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

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

From: Eric Dumazet <edumazet@google.com>
Date: 2026-06-04 13:26:58

On Thu, Jun 4, 2026 at 3:50 AM Ido Schimmel [off-list ref] wrote:
On Wed, Jun 03, 2026 at 06:20:38AM +0000, Eric Dumazet wrote:
quoted
@@ -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
      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?
Oh well, time for a V3 I guess.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help