diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2014-02-16 09:55:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-17 00:36:34 -0500 |
commit | b9507bdaf40e91fea2b1c0c1ee7dc627c8ee6fd6 (patch) | |
tree | 277be7b469483258b41497d1e47901cf745a1e62 | |
parent | 99932d4fc03a13bb3e94938fe25458fabc8f2fc3 (diff) |
netdevice: move netdev_cap_txqueue for shared usage to header
In order to allow users to invoke netdev_cap_txqueue, it needs to
be moved into netdevice.h header file. While at it, also add kernel
doc header to document the API.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 20 | ||||
-rw-r--r-- | net/core/flow_dissector.c | 13 |
2 files changed, 21 insertions, 12 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1de9c136b066..e8eeebd49a98 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2279,6 +2279,26 @@ static inline void netdev_reset_queue(struct net_device *dev_queue) | |||
2279 | } | 2279 | } |
2280 | 2280 | ||
2281 | /** | 2281 | /** |
2282 | * netdev_cap_txqueue - check if selected tx queue exceeds device queues | ||
2283 | * @dev: network device | ||
2284 | * @queue_index: given tx queue index | ||
2285 | * | ||
2286 | * Returns 0 if given tx queue index >= number of device tx queues, | ||
2287 | * otherwise returns the originally passed tx queue index. | ||
2288 | */ | ||
2289 | static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) | ||
2290 | { | ||
2291 | if (unlikely(queue_index >= dev->real_num_tx_queues)) { | ||
2292 | net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n", | ||
2293 | dev->name, queue_index, | ||
2294 | dev->real_num_tx_queues); | ||
2295 | return 0; | ||
2296 | } | ||
2297 | |||
2298 | return queue_index; | ||
2299 | } | ||
2300 | |||
2301 | /** | ||
2282 | * netif_running - test if up | 2302 | * netif_running - test if up |
2283 | * @dev: network device | 2303 | * @dev: network device |
2284 | * | 2304 | * |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 75fe83f590ea..e29e810663d7 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -323,17 +323,6 @@ u32 __skb_get_poff(const struct sk_buff *skb) | |||
323 | return poff; | 323 | return poff; |
324 | } | 324 | } |
325 | 325 | ||
326 | static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) | ||
327 | { | ||
328 | if (unlikely(queue_index >= dev->real_num_tx_queues)) { | ||
329 | net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n", | ||
330 | dev->name, queue_index, | ||
331 | dev->real_num_tx_queues); | ||
332 | return 0; | ||
333 | } | ||
334 | return queue_index; | ||
335 | } | ||
336 | |||
337 | static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) | 326 | static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb) |
338 | { | 327 | { |
339 | #ifdef CONFIG_XPS | 328 | #ifdef CONFIG_XPS |
@@ -408,7 +397,7 @@ struct netdev_queue *netdev_pick_tx(struct net_device *dev, | |||
408 | queue_index = __netdev_pick_tx(dev, skb); | 397 | queue_index = __netdev_pick_tx(dev, skb); |
409 | 398 | ||
410 | if (!accel_priv) | 399 | if (!accel_priv) |
411 | queue_index = dev_cap_txqueue(dev, queue_index); | 400 | queue_index = netdev_cap_txqueue(dev, queue_index); |
412 | } | 401 | } |
413 | 402 | ||
414 | skb_set_queue_mapping(skb, queue_index); | 403 | skb_set_queue_mapping(skb, queue_index); |