All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
@ 2010-03-24  0:41 Jeff Kirsher
  2010-03-24  0:42 ` [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues Jeff Kirsher
  2010-03-24  5:53 ` [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Eric Dumazet
  0 siblings, 2 replies; 8+ messages in thread
From: Jeff Kirsher @ 2010-03-24  0:41 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Vasu Dev, Jeff Kirsher

From: Vasu Dev <vasu.dev@intel.com>

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<eric.dumazet@gmail.com> 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.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 net/8021q/vlan_dev.c |   71 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 9e83272..2fd057c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -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);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
  2010-03-24  0:41 [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Jeff Kirsher
@ 2010-03-24  0:42 ` Jeff Kirsher
  2010-03-24  6:44   ` Eric Dumazet
  2010-03-24  5:53 ` [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Eric Dumazet
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff Kirsher @ 2010-03-24  0:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Vasu Dev, Jeff Kirsher

From: Vasu Dev <vasu.dev@intel.com>

Updates real_num_tx_queues in case underlying real device
has changed real_num_tx_queues.

-v2
 As per Eric Dumazet<eric.dumazet@gmail.com> 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.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 net/8021q/vlan.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4535122..db783d7 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -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);


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
  2010-03-24  0:41 [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Jeff Kirsher
  2010-03-24  0:42 ` [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues Jeff Kirsher
@ 2010-03-24  5:53 ` Eric Dumazet
  2010-03-24  6:30   ` David Miller
  2010-03-24 18:11   ` David Miller
  1 sibling, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2010-03-24  5:53 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, netdev, gospo, Vasu Dev

Le mardi 23 mars 2010 à 17:41 -0700, Jeff Kirsher a écrit :
> From: Vasu Dev <vasu.dev@intel.com>
> 
> 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<eric.dumazet@gmail.com> 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.
> 
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> 

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Thanks Jeff




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
  2010-03-24  5:53 ` [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Eric Dumazet
@ 2010-03-24  6:30   ` David Miller
  2010-03-24  6:45     ` Eric Dumazet
  2010-03-24 18:11   ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: David Miller @ 2010-03-24  6:30 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Mar 2010 06:53:42 +0100

> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Eric are you now OK with patch #2 in this series as well?

Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
  2010-03-24  0:42 ` [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues Jeff Kirsher
@ 2010-03-24  6:44   ` Eric Dumazet
  2010-03-24 18:11     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2010-03-24  6:44 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: davem, netdev, gospo, Vasu Dev

Le mardi 23 mars 2010 à 17:42 -0700, Jeff Kirsher a écrit :
> From: Vasu Dev <vasu.dev@intel.com>
> 
> Updates real_num_tx_queues in case underlying real device
> has changed real_num_tx_queues.
> 
> -v2
>  As per Eric Dumazet<eric.dumazet@gmail.com> 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.
> 
> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> 

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Thanks Jeff  and Vasu :)

>  net/8021q/vlan.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
> index 4535122..db783d7 100644
> --- a/net/8021q/vlan.c
> +++ b/net/8021q/vlan.c
> @@ -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);
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
  2010-03-24  6:30   ` David Miller
@ 2010-03-24  6:45     ` Eric Dumazet
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2010-03-24  6:45 UTC (permalink / raw)
  To: David Miller; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev

Le mardi 23 mars 2010 à 23:30 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 24 Mar 2010 06:53:42 +0100
> 
> > Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Eric are you now OK with patch #2 in this series as well?
> 

Absolutely, I feel better after a breakfirst :)

Thanks



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] vlan: adds vlan_dev_select_queue
  2010-03-24  5:53 ` [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Eric Dumazet
  2010-03-24  6:30   ` David Miller
@ 2010-03-24 18:11   ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2010-03-24 18:11 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Mar 2010 06:53:42 +0100

> Le mardi 23 mars 2010 à 17:41 -0700, Jeff Kirsher a écrit :
>> From: Vasu Dev <vasu.dev@intel.com>
>> 
>> 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<eric.dumazet@gmail.com> 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.
>> 
>> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> ---
>> 
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues
  2010-03-24  6:44   ` Eric Dumazet
@ 2010-03-24 18:11     ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-03-24 18:11 UTC (permalink / raw)
  To: eric.dumazet; +Cc: jeffrey.t.kirsher, netdev, gospo, vasu.dev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Mar 2010 07:44:07 +0100

> Le mardi 23 mars 2010 à 17:42 -0700, Jeff Kirsher a écrit :
>> From: Vasu Dev <vasu.dev@intel.com>
>> 
>> Updates real_num_tx_queues in case underlying real device
>> has changed real_num_tx_queues.
>> 
>> -v2
>>  As per Eric Dumazet<eric.dumazet@gmail.com> 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.
>> 
>> Signed-off-by: Vasu Dev <vasu.dev@intel.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> ---
>> 
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-03-24 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-24  0:41 [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Jeff Kirsher
2010-03-24  0:42 ` [PATCH v2 2/2] vlan: updates vlan real_num_tx_queues Jeff Kirsher
2010-03-24  6:44   ` Eric Dumazet
2010-03-24 18:11     ` David Miller
2010-03-24  5:53 ` [PATCH v2 1/2] vlan: adds vlan_dev_select_queue Eric Dumazet
2010-03-24  6:30   ` David Miller
2010-03-24  6:45     ` Eric Dumazet
2010-03-24 18:11   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.