mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
bridge: provide lockless access to p->priority
sysfs show_priority() needs this. Also br_port_fill_attrs() might in the future run without RTNL. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20260604141343.2124500-9-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
009b1dc8bf
commit
abe46dbe52
|
|
@ -239,7 +239,7 @@ static int br_port_fill_attrs(struct sk_buff *skb,
|
|||
u64 timerval;
|
||||
|
||||
if (nla_put_u8(skb, IFLA_BRPORT_STATE, p->state) ||
|
||||
nla_put_u16(skb, IFLA_BRPORT_PRIORITY, p->priority) ||
|
||||
nla_put_u16(skb, IFLA_BRPORT_PRIORITY, READ_ONCE(p->priority)) ||
|
||||
nla_put_u32(skb, IFLA_BRPORT_COST, READ_ONCE(p->path_cost)) ||
|
||||
nla_put_u8(skb, IFLA_BRPORT_MODE, mode) ||
|
||||
nla_put_u8(skb, IFLA_BRPORT_GUARD, !!(p->flags & BR_BPDU_GUARD)) ||
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ int br_stp_set_port_priority(struct net_bridge_port *p, unsigned long newprio)
|
|||
WRITE_ONCE(p->designated_port, new_port_id);
|
||||
|
||||
p->port_id = new_port_id;
|
||||
p->priority = newprio;
|
||||
WRITE_ONCE(p->priority, newprio);
|
||||
if (!memcmp(&p->br->bridge_id, &p->designated_bridge, 8) &&
|
||||
p->port_id < p->designated_port) {
|
||||
br_become_designated_port(p);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static BRPORT_ATTR(path_cost, 0644, show_path_cost, store_path_cost);
|
|||
|
||||
static ssize_t show_priority(struct net_bridge_port *p, char *buf)
|
||||
{
|
||||
return sysfs_emit(buf, "%d\n", p->priority);
|
||||
return sysfs_emit(buf, "%d\n", READ_ONCE(p->priority));
|
||||
}
|
||||
|
||||
static int store_priority(struct net_bridge_port *p, unsigned long v)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user