[PATCH] common/mlx5: fix mac deletion on Linux
David Marchand
david.marchand at redhat.com
Thu Mar 19 19:28:29 CET 2026
On Thu, 19 Mar 2026 at 17:06, Dariusz Sosnowski <dsosnowski at 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 at dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand at 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
More information about the dev
mailing list