From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 372AB5F25 for ; Thu, 1 Nov 2018 15:45:35 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id q19-v6so1624681wmc.2 for ; Thu, 01 Nov 2018 07:45:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:mime-version; bh=hLqKSJ66cMxskfJM8nXzogal0K6xnUoRJeyrEZw8hOg=; b=O8tivVAgegZDQaUH8SSlPv2Zi4coW8TZDBB+4k1ckk/4WU4bBtA1qsFRcQzxi1YuFP ASLkjz9cX9kMRGtlL/fk3sekAo5pWK9B2V2aR/22Y3oMwTTIQPacoXS3j8Stc57WXSXD wcEz8Yxgp8bGR/FfevDbmldjQtyuUX0BLWfJy4D0RPko6zLdrTqzyQPT90JCymC1aAsP 5HEbvKgHvXHx9wBCyCtItBHscKe4CoNhraqGbvGCPGP9yaFw2R0MBJKps773UIfEKU+0 H5lFPMpIuHs4ZIF1QfGyWv+qeMTs0TAZ4mHgFsVInIqYDXUyE5kBT+MAS7pqUTuZUyHM f7Qg== X-Gm-Message-State: AGRZ1gJKjTIu4Soa8A29odxyV7QbRJBCWfsc0gaIhphW2Ro+YH45p3o4 a2OnMcgVmFoKJU6/1SL6xlI= X-Google-Smtp-Source: AJdET5fihqfBv8DprecnTIcAMWd1CJyi9xw/OcwaST4yLdcgP+ERM9F80UKRnnb55TZOtnNEaB7gjw== X-Received: by 2002:a1c:d948:: with SMTP id q69-v6mr5503856wmg.134.1541083534803; Thu, 01 Nov 2018 07:45:34 -0700 (PDT) Received: from localhost ([2001:1be0:110d:fcfe:70c5:32f6:c5b6:39e6]) by smtp.gmail.com with ESMTPSA id z15-v6sm8434971wrp.8.2018.11.01.07.45.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Nov 2018 07:45:33 -0700 (PDT) Message-ID: <1541083532.4849.8.camel@debian.org> From: Luca Boccassi To: maxime.coquelin@redhat.com, dev@dpdk.org Cc: ferruh.yigit@intel.com, 3chas3@gmail.com Date: Thu, 01 Nov 2018 14:45:32 +0000 In-Reply-To: <1500332723-10812-2-git-send-email-ciwillia@brocade.com> References: <1500332723-10812-1-git-send-email-ciwillia@brocade.com> <1500332723-10812-2-git-send-email-ciwillia@brocade.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] net/virtio: do not re-enter clean up routines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2018 14:45:35 -0000 On Mon, 2017-07-17 at 19:05 -0400, Charles (Chas) Williams wrote: > .dev_uninit calls .dev_stop and .dev_close.=C2=A0=C2=A0The work that is d= one in > those routines doesn't need repeated.=C2=A0=C2=A0Use started and opened t= o > track > the adapter's status. >=20 > Signed-off-by: Chas Williams > --- > =C2=A0drivers/net/virtio/virtio_ethdev.c | 15 ++++++++++++--- > =C2=A0drivers/net/virtio/virtio_pci.h=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2= =A04 +++- > =C2=A02 files changed, 15 insertions(+), 4 deletions(-) >=20 > 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) > =C2=A0 > =C2=A0 PMD_INIT_LOG(DEBUG, "virtio_dev_close"); > =C2=A0 > + if (!hw->opened) > + return; > + hw->opened =3D false; > + > =C2=A0 /* reset the NIC */ > =C2=A0 if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) > =C2=A0 VTPCI_OPS(hw)->set_config_irq(hw, > VIRTIO_MSI_NO_VECTOR); > @@ -1696,6 +1700,8 @@ virtio_dev_configure(struct rte_eth_dev *dev) > =C2=A0 return -EBUSY; > =C2=A0 } > =C2=A0 > + hw->opened =3D true; > + > =C2=A0 return 0; > =C2=A0} > =C2=A0 > @@ -1759,7 +1765,7 @@ virtio_dev_start(struct rte_eth_dev *dev) > =C2=A0 VIRTQUEUE_DUMP(txvq->vq); > =C2=A0 } > =C2=A0 > - hw->started =3D 1; > + hw->started =3D true; > =C2=A0 > =C2=A0 /* Initialize Link state */ > =C2=A0 virtio_dev_link_update(dev, 0); > @@ -1824,10 +1830,13 @@ virtio_dev_stop(struct rte_eth_dev *dev) > =C2=A0 > =C2=A0 PMD_INIT_LOG(DEBUG, "stop"); > =C2=A0 > + if (!hw->started) > + return; > + hw->started =3D false; > + > =C2=A0 if (intr_conf->lsc || intr_conf->rxq) > =C2=A0 rte_intr_disable(dev->intr_handle); > =C2=A0 > - hw->started =3D 0; > =C2=A0 memset(&link, 0, sizeof(link)); > =C2=A0 virtio_dev_atomic_write_link_status(dev, &link); > =C2=A0} > @@ -1844,7 +1853,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, > __rte_unused int wait_to_complet > =C2=A0 link.link_duplex =3D ETH_LINK_FULL_DUPLEX; > =C2=A0 link.link_speed=C2=A0=C2=A0=3D SPEED_10G; > =C2=A0 > - if (hw->started =3D=3D 0) { > + if (!hw->started) { > =C2=A0 link.link_status =3D ETH_LINK_DOWN; > =C2=A0 } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { > =C2=A0 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 @@ > =C2=A0#define _VIRTIO_PCI_H_ > =C2=A0 > =C2=A0#include > +#include > =C2=A0 > =C2=A0#include > =C2=A0#include > @@ -253,7 +254,7 @@ struct virtio_hw { > =C2=A0 uint64_t=C2=A0=C2=A0=C2=A0=C2=A0req_guest_features; > =C2=A0 uint64_t=C2=A0=C2=A0=C2=A0=C2=A0guest_features; > =C2=A0 uint32_t=C2=A0=C2=A0=C2=A0=C2=A0max_queue_pairs; > - uint16_t=C2=A0=C2=A0=C2=A0=C2=A0started; > + bool=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0started; > =C2=A0 uint16_t max_mtu; > =C2=A0 uint16_t=C2=A0=C2=A0=C2=A0=C2=A0vtnet_hdr_size; > =C2=A0 uint8_t =C2=A0=C2=A0=C2=A0=C2=A0vlan_strip; > @@ -268,6 +269,7 @@ struct virtio_hw { > =C2=A0 struct virtio_pci_common_cfg *common_cfg; > =C2=A0 struct virtio_net_config *dev_cfg; > =C2=A0 void =C2=A0=C2=A0=C2=A0=C2=A0*virtio_user_dev; > + bool=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0opened; > =C2=A0 > =C2=A0 struct virtqueue **vqs; > =C2=A0}; 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! --=20 Kind regards, Luca Boccassi