Avoid requiring NET_ADMIN with mlx5

Resolves: RHEL-100573
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Maxime Coquelin 2025-06-26 13:36:28 +02:00 committed by Timothy Redaelli
parent 5866740275
commit 94043ee61f
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From f1f9113a08b202d302ba9448d351c04da48ff46d Mon Sep 17 00:00:00 2001
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Date: Wed, 28 May 2025 11:36:44 +0200
Subject: [PATCH] net/mlx5: avoid setting kernel MTU if not needed
This patch checks whether the Kernel MTU has the same value
as the requested one at port configuration time, and skip
setting it if it is the same.
Doing this, we can avoid the application to require
NET_ADMIN capability, as in v23.11.
Fixes: 10859ecf09c4 ("net/mlx5: fix MTU configuration")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/mlx5_ethdev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index a50320075c..b7df39ace9 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -678,6 +678,14 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
ret = mlx5_get_mtu(dev, &kern_mtu);
if (ret)
return ret;
+
+ if (kern_mtu == mtu) {
+ priv->mtu = mtu;
+ DRV_LOG(DEBUG, "port %u adapter MTU was already set to %u",
+ dev->data->port_id, mtu);
+ return 0;
+ }
+
/* Set kernel interface MTU first. */
ret = mlx5_set_mtu(dev, mtu);
if (ret)
--
2.49.0

View File

@ -9,7 +9,7 @@
#% define shortcommit0 %(c=%{commit0}; echo ${c:0:7})
%define ver 24.11.2
%define rel 1
%define rel 2
%define srcname dpdk%(awk -F. '{ if (NF > 2) print "-stable" }' <<<%{version})
@ -31,6 +31,8 @@ Source: https://fast.dpdk.org/rel/dpdk-%{ver}.tar.xz
# Only needed for creating snapshot tarballs, not used in build itself
Source100: dpdk-snapshot.sh
Patch1: 0001-net-mlx5-avoid-setting-kernel-MTU-if-not-needed.patch
Summary: Set of libraries and drivers for fast packet processing
#
@ -288,6 +290,9 @@ find %{buildroot}%{_datadir}/man/ -type f -a ! -iname "*rte_*" -exec rm {} \;
%endif
%changelog
* Thu Jun 26 2025 Maxime Coquelin <maxime.coquelin@redhat.com> - 24.11.2-2
- Avoid requiring NET_ADMIN with mlx5 (RHEL-93856)
* Mon Jun 23 2025 Kevin Traynor <ktraynor@redhat.com> - 24.11.2-1
- Rebase to 24.11.2 (RHEL-96849)