diff options
| author | Daniel Borkmann <dborkman@redhat.com> | 2014-02-16 09:55:20 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-02-17 00:36:34 -0500 |
| commit | 99932d4fc03a13bb3e94938fe25458fabc8f2fc3 (patch) | |
| tree | 529c7ad3764f7611f10ea299a67313f8baf84ce7 /include/linux | |
| parent | c321f7d7c87cdc623c87845f6378620573e57512 (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 'include/linux')
| -rw-r--r-- | include/linux/netdevice.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 21d4e6be8949..1de9c136b066 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -752,6 +752,9 @@ struct netdev_phys_port_id { | |||
| 752 | unsigned char id_len; | 752 | unsigned char id_len; |
| 753 | }; | 753 | }; |
| 754 | 754 | ||
| 755 | typedef u16 (*select_queue_fallback_t)(struct net_device *dev, | ||
| 756 | struct sk_buff *skb); | ||
| 757 | |||
| 755 | /* | 758 | /* |
| 756 | * This structure defines the management hooks for network devices. | 759 | * This structure defines the management hooks for network devices. |
| 757 | * The following hooks can be defined; unless noted otherwise, they are | 760 | * The following hooks can be defined; unless noted otherwise, they are |
| @@ -783,7 +786,7 @@ struct netdev_phys_port_id { | |||
| 783 | * Required can not be NULL. | 786 | * Required can not be NULL. |
| 784 | * | 787 | * |
| 785 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, | 788 | * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb, |
| 786 | * void *accel_priv); | 789 | * void *accel_priv, select_queue_fallback_t fallback); |
| 787 | * Called to decide which queue to when device supports multiple | 790 | * Called to decide which queue to when device supports multiple |
| 788 | * transmit queues. | 791 | * transmit queues. |
| 789 | * | 792 | * |
| @@ -1005,7 +1008,8 @@ struct net_device_ops { | |||
| 1005 | struct net_device *dev); | 1008 | struct net_device *dev); |
| 1006 | u16 (*ndo_select_queue)(struct net_device *dev, | 1009 | u16 (*ndo_select_queue)(struct net_device *dev, |
| 1007 | struct sk_buff *skb, | 1010 | struct sk_buff *skb, |
| 1008 | void *accel_priv); | 1011 | void *accel_priv, |
| 1012 | select_queue_fallback_t fallback); | ||
| 1009 | void (*ndo_change_rx_flags)(struct net_device *dev, | 1013 | void (*ndo_change_rx_flags)(struct net_device *dev, |
| 1010 | int flags); | 1014 | int flags); |
| 1011 | void (*ndo_set_rx_mode)(struct net_device *dev); | 1015 | void (*ndo_set_rx_mode)(struct net_device *dev); |
| @@ -1551,7 +1555,6 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, | |||
| 1551 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 1555 | struct netdev_queue *netdev_pick_tx(struct net_device *dev, |
| 1552 | struct sk_buff *skb, | 1556 | struct sk_buff *skb, |
| 1553 | void *accel_priv); | 1557 | void *accel_priv); |
| 1554 | u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb); | ||
| 1555 | 1558 | ||
| 1556 | /* | 1559 | /* |
| 1557 | * Net namespace inlines | 1560 | * Net namespace inlines |
