From 4cc5d081d8c23020130c5f30ed31f79fa105de74 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 21 Nov 2024 08:06:01 +0200 Subject: [PATCH] mlx5en: only enable to toggle offload caps if they are supported Reviewed by: Ariel Ehrenberg Sponsored by: NVidia networking MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index e3c075d4dd80..3e7df834d080 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3552,6 +3552,24 @@ mlx5e_ioctl(if_t ifp, u_long command, caddr_t data) drv_ioctl_data = (struct siocsifcapnv_driver_data *)data; PRIV_LOCK(priv); siocsifcap_driver: + if (!mlx5e_is_tlstx_capable(priv->mdev)) { + drv_ioctl_data->reqcap &= ~(IFCAP_TXTLS4 | + IFCAP_TXTLS6); + } + if (!mlx5e_is_tlsrx_capable(priv->mdev)) { + drv_ioctl_data->reqcap &= ~( + IFCAP2_BIT(IFCAP2_RXTLS4) | + IFCAP2_BIT(IFCAP2_RXTLS6)); + } + if (!mlx5e_is_ipsec_capable(priv->mdev)) { + drv_ioctl_data->reqcap &= + ~IFCAP2_BIT(IFCAP2_IPSEC_OFFLOAD); + } + if (!mlx5e_is_ratelimit_capable(priv->mdev)) { + drv_ioctl_data->reqcap &= ~(IFCAP_TXTLS_RTLMT | + IFCAP_TXRTLMT); + } + mask = drv_ioctl_data->reqcap ^ if_getcapenable(ifp); if (mask & IFCAP_TXCSUM) {