Skip to contentSkip to conversation

ixgbe, TSO, and NETIF_F_TSO_MANGLEID

Intel-wired-lan Shannon Nelson 2 participants 4 messages Mar 1, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi folks,

In trying to get TSO working for ipsec offload, I've found that NETIF_F_TSO_MANGLEID is not set, so the NETIF_F_TSO bit is getting stripped in ixgbe_features_check().

Back in commit
commit b83e30104bd9 ("ixgbe/ixgbevf: Add support for GSO partial")

NETIF_F_TSO_MANGLEID was added to netdev->vlan_features in ixgbe_probe(), but it is never added to netdev->features. The patch also added a check for NETIF_F_TSO_MANGLEID in ixgbe_features_check(), but the test is looking in the "features" passed into the function. As far as I can tell, the calls into .ndo_features_check() are using dev->features, not dev->vlan_features.

Should NETIF_F_TSO_MANGLEID be added to netdev->features as well? Something like:

(quoted diff) +0 -0

b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 82c0543..dcb408b 100644

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
@@ -10441,7 +10441,9 @@ static int ixgbe_probe(struct pci_dev *pdev, 

const struct pci_device_id *ent)

         if (pci_using_dac)
                 netdev->features |= NETIF_F_HIGHDMA;
-       netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
+       netdev->features |= NETIF_F_TSO_MANGLEID;
+       netdev->vlan_features |= NETIF_F_TSO_MANGLEID;
+
         netdev->hw_enc_features |= netdev->vlan_features;
         netdev->mpls_features |= NETIF_F_SG |
                                  NETIF_F_TSO |

Cheers,
sln

Signature · 3 lines
==================================================
Shannon Nelson           shannon.nelson at oracle.com
Parents can't afford to be squeamish
#1 lore raw
Quoted 34 lines · Shannon Nelson

Hi folks,

In trying to get TSO working for ipsec offload, I've found that NETIF_F_TSO_MANGLEID is not set, so the NETIF_F_TSO bit is getting stripped in ixgbe_features_check().

Back in commit
commit b83e30104bd9 ("ixgbe/ixgbevf: Add support for GSO partial")

NETIF_F_TSO_MANGLEID was added to netdev->vlan_features in ixgbe_probe(), but it is never added to netdev->features. The patch also added a check for NETIF_F_TSO_MANGLEID in ixgbe_features_check(), but the test is looking in the "features" passed into the function. As far as I can tell, the calls into .ndo_features_check() are using dev->features, not dev->vlan_features.

Should NETIF_F_TSO_MANGLEID be added to netdev->features as well? Something like:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -1
index 82c0543..dcb408b 100644
@@ -10441,7 +10441,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const
 struct pci_device_id *ent)
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-       netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
+       netdev->features |= NETIF_F_TSO_MANGLEID;
+       netdev->vlan_features |= NETIF_F_TSO_MANGLEID;
+
        netdev->hw_enc_features |= netdev->vlan_features;
        netdev->mpls_features |= NETIF_F_SG |
Quoted 1 line

NETIF_F_TSO |

No, we didn't want to add that by default as TSO_MANGLEID can result in GRO not working in the case of older kernels.

The question I would have is why you need TSO_MANGLEID support for IPSEC offload? Is it using GSO_PARTIAL for the IPSec offload? Is IPSec setting skb->encapsulation? If so you might need to clean up ixgbe_features_check since we had assumed that skb->encapsulation meant either a GRE or UDP based tunnel offload.

- Alex

#2 lore raw
Quoted 30 lines · Alexander Duyck
Quoted 28 lines · Shannon Nelson

Hi folks,

In trying to get TSO working for ipsec offload, I've found that NETIF_F_TSO_MANGLEID is not set, so the NETIF_F_TSO bit is getting stripped in ixgbe_features_check().

Back in commit
commit b83e30104bd9 ("ixgbe/ixgbevf: Add support for GSO partial")

NETIF_F_TSO_MANGLEID was added to netdev->vlan_features in ixgbe_probe(), but it is never added to netdev->features. The patch also added a check for NETIF_F_TSO_MANGLEID in ixgbe_features_check(), but the test is looking in the "features" passed into the function. As far as I can tell, the calls into .ndo_features_check() are using dev->features, not dev->vlan_features.

Should NETIF_F_TSO_MANGLEID be added to netdev->features as well? Something like:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
index 82c0543..dcb408b 100644
@@ -10441,7 +10441,9 @@ static int ixgbe_probe(struct pci_dev *pdev, const
 struct pci_device_id *ent)
         if (pci_using_dac)
                 netdev->features |= NETIF_F_HIGHDMA;
 
Quoted 10 lines
Quoted 7 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -1
-       netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
+       netdev->features |= NETIF_F_TSO_MANGLEID;
+       netdev->vlan_features |= NETIF_F_TSO_MANGLEID;
+
         netdev->hw_enc_features |= netdev->vlan_features;
         netdev->mpls_features |= NETIF_F_SG |

NETIF_F_TSO |

No, we didn't want to add that by default as TSO_MANGLEID can result in GRO not working in the case of older kernels.

But in the kernel driver we don't care about "older kernels", right?

Quoted 6 lines

The question I would have is why you need TSO_MANGLEID support for IPSEC offload? Is it using GSO_PARTIAL for the IPSec offload? Is IPSec setting skb->encapsulation? If so you might need to clean up ixgbe_features_check since we had assumed that skb->encapsulation meant either a GRE or UDP based tunnel offload.

Yes, IPsec's net/xfrm/xfrm_output.c sets skb->encapsulation when doing an offload.

I can tweak the features_check to leave TSO alone for IPsec offloads and we'll see if that doesn't break anything else.

sln

#3 lore raw
Quoted 62 lines · Shannon Nelson
Quoted 38 lines · Alexander Duyck
Quoted 35 lines · Shannon Nelson

Hi folks,

In trying to get TSO working for ipsec offload, I've found that NETIF_F_TSO_MANGLEID is not set, so the NETIF_F_TSO bit is getting stripped
in ixgbe_features_check().

Back in commit
commit b83e30104bd9 ("ixgbe/ixgbevf: Add support for GSO partial")

NETIF_F_TSO_MANGLEID was added to netdev->vlan_features in ixgbe_probe(), but it is never added to netdev->features. The patch also added a check for
NETIF_F_TSO_MANGLEID in ixgbe_features_check(), but the test is looking in
the "features" passed into the function. As far as I can tell, the calls into .ndo_features_check() are using dev->features, not dev->vlan_features.

Should NETIF_F_TSO_MANGLEID be added to netdev->features as well? Something
like:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
index 82c0543..dcb408b 100644
@@ -10441,7 +10441,9 @@ static int ixgbe_probe(struct pci_dev *pdev,

const
struct pci_device_id *ent)

         if (pci_using_dac)
                 netdev->features |= NETIF_F_HIGHDMA;
Quoted 11 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Quoted 7 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -1
-       netdev->vlan_features |= netdev->features | NETIF_F_TSO_MANGLEID;
+       netdev->features |= NETIF_F_TSO_MANGLEID;
+       netdev->vlan_features |= NETIF_F_TSO_MANGLEID;
+
         netdev->hw_enc_features |= netdev->vlan_features;
         netdev->mpls_features |= NETIF_F_SG |
                                  NETIF_F_TSO |

No, we didn't want to add that by default as TSO_MANGLEID can result in GRO not working in the case of older kernels.

But in the kernel driver we don't care about "older kernels", right?

Quoted 6 lines

The question I would have is why you need TSO_MANGLEID support for IPSEC offload? Is it using GSO_PARTIAL for the IPSec offload? Is IPSec setting skb->encapsulation? If so you might need to clean up ixgbe_features_check since we had assumed that skb->encapsulation meant either a GRE or UDP based tunnel offload.

Quoted 7 lines

Yes, IPsec's net/xfrm/xfrm_output.c sets skb->encapsulation when doing an offload.

I can tweak the features_check to leave TSO alone for IPsec offloads and we'll see if that doesn't break anything else.

sln

The reason for the MANGLE_ID check clearing TSO was because we cannot cleanly support inner IPv4 offload with full encapsulation. Basically we are stuck repeating the inner IPv4 header so the IP ID is "mangled".

An alternative would be to use something like net_gso_ok and strip the partial features to determine if we can handle it or not. If not then we need to drop TSO. It might be worthwhile to look at only doing this if we are dealing with csum and gso_size being set like what we already do in the driver. That way we can avoid touching more cache lines then we need to.

Thanks.

- Alex