All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: Jens Freimann <jfreimann@redhat.com>,
	dev@dpdk.org, maxime.coquelin@redhat.com, stable@dpdk.org
Subject: Re: [PATCH] net/virtio: fix an incorrect behavior of device stop/start
Date: Thu, 19 Oct 2017 21:53:14 +0800	[thread overview]
Message-ID: <20171019135314.GA1545@yliu-home> (raw)
In-Reply-To: <20170901071426.GA25578@debian-ZGViaWFuCg>

On Fri, Sep 01, 2017 at 03:14:26PM +0800, Tiwei Bie wrote:
> > > > On Tue, Aug 29, 2017 at 04:26:01PM +0800, Tiwei Bie wrote:
> > > > > After starting a device, the driver shouldn't deliver the
> > > > > packets that already existed in the device before it is
> > > > > started to the applications.

Otherwise? I'm assuming you fixed a real issue? If so, it'd be better
if you can add a bit info about the issue.

> This patch fixes this issue
> > > > > by flushing the Rx queues when starting the device.
> > > > >
> > > > > Fixes: a85786dc816f ("virtio: fix states handling during initialization")
...
> > > > > @@ -1737,6 +1737,12 @@ virtio_dev_start(struct rte_eth_dev *dev)
> > > > > 		}
> > > > > 	}
> > > > >
> > > > > +	/* Flush the packets in Rx queues. */
> > > > > +	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> > > > > +		rxvq = dev->data->rx_queues[i];
> > > > > +		virtqueue_flush(rxvq->vq);
> > > > > +	}
> > > > > +
> > > > 
> > > > A little bit further down is a for loop going over rx queues calling
> > > > notify. Could we flush directly before the notify and save the
> > > > additional loop?
> > > > 
> > > 
> > > I saw there is also another `for' loop to dump the Rx queues.
> > > And I think it makes the code more readable to flush the Rx
> > > queues in a separate `for' loop too. Besides, this function
> > > isn't performance critical. So I didn't combine them into one
> > > `for' loop.
> > 
> > To me code is better readable when it is concise, so I'd still vote for
> > combining the loops if its logically equivalent.
> > 
> > On the other hand I think this should be fixed soon, so
> > 
> > Reviewed-by: Jens Freimann <jfreimann@redhat.com>
> > 
> 
> Thank you! :-)
> 
> It's not a big deal. I'd like to leave it up to the maintainers.
> They can make the decision when applying the patch.

I agree with Jens here. We already have too many for loops in this
function. Let's not add yet another one. Besides that, the VIRTQUEU_DUMP
loop probably should also be removed and more it to the notify loop.

	--yliu

  reply	other threads:[~2017-10-19 13:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29  8:26 [PATCH] net/virtio: fix an incorrect behavior of device stop/start Tiwei Bie
2017-08-30  9:13 ` Jens Freimann
2017-08-30 10:24   ` Tiwei Bie
2017-09-01  6:26     ` Jens Freimann
2017-09-01  7:14       ` Tiwei Bie
2017-10-19 13:53         ` Yuanhan Liu [this message]
2017-10-20  2:09 ` [PATCH v2] " Tiwei Bie
2017-10-20  5:35   ` Yuanhan Liu
2017-11-14 17:38   ` Fischetti, Antonio
2017-12-01 17:17     ` Fischetti, Antonio
2017-12-02  4:30       ` Tiwei Bie
2017-12-04  7:19         ` Tiwei Bie
2017-12-04 11:46           ` Fischetti, Antonio
2017-12-05  3:11             ` Tiwei Bie
2017-12-05  8:52               ` Fischetti, Antonio
2017-12-02  1:24     ` Tiwei Bie

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=20171019135314.GA1545@yliu-home \
    --to=yliu@fridaylinux.org \
    --cc=dev@dpdk.org \
    --cc=jfreimann@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.