--- zzzz-none-000/linux-4.1.52/net/bridge/br_sysfs_br.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/net/bridge/br_sysfs_br.c 2022-03-02 11:37:13.000000000 +0000 @@ -22,6 +22,13 @@ #include "br_private.h" +#if defined(CONFIG_BCM_KF_RUNNER) +#if defined(CONFIG_BCM_RDPA_BRIDGE) || defined(CONFIG_BCM_RDPA_BRIDGE_MODULE) +#include "br_fp.h" +#include "br_fp_hooks.h" +#endif +#endif + #define to_dev(obj) container_of(obj, struct device, kobj) #define to_bridge(cd) ((struct net_bridge *)netdev_priv(to_net_dev(cd))) @@ -103,6 +110,9 @@ static int set_ageing_time(struct net_bridge *br, unsigned long val) { br->ageing_time = clock_t_to_jiffies(val); +#if defined(CONFIG_BCM_KF_RUNNER) + mod_timer(&br->gc_timer, round_jiffies_up(jiffies + br->ageing_time)); +#endif return 0; } @@ -743,6 +753,111 @@ static DEVICE_ATTR_RW(default_pvid); #endif +#if defined(CONFIG_BCM_KF_BRIDGE_COUNTERS) +static ssize_t show_mac_entry_discard_counter(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct net_bridge *br = to_bridge(d); + return sprintf(buf, "%u\n", br->mac_entry_discard_counter); +} + +static int set_mac_entry_discard_counter(struct net_bridge *br, unsigned long val) +{ + br->mac_entry_discard_counter = val; + return 0; +} + +static ssize_t store_mac_entry_discard_counter(struct device *d, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return store_bridge_parm(d, buf, len, set_mac_entry_discard_counter); +} +static DEVICE_ATTR(mac_entry_discard_counter, S_IRUGO | S_IWUSR, show_mac_entry_discard_counter, + store_mac_entry_discard_counter); +#endif + +#if defined(CONFIG_BCM_KF_BRIDGE_MAC_FDB_LIMIT) && defined(CONFIG_BCM_BRIDGE_MAC_FDB_LIMIT) +static ssize_t max_fdb_entries_show(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct net_bridge *br = to_bridge(d); + return sprintf(buf, "%d\n", br->max_br_fdb_entries); +} + +static int set_max_fdb_entries(struct net_bridge *br, unsigned long val) +{ + spin_lock_bh(&br->lock); + br_set_fdb_limit(br, NULL, 0, 0, (int)val); + spin_unlock_bh(&br->lock); + return 0; +} + +static ssize_t max_fdb_entries_store(struct device *d, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return store_bridge_parm(d, buf, len, set_max_fdb_entries); +} +static DEVICE_ATTR_RW(max_fdb_entries); + +static ssize_t used_fdb_entries_show(struct device *d, struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%d\n", to_bridge(d)->used_br_fdb_entries); +} +static DEVICE_ATTR_RO(used_fdb_entries); +#endif + +#if defined(CONFIG_BCM_KF_LOCAL_SWITCHING_DISABLE) +static ssize_t local_switching_disable_show(struct device *d, + struct device_attribute *attr, + char *buf) +{ + struct net_bridge *br = to_bridge(d); + return sprintf(buf, "%d\n", br->local_switching_disable); +} + +int br_local_switching_disable(struct net_bridge *br, unsigned long val) +{ + br->local_switching_disable = val; +#if defined(CONFIG_BCM_KF_RUNNER) +#if defined(CONFIG_BCM_RDPA_BRIDGE) || defined(CONFIG_BCM_RDPA_BRIDGE_MODULE) + return br_fp_hook(BR_FP_LOCAL_SWITCHING_DISABLE, br, NULL); +#endif +#endif + + return -1; +} + +static ssize_t local_switching_disable_store(struct device *d, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return store_bridge_parm(d, buf, len, br_local_switching_disable); +} +static DEVICE_ATTR_RW(local_switching_disable); +#endif + +#if defined(CONFIG_BCM_KF_RUNNER) +int br_bridge_type(struct net_bridge *br, unsigned long val) +{ +#if defined(CONFIG_BCM_RDPA_BRIDGE) || defined(CONFIG_BCM_RDPA_BRIDGE_MODULE) + return br_fp_hook(BR_FP_BRIDGE_TYPE, br, (void *)&val); +#endif + + return -1; +} + +static ssize_t bridge_type_store(struct device *d, + struct device_attribute *attr, + const char *buf, size_t len) +{ + return store_bridge_parm(d, buf, len, br_bridge_type); +} +static DEVICE_ATTR_WO(bridge_type); +#endif + static struct attribute *bridge_attrs[] = { &dev_attr_forward_delay.attr, &dev_attr_hello_time.attr, @@ -762,6 +877,9 @@ &dev_attr_topology_change_timer.attr, &dev_attr_gc_timer.attr, &dev_attr_group_addr.attr, +#if defined(CONFIG_BCM_KF_BRIDGE_COUNTERS) + &dev_attr_mac_entry_discard_counter.attr, +#endif &dev_attr_flush.attr, #ifdef CONFIG_BRIDGE_IGMP_SNOOPING &dev_attr_multicast_router.attr, @@ -789,6 +907,16 @@ &dev_attr_vlan_protocol.attr, &dev_attr_default_pvid.attr, #endif +#if defined(CONFIG_BCM_KF_BRIDGE_MAC_FDB_LIMIT) && defined(CONFIG_BCM_BRIDGE_MAC_FDB_LIMIT) + &dev_attr_max_fdb_entries.attr, + &dev_attr_used_fdb_entries.attr, +#endif +#if defined(CONFIG_BCM_KF_LOCAL_SWITCHING_DISABLE) + &dev_attr_local_switching_disable.attr, +#endif +#if defined(CONFIG_BCM_KF_RUNNER) + &dev_attr_bridge_type.attr, +#endif NULL };