Thread (26 messages) 26 messages, 3 authors, 17d ago

Re: [PATCH v2 net-next 06/11] bridge: provide lockless access to p->designated_cost

From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-06-04 10:50:44

On Wed, Jun 03, 2026 at 06:20:38AM +0000, Eric Dumazet wrote:
quoted hunk ↗ jump to hunk
@@ -302,9 +304,10 @@ static int br_should_become_designated_port(const struct net_bridge_port *p)
 	if (memcmp(&p->designated_root, &br->designated_root, 8))
 		return 1;
 
-	if (br->root_path_cost < p->designated_cost)
+	t = br->root_path_cost - READ_ONCE(p->designated_cost);
+	if (t < 0)
 		return 1;
-	else if (br->root_path_cost > p->designated_cost)
+	else if (t > 0)
 		return 0;
Eric, I think you meant:

p_designated_cost = READ_ONCE(p->designated_cost);

if (br->root_path_cost < p_designated_cost)
	return 1;
else if (br->root_path_cost > p_designated_cost)
	return 0;

?
quoted hunk ↗ jump to hunk
 
 	t = memcmp(&br->bridge_id, &p->designated_bridge, 8);
@@ -344,9 +347,10 @@ static int br_supersedes_port_info(const struct net_bridge_port *p,
 	else if (t > 0)
 		return 0;
 
-	if (bpdu->root_path_cost < p->designated_cost)
+	t = bpdu->root_path_cost < READ_ONCE(p->designated_cost);
+	if (t < 0)
 		return 1;
-	else if (bpdu->root_path_cost > p->designated_cost)
+	else if (t > 0)
 		return 0;
Similarly here?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help