From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: rjarry@redhat.com, cfontain@redhat.com,
Dariusz Sosnowski <dsosnowski@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Subject: [PATCH v6 2/5] net/mlx5: remove redundant MAC address index checks
Date: Tue, 8 Sep 2026 11:27:40 +0200 [thread overview]
Message-ID: <20260908092743.3439825-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20260908092743.3439825-1-david.marchand@redhat.com>
On the net/mlx5 side, mlx5_mac.c validates that any MAC address and its
index is valid before calling the OS specific helpers.
So those OS helpers do not have to validate again the index.
Cascading this consideration, validating the MAC index against
MLX5_MAX_MAC_ADDRESSES in common code is also redundant.
The common code only deals with netlink, remove any index concern.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/common/mlx5/linux/mlx5_nl.c | 17 ++---------------
drivers/common/mlx5/linux/mlx5_nl.h | 4 ++--
drivers/net/mlx5/linux/mlx5_os.c | 9 ++++-----
3 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index 40a8b8a2cc..3207eae563 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -719,8 +719,6 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
* Net device interface index.
* @param mac
* MAC address to register.
- * @param index
- * MAC address index.
*
* @return
* 0 on success, a negative errno value otherwise and rte_errno is set.
@@ -728,16 +726,11 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
RTE_EXPORT_INTERNAL_SYMBOL(mlx5_nl_mac_addr_add)
int
mlx5_nl_mac_addr_add(int nlsk_fd, unsigned int iface_idx,
- struct rte_ether_addr *mac, uint32_t index)
+ struct rte_ether_addr *mac)
{
int ret;
ret = mlx5_nl_mac_addr_modify(nlsk_fd, iface_idx, mac, 1);
- if (!ret) {
- MLX5_ASSERT(index < MLX5_MAX_MAC_ADDRESSES);
- if (index >= MLX5_MAX_MAC_ADDRESSES)
- return -EINVAL;
- }
if (ret == -EEXIST)
return 0;
return ret;
@@ -752,8 +745,6 @@ mlx5_nl_mac_addr_add(int nlsk_fd, unsigned int iface_idx,
* Net device interface index.
* @param mac
* MAC address to remove.
- * @param index
- * MAC address index.
*
* @return
* 0 on success, a negative errno value otherwise and rte_errno is set.
@@ -761,12 +752,8 @@ mlx5_nl_mac_addr_add(int nlsk_fd, unsigned int iface_idx,
RTE_EXPORT_INTERNAL_SYMBOL(mlx5_nl_mac_addr_remove)
int
mlx5_nl_mac_addr_remove(int nlsk_fd, unsigned int iface_idx,
- struct rte_ether_addr *mac, uint32_t index)
+ struct rte_ether_addr *mac)
{
- MLX5_ASSERT(index < MLX5_MAX_MAC_ADDRESSES);
- if (index >= MLX5_MAX_MAC_ADDRESSES)
- return -EINVAL;
-
return mlx5_nl_mac_addr_modify(nlsk_fd, iface_idx, mac, 0);
}
diff --git a/drivers/common/mlx5/linux/mlx5_nl.h b/drivers/common/mlx5/linux/mlx5_nl.h
index 0242342c47..0d6259f4ad 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.h
+++ b/drivers/common/mlx5/linux/mlx5_nl.h
@@ -57,10 +57,10 @@ __rte_internal
int mlx5_nl_init(int protocol, int groups);
__rte_internal
int mlx5_nl_mac_addr_add(int nlsk_fd, unsigned int iface_idx,
- struct rte_ether_addr *mac, uint32_t index);
+ struct rte_ether_addr *mac);
__rte_internal
int mlx5_nl_mac_addr_remove(int nlsk_fd, unsigned int iface_idx,
- struct rte_ether_addr *mac, uint32_t index);
+ struct rte_ether_addr *mac);
__rte_internal
void mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx,
struct rte_ether_addr *mac_addrs, int n);
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 49a8751761..c65293cb25 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -3382,9 +3382,8 @@ mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
if (vf)
mlx5_nl_mac_addr_remove(priv->nl_socket_route,
mlx5_ifindex(dev),
- &dev->data->mac_addrs[index], index);
- if (index < MLX5_MAX_MAC_ADDRESSES)
- BITFIELD_RESET(priv->mac_own, index);
+ &dev->data->mac_addrs[index]);
+ BITFIELD_RESET(priv->mac_own, index);
}
/**
@@ -3411,7 +3410,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
if (vf)
ret = mlx5_nl_mac_addr_add(priv->nl_socket_route,
mlx5_ifindex(dev),
- mac, index);
+ mac);
if (!ret)
BITFIELD_SET(priv->mac_own, index);
@@ -3536,7 +3535,7 @@ mlx5_os_mac_addr_flush(struct rte_eth_dev *dev)
if (vf)
mlx5_nl_mac_addr_remove(priv->nl_socket_route,
mlx5_ifindex(dev),
- &dev->data->mac_addrs[i], i);
+ &dev->data->mac_addrs[i]);
BITFIELD_RESET(priv->mac_own, i);
}
}
--
2.54.0
next prev parent reply other threads:[~2026-09-08 9:28 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 9:18 [PATCH 0/4] Remove limitations coming from legacy VMDq David Marchand
2026-04-03 9:18 ` [PATCH 1/4] ethdev: skip VMDq pools unless configured David Marchand
2026-06-01 9:30 ` Andrew Rybchenko
2026-04-03 9:18 ` [PATCH 2/4] ethdev: announce VMDq capability David Marchand
2026-04-06 22:22 ` Kishore Padmanabha
2026-04-29 14:18 ` David Marchand
2026-05-18 22:12 ` Kishore Padmanabha
2026-06-01 9:32 ` Andrew Rybchenko
2026-04-03 9:18 ` [PATCH 3/4] ethdev: hide VMDq internal sizes David Marchand
2026-06-01 9:34 ` Andrew Rybchenko
2026-04-03 9:18 ` [PATCH 4/4] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-04-05 18:47 ` [PATCH 0/4] Remove limitations coming from legacy VMDq Stephen Hemminger
2026-04-29 14:22 ` David Marchand
2026-05-06 12:35 ` [PATCH v2 0/5] " David Marchand
2026-05-06 12:35 ` [PATCH v2 1/5] ethdev: skip VMDq pools unless configured David Marchand
2026-06-01 9:35 ` Andrew Rybchenko
2026-05-06 12:35 ` [PATCH v2 2/5] ethdev: announce VMDq capability David Marchand
2026-06-01 9:36 ` Andrew Rybchenko
2026-05-06 12:35 ` [PATCH v2 3/5] ethdev: hide VMDq internal sizes David Marchand
2026-05-06 12:35 ` [PATCH v2 4/5] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-05-06 12:35 ` [PATCH v2 5/5] net/iavf: fix duplicate MAC addresses install David Marchand
2026-05-07 2:51 ` [PATCH v2 0/5] Remove limitations coming from legacy VMDq Stephen Hemminger
2026-05-10 15:03 ` David Marchand
2026-05-10 17:03 ` [PATCH v3 " David Marchand
2026-05-10 17:03 ` [PATCH v3 1/5] ethdev: check VMDq availability David Marchand
2026-06-01 9:38 ` Andrew Rybchenko
2026-05-10 17:03 ` [PATCH v3 2/5] ethdev: skip VMDq pools unless configured David Marchand
2026-06-01 9:38 ` Andrew Rybchenko
2026-05-10 17:03 ` [PATCH v3 3/5] ethdev: hide VMDq internal sizes David Marchand
2026-06-01 9:39 ` Andrew Rybchenko
2026-05-10 17:03 ` [PATCH v3 4/5] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-05-12 14:41 ` Stephen Hemminger
2026-05-27 13:25 ` David Marchand
2026-05-10 17:03 ` [PATCH v3 5/5] net/iavf: fix duplicate MAC addresses install David Marchand
2026-07-09 16:02 ` [PATCH v4 00/10] Remove limitations coming from legacy VMDq David Marchand
2026-07-09 16:02 ` [PATCH v4 01/10] ethdev: check VMDq availability David Marchand
2026-07-09 16:02 ` [PATCH v4 02/10] ethdev: skip VMDq pools unless configured David Marchand
2026-07-09 16:02 ` [PATCH v4 03/10] ethdev: hide VMDq internal sizes David Marchand
2026-07-09 16:02 ` [PATCH v4 04/10] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-07-09 16:02 ` [PATCH v4 05/10] net/iavf: fix duplicate MAC addresses install David Marchand
2026-07-13 13:12 ` Loftus, Ciara
2026-07-13 14:10 ` David Marchand
2026-07-14 9:23 ` Loftus, Ciara
2026-07-09 16:02 ` [PATCH v4 06/10] net/mlx5: remove MAC addresses flush helper on Linux David Marchand
2026-07-09 16:02 ` [PATCH v4 07/10] net/mlx5: remove redundant MAC address index checks David Marchand
2026-07-09 16:02 ` [PATCH v4 08/10] net/mlx5: pass maximum number of unicast MAC to common code David Marchand
2026-07-09 16:02 ` [PATCH v4 09/10] net/mlx5: use bitset for tracking MAC addresses David Marchand
2026-07-09 16:02 ` [PATCH v4 10/10] net/mlx5: accept more unicast " David Marchand
2026-07-10 6:44 ` David Marchand
2026-07-10 7:48 ` David Marchand
2026-07-23 12:41 ` [PATCH v5 00/10] Remove limitations coming from legacy VMDq David Marchand
2026-07-23 12:41 ` [PATCH v5 01/10] ethdev: check VMDq availability David Marchand
2026-07-23 12:41 ` [PATCH v5 02/10] ethdev: skip VMDq pools unless configured David Marchand
2026-07-23 12:41 ` [PATCH v5 03/10] ethdev: hide VMDq internal sizes David Marchand
2026-07-23 12:41 ` [PATCH v5 04/10] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-07-23 12:41 ` [PATCH v5 05/10] net/iavf: fix duplicate MAC addresses install David Marchand
2026-07-23 12:41 ` [PATCH v5 06/10] net/mlx5: remove MAC addresses flush helper on Linux David Marchand
2026-07-23 12:41 ` [PATCH v5 07/10] net/mlx5: remove redundant MAC address index checks David Marchand
2026-07-23 12:41 ` [PATCH v5 08/10] net/mlx5: pass maximum number of unicast MAC to common code David Marchand
2026-07-23 17:35 ` Stephen Hemminger
2026-07-23 12:41 ` [PATCH v5 09/10] net/mlx5: use bitset for tracking MAC addresses David Marchand
2026-07-23 12:41 ` [PATCH v5 10/10] net/mlx5: accept more unicast " David Marchand
2026-07-27 7:20 ` [PATCH v5 00/10] Remove limitations coming from legacy VMDq David Marchand
2026-08-24 11:42 ` [PATCH v6 0/3] " David Marchand
2026-08-24 11:42 ` [PATCH v6 1/3] ethdev: check VMDq availability David Marchand
2026-08-24 11:42 ` [PATCH v6 2/3] ethdev: skip VMDq pools unless configured David Marchand
2026-08-24 16:21 ` Stephen Hemminger
2026-08-24 16:24 ` David Marchand
2026-08-24 16:39 ` Stephen Hemminger
2026-08-24 11:42 ` [PATCH v6 3/3] ethdev: hide VMDq internal sizes David Marchand
2026-08-24 17:01 ` [PATCH v6 0/3] Remove limitations coming from legacy VMDq Stephen Hemminger
2026-09-04 12:28 ` [PATCH v6 1/2] net/iavf: accept up to 32k unicast MAC addresses David Marchand
2026-09-04 12:28 ` [PATCH v6 2/2] net/iavf: fix duplicate MAC addresses install David Marchand
2026-09-09 9:39 ` Loftus, Ciara
2026-09-11 14:14 ` David Marchand
2026-09-10 10:24 ` [PATCH v6 1/2] net/iavf: accept up to 32k unicast MAC addresses Burakov, Anatoly
2026-09-11 9:37 ` Burakov, Anatoly
2026-09-11 11:52 ` David Marchand
2026-09-11 12:14 ` Burakov, Anatoly
2026-09-10 12:13 ` Burakov, Anatoly
2026-09-10 12:20 ` Burakov, Anatoly
2026-09-10 12:30 ` David Marchand
2026-09-10 12:38 ` Burakov, Anatoly
2026-09-08 9:27 ` [PATCH v6 1/5] net/mlx5: remove MAC addresses flush helper on Linux David Marchand
2026-09-08 9:27 ` David Marchand [this message]
2026-09-11 8:36 ` [PATCH v6 2/5] net/mlx5: remove redundant MAC address index checks Dariusz Sosnowski
2026-09-08 9:27 ` [PATCH v6 3/5] net/mlx5: pass maximum number of unicast MAC to common code David Marchand
2026-09-11 8:38 ` Dariusz Sosnowski
2026-09-08 9:27 ` [PATCH v6 4/5] net/mlx5: use bitset for tracking MAC addresses David Marchand
2026-09-11 8:40 ` Dariusz Sosnowski
2026-09-08 9:27 ` [PATCH v6 5/5] net/mlx5: accept more unicast " David Marchand
2026-09-11 8:59 ` Dariusz Sosnowski
2026-09-11 9:55 ` David Marchand
2026-09-11 10:01 ` Dariusz Sosnowski
2026-09-11 8:35 ` [PATCH v6 1/5] net/mlx5: remove MAC addresses flush helper on Linux Dariusz Sosnowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908092743.3439825-2-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bingz@nvidia.com \
--cc=cfontain@redhat.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rjarry@redhat.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox