Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 0/2] Change spp_pcap to use common port types
@ 2019-07-25 12:12 yasufum.o
  2019-07-25 12:12 ` [spp] [PATCH 1/2] shared/sec: move defines of " yasufum.o
  2019-07-25 12:12 ` [spp] [PATCH 2/2] spp_pcap: change to use common " yasufum.o
  0 siblings, 2 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-25 12:12 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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

Spp_pcap defines string of port types, "phy" and "ring". However, these
are also defined in shared lib. This series of pathces is to change
spp_pcap to use shared.

Yasufumi Ogawa (2):
  shared/sec: move defines of port types
  spp_pcap: change to use common port types

 src/pcap/cmd_utils.c                          |  4 ++--
 src/pcap/cmd_utils.h                          | 10 +---------
 src/pcap/spp_pcap.c                           | 20 +++++++++----------
 .../secondary/spp_worker_th/cmd_utils.h       |  5 -----
 .../secondary/spp_worker_th/data_types.h      |  5 +++++
 5 files changed, 18 insertions(+), 26 deletions(-)

-- 
2.17.1


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

* [spp] [PATCH 1/2] shared/sec: move defines of port types
  2019-07-25 12:12 [spp] [PATCH 0/2] Change spp_pcap to use common port types yasufum.o
@ 2019-07-25 12:12 ` yasufum.o
  2019-07-25 12:12 ` [spp] [PATCH 2/2] spp_pcap: change to use common " yasufum.o
  1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-25 12:12 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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

This patch is to move following defines to be able to be used from
spp_pcap.

  #define SPPWK_PHY_STR "phy"
  #define SPPWK_VHOST_STR "vhost"
  #define SPPWK_RING_STR "ring"

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/shared/secondary/spp_worker_th/cmd_utils.h  | 5 -----
 src/shared/secondary/spp_worker_th/data_types.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index 56f11ac..ecc1141 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -27,11 +27,6 @@
 #define SPPWK_TYPE_PCAP_STR "pcap"
 #define SPPWK_TYPE_NONE_STR "unuse"
 
-/** Identifier string for each interface */
-#define SPPWK_PHY_STR "phy"
-#define SPPWK_VHOST_STR "vhost"
-#define SPPWK_RING_STR "ring"
-
 /** Waiting time for checking update (not used for spp_pcap). */
 #define SPP_CHANGE_UPDATE_INTERVAL 10  /* micro sec */
 
diff --git a/src/shared/secondary/spp_worker_th/data_types.h b/src/shared/secondary/spp_worker_th/data_types.h
index 7b24df3..f6dd60f 100644
--- a/src/shared/secondary/spp_worker_th/data_types.h
+++ b/src/shared/secondary/spp_worker_th/data_types.h
@@ -10,6 +10,11 @@
 #define STR_LEN_SHORT 32  /* Size of short string. */
 #define STR_LEN_NAME 128  /* Size of string for names. */
 
+/** Identifier string for each interface */
+#define SPPWK_PHY_STR "phy"
+#define SPPWK_VHOST_STR "vhost"
+#define SPPWK_RING_STR "ring"
+
 /* TODO(yasufum) confirm usage of this value and why it is 4. */
 #define PORT_CAPABL_MAX 4  /* Max num of port abilities. */
 
-- 
2.17.1


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

* [spp] [PATCH 2/2] spp_pcap: change to use common port types
  2019-07-25 12:12 [spp] [PATCH 0/2] Change spp_pcap to use common port types yasufum.o
  2019-07-25 12:12 ` [spp] [PATCH 1/2] shared/sec: move defines of " yasufum.o
@ 2019-07-25 12:12 ` yasufum.o
  1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-07-25 12:12 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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

This update is to change to use port types "phy" and "ring" defined
in shared dir.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/pcap/cmd_utils.c |  4 ++--
 src/pcap/cmd_utils.h | 10 +---------
 src/pcap/spp_pcap.c  | 20 ++++++++++----------
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/src/pcap/cmd_utils.c b/src/pcap/cmd_utils.c
index 88514c8..3c71b2e 100644
--- a/src/pcap/cmd_utils.c
+++ b/src/pcap/cmd_utils.c
@@ -269,10 +269,10 @@ int spp_format_port_string(char *port, enum port_type iface_type, int iface_no)
 
 	switch (iface_type) {
 	case PHY:
-		iface_type_str = SPP_IFTYPE_NIC_STR;
+		iface_type_str = SPPWK_PHY_STR;
 		break;
 	case RING:
-		iface_type_str = SPP_IFTYPE_RING_STR;
+		iface_type_str = SPPWK_RING_STR;
 		break;
 	default:
 		return SPPWK_RET_NG;
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index 1fb8d14..2e78c69 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -22,15 +22,6 @@
 #include <netinet/in.h>
 #include "shared/common.h"
 
-/** Identifier string for each interface */
-#define SPP_IFTYPE_NIC_STR   "phy"
-#define SPP_IFTYPE_RING_STR  "ring"
-
-#define STR_LEN_SHORT 32  /* Size of short string. */
-#define STR_LEN_NAME 128  /* Size of string for names. */
-
-#define PORT_ABL_MAX 4  /* Max num of port abilities. */
-
 /* Max number of core status check */
 #define SPP_CORE_STATUS_CHECK_MAX 5
 
@@ -59,6 +50,7 @@ enum sppwk_lcore_status sppwk_get_lcore_status(unsigned int lcore_id);
  * @retval 0  If succeeded.
  * @retval -1 If failed.
  */
+/* TODO(yasufum) remove it and use in shared because it is same. */
 int check_core_status_wait(enum sppwk_lcore_status status);
 
 /**
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index e6ae01a..58a2c52 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -216,16 +216,16 @@ parse_captured_port(const char *port_str, enum port_type *iface_type,
 	char *endptr = NULL;
 
 	/* Find out which type of interface from resource UID */
-	if (strncmp(port_str, SPP_IFTYPE_NIC_STR ":",
-			strlen(SPP_IFTYPE_NIC_STR)+1) == 0) {
+	if (strncmp(port_str, SPPWK_PHY_STR ":",
+			strlen(SPPWK_PHY_STR)+1) == 0) {
 		/* NIC */
 		type = PHY;
-		no_str = &port_str[strlen(SPP_IFTYPE_NIC_STR)+1];
-	} else if (strncmp(port_str, SPP_IFTYPE_RING_STR ":",
-			strlen(SPP_IFTYPE_RING_STR)+1) == 0) {
+		no_str = &port_str[strlen(SPPWK_PHY_STR)+1];
+	} else if (strncmp(port_str, SPPWK_RING_STR ":",
+			strlen(SPPWK_RING_STR)+1) == 0) {
 		/* RING */
 		type = RING;
-		no_str = &port_str[strlen(SPP_IFTYPE_RING_STR)+1];
+		no_str = &port_str[strlen(SPPWK_RING_STR)+1];
 	} else {
 		/* OTHER */
 		RTE_LOG(ERR, SPP_PCAP, "The interface that does not suppor. "
@@ -468,9 +468,9 @@ static int file_compression_operation(struct pcap_mng_info *info,
 		info->file_size = 0;
 		info->file_no = 1;
 		if (g_pcap_option.port_cap.iface_type == PHY)
-			iface_type_str = SPP_IFTYPE_NIC_STR;
+			iface_type_str = SPPWK_PHY_STR;
 		else
-			iface_type_str = SPP_IFTYPE_RING_STR;
+			iface_type_str = SPPWK_RING_STR;
 		snprintf(info->compress_file_name,
 					PCAP_FNAME_STRLEN - 1,
 					"spp_pcap.%s.%s%d.%u.%u.pcap.lz4",
@@ -523,9 +523,9 @@ static int file_compression_operation(struct pcap_mng_info *info,
 		info->file_size = 0;
 		info->file_no++;
 		if (g_pcap_option.port_cap.iface_type == PHY)
-			iface_type_str = SPP_IFTYPE_NIC_STR;
+			iface_type_str = SPPWK_PHY_STR;
 		else
-			iface_type_str = SPP_IFTYPE_RING_STR;
+			iface_type_str = SPPWK_RING_STR;
 		snprintf(info->compress_file_name,
 					PCAP_FNAME_STRLEN - 1,
 					"spp_pcap.%s.%s%d.%u.%u.pcap.lz4",
-- 
2.17.1


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

end of thread, other threads:[~2019-07-25 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 12:12 [spp] [PATCH 0/2] Change spp_pcap to use common port types yasufum.o
2019-07-25 12:12 ` [spp] [PATCH 1/2] shared/sec: move defines of " yasufum.o
2019-07-25 12:12 ` [spp] [PATCH 2/2] spp_pcap: change to use common " yasufum.o

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