patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error
       [not found] <20190605094342.17563-1-tiwei.bie@intel.com>
@ 2019-06-05  9:43 ` Tiwei Bie
  2019-06-05 12:35   ` Maxime Coquelin
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device Tiwei Bie
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error Tiwei Bie
  2 siblings, 1 reply; 6+ messages in thread
From: Tiwei Bie @ 2019-06-05  9:43 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: stable

We should free queues when we failed to initialize the
virtio device.

Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c4570bbf8..df3a218a8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1752,6 +1752,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
 	if (eth_dev->data->dev_conf.intr_conf.rxq) {
 		if (virtio_configure_intr(eth_dev) < 0) {
 			PMD_INIT_LOG(ERR, "failed to configure interrupt");
+			virtio_free_queues(hw);
 			return -1;
 		}
 	}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device
       [not found] <20190605094342.17563-1-tiwei.bie@intel.com>
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error Tiwei Bie
@ 2019-06-05  9:43 ` Tiwei Bie
  2019-06-05 14:31   ` Maxime Coquelin
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error Tiwei Bie
  2 siblings, 1 reply; 6+ messages in thread
From: Tiwei Bie @ 2019-06-05  9:43 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: stable

For legacy devices, we should also unmap the port IO
resource on device removal.

Fixes: b8f04520ad71 ("virtio: use PCI ioport API")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index df3a218a8..a2cedcc87 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1876,6 +1876,8 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 static int
 eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
 {
+	struct virtio_hw *hw = eth_dev->data->dev_private;
+
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
@@ -1888,8 +1890,11 @@ eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev)
 	eth_dev->tx_pkt_burst = NULL;
 	eth_dev->rx_pkt_burst = NULL;
 
-	if (eth_dev->device)
+	if (eth_dev->device) {
 		rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
+		if (!hw->modern)
+			rte_pci_ioport_unmap(VTPCI_IO(hw));
+	}
 
 	PMD_INIT_LOG(DEBUG, "dev_uninit completed");
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error
       [not found] <20190605094342.17563-1-tiwei.bie@intel.com>
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error Tiwei Bie
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device Tiwei Bie
@ 2019-06-05  9:43 ` Tiwei Bie
  2019-06-05 14:33   ` Maxime Coquelin
  2 siblings, 1 reply; 6+ messages in thread
From: Tiwei Bie @ 2019-06-05  9:43 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: stable

We should unmap the device when we failed to initialize the device.

Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 12 +++++++++---
 drivers/net/virtio/virtio_pci.c    |  1 +
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index a2cedcc87..46d2e4ac6 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1857,17 +1857,23 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 	if (!hw->virtio_user_dev) {
 		ret = vtpci_init(RTE_ETH_DEV_TO_PCI(eth_dev), hw);
 		if (ret)
-			goto out;
+			goto err_vtpci_init;
 	}
 
 	/* reset device and negotiate default features */
 	ret = virtio_init_device(eth_dev, VIRTIO_PMD_DEFAULT_GUEST_FEATURES);
 	if (ret < 0)
-		goto out;
+		goto err_virtio_init;
 
 	return 0;
 
-out:
+err_virtio_init:
+	if (!hw->virtio_user_dev) {
+		rte_pci_unmap_device(RTE_ETH_DEV_TO_PCI(eth_dev));
+		if (!hw->modern)
+			rte_pci_ioport_unmap(VTPCI_IO(hw));
+	}
+err_vtpci_init:
 	rte_free(eth_dev->data->mac_addrs);
 	eth_dev->data->mac_addrs = NULL;
 	return ret;
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index adc02f96a..4468e89cb 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -678,6 +678,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 
 	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
 	if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
+		rte_pci_unmap_device(dev);
 		if (dev->kdrv == RTE_KDRV_UNKNOWN &&
 		    (!dev->device.devargs ||
 		     dev->device.devargs->bus !=
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error Tiwei Bie
@ 2019-06-05 12:35   ` Maxime Coquelin
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2019-06-05 12:35 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stable



On 6/5/19 11:43 AM, Tiwei Bie wrote:
> We should free queues when we failed to initialize the
> virtio device.
> 
> Fixes: 26b683b4f7d0 ("net/virtio: setup Rx queue interrupts")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index c4570bbf8..df3a218a8 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1752,6 +1752,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)
>   	if (eth_dev->data->dev_conf.intr_conf.rxq) {
>   		if (virtio_configure_intr(eth_dev) < 0) {
>   			PMD_INIT_LOG(ERR, "failed to configure interrupt");
> +			virtio_free_queues(hw);
>   			return -1;
>   		}
>   	}
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device Tiwei Bie
@ 2019-06-05 14:31   ` Maxime Coquelin
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2019-06-05 14:31 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stable



On 6/5/19 11:43 AM, Tiwei Bie wrote:
> For legacy devices, we should also unmap the port IO
> resource on device removal.
> 
> Fixes: b8f04520ad71 ("virtio: use PCI ioport API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error
  2019-06-05  9:43 ` [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error Tiwei Bie
@ 2019-06-05 14:33   ` Maxime Coquelin
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2019-06-05 14:33 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: stable



On 6/5/19 11:43 AM, Tiwei Bie wrote:
> We should unmap the device when we failed to initialize the device.
> 
> Fixes: 6ba1f63b5ab0 ("virtio: support specification 1.0")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 12 +++++++++---
>   drivers/net/virtio/virtio_pci.c    |  1 +
>   2 files changed, 10 insertions(+), 3 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-05 14:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190605094342.17563-1-tiwei.bie@intel.com>
2019-06-05  9:43 ` [dpdk-stable] [PATCH 1/5] net/virtio: fix queue memory leak on error Tiwei Bie
2019-06-05 12:35   ` Maxime Coquelin
2019-06-05  9:43 ` [dpdk-stable] [PATCH 2/5] net/virtio: unmap port IO for legacy device Tiwei Bie
2019-06-05 14:31   ` Maxime Coquelin
2019-06-05  9:43 ` [dpdk-stable] [PATCH 3/5] net/virtio: unmap device on initialization error Tiwei Bie
2019-06-05 14:33   ` Maxime Coquelin

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).