All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception
@ 2018-04-11 15:07 Elad Nachman
  2018-04-13  1:48 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Elad Nachman @ 2018-04-11 15:07 UTC (permalink / raw)
  To: netdev, David Miller

Stmmac reception handler calls stmmac_rx_vlan() to strip the vlan before calling napi_gro_receive().

The function assumes VLAN tagged frames are always tagged with 802.1Q protocol,
and assigns ETH_P_8021Q to the skb by hard-coding the parameter on call to __vlan_hwaccel_put_tag() .

This causes packets not to be passed to the VLAN slave if it was created with 802.1AD protocol
(ip link add link eth0 eth0.100 type vlan proto 802.1ad id 100).

This fix passes the protocol from the VLAN header into __vlan_hwaccel_put_tag()
instead of using the hard-coded value of ETH_P_8021Q.

Signed-off-by: Elad Nachman <eladn@gilat.com>

---

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2018-04-11 17:04:00.586057300 +0300
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2018-04-11 17:05:33.601992400 +0300
@@ -3293,17 +3293,19 @@ dma_map_err:

 static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
 {
-struct ethhdr *ehdr;
+struct vlan_ethhdr *veth;
 u16 vlanid;
+__be16 vlan_proto;

 if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) ==
     NETIF_F_HW_VLAN_CTAG_RX &&
     !__vlan_get_tag(skb, &vlanid)) {
 /* pop the vlan tag */
-ehdr = (struct ethhdr *)skb->data;
-memmove(skb->data + VLAN_HLEN, ehdr, ETH_ALEN * 2);
+veth = (struct vlan_ethhdr *)skb->data;
+vlan_proto = veth->h_vlan_proto;
+memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2);
 skb_pull(skb, VLAN_HLEN);
-__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlanid);
+__vlan_hwaccel_put_tag(skb, vlan_proto, vlanid);
 }
 }
IMPORTANT - This email and any attachments is intended for the above named addressee(s), and may contain information which is confidential or privileged. If you are not the intended recipient, please inform the sender immediately and delete this email: you should not copy or use this e-mail for any purpose nor disclose its contents to any person.

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

* Re: [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception
  2018-04-11 15:07 [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception Elad Nachman
@ 2018-04-13  1:48 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-13  1:48 UTC (permalink / raw)
  To: EladN; +Cc: netdev

From: Elad Nachman <EladN@gilat.com>
Date: Wed, 11 Apr 2018 15:07:40 +0000

> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2018-04-11 17:04:00.586057300 +0300
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c2018-04-11 17:05:33.601992400 +0300
> @@ -3293,17 +3293,19 @@ dma_map_err:
> 
>  static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
>  {
> -struct ethhdr *ehdr;
> +struct vlan_ethhdr *veth;
>  u16 vlanid;
> +__be16 vlan_proto;

This patch has been mangled by your email client.

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

* [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception
@ 2018-04-13  7:03 Elad Nachman
  0 siblings, 0 replies; 4+ messages in thread
From: Elad Nachman @ 2018-04-13  7:03 UTC (permalink / raw)
  To: netdev, davem

stmmac reception handler calls stmmac_rx_vlan() to strip the vlan before
calling napi_gro_receive().

The function assumes VLAN tagged frames are always tagged with 802.1Q
protocol,
and assigns ETH_P_8021Q to the skb by hard-coding the parameter on call
to __vlan_hwaccel_put_tag() .

This causes packets not to be passed to the VLAN slave if it was created
with 802.1AD protocol
(ip link add link eth0 eth0.100 type vlan proto 802.1ad id 100).

This fix passes the protocol from the VLAN header into
__vlan_hwaccel_put_tag()
instead of using the hard-coded value of ETH_P_8021Q.

Signed-off-by: Elad Nachman <eladn@gilat.com>

---

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2018-04-11
17:04:00.586057300 +0300
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2018-04-11
17:05:33.601992400 +0300
@@ -3293,17 +3293,19 @@ dma_map_err:

 static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
 {
-	struct ethhdr *ehdr;
+	struct vlan_ethhdr *veth;
 	u16 vlanid;
+	__be16 vlan_proto;

 	if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) ==
 	    NETIF_F_HW_VLAN_CTAG_RX &&
 	    !__vlan_get_tag(skb, &vlanid)) {
 		/* pop the vlan tag */
-		ehdr = (struct ethhdr *)skb->data;
-		memmove(skb->data + VLAN_HLEN, ehdr, ETH_ALEN * 2);
+		veth = (struct vlan_ethhdr *)skb->data;
+		vlan_proto = veth->h_vlan_proto;
+		memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2);
 		skb_pull(skb, VLAN_HLEN);
-		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlanid);
+		__vlan_hwaccel_put_tag(skb, vlan_proto, vlanid);
 	}
 }

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

* [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception
@ 2018-04-13  6:45 Elad Nachman
  0 siblings, 0 replies; 4+ messages in thread
From: Elad Nachman @ 2018-04-13  6:45 UTC (permalink / raw)
  To: netdev, davem

stmmac reception handler calls stmmac_rx_vlan() to strip the vlan before 
calling napi_gro_receive().

The function assumes VLAN tagged frames are always tagged with 802.1Q 
protocol,
and assigns ETH_P_8021Q to the skb by hard-coding the parameter on call 
to __vlan_hwaccel_put_tag() .

This causes packets not to be passed to the VLAN slave if it was created 
with 802.1AD protocol
(ip link add link eth0 eth0.100 type vlan proto 802.1ad id 100).

This fix passes the protocol from the VLAN header into 
__vlan_hwaccel_put_tag()
instead of using the hard-coded value of ETH_P_8021Q.

Signed-off-by: Elad Nachman <eladn@gilat.com>

---

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2018-04-11 
17:04:00.586057300 +0300

+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c	2018-04-11 
17:05:33.601992400 +0300

@@ -3293,17 +3293,19 @@ dma_map_err:



  static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)

  {

-	struct ethhdr *ehdr;

+	struct vlan_ethhdr *veth;

  	u16 vlanid;

+	__be16 vlan_proto;



  	if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) ==

  	    NETIF_F_HW_VLAN_CTAG_RX &&

  	    !__vlan_get_tag(skb, &vlanid)) {

  		/* pop the vlan tag */

-		ehdr = (struct ethhdr *)skb->data;

-		memmove(skb->data + VLAN_HLEN, ehdr, ETH_ALEN * 2);

+		veth = (struct vlan_ethhdr *)skb->data;

+		vlan_proto = veth->h_vlan_proto;

+		memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2);

  		skb_pull(skb, VLAN_HLEN);

-		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlanid);

+		__vlan_hwaccel_put_tag(skb, vlan_proto, vlanid);

  	}

  }

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

end of thread, other threads:[~2018-04-13  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 15:07 [PATCH] net: stmmac: fix missing support for 802.1AD tag on reception Elad Nachman
2018-04-13  1:48 ` David Miller
2018-04-13  6:45 Elad Nachman
2018-04-13  7:03 Elad Nachman

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.