aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_private.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-12 17:27:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-12 17:27:40 -0400
commitf9da455b93f6ba076935b4ef4589f61e529ae046 (patch)
tree3c4e69ce1ba1d6bf65915b97a76ca2172105b278 /net/bridge/br_private.h
parent0e04c641b199435f3779454055f6a7de258ecdfc (diff)
parente5eca6d41f53db48edd8cf88a3f59d2c30227f8e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Seccomp BPF filters can now be JIT'd, from Alexei Starovoitov. 2) Multiqueue support in xen-netback and xen-netfront, from Andrew J Benniston. 3) Allow tweaking of aggregation settings in cdc_ncm driver, from Bjørn Mork. 4) BPF now has a "random" opcode, from Chema Gonzalez. 5) Add more BPF documentation and improve test framework, from Daniel Borkmann. 6) Support TCP fastopen over ipv6, from Daniel Lee. 7) Add software TSO helper functions and use them to support software TSO in mvneta and mv643xx_eth drivers. From Ezequiel Garcia. 8) Support software TSO in fec driver too, from Nimrod Andy. 9) Add Broadcom SYSTEMPORT driver, from Florian Fainelli. 10) Handle broadcasts more gracefully over macvlan when there are large numbers of interfaces configured, from Herbert Xu. 11) Allow more control over fwmark used for non-socket based responses, from Lorenzo Colitti. 12) Do TCP congestion window limiting based upon measurements, from Neal Cardwell. 13) Support busy polling in SCTP, from Neal Horman. 14) Allow RSS key to be configured via ethtool, from Venkata Duvvuru. 15) Bridge promisc mode handling improvements from Vlad Yasevich. 16) Don't use inetpeer entries to implement ID generation any more, it performs poorly, from Eric Dumazet. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1522 commits) rtnetlink: fix userspace API breakage for iproute2 < v3.9.0 tcp: fixing TLP's FIN recovery net: fec: Add software TSO support net: fec: Add Scatter/gather support net: fec: Increase buffer descriptor entry number net: fec: Factorize feature setting net: fec: Enable IP header hardware checksum net: fec: Factorize the .xmit transmit function bridge: fix compile error when compiling without IPv6 support bridge: fix smatch warning / potential null pointer dereference via-rhine: fix full-duplex with autoneg disable bnx2x: Enlarge the dorq threshold for VFs bnx2x: Check for UNDI in uncommon branch bnx2x: Fix 1G-baseT link bnx2x: Fix link for KR with swapped polarity lane sctp: Fix sk_ack_backlog wrap-around problem net/core: Add VF link state control policy net/fsl: xgmac_mdio is dependent on OF_MDIO net/fsl: Make xgmac_mdio read error message useful net_sched: drr: warn when qdisc is not work conserving ...
Diffstat (limited to 'net/bridge/br_private.h')
-rw-r--r--net/bridge/br_private.h75
1 files changed, 52 insertions, 23 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 59d3a85c5873..23caf5b0309e 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -35,6 +35,8 @@
35#define BR_GROUPFWD_DEFAULT 0 35#define BR_GROUPFWD_DEFAULT 0
36/* Don't allow forwarding control protocols like STP and LLDP */ 36/* Don't allow forwarding control protocols like STP and LLDP */
37#define BR_GROUPFWD_RESTRICTED 0x4007u 37#define BR_GROUPFWD_RESTRICTED 0x4007u
38/* The Nearest Customer Bridge Group Address, 01-80-C2-00-00-[00,0B,0C,0D,0F] */
39#define BR_GROUPFWD_8021AD 0xB801u
38 40
39/* Path to usermode spanning tree program */ 41/* Path to usermode spanning tree program */
40#define BR_STP_PROG "/sbin/bridge-stp" 42#define BR_STP_PROG "/sbin/bridge-stp"
@@ -54,30 +56,24 @@ struct mac_addr
54 unsigned char addr[ETH_ALEN]; 56 unsigned char addr[ETH_ALEN];
55}; 57};
56 58
57struct br_ip
58{
59 union {
60 __be32 ip4;
61#if IS_ENABLED(CONFIG_IPV6)
62 struct in6_addr ip6;
63#endif
64 } u;
65 __be16 proto;
66 __u16 vid;
67};
68
69#ifdef CONFIG_BRIDGE_IGMP_SNOOPING 59#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
70/* our own querier */ 60/* our own querier */
71struct bridge_mcast_query { 61struct bridge_mcast_own_query {
72 struct timer_list timer; 62 struct timer_list timer;
73 u32 startup_sent; 63 u32 startup_sent;
74}; 64};
75 65
76/* other querier */ 66/* other querier */
77struct bridge_mcast_querier { 67struct bridge_mcast_other_query {
78 struct timer_list timer; 68 struct timer_list timer;
79 unsigned long delay_time; 69 unsigned long delay_time;
80}; 70};
71
72/* selected querier */
73struct bridge_mcast_querier {
74 struct br_ip addr;
75 struct net_bridge_port __rcu *port;
76};
81#endif 77#endif
82 78
83struct net_port_vlans { 79struct net_port_vlans {
@@ -174,11 +170,13 @@ struct net_bridge_port
174#define BR_ADMIN_COST 0x00000010 170#define BR_ADMIN_COST 0x00000010
175#define BR_LEARNING 0x00000020 171#define BR_LEARNING 0x00000020
176#define BR_FLOOD 0x00000040 172#define BR_FLOOD 0x00000040
173#define BR_AUTO_MASK (BR_FLOOD | BR_LEARNING)
174#define BR_PROMISC 0x00000080
177 175
178#ifdef CONFIG_BRIDGE_IGMP_SNOOPING 176#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
179 struct bridge_mcast_query ip4_query; 177 struct bridge_mcast_own_query ip4_own_query;
180#if IS_ENABLED(CONFIG_IPV6) 178#if IS_ENABLED(CONFIG_IPV6)
181 struct bridge_mcast_query ip6_query; 179 struct bridge_mcast_own_query ip6_own_query;
182#endif /* IS_ENABLED(CONFIG_IPV6) */ 180#endif /* IS_ENABLED(CONFIG_IPV6) */
183 unsigned char multicast_router; 181 unsigned char multicast_router;
184 struct timer_list multicast_router_timer; 182 struct timer_list multicast_router_timer;
@@ -198,6 +196,9 @@ struct net_bridge_port
198#endif 196#endif
199}; 197};
200 198
199#define br_auto_port(p) ((p)->flags & BR_AUTO_MASK)
200#define br_promisc_port(p) ((p)->flags & BR_PROMISC)
201
201#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT) 202#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT)
202 203
203static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *dev) 204static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *dev)
@@ -227,6 +228,7 @@ struct net_bridge
227 bool nf_call_arptables; 228 bool nf_call_arptables;
228#endif 229#endif
229 u16 group_fwd_mask; 230 u16 group_fwd_mask;
231 u16 group_fwd_mask_required;
230 232
231 /* STP */ 233 /* STP */
232 bridge_id designated_root; 234 bridge_id designated_root;
@@ -241,6 +243,7 @@ struct net_bridge
241 unsigned long bridge_forward_delay; 243 unsigned long bridge_forward_delay;
242 244
243 u8 group_addr[ETH_ALEN]; 245 u8 group_addr[ETH_ALEN];
246 bool group_addr_set;
244 u16 root_port; 247 u16 root_port;
245 248
246 enum { 249 enum {
@@ -277,11 +280,13 @@ struct net_bridge
277 struct hlist_head router_list; 280 struct hlist_head router_list;
278 281
279 struct timer_list multicast_router_timer; 282 struct timer_list multicast_router_timer;
283 struct bridge_mcast_other_query ip4_other_query;
284 struct bridge_mcast_own_query ip4_own_query;
280 struct bridge_mcast_querier ip4_querier; 285 struct bridge_mcast_querier ip4_querier;
281 struct bridge_mcast_query ip4_query;
282#if IS_ENABLED(CONFIG_IPV6) 286#if IS_ENABLED(CONFIG_IPV6)
287 struct bridge_mcast_other_query ip6_other_query;
288 struct bridge_mcast_own_query ip6_own_query;
283 struct bridge_mcast_querier ip6_querier; 289 struct bridge_mcast_querier ip6_querier;
284 struct bridge_mcast_query ip6_query;
285#endif /* IS_ENABLED(CONFIG_IPV6) */ 290#endif /* IS_ENABLED(CONFIG_IPV6) */
286#endif 291#endif
287 292
@@ -290,8 +295,10 @@ struct net_bridge
290 struct timer_list topology_change_timer; 295 struct timer_list topology_change_timer;
291 struct timer_list gc_timer; 296 struct timer_list gc_timer;
292 struct kobject *ifobj; 297 struct kobject *ifobj;
298 u32 auto_cnt;
293#ifdef CONFIG_BRIDGE_VLAN_FILTERING 299#ifdef CONFIG_BRIDGE_VLAN_FILTERING
294 u8 vlan_enabled; 300 u8 vlan_enabled;
301 __be16 vlan_proto;
295 struct net_port_vlans __rcu *vlan_info; 302 struct net_port_vlans __rcu *vlan_info;
296#endif 303#endif
297}; 304};
@@ -327,8 +334,6 @@ struct br_input_skb_cb {
327#define br_debug(br, format, args...) \ 334#define br_debug(br, format, args...) \
328 pr_debug("%s: " format, (br)->dev->name, ##args) 335 pr_debug("%s: " format, (br)->dev->name, ##args)
329 336
330extern struct notifier_block br_device_notifier;
331
332/* called under bridge lock */ 337/* called under bridge lock */
333static inline int br_is_root_bridge(const struct net_bridge *br) 338static inline int br_is_root_bridge(const struct net_bridge *br)
334{ 339{
@@ -395,6 +400,8 @@ int br_fdb_add(struct ndmsg *nlh, struct nlattr *tb[], struct net_device *dev,
395 const unsigned char *addr, u16 nlh_flags); 400 const unsigned char *addr, u16 nlh_flags);
396int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb, 401int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,
397 struct net_device *dev, int idx); 402 struct net_device *dev, int idx);
403int br_fdb_sync_static(struct net_bridge *br, struct net_bridge_port *p);
404void br_fdb_unsync_static(struct net_bridge *br, struct net_bridge_port *p);
398 405
399/* br_forward.c */ 406/* br_forward.c */
400void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb); 407void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb);
@@ -415,6 +422,8 @@ int br_del_if(struct net_bridge *br, struct net_device *dev);
415int br_min_mtu(const struct net_bridge *br); 422int br_min_mtu(const struct net_bridge *br);
416netdev_features_t br_features_recompute(struct net_bridge *br, 423netdev_features_t br_features_recompute(struct net_bridge *br,
417 netdev_features_t features); 424 netdev_features_t features);
425void br_port_flags_change(struct net_bridge_port *port, unsigned long mask);
426void br_manage_promisc(struct net_bridge *br);
418 427
419/* br_input.c */ 428/* br_input.c */
420int br_handle_frame_finish(struct sk_buff *skb); 429int br_handle_frame_finish(struct sk_buff *skb);
@@ -485,7 +494,7 @@ static inline bool br_multicast_is_router(struct net_bridge *br)
485 494
486static inline bool 495static inline bool
487__br_multicast_querier_exists(struct net_bridge *br, 496__br_multicast_querier_exists(struct net_bridge *br,
488 struct bridge_mcast_querier *querier) 497 struct bridge_mcast_other_query *querier)
489{ 498{
490 return time_is_before_jiffies(querier->delay_time) && 499 return time_is_before_jiffies(querier->delay_time) &&
491 (br->multicast_querier || timer_pending(&querier->timer)); 500 (br->multicast_querier || timer_pending(&querier->timer));
@@ -496,10 +505,10 @@ static inline bool br_multicast_querier_exists(struct net_bridge *br,
496{ 505{
497 switch (eth->h_proto) { 506 switch (eth->h_proto) {
498 case (htons(ETH_P_IP)): 507 case (htons(ETH_P_IP)):
499 return __br_multicast_querier_exists(br, &br->ip4_querier); 508 return __br_multicast_querier_exists(br, &br->ip4_other_query);
500#if IS_ENABLED(CONFIG_IPV6) 509#if IS_ENABLED(CONFIG_IPV6)
501 case (htons(ETH_P_IPV6)): 510 case (htons(ETH_P_IPV6)):
502 return __br_multicast_querier_exists(br, &br->ip6_querier); 511 return __br_multicast_querier_exists(br, &br->ip6_other_query);
503#endif 512#endif
504 default: 513 default:
505 return false; 514 return false;
@@ -589,7 +598,10 @@ int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags);
589int br_vlan_delete(struct net_bridge *br, u16 vid); 598int br_vlan_delete(struct net_bridge *br, u16 vid);
590void br_vlan_flush(struct net_bridge *br); 599void br_vlan_flush(struct net_bridge *br);
591bool br_vlan_find(struct net_bridge *br, u16 vid); 600bool br_vlan_find(struct net_bridge *br, u16 vid);
601void br_recalculate_fwd_mask(struct net_bridge *br);
592int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val); 602int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val);
603int br_vlan_set_proto(struct net_bridge *br, unsigned long val);
604void br_vlan_init(struct net_bridge *br);
593int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags); 605int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags);
594int nbp_vlan_delete(struct net_bridge_port *port, u16 vid); 606int nbp_vlan_delete(struct net_bridge_port *port, u16 vid);
595void nbp_vlan_flush(struct net_bridge_port *port); 607void nbp_vlan_flush(struct net_bridge_port *port);
@@ -633,6 +645,10 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v)
633 return v->pvid ?: VLAN_N_VID; 645 return v->pvid ?: VLAN_N_VID;
634} 646}
635 647
648static inline int br_vlan_enabled(struct net_bridge *br)
649{
650 return br->vlan_enabled;
651}
636#else 652#else
637static inline bool br_allowed_ingress(struct net_bridge *br, 653static inline bool br_allowed_ingress(struct net_bridge *br,
638 struct net_port_vlans *v, 654 struct net_port_vlans *v,
@@ -681,6 +697,14 @@ static inline bool br_vlan_find(struct net_bridge *br, u16 vid)
681 return false; 697 return false;
682} 698}
683 699
700static inline void br_recalculate_fwd_mask(struct net_bridge *br)
701{
702}
703
704static inline void br_vlan_init(struct net_bridge *br)
705{
706}
707
684static inline int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags) 708static inline int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags)
685{ 709{
686 return -EOPNOTSUPP; 710 return -EOPNOTSUPP;
@@ -719,6 +743,11 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v)
719{ 743{
720 return VLAN_N_VID; /* Returns invalid vid */ 744 return VLAN_N_VID; /* Returns invalid vid */
721} 745}
746
747static inline int br_vlan_enabled(struct net_bridge *br)
748{
749 return 0;
750}
722#endif 751#endif
723 752
724/* br_netfilter.c */ 753/* br_netfilter.c */