--- zzzz-none-000/linux-4.9.279/net/bridge/br_fdb.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-arm-6591-750/linux-4.9.279/net/bridge/br_fdb.c 2023-02-08 10:58:16.000000000 +0000 @@ -11,6 +11,11 @@ * 2 of the License, or (at your option) any later version. */ +/* + * Includes Intel Corporation's changes/modifications dated: [11/07/2011]. + * Changed/modified portions - Copyright © [2011], Intel Corporation. + */ + #include #include #include @@ -18,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +33,10 @@ #include #include "br_private.h" +#ifdef CONFIG_INTEL_MAX_BRIDGE_MACS_LIMIT +static int fdb_insert_cnt = 0; +#endif + static struct kmem_cache *br_fdb_cache __read_mostly; static struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head, const unsigned char *addr, @@ -157,6 +167,12 @@ 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 +326,24 @@ continue; this_timer = f->updated + delay; if (time_before_eq(this_timer, jiffies)) + { +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Generate a HIL Packet Processor event indicating that the FDB entry + * is being deleted. Notifications are sent only for non-local FDB + * entries as local traffic is not accelerated through PP. */ + if(!f->is_local) + ti_hil_pp_event(TI_BRIDGE_FDB_DELETED, (void*)f); + + + /* Check if the PP has a session alive for this FDB entry + * ACTIVE - DONT delete the FDB entry. + * NOT ACTIVE - Delete the FDB entry. */ + 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 +537,13 @@ { 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 +554,26 @@ fdb->added_by_user = 0; fdb->added_by_external_learn = 0; fdb->updated = fdb->used = jiffies; +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Initialize the Status flag to INACTIVE by default. If + * the event TI_BRIDGE_FDB_CREATED is indeed handled, then + * this flag must be set to TI_PP_FDB_ACTIVE so that it + * can be synced up with PP when FDB entry expires in the + * bridge. If the status flag is not set active, it is assumed + * that the TI_BRIDGE_FDB_* events are not handled and thus + * bridge takes complete control over the fdb entry deletion */ + fdb->ti_pp_fdb_status = TI_PP_FDB_INACTIVE; +#endif hlist_add_head_rcu(&fdb->hlist, head); +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Indicate to the HIL layer that a non-local FDB entry has been created. */ + 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 +652,10 @@ fdb_modified = true; } fdb->updated = jiffies; +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Indicate to the HIL layer that an FDB entry has been updated. */ + 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))