[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250708182718.29c4ae45@kernel.org>
Date: Tue, 8 Jul 2025 18:27:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...a.com, dw@...idwei.uk
Subject: Re: [PATCH net-next v2] netdevsim: implement peer queue flow
control
On Thu, 03 Jul 2025 06:09:31 -0700 Breno Leitao wrote:
> +static int nsim_napi_rx(struct net_device *dev, struct nsim_rq *rq,
> + struct sk_buff *skb)
> {
> if (skb_queue_len(&rq->skb_queue) > NSIM_RING_SIZE) {
> + nsim_stop_peer_tx_queue(dev, rq, skb_get_queue_mapping(skb));
> dev_kfree_skb_any(skb);
> return NET_RX_DROP;
> }
we should probably add:
if (skb_queue_len(&rq->skb_queue) > NSIM_RING_SIZE)
nsim_stop_tx_queue(dev, rq, skb_get_queue_mapping(skb));
after enqueuing the skb, so that we stop the queue before any drops
happen
> @@ -51,7 +109,7 @@ static int nsim_napi_rx(struct nsim_rq *rq, struct sk_buff *skb)
> static int nsim_forward_skb(struct net_device *dev, struct sk_buff *skb,
> struct nsim_rq *rq)
> {
> - return __dev_forward_skb(dev, skb) ?: nsim_napi_rx(rq, skb);
> + return __dev_forward_skb(dev, skb) ?: nsim_napi_rx(dev, rq, skb);
> }
>
> static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
nsim_start_xmit() has both dev and peer_dev, pass them all the way to
nsim_stop_peer_tx_queue() so that you don't have to try to dereference
the peer again.
> + if (dev->real_num_tx_queues != peer_dev->num_rx_queues)
given that we compare real_num_tx_queues I think we should also kick
the queues in nsim_set_channels(), like we do in unlink_device_store()
--
pw-bot: cr
Powered by blists - more mailing lists