vmxnet3: correctly report gso type for UDP tunnels
Subsystems (3)
Ronak Doshi
maintainerPATCH v3 1/1 vmxnet3: correctly report gso type for UDP tunnels
Commit 3d010c8031e3 ("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.
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.
--- drivers/net/vmxnet3/vmxnet3_drv.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/net/vmxnet3/vmxnet3_drv.c +26 -0
@@ -1568,6 +1568,30 @@ vmxnet3_get_hdr_len(struct vmxnet3_adapter *adapter, struct sk_buff *skb,return (hlen + (hdr.tcp->doff <<2 )); } +static void +vmxnet3_lro_tunnel (struct sk_buff *skb,__be16 ip_proto) +{ +struct udphdr *uh =NULL ; + +if (ip_proto ==htons (ETH_P_IP )) { +struct iphdr *iph = (struct iphdr *)skb->data; + +if (iph->protocol ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + }else { +struct ipv6hdr *iph = (struct ipv6hdr *)skb->data; + +if (iph->nexthdr ==IPPROTO_UDP ) + uh = (struct udphdr *)(iph +1 ); + } +if (uh) { +if (uh->check) +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL_CSUM ; +else +skb_shinfo (skb)->gso_type |=SKB_GSO_UDP_TUNNEL ; + } +} +static int vmxnet3_rq_rx_complete (struct vmxnet3_rx_queue *rq,struct vmxnet3_adapter *adapter,int quota)
@@ -1881,6 +1905,8 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,if (segCnt !=0 && mss !=0 ) {skb_shinfo (skb)->gso_type = rcd->v4 ?SKB_GSO_TCPV4 :SKB_GSO_TCPV6 ; +if (encap_lro) +vmxnet3_lro_tunnel (skb, skb->protocol);skb_shinfo (skb)->gso_size = mss;skb_shinfo (skb)->gso_segs = segCnt; }else if ((segCnt !=0 || skb->len > mtu) && !encap_lro) {
Signature · 1 line
2.45.2
Paolo Abeni
maintainerQuoted 5 lines · Ronak Doshi
Commit
3d010c8031e3("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.
Quoted 8 lines
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.
I think it would be better if you rephrase the above paragraph, as is a bit misleading. The workaround is available only in some scenarios: when the egress device supports tunnel TSO and only if the relevant egress driver does not use the skb inner fields (many NICs actually use/need them).
Note that there is no guarantee that the egress device will be vmxnet, too.
/P