patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/virtio-user: fix multi-process support' has been queued to LTS release 18.11.2
Date: Thu, 25 Apr 2019 16:40:02 +0100	[thread overview]
Message-ID: <20190425154037.28778-27-ktraynor@redhat.com> (raw)
In-Reply-To: <20190425154037.28778-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/01/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches can be viewed on the 18.11 branch at:
	https://github.com/kevintraynor/dpdk-stable-queue.git

Thanks.

Kevin Traynor

---
From d21964ea6b83ef0a060a628c044a3d35041ed373 Mon Sep 17 00:00:00 2001
From: Tiwei Bie <tiwei.bie@intel.com>
Date: Mon, 25 Mar 2019 12:12:15 +0800
Subject: [PATCH] net/virtio-user: fix multi-process support

[ upstream commit 1c8489da561be16ac73c6dab01db816af249713f ]

This patch fixes the multi-process support for virtio-user.
Currently virtio-user just provides some limited secondary
process supports. Only some basic operations can be done in
secondary process on virtio-user port, e.g. getting port stats.
Actions which will trigger the communication with vhost backend
can't be done in secondary process for now, as the fds are
not synced between processes. The processing of server mode
devargs is also moved into virtio_user_dev_init().

Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel")
Fixes: ee27edbe0c10 ("drivers/net: share vdev data to secondary process")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c            | 15 +++++
 drivers/net/virtio/virtio_ethdev.h            |  2 +
 .../net/virtio/virtio_user/virtio_user_dev.c  |  3 +-
 .../net/virtio/virtio_user/virtio_user_dev.h  |  2 +-
 drivers/net/virtio/virtio_user_ethdev.c       | 61 +++++++++++--------
 5 files changed, 55 insertions(+), 28 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 1767140b7..a1e3752a8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -779,4 +779,19 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
 };
 
+/*
+ * dev_ops for virtio-user in secondary processes, as we just have
+ * some limited supports currently.
+ */
+const struct eth_dev_ops virtio_user_secondary_eth_dev_ops = {
+	.dev_infos_get           = virtio_dev_info_get,
+	.stats_get               = virtio_dev_stats_get,
+	.xstats_get              = virtio_dev_xstats_get,
+	.xstats_get_names        = virtio_dev_xstats_get_names,
+	.stats_reset             = virtio_dev_stats_reset,
+	.xstats_reset            = virtio_dev_stats_reset,
+	/* collect stats per queue */
+	.queue_stats_mapping_set = virtio_dev_queue_stats_mapping_set,
+};
+
 static void
 virtio_update_stats(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
diff --git a/drivers/net/virtio/virtio_ethdev.h b/drivers/net/virtio/virtio_ethdev.h
index e0f80e5a4..39a9f7b7d 100644
--- a/drivers/net/virtio/virtio_ethdev.h
+++ b/drivers/net/virtio/virtio_ethdev.h
@@ -46,4 +46,6 @@
 	 1u << VIRTIO_NET_F_HOST_TSO6)
 
+extern const struct eth_dev_ops virtio_user_secondary_eth_dev_ops;
+
 /*
  * CQ function prototype
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 9c8bcd2c6..f0051f887 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -413,5 +413,5 @@ int
 virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		     int cq, int queue_size, const char *mac, char **ifname,
-		     int mrg_rxbuf, int in_order)
+		     int server, int mrg_rxbuf, int in_order)
 {
 	pthread_mutex_init(&dev->mutex, NULL);
@@ -421,4 +421,5 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 	dev->queue_pairs = 1; /* mq disabled by default */
 	dev->queue_size = queue_size;
+	dev->is_server = server;
 	dev->mac_specified = 0;
 	dev->frontend_features = 0;
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h
index c42ce5d4b..3e3a7b787 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
@@ -51,5 +51,5 @@ int virtio_user_stop_device(struct virtio_user_dev *dev);
 int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 			 int cq, int queue_size, const char *mac, char **ifname,
-			 int mrg_rxbuf, int in_order);
+			 int server, int mrg_rxbuf, int in_order);
 void virtio_user_dev_uninit(struct virtio_user_dev *dev);
 void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx);
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index f8791391a..5781c0948 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -470,4 +470,24 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
 	int ret = -1;
 
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		const char *name = rte_vdev_device_name(dev);
+		eth_dev = rte_eth_dev_attach_secondary(name);
+		if (!eth_dev) {
+			RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
+			return -1;
+		}
+
+		if (eth_virtio_dev_init(eth_dev) < 0) {
+			PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
+			rte_eth_dev_release_port(eth_dev);
+			return -1;
+		}
+
+		eth_dev->dev_ops = &virtio_user_secondary_eth_dev_ops;
+		eth_dev->device = &dev->device;
+		rte_eth_dev_probing_finish(eth_dev);
+		return 0;
+	}
+
 	kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_args);
 	if (!kvlist) {
@@ -582,31 +602,17 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
 	}
 
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		struct virtio_user_dev *vu_dev;
+	eth_dev = virtio_user_eth_dev_alloc(dev);
+	if (!eth_dev) {
+		PMD_INIT_LOG(ERR, "virtio_user fails to alloc device");
+		goto end;
+	}
 
-		eth_dev = virtio_user_eth_dev_alloc(dev);
-		if (!eth_dev) {
-			PMD_INIT_LOG(ERR, "virtio_user fails to alloc device");
-			goto end;
-		}
-
-		hw = eth_dev->data->dev_private;
-		vu_dev = virtio_user_get_dev(hw);
-		if (server_mode == 1)
-			vu_dev->is_server = true;
-		else
-			vu_dev->is_server = false;
-		if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,
-				 queue_size, mac_addr, &ifname, mrg_rxbuf,
-				 in_order) < 0) {
-			PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
-			virtio_user_eth_dev_free(eth_dev);
-			goto end;
-		}
-
-	} else {
-		eth_dev = rte_eth_dev_attach_secondary(rte_vdev_device_name(dev));
-		if (!eth_dev)
-			goto end;
+	hw = eth_dev->data->dev_private;
+	if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,
+			 queue_size, mac_addr, &ifname, server_mode,
+			 mrg_rxbuf, in_order) < 0) {
+		PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
+		virtio_user_eth_dev_free(eth_dev);
+		goto end;
 	}
 
@@ -650,4 +656,7 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)
 		return -ENODEV;
 
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return rte_eth_dev_release_port(eth_dev);
+
 	/* make sure the device is stopped, queues freed */
 	rte_eth_dev_close(eth_dev->data->port_id);
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-04-25 16:37:47.931380463 +0100
+++ 0027-net-virtio-user-fix-multi-process-support.patch	2019-04-25 16:37:46.735295178 +0100
@@ -1 +1 @@
-From 1c8489da561be16ac73c6dab01db816af249713f Mon Sep 17 00:00:00 2001
+From d21964ea6b83ef0a060a628c044a3d35041ed373 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1c8489da561be16ac73c6dab01db816af249713f ]
+
@@ -17 +18,0 @@
-Cc: stable@dpdk.org
@@ -25 +26 @@
- .../net/virtio/virtio_user/virtio_user_dev.h  |  3 +-
+ .../net/virtio/virtio_user/virtio_user_dev.h  |  2 +-
@@ -27 +28 @@
- 5 files changed, 56 insertions(+), 28 deletions(-)
+ 5 files changed, 55 insertions(+), 28 deletions(-)
@@ -30 +31 @@
-index 85b223451..310008757 100644
+index 1767140b7..a1e3752a8 100644
@@ -33 +34 @@
-@@ -908,4 +908,19 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
+@@ -779,4 +779,19 @@ static const struct eth_dev_ops virtio_eth_dev_ops = {
@@ -54 +55 @@
-index b8aab7da4..45e96f32b 100644
+index e0f80e5a4..39a9f7b7d 100644
@@ -57 +58 @@
-@@ -48,4 +48,6 @@
+@@ -46,4 +46,6 @@
@@ -65 +66 @@
-index 2dc8f2051..07aabb527 100644
+index 9c8bcd2c6..f0051f887 100644
@@ -68 +69 @@
-@@ -427,5 +427,5 @@ int
+@@ -413,5 +413,5 @@ int
@@ -71,2 +72,2 @@
--		     int mrg_rxbuf, int in_order, int packed_vq)
-+		     int server, int mrg_rxbuf, int in_order, int packed_vq)
+-		     int mrg_rxbuf, int in_order)
++		     int server, int mrg_rxbuf, int in_order)
@@ -75 +76 @@
-@@ -435,4 +435,5 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
+@@ -421,4 +421,5 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
@@ -82 +83 @@
-index c57b298a6..829ad4140 100644
+index c42ce5d4b..3e3a7b787 100644
@@ -85 +86 @@
-@@ -62,5 +62,6 @@ int virtio_user_stop_device(struct virtio_user_dev *dev);
+@@ -51,5 +51,5 @@ int virtio_user_stop_device(struct virtio_user_dev *dev);
@@ -88,3 +89,2 @@
--			 int mrg_rxbuf, int in_order, int packed_vq);
-+			 int server, int mrg_rxbuf, int in_order,
-+			 int packed_vq);
+-			 int mrg_rxbuf, int in_order);
++			 int server, int mrg_rxbuf, int in_order);
@@ -94 +94 @@
-index c5a76bd91..129c2b9ef 100644
+index f8791391a..5781c0948 100644
@@ -97 +97 @@
-@@ -515,4 +515,24 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
+@@ -470,4 +470,24 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
@@ -122 +122 @@
-@@ -636,31 +656,17 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
+@@ -582,31 +602,17 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
@@ -147 +147 @@
--				 in_order, packed_vq) < 0) {
+-				 in_order) < 0) {
@@ -160 +160 @@
-+			 mrg_rxbuf, in_order, packed_vq) < 0) {
++			 mrg_rxbuf, in_order) < 0) {
@@ -166 +166 @@
-@@ -704,4 +710,7 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)
+@@ -650,4 +656,7 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)

  parent reply	other threads:[~2019-04-25 15:41 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 15:39 [dpdk-stable] patch 'drivers: fix SPDX license id consistency' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'malloc: fix IPC message initialization' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: fix secondary process setup' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/netvsc: fix VF support with secondary process' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: fix check for mmap failure' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: stop mapping if empty resource found' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: map ring in secondary process' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: decrease log level for unsupported devices' " Kevin Traynor
2019-04-26  9:38   ` [dpdk-stable] [EXT] " Hemant Agrawal
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/dpaa: fix Rx discard register mask' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'mem: warn user when running without NUMA support' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'eal/linux: remove thread ID from debug message' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: remove unused include of error.h' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: fix build with musl libc' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/nfp: " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/netvsc: fix include of fcntl.h' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/test: fix flags with meson' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/test: fix build with musl libc' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/vdev_netvsc: fix device cast' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: add missing newline when showing statistics' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: extend forwarding statistics to 64 bits' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: remove useless casts on statistics' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'ethdev: fix a typo' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/i40e: log when provided RSS key is not valid' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/bnxt: fix Rx VLAN offload flags' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/fm10k: fix VLAN strip offload flag' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/virtio: fix duplicate naming of include guard' " Kevin Traynor
2019-04-25 15:40 ` Kevin Traynor [this message]
2019-04-25 15:40 ` [dpdk-stable] patch 'vhost/crypto: fix parens' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'raw/ifpga: modify log output' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/netvsc: remove useless condition' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/virtio: " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'power: fix governor storage to trim newlines' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'telemetry: fix mapping of statistics' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'app/test: fix sprintf with strlcat' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'maintainers: update for IBM POWER' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: initialize alarms early' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ring: fix an error message' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'mem: limit use of address hint' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'event/sw: fix enqueue checks in self-test' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/event: replace sprintf with snprintf' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'compress/isal: fix compression stream initialization' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix session clearing' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix offset calculation for GCM' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'drivers/qat: fix queue pair NUMA node' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'compress/isal: fix getting information about CPU' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ring: fix namesize macro documentation block' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: tighten permissions on shared memory files' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/bonding: fix buffer length when printing strings' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'raw/dpaa2_qdma: fix to support multiprocess execution' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'power: remove unused variable' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/distributor: replace sprintf with strlcpy' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/hash: replace sprintf with snprintf' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: fix typo in comment of vector function' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix links to doxygen and sphinx sites' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix two typos in contributing guide' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix ABI check script examples' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'cfgfile: replace strcat with strlcat' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/mlx5: fix errno typos in comments' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix typos in mlx5 guide' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix typos in testpmd user " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'app/testpmd: fix typo in comment' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ethdev: fix typo in error messages' " Kevin Traynor

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=20190425154037.28778-27-ktraynor@redhat.com \
    --to=ktraynor@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 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).