]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfp: avoid oversized TSO headers with metadata prepend
authorJakub Kicinski <jakub.kicinski@netronome.com>
Wed, 28 Nov 2018 06:24:52 +0000 (22:24 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 30 Nov 2018 21:30:44 +0000 (13:30 -0800)
In preparation for TSO over representors make sure the port id
prepend will always fit in the frame.  The current max header
length is 255, which is ample, so assume worst case scenario
of 8 byte prepend and save ourselves the conditionals.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/nfp_net_common.c

index 9cc2c204baa3e0973f7e2dd23a99e9c2967635ff..3cb7dceca2d902d9d45a39f9f0f1eaf9d034a57d 100644 (file)
@@ -3284,7 +3284,10 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
                hdrlen = skb_inner_transport_header(skb) - skb->data +
                        inner_tcp_hdrlen(skb);
 
-               if (unlikely(hdrlen > NFP_NET_LSO_MAX_HDR_SZ))
+               /* Assume worst case scenario of having longest possible
+                * metadata prepend - 8B
+                */
+               if (unlikely(hdrlen > NFP_NET_LSO_MAX_HDR_SZ - 8))
                        features &= ~NETIF_F_GSO_MASK;
        }