Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH] shared/sec: revise port ability
@ 2019-06-26  5:37 yasufum.o
  0 siblings, 0 replies; only message in thread
From: yasufum.o @ 2019-06-26  5:37 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

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

This update is to revise term of enum or struct `port ability` to
`port capability`. It also includes members of them.

* Change sppwk_port_abl_ops to sppwk_port_ops
* Change spp_port_ability to sppwk_port_attrs
* Change spp_ability_data to sppwk_port_capability

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/mirror/mir_cmd_runner.c                   | 31 +++++------
 src/pcap/cmd_utils.h                          | 31 +++++------
 .../secondary/spp_worker_th/cmd_parser.c      | 24 ++++-----
 .../secondary/spp_worker_th/cmd_parser.h      |  2 +-
 .../spp_worker_th/cmd_res_formatter.c         | 15 +++---
 .../secondary/spp_worker_th/cmd_utils.h       | 16 +++---
 src/shared/secondary/spp_worker_th/spp_port.c | 54 +++++++++----------
 src/shared/secondary/spp_worker_th/spp_port.h |  2 +-
 src/vf/vf_cmd_runner.c                        | 29 +++++-----
 9 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/src/mirror/mir_cmd_runner.c b/src/mirror/mir_cmd_runner.c
index 17c2c27..307b3f6 100644
--- a/src/mirror/mir_cmd_runner.c
+++ b/src/mirror/mir_cmd_runner.c
@@ -132,7 +132,7 @@ update_port(enum sppwk_action wk_action,
 		const struct sppwk_port_idx *port,
 		enum sppwk_port_dir dir,
 		const char *name,
-		const struct spp_port_ability *ability)
+		const struct sppwk_port_attrs *port_attrs)
 {
 	int ret = SPP_RET_NG;
 	int port_idx;
@@ -176,9 +176,9 @@ update_port(enum sppwk_action wk_action,
 		if (port_idx >= SPP_RET_OK) {
 			/* registered */
 			/* TODO(yasufum) confirm it is needed for spp_mirror. */
-			if (ability->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
+			if (port_attrs->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
 				while ((cnt < PORT_ABL_MAX) &&
-					    (port_info->ability[cnt].ops !=
+					    (port_info->port_attrs[cnt].ops !=
 					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
 					cnt++;
 				if (cnt >= PORT_ABL_MAX) {
@@ -186,8 +186,8 @@ update_port(enum sppwk_action wk_action,
 						"Non-registratio\n");
 					return SPP_RET_NG;
 				}
-				memcpy(&port_info->ability[cnt], ability,
-					sizeof(struct spp_port_ability));
+				memcpy(&port_info->port_attrs[cnt], port_attrs,
+					sizeof(struct sppwk_port_attrs));
 
 				ret = SPP_RET_OK;
 				break;
@@ -201,19 +201,19 @@ update_port(enum sppwk_action wk_action,
 			return SPP_RET_NG;
 		}
 
-		if (ability->ops != SPPWK_PORT_ABL_OPS_NONE) {
+		if (port_attrs->ops != SPPWK_PORT_ABL_OPS_NONE) {
 			while ((cnt < PORT_ABL_MAX) &&
-					(port_info->ability[cnt].ops !=
+					(port_info->port_attrs[cnt].ops !=
 					SPPWK_PORT_ABL_OPS_NONE)) {
 				cnt++;
 			}
 			if (cnt >= PORT_ABL_MAX) {
 				RTE_LOG(ERR, MIR_CMD_RUNNER,
-						"No space of port ability.\n");
+						"No space of port port_attrs.\n");
 				return SPP_RET_NG;
 			}
-			memcpy(&port_info->ability[cnt], ability,
-					sizeof(struct spp_port_ability));
+			memcpy(&port_info->port_attrs[cnt], port_attrs,
+					sizeof(struct sppwk_port_attrs));
 		}
 
 		port_info->iface_type = port->iface_type;
@@ -225,13 +225,13 @@ update_port(enum sppwk_action wk_action,
 
 	case SPPWK_ACT_DEL:
 		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
-			if (port_info->ability[cnt].ops ==
+			if (port_info->port_attrs[cnt].ops ==
 					SPPWK_PORT_ABL_OPS_NONE)
 				continue;
 
-			if (port_info->ability[cnt].dir == dir)
-				memset(&port_info->ability[cnt], 0x00,
-					sizeof(struct spp_port_ability));
+			if (port_info->port_attrs[cnt].dir == dir)
+				memset(&port_info->port_attrs[cnt], 0x00,
+					sizeof(struct sppwk_port_attrs));
 		}
 
 		ret_del = delete_port_info(port_info, *nof_ports, ports);
@@ -276,7 +276,8 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd)
 				sppwk_action_str(cmd->spec.port.wk_action));
 		ret = update_port(cmd->spec.port.wk_action,
 				&cmd->spec.port.port, cmd->spec.port.dir,
-				cmd->spec.port.name, &cmd->spec.port.ability);
+				cmd->spec.port.name,
+				&cmd->spec.port.port_attrs);
 		if (ret == 0) {
 			RTE_LOG(INFO, MIR_CMD_RUNNER, "Exec flush.\n");
 			ret = flush_cmd();
diff --git a/src/pcap/cmd_utils.h b/src/pcap/cmd_utils.h
index 1b757f5..e3714a5 100644
--- a/src/pcap/cmd_utils.h
+++ b/src/pcap/cmd_utils.h
@@ -75,10 +75,10 @@ enum sppwk_worker_type {
  * Port ability operation which indicates vlan tag operation on the port
  * (e.g. add vlan tag or delete vlan tag)
  */
-enum spp_port_ability_ope {
-	SPP_PORT_ABILITY_OPE_NONE,        /**< none */
-	SPP_PORT_ABILITY_OPE_ADD_VLANTAG, /**< add VLAN tag */
-	SPP_PORT_ABILITY_OPE_DEL_VLANTAG, /**< delete VLAN tag */
+enum sppwk_port_ops {
+	SPPWK_PORT_ABL_OPS_NONE,
+	SPPWK_PORT_ABL_OPS_ADD_VLANTAG,
+	SPPWK_PORT_ABL_OPS_DEL_VLANTAG,
 };
 
 /* getopt_long return value for long option */
@@ -95,26 +95,23 @@ enum SPP_LONGOPT_RETVAL {
 };
 
 /** VLAN tag information */
-struct spp_vlantag_info {
+struct sppwk_vlan_tag {
 	int vid; /**< VLAN ID */
 	int pcp; /**< Priority Code Point */
 	int tci; /**< Tag Control Information */
 };
 
-/**
- * Data for each port ability which indicates vlantag related information
- * for the port
- */
-union spp_ability_data {
+/* Ability for vlantag for a port. */
+union sppwk_port_capability {
 	/** VLAN tag information */
-	struct spp_vlantag_info vlantag;
+	struct sppwk_vlan_tag vlantag;
 };
 
-/** Port ability information */
-struct spp_port_ability {
-	enum spp_port_ability_ope ope; /**< Operation */
+/* Port attributes of SPP worker processes. */
+struct sppwk_port_attrs {
+	enum sppwk_port_ops ops;  /**< Port capability Operations */
 	enum sppwk_port_dir dir;  /**< Direction of RX, TX or both */
-	union spp_ability_data data;   /**< Port ability data */
+	union sppwk_port_capability capability;   /**< Port capability */
 };
 
 /* TODO(yasufum) confirm why vlantag is required for spp_pcap. */
@@ -122,7 +119,7 @@ struct spp_port_ability {
 struct sppwk_cls_attrs {
 	uint64_t mac_addr;  /**< Mac address (binary) */
 	char mac_addr_str[STR_LEN_SHORT];  /**< Mac address (text) */
-	struct spp_vlantag_info vlantag;   /**< VLAN tag information */
+	struct sppwk_vlan_tag vlantag;   /**< VLAN tag information */
 };
 
 /* Interface information structure */
@@ -137,7 +134,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[PORT_ABL_MAX];
+	struct sppwk_port_attrs port_attrs[PORT_ABL_MAX];
 };
 
 /* TODO(yasufum) merge it to the same definition in shared/.../cmd_utils.h */
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c
index 931c53b..32903c3 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.c
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.c
@@ -540,19 +540,19 @@ parse_port_vlan_ops(void *output, const char *arg_val,
 {
 	int ret;
 	struct sppwk_cmd_port *port = output;
-	struct spp_port_ability *ability = &port->ability;
+	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
-	switch (ability->ops) {
+	switch (port_attrs->ops) {
 	case SPPWK_PORT_ABL_OPS_NONE:
 		ret = get_list_idx(arg_val, PORT_ABILITY_LIST);
 		if (unlikely(ret <= 0)) {
 			RTE_LOG(ERR, WK_CMD_PARSER,
-					"Unknown port ability. val=%s\n",
+					"Unknown port attribute. val=%s\n",
 					arg_val);
 			return SPP_RET_NG;
 		}
-		ability->ops = ret;
-		ability->dir = port->dir;
+		port_attrs->ops = ret;
+		port_attrs->dir = port->dir;
 		break;
 	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		/* Nothing to do. */
@@ -572,11 +572,11 @@ parse_port_vid(void *output, const char *arg_val,
 {
 	int vlan_id;
 	struct sppwk_cmd_port *port = output;
-	struct spp_port_ability *ability = &port->ability;
+	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
-	switch (ability->ops) {
+	switch (port_attrs->ops) {
 	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
-		vlan_id = get_int_in_range(&ability->data.vlantag.vid,
+		vlan_id = get_int_in_range(&port_attrs->capability.vlantag.vid,
 			arg_val, 0, ETH_VLAN_ID_MAX);
 		if (unlikely(vlan_id < SPP_RET_OK)) {
 			RTE_LOG(ERR, WK_CMD_PARSER,
@@ -584,7 +584,7 @@ parse_port_vid(void *output, const char *arg_val,
 					arg_val);
 			return SPP_RET_NG;
 		}
-		ability->data.vlantag.pcp = -1;
+		port_attrs->capability.vlantag.pcp = -1;
 		break;
 	default:
 		/* Not used. */
@@ -601,11 +601,11 @@ parse_port_pcp(void *output, const char *arg_val,
 {
 	int pcp;
 	struct sppwk_cmd_port *port = output;
-	struct spp_port_ability *ability = &port->ability;
+	struct sppwk_port_attrs *port_attrs = &port->port_attrs;
 
-	switch (ability->ops) {
+	switch (port_attrs->ops) {
 	case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
-		pcp = get_int_in_range(&ability->data.vlantag.pcp,
+		pcp = get_int_in_range(&port_attrs->capability.vlantag.pcp,
 				arg_val, 0, SPP_VLAN_PCP_MAX);
 		if (unlikely(pcp < SPP_RET_OK)) {
 			RTE_LOG(ERR, WK_CMD_PARSER,
diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h
index b124dc1..e51c3a4 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.h
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.h
@@ -105,7 +105,7 @@ struct sppwk_cmd_port {
 	struct sppwk_port_idx port;   /**< port type and number */
 	enum sppwk_port_dir dir;  /**< Direction of RX, TX or both. */
 	char name[SPPWK_NAME_BUFSZ];  /**<  component name */
-	struct spp_port_ability ability;  /**< port ability */
+	struct sppwk_port_attrs port_attrs;  /**< port attrs for spp_vf. */
 };
 
 /* TODO(yasufum) Add usage and desc for members. What's command descriptors? */
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 a424fce..820df8f 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
@@ -145,24 +145,23 @@ append_vlan_block(const char *name, char **output,
 {
 	int ret = SPP_RET_NG;
 	int i = 0;
-	struct spp_port_ability *info = NULL;
+	struct sppwk_port_attrs *port_attrs = NULL;
 	char *tmp_buff = spp_strbuf_allocate(CMD_RES_BUF_INIT_SIZE);
 	if (unlikely(tmp_buff == NULL)) {
 		RTE_LOG(ERR, WK_CMD_RES_FMT,
-				/* TODO(yasufum) refactor no meaning err msg */
-				"allocate error. (name = %s)\n",
+				"Failed to allocate buffer (name = %s).\n",
 				name);
 		return SPP_RET_NG;
 	}
 
-	spp_port_ability_get_info(port_id, dir, &info);
+	spp_port_ability_get_info(port_id, dir, &port_attrs);
 	for (i = 0; i < PORT_ABL_MAX; i++) {
-		switch (info[i].ops) {
+		switch (port_attrs[i].ops) {
 		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
 		case SPPWK_PORT_ABL_OPS_DEL_VLANTAG:
-			ret = append_vlan_value(&tmp_buff, info[i].ops,
-					info[i].data.vlantag.vid,
-					info[i].data.vlantag.pcp);
+			ret = append_vlan_value(&tmp_buff, port_attrs[i].ops,
+					port_attrs[i].capability.vlantag.vid,
+					port_attrs[i].capability.vlantag.pcp);
 			if (unlikely(ret < SPP_RET_OK))
 				return SPP_RET_NG;
 
diff --git a/src/shared/secondary/spp_worker_th/cmd_utils.h b/src/shared/secondary/spp_worker_th/cmd_utils.h
index a935312..ff363f5 100644
--- a/src/shared/secondary/spp_worker_th/cmd_utils.h
+++ b/src/shared/secondary/spp_worker_th/cmd_utils.h
@@ -84,6 +84,7 @@ enum sppwk_lcore_status {
 };
 
 /* Type of SPP worker thread. */
+/* TODO(yasufum) it should be separated into each process. */
 enum sppwk_worker_type {
 	SPPWK_TYPE_NONE,  /**< Not used */
 	SPPWK_TYPE_CLS,  /**< Classifier_mac */
@@ -111,7 +112,7 @@ enum sppwk_port_dir {
  * Port ability operation which indicates vlan tag operation on the port
  * (e.g. add vlan tag or delete vlan tag)
  */
-enum sppwk_port_abl_ops {
+enum sppwk_port_ops {
 	SPPWK_PORT_ABL_OPS_NONE,
 	SPPWK_PORT_ABL_OPS_ADD_VLANTAG,
 	SPPWK_PORT_ABL_OPS_DEL_VLANTAG,
@@ -127,6 +128,7 @@ enum SPP_LONGOPT_RETVAL {
 };
 
 /* Flag of processing type to copy management information */
+/* TODO(yasufum) add comments for each of members. */
 enum copy_mng_flg {
 	COPY_MNG_FLG_NONE,
 	COPY_MNG_FLG_UPDCOPY,
@@ -141,16 +143,16 @@ struct sppwk_vlan_tag {
 };
 
 /* Ability for vlantag for a port. */
-union spp_ability_data {
+union sppwk_port_capability {
 	/** VLAN tag information */
 	struct sppwk_vlan_tag vlantag;
 };
 
-/* Port ability information. */
-struct spp_port_ability {
-	enum sppwk_port_abl_ops ops;   /**< Port ability Operations */
+/* Port attributes of SPP worker processes. */
+struct sppwk_port_attrs {
+	enum sppwk_port_ops ops;  /**< Port capability Operations */
 	enum sppwk_port_dir dir;  /**< Direction of RX, TX or both */
-	union spp_ability_data data;   /**< Port ability data */
+	union sppwk_port_capability capability;   /**< Port capability */
 };
 
 /* Attributes for classifying. */
@@ -175,7 +177,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[PORT_ABL_MAX];
+	struct sppwk_port_attrs port_attrs[PORT_ABL_MAX];
 };
 
 /* Attributes of SPP worker thread named as `component`. */
diff --git a/src/shared/secondary/spp_worker_th/spp_port.c b/src/shared/secondary/spp_worker_th/spp_port.c
index 8de8460..cc87200 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.c
+++ b/src/shared/secondary/spp_worker_th/spp_port.c
@@ -16,8 +16,8 @@
 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][PORT_ABL_MAX];
-				/* Port ability information. */
+	struct sppwk_port_attrs port_attrs[TWO_SIDES][PORT_ABL_MAX];
+				/* Port attributes for spp_vf. */
 };
 
 /* Port ability port information */
@@ -53,7 +53,7 @@ spp_port_ability_init(void)
 void
 spp_port_ability_get_info(
 		int port_id, enum sppwk_port_dir dir,
-		struct spp_port_ability **info)
+		struct sppwk_port_attrs **info)
 {
 	struct port_abl_info *mng = NULL;
 
@@ -68,7 +68,7 @@ spp_port_ability_get_info(
 		/* Not used. */
 		break;
 	}
-	*info = mng->ability[mng->ref_index];
+	*info = mng->port_attrs[mng->ref_index];
 }
 
 /* Calculation and Setting of FCS. */
@@ -85,12 +85,12 @@ set_fcs_packet(struct rte_mbuf *pkt)
 static inline int
 add_vlantag_packet(
 		struct rte_mbuf *pkt,
-		const union spp_ability_data *data)
+		const union sppwk_port_capability *capability)
 {
 	struct ether_hdr *old_ether = NULL;
 	struct ether_hdr *new_ether = NULL;
 	struct vlan_hdr  *vlan      = NULL;
-	const struct sppwk_vlan_tag *vlantag = &data->vlantag;
+	const struct sppwk_vlan_tag *vlantag = &capability->vlantag;
 
 	old_ether = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
 	if (old_ether->ether_type == g_vlan_tpid) {
@@ -122,12 +122,12 @@ add_vlantag_packet(
 static inline int
 add_vlantag_all_packets(
 		struct rte_mbuf **pkts, int nb_pkts,
-		const union spp_ability_data *data)
+		const union sppwk_port_capability *capability)
 {
 	int ret = SPP_RET_OK;
 	int cnt = 0;
 	for (cnt = 0; cnt < nb_pkts; cnt++) {
-		ret = add_vlantag_packet(pkts[cnt], data);
+		ret = add_vlantag_packet(pkts[cnt], capability);
 		if (unlikely(ret < 0)) {
 			RTE_LOG(ERR, PORT,
 					"Failed to add VLAN tag."
@@ -142,7 +142,7 @@ add_vlantag_all_packets(
 static inline int
 del_vlantag_packet(
 		struct rte_mbuf *pkt,
-		const union spp_ability_data *data __attribute__ ((unused)))
+		const union sppwk_port_capability *cbl __attribute__ ((unused)))
 {
 	struct ether_hdr *old_ether = NULL;
 	struct ether_hdr *new_ether = NULL;
@@ -174,12 +174,12 @@ del_vlantag_packet(
 static inline int
 del_vlantag_all_packets(
 		struct rte_mbuf **pkts, int nb_pkts,
-		const union spp_ability_data *data)
+		const union sppwk_port_capability *capability)
 {
 	int ret = SPP_RET_OK;
 	int cnt = 0;
 	for (cnt = 0; cnt < nb_pkts; cnt++) {
-		ret = del_vlantag_packet(pkts[cnt], data);
+		ret = del_vlantag_packet(pkts[cnt], capability);
 		if (unlikely(ret < 0)) {
 			RTE_LOG(ERR, PORT,
 					"Failed to del VLAN tag."
@@ -246,8 +246,8 @@ port_ability_set_ability(struct sppwk_port_info *port,
 	int port_id = port->ethdev_port_id;
 	struct port_mng_info *port_mng = &g_port_mng_info[port_id];
 	struct port_abl_info *mng = NULL;
-	struct spp_port_ability *in_ability = port->ability;
-	struct spp_port_ability *out_ability = NULL;
+	struct sppwk_port_attrs *port_attrs_in = port->port_attrs;
+	struct sppwk_port_attrs *port_attrs_out = NULL;
 	struct sppwk_vlan_tag *tag = NULL;
 
 	port_mng->iface_type = port->iface_type;
@@ -265,19 +265,19 @@ port_ability_set_ability(struct sppwk_port_info *port,
 		break;
 	}
 
-	out_ability = mng->ability[mng->upd_index];
-	memset(out_ability, 0x00, sizeof(struct spp_port_ability)
+	port_attrs_out = mng->port_attrs[mng->upd_index];
+	memset(port_attrs_out, 0x00, sizeof(struct sppwk_port_attrs)
 			* PORT_ABL_MAX);
 	for (in_cnt = 0; in_cnt < PORT_ABL_MAX; in_cnt++) {
-		if (in_ability[in_cnt].dir != dir)
+		if (port_attrs_in[in_cnt].dir != dir)
 			continue;
 
-		memcpy(&out_ability[out_cnt], &in_ability[in_cnt],
-				sizeof(struct spp_port_ability));
+		memcpy(&port_attrs_out[out_cnt], &port_attrs_in[in_cnt],
+				sizeof(struct sppwk_port_attrs));
 
-		switch (out_ability[out_cnt].ops) {
+		switch (port_attrs_out[out_cnt].ops) {
 		case SPPWK_PORT_ABL_OPS_ADD_VLANTAG:
-			tag = &out_ability[out_cnt].data.vlantag;
+			tag = &port_attrs_out[out_cnt].capability.vlantag;
 			tag->tci = rte_cpu_to_be_16(SPP_VLANTAG_CALC_TCI(
 					tag->vid, tag->pcp));
 			break;
@@ -314,7 +314,7 @@ spp_port_ability_update(const struct sppwk_comp_info *component)
 /* Definition of functions that operate port abilities. */
 typedef int (*port_ability_func)(
 		struct rte_mbuf **pkts, int nb_pkts,
-		const union spp_ability_data *data);
+		const union sppwk_port_capability *capability);
 
 /* List of functions per port ability. */
 port_ability_func port_ability_function_list[] = {
@@ -332,18 +332,18 @@ port_ability_each_operation(uint16_t port_id,
 {
 	int cnt, buf;
 	int ok_pkts = nb_pkts;
-	struct spp_port_ability *info = NULL;
+	struct sppwk_port_attrs *port_attrs = NULL;
 
-	spp_port_ability_get_info(port_id, dir, &info);
-	if (unlikely(info[0].ops == SPPWK_PORT_ABL_OPS_NONE))
+	spp_port_ability_get_info(port_id, dir, &port_attrs);
+	if (unlikely(port_attrs[0].ops == SPPWK_PORT_ABL_OPS_NONE))
 		return nb_pkts;
 
 	for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
-		if (info[cnt].ops == SPPWK_PORT_ABL_OPS_NONE)
+		if (port_attrs[cnt].ops == SPPWK_PORT_ABL_OPS_NONE)
 			break;
 
-		ok_pkts = port_ability_function_list[info[cnt].ops](
-				pkts, ok_pkts, &info->data);
+		ok_pkts = port_ability_function_list[port_attrs[cnt].ops](
+				pkts, ok_pkts, &port_attrs->capability);
 	}
 
 	/* Discard remained packets to release mbuf. */
diff --git a/src/shared/secondary/spp_worker_th/spp_port.h b/src/shared/secondary/spp_worker_th/spp_port.h
index a6fb313..81aefa7 100644
--- a/src/shared/secondary/spp_worker_th/spp_port.h
+++ b/src/shared/secondary/spp_worker_th/spp_port.h
@@ -35,7 +35,7 @@ void spp_port_ability_init(void);
  */
 void spp_port_ability_get_info(
 		int port_id, enum sppwk_port_dir dir,
-		struct spp_port_ability **info);
+		struct sppwk_port_attrs **info);
 
 /**
  * Change index of management information.
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index 72e7b97..bab04ed 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -253,7 +253,7 @@ update_port(enum sppwk_action wk_action,
 		const struct sppwk_port_idx *port,
 		enum sppwk_port_dir dir,
 		const char *name,
-		const struct spp_port_ability *ability)
+		const struct sppwk_port_attrs *port_attrs)
 {
 	int ret = SPP_RET_NG;
 	int port_idx;
@@ -297,9 +297,9 @@ update_port(enum sppwk_action wk_action,
 		port_idx = get_idx_port_info(port_info, *nof_ports, ports);
 		if (port_idx >= SPP_RET_OK) {
 			/* registered */
-			if (ability->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
+			if (port_attrs->ops == SPPWK_PORT_ABL_OPS_ADD_VLANTAG) {
 				while ((cnt < PORT_ABL_MAX) &&
-					    (port_info->ability[cnt].ops !=
+					    (port_info->port_attrs[cnt].ops !=
 					    SPPWK_PORT_ABL_OPS_ADD_VLANTAG))
 					cnt++;
 				if (cnt >= PORT_ABL_MAX) {
@@ -307,8 +307,8 @@ update_port(enum sppwk_action wk_action,
 						"Non-registratio\n");
 					return SPP_RET_NG;
 				}
-				memcpy(&port_info->ability[cnt], ability,
-					sizeof(struct spp_port_ability));
+				memcpy(&port_info->port_attrs[cnt], port_attrs,
+					sizeof(struct sppwk_port_attrs));
 
 				ret = SPP_RET_OK;
 				break;
@@ -322,9 +322,9 @@ update_port(enum sppwk_action wk_action,
 			return SPP_RET_NG;
 		}
 
-		if (ability->ops != SPPWK_PORT_ABL_OPS_NONE) {
+		if (port_attrs->ops != SPPWK_PORT_ABL_OPS_NONE) {
 			while ((cnt < PORT_ABL_MAX) &&
-					(port_info->ability[cnt].ops !=
+					(port_info->port_attrs[cnt].ops !=
 					SPPWK_PORT_ABL_OPS_NONE)) {
 				cnt++;
 			}
@@ -333,8 +333,8 @@ update_port(enum sppwk_action wk_action,
 						"No space of port ability.\n");
 				return SPP_RET_NG;
 			}
-			memcpy(&port_info->ability[cnt], ability,
-					sizeof(struct spp_port_ability));
+			memcpy(&port_info->port_attrs[cnt], port_attrs,
+					sizeof(struct sppwk_port_attrs));
 		}
 
 		port_info->iface_type = port->iface_type;
@@ -346,13 +346,13 @@ update_port(enum sppwk_action wk_action,
 
 	case SPPWK_ACT_DEL:
 		for (cnt = 0; cnt < PORT_ABL_MAX; cnt++) {
-			if (port_info->ability[cnt].ops ==
+			if (port_info->port_attrs[cnt].ops ==
 					SPPWK_PORT_ABL_OPS_NONE)
 				continue;
 
-			if (port_info->ability[cnt].dir == dir)
-				memset(&port_info->ability[cnt], 0x00,
-					sizeof(struct spp_port_ability));
+			if (port_info->port_attrs[cnt].dir == dir)
+				memset(&port_info->port_attrs[cnt], 0x00,
+					sizeof(struct sppwk_port_attrs));
 		}
 
 		ret_del = delete_port_info(port_info, *nof_ports, ports);
@@ -410,7 +410,8 @@ exec_one_cmd(const struct sppwk_cmd_attrs *cmd)
 				sppwk_action_str(cmd->spec.port.wk_action));
 		ret = update_port(cmd->spec.port.wk_action,
 				&cmd->spec.port.port, cmd->spec.port.dir,
-				cmd->spec.port.name, &cmd->spec.port.ability);
+				cmd->spec.port.name,
+				&cmd->spec.port.port_attrs);
 		if (ret == 0) {
 			RTE_LOG(INFO, VF_CMD_RUNNER, "Exec flush.\n");
 			ret = flush_cmd();
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26  5:37 [spp] [PATCH] shared/sec: revise port ability yasufum.o

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox