net/sfc: improve tunnel TSO mask calculation
authorAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Thu, 11 Mar 2021 12:25:38 +0000 (15:25 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 22 Mar 2021 17:05:39 +0000 (18:05 +0100)
Corresponding tunnel TSO is not supported if the tunnel is not
supported.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
drivers/net/sfc/sfc_tx.c

index 4db3941..28d696d 100644 (file)
@@ -49,9 +49,15 @@ sfc_tx_get_offload_mask(struct sfc_adapter *sa)
        if (!sa->tso)
                no_caps |= DEV_TX_OFFLOAD_TCP_TSO;
 
-       if (!sa->tso_encap)
-               no_caps |= (DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
-                           DEV_TX_OFFLOAD_GENEVE_TNL_TSO);
+       if (!sa->tso_encap ||
+           (encp->enc_tunnel_encapsulations_supported &
+            (1u << EFX_TUNNEL_PROTOCOL_VXLAN)) == 0)
+               no_caps |= DEV_TX_OFFLOAD_VXLAN_TNL_TSO;
+
+       if (!sa->tso_encap ||
+           (encp->enc_tunnel_encapsulations_supported &
+            (1u << EFX_TUNNEL_PROTOCOL_GENEVE)) == 0)
+               no_caps |= DEV_TX_OFFLOAD_GENEVE_TNL_TSO;
 
        return ~no_caps;
 }