vlan: adds vlan_dev_select_queue
Subsystems (2)
PATCH v2 1/2 vlan: adds vlan_dev_select_queue
From: Vasu Dev <[email protected]>
This is required to correctly select vlan tx queue for a driver supporting multi tx queue with ndo_select_queue implemented since currently selected vlan tx queue is unaligned to selected queue by real net_devce ndo_select_queue.
Unaligned vlan tx queue selection causes thrash with higher vlan tx lock contention for least fcoe traffic and wrong socket tx queue_mapping for ixgbe having ndo_select_queue implemented.
-v2
As per Eric Dumazet<[email protected]> comments, mirrored vlan net_device_ops to have them with and without vlan_dev_select_queue and then select according to real dev ndo_select_queue present or not for a vlan net_device. This is to completely skip vlan_dev_select_queue calling for real net_device not supporting ndo_select_queue.
---
net/8021q/vlan_dev.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 68 insertions(+), 3 deletions(-)
net/8021q/vlan_dev.c +68 -3
@@ -361,6 +361,14 @@ static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,return ret; } +static u16 vlan_dev_select_queue (struct net_device *dev,struct sk_buff *skb) +{ +struct net_device *rdev =vlan_dev_info (dev)->real_dev; +const struct net_device_ops *ops = rdev->netdev_ops; + +return ops->ndo_select_queue (rdev, skb); +} +static int vlan_dev_change_mtu (struct net_device *dev,int new_mtu) {/* TODO: gotta make sure the underlying layer can handle it,
@@ -688,7 +696,8 @@ static const struct header_ops vlan_header_ops = { .parse = eth_header_parse, }; -static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops; +static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops, + vlan_netdev_ops_sq, vlan_netdev_accel_ops_sq;static int vlan_dev_init (struct net_device *dev) {
@@ -722,11 +731,17 @@ static int vlan_dev_init(struct net_device *dev)if (real_dev->features &NETIF_F_HW_VLAN_TX ) { dev->header_ops = real_dev->header_ops; dev->hard_header_len = real_dev->hard_header_len; - dev->netdev_ops = &vlan_netdev_accel_ops; +if (real_dev->netdev_ops->ndo_select_queue) + dev->netdev_ops = &vlan_netdev_accel_ops_sq; +else + dev->netdev_ops = &vlan_netdev_accel_ops; }else { dev->header_ops = &vlan_header_ops; dev->hard_header_len = real_dev->hard_header_len +VLAN_HLEN ; - dev->netdev_ops = &vlan_netdev_ops; +if (real_dev->netdev_ops->ndo_select_queue) + dev->netdev_ops = &vlan_netdev_ops_sq; +else + dev->netdev_ops = &vlan_netdev_ops; }if (is_vlan_dev (real_dev))
@@ -865,6 +880,56 @@ static const struct net_device_ops vlan_netdev_accel_ops = {#endif }; +static const struct net_device_ops vlan_netdev_ops_sq = { + .ndo_select_queue = vlan_dev_select_queue, + .ndo_change_mtu = vlan_dev_change_mtu, + .ndo_init = vlan_dev_init, + .ndo_uninit = vlan_dev_uninit, + .ndo_open = vlan_dev_open, + .ndo_stop = vlan_dev_stop, + .ndo_start_xmit = vlan_dev_hard_start_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = vlan_dev_set_mac_address, + .ndo_set_rx_mode = vlan_dev_set_rx_mode, + .ndo_set_multicast_list = vlan_dev_set_rx_mode, + .ndo_change_rx_flags = vlan_dev_change_rx_flags, + .ndo_do_ioctl = vlan_dev_ioctl, + .ndo_neigh_setup = vlan_dev_neigh_setup, + .ndo_get_stats = vlan_dev_get_stats, +#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) + .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, + .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, + .ndo_fcoe_enable = vlan_dev_fcoe_enable, + .ndo_fcoe_disable = vlan_dev_fcoe_disable, + .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, +#endif +}; + +static const struct net_device_ops vlan_netdev_accel_ops_sq = { + .ndo_select_queue = vlan_dev_select_queue, + .ndo_change_mtu = vlan_dev_change_mtu, + .ndo_init = vlan_dev_init, + .ndo_uninit = vlan_dev_uninit, + .ndo_open = vlan_dev_open, + .ndo_stop = vlan_dev_stop, + .ndo_start_xmit = vlan_dev_hwaccel_hard_start_xmit, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = vlan_dev_set_mac_address, + .ndo_set_rx_mode = vlan_dev_set_rx_mode, + .ndo_set_multicast_list = vlan_dev_set_rx_mode, + .ndo_change_rx_flags = vlan_dev_change_rx_flags, + .ndo_do_ioctl = vlan_dev_ioctl, + .ndo_neigh_setup = vlan_dev_neigh_setup, + .ndo_get_stats = vlan_dev_get_stats, +#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) + .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup, + .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done, + .ndo_fcoe_enable = vlan_dev_fcoe_enable, + .ndo_fcoe_disable = vlan_dev_fcoe_disable, + .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, +#endif +}; +void vlan_setup (struct net_device *dev) {ether_setup (dev);
PATCH v2 2/2 vlan: updates vlan real_num_tx_queues
From: Vasu Dev <[email protected]>
Updates real_num_tx_queues in case underlying real device has changed real_num_tx_queues.
-v2
As per Eric Dumazet<[email protected]> comment:-
-- adds BUG_ON to catch case of real_num_tx_queues exceeding num_tx_queues. -- created this self contained patch to just update real_num_tx_queues.
---
net/8021q/vlan.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/8021q/vlan.c +2 -0
@@ -378,6 +378,8 @@ static void vlan_transfer_features(struct net_device *dev,#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;#endif + vlandev->real_num_tx_queues = dev->real_num_tx_queues; +BUG_ON (vlandev->real_num_tx_queues > vlandev->num_tx_queues);if (old_features != vlandev->features)netdev_features_change (vlandev);
Re: [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
Quoted 5 lines · Jeff Kirsher
From: Vasu Dev <[email protected]>
Updates
real_num_tx_queuesin case underlying real device has changedreal_num_tx_queues.
Quoted 9 lines
-v2
As per Eric Dumazet<[email protected]> comment:-
-- addsBUG_ONto catch case ofreal_num_tx_queuesexceedingnum_tx_queues. -- created this self contained patch to just updatereal_num_tx_queues.Signed-off-by Vasu Dev <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>---
Thanks Jeff and Vasu :)
Quoted 17 lines
net/8021q/vlan.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)net/8021q/vlan.c +2
-0@@ -378,6 +378,8 @@ static void vlan_transfer_features(struct net_device *dev,#if defined(CONFIG_FCOE ) || defined(CONFIG_FCOE_MODULE ) vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;#endif + vlandev->real_num_tx_queues = dev->real_num_tx_queues; +BUG_ON (vlandev->real_num_tx_queues > vlandev->num_tx_queues);if (old_features != vlandev->features)netdev_features_change (vlandev);
Re: [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
From: Eric Dumazet <[email protected]>
Date: Wed, 24 Mar 2010 07:44:07 +0100
Quoted 11 lines · Jeff Kirsher
Quoted 10 lines
From: Vasu Dev <[email protected]>
Updates
real_num_tx_queuesin case underlying real device has changedreal_num_tx_queues.-v2
As per Eric Dumazet<[email protected]> comment:-
-- addsBUG_ONto catch case ofreal_num_tx_queuesexceedingnum_tx_queues. -- created this self contained patch to just updatereal_num_tx_queues.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Vasu Dev <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>---
Signed-off-by Eric Dumazet <[email protected]>
Applied.
Quoted 19 lines · Jeff Kirsher
From: Vasu Dev <[email protected]>
This is required to correctly select vlan tx queue for a driver supporting multi tx queue with
ndo_select_queueimplemented since currently selected vlan tx queue is unaligned to selected queue by realnet_devcendo_select_queue.Unaligned vlan tx queue selection causes thrash with higher vlan tx lock contention for least fcoe traffic and wrong socket tx
queue_mappingfor ixgbe havingndo_select_queueimplemented.-v2
As per Eric Dumazet<[email protected]> comments, mirrored vlan
net_device_opsto have them with and withoutvlan_dev_select_queueand then select according to real devndo_select_queuepresent or not for a vlannet_device. This is to completely skipvlan_dev_select_queuecalling for realnet_devicenot supportingndo_select_queue.
Quoted 4 lines
Signed-off-by Vasu Dev <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>---
Thanks Jeff
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Wed, 24 Mar 2010 06:53:42 +0100
Quoted 1 line
Acked-by Eric Dumazet <[email protected]>
Eric are you now OK with patch #2 in this series as well?
Thanks!
Quoted 7 lines · David Miller
From: Eric Dumazet <[email protected]>
Date: Wed, 24 Mar 2010 06:53:42 +0100Quoted 1 line
Acked-by Eric Dumazet <[email protected]>Eric are you now OK with patch #2 in this series as well?
Absolutely, I feel better after a breakfirst :)
Thanks
From: Eric Dumazet <[email protected]>
Date: Wed, 24 Mar 2010 06:53:42 +0100
Quoted 20 lines · Jeff Kirsher
Quoted 19 lines
From: Vasu Dev <[email protected]>
This is required to correctly select vlan tx queue for a driver supporting multi tx queue with
ndo_select_queueimplemented since currently selected vlan tx queue is unaligned to selected queue by realnet_devcendo_select_queue.Unaligned vlan tx queue selection causes thrash with higher vlan tx lock contention for least fcoe traffic and wrong socket tx
queue_mappingfor ixgbe havingndo_select_queueimplemented.-v2
As per Eric Dumazet<[email protected]> comments, mirrored vlan
net_device_opsto have them with and withoutvlan_dev_select_queueand then select according to real devndo_select_queuepresent or not for a vlannet_device. This is to completely skipvlan_dev_select_queuecalling for realnet_devicenot supportingndo_select_queue.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Vasu Dev <[email protected]>Signed-off-by Jeff Kirsher <[email protected]>---
Acked-by Eric Dumazet <[email protected]>
Applied.