From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
Nikolay Aleksandrov <razor@blackwall.org>,
eric.dumazet@gmail.com, Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 10/11] bridge: provide lockless access to p->config_pending
Date: Thu, 21 May 2026 13:19:15 +0000 [thread overview]
Message-ID: <20260521131916.3627204-11-edumazet@google.com> (raw)
In-Reply-To: <20260521131916.3627204-1-edumazet@google.com>
Needed for sysfs show_config_pending(), BRCTL_GET_PORT_INFO
and upcoming RTNL avoidance in "ip link" dumps (cf br_port_fill_attrs()).
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/bridge/br_ioctl.c | 2 +-
net/bridge/br_netlink.c | 2 +-
net/bridge/br_stp.c | 8 ++++----
net/bridge/br_stp_if.c | 4 ++--
net/bridge/br_sysfs_if.c | 2 +-
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index a017374c6e659498d98c6af3f8d8e46a8b93570e..39f3ffcfa2d33f15cec6e61490100925eefc7e68 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -263,7 +263,7 @@ int br_dev_siocdevprivate(struct net_device *dev, struct ifreq *rq,
p.designated_cost = READ_ONCE(pt->designated_cost);
p.state = pt->state;
p.top_change_ack = pt->topology_change_ack;
- p.config_pending = pt->config_pending;
+ p.config_pending = READ_ONCE(pt->config_pending);
p.message_age_timer_value = br_timer_value(&pt->message_age_timer);
p.forward_delay_timer_value = br_timer_value(&pt->forward_delay_timer);
p.hold_timer_value = br_timer_value(&pt->hold_timer);
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 7b039994d6a2df00a2fc8ca50e45e7db4f392fa7..cc485b929d983ee4faf2541b661cad88896d39ed 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -271,7 +271,7 @@ static int br_port_fill_attrs(struct sk_buff *skb,
nla_put_u16(skb, IFLA_BRPORT_NO, p->port_no) ||
nla_put_u8(skb, IFLA_BRPORT_TOPOLOGY_CHANGE_ACK,
p->topology_change_ack) ||
- nla_put_u8(skb, IFLA_BRPORT_CONFIG_PENDING, p->config_pending) ||
+ nla_put_u8(skb, IFLA_BRPORT_CONFIG_PENDING, READ_ONCE(p->config_pending)) ||
nla_put_u8(skb, IFLA_BRPORT_VLAN_TUNNEL, !!(p->flags &
BR_VLAN_TUNNEL)) ||
nla_put_u16(skb, IFLA_BRPORT_GROUP_FWD_MASK, p->group_fwd_mask) ||
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 4c364a7f0f53f4f9360887b93bfbc592c738e311..4db0b21b50ccd908b5fe8c70d77daa1afaee550d 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -215,7 +215,7 @@ void br_transmit_config(struct net_bridge_port *p)
struct net_bridge *br;
if (timer_pending(&p->hold_timer)) {
- p->config_pending = 1;
+ WRITE_ONCE(p->config_pending, 1);
return;
}
@@ -242,7 +242,7 @@ void br_transmit_config(struct net_bridge_port *p)
if (bpdu.message_age < br->max_age) {
br_send_config_bpdu(p, &bpdu);
p->topology_change_ack = 0;
- p->config_pending = 0;
+ WRITE_ONCE(p->config_pending, 0);
if (p->br->stp_enabled == BR_KERNEL_STP)
mod_timer(&p->hold_timer,
round_jiffies(jiffies + BR_HOLD_TIME));
@@ -483,14 +483,14 @@ void br_port_state_selection(struct net_bridge *br)
/* Don't change port states if userspace is handling STP */
if (br->stp_enabled != BR_USER_STP) {
if (p->port_no == br->root_port) {
- p->config_pending = 0;
+ WRITE_ONCE(p->config_pending, 0);
p->topology_change_ack = 0;
br_make_forwarding(p);
} else if (br_is_designated_port(p)) {
timer_delete(&p->message_age_timer);
br_make_forwarding(p);
} else {
- p->config_pending = 0;
+ WRITE_ONCE(p->config_pending, 0);
p->topology_change_ack = 0;
br_make_blocking(p);
}
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 8a418f6af423ccba88fae57d2254e35e1ae4a1a0..a7e5422eb5d140b501a7dcebf0238d5a77c5f4a1 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -38,7 +38,7 @@ void br_init_port(struct net_bridge_port *p)
br_become_designated_port(p);
br_set_state(p, BR_STATE_BLOCKING);
p->topology_change_ack = 0;
- p->config_pending = 0;
+ WRITE_ONCE(p->config_pending, 0);
err = __set_ageing_time(p->dev, p->br->ageing_time);
if (err)
@@ -105,7 +105,7 @@ void br_stp_disable_port(struct net_bridge_port *p)
br_become_designated_port(p);
br_set_state(p, BR_STATE_DISABLED);
p->topology_change_ack = 0;
- p->config_pending = 0;
+ WRITE_ONCE(p->config_pending, 0);
br_ifinfo_notify(RTM_NEWLINK, NULL, p);
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index af17f62e95aaff320f8407aa7b50244573ecdc00..58ba535da4e5f473be6c6eec21ce1c71f4bf97c9 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -142,7 +142,7 @@ static BRPORT_ATTR(change_ack, 0444, show_change_ack, NULL);
static ssize_t show_config_pending(struct net_bridge_port *p, char *buf)
{
- return sysfs_emit(buf, "%d\n", p->config_pending);
+ return sysfs_emit(buf, "%d\n", READ_ONCE(p->config_pending));
}
static BRPORT_ATTR(config_pending, 0444, show_config_pending, NULL);
--
2.54.0.669.g59709faab0-goog
next prev parent reply other threads:[~2026-05-21 13:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 13:19 [PATCH net-next 00/11] bridge: prepare lockless br_port_fill_attrs() (I) Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 01/11] bridge: add a READ_ONCE() in br_timer_value() Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 02/11] bridge: add bridge_flags_bit enum Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 03/11] bridge: use BR_PROMISC_BIT Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 04/11] bridge: use BR_ADMIN_COST_BIT Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 05/11] bridge: provide lockless access to p->path_cost Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 06/11] bridge: provide lockless access to p->designated_cost Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 07/11] bridge: provide lockless access to p->designated_port Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 08/11] bridge: provide lockless access to p->priority Eric Dumazet
2026-05-21 13:19 ` [PATCH net-next 09/11] bridge: provide lockless access to p->port_id Eric Dumazet
2026-05-21 13:19 ` Eric Dumazet [this message]
2026-05-21 13:19 ` [PATCH net-next 11/11] bridge: read p->flags once in br_port_fill_attrs() Eric Dumazet
2026-05-22 8:45 ` [PATCH net-next 00/11] bridge: prepare lockless br_port_fill_attrs() (I) Ido Schimmel
2026-05-22 9:31 ` Eric Dumazet
2026-05-22 9:32 ` Nikolay Aleksandrov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260521131916.3627204-11-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox