netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback()
@ 2013-05-28 16:15 Haiyang Zhang
  2013-06-01  0:34 ` David Miller
  2013-06-14 15:28 ` Olaf Hering
  0 siblings, 2 replies; 4+ messages in thread
From: Haiyang Zhang @ 2013-05-28 16:15 UTC (permalink / raw)
  To: davem, netdev; +Cc: haiyangz, kys, olaf, jasowang, linux-kernel, devel

Since the recent addition of 8021AD, we need to set the new field vlan_proto in
sk_buff. Otherwise, it will trigger BUG() call in vlan_proto_idx().

This patch fixes the problem.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>

---
 drivers/net/hyperv/netvsc_drv.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 088c554..ab2307b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -31,6 +31,7 @@
 #include <linux/inetdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
+#include <linux/if_vlan.h>
 #include <linux/in.h>
 #include <linux/slab.h>
 #include <net/arp.h>
@@ -284,7 +285,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
 
 	skb->protocol = eth_type_trans(skb, net);
 	skb->ip_summed = CHECKSUM_NONE;
-	skb->vlan_tci = packet->vlan_tci;
+	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet->vlan_tci);
 
 	net->stats.rx_packets++;
 	net->stats.rx_bytes += packet->total_data_buflen;
-- 
1.7.4.1

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

* Re: [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback()
  2013-05-28 16:15 [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback() Haiyang Zhang
@ 2013-06-01  0:34 ` David Miller
  2013-06-14 15:28 ` Olaf Hering
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-06-01  0:34 UTC (permalink / raw)
  To: haiyangz; +Cc: netdev, kys, olaf, jasowang, linux-kernel, devel

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Tue, 28 May 2013 09:15:56 -0700

> Since the recent addition of 8021AD, we need to set the new field vlan_proto in
> sk_buff. Otherwise, it will trigger BUG() call in vlan_proto_idx().
> 
> This patch fixes the problem.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>

Applied, thanks.

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

* Re: [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback()
  2013-05-28 16:15 [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback() Haiyang Zhang
  2013-06-01  0:34 ` David Miller
@ 2013-06-14 15:28 ` Olaf Hering
  2013-06-14 16:24   ` Haiyang Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2013-06-14 15:28 UTC (permalink / raw)
  To: Haiyang Zhang; +Cc: davem, netdev, kys, jasowang, linux-kernel, devel

On Tue, May 28, Haiyang Zhang wrote:

> Since the recent addition of 8021AD, we need to set the new field vlan_proto in
> sk_buff. Otherwise, it will trigger BUG() call in vlan_proto_idx().

> @@ -284,7 +285,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>  
>  	skb->protocol = eth_type_trans(skb, net);
>  	skb->ip_summed = CHECKSUM_NONE;
> -	skb->vlan_tci = packet->vlan_tci;
> +	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet->vlan_tci);


Just curious:

Doesnt that change behaviour in the sense that __vlan_hwaccel_put_tag()
now always adds VLAN_TAG_PRESENT to skb->vlan_tci, while before that
change packet->vlan_tci may or may not had this flag?

In other words, should a variant of this patch be backported if it was a
bug not not use __vlan_hwaccel_put_tag right from the start?

Olaf

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

* RE: [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback()
  2013-06-14 15:28 ` Olaf Hering
@ 2013-06-14 16:24   ` Haiyang Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Haiyang Zhang @ 2013-06-14 16:24 UTC (permalink / raw)
  To: Olaf Hering
  Cc: davem@davemloft.net, netdev@vger.kernel.org, KY Srinivasan,
	jasowang@redhat.com, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org



> -----Original Message-----
> From: Olaf Hering [mailto:olaf@aepfle.de]
> Sent: Friday, June 14, 2013 11:29 AM
> To: Haiyang Zhang
> Cc: davem@davemloft.net; netdev@vger.kernel.org; KY Srinivasan;
> jasowang@redhat.com; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org
> Subject: Re: [PATCH net] hyperv: Fix vlan_proto setting in
> netvsc_recv_callback()
> 
> On Tue, May 28, Haiyang Zhang wrote:
> 
> > Since the recent addition of 8021AD, we need to set the new field
> > vlan_proto in sk_buff. Otherwise, it will trigger BUG() call in
> vlan_proto_idx().
> 
> > @@ -284,7 +285,7 @@ int netvsc_recv_callback(struct hv_device
> > *device_obj,
> >
> >  	skb->protocol = eth_type_trans(skb, net);
> >  	skb->ip_summed = CHECKSUM_NONE;
> > -	skb->vlan_tci = packet->vlan_tci;
> > +	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet-
> >vlan_tci);
> 
> 
> Just curious:
> 
> Doesnt that change behaviour in the sense that __vlan_hwaccel_put_tag()
> now always adds VLAN_TAG_PRESENT to skb->vlan_tci, while before that
> change packet->vlan_tci may or may not had this flag?
> 
> In other words, should a variant of this patch be backported if it was a bug
> not not use __vlan_hwaccel_put_tag right from the start?
> 

Thanks for looking at this. Actually, the previous code was correct, because I 
add the VLAN_TAG_PRESENT if the packet comes from vlan in function
rndis_filter_receive_data():
        if (vlan) {
                pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
                        (vlan->pri << VLAN_PRIO_SHIFT);
        } else {
                pkt->vlan_tci = 0;
        }

But, the new code should be updated below, so the VLAN_TAG_PRESENT won't be set
when it's not from a vlan:
If (VLAN_TAG_PRESENT & packet->vlan_tci)
	__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), packet- vlan_tci);

I will submit a patch soon.

Thanks,
- Haiyang


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

end of thread, other threads:[~2013-06-14 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-28 16:15 [PATCH net] hyperv: Fix vlan_proto setting in netvsc_recv_callback() Haiyang Zhang
2013-06-01  0:34 ` David Miller
2013-06-14 15:28 ` Olaf Hering
2013-06-14 16:24   ` Haiyang Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).