fix mvneta vlan tagging
[openwrt/openwrt.git] / target / linux / mvebu / patches-3.14 / 110-mvneta_fix_tso_and_chksum.patch
1 --- a/drivers/net/ethernet/marvell/mvneta.c
2 +++ b/drivers/net/ethernet/marvell/mvneta.c
3 @@ -20,6 +20,7 @@
4 #include <linux/mbus.h>
5 #include <linux/module.h>
6 #include <linux/interrupt.h>
7 +#include <linux/if_vlan.h>
8 #include <net/ip.h>
9 #include <net/ipv6.h>
10 #include <linux/io.h>
11 @@ -1380,15 +1381,16 @@ static u32 mvneta_skb_tx_csum(struct mvn
12 {
13 if (skb->ip_summed == CHECKSUM_PARTIAL) {
14 int ip_hdr_len = 0;
15 + __be16 l3_proto = vlan_get_protocol(skb);
16 u8 l4_proto;
17
18 - if (skb->protocol == htons(ETH_P_IP)) {
19 + if (l3_proto == htons(ETH_P_IP)) {
20 struct iphdr *ip4h = ip_hdr(skb);
21
22 /* Calculate IPv4 checksum and L4 checksum */
23 ip_hdr_len = ip4h->ihl;
24 l4_proto = ip4h->protocol;
25 - } else if (skb->protocol == htons(ETH_P_IPV6)) {
26 + } else if (l3_proto == htons(ETH_P_IPV6)) {
27 struct ipv6hdr *ip6h = ipv6_hdr(skb);
28
29 /* Read l4_protocol from one of IPv6 extra headers */
30 @@ -1399,7 +1401,7 @@ static u32 mvneta_skb_tx_csum(struct mvn
31 return MVNETA_TX_L4_CSUM_NOT;
32
33 return mvneta_txq_desc_csum(skb_network_offset(skb),
34 - skb->protocol, ip_hdr_len, l4_proto);
35 + l3_proto, ip_hdr_len, l4_proto);
36 }
37
38 return MVNETA_TX_L4_CSUM_NOT;