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 06/11] shared/sec: revise members of struct cls_port_info
Date: Mon, 24 Jun 2019 11:24:59 +0900	[thread overview]
Message-ID: <20190624022504.18752-7-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624022504.18752-1-yasufum.o@gmail.com>

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

To refactor, revise members of struct `cls_port_info` in which struct
of information of port is name as "classified data" and it is not
describing the feature.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/shared/secondary/spp_worker_th/vf_deps.h | 10 +--
 src/vf/classifier_mac.c                      | 65 ++++++++++----------
 2 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/vf_deps.h b/src/shared/secondary/spp_worker_th/vf_deps.h
index 8364a13..79e2abb 100644
--- a/src/shared/secondary/spp_worker_th/vf_deps.h
+++ b/src/shared/secondary/spp_worker_th/vf_deps.h
@@ -20,7 +20,7 @@ struct mac_classifier {
 	int default_cls_idx;  /* Default index for classification. */
 };
 
-/* Set of attirbutes of port for classification.  */
+/* Attirbutes of port for classification. */
 /* TODO(yasufum) confirm what is `iface_no_global`. */
 struct cls_port_info {
 	enum port_type iface_type;
@@ -36,10 +36,10 @@ struct cls_comp_info {
 	char name[STR_LEN_NAME];  /* component name */
 	int mac_addr_entry;  /* mac address entry flag */
 	struct mac_classifier *mac_clfs[NOF_VLAN];  /* classifiers per VLAN. */
-	int n_classified_data_tx;  /* number of transmission ports */
-	struct cls_port_info classified_data_rx;  /* RX handled by cls */
-	/* transmission ports handled by classifier */
-	struct cls_port_info classified_data_tx[RTE_MAX_ETHPORTS];
+	int nof_tx_ports;  /* Number of TX ports info entries. */
+	/* Classifier has one RX port and several TX ports. */
+	struct cls_port_info rx_port_i;  /* RX port info classified. */
+	struct cls_port_info tx_ports_i[RTE_MAX_ETHPORTS];  /* TX info. */
 };
 
 /* free mac classification instance. */
diff --git a/src/vf/classifier_mac.c b/src/vf/classifier_mac.c
index 8edad6d..4213372 100644
--- a/src/vf/classifier_mac.c
+++ b/src/vf/classifier_mac.c
@@ -330,42 +330,43 @@ init_component_info(struct cls_comp_info *cmp_info,
 	struct mac_classifier *mac_cls;
 	struct ether_addr eth_addr;
 	char mac_addr_str[ETHER_ADDR_STR_BUF_SZ];
-	struct cls_port_info *clsd_data_rx = &cmp_info->classified_data_rx;
-	struct cls_port_info *clsd_data_tx = cmp_info->classified_data_tx;
+	/* Classifier has one RX port and several TX ports. */
+	struct cls_port_info *cls_rx_port_info = &cmp_info->rx_port_i;
+	struct cls_port_info *cls_tx_ports_info = cmp_info->tx_ports_i;
 	struct sppwk_port_info *tx_port = NULL;
 	uint16_t vid;
 
 	/* set rx */
 	if (wk_comp_info->nof_rx == 0) {
-		clsd_data_rx->iface_type = UNDEF;
-		clsd_data_rx->iface_no = 0;
-		clsd_data_rx->iface_no_global = 0;
-		clsd_data_rx->ethdev_port_id = 0;
-		clsd_data_rx->nof_pkts = 0;
+		cls_rx_port_info->iface_type = UNDEF;
+		cls_rx_port_info->iface_no = 0;
+		cls_rx_port_info->iface_no_global = 0;
+		cls_rx_port_info->ethdev_port_id = 0;
+		cls_rx_port_info->nof_pkts = 0;
 	} else {
-		clsd_data_rx->iface_type =
+		cls_rx_port_info->iface_type =
 			wk_comp_info->rx_ports[0]->iface_type;
-		clsd_data_rx->iface_no = 0;
-		clsd_data_rx->iface_no_global =
+		cls_rx_port_info->iface_no = 0;
+		cls_rx_port_info->iface_no_global =
 			wk_comp_info->rx_ports[0]->iface_no;
-		clsd_data_rx->ethdev_port_id =
+		cls_rx_port_info->ethdev_port_id =
 			wk_comp_info->rx_ports[0]->ethdev_port_id;
-		clsd_data_rx->nof_pkts = 0;
+		cls_rx_port_info->nof_pkts = 0;
 	}
 
 	/* set tx */
-	cmp_info->n_classified_data_tx = wk_comp_info->nof_tx;
+	cmp_info->nof_tx_ports = wk_comp_info->nof_tx;
 	cmp_info->mac_addr_entry = 0;
 	for (i = 0; i < wk_comp_info->nof_tx; i++) {
 		tx_port = wk_comp_info->tx_ports[i];
 		vid = tx_port->cls_attrs.vlantag.vid;
 
 		/* store ports information */
-		clsd_data_tx[i].iface_type = tx_port->iface_type;
-		clsd_data_tx[i].iface_no = i;
-		clsd_data_tx[i].iface_no_global = tx_port->iface_no;
-		clsd_data_tx[i].ethdev_port_id = tx_port->ethdev_port_id;
-		clsd_data_tx[i].nof_pkts = 0;
+		cls_tx_ports_info[i].iface_type = tx_port->iface_type;
+		cls_tx_ports_info[i].iface_no = i;
+		cls_tx_ports_info[i].iface_no_global = tx_port->iface_no;
+		cls_tx_ports_info[i].ethdev_port_id = tx_port->ethdev_port_id;
+		cls_tx_ports_info[i].nof_pkts = 0;
 
 		if (tx_port->cls_attrs.mac_addr == 0)
 			continue;
@@ -475,9 +476,9 @@ static inline void
 transmit_all_packet(struct cls_comp_info *cmp_info)
 {
 	int i;
-	struct cls_port_info *clsd_data_tx = cmp_info->classified_data_tx;
+	struct cls_port_info *clsd_data_tx = cmp_info->tx_ports_i;
 
-	for (i = 0; i < cmp_info->n_classified_data_tx; i++) {
+	for (i = 0; i < cmp_info->nof_tx_ports; i++) {
 		if (unlikely(clsd_data_tx[i].nof_pkts != 0)) {
 			RTE_LOG(INFO, SPP_CLASSIFIER_MAC,
 					"transmit all packets (drain). "
@@ -756,8 +757,8 @@ spp_classifier_mac_do(int id)
 	change_classifier_index(mng_info, id);
 
 	cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-	clsd_data_rx = &cmp_info->classified_data_rx;
-	clsd_data_tx = cmp_info->classified_data_tx;
+	clsd_data_rx = &cmp_info->rx_port_i;
+	clsd_data_tx = cmp_info->tx_ports_i;
 
 	/**
 	 * decide classifier information of the current cycle If at least,
@@ -765,14 +766,14 @@ spp_classifier_mac_do(int id)
 	 * classifying. If not, stop classifying.
 	 */
 	if (!(clsd_data_rx->iface_type != UNDEF &&
-			cmp_info->n_classified_data_tx >= 1 &&
-				cmp_info->mac_addr_entry == 1))
+			cmp_info->nof_tx_ports >= 1 &&
+			cmp_info->mac_addr_entry == 1))
 		return SPP_RET_OK;
 
 	/* drain tx packets, if buffer is not filled for interval */
 	cur_tsc = rte_rdtsc();
 	if (unlikely(cur_tsc - prev_tsc > drain_tsc)) {
-		for (i = 0; i < cmp_info->n_classified_data_tx; i++) {
+		for (i = 0; i < cmp_info->nof_tx_ports; i++) {
 			if (likely(clsd_data_tx[i].nof_pkts == 0))
 				continue;
 
@@ -825,19 +826,17 @@ spp_classifier_get_component_status(
 	}
 
 	cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-	clsd_data = cmp_info->classified_data_tx;
+	clsd_data = cmp_info->tx_ports_i;
 
 	memset(rx_ports, 0x00, sizeof(rx_ports));
-	if (cmp_info->classified_data_rx.iface_type != UNDEF) {
+	if (cmp_info->rx_port_i.iface_type != UNDEF) {
 		nof_rx = 1;
-		rx_ports[0].iface_type = cmp_info->
-				classified_data_rx.iface_type;
-		rx_ports[0].iface_no   = cmp_info->
-				classified_data_rx.iface_no_global;
+		rx_ports[0].iface_type = cmp_info->rx_port_i.iface_type;
+		rx_ports[0].iface_no = cmp_info->rx_port_i.iface_no_global;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
-	nof_tx = cmp_info->n_classified_data_tx;
+	nof_tx = cmp_info->nof_tx_ports;
 	for (i = 0; i < nof_tx; i++) {
 		tx_ports[i].iface_type = clsd_data[i].iface_type;
 		tx_ports[i].iface_no   = clsd_data[i].iface_no_global;
@@ -925,7 +924,7 @@ spp_classifier_mac_iterate_table(
 			continue;
 
 		cmp_info = mng_info->cmp_infos + mng_info->ref_index;
-		clsd_data = cmp_info->classified_data_tx;
+		clsd_data = cmp_info->tx_ports_i;
 
 		RTE_LOG(DEBUG, SPP_CLASSIFIER_MAC,
 			"Core[%u] Start iterate classifier table.\n", i);
-- 
2.17.1


  parent reply	other threads:[~2019-06-24  2:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  2:24 [spp] [PATCH 00/11] Refactor libs for classifier in spp_vf yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 01/11] shared/sec: refactor defines of VLAN " yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 02/11] shared/sec: rename struct mac_classification yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 03/11] shared/sec: refactor comments in vf_deps.h yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 04/11] shared/sec: rename struct classified_data yasufum.o
2019-06-24  2:24 ` [spp] [PATCH 05/11] shared/sec: revise usage of term component_info yasufum.o
2019-06-24  2:24 ` yasufum.o [this message]
2019-06-24  2:25 ` [spp] [PATCH 07/11] shared/sec: rename func free_mac_classification yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 08/11] shared/sec: refactor updating classifier info yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 09/11] shared/sec: refactor updating forwarder yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 10/11] shared/sec: refactor getting classifier status yasufum.o
2019-06-24  2:25 ` [spp] [PATCH 11/11] shared/sec: refactor setup cls table stat in JSON yasufum.o

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