Soft Patch Panel
 help / color / mirror / Atom feed
From: x-fn-spp-ml@ntt-tx.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH v2 02/17] spp_vf: add support of multi-queue
Date: Wed, 19 Feb 2020 20:49:32 +0900	[thread overview]
Message-ID: <20200219114947.14134-3-x-fn-spp-ml@ntt-tx.co.jp> (raw)
In-Reply-To: <20200218063720.6597-1-x-fn-spp-ml@ntt-tx.co.jp>

From: Hideyuki Yamashita <yamashita.hideyuki@ntt-tx.co.jp>

To achieve hardware offload in secondary process, multi-queue should be
supported.
Multi-queue support is divided into several changes like following:
- add queue number parameter in port command
- parse newly added parameter
- add queue number parameter in status response

For spp_vf, code for forwarder, classifier and merger should be changed.

Signed-off-by: Hideyuki Yamashita <yamashita.hideyuki@ntt-tx.co.jp>
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/vf/classifier.c    | 40 +++++++++++++++++++++++++++-------------
 src/vf/forwarder.c     | 12 +++++++-----
 src/vf/vf_cmd_runner.c | 32 ++++++++++++++++++++------------
 3 files changed, 54 insertions(+), 30 deletions(-)

diff --git a/src/vf/classifier.c b/src/vf/classifier.c
index 8a4c8fc..2d95289 100644
--- a/src/vf/classifier.c
+++ b/src/vf/classifier.c
@@ -199,7 +199,8 @@ log_classification(long clsd_idx, struct rte_mbuf *pkt,
 	else
 		sppwk_port_uid(iface_str,
 				clsd_data[clsd_idx].iface_type,
-				clsd_data[clsd_idx].iface_no_global);
+				clsd_data[clsd_idx].iface_no_global,
+				clsd_data[clsd_idx].queue_no);
 
 	RTE_LOG_DP(DEBUG, VF_CLS,
 			"[%s]Classification(%s:%d). d_addr=%s, "
@@ -227,7 +228,8 @@ log_entry(long clsd_idx, uint16_t vid, const char *mac_addr_str,
 	else
 		sppwk_port_uid(iface_str,
 				clsd_data[clsd_idx].iface_type,
-				clsd_data[clsd_idx].iface_no_global);
+				clsd_data[clsd_idx].iface_no_global,
+				clsd_data[clsd_idx].queue_no);
 
 	RTE_LOG_DP(DEBUG, VF_CLS,
 			"[%s]Entry(%s:%d). vid=%hu, mac_addr=%s, iface=%s\n",
@@ -320,6 +322,7 @@ init_component_info(struct cls_comp_info *cmp_info,
 	if (wk_comp_info->nof_rx == 0) {
 		cls_rx_port_info->iface_type = UNDEF;
 		cls_rx_port_info->iface_no = 0;
+		cls_rx_port_info->queue_no = DEFAULT_QUEUE_ID;
 		cls_rx_port_info->iface_no_global = 0;
 		cls_rx_port_info->ethdev_port_id = 0;
 		cls_rx_port_info->nof_pkts = 0;
@@ -327,6 +330,8 @@ init_component_info(struct cls_comp_info *cmp_info,
 		cls_rx_port_info->iface_type =
 			wk_comp_info->rx_ports[0]->iface_type;
 		cls_rx_port_info->iface_no = 0;
+		cls_rx_port_info->queue_no =
+			wk_comp_info->rx_ports[0]->queue_no;
 		cls_rx_port_info->iface_no_global =
 			wk_comp_info->rx_ports[0]->iface_no;
 		cls_rx_port_info->ethdev_port_id =
@@ -344,6 +349,7 @@ init_component_info(struct cls_comp_info *cmp_info,
 		/* store ports information */
 		cls_tx_ports_info[i].iface_type = tx_port->iface_type;
 		cls_tx_ports_info[i].iface_no = i;
+		cls_tx_ports_info[i].queue_no = tx_port->queue_no;
 		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;
@@ -374,10 +380,10 @@ init_component_info(struct cls_comp_info *cmp_info,
 			mac_cls->default_cls_idx = i;
 			RTE_LOG(INFO, VF_CLS,
 					"default classified. vid=%hu, "
-					"iface_type=%d, iface_no=%d, "
+					"iface_type=%d, iface_no=%d, queue_no=%d, "
 					"ethdev_port_id=%d\n",
 					vid, tx_port->iface_type,
-					tx_port->iface_no,
+					tx_port->iface_no, tx_port->queue_no,
 					tx_port->ethdev_port_id);
 			continue;
 		}
@@ -401,9 +407,10 @@ init_component_info(struct cls_comp_info *cmp_info,
 		RTE_LOG(INFO, VF_CLS,
 				"Add entry to classifier table. "
 				"vid=%hu, mac_addr=%s, iface_type=%d, "
-				"iface_no=%d, ethdev_port_id=%d\n",
+				"iface_no=%d, queue_no=%d, ethdev_port_id=%d\n",
 				vid, mac_addr_str, tx_port->iface_type,
-				tx_port->iface_no, tx_port->ethdev_port_id);
+				tx_port->iface_no, tx_port->queue_no,
+				tx_port->ethdev_port_id);
 	}
 
 	return SPPWK_RET_OK;
@@ -422,8 +429,9 @@ transmit_packets(struct cls_port_info *clsd_data)
 			clsd_data->iface_type, clsd_data->iface_no,
 			0, clsd_data->pkts, clsd_data->nof_pkts);
 #else
-	n_tx = sppwk_eth_vlan_tx_burst(clsd_data->ethdev_port_id, 0,
-			clsd_data->pkts, clsd_data->nof_pkts);
+	n_tx = sppwk_eth_vlan_tx_burst(clsd_data->ethdev_port_id,
+			clsd_data->queue_no, clsd_data->pkts,
+			clsd_data->nof_pkts);
 #endif
 
 	/* free cannot transmit packets */
@@ -467,11 +475,12 @@ push_packet(struct rte_mbuf *pkt, struct cls_port_info *clsd_data)
 	if (unlikely(clsd_data->nof_pkts == MAX_PKT_BURST)) {
 		RTE_LOG(DEBUG, VF_CLS,
 				"transmit packets (buffer is filled). "
-				"iface_type=%d, iface_no={%d,%d}, "
+				"iface_type=%d, iface_no={%d,%d}, queue_no=%d, "
 				"tx_port=%hu, nof_pkts=%hu\n",
 				clsd_data->iface_type,
 				clsd_data->iface_no_global,
 				clsd_data->iface_no,
+				clsd_data->queue_no,
 				clsd_data->ethdev_port_id,
 				clsd_data->nof_pkts);
 		transmit_packets(clsd_data);
@@ -754,8 +763,8 @@ classify_packets(int comp_id)
 			clsd_data_rx->iface_type, clsd_data_rx->iface_no,
 			0, rx_pkts, MAX_PKT_BURST);
 #else
-	n_rx = sppwk_eth_vlan_rx_burst(clsd_data_rx->ethdev_port_id, 0,
-			rx_pkts, MAX_PKT_BURST);
+	n_rx = sppwk_eth_vlan_rx_burst(clsd_data_rx->ethdev_port_id,
+			clsd_data_rx->queue_no, rx_pkts, MAX_PKT_BURST);
 #endif
 	if (unlikely(n_rx == 0))
 		return SPPWK_RET_OK;
@@ -776,8 +785,8 @@ get_classifier_status(unsigned int lcore_id, int id,
 	struct cls_mng_info *mng_info;
 	struct cls_comp_info *cmp_info;
 	struct cls_port_info *port_info;
-	struct sppwk_port_idx rx_ports[RTE_MAX_ETHPORTS];
-	struct sppwk_port_idx tx_ports[RTE_MAX_ETHPORTS];
+	struct sppwk_port_idx rx_ports[RTE_MAX_QUEUES_PER_PORT];
+	struct sppwk_port_idx tx_ports[RTE_MAX_QUEUES_PER_PORT];
 
 	mng_info = cls_mng_info_list + id;
 	if (!is_used_mng_info(mng_info)) {
@@ -796,6 +805,7 @@ get_classifier_status(unsigned int lcore_id, int id,
 		nof_rx = 1;
 		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;
+		rx_ports[0].queue_no = cmp_info->rx_port_i.queue_no;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
@@ -803,6 +813,7 @@ get_classifier_status(unsigned int lcore_id, int id,
 	for (i = 0; i < nof_tx; i++) {
 		tx_ports[i].iface_type = port_info[i].iface_type;
 		tx_ports[i].iface_no = port_info[i].iface_no_global;
+		tx_ports[i].queue_no = port_info[i].queue_no;
 	}
 
 	/* Set the information with the function specified by the command. */
@@ -840,6 +851,8 @@ add_mac_entry(struct classifier_table_params *params,
 				mac_cls->default_cls_idx)->iface_type;
 		port.iface_no = (port_info +
 				mac_cls->default_cls_idx)->iface_no_global;
+		port.queue_no = (port_info +
+				mac_cls->default_cls_idx)->queue_no;
 
 		LOG_ENT((long)mac_cls->default_cls_idx, vid,
 				SPPWK_TERM_DEFAULT, cmp_info, port_info);
@@ -863,6 +876,7 @@ add_mac_entry(struct classifier_table_params *params,
 
 		port.iface_type = (port_info + (long)data)->iface_type;
 		port.iface_no = (port_info + (long)data)->iface_no_global;
+		port.queue_no = (port_info + (long)data)->queue_no;
 
 		LOG_ENT((long)data, vid, mac_addr_str, cmp_info, port_info);
 
diff --git a/src/vf/forwarder.c b/src/vf/forwarder.c
index 04bf5c3..66e1682 100644
--- a/src/vf/forwarder.c
+++ b/src/vf/forwarder.c
@@ -62,8 +62,8 @@ get_forwarder_status(unsigned int lcore_id, int id,
 	const char *component_type = NULL;
 	struct forward_info *fwd_info = &g_forward_info[id];
 	struct forward_path *fwd_path = &fwd_info->path[fwd_info->ref_index];
-	struct sppwk_port_idx rx_ports[RTE_MAX_ETHPORTS];
-	struct sppwk_port_idx tx_ports[RTE_MAX_ETHPORTS];
+	struct sppwk_port_idx rx_ports[RTE_MAX_QUEUES_PER_PORT];
+	struct sppwk_port_idx tx_ports[RTE_MAX_QUEUES_PER_PORT];
 
 	if (unlikely(fwd_path->wk_type == SPPWK_TYPE_NONE)) {
 		RTE_LOG(ERR, FORWARD,
@@ -82,12 +82,14 @@ get_forwarder_status(unsigned int lcore_id, int id,
 	for (cnt = 0; cnt < fwd_path->nof_rx; cnt++) {
 		rx_ports[cnt].iface_type = fwd_path->ports[cnt].rx.iface_type;
 		rx_ports[cnt].iface_no = fwd_path->ports[cnt].rx.iface_no;
+		rx_ports[cnt].queue_no = fwd_path->ports[cnt].rx.queue_no;
 	}
 
 	memset(tx_ports, 0x00, sizeof(tx_ports));
 	for (cnt = 0; cnt < fwd_path->nof_tx; cnt++) {
 		tx_ports[cnt].iface_type = fwd_path->ports[cnt].tx.iface_type;
 		tx_ports[cnt].iface_no = fwd_path->ports[cnt].tx.iface_no;
+		tx_ports[cnt].queue_no = fwd_path->ports[cnt].tx.queue_no;
 	}
 
 	/* Set the information with the function specified by the command. */
@@ -217,8 +219,8 @@ forward_packets(int id)
 				rx->iface_type, rx->iface_no, 0,
 				bufs, MAX_PKT_BURST);
 #else
-		nb_rx = sppwk_eth_vlan_rx_burst(rx->ethdev_port_id, 0,
-				bufs, MAX_PKT_BURST);
+		nb_rx = sppwk_eth_vlan_rx_burst(rx->ethdev_port_id,
+				rx->queue_no, bufs, MAX_PKT_BURST);
 #endif
 		if (unlikely(nb_rx == 0))
 			continue;
@@ -231,7 +233,7 @@ forward_packets(int id)
 					tx->iface_no, 0, bufs, nb_rx);
 #else
 			nb_tx = sppwk_eth_vlan_tx_burst(tx->ethdev_port_id,
-					0, bufs, nb_rx);
+					tx->queue_no, bufs, nb_rx);
 #endif
 
 		/* Discard remained packets to release mbuf */
diff --git a/src/vf/vf_cmd_runner.c b/src/vf/vf_cmd_runner.c
index 305c4a2..c5e8278 100644
--- a/src/vf/vf_cmd_runner.c
+++ b/src/vf/vf_cmd_runner.c
@@ -43,8 +43,9 @@ update_cls_table(enum sppwk_action wk_action,
 	struct sppwk_port_info *port_info;
 
 	RTE_LOG(DEBUG, VF_CMD_RUNNER, "Called __func__ with "
-			"type `mac`, mac_addr `%s`, and port `%d:%d`.\n",
-			mac_str, port->iface_type, port->iface_no);
+			"type `mac`, mac_addr `%s`, and port `%d:%d nq %d`.\n",
+			mac_str, port->iface_type, port->iface_no,
+			port->queue_no);
 
 	mac_int64 = sppwk_convert_mac_str_to_int64(mac_str);
 	if (unlikely(mac_int64 == -1)) {
@@ -54,15 +55,18 @@ update_cls_table(enum sppwk_action wk_action,
 	}
 	mac_uint64 = (uint64_t)mac_int64;
 
-	port_info = get_sppwk_port(port->iface_type, port->iface_no);
+	port_info = get_sppwk_port(port->iface_type, port->iface_no,
+			port->queue_no);
 	if (unlikely(port_info == NULL)) {
-		RTE_LOG(ERR, VF_CMD_RUNNER, "Failed to get port %d:%d.\n",
-				port->iface_type, port->iface_no);
+		RTE_LOG(ERR, VF_CMD_RUNNER, "Failed to get port %d:%d nq %d.\n",
+				port->iface_type, port->iface_no,
+				port->queue_no);
 		return SPPWK_RET_NG;
 	}
 	if (unlikely(port_info->iface_type == UNDEF)) {
-		RTE_LOG(ERR, VF_CMD_RUNNER, "Port %d:%d doesn't exist.\n",
-				port->iface_type, port->iface_no);
+		RTE_LOG(ERR, VF_CMD_RUNNER, "Port %d:%d nq %d doesn't exist.\n",
+				port->iface_type, port->iface_no,
+				port->queue_no);
 		return SPPWK_RET_NG;
 	}
 
@@ -88,15 +92,17 @@ update_cls_table(enum sppwk_action wk_action,
 		if (unlikely(port_info->cls_attrs.vlantag.vid !=
 				ETH_VLAN_ID_MAX)) {
 			/* TODO(yasufum) why two vids are required in msg ? */
-			RTE_LOG(ERR, VF_CMD_RUNNER, "Used port %d:%d, vid %d != %d.\n",
+			RTE_LOG(ERR, VF_CMD_RUNNER, "Used port %d:%d nq %d, vid %d != %d.\n",
 					port->iface_type, port->iface_no,
+					port->queue_no,
 					port_info->cls_attrs.vlantag.vid, vid);
 			return SPPWK_RET_NG;
 		}
 		if (unlikely(port_info->cls_attrs.mac_addr != 0)) {
 			/* TODO(yasufum) why two macs are required in msg ? */
-			RTE_LOG(ERR, VF_CMD_RUNNER, "Used port %d:%d, mac %s != %s.\n",
+			RTE_LOG(ERR, VF_CMD_RUNNER, "Used port %d:%d nq %d, mac %s != %s.\n",
 					port->iface_type, port->iface_no,
+					port->queue_no,
 					port_info->cls_attrs.mac_addr_str,
 					mac_str);
 			return SPPWK_RET_NG;
@@ -277,7 +283,8 @@ update_port(enum sppwk_action wk_action,
 	sppwk_get_mng_data(NULL, &comp_info_base, NULL, NULL,
 			&change_component, NULL);
 	comp_info = (comp_info_base + comp_lcore_id);
-	port_info = get_sppwk_port(port->iface_type, port->iface_no);
+	port_info = get_sppwk_port(port->iface_type, port->iface_no,
+			port->queue_no);
 	if (dir == SPPWK_PORT_DIR_RX) {
 		nof_ports = &comp_info->nof_rx;
 		ports = comp_info->rx_ports;
@@ -317,7 +324,7 @@ update_port(enum sppwk_action wk_action,
 			return SPPWK_RET_OK;
 		}
 
-		if (*nof_ports >= RTE_MAX_ETHPORTS) {
+		if (*nof_ports >= RTE_MAX_QUEUES_PER_PORT) {
 			RTE_LOG(ERR, VF_CMD_RUNNER, "Cannot assign port over the "
 				"maximum number.\n");
 			return SPPWK_RET_NG;
@@ -565,7 +572,8 @@ append_classifier_element_value(
 		return ret;
 	}
 
-	sppwk_port_uid(port_str, port->iface_type, port->iface_no);
+	sppwk_port_uid(port_str, port->iface_type, port->iface_no,
+			port->queue_no);
 
 	ret = append_json_str_value(&tmp_buff, "type",
 			CLS_TYPE_A_LIST[cls_type]);
-- 
2.17.1


  parent reply	other threads:[~2020-02-19 11:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  6:37 [spp] [PATCH 00/17] Adding Hardware offload capability x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 01/17] shared: add support of multi-queue x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 02/17] spp_vf: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 03/17] spp_mirror: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 04/17] spp_pcap: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 05/17] spp_primary: " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 06/17] spp_primary: add support of rte_flow x-fn-spp-ml
2020-02-19  2:24   ` Yasufumi Ogawa
2020-02-19 11:57     ` [spp] (x-fn-spp-ml 118) " Hideyuki Yamashita
2020-02-18  6:37 ` [spp] [PATCH 07/17] spp_primary: add common function " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 08/17] spp_primary: add attribute " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 09/17] spp_primary: add patterns " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 10/17] spp_primary: add actions " x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 11/17] bin: add parameter for hardrare offload x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 12/17] cli: add support of hardware offload x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 13/17] cli: add support of rte_flow in vf x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 14/17] cli: add support of rte_flow in mirror x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 15/17] cli: add support of rte_flow in nfv x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 16/17] spp-ctl: add APIs for flow rules x-fn-spp-ml
2020-02-18  6:37 ` [spp] [PATCH 17/17] spp_nfv: add support of multi-queue x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 00/17] Adding Hardware offload capability x-fn-spp-ml
2020-02-21  8:17   ` Yasufumi Ogawa
2020-02-25  5:49     ` [spp] (x-fn-spp-ml 177) " Hideyuki Yamashita
2020-02-19 11:49 ` [spp] [PATCH v2 01/17] shared: add support of multi-queue x-fn-spp-ml
2020-02-19 11:49 ` x-fn-spp-ml [this message]
2020-02-19 11:49 ` [spp] [PATCH v2 03/17] spp_mirror: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 04/17] spp_pcap: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 05/17] spp_primary: " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 06/17] spp_primary: add support of rte_flow x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 07/17] spp_primary: add common function " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 08/17] spp_primary: add attribute " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 09/17] spp_primary: add patterns " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 10/17] spp_primary: add actions " x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 11/17] bin: add parameter for hardrare offload x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 12/17] cli: add support of hardware offload x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 13/17] cli: add support of rte_flow in vf x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 14/17] cli: add support of rte_flow in mirror x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 15/17] cli: add support of rte_flow in nfv x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 16/17] spp-ctl: add APIs for flow rules x-fn-spp-ml
2020-02-19 11:49 ` [spp] [PATCH v2 17/17] spp_nfv: add support of multi-queue x-fn-spp-ml

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=20200219114947.14134-3-x-fn-spp-ml@ntt-tx.co.jp \
    --to=x-fn-spp-ml@ntt-tx.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    --cc=yasufum.o@gmail.com \
    /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).