Skip to content

Commit ab76404

Browse files
Ronak DoshiNipaLocal
Ronak Doshi
authored and
NipaLocal
committed
vmxnet3: correctly report gso type for UDP tunnels
Commit 3d010c8 ("udp: do not accept non-tunnel GSO skbs landing in a tunnel") added checks in linux stack to not accept non-tunnel GRO packets landing in a tunnel. This exposed an issue in vmxnet3 which was not correctly reporting GRO packets for tunnel packets. This patch fixes this issue by setting correct GSO type for the tunnel packets. Currently, vmxnet3 does not support reporting inner fields for LRO tunnel packets. This is fine for now as workaround is to enable tnl-segmentation offload on the relevant interfaces. This problem pre-exists this patch fix and can be addressed as a separate future patch. Fixes: dacce2b ("vmxnet3: add geneve and vxlan tunnel offload support") Signed-off-by: Ronak Doshi <[email protected]> Acked-by: Guolin Yang <[email protected]> Changes v1-->v2: Do not set encapsulation bit as inner fields are not updated Changes v2-->v3: Update the commit message explaining the next steps to address segmentation issues that pre-exists this patch fix. Signed-off-by: NipaLocal <nipa@local>
1 parent b856b39 commit ab76404

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/net/vmxnet3/vmxnet3_drv.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,30 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb,
15721572
return (hlen + (hdr.tcp->doff << 2));
15731573
}
15741574

1575+
static void
1576+
vmxnet3_lro_tunnel(struct sk_buff *skb, __be16 ip_proto)
1577+
{
1578+
struct udphdr *uh = NULL;
1579+
1580+
if (ip_proto == htons(ETH_P_IP)) {
1581+
struct iphdr *iph = (struct iphdr *)skb->data;
1582+
1583+
if (iph->protocol == IPPROTO_UDP)
1584+
uh = (struct udphdr *)(iph + 1);
1585+
} else {
1586+
struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
1587+
1588+
if (iph->nexthdr == IPPROTO_UDP)
1589+
uh = (struct udphdr *)(iph + 1);
1590+
}
1591+
if (uh) {
1592+
if (uh->check)
1593+
skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL_CSUM;
1594+
else
1595+
skb_shinfo(skb)->gso_type |= SKB_GSO_UDP_TUNNEL;
1596+
}
1597+
}
1598+
15751599
static int
15761600
vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
15771601
struct vmxnet3_adapter *adapter, int quota)
@@ -1885,6 +1909,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
18851909
if (segCnt != 0 && mss != 0) {
18861910
skb_shinfo(skb)->gso_type = rcd->v4 ?
18871911
SKB_GSO_TCPV4 : SKB_GSO_TCPV6;
1912+
if (encap_lro)
1913+
vmxnet3_lro_tunnel(skb, skb->protocol);
18881914
skb_shinfo(skb)->gso_size = mss;
18891915
skb_shinfo(skb)->gso_segs = segCnt;
18901916
} else if ((segCnt != 0 || skb->len > mtu) && !encap_lro) {

0 commit comments

Comments
 (0)