diff options
author | Jiri Pirko <jiri@resnulli.us> | 2012-07-17 01:22:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-17 12:02:36 -0400 |
commit | bd2d0837abc0206ecdd3f6b9fc8c25b55b63c96b (patch) | |
tree | d420a4e51965ae8b680562535d7ec9aace815f8e /include/linux/if_team.h | |
parent | 30fdd8a082a00126a6feec994e43e8dc12f5bccb (diff) |
team: add netpoll support
It's done in very similar way this is done in bonding and bridge.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_team.h')
-rw-r--r-- | include/linux/if_team.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index dfa0c8e0ab84..7fd0cdeb9444 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
@@ -13,6 +13,8 @@ | |||
13 | 13 | ||
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | 15 | ||
16 | #include <linux/netpoll.h> | ||
17 | |||
16 | struct team_pcpu_stats { | 18 | struct team_pcpu_stats { |
17 | u64 rx_packets; | 19 | u64 rx_packets; |
18 | u64 rx_bytes; | 20 | u64 rx_bytes; |
@@ -60,6 +62,10 @@ struct team_port { | |||
60 | unsigned int mtu; | 62 | unsigned int mtu; |
61 | } orig; | 63 | } orig; |
62 | 64 | ||
65 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
66 | struct netpoll *np; | ||
67 | #endif | ||
68 | |||
63 | long mode_priv[0]; | 69 | long mode_priv[0]; |
64 | }; | 70 | }; |
65 | 71 | ||
@@ -73,6 +79,33 @@ static inline bool team_port_txable(struct team_port *port) | |||
73 | return port->linkup && team_port_enabled(port); | 79 | return port->linkup && team_port_enabled(port); |
74 | } | 80 | } |
75 | 81 | ||
82 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
83 | static inline void team_netpoll_send_skb(struct team_port *port, | ||
84 | struct sk_buff *skb) | ||
85 | { | ||
86 | struct netpoll *np = port->np; | ||
87 | |||
88 | if (np) | ||
89 | netpoll_send_skb(np, skb); | ||
90 | } | ||
91 | #else | ||
92 | static inline void team_netpoll_send_skb(struct team_port *port, | ||
93 | struct sk_buff *skb) | ||
94 | { | ||
95 | } | ||
96 | #endif | ||
97 | |||
98 | static inline int team_dev_queue_xmit(struct team *team, struct team_port *port, | ||
99 | struct sk_buff *skb) | ||
100 | { | ||
101 | skb->dev = port->dev; | ||
102 | if (unlikely(netpoll_tx_running(port->dev))) { | ||
103 | team_netpoll_send_skb(port, skb); | ||
104 | return 0; | ||
105 | } | ||
106 | return dev_queue_xmit(skb); | ||
107 | } | ||
108 | |||
76 | struct team_mode_ops { | 109 | struct team_mode_ops { |
77 | int (*init)(struct team *team); | 110 | int (*init)(struct team *team); |
78 | void (*exit)(struct team *team); | 111 | void (*exit)(struct team *team); |