* [PATCH] common/mlx5: fix mac deletion on Linux
@ 2026-03-18 16:36 David Marchand
2026-03-19 8:41 ` David Marchand
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: David Marchand @ 2026-03-18 16:36 UTC (permalink / raw)
To: dev
Cc: stable, Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao,
Ori Kam, Suanming Mou, Matan Azrad, Adrien Mazarguil,
Nelio Laranjeiro
Re-enable debug logs unconditionally, this helps understanding why mac
deletions were silently failing (while a bridge fdb del command was
working fine).
testpmd> mac_addr add 0 FA:35:44:3F:58:31
testpmd> mac_addr remove 0 FA:35:44:3F:58:31
mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
Operation not supported
Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
with a RTM_NEWNEIGH op.
For a RTM_DELNEIGH op, 0x200 == NLM_F_BULK and passing this flag
makes the deletion fail miserably for a single mac.
Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/common/mlx5/linux/mlx5_nl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index eceb3d796f..b50431fb61 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -581,8 +581,8 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
} req = {
.hdr = {
.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
- .nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE |
- NLM_F_EXCL | NLM_F_ACK,
+ .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK |
+ add ? NLM_F_CREATE | NLM_F_EXCL : 0,
.nlmsg_type = add ? RTM_NEWNEIGH : RTM_DELNEIGH,
},
.ndm = {
@@ -612,7 +612,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
goto error;
return 0;
error:
-#ifdef RTE_PMD_MLX5_DEBUG
{
char m[RTE_ETHER_ADDR_FMT_SIZE];
@@ -622,7 +621,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
iface_idx,
add ? "add" : "remove", m, strerror(rte_errno));
}
-#endif
return -rte_errno;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] common/mlx5: fix mac deletion on Linux
2026-03-18 16:36 [PATCH] common/mlx5: fix mac deletion on Linux David Marchand
@ 2026-03-19 8:41 ` David Marchand
2026-03-19 16:06 ` Dariusz Sosnowski
2026-03-20 14:14 ` [PATCH v2] " David Marchand
2 siblings, 0 replies; 7+ messages in thread
From: David Marchand @ 2026-03-19 8:41 UTC (permalink / raw)
To: dev
Cc: stable, Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao,
Ori Kam, Suanming Mou, Matan Azrad, Adrien Mazarguil,
Nelio Laranjeiro
On Wed, 18 Mar 2026 at 17:37, David Marchand <david.marchand@redhat.com> wrote:
>
> Re-enable debug logs unconditionally, this helps understanding why mac
> deletions were silently failing (while a bridge fdb del command was
> working fine).
>
> testpmd> mac_addr add 0 FA:35:44:3F:58:31
> testpmd> mac_addr remove 0 FA:35:44:3F:58:31
> mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
> Operation not supported
>
> Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
> with a RTM_NEWNEIGH op.
> For a RTM_DELNEIGH op, 0x200 == NLM_F_BULK and passing this flag
> makes the deletion fail miserably for a single mac.
This issue is actually triggered after a change in the kernel uapi.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=545528d788556
So the DPDK bug can be seen with kernels >= 5.19 (and in my case, RHEL9).
Probably worth adding in the commitlog.
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] common/mlx5: fix mac deletion on Linux
2026-03-18 16:36 [PATCH] common/mlx5: fix mac deletion on Linux David Marchand
2026-03-19 8:41 ` David Marchand
@ 2026-03-19 16:06 ` Dariusz Sosnowski
2026-03-19 18:28 ` David Marchand
2026-03-20 14:14 ` [PATCH v2] " David Marchand
2 siblings, 1 reply; 7+ messages in thread
From: Dariusz Sosnowski @ 2026-03-19 16:06 UTC (permalink / raw)
To: David Marchand
Cc: dev, stable, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
Suanming Mou, Matan Azrad, Adrien Mazarguil, Nelio Laranjeiro
On Wed, Mar 18, 2026 at 05:36:28PM +0100, David Marchand wrote:
> Re-enable debug logs unconditionally, this helps understanding why mac
> deletions were silently failing (while a bridge fdb del command was
> working fine).
>
> testpmd> mac_addr add 0 FA:35:44:3F:58:31
> testpmd> mac_addr remove 0 FA:35:44:3F:58:31
> mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
> Operation not supported
>
> Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
> with a RTM_NEWNEIGH op.
> For a RTM_DELNEIGH op, 0x200 == NLM_F_BULK and passing this flag
> makes the deletion fail miserably for a single mac.
>
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> drivers/common/mlx5/linux/mlx5_nl.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
> index eceb3d796f..b50431fb61 100644
> --- a/drivers/common/mlx5/linux/mlx5_nl.c
> +++ b/drivers/common/mlx5/linux/mlx5_nl.c
> @@ -581,8 +581,8 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
> } req = {
> .hdr = {
> .nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
> - .nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE |
> - NLM_F_EXCL | NLM_F_ACK,
> + .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK |
> + add ? NLM_F_CREATE | NLM_F_EXCL : 0,
It seems that this expression is constructed incorrectly.
IIUC this will be "parenthesised" as follows:
((NLM_F_REQUEST | NLM_F_ACK) | add) ? (NLM_F_CREATE | NLM_F_EXCL) : 0
Since bitwise OR has higher precendence.
So "add" value will be ignored and only "NLM_F_CREATE | NLM_F_EXCL"
will be returned.
Could you please add parenthesis around the ternary?
> .nlmsg_type = add ? RTM_NEWNEIGH : RTM_DELNEIGH,
> },
> .ndm = {
> @@ -612,7 +612,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
> goto error;
> return 0;
> error:
> -#ifdef RTE_PMD_MLX5_DEBUG
> {
> char m[RTE_ETHER_ADDR_FMT_SIZE];
>
> @@ -622,7 +621,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
> iface_idx,
> add ? "add" : "remove", m, strerror(rte_errno));
> }
> -#endif
> return -rte_errno;
> }
>
Best regards,
Dariusz Sosnowski
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] common/mlx5: fix mac deletion on Linux
2026-03-19 16:06 ` Dariusz Sosnowski
@ 2026-03-19 18:28 ` David Marchand
0 siblings, 0 replies; 7+ messages in thread
From: David Marchand @ 2026-03-19 18:28 UTC (permalink / raw)
To: Dariusz Sosnowski
Cc: dev, stable, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
Suanming Mou, Matan Azrad, Adrien Mazarguil, Nelio Laranjeiro
On Thu, 19 Mar 2026 at 17:06, Dariusz Sosnowski <dsosnowski@nvidia.com> wrote:
>
> On Wed, Mar 18, 2026 at 05:36:28PM +0100, David Marchand wrote:
> > Re-enable debug logs unconditionally, this helps understanding why mac
> > deletions were silently failing (while a bridge fdb del command was
> > working fine).
> >
> > testpmd> mac_addr add 0 FA:35:44:3F:58:31
> > testpmd> mac_addr remove 0 FA:35:44:3F:58:31
> > mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
> > Operation not supported
> >
> > Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
> > with a RTM_NEWNEIGH op.
> > For a RTM_DELNEIGH op, 0x200 == NLM_F_BULK and passing this flag
> > makes the deletion fail miserably for a single mac.
> >
> > Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > drivers/common/mlx5/linux/mlx5_nl.c | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
> > index eceb3d796f..b50431fb61 100644
> > --- a/drivers/common/mlx5/linux/mlx5_nl.c
> > +++ b/drivers/common/mlx5/linux/mlx5_nl.c
> > @@ -581,8 +581,8 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
> > } req = {
> > .hdr = {
> > .nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
> > - .nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE |
> > - NLM_F_EXCL | NLM_F_ACK,
> > + .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK |
> > + add ? NLM_F_CREATE | NLM_F_EXCL : 0,
>
> It seems that this expression is constructed incorrectly.
> IIUC this will be "parenthesised" as follows:
>
> ((NLM_F_REQUEST | NLM_F_ACK) | add) ? (NLM_F_CREATE | NLM_F_EXCL) : 0
>
> Since bitwise OR has higher precendence.
> So "add" value will be ignored and only "NLM_F_CREATE | NLM_F_EXCL"
> will be returned.
>
> Could you please add parenthesis around the ternary?
Ugh.
That's what happens when doing a last minute change with a ternary and
not testing the new patch...
I will send the right fix.
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] common/mlx5: fix mac deletion on Linux
2026-03-18 16:36 [PATCH] common/mlx5: fix mac deletion on Linux David Marchand
2026-03-19 8:41 ` David Marchand
2026-03-19 16:06 ` Dariusz Sosnowski
@ 2026-03-20 14:14 ` David Marchand
2026-03-20 16:12 ` Dariusz Sosnowski
2026-03-24 12:30 ` Raslan Darawsheh
2 siblings, 2 replies; 7+ messages in thread
From: David Marchand @ 2026-03-20 14:14 UTC (permalink / raw)
To: dev
Cc: stable, Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao,
Ori Kam, Suanming Mou, Matan Azrad, Nelio Laranjeiro,
Adrien Mazarguil
Re-enable debug logs unconditionally, this helps understanding why mac
deletions were silently failing (while a bridge fdb del command was
working fine).
testpmd> mac_addr add 0 FA:35:44:3F:58:31
testpmd> mac_addr remove 0 FA:35:44:3F:58:31
mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
Operation not supported
Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
with a RTM_NEWNEIGH op.
Since kernel v5.19 though, for a RTM_DELNEIGH op, 0x200 == NLM_F_BULK
and passing this flag makes the deletion fail miserably for a single mac.
Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- fixed ternary usage... (thanks Dariusz),
- updated commitlog with a mention of Linux version when it got broken,
---
drivers/common/mlx5/linux/mlx5_nl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index eceb3d796f..8b19838a7e 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -581,8 +581,8 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
} req = {
.hdr = {
.nlmsg_len = NLMSG_LENGTH(sizeof(struct ndmsg)),
- .nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE |
- NLM_F_EXCL | NLM_F_ACK,
+ .nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK |
+ (add ? NLM_F_CREATE | NLM_F_EXCL : 0),
.nlmsg_type = add ? RTM_NEWNEIGH : RTM_DELNEIGH,
},
.ndm = {
@@ -612,7 +612,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
goto error;
return 0;
error:
-#ifdef RTE_PMD_MLX5_DEBUG
{
char m[RTE_ETHER_ADDR_FMT_SIZE];
@@ -622,7 +621,6 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
iface_idx,
add ? "add" : "remove", m, strerror(rte_errno));
}
-#endif
return -rte_errno;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2] common/mlx5: fix mac deletion on Linux
2026-03-20 14:14 ` [PATCH v2] " David Marchand
@ 2026-03-20 16:12 ` Dariusz Sosnowski
2026-03-24 12:30 ` Raslan Darawsheh
1 sibling, 0 replies; 7+ messages in thread
From: Dariusz Sosnowski @ 2026-03-20 16:12 UTC (permalink / raw)
To: David Marchand
Cc: dev, stable, Viacheslav Ovsiienko, Bing Zhao, Ori Kam,
Suanming Mou, Matan Azrad, Nelio Laranjeiro, Adrien Mazarguil
On Fri, Mar 20, 2026 at 03:14:17PM +0100, David Marchand wrote:
> Re-enable debug logs unconditionally, this helps understanding why mac
> deletions were silently failing (while a bridge fdb del command was
> working fine).
>
> testpmd> mac_addr add 0 FA:35:44:3F:58:31
> testpmd> mac_addr remove 0 FA:35:44:3F:58:31
> mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
> Operation not supported
>
> Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
> with a RTM_NEWNEIGH op.
>
> Since kernel v5.19 though, for a RTM_DELNEIGH op, 0x200 == NLM_F_BULK
> and passing this flag makes the deletion fail miserably for a single mac.
>
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Best regards,
Dariusz Sosnowski
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2] common/mlx5: fix mac deletion on Linux
2026-03-20 14:14 ` [PATCH v2] " David Marchand
2026-03-20 16:12 ` Dariusz Sosnowski
@ 2026-03-24 12:30 ` Raslan Darawsheh
1 sibling, 0 replies; 7+ messages in thread
From: Raslan Darawsheh @ 2026-03-24 12:30 UTC (permalink / raw)
To: David Marchand, dev
Cc: stable, Dariusz Sosnowski, Viacheslav Ovsiienko, Bing Zhao,
Ori Kam, Suanming Mou, Matan Azrad, Nelio Laranjeiro,
Adrien Mazarguil
Hi,
On 20/03/2026 4:14 PM, David Marchand wrote:
> Re-enable debug logs unconditionally, this helps understanding why mac
> deletions were silently failing (while a bridge fdb del command was
> working fine).
>
> testpmd> mac_addr add 0 FA:35:44:3F:58:31
> testpmd> mac_addr remove 0 FA:35:44:3F:58:31
> mlx5_common: Interface 35 cannot remove MAC address FA:35:44:3F:58:31
> Operation not supported
>
> Then, fix mac deletion as the NLM_F_CREATE == 0x200 flag is relevant
> with a RTM_NEWNEIGH op.
>
> Since kernel v5.19 though, for a RTM_DELNEIGH op, 0x200 == NLM_F_BULK
> and passing this flag makes the deletion fail miserably for a single mac.
>
> Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-24 12:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 16:36 [PATCH] common/mlx5: fix mac deletion on Linux David Marchand
2026-03-19 8:41 ` David Marchand
2026-03-19 16:06 ` Dariusz Sosnowski
2026-03-19 18:28 ` David Marchand
2026-03-20 14:14 ` [PATCH v2] " David Marchand
2026-03-20 16:12 ` Dariusz Sosnowski
2026-03-24 12:30 ` Raslan Darawsheh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox