Re: [PATCH net-next v6 0/2] net: Split ndo_set_rx_mode into snapshot and deferred write
From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-12-28 15:20:52
Also in:
virtualization
On 12/27/25 6:42 PM, I Viswanath wrote:
This is an implementation of the idea provided by Jakub here https://lore.kernel.org/netdev/20250923163727.5e97abdb@kernel.org/ (local) ndo_set_rx_mode is problematic because it cannot sleep. To address this, this series proposes dividing the concept of setting rx_mode into 2 stages: snapshot and deferred I/O. To achieve this, we reinterpret set_rx_mode and add create a new ndo write_rx_mode as explained below: The new set_rx_mode will be responsible for customizing the rx_mode snapshot which will be used by write_rx_mode to update the hardware In brief, the new flow looks something like: prepare_rx_mode(): ndo_set_rx_mode(); prepare_snapshot(); write_rx_mode(): use_ready_snapshot(); ndo_write_rx_mode(); write_rx_mode() is called from a work item and doesn't hold the netif_addr_lock lock during ndo_write_rx_mode() making it sleepable in that section. This model should work correctly if the following conditions hold: 1. write_rx_mode should use the rx_mode set by the most recent call to make_snapshot_ready before its execution. 2. If a make_snapshot_ready call happens during execution of write_rx_mode, write_rx_mode should be rescheduled. 3. All calls to modify rx_mode should pass through the prepare_rx_mode + schedule write_rx_mode execution flow. netif_rx_mode_schedule_work has been implemented in core for this purpose. 1 and 2 are implemented in core Drivers need to ensure 3 using netif_rx_mode_schedule_work To use this model, a driver needs to implement the ndo_write_rx_mode callback, change the set_rx_mode callback appropriately and replace all calls to modify rx mode with netif_rx_mode_schedule_work Signed-off-by: I Viswanath <redacted>
## Form letter - net-next-closed The net-next tree is closed for new drivers, features, code refactoring and optimizations due to the merge window and the winter break. We are currently accepting bug fixes only. Please repost when net-next reopens after Jan 2nd. RFC patches sent for review only are obviously welcome at any time.