Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] shared: support old desc of vdev tyep
Date: Tue, 30 Jul 2019 16:29:07 +0900	[thread overview]
Message-ID: <20190730072907.3849-1-yasufum.o@gmail.com> (raw)

From: Yasufumi Ogawa <yasufum.o@gmail.com>

In DPDK, vdev was described with prefix `eth` such as `eth_vhost0`,
but is changed to use `net` instead of `eth`. Because both of
prefixes are supported currently, SPP should also accept both.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/shared/common.c | 46 +++++++++++++++++++++++++--------------------
 src/shared/common.h | 13 ++++++++-----
 2 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/src/shared/common.c b/src/shared/common.c
index 6655f17..aa1486a 100644
--- a/src/shared/common.c
+++ b/src/shared/common.c
@@ -176,47 +176,53 @@ int parse_dev_name(char *dev_name, int *port_type, int *port_id)
 	int dev_name_len = strlen(dev_name);
 	int dev_str_len;
 
-	if (strncmp(dev_name, VDEV_PREFIX_RING,
-			strlen(VDEV_PREFIX_RING)) == 0) {
-		dev_str_len = strlen(VDEV_PREFIX_RING);
+	if (strncmp(dev_name, VDEV_ETH_RING,
+				strlen(VDEV_ETH_RING)) == 0 ||
+			strncmp(dev_name, VDEV_NET_RING,
+				strlen(VDEV_NET_RING)) == 0) {
+		dev_str_len = strlen(VDEV_NET_RING);
 		pid_len = dev_name_len - dev_str_len;
-		strncpy(pid_str, dev_name + strlen(VDEV_PREFIX_RING),
+		strncpy(pid_str, dev_name + strlen(VDEV_NET_RING),
 				pid_len);
 		*port_id = (int)strtol(pid_str, NULL, 10);
 		*port_type = RING;
 
-	} else if (strncmp(dev_name, VDEV_PREFIX_VHOST,
-			strlen(VDEV_PREFIX_VHOST)) == 0) {
-		dev_str_len = strlen(VDEV_PREFIX_VHOST);
+	} else if (strncmp(dev_name, VDEV_ETH_VHOST,
+				strlen(VDEV_ETH_VHOST)) == 0 ||
+			strncmp(dev_name, VDEV_NET_VHOST,
+				strlen(VDEV_NET_VHOST)) == 0) {
+		dev_str_len = strlen(VDEV_NET_VHOST);
 		pid_len = dev_name_len - dev_str_len;
-		strncpy(pid_str, dev_name + strlen(VDEV_PREFIX_VHOST),
+		strncpy(pid_str, dev_name + strlen(VDEV_NET_VHOST),
 				pid_len);
 		*port_id = (int)strtol(pid_str, NULL, 10);
 		*port_type = VHOST;
 
-	} else if (strncmp(dev_name, VDEV_PREFIX_PCAP,
-			strlen(VDEV_PREFIX_PCAP)) == 0) {
-		dev_str_len = strlen(VDEV_PREFIX_PCAP);
+	} else if (strncmp(dev_name, VDEV_PCAP,
+			strlen(VDEV_PCAP)) == 0) {
+		dev_str_len = strlen(VDEV_PCAP);
 		pid_len = dev_name_len - dev_str_len;
-		strncpy(pid_str, dev_name + strlen(VDEV_PREFIX_PCAP),
+		strncpy(pid_str, dev_name + strlen(VDEV_PCAP),
 				pid_len);
 		*port_id = (int)strtol(pid_str, NULL, 10);
 		*port_type = PCAP;
 
-	} else if (strncmp(dev_name, VDEV_PREFIX_TAP,
-			strlen(VDEV_PREFIX_TAP)) == 0) {
-		dev_str_len = strlen(VDEV_PREFIX_TAP);
+	} else if (strncmp(dev_name, VDEV_ETH_TAP,
+				strlen(VDEV_ETH_TAP)) == 0 ||
+			strncmp(dev_name, VDEV_NET_TAP,
+				strlen(VDEV_NET_TAP)) == 0) {
+		dev_str_len = strlen(VDEV_NET_TAP);
 		pid_len = dev_name_len - dev_str_len;
-		strncpy(pid_str, dev_name + strlen(VDEV_PREFIX_TAP),
+		strncpy(pid_str, dev_name + strlen(VDEV_NET_TAP),
 				pid_len);
 		*port_id = (int)strtol(pid_str, NULL, 10);
 		*port_type = TAP;
 
-	} else if (strncmp(dev_name, VDEV_PREFIX_NULL,
-			strlen(VDEV_PREFIX_NULL)) == 0) {
-		dev_str_len = strlen(VDEV_PREFIX_NULL);
+	} else if (strncmp(dev_name, VDEV_NULL,
+			strlen(VDEV_NULL)) == 0) {
+		dev_str_len = strlen(VDEV_NULL);
 		pid_len = dev_name_len - dev_str_len;
-		strncpy(pid_str, dev_name + strlen(VDEV_PREFIX_NULL),
+		strncpy(pid_str, dev_name + strlen(VDEV_NULL),
 				pid_len);
 		*port_id = (int)strtol(pid_str, NULL, 10);
 		*port_type = PCAP;
diff --git a/src/shared/common.h b/src/shared/common.h
index d51d6df..4d0dbe8 100644
--- a/src/shared/common.h
+++ b/src/shared/common.h
@@ -43,11 +43,14 @@
 #define RTE_MP_RX_DESC_DEFAULT 512
 #define RTE_MP_TX_DESC_DEFAULT 512
 
-#define VDEV_PREFIX_RING  "net_ring"
-#define VDEV_PREFIX_VHOST "eth_vhost"
-#define VDEV_PREFIX_PCAP  "net_pcap"
-#define VDEV_PREFIX_TAP   "net_tap"
-#define VDEV_PREFIX_NULL  "eth_null"
+#define VDEV_ETH_RING "eth_ring"
+#define VDEV_NET_RING "net_ring"
+#define VDEV_ETH_VHOST "eth_vhost"
+#define VDEV_NET_VHOST "net_vhost"
+#define VDEV_PCAP "net_pcap"
+#define VDEV_ETH_TAP "eth_tap"
+#define VDEV_NET_TAP "net_tap"
+#define VDEV_NULL "eth_null"
 
 
 /* Command. */
-- 
2.17.1


                 reply	other threads:[~2019-07-30  7:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190730072907.3849-1-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /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).