--- zzzz-none-000/linux-4.9.279/net/bridge/br_private.h 2021-08-08 06:38:54.000000000 +0000 +++ puma7-atom-6591-750/linux-4.9.279/net/bridge/br_private.h 2023-02-08 11:43:43.000000000 +0000 @@ -19,8 +19,10 @@ #include #include #include +#include /* struct inet_skb_param */ #include #include +#include #define BR_HASH_BITS 8 #define BR_HASH_SIZE (1 << BR_HASH_BITS) @@ -42,6 +44,11 @@ /* Path to usermode spanning tree program */ #define BR_STP_PROG "/sbin/bridge-stp" +#ifdef CONFIG_TI_PACKET_PROCESSOR +#define TI_PP_FDB_INACTIVE 0x0 +#define TI_PP_FDB_ACTIVE 0x1 +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + typedef struct bridge_id bridge_id; typedef struct mac_addr mac_addr; typedef __u16 port_id; @@ -163,9 +170,14 @@ is_static:1, added_by_user:1, added_by_external_learn:1; +#ifdef CONFIG_TI_PACKET_PROCESSOR + int ti_pp_session_handle; + int ti_pp_fdb_status; +#endif /* CONFIG_TI_PACKET_PROCESSOR */ struct rcu_head rcu; }; + #define MDB_PG_FLAGS_PERMANENT BIT(0) #define MDB_PG_FLAGS_OFFLOAD BIT(1) @@ -177,6 +189,7 @@ struct timer_list timer; struct br_ip addr; unsigned char flags; + unsigned char eth_addr[ETH_ALEN]; }; struct net_bridge_mdb_entry @@ -200,6 +213,65 @@ u32 secret; u32 ver; }; +#ifdef CONFIG_LTQ_MCAST_SNOOPING + +typedef enum { + IPV4 = 0, + IPV6, +} ptype_t; + +struct ipaddr { + ptype_t type; + union { + struct in_addr ip4; + struct in6_addr ip6; + } addr; +}; + +typedef struct ipaddr ipaddr_t; + +enum igmp_ver { + IGMPV1 = 1, + IGMPV2, + IGMPV3, +}; + +enum mld_ver { + MLDV1 = 1, + MLDV2, +}; + +/* Set router port ioctl request */ +struct router_port { + ptype_t type; + u32 if_index; /* interface index */ + u32 expires; /* expiry time */ +}; + +/* Multicast group record ioctl request */ +struct br_grp_rec { + u32 if_index; /* interface index */ + ipaddr_t gaddr; /* Group address */ + u32 filter_mode; /* Filter mode */ + u32 compat; /* Compatibility mode */ + u32 nsrc; /* number of sources */ + ipaddr_t slist[0]; /* source list */ +}; + +struct net_bridge_mg_entry +{ + struct hlist_node hlist; + ipaddr_t gaddr; /* Group ipaddr */ + u8 filter_mode; /* 0 = EX, 1 = IN */ + u8 compat_mode; /* 1 = v1, 2 = v2, 3 = v3 */ + struct net_bridge_port *port; + struct rcu_head rcu; + u32 saddr_cnt; + ipaddr_t saddr[0]; /* Array of src ipaddr */ +}; + +#endif /* CONFIG_LTQ_MCAST_SNOOPING */ + struct net_bridge_port { @@ -229,6 +301,17 @@ unsigned long flags; +#ifdef CONFIG_LTQ_MCAST_SNOOPING + u32 mghash_secret; + u32 mghash_secret6; + spinlock_t mghash_lock; + struct hlist_head mghash[BR_HASH_SIZE]; + u8 igmp_router_port; + struct timer_list igmp_router_timer; + u8 mld_router_port; + struct timer_list mld_router_timer; +#endif /* CONFIG_LTQ_MCAST_SNOOPING */ + #ifdef CONFIG_BRIDGE_IGMP_SNOOPING struct bridge_mcast_own_query ip4_own_query; #if IS_ENABLED(CONFIG_IPV6) @@ -272,6 +355,15 @@ rtnl_dereference(dev->rx_handler_data) : NULL; } +#ifdef CONFIG_TI_L2_SELECTIVE_PACKET_HANDLING +struct l2_sph +{ + int (*packet_handler)(struct sk_buff *skb); + int priority; + struct l2_sph *prev; + struct l2_sph *next; +}; +#endif /* CONFIG_TI_L2_SELECTIVE_PACKET_HANDLING */ struct net_bridge { spinlock_t lock; @@ -289,6 +381,20 @@ bool nf_call_iptables; bool nf_call_ip6tables; bool nf_call_arptables; + /* These non-standard parameters allow disabling the bridge-netfilter hooks + even if those hooks are enabled globally. This is to support special bridge + configurations which NEED to bypass the bridge-netfilter hooks, for example + to avoid fragmented packets being reassembled and re-fragmented, and to + avoid negative performance impact from unecessarily calling those hooks */ + bool nf_disable_iptables; + bool nf_disable_ip6tables; + bool nf_disable_arptables; +#endif +#ifdef CONFIG_AVM_BRIDGE_FLOOD_RATELIMITER + atomic_t avm_flood_credits; + int avm_flood_credits_max; + int avm_flood_credits_recov_rate; + struct timer_list avm_flood_rl_timer; #endif u16 group_fwd_mask; u16 group_fwd_mask_required; @@ -333,6 +439,8 @@ u32 multicast_last_member_count; u32 multicast_startup_query_count; + u8 multicast_igmp_version; + unsigned long multicast_last_member_interval; unsigned long multicast_membership_interval; unsigned long multicast_querier_interval; @@ -353,6 +461,7 @@ struct bridge_mcast_other_query ip6_other_query; struct bridge_mcast_own_query ip6_own_query; struct bridge_mcast_querier ip6_querier; + u8 multicast_mld_version; #endif /* IS_ENABLED(CONFIG_IPV6) */ #endif @@ -366,6 +475,7 @@ #ifdef CONFIG_NET_SWITCHDEV int offload_fwd_mark; #endif + bool mtu_set_by_user; #ifdef CONFIG_BRIDGE_VLAN_FILTERING struct net_bridge_vlan_group __rcu *vlgrp; @@ -374,17 +484,27 @@ __be16 vlan_proto; u16 default_pvid; #endif +#ifdef CONFIG_TI_L2_SELECTIVE_PACKET_HANDLING + struct l2_sph *selective_packet_handler; +#endif /* CONFIG_TI_L2_SELECTIVE_PACKET_HANDLING */ +#ifdef CONFIG_INTEL_L2VPN_L2CP_FORWARD + int (*l2vpn_packet_handler)(struct sk_buff *skb, int *l2vpnRelate); +#endif +#ifdef CONFIG_LTQ_MCAST_SNOOPING + bool this_br_snooping_enabled; +#endif /* CONFIG_LTQ_MCAST_SNOOPING */ }; struct br_input_skb_cb { struct net_device *brdev; - + int frag_max_size; #ifdef CONFIG_BRIDGE_IGMP_SNOOPING int igmp; int mrouters_only; #endif bool proxyarp_replied; + bool src_port_isolated; #ifdef CONFIG_BRIDGE_VLAN_FILTERING bool vlan_filtered; @@ -529,13 +649,21 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb, enum br_pkt_type pkt_type, bool local_rcv, bool local_orig); +/* 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 */ 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); int br_add_if(struct net_bridge *br, struct net_device *dev); int br_del_if(struct net_bridge *br, struct net_device *dev); -int br_min_mtu(const struct net_bridge *br); +void br_mtu_auto_adjust(struct net_bridge *br); netdev_features_t br_features_recompute(struct net_bridge *br, netdev_features_t features); void br_port_flags_change(struct net_bridge_port *port, unsigned long mask); @@ -582,16 +710,20 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val); int br_multicast_set_querier(struct net_bridge *br, unsigned long val); int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val); +int br_multicast_set_igmp_version(struct net_bridge *br, unsigned long val); +#if IS_ENABLED(CONFIG_IPV6) +int br_multicast_set_mld_version(struct net_bridge *br, unsigned long val); +#endif struct net_bridge_mdb_entry * br_mdb_ip_get(struct net_bridge_mdb_htable *mdb, struct br_ip *dst); struct net_bridge_mdb_entry * br_multicast_new_group(struct net_bridge *br, struct net_bridge_port *port, struct br_ip *group); -void br_multicast_free_pg(struct rcu_head *head); +void br_multicast_delete_pg(struct net_bridge_port_group *pg); struct net_bridge_port_group * br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, struct net_bridge_port_group __rcu *next, - unsigned char flags); + unsigned char flags, const unsigned char *src); void br_mdb_init(void); void br_mdb_uninit(void); void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, @@ -982,6 +1114,20 @@ #define br_netfilter_rtable_init(x) #endif +/* br_bcast_rl.c */ +#ifdef CONFIG_AVM_BRIDGE_FLOOD_RATELIMITER +int br_flood_rl_init(void); +void br_flood_rl_fini(void); +void br_flood_rl_setup(struct net_bridge *br); +int br_flood_rl_set_credits(struct net_bridge *br, unsigned long v); +unsigned int br_flood_rl(struct net_bridge *br, struct sk_buff *skb, struct net_device *src_dev); +#else +#define br_flood_rl_init() (0) +#define br_flood_rl_fini() do { } while (0) +#define br_flood_rl_setup(br) do { } while (0) +#define br_flood_rl(br, skb, dev) (1) +#endif + /* br_stp.c */ void br_set_state(struct net_bridge_port *p, unsigned int state); struct net_bridge_port *br_get_port(struct net_bridge *br, u16 port_no); @@ -1033,6 +1179,20 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, u32 filter_mask, int nlflags); +#ifdef CONFIG_LTQ_MCAST_SNOOPING +/* br_mcast_snooping.c */ +void br_mcast_port_init(struct net_bridge_port *port); +void br_mcast_port_cleanup(struct net_bridge_port *port); +int br_mg_del_record(struct net_bridge_port *port, ipaddr_t *gaddr); +int br_mg_add_entry(struct net_bridge_port *port, ipaddr_t *gaddr, u8 filter, u8 compat, u32 saddr_cnt, ipaddr_t *saddr); +int br_selective_flood(struct net_bridge_port *p, struct sk_buff *skb); + +extern int bridge_igmp_snooping; +extern int bridge_mld_snooping; +void br_mcast_snoop_init(void); +void br_mcast_snoop_deinit(void); +#endif + #ifdef CONFIG_SYSFS /* br_sysfs_if.c */ extern const struct sysfs_ops brport_sysfs_ops;