public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] bnx2 + vlan + TSO : doesnt work
@ 2011-01-17 23:41 Eric Dumazet
  2011-01-17 23:47 ` Ben Hutchings
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2011-01-17 23:41 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jesse Gross

Oh well, my dev machine, with bnx2 and tg3 NICs, isnt working at all
with current linux-2.6 tree (I need vlans on my setup)

tg3 : vlan not working

bnx2 : vlan + TSO not working (or very slowly, since only non GSO frames
are OK)

I suspect recent commits from Jesse are the problem.
(bnx2_xmit() is feeded with zeroed vlan_tci skbs)

Maybe f01a5236bd4b1401 (net offloading: Generalize
netif_get_vlan_features().) ?

I dont see NETIF_F_HW_VLAN_TX being set in vlan_features in net drivers.
They only set this flag in dev->features

I dont think changing all drivers to also set vlan_features makes sense.

Is following patch the right path ? (It does solve my problem)

diff --git a/net/core/dev.c b/net/core/dev.c
index 54277df..5c13e55 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5265,6 +5265,9 @@ int register_netdevice(struct net_device *dev)
 	 */
 	dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
 
+	/* allow netif_skb_features() not mask this bit from dev->features */
+	dev->vlan_features |= NETIF_F_HW_VLAN_TX;
+
 	ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
 	ret = notifier_to_errno(ret);
 	if (ret)



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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-17 23:41 [BUG] bnx2 + vlan + TSO : doesnt work Eric Dumazet
@ 2011-01-17 23:47 ` Ben Hutchings
  2011-01-18  0:00   ` Eric Dumazet
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Hutchings @ 2011-01-17 23:47 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Jesse Gross

On Tue, 2011-01-18 at 00:41 +0100, Eric Dumazet wrote:
> Oh well, my dev machine, with bnx2 and tg3 NICs, isnt working at all
> with current linux-2.6 tree (I need vlans on my setup)
> 
> tg3 : vlan not working
> 
> bnx2 : vlan + TSO not working (or very slowly, since only non GSO frames
> are OK)
> 
> I suspect recent commits from Jesse are the problem.
> (bnx2_xmit() is feeded with zeroed vlan_tci skbs)
> 
> Maybe f01a5236bd4b1401 (net offloading: Generalize
> netif_get_vlan_features().) ?
> 
> I dont see NETIF_F_HW_VLAN_TX being set in vlan_features in net drivers.
> They only set this flag in dev->features
> 
> I dont think changing all drivers to also set vlan_features makes sense.
> 
> Is following patch the right path ? (It does solve my problem)

This isn't right.  NETIF_F_HW_VLAN_TX in vlan_features would mean that
the hardware can do two levels of VLAN tag insertion, which is generally
not true.

Ben.

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 54277df..5c13e55 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5265,6 +5265,9 @@ int register_netdevice(struct net_device *dev)
>  	 */
>  	dev->vlan_features |= (NETIF_F_GRO | NETIF_F_HIGHDMA);
>  
> +	/* allow netif_skb_features() not mask this bit from dev->features */
> +	dev->vlan_features |= NETIF_F_HW_VLAN_TX;
> +
>  	ret = call_netdevice_notifiers(NETDEV_POST_INIT, dev);
>  	ret = notifier_to_errno(ret);
>  	if (ret)

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-17 23:47 ` Ben Hutchings
@ 2011-01-18  0:00   ` Eric Dumazet
  2011-01-18  0:09     ` Ben Hutchings
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2011-01-18  0:00 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: David Miller, netdev, Jesse Gross

Le lundi 17 janvier 2011 à 23:47 +0000, Ben Hutchings a écrit :
> On Tue, 2011-01-18 at 00:41 +0100, Eric Dumazet wrote:
> > Oh well, my dev machine, with bnx2 and tg3 NICs, isnt working at all
> > with current linux-2.6 tree (I need vlans on my setup)
> > 
> > tg3 : vlan not working
> > 
> > bnx2 : vlan + TSO not working (or very slowly, since only non GSO frames
> > are OK)
> > 
> > I suspect recent commits from Jesse are the problem.
> > (bnx2_xmit() is feeded with zeroed vlan_tci skbs)
> > 
> > Maybe f01a5236bd4b1401 (net offloading: Generalize
> > netif_get_vlan_features().) ?
> > 
> > I dont see NETIF_F_HW_VLAN_TX being set in vlan_features in net drivers.
> > They only set this flag in dev->features
> > 
> > I dont think changing all drivers to also set vlan_features makes sense.
> > 
> > Is following patch the right path ? (It does solve my problem)
> 
> This isn't right.  NETIF_F_HW_VLAN_TX in vlan_features would mean that
> the hardware can do two levels of VLAN tag insertion, which is generally
> not true.
> 

So should we revert part of Jesse patch ? I want my vlan back ;)

diff --git a/net/core/dev.c b/net/core/dev.c
index 54277df..8209d93 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2076,7 +2076,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 		features = netif_skb_features(skb);
 
 		if (vlan_tx_tag_present(skb) &&
-		    !(features & NETIF_F_HW_VLAN_TX)) {
+		    !(dev->features & NETIF_F_HW_VLAN_TX)) {
 			skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
 			if (unlikely(!skb))
 				goto out;



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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  0:00   ` Eric Dumazet
@ 2011-01-18  0:09     ` Ben Hutchings
  2011-01-18  0:13       ` Jesse Gross
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Hutchings @ 2011-01-18  0:09 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Jesse Gross

On Tue, 2011-01-18 at 01:00 +0100, Eric Dumazet wrote:
> Le lundi 17 janvier 2011 à 23:47 +0000, Ben Hutchings a écrit :
> > On Tue, 2011-01-18 at 00:41 +0100, Eric Dumazet wrote:
> > > Oh well, my dev machine, with bnx2 and tg3 NICs, isnt working at all
> > > with current linux-2.6 tree (I need vlans on my setup)
> > > 
> > > tg3 : vlan not working
> > > 
> > > bnx2 : vlan + TSO not working (or very slowly, since only non GSO frames
> > > are OK)
> > > 
> > > I suspect recent commits from Jesse are the problem.
> > > (bnx2_xmit() is feeded with zeroed vlan_tci skbs)
> > > 
> > > Maybe f01a5236bd4b1401 (net offloading: Generalize
> > > netif_get_vlan_features().) ?
> > > 
> > > I dont see NETIF_F_HW_VLAN_TX being set in vlan_features in net drivers.
> > > They only set this flag in dev->features
> > > 
> > > I dont think changing all drivers to also set vlan_features makes sense.
> > > 
> > > Is following patch the right path ? (It does solve my problem)
> > 
> > This isn't right.  NETIF_F_HW_VLAN_TX in vlan_features would mean that
> > the hardware can do two levels of VLAN tag insertion, which is generally
> > not true.
> > 
> 
> So should we revert part of Jesse patch ? I want my vlan back ;)

Yeah, that looks right.

Ben.

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 54277df..8209d93 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2076,7 +2076,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
>  		features = netif_skb_features(skb);
>  
>  		if (vlan_tx_tag_present(skb) &&
> -		    !(features & NETIF_F_HW_VLAN_TX)) {
> +		    !(dev->features & NETIF_F_HW_VLAN_TX)) {
>  			skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
>  			if (unlikely(!skb))
>  				goto out;
> 
> 

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  0:09     ` Ben Hutchings
@ 2011-01-18  0:13       ` Jesse Gross
  2011-01-18  6:09         ` David Miller
  0 siblings, 1 reply; 9+ messages in thread
From: Jesse Gross @ 2011-01-18  0:13 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Eric Dumazet, David Miller, netdev

On Mon, Jan 17, 2011 at 4:09 PM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> On Tue, 2011-01-18 at 01:00 +0100, Eric Dumazet wrote:
>> Le lundi 17 janvier 2011 à 23:47 +0000, Ben Hutchings a écrit :
>> > On Tue, 2011-01-18 at 00:41 +0100, Eric Dumazet wrote:
>> > > Oh well, my dev machine, with bnx2 and tg3 NICs, isnt working at all
>> > > with current linux-2.6 tree (I need vlans on my setup)
>> > >
>> > > tg3 : vlan not working
>> > >
>> > > bnx2 : vlan + TSO not working (or very slowly, since only non GSO frames
>> > > are OK)
>> > >
>> > > I suspect recent commits from Jesse are the problem.
>> > > (bnx2_xmit() is feeded with zeroed vlan_tci skbs)
>> > >
>> > > Maybe f01a5236bd4b1401 (net offloading: Generalize
>> > > netif_get_vlan_features().) ?
>> > >
>> > > I dont see NETIF_F_HW_VLAN_TX being set in vlan_features in net drivers.
>> > > They only set this flag in dev->features
>> > >
>> > > I dont think changing all drivers to also set vlan_features makes sense.
>> > >
>> > > Is following patch the right path ? (It does solve my problem)
>> >
>> > This isn't right.  NETIF_F_HW_VLAN_TX in vlan_features would mean that
>> > the hardware can do two levels of VLAN tag insertion, which is generally
>> > not true.
>> >
>>
>> So should we revert part of Jesse patch ? I want my vlan back ;)
>
> Yeah, that looks right.

I think it is better for netif_skb_features() to actually return the
correct features rather than bypass it here.  NETIF_F_HW_VLAN_TX
doesn't depend on any other offloads, so we can always include it if
it is in dev->features.

Separately, this means there is a problem with bnx2 because it allows
vlan insertion to be turned off, which would have the same effect.
Maybe it is looking directly at skb->protocol or similar for TSO.

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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  0:13       ` Jesse Gross
@ 2011-01-18  6:09         ` David Miller
  2011-01-18  6:21           ` Eric Dumazet
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2011-01-18  6:09 UTC (permalink / raw)
  To: jesse; +Cc: bhutchings, eric.dumazet, netdev

From: Jesse Gross <jesse@nicira.com>
Date: Mon, 17 Jan 2011 16:13:18 -0800

> I think it is better for netif_skb_features() to actually return the
> correct features rather than bypass it here.  NETIF_F_HW_VLAN_TX
> doesn't depend on any other offloads, so we can always include it if
> it is in dev->features.
> 
> Separately, this means there is a problem with bnx2 because it allows
> vlan insertion to be turned off, which would have the same effect.
> Maybe it is looking directly at skb->protocol or similar for TSO.

Please, someone cons up an acceptable fix fast.

Thanks.

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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  6:09         ` David Miller
@ 2011-01-18  6:21           ` Eric Dumazet
  2011-01-18  6:32             ` Jesse Gross
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Dumazet @ 2011-01-18  6:21 UTC (permalink / raw)
  To: David Miller; +Cc: jesse, bhutchings, netdev

Le lundi 17 janvier 2011 à 22:09 -0800, David Miller a écrit :
> From: Jesse Gross <jesse@nicira.com>
> Date: Mon, 17 Jan 2011 16:13:18 -0800
> 
> > I think it is better for netif_skb_features() to actually return the
> > correct features rather than bypass it here.  NETIF_F_HW_VLAN_TX
> > doesn't depend on any other offloads, so we can always include it if
> > it is in dev->features.
> > 
> > Separately, this means there is a problem with bnx2 because it allows
> > vlan insertion to be turned off, which would have the same effect.
> > Maybe it is looking directly at skb->protocol or similar for TSO.
> 
> Please, someone cons up an acceptable fix fast.
> 

I just woke up, and honestly dont understand why only bnx2 is affected
by this problem of masking NETIF_F_HW_VLAN_TX

And I dont understand all this netif_skb_features() stuff : if we want
to actually test dev->features & NETIF_F_HW_VLAN_TX, and this flag
doesnt depend on other offloads, why are we doing features &
vlan_features.

Jesse, I dont understand why you say "bnx2 allows vlan insertion to be
turned off". Really.




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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  6:21           ` Eric Dumazet
@ 2011-01-18  6:32             ` Jesse Gross
  2011-01-18  6:38               ` Eric Dumazet
  0 siblings, 1 reply; 9+ messages in thread
From: Jesse Gross @ 2011-01-18  6:32 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, bhutchings, netdev

On Tue, Jan 18, 2011 at 1:21 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le lundi 17 janvier 2011 à 22:09 -0800, David Miller a écrit :
>> From: Jesse Gross <jesse@nicira.com>
>> Date: Mon, 17 Jan 2011 16:13:18 -0800
>>
>> > I think it is better for netif_skb_features() to actually return the
>> > correct features rather than bypass it here.  NETIF_F_HW_VLAN_TX
>> > doesn't depend on any other offloads, so we can always include it if
>> > it is in dev->features.
>> >
>> > Separately, this means there is a problem with bnx2 because it allows
>> > vlan insertion to be turned off, which would have the same effect.
>> > Maybe it is looking directly at skb->protocol or similar for TSO.
>>
>> Please, someone cons up an acceptable fix fast.
>>
>
> I just woke up, and honestly dont understand why only bnx2 is affected
> by this problem of masking NETIF_F_HW_VLAN_TX

If NETIF_F_HW_VLAN_TX is masked then the tag will be inserted in
software, which is generally OK.  The problem is that some drivers
assume that if they can do vlan tagging in hardware it will always be
used and therefore don't expect vlan tags when setting up TSO, etc.

>
> And I dont understand all this netif_skb_features() stuff : if we want
> to actually test dev->features & NETIF_F_HW_VLAN_TX, and this flag
> doesnt depend on other offloads, why are we doing features &
> vlan_features.

The idea is to put all of the logic in one place rather than having
pieces that are really interdependent scattered around in the
different offloads.  So we could test dev->features directly for vlans
but I would rather just have netif_skb_features() return the right
values to start off with.

>
> Jesse, I dont understand why you say "bnx2 allows vlan insertion to be
> turned off". Really.

You can disable it using Ethtool, which will turn off
NETIF_F_HW_VLAN_TX the same as this bug.

I'm running a quick test on a patch to always allow NETIF_F_HW_VLAN_TX
to be returned from netif_skb_features().

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

* Re: [BUG] bnx2 + vlan + TSO : doesnt work
  2011-01-18  6:32             ` Jesse Gross
@ 2011-01-18  6:38               ` Eric Dumazet
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2011-01-18  6:38 UTC (permalink / raw)
  To: Jesse Gross; +Cc: David Miller, bhutchings, netdev

Le mardi 18 janvier 2011 à 01:32 -0500, Jesse Gross a écrit :
> On Tue, Jan 18, 2011 at 1:21 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Le lundi 17 janvier 2011 à 22:09 -0800, David Miller a écrit :
> >> From: Jesse Gross <jesse@nicira.com>
> >> Date: Mon, 17 Jan 2011 16:13:18 -0800
> >>
> >> > I think it is better for netif_skb_features() to actually return the
> >> > correct features rather than bypass it here.  NETIF_F_HW_VLAN_TX
> >> > doesn't depend on any other offloads, so we can always include it if
> >> > it is in dev->features.
> >> >
> >> > Separately, this means there is a problem with bnx2 because it allows
> >> > vlan insertion to be turned off, which would have the same effect.
> >> > Maybe it is looking directly at skb->protocol or similar for TSO.
> >>
> >> Please, someone cons up an acceptable fix fast.
> >>
> >
> > I just woke up, and honestly dont understand why only bnx2 is affected
> > by this problem of masking NETIF_F_HW_VLAN_TX
> 
> If NETIF_F_HW_VLAN_TX is masked then the tag will be inserted in
> software, which is generally OK.  The problem is that some drivers
> assume that if they can do vlan tagging in hardware it will always be
> used and therefore don't expect vlan tags when setting up TSO, etc.
> 

OK, but then this driver gave us the hint core network was actually
always doing software vlan, tagging ;)

> >
> > And I dont understand all this netif_skb_features() stuff : if we want
> > to actually test dev->features & NETIF_F_HW_VLAN_TX, and this flag
> > doesnt depend on other offloads, why are we doing features &
> > vlan_features.
> 
> The idea is to put all of the logic in one place rather than having
> pieces that are really interdependent scattered around in the
> different offloads.  So we could test dev->features directly for vlans
> but I would rather just have netif_skb_features() return the right
> values to start off with.
> 
> >
> > Jesse, I dont understand why you say "bnx2 allows vlan insertion to be
> > turned off". Really.
> 
> You can disable it using Ethtool, which will turn off
> NETIF_F_HW_VLAN_TX the same as this bug.
> 
> I'm running a quick test on a patch to always allow NETIF_F_HW_VLAN_TX
> to be returned from netif_skb_features().

Thanks




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

end of thread, other threads:[~2011-01-18  6:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-17 23:41 [BUG] bnx2 + vlan + TSO : doesnt work Eric Dumazet
2011-01-17 23:47 ` Ben Hutchings
2011-01-18  0:00   ` Eric Dumazet
2011-01-18  0:09     ` Ben Hutchings
2011-01-18  0:13       ` Jesse Gross
2011-01-18  6:09         ` David Miller
2011-01-18  6:21           ` Eric Dumazet
2011-01-18  6:32             ` Jesse Gross
2011-01-18  6:38               ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox