netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heng Qi <hengqi@linux.alibaba.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	virtualization@lists.linux.dev,
	EugenioPérez <eperezma@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH net] virtio_net: Avoid sending unnecessary vq coalescing commands
Date: Wed, 31 Jul 2024 19:30:31 +0800	[thread overview]
Message-ID: <1722425431.2357254-1-hengqi@linux.alibaba.com> (raw)
In-Reply-To: <20240730182020.75639070@kernel.org>

On Tue, 30 Jul 2024 18:20:20 -0700, Jakub Kicinski <kuba@kernel.org> wrote:
> On Mon, 29 Jul 2024 20:47:55 +0800 Heng Qi wrote:
> > Subject: [PATCH net] virtio_net: Avoid sending unnecessary vq coalescing commands
> 
> subject currently reads like this is an optimization, could you
> rephrase?

Jason's rephrase will be used.

> 
> > From the virtio spec:
> > 
> > 	The driver MUST have negotiated the VIRTIO_NET_F_VQ_NOTF_COAL
> > 	feature when issuing commands VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET
> > 	and VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET.
> > 
> > The driver must not send vq notification coalescing commands if
> > VIRTIO_NET_F_VQ_NOTF_COAL is not negotiated. This limitation of course
> > applies to vq resize.
> > 
> > Fixes: f61fe5f081cf ("virtio-net: fix the vq coalescing setting for vq resize")
> > Signed-off-by: Heng Qi <hengqi@linux.alibaba.com>
> > ---
> >  drivers/net/virtio_net.c | 29 +++++++++++++++++------------
> >  1 file changed, 17 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 0383a3e136d6..eb115e807882 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -3708,6 +3708,7 @@ static int virtnet_set_ringparam(struct net_device *dev,
> >  	u32 rx_pending, tx_pending;
> >  	struct receive_queue *rq;
> >  	struct send_queue *sq;
> > +	u32 pkts, usecs;
> >  	int i, err;
> >  
> >  	if (ring->rx_mini_pending || ring->rx_jumbo_pending)
> > @@ -3740,11 +3741,13 @@ static int virtnet_set_ringparam(struct net_device *dev,
> >  			 * through the VIRTIO_NET_CTRL_NOTF_COAL_TX_SET command, or, if the driver
> >  			 * did not set any TX coalescing parameters, to 0.
> >  			 */
> > -			err = virtnet_send_tx_ctrl_coal_vq_cmd(vi, i,
> > -							       vi->intr_coal_tx.max_usecs,
> > -							       vi->intr_coal_tx.max_packets);
> > -			if (err)
> > -				return err;
> > +			if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_VQ_NOTF_COAL)) {
> > +				usecs = vi->intr_coal_tx.max_usecs;
> > +				pkts = vi->intr_coal_tx.max_packets;
> > +				err = virtnet_send_tx_ctrl_coal_vq_cmd(vi, i, usecs, pkts);
> > +				if (err)
> > +					return err;
> 
> Can you check the feature inside the
> virtnet_send_.x_ctrl_coal_vq_cmd() helpers?
> 5 levels of indentation is a bit much

Makes sense. Will update in the next version.

Thanks.

> -- 
> pw-bot: cr

  parent reply	other threads:[~2024-07-31 11:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 12:47 [PATCH net] virtio_net: Avoid sending unnecessary vq coalescing commands Heng Qi
2024-07-30  1:11 ` Xuan Zhuo
2024-07-30 11:04 ` Eugenio Perez Martin
2024-07-31  1:20 ` Jakub Kicinski
2024-07-31  3:13   ` Jason Wang
2024-07-31 11:22     ` Heng Qi
2024-07-31 11:30   ` Heng Qi [this message]
2024-07-31  3:11 ` Jason Wang

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=1722425431.2357254-1-hengqi@linux.alibaba.com \
    --to=hengqi@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /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;
as well as URLs for NNTP newsgroup(s).