--- zzzz-none-000/linux-4.19.183/net/bridge/br_fdb.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/net/bridge/br_fdb.c 2023-06-28 08:54:21.000000000 +0000 @@ -28,6 +28,12 @@ #include #include "br_private.h" +#if defined(CONFIG_BCM_KF_BR_HOOKS) +#include +#endif + +#include + static const struct rhashtable_params br_fdb_rht_params = { .head_offset = offsetof(struct net_bridge_fdb_entry, rhnode), .key_offset = offsetof(struct net_bridge_fdb_entry, key), @@ -80,8 +86,12 @@ static inline int has_expired(const struct net_bridge *br, const struct net_bridge_fdb_entry *fdb) { +#if defined(CONFIG_BCM_KF_BR_HOOKS) + return bcm_br_has_fdb_expired(br, fdb); +#else return !fdb->is_static && !fdb->added_by_external_learn && time_before_eq(fdb->updated + hold_time(br), jiffies); +#endif } static void fdb_rcu_free(struct rcu_head *head) @@ -353,7 +363,13 @@ if (f->is_static || f->added_by_external_learn) continue; + +#if defined(CONFIG_BCM_KF_BR_HOOKS) + bcm_br_fdb_cleanup(f, now, delay); +#endif + this_timer = f->updated + delay; + if (time_after(this_timer, now)) { work_delay = min(work_delay, this_timer - now); } else { @@ -505,6 +521,9 @@ fdb->added_by_external_learn = 0; fdb->offloaded = 0; fdb->updated = fdb->used = jiffies; +#if defined(CONFIG_BCM_KF_BR_HOOKS) + bcm_br_fdb_init(fdb); +#endif if (rhashtable_lookup_insert_fast(&br->fdb_hash_tbl, &fdb->rhnode, br_fdb_rht_params)) { @@ -583,6 +602,9 @@ } else { unsigned long now = jiffies; +#if defined(CONFIG_BCM_KF_BR_HOOKS) + bcm_br_fdb_update(fdb, source); +#endif /* fastpath: update of existing entry */ if (unlikely(source != fdb->dst)) { fdb->dst = source; @@ -663,6 +685,9 @@ goto nla_put_failure; ci.ndm_used = jiffies_to_clock_t(now - fdb->used); ci.ndm_confirmed = 0; +#if defined(CONFIG_BCM_KF_BR_HOOKS) + bcm_br_fdb_fill_info(fdb); +#endif ci.ndm_updated = jiffies_to_clock_t(now - fdb->updated); ci.ndm_refcnt = 0; if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) @@ -697,9 +722,20 @@ struct sk_buff *skb; int err = -ENOBUFS; +#if defined(CONFIG_BCM_KF_BR_HOOKS) + bcm_br_fdb_notify(br, fdb, type, swdev_notify); +#endif /* CONFIG_BCM_KF_BR_HOOKS */ + if (swdev_notify) br_switchdev_fdb_notify(fdb, type); + /* fdb changed port or was deleted, must cancel any existing bypass. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0) + avm_pa_flush_sessions_for_mac(fdb->addr.addr); +#else + avm_pa_flush_sessions_for_mac(fdb->key.addr.addr); +#endif + skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC); if (skb == NULL) goto errout;