--- zzzz-none-000/linux-4.1.38/net/bridge/br_private.h 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/net/bridge/br_private.h 2020-11-25 10:06:48.000000000 +0000 @@ -20,9 +20,23 @@ #include #include +#if defined(CONFIG_BCM_KF_RUNNER) +#if defined(CONFIG_BCM_RDPA) || defined(CONFIG_BCM_RDPA_MODULE) +#if defined(CONFIG_BCM_RDPA_BRIDGE) || defined(CONFIG_BCM_RDPA_BRIDGE_MODULE) +#include "br_fp.h" +#endif /* CONFIG_BCM_RDPA_BRIDGE || CONFIG_BCM_RDPA_BRIDGE_MODULE */ +#endif /* CONFIG_BCM_RUNNER */ +#endif /* CONFIG_BCM_KF_RUNNER */ + + #define BR_HASH_BITS 8 #define BR_HASH_SIZE (1 << BR_HASH_BITS) +#if (defined(CONFIG_BCM_MCAST) || defined(CONFIG_BCM_MCAST_MODULE)) && defined(CONFIG_BCM_KF_MCAST) +extern br_bcm_mcast_receive_hook br_bcm_mcast_receive; +extern br_bcm_mcast_should_deliver_hook br_bcm_mcast_should_deliver; +#endif + #define BR_HOLD_TIME (1*HZ) #define BR_PORT_BITS 10 @@ -31,6 +45,10 @@ #define BR_VERSION "2.3" +#if defined(CONFIG_BCM_KF_NETFILTER) +#define BR_MAX_FDB_ENTRIES 4096 +#endif + /* Control of forwarding link local multicast */ #define BR_GROUPFWD_DEFAULT 0 /* Don't allow forwarding control protocols like STP and LLDP */ @@ -102,9 +120,11 @@ is_static:1, added_by_user:1, added_by_external_learn:1; +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + unsigned int fdb_key; +#endif __u16 vlan_id; }; - struct net_bridge_port_group { struct net_bridge_port *port; struct net_bridge_port_group __rcu *next; @@ -156,7 +176,6 @@ u32 path_cost; u32 designated_cost; unsigned long designated_age; - struct timer_list forward_delay_timer; struct timer_list hold_timer; struct timer_list message_age_timer; @@ -165,6 +184,18 @@ unsigned long flags; + +#if defined(CONFIG_BCM_KF_STP_LOOP) && (defined(CONFIG_BCM_FBOND) || defined(CONFIG_BCM_FBOND_MODULE)) + struct { + /* The following is set if the port is singular (only connects to one other device), and + if that other device is guarenteed to support STP. When set, the port will not enter + forwarding state until it has received at least one bpdu */ + int is_dedicated_stp_port : 1; + int is_bpdu_blocked : 1; // used for debugging. When set, do not send bpdus + int unused1 : 6; + }; +#endif + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING struct bridge_mcast_own_query ip4_own_query; #if IS_ENABLED(CONFIG_IPV6) @@ -186,6 +217,12 @@ #ifdef CONFIG_BRIDGE_VLAN_FILTERING struct net_port_vlans __rcu *vlan_info; #endif + +#if defined(CONFIG_BCM_KF_BRIDGE_MAC_FDB_LIMIT) && defined(CONFIG_BCM_BRIDGE_MAC_FDB_LIMIT) + int num_port_fdb_entries; + int max_port_fdb_entries; + int min_port_fdb_entries; +#endif }; #define br_auto_port(p) ((p)->flags & BR_AUTO_MASK) @@ -211,6 +248,12 @@ struct net_device *dev; struct pcpu_sw_netstats __percpu *stats; +#if defined(CONFIG_BCM_KF_BRIDGE_COUNTERS) + u32 mac_entry_discard_counter; +#endif +#if defined(CONFIG_BCM_KF_BLOG) && defined(CONFIG_BLOG) + struct rtnl_link_stats64 c_b_stats; /* Cumulative Blog stats (rx-bytes, tx-pkts, etc...) */ +#endif spinlock_t hash_lock; struct hlist_head hash[BR_HASH_SIZE]; #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) @@ -219,6 +262,16 @@ bool nf_call_ip6tables; bool nf_call_arptables; #endif + +#if defined(CONFIG_BCM_KF_NETFILTER) + int num_fdb_entries; +#endif + +#if defined(CONFIG_BCM_KF_BRIDGE_MAC_FDB_LIMIT) && defined(CONFIG_BCM_BRIDGE_MAC_FDB_LIMIT) + int max_br_fdb_entries; + int used_br_fdb_entries; +#endif + u16 group_fwd_mask; u16 group_fwd_mask_required; @@ -294,6 +347,19 @@ u16 default_pvid; struct net_port_vlans __rcu *vlan_info; #endif + +#if defined(CONFIG_BCM_KF_RUNNER) +#if defined(CONFIG_BCM_RDPA) || defined(CONFIG_BCM_RDPA_MODULE) +#if defined(CONFIG_BCM_RDPA_BRIDGE) || defined(CONFIG_BCM_RDPA_BRIDGE_MODULE) + struct br_fp_data fp_hooks; +#endif /* CONFIG_BCM_RDPA_BRIDGE || CONFIG_BCM_RDPA_BRIDGE_MODULE */ +#endif /* CONFIG_BCM_RUNNER */ +#endif /* CONFIG_BCM_KF_RUNNER */ +#if defined(CONFIG_BCM_KF_INTF_BRG) && defined(CONFIG_BCM_INTF_BRG_ENABLED) + u16 lan_port_num; + u16 wan_port_num; +#endif /* CONFIG_BCM_KF_INTF_BRG && CONFIG_BCM_INTF_BRG_ENABLED */ + }; struct br_input_skb_cb { @@ -306,6 +372,7 @@ u16 frag_max_size; bool proxyarp_replied; + bool src_port_isolated; #ifdef CONFIG_BRIDGE_VLAN_FILTERING bool vlan_filtered; @@ -408,6 +475,14 @@ int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, const unsigned char *addr, u16 vid); +#if defined(CONFIG_BCM_KF_BRIDGE_MAC_FDB_LIMIT) && defined(CONFIG_BCM_BRIDGE_MAC_FDB_LIMIT) +int br_set_fdb_limit(struct net_bridge *br, + struct net_bridge_port *p, + int lmt_type, + int is_min, + int fdb_limit); +#endif + /* br_forward.c */ void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb); int br_dev_queue_push_xmit(struct sock *sk, struct sk_buff *skb); @@ -418,7 +493,64 @@ void br_flood_forward(struct net_bridge *br, struct sk_buff *skb, struct sk_buff *skb2, bool unicast); +/* return true if both source port and dest port are isolated */ +static inline bool br_skb_isolated(const struct net_bridge_port *to, + const struct sk_buff *skb) +{ + return BR_INPUT_SKB_CB(skb)->src_port_isolated && + (to->flags & BR_ISOLATED); +} + /* br_if.c */ +#if defined(CONFIG_BCM_KF_INTF_BRG) && defined(CONFIG_BCM_INTF_BRG_ENABLED) +static inline void br_port_num_inc(struct net_bridge *br, struct net_bridge_port *p) +{ +#if defined(CONFIG_BCM_KF_WANDEV) + if ((p->dev->priv_flags & IFF_WANDEV) || (p->dev->priv_flags & IFF_EPON_IF)) + { + br->wan_port_num++; + } + else +#endif + { + br->lan_port_num++; + } +} + +static inline void br_port_num_dec(struct net_bridge *br, struct net_bridge_port *p) +{ +#if defined(CONFIG_BCM_KF_WANDEV) + if ((p->dev->priv_flags & IFF_WANDEV) || (p->dev->priv_flags & IFF_EPON_IF)) + { + br->wan_port_num--; + } + else +#endif + { + br->lan_port_num--; + } +} + +static inline bool is_interface_br(struct net_bridge *br, struct sk_buff *skb) +{ + struct net_bridge_port *pin; + + if (!skb->dev) + { + return 0; + } + + pin = br_port_get_rcu(skb->dev); + if ((!pin) || (!pin->dev)) + { + return 0; + } + + return ((br->lan_port_num == 1) && (br->wan_port_num == 1)); +} + +#endif /* CONFIG_BCM_KF_INTF_BRG && CONFIG_BCM_INTF_BRG_ENABLED */ + void br_port_carrier_check(struct net_bridge_port *p); int br_add_bridge(struct net *net, const char *name); int br_del_bridge(struct net *net, const char *name); @@ -798,6 +930,9 @@ void br_stp_set_enabled(struct net_bridge *br, unsigned long val); void br_stp_enable_port(struct net_bridge_port *p); void br_stp_disable_port(struct net_bridge_port *p); +#if defined(CONFIG_BCM_KF_BRIDGE_STP) +void br_stp_off_port(struct net_bridge_port *p); +#endif bool br_stp_recalculate_bridge_id(struct net_bridge *br); void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *a); void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio); @@ -848,4 +983,13 @@ static inline void br_sysfs_delbr(struct net_device *dev) { return; } #endif /* CONFIG_SYSFS */ +#if defined(CONFIG_BCM_KF_BRIDGE_STP) +/* br_notifier.c */ +extern void br_stp_notify_state_port(const struct net_bridge_port *p); +extern void br_stp_notify_state_bridge(const struct net_bridge *br); +#endif +#if defined(CONFIG_BCM_KF_BRIDGE_PORT_ISOLATION) +extern void br_dev_notify_if_change(char *brName); +#endif + #endif