From: Luca Boccassi <bluca@debian.org>
To: Maxime Coquelin <maxime.coquelin@redhat.com>, dev@dpdk.org
Cc: ferruh.yigit@intel.com, 3chas3@gmail.com
Subject: Re: [PATCH 1/2] net/virtio: do not re-enter clean up routines
Date: Fri, 02 Nov 2018 11:14:18 +0000 [thread overview]
Message-ID: <1541157258.4849.17.camel@debian.org> (raw)
In-Reply-To: <54c2ea74-17ec-ee3a-4b32-a55599f43413@redhat.com>
On Fri, 2018-11-02 at 12:03 +0100, Maxime Coquelin wrote:
>
> On 11/2/18 10:57 AM, Maxime Coquelin wrote:
> >
> >
> > On 11/1/18 3:45 PM, Luca Boccassi wrote:
> > > On Mon, 2017-07-17 at 19:05 -0400, Charles (Chas) Williams wrote:
> > > > .dev_uninit calls .dev_stop and .dev_close. The work that is
> > > > done in
> > > > those routines doesn't need repeated. Use started and opened
> > > > to
> > > > track
> > > > the adapter's status.
> > > >
> > > > Signed-off-by: Chas Williams <ciwillia@brocade.com>
> > > > ---
> > > > drivers/net/virtio/virtio_ethdev.c | 15 ++++++++++++---
> > > > drivers/net/virtio/virtio_pci.h | 4 +++-
> > > > 2 files changed, 15 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/net/virtio/virtio_ethdev.c
> > > > b/drivers/net/virtio/virtio_ethdev.c
> > > > index 00a3122..eff0545 100644
> > > > --- a/drivers/net/virtio/virtio_ethdev.c
> > > > +++ b/drivers/net/virtio/virtio_ethdev.c
> > > > @@ -609,6 +609,10 @@ virtio_dev_close(struct rte_eth_dev *dev)
> > > > PMD_INIT_LOG(DEBUG, "virtio_dev_close");
> > > > + if (!hw->opened)
> > > > + return;
> > > > + hw->opened = false;
> > > > +
> > > > /* reset the NIC */
> > > > if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
> > > > VTPCI_OPS(hw)->set_config_irq(hw,
> > > > VIRTIO_MSI_NO_VECTOR);
> > > > @@ -1696,6 +1700,8 @@ virtio_dev_configure(struct rte_eth_dev
> > > > *dev)
> > > > return -EBUSY;
> > > > }
> > > > + hw->opened = true;
> > > > +
> > > > return 0;
> > > > }
> > > > @@ -1759,7 +1765,7 @@ virtio_dev_start(struct rte_eth_dev *dev)
> > > > VIRTQUEUE_DUMP(txvq->vq);
> > > > }
> > > > - hw->started = 1;
> > > > + hw->started = true;
> > > > /* Initialize Link state */
> > > > virtio_dev_link_update(dev, 0);
> > > > @@ -1824,10 +1830,13 @@ virtio_dev_stop(struct rte_eth_dev
> > > > *dev)
> > > > PMD_INIT_LOG(DEBUG, "stop");
> > > > + if (!hw->started)
> > > > + return;
> > > > + hw->started = false;
> > > > +
> > > > if (intr_conf->lsc || intr_conf->rxq)
> > > > rte_intr_disable(dev->intr_handle);
> > > > - hw->started = 0;
> > > > memset(&link, 0, sizeof(link));
> > > > virtio_dev_atomic_write_link_status(dev, &link);
> > > > }
> > > > @@ -1844,7 +1853,7 @@ virtio_dev_link_update(struct rte_eth_dev
> > > > *dev,
> > > > __rte_unused int wait_to_complet
> > > > link.link_duplex = ETH_LINK_FULL_DUPLEX;
> > > > link.link_speed = SPEED_10G;
> > > > - if (hw->started == 0) {
> > > > + if (!hw->started) {
> > > > link.link_status = ETH_LINK_DOWN;
> > > > } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) {
> > > > PMD_INIT_LOG(DEBUG, "Get link status from hw");
> > > > diff --git a/drivers/net/virtio/virtio_pci.h
> > > > b/drivers/net/virtio/virtio_pci.h
> > > > index 18caebd..65bad2d 100644
> > > > --- a/drivers/net/virtio/virtio_pci.h
> > > > +++ b/drivers/net/virtio/virtio_pci.h
> > > > @@ -35,6 +35,7 @@
> > > > #define _VIRTIO_PCI_H_
> > > > #include <stdint.h>
> > > > +#include <stdbool.h>
> > > > #include <rte_pci.h>
> > > > #include <rte_ethdev.h>
> > > > @@ -253,7 +254,7 @@ struct virtio_hw {
> > > > uint64_t req_guest_features;
> > > > uint64_t guest_features;
> > > > uint32_t max_queue_pairs;
> > > > - uint16_t started;
> > > > + bool started;
> > > > uint16_t max_mtu;
> > > > uint16_t vtnet_hdr_size;
> > > > uint8_t vlan_strip;
> > > > @@ -268,6 +269,7 @@ struct virtio_hw {
> > > > struct virtio_pci_common_cfg *common_cfg;
> > > > struct virtio_net_config *dev_cfg;
> > > > void *virtio_user_dev;
> > > > + bool opened;
> > > > struct virtqueue **vqs;
> > > > };
> > >
> > > Hi Maxime,
> > >
> > > Any chance this could be reviewed and taken care of, please? It's
> > > been
> > > forgotten in the queue for a year, but we still use it.
> > > I have sent 2/2 separately so ignore that (I didn't notice this
> > > series
> > > was still pending review).
> > >
> > > Thanks!
> > >
> >
> >
> > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> >
> > I'll certainly have to rebase it, but it should be trivial.
> > And as discussed on IRC, it fixes a real issue, so will have to be
> > backported to stable. I'll take care of it.
> >
> > Regards,
> > Maxime
>
> Applied to dpdk-next-virtio/master
>
> If you have some time, please have a look at the branch to ensure the
> rebase is correct.
>
> Thanks,
> Maxime
Looks good to me, thank you very much!
--
Kind regards,
Luca Boccassi
next prev parent reply other threads:[~2018-11-02 11:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 23:05 [PATCH 0/2] Some small changes to net/virtio Charles (Chas) Williams
2017-07-17 23:05 ` [PATCH 1/2] net/virtio: do not re-enter clean up routines Charles (Chas) Williams
2018-11-01 14:45 ` Luca Boccassi
2018-11-02 9:57 ` Maxime Coquelin
2018-11-02 11:03 ` Maxime Coquelin
2018-11-02 11:14 ` Luca Boccassi [this message]
2018-11-02 14:33 ` Ferruh Yigit
2018-11-02 15:19 ` Chas Williams
2018-11-02 16:48 ` Maxime Coquelin
2018-11-02 17:17 ` Ferruh Yigit
2017-07-17 23:05 ` [PATCH 2/2] net/virtio: register/unregister intr handler on start/stop Charles (Chas) Williams
2017-07-18 11:50 ` [PATCH 0/2] Some small changes to net/virtio Ferruh Yigit
2017-07-18 11:52 ` Charles (Chas) Williams
2018-08-15 13:51 ` Luca Boccassi
2018-08-27 13:41 ` Ferruh Yigit
2018-08-27 13:48 ` Ferruh Yigit
2018-08-27 14:52 ` Gavin Hu
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=1541157258.4849.17.camel@debian.org \
--to=bluca@debian.org \
--cc=3chas3@gmail.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=maxime.coquelin@redhat.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.