Skip to content

Commit 8bcd560

Browse files
qsndavem330
authored andcommitted
Revert "net: macsec: report real_dev features when HW offloading is enabled"
This reverts commit c850240. That commit tried to improve the performance of macsec offload by taking advantage of some of the NIC's features, but in doing so, broke macsec offload when the lower device supports both macsec and ipsec offload, as the ipsec offload feature flags (mainly NETIF_F_HW_ESP) were copied from the real device. Since the macsec device doesn't provide xdo_* ops, the XFRM core rejects the registration of the new macsec device in xfrm_api_check. Example perf trace when running ip link add link eni1np1 type macsec port 4 offload mac ip 737 [003] 795.477676: probe:xfrm_dev_event__REGISTER name="macsec0" features=0x1c000080014869 xfrm_dev_event+0x3a notifier_call_chain+0x47 register_netdevice+0x846 macsec_newlink+0x25a ip 737 [003] 795.477687: probe:xfrm_dev_event__return ret=0x8002 (NOTIFY_BAD) notifier_call_chain+0x47 register_netdevice+0x846 macsec_newlink+0x25a dev->features includes NETIF_F_HW_ESP (0x04000000000000), so xfrm_api_check returns NOTIFY_BAD because we don't have dev->xfrmdev_ops on the macsec device. We could probably propagate GSO and a few other features from the lower device, similar to macvlan. This will be done in a future patch. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Antoine Tenart <atenart@kernel.org> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent cdb525c commit 8bcd560

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

drivers/net/macsec.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,11 +2654,6 @@ static int macsec_upd_offload(struct sk_buff *skb, struct genl_info *info)
26542654
if (ret)
26552655
goto rollback;
26562656

2657-
/* Force features update, since they are different for SW MACSec and
2658-
* HW offloading cases.
2659-
*/
2660-
netdev_update_features(dev);
2661-
26622657
rtnl_unlock();
26632658
return 0;
26642659

@@ -3432,16 +3427,9 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
34323427
return ret;
34333428
}
34343429

3435-
#define SW_MACSEC_FEATURES \
3430+
#define MACSEC_FEATURES \
34363431
(NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
34373432

3438-
/* If h/w offloading is enabled, use real device features save for
3439-
* VLAN_FEATURES - they require additional ops
3440-
* HW_MACSEC - no reason to report it
3441-
*/
3442-
#define REAL_DEV_FEATURES(dev) \
3443-
((dev)->features & ~(NETIF_F_VLAN_FEATURES | NETIF_F_HW_MACSEC))
3444-
34453433
static int macsec_dev_init(struct net_device *dev)
34463434
{
34473435
struct macsec_dev *macsec = macsec_priv(dev);
@@ -3458,12 +3446,8 @@ static int macsec_dev_init(struct net_device *dev)
34583446
return err;
34593447
}
34603448

3461-
if (macsec_is_offloaded(macsec)) {
3462-
dev->features = REAL_DEV_FEATURES(real_dev);
3463-
} else {
3464-
dev->features = real_dev->features & SW_MACSEC_FEATURES;
3465-
dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE;
3466-
}
3449+
dev->features = real_dev->features & MACSEC_FEATURES;
3450+
dev->features |= NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE;
34673451

34683452
dev->needed_headroom = real_dev->needed_headroom +
34693453
MACSEC_NEEDED_HEADROOM;
@@ -3495,10 +3479,7 @@ static netdev_features_t macsec_fix_features(struct net_device *dev,
34953479
struct macsec_dev *macsec = macsec_priv(dev);
34963480
struct net_device *real_dev = macsec->real_dev;
34973481

3498-
if (macsec_is_offloaded(macsec))
3499-
return REAL_DEV_FEATURES(real_dev);
3500-
3501-
features &= (real_dev->features & SW_MACSEC_FEATURES) |
3482+
features &= (real_dev->features & MACSEC_FEATURES) |
35023483
NETIF_F_GSO_SOFTWARE | NETIF_F_SOFT_FEATURES;
35033484
features |= NETIF_F_LLTX;
35043485

0 commit comments

Comments
 (0)