aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-02-10 20:14:46 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-10 20:14:46 -0500
commit839c8cc32bc252345f4d5767d2d6cf695f2124ab (patch)
treed7b0904cf9f44ab1fa5caaca7ba912ad0e944c9e
parent3955b22b9798ae8694ac053614694695991f0a91 (diff)
parent0aba93e2b9fb0be4f4dd1b52ef10d789edf15f74 (diff)
Merge branch 'gso_type'
Michael S. Tsirkin says: ==================== At the moment, macvtap crashes are observed if macvtap is attached to an interface with LRO enabled. The crash in question is BUG() in macvtap_skb_to_vnet_hdr. This happens because several drivers set gso_size but not gso_type in incoming skbs. This didn't use to be the case: with intel cards on 3.2 and older kernels, with qlogic - on 3.4 and older kernels, so it's a regression if not a recent one. The following patches fix this for qlogic, broadcom and intel drivers. I tested that the patch fixes the crash for ixgbe but don't have qlogic/broadcom hardware to test. I also only tested TCPv4. Please review, and consider for 3.8. Changes from v1: - added missing htons as suggested by Eric - backported the relevant bits from cbf1de72324a8105ddcc3d9ce9acbc613faea17e for bnx2x ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c12
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c8
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c7
3 files changed, 17 insertions, 10 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f771ddfba646..a5edac8df67b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -504,13 +504,11 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
504 skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp, 504 skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp,
505 tpa_info->parsing_flags, len_on_bd); 505 tpa_info->parsing_flags, len_on_bd);
506 506
507 /* set for GRO */ 507 skb_shinfo(skb)->gso_type =
508 if (fp->mode == TPA_MODE_GRO) 508 (GET_FLAG(tpa_info->parsing_flags,
509 skb_shinfo(skb)->gso_type = 509 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
510 (GET_FLAG(tpa_info->parsing_flags, 510 PRS_FLAG_OVERETH_IPV6) ?
511 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == 511 SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
512 PRS_FLAG_OVERETH_IPV6) ?
513 SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
514 } 512 }
515 513
516 514
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 20a5af6d87d0..e1b2d22a2850 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1401,6 +1401,10 @@ static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
1401 /* set gso_size to avoid messing up TCP MSS */ 1401 /* set gso_size to avoid messing up TCP MSS */
1402 skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len), 1402 skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len),
1403 IXGBE_CB(skb)->append_cnt); 1403 IXGBE_CB(skb)->append_cnt);
1404 if (skb->protocol == __constant_htons(ETH_P_IPV6))
1405 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
1406 else
1407 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
1404} 1408}
1405 1409
1406static void ixgbe_update_rsc_stats(struct ixgbe_ring *rx_ring, 1410static void ixgbe_update_rsc_stats(struct ixgbe_ring *rx_ring,
@@ -1435,6 +1439,8 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
1435{ 1439{
1436 struct net_device *dev = rx_ring->netdev; 1440 struct net_device *dev = rx_ring->netdev;
1437 1441
1442 skb->protocol = eth_type_trans(skb, dev);
1443
1438 ixgbe_update_rsc_stats(rx_ring, skb); 1444 ixgbe_update_rsc_stats(rx_ring, skb);
1439 1445
1440 ixgbe_rx_hash(rx_ring, rx_desc, skb); 1446 ixgbe_rx_hash(rx_ring, rx_desc, skb);
@@ -1450,8 +1456,6 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
1450 } 1456 }
1451 1457
1452 skb_record_rx_queue(skb, rx_ring->queue_index); 1458 skb_record_rx_queue(skb, rx_ring->queue_index);
1453
1454 skb->protocol = eth_type_trans(skb, dev);
1455} 1459}
1456 1460
1457static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, 1461static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6f82812d0fab..09aa310b6194 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -986,8 +986,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
986 th->seq = htonl(seq_number); 986 th->seq = htonl(seq_number);
987 length = skb->len; 987 length = skb->len;
988 988
989 if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) 989 if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) {
990 skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1); 990 skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1);
991 if (skb->protocol == htons(ETH_P_IPV6))
992 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
993 else
994 skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
995 }
991 996
992 if (vid != 0xffff) 997 if (vid != 0xffff)
993 __vlan_hwaccel_put_tag(skb, vid); 998 __vlan_hwaccel_put_tag(skb, vid);