Commit 839c8cc3 authored by David S. Miller's avatar David S. Miller

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
	  cbf1de72 for bnx2x
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3955b22b 0aba93e2
...@@ -504,13 +504,11 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, ...@@ -504,13 +504,11 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp, skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp,
tpa_info->parsing_flags, len_on_bd); tpa_info->parsing_flags, len_on_bd);
/* set for GRO */ skb_shinfo(skb)->gso_type =
if (fp->mode == TPA_MODE_GRO) (GET_FLAG(tpa_info->parsing_flags,
skb_shinfo(skb)->gso_type = PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) ==
(GET_FLAG(tpa_info->parsing_flags, PRS_FLAG_OVERETH_IPV6) ?
PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
PRS_FLAG_OVERETH_IPV6) ?
SKB_GSO_TCPV6 : SKB_GSO_TCPV4;
} }
......
...@@ -1401,6 +1401,10 @@ static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring, ...@@ -1401,6 +1401,10 @@ static void ixgbe_set_rsc_gso_size(struct ixgbe_ring *ring,
/* set gso_size to avoid messing up TCP MSS */ /* set gso_size to avoid messing up TCP MSS */
skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len), skb_shinfo(skb)->gso_size = DIV_ROUND_UP((skb->len - hdr_len),
IXGBE_CB(skb)->append_cnt); IXGBE_CB(skb)->append_cnt);
if (skb->protocol == __constant_htons(ETH_P_IPV6))
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
else
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
} }
static void ixgbe_update_rsc_stats(struct ixgbe_ring *rx_ring, static 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,6 +1439,8 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
{ {
struct net_device *dev = rx_ring->netdev; struct net_device *dev = rx_ring->netdev;
skb->protocol = eth_type_trans(skb, dev);
ixgbe_update_rsc_stats(rx_ring, skb); ixgbe_update_rsc_stats(rx_ring, skb);
ixgbe_rx_hash(rx_ring, rx_desc, skb); ixgbe_rx_hash(rx_ring, rx_desc, skb);
...@@ -1450,8 +1456,6 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, ...@@ -1450,8 +1456,6 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring,
} }
skb_record_rx_queue(skb, rx_ring->queue_index); skb_record_rx_queue(skb, rx_ring->queue_index);
skb->protocol = eth_type_trans(skb, dev);
} }
static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector,
......
...@@ -986,8 +986,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, ...@@ -986,8 +986,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
th->seq = htonl(seq_number); th->seq = htonl(seq_number);
length = skb->len; length = skb->len;
if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) if (adapter->flags & QLCNIC_FW_LRO_MSS_CAP) {
skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1); skb_shinfo(skb)->gso_size = qlcnic_get_lro_sts_mss(sts_data1);
if (skb->protocol == htons(ETH_P_IPV6))
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
else
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
}
if (vid != 0xffff) if (vid != 0xffff)
__vlan_hwaccel_put_tag(skb, vid); __vlan_hwaccel_put_tag(skb, vid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment