Skip to contentSkip to conversation

net/mlx5e: advertise MACsec offload only when supported

PATCH Superseded Ralf Lici 2 participants 4 messages Aug 18 – Sep 17

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ralf Lici

author
#0 lore raw

PATCH v2 1/1 net/mlx5e: advertise MACsec offload only when supported

Commit 339ccec8d43d ("net/mlx5: Enable MACsec offload feature for VLAN interface") added NETIF_F_HW_MACSEC unconditionally to vlan_features so that VLAN devices could inherit MACsec offload support.

mlx5e_build_nic_netdev subsequently copies vlan_features into hw_features and features. As a result, all mlx5e NIC netdevices advertise MACsec hardware offload, even when the firmware does not support it and the driver does not install macsec_ops.

Set the MACsec feature bits in mlx5e_macsec_build_netdev, after device capabilities have been validated. This preserves MACsec-over-VLAN support and the ethtool feature control on capable devices, without advertising either on unsupported hardware.

Fixes 339ccec8d43d ("net/mlx5: Enable MACsec offload feature for VLAN interface")

---
The issue was reproduced on a ConnectX-4 Lx: ethtool -k reported "macsec-hw-offload: on", while creating a MACsec interface with "offload mac" failed with EOPNOTSUPP.

Changes since v1 https://lore.kernel.org/netdev/0a27c8b7308121fd00c528fc99fc3866782d3990.1786783174.git.ralf@mandelbit.com/
- Set NETIF_F_HW_MACSEC in hw_features as well, preserving ethtool
configurability and restoration after an eswitch mode cycle (Sashiko).

 drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c | 2 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c         | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +2 -0
index daff53ba7d09..38a3415acf7a 100644
@@ -1724,6 +1724,8 @@ void mlx5e_macsec_build_netdev(struct mlx5e_priv *priv)
 	mlx5_core_dbg(priv->mdev, "mlx5e: MACsec acceleration enabled\n");
 	netdev->macsec_ops = &macsec_offload_ops;
 	netdev->features |= NETIF_F_HW_MACSEC;
+	netdev->hw_features |= NETIF_F_HW_MACSEC;
+	netdev->vlan_features |= NETIF_F_HW_MACSEC;
 	netif_keep_dst(netdev);
 }
 
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -1
index f0407a850ea8..cb8ebca58ce8 100644
@@ -5851,7 +5851,6 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 
 	netdev->vlan_features    |= NETIF_F_SG;
 	netdev->vlan_features    |= NETIF_F_HW_CSUM;
-	netdev->vlan_features    |= NETIF_F_HW_MACSEC;
 	netdev->vlan_features    |= NETIF_F_GRO;
 	netdev->vlan_features    |= NETIF_F_TSO;
 	netdev->vlan_features    |= NETIF_F_TSO6;

base-commit: e2466392a0b8496000e12181cb1ee1535eb0da25

Signature · 1 line
2.54.0
author
#1 lore raw

Hi,

Gentle ping on this patch in case it got lost in the queue.

Please let me know if there are any comments or if you'd prefer a respin.

Thanks.

Signature · 2 lines
Ralf Lici
Mandelbit Srl
maintainer Reviewed-by
#2 lore raw
Quoted 9 lines · Ralf Lici

Hi,

Gentle ping on this patch in case it got lost in the queue.

Please let me know if there are any comments or if you'd prefer a respin.

Thanks.

Hi,
Sorry for the delay, it was missed during August vacations.

Patch LGTM, you can re-send it yourself and add my tag:

I can also do that, let me know.

author
#3 lore raw
Quoted 13 lines · Tariq Toukan
Quoted 9 lines · Ralf Lici

Hi,

Gentle ping on this patch in case it got lost in the queue.

Please let me know if there are any comments or if you'd prefer a respin.

Thanks.

Quoted 8 lines

Hi,
Sorry for the delay, it was missed during August vacations.

Patch LGTM, you can re-send it yourself and add my tag:

I can also do that, let me know.

No problem, thanks for the review. I'll take care of the resend.

Cheers!

Signature · 2 lines
Ralf Lici
Mandelbit Srl