Message ID | 20241024163112.298865-1-tariqt@nvidia.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] bonding: add ESP offload features when slaves support | expand |
On Thu, 24 Oct 2024 19:31:12 +0300 Tariq Toukan wrote: > +#ifdef CONFIG_XFRM_OFFLOAD > + if (gso_partial_features & NETIF_F_GSO_ESP) > + bond_dev->gso_partial_features |= NETIF_F_GSO_ESP; > + else > + bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP; > +#endif /* CONFIG_XFRM_OFFLOAD */ Hiding the block under ifdef is unnecessary. If you worry about the no-lower devs case - add IS_ENABLED() to the if condition. The local variable doesn't have to be under ifdef either (making it more rev xmas tree compatible)
On 11/1/2024 8:48 AM, Jakub Kicinski wrote: > On Thu, 24 Oct 2024 19:31:12 +0300 Tariq Toukan wrote: >> +#ifdef CONFIG_XFRM_OFFLOAD >> + if (gso_partial_features & NETIF_F_GSO_ESP) >> + bond_dev->gso_partial_features |= NETIF_F_GSO_ESP; >> + else >> + bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP; >> +#endif /* CONFIG_XFRM_OFFLOAD */ > > Hiding the block under ifdef is unnecessary. OK. > If you worry about the no-lower devs case - add IS_ENABLED() It will jump to done and bond_dev->gso_partial_features is not changed. Seems no need to take care of such case, right? > to the if condition. The local variable doesn't have to be under > ifdef either (making it more rev xmas tree compatible) Sure, I will change in V2. Thanks! Jianbo
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3928287f5865..f7c734cfb917 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1548,6 +1548,7 @@ static void bond_compute_features(struct bonding *bond) netdev_features_t vlan_features = BOND_VLAN_FEATURES; netdev_features_t enc_features = BOND_ENC_FEATURES; #ifdef CONFIG_XFRM_OFFLOAD + netdev_features_t gso_partial_features = NETIF_F_GSO_ESP; netdev_features_t xfrm_features = BOND_XFRM_FEATURES; #endif /* CONFIG_XFRM_OFFLOAD */ netdev_features_t mpls_features = BOND_MPLS_FEATURES; @@ -1575,6 +1576,9 @@ static void bond_compute_features(struct bonding *bond) xfrm_features = netdev_increment_features(xfrm_features, slave->dev->hw_enc_features, BOND_XFRM_FEATURES); + + if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL) + gso_partial_features &= slave->dev->gso_partial_features; #endif /* CONFIG_XFRM_OFFLOAD */ mpls_features = netdev_increment_features(mpls_features, @@ -1590,6 +1594,13 @@ static void bond_compute_features(struct bonding *bond) } bond_dev->hard_header_len = max_hard_header_len; +#ifdef CONFIG_XFRM_OFFLOAD + if (gso_partial_features & NETIF_F_GSO_ESP) + bond_dev->gso_partial_features |= NETIF_F_GSO_ESP; + else + bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP; +#endif /* CONFIG_XFRM_OFFLOAD */ + done: bond_dev->vlan_features = vlan_features; bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |