Skip to content

Commit 4cf5fd8

Browse files
pmachatakuba-moo
authored andcommitted
net: bridge: BROPT_FDB_LOCAL_VLAN_0: On port changeaddr, skip per-VLAN FDBs
When BROPT_FDB_LOCAL_VLAN_0 is enabled, the local FDB entries for member ports should not be created per-VLAN, but instead only on VLAN 0. When the member port address changes, the local FDB entries need to be updated, which is done in br_fdb_changeaddr(). Under the VLAN-0 mode, only one local FDB entry will ever be added for a port's address, and that on VLAN 0. Thus bail out of the delete loop early. For the same reason, also skip adding the per-VLAN entries. Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/0cf9d41836d2a245b0ce07e1a16ee05ca506cbe9.1757004393.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 60d6be0 commit 4cf5fd8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/bridge/br_fdb.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
459459
struct net_bridge_fdb_entry *f;
460460
struct net_bridge *br = p->br;
461461
struct net_bridge_vlan *v;
462+
bool local_vlan_0;
463+
464+
local_vlan_0 = br_opt_get(br, BROPT_FDB_LOCAL_VLAN_0);
462465

463466
spin_lock_bh(&br->hash_lock);
464467
vg = nbp_vlan_group(p);
@@ -468,11 +471,11 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
468471
/* delete old one */
469472
fdb_delete_local(br, p, f);
470473

471-
/* if this port has no vlan information
472-
* configured, we can safely be done at
473-
* this point.
474+
/* if this port has no vlan information configured, or
475+
* local entries are only kept on VLAN 0, we can safely
476+
* be done at this point.
474477
*/
475-
if (!vg || !vg->num_vlans)
478+
if (!vg || !vg->num_vlans || local_vlan_0)
476479
goto insert;
477480
}
478481
}
@@ -481,7 +484,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
481484
/* insert new address, may fail if invalid address or dup. */
482485
fdb_add_local(br, p, newaddr, 0);
483486

484-
if (!vg || !vg->num_vlans)
487+
if (!vg || !vg->num_vlans || local_vlan_0)
485488
goto done;
486489

487490
/* Now add entries for every VLAN configured on the port.

0 commit comments

Comments
 (0)