aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-02-16 09:55:20 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-17 00:36:34 -0500
commit99932d4fc03a13bb3e94938fe25458fabc8f2fc3 (patch)
tree529c7ad3764f7611f10ea299a67313f8baf84ce7 /net
parentc321f7d7c87cdc623c87845f6378620573e57512 (diff)
netdevice: add queue selection fallback handler for ndo_select_queue
Add a new argument for ndo_select_queue() callback that passes a fallback handler. This gets invoked through netdev_pick_tx(); fallback handler is currently __netdev_pick_tx() as most drivers invoke this function within their customized implementation in case for skbs that don't need any special handling. This fallback handler can then be replaced on other call-sites with different queue selection methods (e.g. in packet sockets, pktgen etc). This also has the nice side-effect that __netdev_pick_tx() is then only invoked from netdev_pick_tx() and export of that function to modules can be undone. Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/flow_dissector.c7
-rw-r--r--net/mac80211/iface.c6
2 files changed, 7 insertions, 6 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 87577d447554..75fe83f590ea 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -372,7 +372,7 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
372#endif 372#endif
373} 373}
374 374
375u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) 375static u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb)
376{ 376{
377 struct sock *sk = skb->sk; 377 struct sock *sk = skb->sk;
378 int queue_index = sk_tx_queue_get(sk); 378 int queue_index = sk_tx_queue_get(sk);
@@ -392,7 +392,6 @@ u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb)
392 392
393 return queue_index; 393 return queue_index;
394} 394}
395EXPORT_SYMBOL(__netdev_pick_tx);
396 395
397struct netdev_queue *netdev_pick_tx(struct net_device *dev, 396struct netdev_queue *netdev_pick_tx(struct net_device *dev,
398 struct sk_buff *skb, 397 struct sk_buff *skb,
@@ -403,8 +402,8 @@ struct netdev_queue *netdev_pick_tx(struct net_device *dev,
403 if (dev->real_num_tx_queues != 1) { 402 if (dev->real_num_tx_queues != 1) {
404 const struct net_device_ops *ops = dev->netdev_ops; 403 const struct net_device_ops *ops = dev->netdev_ops;
405 if (ops->ndo_select_queue) 404 if (ops->ndo_select_queue)
406 queue_index = ops->ndo_select_queue(dev, skb, 405 queue_index = ops->ndo_select_queue(dev, skb, accel_priv,
407 accel_priv); 406 __netdev_pick_tx);
408 else 407 else
409 queue_index = __netdev_pick_tx(dev, skb); 408 queue_index = __netdev_pick_tx(dev, skb);
410 409
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index d6d1f1df9119..ce1c44370610 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1057,7 +1057,8 @@ static void ieee80211_uninit(struct net_device *dev)
1057 1057
1058static u16 ieee80211_netdev_select_queue(struct net_device *dev, 1058static u16 ieee80211_netdev_select_queue(struct net_device *dev,
1059 struct sk_buff *skb, 1059 struct sk_buff *skb,
1060 void *accel_priv) 1060 void *accel_priv,
1061 select_queue_fallback_t fallback)
1061{ 1062{
1062 return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); 1063 return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
1063} 1064}
@@ -1075,7 +1076,8 @@ static const struct net_device_ops ieee80211_dataif_ops = {
1075 1076
1076static u16 ieee80211_monitor_select_queue(struct net_device *dev, 1077static u16 ieee80211_monitor_select_queue(struct net_device *dev,
1077 struct sk_buff *skb, 1078 struct sk_buff *skb,
1078 void *accel_priv) 1079 void *accel_priv,
1080 select_queue_fallback_t fallback)
1079{ 1081{
1080 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1082 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1081 struct ieee80211_local *local = sdata->local; 1083 struct ieee80211_local *local = sdata->local;