From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B6E6A0556 for ; Wed, 19 Feb 2020 12:49:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 10F381BF9B; Wed, 19 Feb 2020 12:49:54 +0100 (CET) Received: from dish-sg.nttdocomo.co.jp (dish-sg.nttdocomo.co.jp [202.19.227.74]) by dpdk.org (Postfix) with ESMTP id D0E361BF87 for ; Wed, 19 Feb 2020 12:49:51 +0100 (CET) X-dD-Source: Outbound Received: from zssg-mailmd105.ddreams.local (zssg-mailmd900.ddreams.local [10.160.172.63]) by zssg-mailou102.ddreams.local (Postfix) with ESMTP id 0EFCC1200DF; Wed, 19 Feb 2020 20:49:51 +0900 (JST) Received: from zssg-mailmf101.ddreams.local (zssg-mailmf900.ddreams.local [10.160.172.84]) by zssg-mailmd105.ddreams.local (dDREAMS) with ESMTP id <0Q5Y01DTH672TH50@dDREAMS>; Wed, 19 Feb 2020 20:49:50 +0900 (JST) Received: from zssg-mailmf101.ddreams.local (unknown [127.0.0.1]) by zssg-mailmf101.ddreams.local (Postfix) with ESMTP id E52867E6034; Wed, 19 Feb 2020 20:49:50 +0900 (JST) Received: from zssg-mailmf101.ddreams.local (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3FFC8E6054; Wed, 19 Feb 2020 20:49:50 +0900 (JST) Received: from localhost (unknown [127.0.0.1]) by IMSVA (Postfix) with SMTP id D92718E6058; Wed, 19 Feb 2020 20:49:50 +0900 (JST) X-IMSS-HAND-OFF-DIRECTIVE: localhost:10026 Received: from zssg-mailmf101.ddreams.local (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5CA688E6056; Wed, 19 Feb 2020 20:49:50 +0900 (JST) Received: from davinci.ntt-tx.co.jp (unknown [10.160.183.139]) by zssg-mailmf101.ddreams.local (Postfix) with ESMTP; Wed, 19 Feb 2020 20:49:50 +0900 (JST) From: x-fn-spp-ml@ntt-tx.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Wed, 19 Feb 2020 20:49:32 +0900 Message-id: <20200219114947.14134-3-x-fn-spp-ml@ntt-tx.co.jp> X-Mailer: git-send-email 2.18.0 In-reply-to: <20200218063720.6597-1-x-fn-spp-ml@ntt-tx.co.jp> References: <20200218063720.6597-1-x-fn-spp-ml@ntt-tx.co.jp> X-TM-AS-GCONF: 00 Subject: [spp] [PATCH v2 02/17] spp_vf: add support of multi-queue X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Hideyuki Yamashita 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 Signed-off-by: Yasufumi Ogawa --- 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