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] spp_pcap: rename funcs and vars in cmd_util.h
Date: Mon, 24 Jun 2019 19:39:52 +0900	[thread overview]
Message-ID: <20190624103952.24710-1-yasufum.o@gmail.com> (raw)

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

There are many similar funcs and vars in shared and spp_pcap. Some of
them have same features should be merged to shared libs. This update is
the first step to the task, rename funcs and vars in spp_pcap to be
exactly the same, and add TODOs.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/mirror/mir_cmd_runner.c                   |  10 +-
 src/pcap/cmd_utils.c                          |  70 ++++----
 src/pcap/cmd_utils.h                          | 151 ++++++++----------
 .../secondary/spp_worker_th/cmd_parser.c      |   2 +-
 .../spp_worker_th/cmd_res_formatter.c         |   8 +-
 .../secondary/spp_worker_th/cmd_utils.h       |  51 +++---
 src/shared/secondary/spp_worker_th/spp_port.c |   8 +-
 src/vf/classifier_mac.c                       |   6 +-
 src/vf/vf_cmd_runner.c                        |  10 +-
 9 files changed, 150 insertions(+), 166 deletions(-)

diff --git a/src/mirror/mir_cmd_runner.c b/src/mirror/mir_cmd_runner.c
index 312ded5..abbd6f6 100644
--- a/src/mirror/mir_cmd_runner.c
+++ b/src/mirror/mir_cmd_runner.c
@@ -176,11 +176,11 @@ update_port(enum sppwk_action wk_action,
 			/* registered */
 			/* TODO(yasufum) confirm it is needed for spp_mirror. */
 			if (ability->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
-				while ((cnt < SPP_PORT_ABILITY_MAX) &&
+				while ((cnt < PORT_ABL_MAX) &&
 					    (port_info->ability[cnt].ops !=
 					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
 					cnt++;
-				if (cnt >= SPP_PORT_ABILITY_MAX) {
+				if (cnt >= PORT_ABL_MAX) {
 					RTE_LOG(ERR, MIR_CMD_RUNNER, "update VLAN tag "
 						"Non-registratio\n");
 					return SPP_RET_NG;
@@ -201,12 +201,12 @@ update_port(enum sppwk_action wk_action,
 		}
 
 		if (ability->ops != SPPWK_PORT_ABL_OPS_NONE) {
-			while ((cnt < SPP_PORT_ABILITY_MAX) &&
+			while ((cnt < PORT_ABL_MAX) &&
 					(port_info->ability[cnt].ops !=
 					SPPWK_PORT_ABL_OPS_NONE)) {
 				cnt++;
 			}
-			if (cnt >= SPP_PORT_ABILITY_MAX) {
+			if (cnt >= PORT_ABL_MAX) {
 				RTE_LOG(ERR, MIR_CMD_RUNNER,
 						"No space of port ability.\n");
 				return SPP_RET_NG;
@@ -223,7 +223,7 @@ update_port(enum sppwk_action wk_action,
 		break;
 
 	case SPPWK_ACT_DEL:
-		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
 			if (port_info->ability[cnt].ops ==
 					SPPWK_PORT_ABL_OPS_NONE)
 				continue;
diff --git a/src/pcap/cmd_utils.c b/src/pcap/cmd_utils.c
index 726ad9e..d9e09e5 100644
--- a/src/pcap/cmd_utils.c
+++ b/src/pcap/cmd_utils.c
@@ -13,7 +13,7 @@
 #define RTE_LOGTYPE_PCAP_UTILS RTE_LOGTYPE_USER2
 
 /* Manage data to addoress */
-struct manage_data_addr_info {
+struct mng_data_info {
 	struct startup_param	  *p_startup_param;
 	struct iface_info	  *p_iface_info;
 	struct core_mng_info	  *p_core_info;
@@ -24,7 +24,7 @@ struct manage_data_addr_info {
 
 /* Declare global variables */
 /* Logical core ID for main process */
-static struct manage_data_addr_info g_mng_data_addr;
+static struct mng_data_info g_mng_data_addr;
 
 /* generation of the ring port */
 int
@@ -206,11 +206,11 @@ set_nic_interface(void)
 	struct iface_info *p_iface_info = g_mng_data_addr.p_iface_info;
 
 	/* NIC Setting */
-	p_iface_info->num_nic = rte_eth_dev_count_avail();
-	if (p_iface_info->num_nic > RTE_MAX_ETHPORTS)
-		p_iface_info->num_nic = RTE_MAX_ETHPORTS;
+	p_iface_info->nof_phys = rte_eth_dev_count_avail();
+	if (p_iface_info->nof_phys > RTE_MAX_ETHPORTS)
+		p_iface_info->nof_phys = RTE_MAX_ETHPORTS;
 
-	for (nic_cnt = 0; nic_cnt < p_iface_info->num_nic; nic_cnt++) {
+	for (nic_cnt = 0; nic_cnt < p_iface_info->nof_phys; nic_cnt++) {
 		p_iface_info->nic[nic_cnt].iface_type   = PHY;
 		p_iface_info->nic[nic_cnt].ethdev_port_id = nic_cnt;
 	}
@@ -258,47 +258,47 @@ int spp_format_port_string(char *port, enum port_type iface_type, int iface_no)
 }
 
 /* Set mange data address */
-int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
-			  struct iface_info *iface_addr,
-			  struct core_mng_info *core_mng_addr,
-			  int *capture_request_addr,
-			  int *capture_status_addr,
+int spp_set_mng_data_addr(struct startup_param *startup_param_p,
+			  struct iface_info *iface_p,
+			  struct core_mng_info *core_mng_p,
+			  int *capture_request_p,
+			  int *capture_status_p,
 			  unsigned int main_lcore_id)
 {
-	if (startup_param_addr == NULL || iface_addr == NULL ||
-			core_mng_addr == NULL ||
-			capture_request_addr == NULL ||
-			capture_status_addr == NULL ||
+	if (startup_param_p == NULL || iface_p == NULL ||
+			core_mng_p == NULL ||
+			capture_request_p == NULL ||
+			capture_status_p == NULL ||
 			main_lcore_id == 0xffffffff)
 		return SPPWK_RET_NG;
 
-	g_mng_data_addr.p_startup_param = startup_param_addr;
-	g_mng_data_addr.p_iface_info = iface_addr;
-	g_mng_data_addr.p_core_info = core_mng_addr;
-	g_mng_data_addr.p_capture_request = capture_request_addr;
-	g_mng_data_addr.p_capture_status = capture_status_addr;
+	g_mng_data_addr.p_startup_param = startup_param_p;
+	g_mng_data_addr.p_iface_info = iface_p;
+	g_mng_data_addr.p_core_info = core_mng_p;
+	g_mng_data_addr.p_capture_request = capture_request_p;
+	g_mng_data_addr.p_capture_status = capture_status_p;
 	g_mng_data_addr.main_lcore_id = main_lcore_id;
 
 	return SPPWK_RET_OK;
 }
 
 /* Get manage data address */
-void spp_get_mng_data_addr(struct startup_param **startup_param_addr,
-			   struct iface_info **iface_addr,
-			   struct core_mng_info **core_mng_addr,
-			   int **capture_request_addr,
-			   int **capture_status_addr)
+void spp_get_mng_data_addr(struct startup_param **startup_param_p,
+			   struct iface_info **iface_p,
+			   struct core_mng_info **core_mng_p,
+			   int **capture_request_p,
+			   int **capture_status_p)
 {
 
-	if (startup_param_addr != NULL)
-		*startup_param_addr = g_mng_data_addr.p_startup_param;
-	if (iface_addr != NULL)
-		*iface_addr = g_mng_data_addr.p_iface_info;
-	if (core_mng_addr != NULL)
-		*core_mng_addr = g_mng_data_addr.p_core_info;
-	if (capture_request_addr != NULL)
-		*capture_request_addr = g_mng_data_addr.p_capture_request;
-	if (capture_status_addr != NULL)
-		*capture_status_addr = g_mng_data_addr.p_capture_status;
+	if (startup_param_p != NULL)
+		*startup_param_p = g_mng_data_addr.p_startup_param;
+	if (iface_p != NULL)
+		*iface_p = g_mng_data_addr.p_iface_info;
+	if (core_mng_p != NULL)
+		*core_mng_p = g_mng_data_addr.p_core_info;
+	if (capture_request_p != NULL)
+		*capture_request_p = g_mng_data_addr.p_capture_request;
+	if (capture_status_p != NULL)
+		*capture_status_p = g_mng_data_addr.p_capture_status;
 
 }
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index d38e0eb..46747e9 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -21,22 +21,18 @@
 #include <netinet/in.h>
 #include "shared/common.h"
 
-/* Max number of core status check */
-#define SPP_CORE_STATUS_CHECK_MAX 5
-
-/** The length of shortest character string */
-#define SPP_MIN_STR_LEN   32
-
-/** The length of NAME string */
-#define SPP_NAME_STR_LEN  128
-
-/** Maximum number of port abilities available */
-#define SPP_PORT_ABILITY_MAX 4
-
 /** 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
+
 /* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
 /* State on core */
 enum sppwk_lcore_status {
@@ -127,7 +123,7 @@ struct spp_port_ability {
 /* Attributes for classifying . */
 struct sppwk_cls_attrs {
 	uint64_t mac_addr;  /**< Mac address (binary) */
-	char mac_addr_str[SPP_MIN_STR_LEN];  /**< Mac address (text) */
+	char mac_addr_str[STR_LEN_SHORT];  /**< Mac address (text) */
 	struct spp_vlantag_info vlantag;   /**< VLAN tag information */
 };
 
@@ -143,13 +139,13 @@ struct sppwk_port_info {
 	int iface_no;
 	int ethdev_port_id;  /**< Consistent ID of ethdev */
 	struct sppwk_cls_attrs cls_attrs;
-	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
+	struct spp_port_ability ability[PORT_ABL_MAX];
 };
 
 /* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
 /* Attributes of SPP worker thread named as `component`. */
 struct sppwk_comp_info {
-	char name[SPP_NAME_STR_LEN];  /**< Component name */
+	char name[STR_LEN_NAME];  /**< Component name */
 	enum sppwk_worker_type wk_type;  /**< Type of worker thread */
 	unsigned int lcore_id;
 	int comp_id;  /**< Component ID */
@@ -161,20 +157,18 @@ struct sppwk_comp_info {
 
 /* Manage given options as global variable */
 struct startup_param {
-	int client_id;		/* Client ID */
-	char server_ip[INET_ADDRSTRLEN];
-				/* IP address stiring of spp-ctl */
-	int server_port;	/* Port Number of spp-ctl */
+	int client_id;  /* Client ID */
+	char server_ip[INET_ADDRSTRLEN];  /* IP address of spp-ctl */
+	int server_port;  /* Port Number of spp-ctl */
 };
 
 /* Manage interfaces and port information as global variable */
+/* TODO(yasufum) confirm why nof_rings is required not used in anywhere. */
 struct iface_info {
-	int num_nic;            /* The number of phy */
-	int num_ring;           /* The number of ring */
+	int nof_phys;    /* Number of phy ports */
+	int nof_rings;   /* Number of ring ports */
 	struct sppwk_port_info nic[RTE_MAX_ETHPORTS];
-				/* Port information of phy */
 	struct sppwk_port_info ring[RTE_MAX_ETHPORTS];
-				/* Port information of ring */
 };
 
 /* Manage core status and component information as global variable */
@@ -184,46 +178,42 @@ struct core_mng_info {
 };
 
 /* TODO(yasufum) refactor name of func and vars, and comments. */
+/* TODO(yasufum) confirm this var is used in spp_pcap. */
+/* TODO(yasufum) if so, consider to merge to shared. */
 struct spp_iterate_core_params;
 /**
- * definition of iterated core element procedure function
- * which is member of spp_iterate_core_params structure.
- * Above structure is used when listing core information
- * (e.g) create resonse to status command.
+ * Define func to iterate lcore to list core information for showing status
+ * or so, as a member of struct `spp_iterate_core_params`.
  */
 typedef int (*spp_iterate_core_element_proc)(
 		struct spp_iterate_core_params *params,
 		const unsigned int lcore_id,
-		const char *name,
-		const char *type,
-		const int num_rx,
+		const char *wk_name,
+		const char *wk_type,
+		const int nof_rx,
 		const struct sppwk_port_idx *rx_ports,
-		const int num_tx,
+		const int nof_tx,
 		const struct sppwk_port_idx *tx_ports);
 
-/* TODO(yasufum) refactor name of func and vars, and comments. */
 /**
- * iterate core table parameters which is
- * used when listing core table content
- * (e.g.) create response to status command.
+ * iterate core table parameters used to list content of lcore table for.
+ * showing status or so.
  */
+/* TODO(yasufum) consider to merge to shared. */
+/* TODO(yasufum) refactor name of func and vars, and comments. */
 struct spp_iterate_core_params {
-	/** Output buffer */
-	char *output;
-
+	char *output;  /* Buffer used for output */
 	/** The function for creating core information */
 	spp_iterate_core_element_proc element_proc;
 };
 
 /**
- * added ring_pmd
+ * Add ring pmd for owned proccess or thread.
  *
- * @param ring_id
- *  added ring id.
- *
- * @retval 0~   ring_port_id.
- * @retval -1   failed.
+ * @param[in] ring_id added ring id.
+ * @return ring port ID, or -1 if failed.
  */
+/* TODO(yasufum) consider to merge to shared. */
 int add_ring_pmd(int ring_id);
 
 /**
@@ -308,16 +298,13 @@ struct core_info *get_core_info(unsigned int lcore_id);
 /**
  * Port type to string
  *
- * @param port
- *  Character string of Port type to be converted.
- * @param iface_type
- *  port interface type
- * @param iface_no
- *  interface no
- *
- * @retval SPPWK_RET_OK succeeded.
- * @retval SPPWK_RET_NG failed.
+ * @param port String of port type to be converted.
+ * @param iface_type Interface type.
+ * @param iface_no Interface number.
+ * @retval SPP_RET_OK If succeeded.
+ * @retval SPP_RET_NG If failed.
  */
+/* TODO(yasufum) consider to merge to shared. */
 int
 spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 
@@ -340,47 +327,35 @@ spp_format_port_string(char *port, enum port_type iface_type, int iface_no);
 /**
  * Set mange data address
  *
- * @param startup_param_addr
- *  g_startup_param address
- * @param iface_addr
- *  g_iface_info address
- * @param core_mng_addr
- *  g_core_info address
- * @param capture_request_addr
- *  g_capture_request address
- * @param capture_status_addr
- *  g_capture_status address
- * @param main_lcore_id
- *  main_lcore_id mask
- *
- * @retval SPPWK_RET_OK succeeded.
- * @retval SPPWK_RET_NG failed.
+ * @param startup_param_p Pointer to g_startup_param address.
+ * @param iface_p Pointer to g_iface_info address.
+ * @param core_mng_p Pointer to g_core_info address.
+ * @param capture_status_p Pointer to status of pcap.
+ * @param capture_request_p Pointer to req of pcap.
+ * @param main_lcore_id Lcore ID of main thread.
+ * @retval SPP_RET_OK If succeeded.
+ * @retval SPP_RET_NG If failed.
  */
-int spp_set_mng_data_addr(struct startup_param *startup_param_addr,
-			  struct iface_info *iface_addr,
-			  struct core_mng_info *core_mng_addr,
-			  int *capture_request_addr,
-			  int *capture_status_addr,
+int spp_set_mng_data_addr(struct startup_param *startup_param_p,
+			  struct iface_info *iface_p,
+			  struct core_mng_info *core_mng_p,
+			  int *capture_request_p,
+			  int *capture_status_p,
 			  unsigned int main_lcore_id);
 
 /**
  * Get mange data address
  *
- * @param iface_addr
- *  g_startup_param write address
- * @param iface_addr
- *  g_iface_info write address
- * @param core_mng_addr
- *  g_core_mng_info write address
- * @param change_core_addr
- *  g_capture_request write address
- * @param change_component_addr
- *  g_capture_status write address
+ * @param startup_param_p Pointer to startup params.
+ * @param iface_p Pointer to g_iface_info.
+ * @param core_mng_p Pointer to g_core_mng_info.
+ * @param capture_request_p Pointer to status of pcap.
+ * @param capture_status_p Pointer to req of pcap.
  */
-void spp_get_mng_data_addr(struct startup_param **startup_param_addr,
-			   struct iface_info **iface_addr,
-			   struct core_mng_info **core_mng_addr,
-			   int **capture_request_addr,
-			   int **capture_status_addr);
+void spp_get_mng_data_addr(struct startup_param **startup_param_p,
+			   struct iface_info **iface_p,
+			   struct core_mng_info **core_mng_p,
+			   int **capture_request_p,
+			   int **capture_status_p);
 
 #endif
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 10d46d8..cd79bdb 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -632,7 +632,7 @@ parse_mac_addr(void *output, const char *arg_val,
 
 	/* If given value is the default, use dummy address instead. */
 	if (unlikely(strcmp(str_val, SPPWK_TERM_DEFAULT) == 0))
-		str_val = SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR;
+		str_val = CLS_DUMMY_ADDR_STR;
 
 	/* Check if the given value is valid. */
 	res = sppwk_convert_mac_str_to_int64(str_val);
diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
index f51157a..7d7388d 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
@@ -23,7 +23,7 @@ static int append_error_details_value(const char *name, char **output,
 
 /**
  * List of worker process type. The order of items should be same as the order
- * of enum `secondary_type` in cmd_utils.h.
+ * of enum `wk_proc_type` in cmd_utils.h.
  */
 /* TODO(yasufum) Add "pcap" after spp_pcap is made to use shared. */
 const char *SPPWK_PROC_TYPE_LIST[] = {
@@ -179,7 +179,7 @@ append_vlan_block(const char *name, char **output,
 	}
 
 	spp_port_ability_get_info(port_id, dir, &info);
-	for (i = 0; i < SPP_PORT_ABILITY_MAX; i++) {
+	for (i = 0; i < PORT_ABL_MAX; i++) {
 		switch (info[i].ops) {
 		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
@@ -194,14 +194,14 @@ append_vlan_block(const char *name, char **output,
 			 * An if statement after loop termination is false
 			 * by "maximum+1 ".
 			 */
-			i = SPP_PORT_ABILITY_MAX + 1;
+			i = PORT_ABL_MAX + 1;
 			break;
 		default:
 			/* not used */
 			break;
 		}
 	}
-	if (i == SPP_PORT_ABILITY_MAX) {
+	if (i == PORT_ABL_MAX) {
 		ret = append_vlan_value(&tmp_buff, SPPWK_PORT_ABL_OPS_NONE,
 				0, 0);
 		if (unlikely(ret < SPP_RET_OK))
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index d68b0d6..7139865 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -5,14 +5,13 @@
 #ifndef _SPPWK_CMD_UTILS_H_
 #define _SPPWK_CMD_UTILS_H_
 
-#include <netinet/in.h>
-
 /**
  * @file cmd_utils.h
  *
  * Command utility functions for SPP worker thread.
  */
 
+#include <netinet/in.h>
 #include "shared/common.h"
 
 /**
@@ -24,6 +23,7 @@
 #define SPPWK_TYPE_MRG_STR "merge"
 #define SPPWK_TYPE_FWD_STR "forward"
 #define SPPWK_TYPE_MIR_STR "mirror"
+#define SPPWK_TYPE_PCAP_STR "pcap"
 #define SPPWK_TYPE_NONE_STR "unuse"
 
 /** Identifier string for each interface */
@@ -31,19 +31,22 @@
 #define SPP_IFTYPE_VHOST_STR "vhost"
 #define SPP_IFTYPE_RING_STR  "ring"
 
-/** Update wait timer (micro sec) */
-#define SPP_CHANGE_UPDATE_INTERVAL 10
+/** Waiting time for checking update (not used for spp_pcap). */
+#define SPP_CHANGE_UPDATE_INTERVAL 10  /* micro sec */
 
-/* Used for index of arrary of management data which has two sides. */
+/**
+ * Used for index of arrary of management data which has two sides. It is not
+ * used for spp_pcap.
+ */
 #define TWO_SIDES 2
 
 #define STR_LEN_SHORT 32  /* Size of short string. */
 #define STR_LEN_NAME 128  /* Size of string for names. */
 
 /* TODO(yasufum) confirm usage of this value and why it is 4. */
-#define SPP_PORT_ABILITY_MAX 4  /* Max num of port abilities. */
+#define PORT_ABL_MAX 4  /* Max num of port abilities. */
 
-/** Maximum VLAN PCP */
+/** Maximum VLAN PCP, used only for spp_vf. */
 #define SPP_VLAN_PCP_MAX 7
 
 /* Max number of core status check */
@@ -52,11 +55,11 @@
 /** Character sting for default port of classifier */
 #define SPPWK_TERM_DEFAULT "default"
 
-/** Value for default MAC address of classifier */
-#define SPP_DEFAULT_CLASSIFIED_DMY_ADDR     0x010000000000
-
-/** Character sting for default MAC address of classifier */
-#define SPP_DEFAULT_CLASSIFIED_DMY_ADDR_STR "00:00:00:00:00:01"
+/**
+ * Character sting for default MAC address of classifier.
+ * It is used only for spp_vf.
+ */
+#define CLS_DUMMY_ADDR_STR "00:00:00:00:00:01"
 
 /* Sampling interval timer for latency evaluation */
 #define SPP_RING_LATENCY_STATS_SAMPLING_INTERVAL 1000000
@@ -181,7 +184,7 @@ struct sppwk_port_info {
 	int iface_no;
 	int ethdev_port_id;  /**< Consistent ID of ethdev */
 	struct sppwk_cls_attrs cls_attrs;
-	struct spp_port_ability ability[SPP_PORT_ABILITY_MAX];
+	struct spp_port_ability ability[PORT_ABL_MAX];
 };
 
 /* Attributes of SPP worker thread named as `component`. */
@@ -196,7 +199,7 @@ struct sppwk_comp_info {
 	struct sppwk_port_info *tx_ports[RTE_MAX_ETHPORTS]; /**< tx ports */
 };
 
-/* Manage given options as global variable */
+/* Manage cmd arg as global variable, used for spp_vf and spp_mirror. */
 struct startup_param {
 	int client_id;  /* Client ID */
 	char server_ip[INET_ADDRSTRLEN];  /* IP address of spp-ctl */
@@ -221,7 +224,10 @@ struct core_info {
 	int id[RTE_MAX_LCORE];  /* IDs of components run on the lcore. */
 };
 
-/* Manage core status and component info as global variable. */
+/**
+ * Manage core status and comp info as global variable,
+ * used for spp_vf and spp_mirror.
+ */
 struct core_mng_info {
 	volatile enum sppwk_lcore_status status;
 	volatile int ref_index;  /* index for reference */
@@ -256,6 +262,7 @@ typedef int (*spp_iterate_core_element_proc)(
  * iterate core table parameters used to list content of lcore table for.
  * showing status or so.
  */
+/* TODO(yasufum) refactor name of func and vars, and comments. */
 struct spp_iterate_core_params {
 	char *output;  /* Buffer used for output */
 	/** The function for creating core information */
@@ -544,7 +551,7 @@ int64_t sppwk_convert_mac_str_to_int64(const char *macaddr);
 /**
  * Set mange data address.
  *
- * @param startup_param_p Pointer to  g_startup_param address.
+ * @param startup_param_p Pointer to g_startup_param address.
  * @param iface_p Pointer to g_iface_info address.
  * @param component_p Pointer to g_component_info address.
  * @param core_mng_p Pointer to g_core_info address.
@@ -568,12 +575,12 @@ int sppwk_set_mng_data(struct startup_param *startup_param_p,
  * Get mange data address.
  *
  * @param startup_param_p Pointer to startup params.
- * @param iface_addr Pointer to g_iface_info.
- * @param component_addr Pointer to g_component_info.
- * @param core_mng_addr Pointer to g_core_mng_info.
- * @param change_core_addr Pointer to change_core_addr.
- * @param change_component_addr Pointer to g_change_component.
- * @param backup_info_addr Pointer to g_backup_info.
+ * @param iface_p Pointer to g_iface_info.
+ * @param component_p Pointer to g_component_info.
+ * @param core_mng_p Pointer to g_core_mng_info.
+ * @param change_core_p Pointer to change_core_addr.
+ * @param change_component_p Pointer to g_change_component.
+ * @param backup_info_p Pointer to g_backup_info.
  */
 void sppwk_get_mng_data(struct startup_param **startup_param_p,
 		struct iface_info **iface_p,
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index 0b79531..8de8460 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -16,7 +16,7 @@
 struct port_abl_info {
 	volatile int ref_index; /* Index to reference area. */
 	volatile int upd_index; /* Index to update area. */
-	struct spp_port_ability ability[TWO_SIDES][SPP_PORT_ABILITY_MAX];
+	struct spp_port_ability ability[TWO_SIDES][PORT_ABL_MAX];
 				/* Port ability information. */
 };
 
@@ -267,8 +267,8 @@ port_ability_set_ability(struct sppwk_port_info *port,
 
 	out_ability = mng->ability[mng->upd_index];
 	memset(out_ability, 0x00, sizeof(struct spp_port_ability)
-			* SPP_PORT_ABILITY_MAX);
-	for (in_cnt = 0; in_cnt < SPP_PORT_ABILITY_MAX; in_cnt++) {
+			* PORT_ABL_MAX);
+	for (in_cnt = 0; in_cnt < PORT_ABL_MAX; in_cnt++) {
 		if (in_ability[in_cnt].dir != dir)
 			continue;
 
@@ -338,7 +338,7 @@ port_ability_each_operation(uint16_t port_id,
 	if (unlikely(info[0].ops == SPPWK_PORT_ABL_OPS_NONE))
 		return nb_pkts;
 
-	for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+	for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
 		if (info[cnt].ops == SPPWK_PORT_ABL_OPS_NONE)
 			break;
 
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 4387fd5..c7873e3 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -58,6 +58,9 @@
 /* VID of VLAN untagged */
 #define VLAN_UNTAGGED_VID 0x0fff
 
+/** Value for default MAC address of classifier */
+#define CLS_DUMMY_ADDR 0x010000000000
+
 /* classifier management information */
 struct management_info {
 	/* classifier information */
@@ -396,8 +399,7 @@ init_component_info(struct cls_comp_info *cmp_info,
 		cmp_info->mac_addr_entry = 1;
 
 		/* store default classified */
-		if (unlikely(tx_port->cls_attrs.mac_addr ==
-				SPP_DEFAULT_CLASSIFIED_DMY_ADDR)) {
+		if (unlikely(tx_port->cls_attrs.mac_addr == CLS_DUMMY_ADDR)) {
 			mac_cls->default_cls_idx = i;
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 					"default classified. vid=%hu, "
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index 4a78ab2..4be3188 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -297,11 +297,11 @@ update_port(enum sppwk_action wk_action,
 		if (port_idx >= SPP_RET_OK) {
 			/* registered */
 			if (ability->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
-				while ((cnt < SPP_PORT_ABILITY_MAX) &&
+				while ((cnt < PORT_ABL_MAX) &&
 					    (port_info->ability[cnt].ops !=
 					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
 					cnt++;
-				if (cnt >= SPP_PORT_ABILITY_MAX) {
+				if (cnt >= PORT_ABL_MAX) {
 					RTE_LOG(ERR, VF_CMD_RUNNER, "update VLAN tag "
 						"Non-registratio\n");
 					return SPP_RET_NG;
@@ -322,12 +322,12 @@ update_port(enum sppwk_action wk_action,
 		}
 
 		if (ability->ops != SPPWK_PORT_ABL_OPS_NONE) {
-			while ((cnt < SPP_PORT_ABILITY_MAX) &&
+			while ((cnt < PORT_ABL_MAX) &&
 					(port_info->ability[cnt].ops !=
 					SPPWK_PORT_ABL_OPS_NONE)) {
 				cnt++;
 			}
-			if (cnt >= SPP_PORT_ABILITY_MAX) {
+			if (cnt >= PORT_ABL_MAX) {
 				RTE_LOG(ERR, VF_CMD_RUNNER,
 						"No space of port ability.\n");
 				return SPP_RET_NG;
@@ -344,7 +344,7 @@ update_port(enum sppwk_action wk_action,
 		break;
 
 	case SPPWK_ACT_DEL:
-		for (cnt = 0; cnt < SPP_PORT_ABILITY_MAX; cnt++) {
+		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
 			if (port_info->ability[cnt].ops ==
 					SPPWK_PORT_ABL_OPS_NONE)
 				continue;
-- 
2.17.1


                 reply	other threads:[~2019-06-24 10:40 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=20190624103952.24710-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).