Re: [PATCH net-next V2 00/13] net/mlx5e: Add netdev support for data direct
From: Dragos Tatulea
Date: Fri Nov 20 2026 - 12:05:38 EST
On 20.11.26 17:38, Mina Almasry wrote:
> On Fri, Nov 20, 2026 at 6:39 AM Dragos Tatulea <dtatulea@xxxxxxxxxx> wrote:
>>
>> Hi all,
>>
>> On 10.11.26 19:38, Tariq Toukan wrote:
>> [...]
>>>
>>> .../ethernet/mellanox/mlx5/core/data_direct.c | 9 +-
>>> drivers/net/ethernet/mellanox/mlx5/core/en.h | 14 +
>>> .../ethernet/mellanox/mlx5/core/en/params.c | 18 +-
>>> .../ethernet/mellanox/mlx5/core/en/params.h | 2 +
>>> .../mellanox/mlx5/core/en/reporter_rx.c | 1 +
>>> .../mellanox/mlx5/core/en/reporter_tx.c | 1 +
>>> .../ethernet/mellanox/mlx5/core/en_common.c | 38 ++-
>>> .../ethernet/mellanox/mlx5/core/en_ethtool.c | 67 +++++
>>> .../net/ethernet/mellanox/mlx5/core/en_main.c | 253 +++++++++++++++++-
>>> .../net/ethernet/mellanox/mlx5/core/en_rx.c | 33 +--
>>> .../net/ethernet/mellanox/mlx5/core/en_tx.c | 4 +-
>>> .../net/ethernet/mellanox/mlx5/core/main.c | 1 +
>>> include/linux/mlx5/driver.h | 1 +
>>> include/net/netdev_queues.h | 1 +
>>> include/net/netmem.h | 24 ++
>>> net/core/devmem.c | 85 ++++++
>>> net/core/devmem.h | 6 +
>>> net/core/netdev_queues.c | 51 ++++
>> While working on V3 I realized that keeping the core part in
>> this series is not the best approach. Initially it made sense
>> because the change was small.
>>
>> I think I should re-spin it in a separate series with netdevsim
>> based selftests for the new APIs. I would base it on Mina's devmem
>> leased queues unregister [1].
>>
>> Any reason not to?
>>
>
> I honestly wanted to comment that you should base it on the leased
> queues series from me but didn't want to be annoying, especially
> because I made you wait for the previous series.
>
I realized that quite a few changes were needed after your series
so I decided to base it on it.
> My series creates binding->bind_dev, and binding->map_dev, and core
> will (should) handle things correctly across both devices. This seems
> perfect for you, because you have a bind device and a separate map
> device and their lifetime is different.
>
In my series I am actually skipping leased rx queues in
net_devmem_unbind_dma_dev() because we need some kind of notification
mechanism + netkit implementation. I think this should be added later
if there is a usecase. For now mlx5 simply doesn't support the combo.
One note on net_devmem_unbind_dmabuf(). Posting it here as I don't
find the right place to mention in your series:
@@ -234,8 +234,17 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding)
busy = true;
}
- if (binding->direction == DMA_FROM_DEVICE && !busy)
+ if (binding->direction == DMA_FROM_DEVICE && !busy) {
+ struct net_device *map_dev = NULL;
+ netdevice_tracker dev_tracker;
+
+ /* Leased queue: attachment readers hold map_dev's lock. */
+ if (READ_ONCE(binding->map_dev) != binding->bind_dev)
+ map_dev = net_devmem_lock_dev(&binding->map_dev,
+ &dev_tracker);
net_devmem_dmabuf_binding_unmap(binding);
+ net_devmem_unlock_dev(map_dev, &dev_tracker);
+ }
WRITE_ONCE(binding->bind_dev, NULL);
}
map_dev devmem lock is taken to prevent use after free in
netdev_has_dmabuf_binding() when called in parallel with
net_devmem_unbind_dmabuf(). As this can happen in my series I added it
there.
Waiting for feedback from Stan/Jakub/Paolo for a few more hours and
will post the series tomorrow.
Thanks,
Dragos