mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	netdev@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS'
Date: Wed, 21 May 2025 17:33:56 +0800	[thread overview]
Message-ID: <1747820036.241548-2-xuanzhuo@linux.alibaba.com> (raw)
In-Reply-To: <20250521092236.661410-3-lvivier@redhat.com>

On Wed, 21 May 2025 11:22:35 +0200, Laurent Vivier <lvivier@redhat.com> wrote:
> Improve consistency by using everywhere it is needed
> 'MAX_SKB_FRAGS + 2' rather than '2+MAX_SKB_FRAGS' or
> '2 + MAX_SKB_FRAGS'.
>
> No functional change.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>

> ---
>  drivers/net/virtio_net.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index e53ba600605a..ff4160243538 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1084,7 +1084,7 @@ static bool tx_may_stop(struct virtnet_info *vi,
>  	 * Since most packets only take 1 or 2 ring slots, stopping the queue
>  	 * early means 16 slots are typically wasted.
>  	 */
> -	if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
> +	if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
>  		struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
>
>  		netif_tx_stop_queue(txq);
> @@ -1116,7 +1116,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
>  		} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
>  			/* More just got used, free them then recheck. */
>  			free_old_xmit(sq, txq, false);
> -			if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
> +			if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  				netif_start_subqueue(dev, qnum);
>  				u64_stats_update_begin(&sq->stats.syncp);
>  				u64_stats_inc(&sq->stats.wake);
> @@ -2998,7 +2998,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq, int budget)
>  			free_old_xmit(sq, txq, !!budget);
>  		} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
>
> -		if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +		if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  			if (netif_tx_queue_stopped(txq)) {
>  				u64_stats_update_begin(&sq->stats.syncp);
>  				u64_stats_inc(&sq->stats.wake);
> @@ -3195,7 +3195,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
>  	else
>  		free_old_xmit(sq, txq, !!budget);
>
> -	if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +	if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  		if (netif_tx_queue_stopped(txq)) {
>  			u64_stats_update_begin(&sq->stats.syncp);
>  			u64_stats_inc(&sq->stats.wake);
> --
> 2.49.0
>

  reply	other threads:[~2025-05-21  9:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
2025-05-22  1:56   ` Jason Wang
2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
2025-05-21  9:33   ` Xuan Zhuo [this message]
2025-05-22  1:56   ` Jason Wang
2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
2025-05-21  9:34   ` Xuan Zhuo
2025-05-22  1:56   ` Jason Wang
2025-05-27  7:32 ` [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Lei Yang
2025-05-28  6:24 ` Paolo Abeni
2025-05-28  7:20   ` Michael S. Tsirkin
2025-06-16 13:07     ` Laurent Vivier
2025-06-23  8:23       ` Laurent Vivier
2025-07-03  7:43     ` Laurent Vivier
2025-07-03  9:30       ` Michael S. Tsirkin
2025-07-03  9:31   ` Michael S. Tsirkin
2025-07-03  9:34     ` Paolo Abeni
2025-07-08  0:29       ` Jakub Kicinski
2025-07-08 16:03         ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1747820036.241548-2-xuanzhuo@linux.alibaba.com \
    --to=xuanzhuo@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®