[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e87a5ba3-956e-401e-9a1e-fc40dadf3d87@davidwei.uk>
Date: Tue, 1 Jul 2025 15:26:07 -0700
From: David Wei <dw@...idwei.uk>
To: Breno Leitao <leitao@...ian.org>, Jakub Kicinski <kuba@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH net-next] netdevsim: implement peer queue flow control
On 2025-07-01 11:10, Breno Leitao wrote:
> Add flow control mechanism between paired netdevsim devices to stop the
> TX queue during high traffic scenarios. When a receive queue becomes
> congested (approaching NSIM_RING_SIZE limit), the corresponding transmit
> queue on the peer device is stopped using netif_subqueue_try_stop().
>
> Once the receive queue has sufficient capacity again, the peer's
> transmit queue is resumed with netif_tx_wake_queue().
>
> Key changes:
> * Add nsim_stop_peer_tx_queue() to pause peer TX when RX queue is full
> * Add nsim_start_peer_tx_queue() to resume peer TX when RX queue drains
> * Implement queue mapping validation to ensure TX/RX queue count match
> * Wake all queues during device unlinking to prevent stuck queues
> * Use RCU protection when accessing peer device references
>
> The flow control only activates when devices have matching TX/RX queue
> counts to ensure proper queue mapping.
>
> Suggested-by: Jakub Kicinski <kuba@...nel.org>
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
> drivers/net/netdevsim/bus.c | 16 +++++++++++
> drivers/net/netdevsim/netdev.c | 62 ++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 76 insertions(+), 2 deletions(-)
>
[...]> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index e36d3e846c2dc..43f31bc134b0a 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -351,6 +406,9 @@ static int nsim_rcv(struct nsim_rq *rq, int budget)
> dev_dstats_rx_dropped(dev);
> }
>
> + rcu_read_lock();
> + nsim_start_peer_tx_queue(dev, rq);
> + rcu_read_unlock();
Could the rcu_read_{un}lock() be moved into the
nsim_start/stop_peer_tx_queue() functions to keep it together with
rcu_dereference()?
> return i;
> }
>
>
> ---
> base-commit: f6e98f17ad6829c48573952ede3f52ed00c1377f
> change-id: 20250630-netdev_flow_control-2b2d37965377
>
> Best regards,
> --
> Breno Leitao <leitao@...ian.org>
>
Powered by blists - more mailing lists