ixgbe, TSO, and NETIF_F_TSO_MANGLEID
Subsystems (2)
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
Quoted 34 lines · Shannon Nelson
Hi folks,
In trying to get TSO working for ipsec offload, I've found that
NETIF_F_TSO_MANGLEIDis not set, so theNETIF_F_TSObit is getting stripped inixgbe_features_check().Back in commit
commitb83e30104bd9("ixgbe/ixgbevf: Add support for GSO partial")
NETIF_F_TSO_MANGLEIDwas added tonetdev->vlan_featuresinixgbe_probe(), but it is never added tonetdev->features. The patch also added a check forNETIF_F_TSO_MANGLEIDinixgbe_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 usingdev->features, notdev->vlan_features.Should
NETIF_F_TSO_MANGLEIDbe added tonetdev->featuresas well? Something like:drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3
-1@@ -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
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_MANGLEIDis not set, so theNETIF_F_TSObit is getting stripped inixgbe_features_check().Back in commit
commitb83e30104bd9("ixgbe/ixgbevf: Add support for GSO partial")
NETIF_F_TSO_MANGLEIDwas added tonetdev->vlan_featuresinixgbe_probe(), but it is never added tonetdev->features. The patch also added a check forNETIF_F_TSO_MANGLEIDinixgbe_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 usingdev->features, notdev->vlan_features.Should
NETIF_F_TSO_MANGLEIDbe added tonetdev->featuresas well? Something like: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 ;
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_MANGLEIDcan 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_MANGLEIDsupport for IPSEC offload? Is it usingGSO_PARTIALfor the IPSec offload? Is IPSec settingskb->encapsulation? If so you might need to clean upixgbe_features_checksince we had assumed thatskb->encapsulationmeant 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
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_MANGLEIDis not set, so theNETIF_F_TSObit is getting stripped
inixgbe_features_check().Back in commit
commitb83e30104bd9("ixgbe/ixgbevf: Add support for GSO partial")
NETIF_F_TSO_MANGLEIDwas added tonetdev->vlan_featuresinixgbe_probe(), but it is never added tonetdev->features. The patch also added a check forNETIF_F_TSO_MANGLEIDinixgbe_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 usingdev->features, notdev->vlan_features.Should
NETIF_F_TSO_MANGLEIDbe added tonetdev->featuresas well? Something
like:drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0
-0@@ -10441,7 +10441,9 @@ static int ixgbe_probe(struct pci_dev *pdev,const
structpci_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_MANGLEIDcan 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_MANGLEIDsupport for IPSEC offload? Is it usingGSO_PARTIALfor the IPSec offload? Is IPSec settingskb->encapsulation? If so you might need to clean upixgbe_features_checksince we had assumed thatskb->encapsulationmeant either a GRE or UDP based tunnel offload.
Quoted 7 lines
Yes, IPsec's
net/xfrm/xfrm_output.csetsskb->encapsulationwhen doing an offload.I can tweak the
features_checkto 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