--- zzzz-none-000/linux-4.9.279/net/bridge/br_fdb.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/net/bridge/br_fdb.c 2023-02-08 11:43:43.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,11 @@ #include #include #include "br_private.h" +#ifdef CONFIG_INTEL_MAX_BRIDGE_MACS_LIMIT +static int fdb_insert_cnt = 0; +#endif + +#include static struct kmem_cache *br_fdb_cache __read_mostly; static struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head, @@ -157,6 +163,11 @@ hlist_del_rcu(&f->hlist); fdb_notify(br, f, RTM_DELNEIGH); call_rcu(&f->rcu, fdb_rcu_free); +#ifdef CONFIG_INTEL_MAX_BRIDGE_MACS_LIMIT + if (fdb_insert_cnt >= 1) { + fdb_insert_cnt--; + } +#endif } /* Delete a local entry if no other port had the same address. */ @@ -310,7 +321,16 @@ continue; this_timer = f->updated + delay; if (time_before_eq(this_timer, jiffies)) + { +#ifdef CONFIG_TI_PACKET_PROCESSOR + if(!f->is_local) + ti_hil_pp_event(TI_BRIDGE_FDB_DELETED, (void*)f); + if (!(f->ti_pp_fdb_status & TI_PP_FDB_ACTIVE)) fdb_delete(br, f); +#else + fdb_delete(br, f); +#endif + } else if (time_before(this_timer, next_timer)) next_timer = this_timer; } @@ -504,6 +524,12 @@ { struct net_bridge_fdb_entry *fdb; +#ifdef CONFIG_INTEL_MAX_BRIDGE_MACS_LIMIT + if (fdb_insert_cnt >= CONFIG_INTEL_MAX_BRIDGE_MACS) { + printk(KERN_WARNING "\n fdb_create reached max bridge macs limit \n"); + return 0; + } +#endif fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC); if (fdb) { memcpy(fdb->addr.addr, addr, ETH_ALEN); @@ -514,7 +540,17 @@ fdb->added_by_user = 0; fdb->added_by_external_learn = 0; fdb->updated = fdb->used = jiffies; +#ifdef CONFIG_TI_PACKET_PROCESSOR + fdb->ti_pp_fdb_status = TI_PP_FDB_INACTIVE; +#endif hlist_add_head_rcu(&fdb->hlist, head); +#ifdef CONFIG_TI_PACKET_PROCESSOR + if (!fdb->is_local) + ti_hil_pp_event(TI_BRIDGE_FDB_CREATED, (void *)fdb); +#endif +#ifdef CONFIG_INTEL_MAX_BRIDGE_MACS_LIMIT + fdb_insert_cnt++; +#endif } return fdb; } @@ -593,6 +629,9 @@ fdb_modified = true; } fdb->updated = jiffies; +#ifdef CONFIG_TI_PACKET_PROCESSOR + ti_hil_pp_event(TI_BRIDGE_FDB_CREATED, (void *)fdb); +#endif if (unlikely(added_by_user)) fdb->added_by_user = 1; if (unlikely(fdb_modified)) @@ -688,6 +727,9 @@ struct sk_buff *skb; int err = -ENOBUFS; + /* fdb changed port or was deleted, must cancel any existing bypass. */ + avm_pa_flush_sessions_for_mac(fdb->addr.addr); + skb = nlmsg_new(fdb_nlmsg_size(), GFP_ATOMIC); if (skb == NULL) goto errout; @@ -984,6 +1026,33 @@ return err; } +#if IS_ENABLED(CONFIG_DIRECTCONNECT_DP_API) +int dc_dp_br_fdb_delete(struct net_device *dev, const unsigned char *addr) +{ + struct net_bridge_port *p; + int err = 0; + + if (!dev) + return -EINVAL; + + if (!br_port_exists(dev)) + return -EINVAL; + + rcu_read_lock(); + p = br_port_get_rcu(dev); + if (p) { + if (addr) + err = __br_fdb_delete(p, addr, 0); + else + br_fdb_delete_by_port(p->br, p, 0, 0); + } + rcu_read_unlock(); + + return err; +} +EXPORT_SYMBOL(dc_dp_br_fdb_delete); +#endif + /* Remove neighbor entry with RTM_DELNEIGH */ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], struct net_device *dev,