1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

mlx5en: improve reporting of kernel TLS, IPSEC offload, and ratelimit caps

Only ever set the capabilities bits if kernel options are enabled.
Check for hardware capabilities before setting software bits.

Sponsored by:	NVidia networking
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2024-10-16 01:34:58 +03:00
parent f660777865
commit de7a92756f

View File

@ -4535,17 +4535,29 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
if_setcapabilitiesbit(ifp, IFCAP_TSO | IFCAP_VLAN_HWTSO, 0);
if_setcapabilitiesbit(ifp, IFCAP_HWSTATS | IFCAP_HWRXTSTMP, 0);
if_setcapabilitiesbit(ifp, IFCAP_MEXTPG, 0);
if_setcapabilitiesbit(ifp, IFCAP_TXTLS4 | IFCAP_TXTLS6, 0);
#ifdef KERN_TLS
if (MLX5_CAP_GEN(mdev, tls_tx) != 0 &&
MLX5_CAP_GEN(mdev, log_max_dek) != 0)
if_setcapabilitiesbit(ifp, IFCAP_TXTLS4 | IFCAP_TXTLS6, 0);
if (MLX5_CAP_GEN(mdev, tls_rx) != 0 &&
MLX5_CAP_GEN(mdev, log_max_dek) != 0 &&
MLX5_CAP_FLOWTABLE_NIC_RX(mdev,
ft_field_support.outer_ip_version) != 0)
if_setcapabilities2bit(ifp, IFCAP2_BIT(IFCAP2_RXTLS4) |
IFCAP2_BIT(IFCAP2_RXTLS6), 0);
#endif
#ifdef RATELIMIT
if_setcapabilitiesbit(ifp, IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT, 0);
if (MLX5_CAP_GEN(mdev, qos) &&
MLX5_CAP_QOS(mdev, packet_pacing))
if_setcapabilitiesbit(ifp, IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT,
0);
#endif
if_setcapabilitiesbit(ifp, IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO, 0);
if_setcapabilities2bit(ifp, IFCAP2_BIT(IFCAP2_RXTLS4) |
IFCAP2_BIT(IFCAP2_RXTLS6), 0);
#ifdef IPSEC_OFFLOAD
if (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_PACKET_OFFLOAD)
if_setcapabilities2bit(ifp, IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD),
0);
#endif
if_setsndtagallocfn(ifp, mlx5e_snd_tag_alloc);
#ifdef RATELIMIT