aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Yasevich <vyasevich@gmail.com>2014-08-25 10:34:55 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-25 20:27:10 -0400
commit1ee1cfe7d3df00bff11dd28576eeac1875d7d51f (patch)
treefe056ca032ee9d8b0307b4502e198f0efc3a2209
parent817dbfa5d1bc276a72c1a577310382008e8aca0a (diff)
qlge: Fix TSO for non-accelerated vlan traffic
This device claims TSO support for vlans. It also allows a user to control vlan acceleration offloading. As such, it is possible to turn off vlan acceleration and configure a vlan which will continue to send TSO traffic. In such situation the packet passed down the the device will contain a vlan header and skb->protocol will be set to ETH_P_8021Q. The device assumes that skb->protocol contains network protocol value and uses that value to set up TSO information. This results in corrupted frames sent on the wire. This patch extracts the protocol value correctly by using a vlan_get_protocol() helper and corrects corrupt TSO frames. CC: Shahed Shaikh <shahed.shaikh@qlogic.com> CC: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> CC: Ron Mercer <ron.mercer@qlogic.com> CC: linux-driver@qlogic.com Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com> Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 188626e2a861..3e96f269150d 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -2556,6 +2556,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr)
2556 2556
2557 if (skb_is_gso(skb)) { 2557 if (skb_is_gso(skb)) {
2558 int err; 2558 int err;
2559 __be16 l3_proto = vlan_get_protocol(skb);
2559 2560
2560 err = skb_cow_head(skb, 0); 2561 err = skb_cow_head(skb, 0);
2561 if (err < 0) 2562 if (err < 0)
@@ -2572,7 +2573,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr)
2572 << OB_MAC_TRANSPORT_HDR_SHIFT); 2573 << OB_MAC_TRANSPORT_HDR_SHIFT);
2573 mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 2574 mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
2574 mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; 2575 mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO;
2575 if (likely(skb->protocol == htons(ETH_P_IP))) { 2576 if (likely(l3_proto == htons(ETH_P_IP))) {
2576 struct iphdr *iph = ip_hdr(skb); 2577 struct iphdr *iph = ip_hdr(skb);
2577 iph->check = 0; 2578 iph->check = 0;
2578 mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; 2579 mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4;
@@ -2580,7 +2581,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr)
2580 iph->daddr, 0, 2581 iph->daddr, 0,
2581 IPPROTO_TCP, 2582 IPPROTO_TCP,
2582 0); 2583 0);
2583 } else if (skb->protocol == htons(ETH_P_IPV6)) { 2584 } else if (l3_proto == htons(ETH_P_IPV6)) {
2584 mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; 2585 mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6;
2585 tcp_hdr(skb)->check = 2586 tcp_hdr(skb)->check =
2586 ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, 2587 ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,