Message ID | 20230130173429.3577450-5-netdev@kapio-technology.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ATU and FDB synchronization on locked ports | expand |
On Mon, Jan 30, 2023 at 06:34:28PM +0100, Hans J. Schultz wrote: > Since user added entries in the bridge FDB will get the BR_FDB_OFFLOADED > flag set, we do not want the bridge to age those entries and we want the > entries to be deleted in the bridge upon an SWITCHDEV_FDB_DEL_TO_BRIDGE > event. > > Signed-off-by: Hans J. Schultz <netdev@kapio-technology.com> > --- > net/bridge/br_fdb.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c > index e69a872bfc1d..b0c23a72bc76 100644 > --- a/net/bridge/br_fdb.c > +++ b/net/bridge/br_fdb.c > @@ -537,6 +537,7 @@ void br_fdb_cleanup(struct work_struct *work) > unsigned long this_timer = f->updated + delay; > > if (test_bit(BR_FDB_STATIC, &f->flags) || > + test_bit(BR_FDB_OFFLOADED, &f->flags) || > test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f->flags)) { > if (test_bit(BR_FDB_NOTIFY, &f->flags)) { > if (time_after(this_timer, now)) Looks correct > @@ -1465,7 +1466,9 @@ int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, > spin_lock_bh(&br->hash_lock); > > fdb = br_fdb_find(br, addr, vid); > - if (fdb && test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) > + if (fdb && > + (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags) || > + test_bit(BR_FDB_OFFLOADED, &fdb->flags))) This also looks correct, but the function name is not really accurate anymore. I guess you can keep it as-is unless someone has a better name > fdb_delete(br, fdb, swdev_notify); > else > err = -ENOENT; > -- > 2.34.1 >
On 2023-02-01 19:24, Ido Schimmel wrote: > > This also looks correct, but the function name is not really accurate > anymore. I guess you can keep it as-is unless someone has a better name > >> fdb_delete(br, fdb, swdev_notify); >> else >> err = -ENOENT; >> -- >> 2.34.1 >> I have been wondering if it makes sense to have both external_learn and offloaded flags as they now work pretty much the same seen from the bridge. But as I don't know other switches, I guess there is some good reason to have the two?
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index e69a872bfc1d..b0c23a72bc76 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -537,6 +537,7 @@ void br_fdb_cleanup(struct work_struct *work) unsigned long this_timer = f->updated + delay; if (test_bit(BR_FDB_STATIC, &f->flags) || + test_bit(BR_FDB_OFFLOADED, &f->flags) || test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &f->flags)) { if (test_bit(BR_FDB_NOTIFY, &f->flags)) { if (time_after(this_timer, now)) @@ -1465,7 +1466,9 @@ int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, spin_lock_bh(&br->hash_lock); fdb = br_fdb_find(br, addr, vid); - if (fdb && test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) + if (fdb && + (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags) || + test_bit(BR_FDB_OFFLOADED, &fdb->flags))) fdb_delete(br, fdb, swdev_notify); else err = -ENOENT;
Since user added entries in the bridge FDB will get the BR_FDB_OFFLOADED flag set, we do not want the bridge to age those entries and we want the entries to be deleted in the bridge upon an SWITCHDEV_FDB_DEL_TO_BRIDGE event. Signed-off-by: Hans J. Schultz <netdev@kapio-technology.com> --- net/bridge/br_fdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)