* [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
@ 2020-06-22 15:51 Jasvinder Singh
2020-06-23 7:38 ` Phil Yang
2020-06-23 9:32 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
0 siblings, 2 replies; 7+ messages in thread
From: Jasvinder Singh @ 2020-06-22 15:51 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu
Softnic can be used like other virtual devices without
needing any special mode. Therefore, softnic forward mode
is removed from testpmd app. Documentation is updated as
well.
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
app/test-pmd/Makefile | 4 -
app/test-pmd/cmdline.c | 82 ---
app/test-pmd/config.c | 56 --
app/test-pmd/meson.build | 4 -
app/test-pmd/softnicfwd.c | 686 --------------------
app/test-pmd/testpmd.c | 16 -
app/test-pmd/testpmd.h | 22 -
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 -
8 files changed, 880 deletions(-)
delete mode 100644 app/test-pmd/softnicfwd.c
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index ea818de22..4eab42f18 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -37,10 +37,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
SRCS-$(CONFIG_RTE_LIBRTE_BPF) += bpf_cmd.c
SRCS-y += util.c
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC), y)
-SRCS-y += softnicfwd.c
-endif
-
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1375f223e..713a1bcf5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1182,11 +1182,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"show port tm node stats (port_id) (node_id) (clear)\n"
" Display the port TM node stats.\n\n"
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
- "set port tm hierarchy default (port_id)\n"
- " Set default traffic Management hierarchy on a port\n\n"
-#endif
-
"add port tm node shaper profile (port_id) (shaper_profile_id)"
" (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
" (packet_length_adjust)\n"
@@ -15343,80 +15338,6 @@ cmdline_parse_inst_t cmd_vf_tc_max_bw = {
},
};
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
-
-/* *** Set Port default Traffic Management Hierarchy *** */
-struct cmd_set_port_tm_hierarchy_default_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t tm;
- cmdline_fixed_string_t hierarchy;
- cmdline_fixed_string_t def;
- portid_t port_id;
-};
-
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_set =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, set, "set");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_port =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, port, "port");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_tm =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, tm, "tm");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_hierarchy =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- hierarchy, "hierarchy");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_default =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- def, "default");
-cmdline_parse_token_num_t cmd_set_port_tm_hierarchy_default_port_id =
- TOKEN_NUM_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- port_id, UINT16);
-
-static void cmd_set_port_tm_hierarchy_default_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_port_tm_hierarchy_default_result *res = parsed_result;
- struct rte_port *p;
- portid_t port_id = res->port_id;
-
- if (port_id_is_invalid(port_id, ENABLED_WARN))
- return;
-
- p = &ports[port_id];
-
- /* Forward mode: tm */
- if (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, "softnic")) {
- printf(" softnicfwd mode not enabled(error)\n");
- return;
- }
-
- /* Set the default tm hierarchy */
- p->softport.default_tm_hierarchy_enable = 1;
-}
-
-cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default = {
- .f = cmd_set_port_tm_hierarchy_default_parsed,
- .data = NULL,
- .help_str = "set port tm hierarchy default <port_id>",
- .tokens = {
- (void *)&cmd_set_port_tm_hierarchy_default_set,
- (void *)&cmd_set_port_tm_hierarchy_default_port,
- (void *)&cmd_set_port_tm_hierarchy_default_tm,
- (void *)&cmd_set_port_tm_hierarchy_default_hierarchy,
- (void *)&cmd_set_port_tm_hierarchy_default_default,
- (void *)&cmd_set_port_tm_hierarchy_default_port_id,
- NULL,
- },
-};
-#endif
-
/** Set VXLAN encapsulation details */
struct cmd_set_vxlan_result {
cmdline_fixed_string_t set;
@@ -19599,9 +19520,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_tc_max_bw,
(cmdline_parse_inst_t *)&cmd_strict_link_prio,
(cmdline_parse_inst_t *)&cmd_tc_min_bw,
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
- (cmdline_parse_inst_t *)&cmd_set_port_tm_hierarchy_default,
-#endif
(cmdline_parse_inst_t *)&cmd_set_vxlan,
(cmdline_parse_inst_t *)&cmd_set_vxlan_tos_ttl,
(cmdline_parse_inst_t *)&cmd_set_vxlan_with_vlan,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 72f25d152..fa72e4454 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2373,55 +2373,6 @@ icmp_echo_config_setup(void)
}
}
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-static void
-softnic_fwd_config_setup(void)
-{
- struct rte_port *port;
- portid_t pid, softnic_portid;
- queueid_t i;
- uint8_t softnic_enable = 0;
-
- RTE_ETH_FOREACH_DEV(pid) {
- port = &ports[pid];
- const char *driver = port->dev_info.driver_name;
-
- if (strcmp(driver, "net_softnic") == 0) {
- softnic_portid = pid;
- softnic_enable = 1;
- break;
- }
- }
-
- if (softnic_enable == 0) {
- printf("Softnic mode not configured(%s)!\n", __func__);
- return;
- }
-
- cur_fwd_config.nb_fwd_ports = 1;
- cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;
-
- /* Re-initialize forwarding streams */
- init_fwd_streams();
-
- /*
- * In the softnic forwarding test, the number of forwarding cores
- * is set to one and remaining are used for softnic packet processing.
- */
- cur_fwd_config.nb_fwd_lcores = 1;
- setup_fwd_config_of_each_lcore(&cur_fwd_config);
-
- for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {
- fwd_streams[i]->rx_port = softnic_portid;
- fwd_streams[i]->rx_queue = i;
- fwd_streams[i]->tx_port = softnic_portid;
- fwd_streams[i]->tx_queue = i;
- fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
- fwd_streams[i]->retry_enabled = retry_enabled;
- }
-}
-#endif
-
void
fwd_config_setup(void)
{
@@ -2431,13 +2382,6 @@ fwd_config_setup(void)
return;
}
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
- softnic_fwd_config_setup();
- return;
- }
-#endif
-
if ((nb_rxq > 1) && (nb_txq > 1)){
if (dcb_config)
dcb_fwd_config_setup();
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 487288297..750fe3bfd 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -36,10 +36,6 @@ endif
if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
deps += 'pmd_ixgbe'
endif
-if dpdk_conf.has('RTE_LIBRTE_SOFTNIC_PMD')
- sources += files('softnicfwd.c')
- deps += 'pmd_softnic'
-endif
if dpdk_conf.has('RTE_LIBRTE_DPAA_PMD')
deps += ['bus_dpaa', 'mempool_dpaa', 'pmd_dpaa']
endif
diff --git a/app/test-pmd/softnicfwd.c b/app/test-pmd/softnicfwd.c
deleted file mode 100644
index e9d437364..000000000
--- a/app/test-pmd/softnicfwd.c
+++ /dev/null
@@ -1,686 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017 Intel Corporation
- */
-#include <stdio.h>
-#include <sys/stat.h>
-
-#include <rte_cycles.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-#include <rte_ethdev.h>
-#include <rte_flow.h>
-#include <rte_meter.h>
-#include <rte_eth_softnic.h>
-#include <rte_tm.h>
-
-#include "testpmd.h"
-
-#define SUBPORT_NODES_PER_PORT 1
-#define PIPE_NODES_PER_SUBPORT 4096
-#define TC_NODES_PER_PIPE 4
-#define QUEUE_NODES_PER_TC 4
-
-#define NUM_PIPE_NODES \
- (SUBPORT_NODES_PER_PORT * PIPE_NODES_PER_SUBPORT)
-
-#define NUM_TC_NODES \
- (NUM_PIPE_NODES * TC_NODES_PER_PIPE)
-
-#define ROOT_NODE_ID 1000000
-#define SUBPORT_NODES_START_ID 900000
-#define PIPE_NODES_START_ID 800000
-#define TC_NODES_START_ID 700000
-
-#define STATS_MASK_DEFAULT \
- (RTE_TM_STATS_N_PKTS | \
- RTE_TM_STATS_N_BYTES | \
- RTE_TM_STATS_N_PKTS_GREEN_DROPPED | \
- RTE_TM_STATS_N_BYTES_GREEN_DROPPED)
-
-#define STATS_MASK_QUEUE \
- (STATS_MASK_DEFAULT | \
- RTE_TM_STATS_N_PKTS_QUEUED)
-
-#define BYTES_IN_MBPS (1000 * 1000 / 8)
-#define TOKEN_BUCKET_SIZE 1000000
-
-/* TM Hierarchy Levels */
-enum tm_hierarchy_level {
- TM_NODE_LEVEL_PORT = 0,
- TM_NODE_LEVEL_SUBPORT,
- TM_NODE_LEVEL_PIPE,
- TM_NODE_LEVEL_TC,
- TM_NODE_LEVEL_QUEUE,
- TM_NODE_LEVEL_MAX,
-};
-
-struct tm_hierarchy {
- /* TM Nodes */
- uint32_t root_node_id;
- uint32_t subport_node_id[SUBPORT_NODES_PER_PORT];
- uint32_t pipe_node_id[SUBPORT_NODES_PER_PORT][PIPE_NODES_PER_SUBPORT];
- uint32_t tc_node_id[NUM_PIPE_NODES][TC_NODES_PER_PIPE];
- uint32_t queue_node_id[NUM_TC_NODES][QUEUE_NODES_PER_TC];
-
- /* TM Hierarchy Nodes Shaper Rates */
- uint32_t root_node_shaper_rate;
- uint32_t subport_node_shaper_rate;
- uint32_t pipe_node_shaper_rate;
- uint32_t tc_node_shaper_rate;
- uint32_t tc_node_shared_shaper_rate;
-
- uint32_t n_shapers;
-};
-
-static struct fwd_lcore *softnic_fwd_lcore;
-static uint16_t softnic_port_id;
-struct fwd_engine softnic_fwd_engine;
-
-/*
- * Softnic packet forward
- */
-static void
-softnic_fwd(struct fwd_stream *fs)
-{
- struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
- uint16_t nb_rx;
- uint16_t nb_tx;
- uint32_t retry;
-
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- uint64_t start_tsc;
- uint64_t end_tsc;
- uint64_t core_cycles;
-#endif
-
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- start_tsc = rte_rdtsc();
-#endif
-
- /* Packets Receive */
- nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
- pkts_burst, nb_pkt_per_burst);
- fs->rx_packets += nb_rx;
-
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
-
- nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
- pkts_burst, nb_rx);
-
- /* Retry if necessary */
- if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) {
- retry = 0;
- while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) {
- rte_delay_us(burst_tx_delay_time);
- nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
- &pkts_burst[nb_tx], nb_rx - nb_tx);
- }
- }
- fs->tx_packets += nb_tx;
-
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
-
- if (unlikely(nb_tx < nb_rx)) {
- fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
- }
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- end_tsc = rte_rdtsc();
- core_cycles = (end_tsc - start_tsc);
- fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
-}
-
-static void
-softnic_fwd_run(struct fwd_stream *fs)
-{
- rte_pmd_softnic_run(softnic_port_id);
- softnic_fwd(fs);
-}
-
-/**
- * Softnic init
- */
-static int
-softnic_begin(void *arg __rte_unused)
-{
- for (;;) {
- if (!softnic_fwd_lcore->stopped)
- break;
- }
-
- do {
- /* Run softnic */
- rte_pmd_softnic_run(softnic_port_id);
- } while (!softnic_fwd_lcore->stopped);
-
- return 0;
-}
-
-static int
-set_tm_hiearchy_nodes_shaper_rate(portid_t port_id,
- struct tm_hierarchy *h)
-{
- struct rte_eth_link link_params;
- uint64_t tm_port_rate;
- int ret;
-
- memset(&link_params, 0, sizeof(link_params));
-
- ret = rte_eth_link_get(port_id, &link_params);
- if (ret < 0) {
- printf("Error during getting device (port %u) link info: %s\n",
- port_id, rte_strerror(-ret));
- return ret;
- }
- tm_port_rate = (uint64_t)ETH_SPEED_NUM_10G * BYTES_IN_MBPS;
-
- /* Set tm hierarchy shapers rate */
- h->root_node_shaper_rate = tm_port_rate;
- h->subport_node_shaper_rate =
- tm_port_rate / SUBPORT_NODES_PER_PORT;
- h->pipe_node_shaper_rate
- = h->subport_node_shaper_rate / PIPE_NODES_PER_SUBPORT;
- h->tc_node_shaper_rate = h->pipe_node_shaper_rate;
- h->tc_node_shared_shaper_rate = h->subport_node_shaper_rate;
-
- return 0;
-}
-
-static int
-softport_tm_root_node_add(portid_t port_id, struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- struct rte_tm_node_params rnp;
- struct rte_tm_shaper_params rsp;
- uint32_t priority, weight, level_id, shaper_profile_id;
-
- memset(&rsp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&rnp, 0, sizeof(struct rte_tm_node_params));
-
- /* Shaper profile Parameters */
- rsp.peak.rate = h->root_node_shaper_rate;
- rsp.peak.size = TOKEN_BUCKET_SIZE;
- rsp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
- shaper_profile_id = 0;
-
- if (rte_tm_shaper_profile_add(port_id, shaper_profile_id,
- &rsp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
-
- /* Root Node Parameters */
- h->root_node_id = ROOT_NODE_ID;
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_PORT;
- rnp.shaper_profile_id = shaper_profile_id;
- rnp.nonleaf.n_sp_priorities = 1;
- rnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Node to TM Hierarchy */
- if (rte_tm_node_add(port_id, h->root_node_id, RTE_TM_NODE_ID_NULL,
- priority, weight, level_id, &rnp, error)) {
- printf("%s ERROR(%d)-%s!(node_id %u, parent_id %u, level %u)\n",
- __func__, error->type, error->message,
- h->root_node_id, RTE_TM_NODE_ID_NULL,
- level_id);
- return -1;
- }
- /* Update */
- h->n_shapers++;
-
- printf(" Root node added (Start id %u, Count %u, level %u)\n",
- h->root_node_id, 1, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_subport_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t subport_parent_node_id, subport_node_id = 0;
- struct rte_tm_node_params snp;
- struct rte_tm_shaper_params ssp;
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t i;
-
- memset(&ssp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&snp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Add Shaper Profile to TM Hierarchy */
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- ssp.peak.rate = h->subport_node_shaper_rate;
- ssp.peak.size = TOKEN_BUCKET_SIZE;
- ssp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- if (rte_tm_shaper_profile_add(port_id, shaper_profile_id,
- &ssp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
-
- /* Node Parameters */
- h->subport_node_id[i] = SUBPORT_NODES_START_ID + i;
- subport_parent_node_id = h->root_node_id;
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_SUBPORT;
- snp.shaper_profile_id = shaper_profile_id;
- snp.nonleaf.n_sp_priorities = 1;
- snp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Node to TM Hiearchy */
- if (rte_tm_node_add(port_id,
- h->subport_node_id[i],
- subport_parent_node_id,
- priority, weight,
- level_id,
- &snp,
- error)) {
- printf("%s ERROR(%d)-%s!(node %u,parent %u,level %u)\n",
- __func__,
- error->type,
- error->message,
- h->subport_node_id[i],
- subport_parent_node_id,
- level_id);
- return -1;
- }
- shaper_profile_id++;
- subport_node_id++;
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" Subport nodes added (Start id %u, Count %u, level %u)\n",
- h->subport_node_id[0], SUBPORT_NODES_PER_PORT, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_pipe_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t pipe_parent_node_id;
- struct rte_tm_node_params pnp;
- struct rte_tm_shaper_params psp;
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t i, j;
-
- memset(&psp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&pnp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Shaper Profile Parameters */
- psp.peak.rate = h->pipe_node_shaper_rate;
- psp.peak.size = TOKEN_BUCKET_SIZE;
- psp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* Pipe Node Parameters */
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_PIPE;
- pnp.nonleaf.n_sp_priorities = 4;
- pnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Shaper Profiles and Nodes to TM Hierarchy */
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- for (j = 0; j < PIPE_NODES_PER_SUBPORT; j++) {
- if (rte_tm_shaper_profile_add(port_id,
- shaper_profile_id, &psp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
- pnp.shaper_profile_id = shaper_profile_id;
- pipe_parent_node_id = h->subport_node_id[i];
- h->pipe_node_id[i][j] = PIPE_NODES_START_ID +
- (i * PIPE_NODES_PER_SUBPORT) + j;
-
- if (rte_tm_node_add(port_id,
- h->pipe_node_id[i][j],
- pipe_parent_node_id,
- priority, weight, level_id,
- &pnp,
- error)) {
- printf("%s ERROR(%d)-%s!(node %u,parent %u )\n",
- __func__,
- error->type,
- error->message,
- h->pipe_node_id[i][j],
- pipe_parent_node_id);
-
- return -1;
- }
- shaper_profile_id++;
- }
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" Pipe nodes added (Start id %u, Count %u, level %u)\n",
- h->pipe_node_id[0][0], NUM_PIPE_NODES, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_tc_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t tc_parent_node_id;
- struct rte_tm_node_params tnp;
- struct rte_tm_shaper_params tsp, tssp;
- uint32_t shared_shaper_profile_id[TC_NODES_PER_PIPE];
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t pos, n_tc_nodes, i, j, k;
-
- memset(&tsp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&tssp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&tnp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Private Shaper Profile (TC) Parameters */
- tsp.peak.rate = h->tc_node_shaper_rate;
- tsp.peak.size = TOKEN_BUCKET_SIZE;
- tsp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* Shared Shaper Profile (TC) Parameters */
- tssp.peak.rate = h->tc_node_shared_shaper_rate;
- tssp.peak.size = TOKEN_BUCKET_SIZE;
- tssp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* TC Node Parameters */
- weight = 1;
- level_id = TM_NODE_LEVEL_TC;
- tnp.n_shared_shapers = 1;
- tnp.nonleaf.n_sp_priorities = 1;
- tnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Shared Shaper Profiles to TM Hierarchy */
- for (i = 0; i < TC_NODES_PER_PIPE; i++) {
- shared_shaper_profile_id[i] = shaper_profile_id;
-
- if (rte_tm_shaper_profile_add(port_id,
- shared_shaper_profile_id[i], &tssp, error)) {
- printf("%s ERROR(%d)-%s!(Shared shaper profileid %u)\n",
- __func__, error->type, error->message,
- shared_shaper_profile_id[i]);
-
- return -1;
- }
- if (rte_tm_shared_shaper_add_update(port_id, i,
- shared_shaper_profile_id[i], error)) {
- printf("%s ERROR(%d)-%s!(Shared shaper id %u)\n",
- __func__, error->type, error->message, i);
-
- return -1;
- }
- shaper_profile_id++;
- }
-
- /* Add Shaper Profiles and Nodes to TM Hierarchy */
- n_tc_nodes = 0;
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- for (j = 0; j < PIPE_NODES_PER_SUBPORT; j++) {
- for (k = 0; k < TC_NODES_PER_PIPE ; k++) {
- priority = k;
- tc_parent_node_id = h->pipe_node_id[i][j];
- tnp.shared_shaper_id =
- (uint32_t *)calloc(1, sizeof(uint32_t));
- if (tnp.shared_shaper_id == NULL) {
- printf("Shared shaper mem alloc err\n");
- return -1;
- }
- tnp.shared_shaper_id[0] = k;
- pos = j + (i * PIPE_NODES_PER_SUBPORT);
- h->tc_node_id[pos][k] =
- TC_NODES_START_ID + n_tc_nodes;
-
- if (rte_tm_shaper_profile_add(port_id,
- shaper_profile_id, &tsp, error)) {
- printf("%s ERROR(%d)-%s!(shaper %u)\n",
- __func__, error->type,
- error->message,
- shaper_profile_id);
-
- free(tnp.shared_shaper_id);
- return -1;
- }
- tnp.shaper_profile_id = shaper_profile_id;
- if (rte_tm_node_add(port_id,
- h->tc_node_id[pos][k],
- tc_parent_node_id,
- priority, weight,
- level_id,
- &tnp, error)) {
- printf("%s ERROR(%d)-%s!(node id %u)\n",
- __func__,
- error->type,
- error->message,
- h->tc_node_id[pos][k]);
-
- free(tnp.shared_shaper_id);
- return -1;
- }
- shaper_profile_id++;
- n_tc_nodes++;
- }
- }
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" TC nodes added (Start id %u, Count %u, level %u)\n",
- h->tc_node_id[0][0], n_tc_nodes, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_queue_node_add(portid_t port_id, struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t queue_parent_node_id;
- struct rte_tm_node_params qnp;
- uint32_t priority, weight, level_id, pos;
- uint32_t n_queue_nodes, i, j, k;
-
- memset(&qnp, 0, sizeof(struct rte_tm_node_params));
-
- /* Queue Node Parameters */
- priority = 0;
- weight = 1;
- level_id = TM_NODE_LEVEL_QUEUE;
- qnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
- qnp.leaf.cman = RTE_TM_CMAN_TAIL_DROP;
- qnp.stats_mask = STATS_MASK_QUEUE;
-
- /* Add Queue Nodes to TM Hierarchy */
- n_queue_nodes = 0;
- for (i = 0; i < NUM_PIPE_NODES; i++) {
- for (j = 0; j < TC_NODES_PER_PIPE; j++) {
- queue_parent_node_id = h->tc_node_id[i][j];
- for (k = 0; k < QUEUE_NODES_PER_TC; k++) {
- pos = j + (i * TC_NODES_PER_PIPE);
- h->queue_node_id[pos][k] = n_queue_nodes;
- if (rte_tm_node_add(port_id,
- h->queue_node_id[pos][k],
- queue_parent_node_id,
- priority,
- weight,
- level_id,
- &qnp, error)) {
- printf("%s ERROR(%d)-%s!(node %u)\n",
- __func__,
- error->type,
- error->message,
- h->queue_node_id[pos][k]);
-
- return -1;
- }
- n_queue_nodes++;
- }
- }
- }
- printf(" Queue nodes added (Start id %u, Count %u, level %u)\n",
- h->queue_node_id[0][0], n_queue_nodes, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_hierarchy_specify(portid_t port_id,
- struct rte_tm_error *error)
-{
-
- struct tm_hierarchy h;
- int status;
-
- memset(&h, 0, sizeof(struct tm_hierarchy));
-
- /* TM hierarchy shapers rate */
- status = set_tm_hiearchy_nodes_shaper_rate(port_id, &h);
- if (status)
- return status;
-
- /* Add root node (level 0) */
- status = softport_tm_root_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add subport node (level 1) */
- status = softport_tm_subport_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add pipe nodes (level 2) */
- status = softport_tm_pipe_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add traffic class nodes (level 3) */
- status = softport_tm_tc_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add queue nodes (level 4) */
- status = softport_tm_queue_node_add(port_id, &h, error);
- if (status)
- return status;
-
- return 0;
-}
-
-/*
- * Softnic TM default configuration
- */
-static void
-softnic_tm_default_config(portid_t pi)
-{
- struct rte_port *port = &ports[pi];
- struct rte_tm_error error;
- int status;
-
- /* Stop port */
- rte_eth_dev_stop(pi);
-
- /* TM hierarchy specification */
- status = softport_tm_hierarchy_specify(pi, &error);
- if (status) {
- printf(" TM Hierarchy built error(%d) - %s\n",
- error.type, error.message);
- return;
- }
- printf("\n TM Hierarchy Specified!\n");
-
- /* TM hierarchy commit */
- status = rte_tm_hierarchy_commit(pi, 0, &error);
- if (status) {
- printf(" Hierarchy commit error(%d) - %s\n",
- error.type, error.message);
- return;
- }
- printf(" Hierarchy Committed (port %u)!\n", pi);
-
- /* Start port */
- status = rte_eth_dev_start(pi);
- if (status) {
- printf("\n Port %u start error!\n", pi);
- return;
- }
-
- /* Reset the default hierarchy flag */
- port->softport.default_tm_hierarchy_enable = 0;
-}
-
-/*
- * Softnic forwarding init
- */
-static void
-softnic_fwd_begin(portid_t pi)
-{
- struct rte_port *port = &ports[pi];
- uint32_t lcore, fwd_core_present = 0, softnic_run_launch = 0;
- int status;
-
- softnic_fwd_lcore = port->softport.fwd_lcore_arg[0];
- softnic_port_id = pi;
-
- /* Launch softnic_run function on lcores */
- for (lcore = 0; lcore < RTE_MAX_LCORE; lcore++) {
- if (!rte_lcore_is_enabled(lcore))
- continue;
-
- if (lcore == rte_get_master_lcore())
- continue;
-
- if (fwd_core_present == 0) {
- fwd_core_present++;
- continue;
- }
-
- status = rte_eal_remote_launch(softnic_begin, NULL, lcore);
- if (status)
- printf("softnic launch on lcore %u failed (%d)\n",
- lcore, status);
-
- softnic_run_launch = 1;
- }
-
- if (!softnic_run_launch)
- softnic_fwd_engine.packet_fwd = softnic_fwd_run;
-
- /* Softnic TM default configuration */
- if (port->softport.default_tm_hierarchy_enable == 1)
- softnic_tm_default_config(pi);
-}
-
-struct fwd_engine softnic_fwd_engine = {
- .fwd_mode_name = "softnic",
- .port_fwd_begin = softnic_fwd_begin,
- .port_fwd_end = NULL,
- .packet_fwd = softnic_fwd,
-};
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 99bacddbf..463245ba2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -179,9 +179,6 @@ struct fwd_engine * fwd_engines[] = {
&csum_fwd_engine,
&icmp_echo_engine,
&noisy_vnf_engine,
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- &softnic_fwd_engine,
-#endif
#ifdef RTE_LIBRTE_IEEE1588
&ieee1588_fwd_engine,
#endif
@@ -1554,19 +1551,6 @@ init_config(void)
"rte_gro_ctx_create() failed\n");
}
}
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
- RTE_ETH_FOREACH_DEV(pid) {
- port = &ports[pid];
- const char *driver = port->dev_info.driver_name;
-
- if (strcmp(driver, "net_softnic") == 0)
- port->softport.fwd_lcore_arg = fwd_lcores;
- }
- }
-#endif
-
}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 7ff4c5dba..ac9fdaa53 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -58,12 +58,6 @@ typedef uint16_t portid_t;
typedef uint16_t queueid_t;
typedef uint16_t streamid_t;
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-#define SOFTNIC 1
-#else
-#define SOFTNIC 0
-#endif
-
enum {
PORT_TOPOLOGY_PAIRED,
PORT_TOPOLOGY_CHAINED,
@@ -154,16 +148,6 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-#ifdef SOFTNIC
-/**
- * The data structure associate with softnic port
- */
-struct softnic_port {
- uint32_t default_tm_hierarchy_enable; /**< default tm hierarchy */
- struct fwd_lcore **fwd_lcore_arg; /**< softnic fwd core parameters */
-};
-#endif
-
/**
* The data structure associated with each port.
*/
@@ -196,9 +180,6 @@ struct rte_port {
struct port_flow *flow_list; /**< Associated flows. */
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
-#ifdef SOFTNIC
- struct softnic_port softport; /**< softnic params */
-#endif
/**< metadata value to insert in Tx packets. */
uint32_t tx_metadata;
const struct rte_eth_rxtx_callback *tx_set_md_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -266,9 +247,6 @@ extern struct fwd_engine tx_only_engine;
extern struct fwd_engine csum_fwd_engine;
extern struct fwd_engine icmp_echo_engine;
extern struct fwd_engine noisy_vnf_engine;
-#ifdef SOFTNIC
-extern struct fwd_engine softnic_fwd_engine;
-#endif
#ifdef RTE_LIBRTE_IEEE1588
extern struct fwd_engine ieee1588_fwd_engine;
#endif
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a360ecccf..64f705ec6 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -329,9 +329,6 @@ The available information categories are:
* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
-* ``softnic``: Demonstrates the softnic forwarding operation. In this mode, packet forwarding is
- similar to I/O mode except for the fact that packets are loopback to the softnic ports only. Therefore, portmask parameter should be set to softnic port only. The various software based custom NIC pipelines specified through the softnic firmware (DPDK packet framework script) can be tested in this mode. Furthermore, it allows to build 5-level hierarchical QoS scheduler as a default option that can be enabled through CLI once testpmd application is initialised. The user can modify the default scheduler hierarchy or can specify the new QoS Scheduler hierarchy through CLI. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y``.
-
* ``noisy``: Noisy neighbor simulation.
Simulate more realistic behavior of a guest machine engaged in receiving
and sending packets performing Virtual Network Function (VNF).
@@ -3106,13 +3103,6 @@ where:
* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
to ecn of 2'b11 when IP is caring TCP or SCTP
-Set port traffic management default hierarchy (softnic forwarding mode)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-set the traffic management default hierarchy on the port::
-
- testpmd> set port tm hierarchy default (port_id)
-
Filter Functions
----------------
--
2.21.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
2020-06-22 15:51 [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode Jasvinder Singh
@ 2020-06-23 7:38 ` Phil Yang
2020-06-23 8:38 ` Singh, Jasvinder
2020-06-23 9:32 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
1 sibling, 1 reply; 7+ messages in thread
From: Phil Yang @ 2020-06-23 7:38 UTC (permalink / raw)
To: Jasvinder Singh, dev; +Cc: cristian.dumitrescu
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Jasvinder Singh
> Sent: Monday, June 22, 2020 11:51 PM
> To: dev@dpdk.org
> Cc: cristian.dumitrescu@intel.com
> Subject: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
>
> Softnic can be used like other virtual devices without
> needing any special mode. Therefore, softnic forward mode
> is removed from testpmd app. Documentation is updated as
> well.
>
Hi Jasvinder,
One quick question for this change. How can we test the softnic PMD without this mode?
The softnic PMD guidance uses testpmd softnic mode in the PMD test section.
However, when I switch the forward mode from softnic to IO mode, the testpmd cannot work as expected.
I think you need to update the softnic PMD page as well.
doc/guides/nics/softnic.rst
Thanks,
Phil
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> app/test-pmd/Makefile | 4 -
> app/test-pmd/cmdline.c | 82 ---
> app/test-pmd/config.c | 56 --
> app/test-pmd/meson.build | 4 -
> app/test-pmd/softnicfwd.c | 686 --------------------
> app/test-pmd/testpmd.c | 16 -
> app/test-pmd/testpmd.h | 22 -
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 -
> 8 files changed, 880 deletions(-)
> delete mode 100644 app/test-pmd/softnicfwd.c
<snip>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
2020-06-23 7:38 ` Phil Yang
@ 2020-06-23 8:38 ` Singh, Jasvinder
2020-06-23 8:41 ` David Marchand
0 siblings, 1 reply; 7+ messages in thread
From: Singh, Jasvinder @ 2020-06-23 8:38 UTC (permalink / raw)
To: Phil Yang, dev; +Cc: Dumitrescu, Cristian
> -----Original Message-----
> From: Phil Yang <Phil.Yang@arm.com>
> Sent: Tuesday, June 23, 2020 8:38 AM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: RE: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Jasvinder Singh
> > Sent: Monday, June 22, 2020 11:51 PM
> > To: dev@dpdk.org
> > Cc: cristian.dumitrescu@intel.com
> > Subject: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
> >
> > Softnic can be used like other virtual devices without needing any
> > special mode. Therefore, softnic forward mode is removed from testpmd
> > app. Documentation is updated as well.
> >
> Hi Jasvinder,
>
> One quick question for this change. How can we test the softnic PMD
> without this mode?
> The softnic PMD guidance uses testpmd softnic mode in the PMD test
> section.
> However, when I switch the forward mode from softnic to IO mode, the
> testpmd cannot work as expected.
>
> I think you need to update the softnic PMD page as well.
> doc/guides/nics/softnic.rst
>
> Thanks,
> Phil
>
Hi Phil,
I have sent a separate patch on softnic PMD document update with the command to run softnic with testpmd, https://patches.dpdk.org/patch/71984/
Thanks,
Jasvinder
<Snip>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
2020-06-23 8:38 ` Singh, Jasvinder
@ 2020-06-23 8:41 ` David Marchand
2020-06-23 8:49 ` Singh, Jasvinder
0 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2020-06-23 8:41 UTC (permalink / raw)
To: Singh, Jasvinder; +Cc: Phil Yang, dev, Dumitrescu, Cristian
On Tue, Jun 23, 2020 at 10:38 AM Singh, Jasvinder
<jasvinder.singh@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Phil Yang <Phil.Yang@arm.com>
> > Sent: Tuesday, June 23, 2020 8:38 AM
> > To: Singh, Jasvinder <jasvinder.singh@intel.com>; dev@dpdk.org
> > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
> >
> > > -----Original Message-----
> > > From: dev <dev-bounces@dpdk.org> On Behalf Of Jasvinder Singh
> > > Sent: Monday, June 22, 2020 11:51 PM
> > > To: dev@dpdk.org
> > > Cc: cristian.dumitrescu@intel.com
> > > Subject: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
> > >
> > > Softnic can be used like other virtual devices without needing any
> > > special mode. Therefore, softnic forward mode is removed from testpmd
> > > app. Documentation is updated as well.
> > >
> > Hi Jasvinder,
> >
> > One quick question for this change. How can we test the softnic PMD
> > without this mode?
> > The softnic PMD guidance uses testpmd softnic mode in the PMD test
> > section.
> > However, when I switch the forward mode from softnic to IO mode, the
> > testpmd cannot work as expected.
> >
> > I think you need to update the softnic PMD page as well.
> > doc/guides/nics/softnic.rst
> >
> > Thanks,
> > Phil
> >
>
> Hi Phil,
>
> I have sent a separate patch on softnic PMD document update with the command to run softnic with testpmd, https://patches.dpdk.org/patch/71984/
It should be a single patch.
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
2020-06-23 8:41 ` David Marchand
@ 2020-06-23 8:49 ` Singh, Jasvinder
0 siblings, 0 replies; 7+ messages in thread
From: Singh, Jasvinder @ 2020-06-23 8:49 UTC (permalink / raw)
To: David Marchand; +Cc: Phil Yang, dev, Dumitrescu, Cristian
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Tuesday, June 23, 2020 9:42 AM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>
> Cc: Phil Yang <Phil.Yang@arm.com>; dev@dpdk.org; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode
>
> On Tue, Jun 23, 2020 at 10:38 AM Singh, Jasvinder
> <jasvinder.singh@intel.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Phil Yang <Phil.Yang@arm.com>
> > > Sent: Tuesday, June 23, 2020 8:38 AM
> > > To: Singh, Jasvinder <jasvinder.singh@intel.com>; dev@dpdk.org
> > > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> > > Subject: RE: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward
> > > mode
> > >
> > > > -----Original Message-----
> > > > From: dev <dev-bounces@dpdk.org> On Behalf Of Jasvinder Singh
> > > > Sent: Monday, June 22, 2020 11:51 PM
> > > > To: dev@dpdk.org
> > > > Cc: cristian.dumitrescu@intel.com
> > > > Subject: [dpdk-dev] [PATCH] app/testpmd: remove softnic forward
> > > > mode
> > > >
> > > > Softnic can be used like other virtual devices without needing any
> > > > special mode. Therefore, softnic forward mode is removed from
> > > > testpmd app. Documentation is updated as well.
> > > >
> > > Hi Jasvinder,
> > >
> > > One quick question for this change. How can we test the softnic PMD
> > > without this mode?
> > > The softnic PMD guidance uses testpmd softnic mode in the PMD test
> > > section.
> > > However, when I switch the forward mode from softnic to IO mode, the
> > > testpmd cannot work as expected.
> > >
> > > I think you need to update the softnic PMD page as well.
> > > doc/guides/nics/softnic.rst
> > >
> > > Thanks,
> > > Phil
> > >
> >
> > Hi Phil,
> >
> > I have sent a separate patch on softnic PMD document update with the
> > command to run softnic with testpmd,
> > https://patches.dpdk.org/patch/71984/
>
> It should be a single patch.
>
Ok, will merge document patch with this one.
> --
> David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] app/testpmd: remove softnic forward mode
2020-06-22 15:51 [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode Jasvinder Singh
2020-06-23 7:38 ` Phil Yang
@ 2020-06-23 9:32 ` Jasvinder Singh
2020-07-10 16:59 ` Ferruh Yigit
1 sibling, 1 reply; 7+ messages in thread
From: Jasvinder Singh @ 2020-06-23 9:32 UTC (permalink / raw)
To: dev; +Cc: cristian.dumitrescu
Softnic can be used like other virtual devices without
needing any special mode. Therefore, remove softnic mode
from testpmd app. Documentation is updated as well.
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v2
- merge softnic document update patch
app/test-pmd/Makefile | 4 -
app/test-pmd/cmdline.c | 82 ---
app/test-pmd/config.c | 56 --
app/test-pmd/meson.build | 4 -
app/test-pmd/softnicfwd.c | 686 --------------------
app/test-pmd/testpmd.c | 16 -
app/test-pmd/testpmd.h | 22 -
doc/guides/nics/softnic.rst | 60 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 -
9 files changed, 44 insertions(+), 896 deletions(-)
delete mode 100644 app/test-pmd/softnicfwd.c
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index ea818de22..4eab42f18 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -37,10 +37,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c
SRCS-$(CONFIG_RTE_LIBRTE_BPF) += bpf_cmd.c
SRCS-y += util.c
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC), y)
-SRCS-y += softnicfwd.c
-endif
-
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 1375f223e..713a1bcf5 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1182,11 +1182,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"show port tm node stats (port_id) (node_id) (clear)\n"
" Display the port TM node stats.\n\n"
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
- "set port tm hierarchy default (port_id)\n"
- " Set default traffic Management hierarchy on a port\n\n"
-#endif
-
"add port tm node shaper profile (port_id) (shaper_profile_id)"
" (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size)"
" (packet_length_adjust)\n"
@@ -15343,80 +15338,6 @@ cmdline_parse_inst_t cmd_vf_tc_max_bw = {
},
};
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
-
-/* *** Set Port default Traffic Management Hierarchy *** */
-struct cmd_set_port_tm_hierarchy_default_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t tm;
- cmdline_fixed_string_t hierarchy;
- cmdline_fixed_string_t def;
- portid_t port_id;
-};
-
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_set =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, set, "set");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_port =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, port, "port");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_tm =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result, tm, "tm");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_hierarchy =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- hierarchy, "hierarchy");
-cmdline_parse_token_string_t cmd_set_port_tm_hierarchy_default_default =
- TOKEN_STRING_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- def, "default");
-cmdline_parse_token_num_t cmd_set_port_tm_hierarchy_default_port_id =
- TOKEN_NUM_INITIALIZER(
- struct cmd_set_port_tm_hierarchy_default_result,
- port_id, UINT16);
-
-static void cmd_set_port_tm_hierarchy_default_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_port_tm_hierarchy_default_result *res = parsed_result;
- struct rte_port *p;
- portid_t port_id = res->port_id;
-
- if (port_id_is_invalid(port_id, ENABLED_WARN))
- return;
-
- p = &ports[port_id];
-
- /* Forward mode: tm */
- if (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, "softnic")) {
- printf(" softnicfwd mode not enabled(error)\n");
- return;
- }
-
- /* Set the default tm hierarchy */
- p->softport.default_tm_hierarchy_enable = 1;
-}
-
-cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default = {
- .f = cmd_set_port_tm_hierarchy_default_parsed,
- .data = NULL,
- .help_str = "set port tm hierarchy default <port_id>",
- .tokens = {
- (void *)&cmd_set_port_tm_hierarchy_default_set,
- (void *)&cmd_set_port_tm_hierarchy_default_port,
- (void *)&cmd_set_port_tm_hierarchy_default_tm,
- (void *)&cmd_set_port_tm_hierarchy_default_hierarchy,
- (void *)&cmd_set_port_tm_hierarchy_default_default,
- (void *)&cmd_set_port_tm_hierarchy_default_port_id,
- NULL,
- },
-};
-#endif
-
/** Set VXLAN encapsulation details */
struct cmd_set_vxlan_result {
cmdline_fixed_string_t set;
@@ -19599,9 +19520,6 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_tc_max_bw,
(cmdline_parse_inst_t *)&cmd_strict_link_prio,
(cmdline_parse_inst_t *)&cmd_tc_min_bw,
-#if defined RTE_LIBRTE_PMD_SOFTNIC && defined RTE_LIBRTE_SCHED
- (cmdline_parse_inst_t *)&cmd_set_port_tm_hierarchy_default,
-#endif
(cmdline_parse_inst_t *)&cmd_set_vxlan,
(cmdline_parse_inst_t *)&cmd_set_vxlan_tos_ttl,
(cmdline_parse_inst_t *)&cmd_set_vxlan_with_vlan,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 72f25d152..fa72e4454 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2373,55 +2373,6 @@ icmp_echo_config_setup(void)
}
}
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-static void
-softnic_fwd_config_setup(void)
-{
- struct rte_port *port;
- portid_t pid, softnic_portid;
- queueid_t i;
- uint8_t softnic_enable = 0;
-
- RTE_ETH_FOREACH_DEV(pid) {
- port = &ports[pid];
- const char *driver = port->dev_info.driver_name;
-
- if (strcmp(driver, "net_softnic") == 0) {
- softnic_portid = pid;
- softnic_enable = 1;
- break;
- }
- }
-
- if (softnic_enable == 0) {
- printf("Softnic mode not configured(%s)!\n", __func__);
- return;
- }
-
- cur_fwd_config.nb_fwd_ports = 1;
- cur_fwd_config.nb_fwd_streams = (streamid_t) nb_rxq;
-
- /* Re-initialize forwarding streams */
- init_fwd_streams();
-
- /*
- * In the softnic forwarding test, the number of forwarding cores
- * is set to one and remaining are used for softnic packet processing.
- */
- cur_fwd_config.nb_fwd_lcores = 1;
- setup_fwd_config_of_each_lcore(&cur_fwd_config);
-
- for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++) {
- fwd_streams[i]->rx_port = softnic_portid;
- fwd_streams[i]->rx_queue = i;
- fwd_streams[i]->tx_port = softnic_portid;
- fwd_streams[i]->tx_queue = i;
- fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
- fwd_streams[i]->retry_enabled = retry_enabled;
- }
-}
-#endif
-
void
fwd_config_setup(void)
{
@@ -2431,13 +2382,6 @@ fwd_config_setup(void)
return;
}
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
- softnic_fwd_config_setup();
- return;
- }
-#endif
-
if ((nb_rxq > 1) && (nb_txq > 1)){
if (dcb_config)
dcb_fwd_config_setup();
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 487288297..750fe3bfd 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -36,10 +36,6 @@ endif
if dpdk_conf.has('RTE_LIBRTE_IXGBE_PMD')
deps += 'pmd_ixgbe'
endif
-if dpdk_conf.has('RTE_LIBRTE_SOFTNIC_PMD')
- sources += files('softnicfwd.c')
- deps += 'pmd_softnic'
-endif
if dpdk_conf.has('RTE_LIBRTE_DPAA_PMD')
deps += ['bus_dpaa', 'mempool_dpaa', 'pmd_dpaa']
endif
diff --git a/app/test-pmd/softnicfwd.c b/app/test-pmd/softnicfwd.c
deleted file mode 100644
index e9d437364..000000000
--- a/app/test-pmd/softnicfwd.c
+++ /dev/null
@@ -1,686 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2017 Intel Corporation
- */
-#include <stdio.h>
-#include <sys/stat.h>
-
-#include <rte_cycles.h>
-#include <rte_mbuf.h>
-#include <rte_malloc.h>
-#include <rte_ethdev.h>
-#include <rte_flow.h>
-#include <rte_meter.h>
-#include <rte_eth_softnic.h>
-#include <rte_tm.h>
-
-#include "testpmd.h"
-
-#define SUBPORT_NODES_PER_PORT 1
-#define PIPE_NODES_PER_SUBPORT 4096
-#define TC_NODES_PER_PIPE 4
-#define QUEUE_NODES_PER_TC 4
-
-#define NUM_PIPE_NODES \
- (SUBPORT_NODES_PER_PORT * PIPE_NODES_PER_SUBPORT)
-
-#define NUM_TC_NODES \
- (NUM_PIPE_NODES * TC_NODES_PER_PIPE)
-
-#define ROOT_NODE_ID 1000000
-#define SUBPORT_NODES_START_ID 900000
-#define PIPE_NODES_START_ID 800000
-#define TC_NODES_START_ID 700000
-
-#define STATS_MASK_DEFAULT \
- (RTE_TM_STATS_N_PKTS | \
- RTE_TM_STATS_N_BYTES | \
- RTE_TM_STATS_N_PKTS_GREEN_DROPPED | \
- RTE_TM_STATS_N_BYTES_GREEN_DROPPED)
-
-#define STATS_MASK_QUEUE \
- (STATS_MASK_DEFAULT | \
- RTE_TM_STATS_N_PKTS_QUEUED)
-
-#define BYTES_IN_MBPS (1000 * 1000 / 8)
-#define TOKEN_BUCKET_SIZE 1000000
-
-/* TM Hierarchy Levels */
-enum tm_hierarchy_level {
- TM_NODE_LEVEL_PORT = 0,
- TM_NODE_LEVEL_SUBPORT,
- TM_NODE_LEVEL_PIPE,
- TM_NODE_LEVEL_TC,
- TM_NODE_LEVEL_QUEUE,
- TM_NODE_LEVEL_MAX,
-};
-
-struct tm_hierarchy {
- /* TM Nodes */
- uint32_t root_node_id;
- uint32_t subport_node_id[SUBPORT_NODES_PER_PORT];
- uint32_t pipe_node_id[SUBPORT_NODES_PER_PORT][PIPE_NODES_PER_SUBPORT];
- uint32_t tc_node_id[NUM_PIPE_NODES][TC_NODES_PER_PIPE];
- uint32_t queue_node_id[NUM_TC_NODES][QUEUE_NODES_PER_TC];
-
- /* TM Hierarchy Nodes Shaper Rates */
- uint32_t root_node_shaper_rate;
- uint32_t subport_node_shaper_rate;
- uint32_t pipe_node_shaper_rate;
- uint32_t tc_node_shaper_rate;
- uint32_t tc_node_shared_shaper_rate;
-
- uint32_t n_shapers;
-};
-
-static struct fwd_lcore *softnic_fwd_lcore;
-static uint16_t softnic_port_id;
-struct fwd_engine softnic_fwd_engine;
-
-/*
- * Softnic packet forward
- */
-static void
-softnic_fwd(struct fwd_stream *fs)
-{
- struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
- uint16_t nb_rx;
- uint16_t nb_tx;
- uint32_t retry;
-
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- uint64_t start_tsc;
- uint64_t end_tsc;
- uint64_t core_cycles;
-#endif
-
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- start_tsc = rte_rdtsc();
-#endif
-
- /* Packets Receive */
- nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
- pkts_burst, nb_pkt_per_burst);
- fs->rx_packets += nb_rx;
-
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
-
- nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
- pkts_burst, nb_rx);
-
- /* Retry if necessary */
- if (unlikely(nb_tx < nb_rx) && fs->retry_enabled) {
- retry = 0;
- while (nb_tx < nb_rx && retry++ < burst_tx_retry_num) {
- rte_delay_us(burst_tx_delay_time);
- nb_tx += rte_eth_tx_burst(fs->tx_port, fs->tx_queue,
- &pkts_burst[nb_tx], nb_rx - nb_tx);
- }
- }
- fs->tx_packets += nb_tx;
-
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
-
- if (unlikely(nb_tx < nb_rx)) {
- fs->fwd_dropped += (nb_rx - nb_tx);
- do {
- rte_pktmbuf_free(pkts_burst[nb_tx]);
- } while (++nb_tx < nb_rx);
- }
-#ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
- end_tsc = rte_rdtsc();
- core_cycles = (end_tsc - start_tsc);
- fs->core_cycles = (uint64_t) (fs->core_cycles + core_cycles);
-#endif
-}
-
-static void
-softnic_fwd_run(struct fwd_stream *fs)
-{
- rte_pmd_softnic_run(softnic_port_id);
- softnic_fwd(fs);
-}
-
-/**
- * Softnic init
- */
-static int
-softnic_begin(void *arg __rte_unused)
-{
- for (;;) {
- if (!softnic_fwd_lcore->stopped)
- break;
- }
-
- do {
- /* Run softnic */
- rte_pmd_softnic_run(softnic_port_id);
- } while (!softnic_fwd_lcore->stopped);
-
- return 0;
-}
-
-static int
-set_tm_hiearchy_nodes_shaper_rate(portid_t port_id,
- struct tm_hierarchy *h)
-{
- struct rte_eth_link link_params;
- uint64_t tm_port_rate;
- int ret;
-
- memset(&link_params, 0, sizeof(link_params));
-
- ret = rte_eth_link_get(port_id, &link_params);
- if (ret < 0) {
- printf("Error during getting device (port %u) link info: %s\n",
- port_id, rte_strerror(-ret));
- return ret;
- }
- tm_port_rate = (uint64_t)ETH_SPEED_NUM_10G * BYTES_IN_MBPS;
-
- /* Set tm hierarchy shapers rate */
- h->root_node_shaper_rate = tm_port_rate;
- h->subport_node_shaper_rate =
- tm_port_rate / SUBPORT_NODES_PER_PORT;
- h->pipe_node_shaper_rate
- = h->subport_node_shaper_rate / PIPE_NODES_PER_SUBPORT;
- h->tc_node_shaper_rate = h->pipe_node_shaper_rate;
- h->tc_node_shared_shaper_rate = h->subport_node_shaper_rate;
-
- return 0;
-}
-
-static int
-softport_tm_root_node_add(portid_t port_id, struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- struct rte_tm_node_params rnp;
- struct rte_tm_shaper_params rsp;
- uint32_t priority, weight, level_id, shaper_profile_id;
-
- memset(&rsp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&rnp, 0, sizeof(struct rte_tm_node_params));
-
- /* Shaper profile Parameters */
- rsp.peak.rate = h->root_node_shaper_rate;
- rsp.peak.size = TOKEN_BUCKET_SIZE;
- rsp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
- shaper_profile_id = 0;
-
- if (rte_tm_shaper_profile_add(port_id, shaper_profile_id,
- &rsp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
-
- /* Root Node Parameters */
- h->root_node_id = ROOT_NODE_ID;
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_PORT;
- rnp.shaper_profile_id = shaper_profile_id;
- rnp.nonleaf.n_sp_priorities = 1;
- rnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Node to TM Hierarchy */
- if (rte_tm_node_add(port_id, h->root_node_id, RTE_TM_NODE_ID_NULL,
- priority, weight, level_id, &rnp, error)) {
- printf("%s ERROR(%d)-%s!(node_id %u, parent_id %u, level %u)\n",
- __func__, error->type, error->message,
- h->root_node_id, RTE_TM_NODE_ID_NULL,
- level_id);
- return -1;
- }
- /* Update */
- h->n_shapers++;
-
- printf(" Root node added (Start id %u, Count %u, level %u)\n",
- h->root_node_id, 1, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_subport_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t subport_parent_node_id, subport_node_id = 0;
- struct rte_tm_node_params snp;
- struct rte_tm_shaper_params ssp;
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t i;
-
- memset(&ssp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&snp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Add Shaper Profile to TM Hierarchy */
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- ssp.peak.rate = h->subport_node_shaper_rate;
- ssp.peak.size = TOKEN_BUCKET_SIZE;
- ssp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- if (rte_tm_shaper_profile_add(port_id, shaper_profile_id,
- &ssp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
-
- /* Node Parameters */
- h->subport_node_id[i] = SUBPORT_NODES_START_ID + i;
- subport_parent_node_id = h->root_node_id;
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_SUBPORT;
- snp.shaper_profile_id = shaper_profile_id;
- snp.nonleaf.n_sp_priorities = 1;
- snp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Node to TM Hiearchy */
- if (rte_tm_node_add(port_id,
- h->subport_node_id[i],
- subport_parent_node_id,
- priority, weight,
- level_id,
- &snp,
- error)) {
- printf("%s ERROR(%d)-%s!(node %u,parent %u,level %u)\n",
- __func__,
- error->type,
- error->message,
- h->subport_node_id[i],
- subport_parent_node_id,
- level_id);
- return -1;
- }
- shaper_profile_id++;
- subport_node_id++;
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" Subport nodes added (Start id %u, Count %u, level %u)\n",
- h->subport_node_id[0], SUBPORT_NODES_PER_PORT, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_pipe_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t pipe_parent_node_id;
- struct rte_tm_node_params pnp;
- struct rte_tm_shaper_params psp;
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t i, j;
-
- memset(&psp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&pnp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Shaper Profile Parameters */
- psp.peak.rate = h->pipe_node_shaper_rate;
- psp.peak.size = TOKEN_BUCKET_SIZE;
- psp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* Pipe Node Parameters */
- weight = 1;
- priority = 0;
- level_id = TM_NODE_LEVEL_PIPE;
- pnp.nonleaf.n_sp_priorities = 4;
- pnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Shaper Profiles and Nodes to TM Hierarchy */
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- for (j = 0; j < PIPE_NODES_PER_SUBPORT; j++) {
- if (rte_tm_shaper_profile_add(port_id,
- shaper_profile_id, &psp, error)) {
- printf("%s ERROR(%d)-%s!(shaper_id %u)\n ",
- __func__, error->type, error->message,
- shaper_profile_id);
- return -1;
- }
- pnp.shaper_profile_id = shaper_profile_id;
- pipe_parent_node_id = h->subport_node_id[i];
- h->pipe_node_id[i][j] = PIPE_NODES_START_ID +
- (i * PIPE_NODES_PER_SUBPORT) + j;
-
- if (rte_tm_node_add(port_id,
- h->pipe_node_id[i][j],
- pipe_parent_node_id,
- priority, weight, level_id,
- &pnp,
- error)) {
- printf("%s ERROR(%d)-%s!(node %u,parent %u )\n",
- __func__,
- error->type,
- error->message,
- h->pipe_node_id[i][j],
- pipe_parent_node_id);
-
- return -1;
- }
- shaper_profile_id++;
- }
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" Pipe nodes added (Start id %u, Count %u, level %u)\n",
- h->pipe_node_id[0][0], NUM_PIPE_NODES, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_tc_node_add(portid_t port_id,
- struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t tc_parent_node_id;
- struct rte_tm_node_params tnp;
- struct rte_tm_shaper_params tsp, tssp;
- uint32_t shared_shaper_profile_id[TC_NODES_PER_PIPE];
- uint32_t priority, weight, level_id, shaper_profile_id;
- uint32_t pos, n_tc_nodes, i, j, k;
-
- memset(&tsp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&tssp, 0, sizeof(struct rte_tm_shaper_params));
- memset(&tnp, 0, sizeof(struct rte_tm_node_params));
-
- shaper_profile_id = h->n_shapers;
-
- /* Private Shaper Profile (TC) Parameters */
- tsp.peak.rate = h->tc_node_shaper_rate;
- tsp.peak.size = TOKEN_BUCKET_SIZE;
- tsp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* Shared Shaper Profile (TC) Parameters */
- tssp.peak.rate = h->tc_node_shared_shaper_rate;
- tssp.peak.size = TOKEN_BUCKET_SIZE;
- tssp.pkt_length_adjust = RTE_TM_ETH_FRAMING_OVERHEAD_FCS;
-
- /* TC Node Parameters */
- weight = 1;
- level_id = TM_NODE_LEVEL_TC;
- tnp.n_shared_shapers = 1;
- tnp.nonleaf.n_sp_priorities = 1;
- tnp.stats_mask = STATS_MASK_DEFAULT;
-
- /* Add Shared Shaper Profiles to TM Hierarchy */
- for (i = 0; i < TC_NODES_PER_PIPE; i++) {
- shared_shaper_profile_id[i] = shaper_profile_id;
-
- if (rte_tm_shaper_profile_add(port_id,
- shared_shaper_profile_id[i], &tssp, error)) {
- printf("%s ERROR(%d)-%s!(Shared shaper profileid %u)\n",
- __func__, error->type, error->message,
- shared_shaper_profile_id[i]);
-
- return -1;
- }
- if (rte_tm_shared_shaper_add_update(port_id, i,
- shared_shaper_profile_id[i], error)) {
- printf("%s ERROR(%d)-%s!(Shared shaper id %u)\n",
- __func__, error->type, error->message, i);
-
- return -1;
- }
- shaper_profile_id++;
- }
-
- /* Add Shaper Profiles and Nodes to TM Hierarchy */
- n_tc_nodes = 0;
- for (i = 0; i < SUBPORT_NODES_PER_PORT; i++) {
- for (j = 0; j < PIPE_NODES_PER_SUBPORT; j++) {
- for (k = 0; k < TC_NODES_PER_PIPE ; k++) {
- priority = k;
- tc_parent_node_id = h->pipe_node_id[i][j];
- tnp.shared_shaper_id =
- (uint32_t *)calloc(1, sizeof(uint32_t));
- if (tnp.shared_shaper_id == NULL) {
- printf("Shared shaper mem alloc err\n");
- return -1;
- }
- tnp.shared_shaper_id[0] = k;
- pos = j + (i * PIPE_NODES_PER_SUBPORT);
- h->tc_node_id[pos][k] =
- TC_NODES_START_ID + n_tc_nodes;
-
- if (rte_tm_shaper_profile_add(port_id,
- shaper_profile_id, &tsp, error)) {
- printf("%s ERROR(%d)-%s!(shaper %u)\n",
- __func__, error->type,
- error->message,
- shaper_profile_id);
-
- free(tnp.shared_shaper_id);
- return -1;
- }
- tnp.shaper_profile_id = shaper_profile_id;
- if (rte_tm_node_add(port_id,
- h->tc_node_id[pos][k],
- tc_parent_node_id,
- priority, weight,
- level_id,
- &tnp, error)) {
- printf("%s ERROR(%d)-%s!(node id %u)\n",
- __func__,
- error->type,
- error->message,
- h->tc_node_id[pos][k]);
-
- free(tnp.shared_shaper_id);
- return -1;
- }
- shaper_profile_id++;
- n_tc_nodes++;
- }
- }
- }
- /* Update */
- h->n_shapers = shaper_profile_id;
-
- printf(" TC nodes added (Start id %u, Count %u, level %u)\n",
- h->tc_node_id[0][0], n_tc_nodes, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_queue_node_add(portid_t port_id, struct tm_hierarchy *h,
- struct rte_tm_error *error)
-{
- uint32_t queue_parent_node_id;
- struct rte_tm_node_params qnp;
- uint32_t priority, weight, level_id, pos;
- uint32_t n_queue_nodes, i, j, k;
-
- memset(&qnp, 0, sizeof(struct rte_tm_node_params));
-
- /* Queue Node Parameters */
- priority = 0;
- weight = 1;
- level_id = TM_NODE_LEVEL_QUEUE;
- qnp.shaper_profile_id = RTE_TM_SHAPER_PROFILE_ID_NONE;
- qnp.leaf.cman = RTE_TM_CMAN_TAIL_DROP;
- qnp.stats_mask = STATS_MASK_QUEUE;
-
- /* Add Queue Nodes to TM Hierarchy */
- n_queue_nodes = 0;
- for (i = 0; i < NUM_PIPE_NODES; i++) {
- for (j = 0; j < TC_NODES_PER_PIPE; j++) {
- queue_parent_node_id = h->tc_node_id[i][j];
- for (k = 0; k < QUEUE_NODES_PER_TC; k++) {
- pos = j + (i * TC_NODES_PER_PIPE);
- h->queue_node_id[pos][k] = n_queue_nodes;
- if (rte_tm_node_add(port_id,
- h->queue_node_id[pos][k],
- queue_parent_node_id,
- priority,
- weight,
- level_id,
- &qnp, error)) {
- printf("%s ERROR(%d)-%s!(node %u)\n",
- __func__,
- error->type,
- error->message,
- h->queue_node_id[pos][k]);
-
- return -1;
- }
- n_queue_nodes++;
- }
- }
- }
- printf(" Queue nodes added (Start id %u, Count %u, level %u)\n",
- h->queue_node_id[0][0], n_queue_nodes, level_id);
-
- return 0;
-}
-
-static int
-softport_tm_hierarchy_specify(portid_t port_id,
- struct rte_tm_error *error)
-{
-
- struct tm_hierarchy h;
- int status;
-
- memset(&h, 0, sizeof(struct tm_hierarchy));
-
- /* TM hierarchy shapers rate */
- status = set_tm_hiearchy_nodes_shaper_rate(port_id, &h);
- if (status)
- return status;
-
- /* Add root node (level 0) */
- status = softport_tm_root_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add subport node (level 1) */
- status = softport_tm_subport_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add pipe nodes (level 2) */
- status = softport_tm_pipe_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add traffic class nodes (level 3) */
- status = softport_tm_tc_node_add(port_id, &h, error);
- if (status)
- return status;
-
- /* Add queue nodes (level 4) */
- status = softport_tm_queue_node_add(port_id, &h, error);
- if (status)
- return status;
-
- return 0;
-}
-
-/*
- * Softnic TM default configuration
- */
-static void
-softnic_tm_default_config(portid_t pi)
-{
- struct rte_port *port = &ports[pi];
- struct rte_tm_error error;
- int status;
-
- /* Stop port */
- rte_eth_dev_stop(pi);
-
- /* TM hierarchy specification */
- status = softport_tm_hierarchy_specify(pi, &error);
- if (status) {
- printf(" TM Hierarchy built error(%d) - %s\n",
- error.type, error.message);
- return;
- }
- printf("\n TM Hierarchy Specified!\n");
-
- /* TM hierarchy commit */
- status = rte_tm_hierarchy_commit(pi, 0, &error);
- if (status) {
- printf(" Hierarchy commit error(%d) - %s\n",
- error.type, error.message);
- return;
- }
- printf(" Hierarchy Committed (port %u)!\n", pi);
-
- /* Start port */
- status = rte_eth_dev_start(pi);
- if (status) {
- printf("\n Port %u start error!\n", pi);
- return;
- }
-
- /* Reset the default hierarchy flag */
- port->softport.default_tm_hierarchy_enable = 0;
-}
-
-/*
- * Softnic forwarding init
- */
-static void
-softnic_fwd_begin(portid_t pi)
-{
- struct rte_port *port = &ports[pi];
- uint32_t lcore, fwd_core_present = 0, softnic_run_launch = 0;
- int status;
-
- softnic_fwd_lcore = port->softport.fwd_lcore_arg[0];
- softnic_port_id = pi;
-
- /* Launch softnic_run function on lcores */
- for (lcore = 0; lcore < RTE_MAX_LCORE; lcore++) {
- if (!rte_lcore_is_enabled(lcore))
- continue;
-
- if (lcore == rte_get_master_lcore())
- continue;
-
- if (fwd_core_present == 0) {
- fwd_core_present++;
- continue;
- }
-
- status = rte_eal_remote_launch(softnic_begin, NULL, lcore);
- if (status)
- printf("softnic launch on lcore %u failed (%d)\n",
- lcore, status);
-
- softnic_run_launch = 1;
- }
-
- if (!softnic_run_launch)
- softnic_fwd_engine.packet_fwd = softnic_fwd_run;
-
- /* Softnic TM default configuration */
- if (port->softport.default_tm_hierarchy_enable == 1)
- softnic_tm_default_config(pi);
-}
-
-struct fwd_engine softnic_fwd_engine = {
- .fwd_mode_name = "softnic",
- .port_fwd_begin = softnic_fwd_begin,
- .port_fwd_end = NULL,
- .packet_fwd = softnic_fwd,
-};
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 99bacddbf..463245ba2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -179,9 +179,6 @@ struct fwd_engine * fwd_engines[] = {
&csum_fwd_engine,
&icmp_echo_engine,
&noisy_vnf_engine,
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- &softnic_fwd_engine,
-#endif
#ifdef RTE_LIBRTE_IEEE1588
&ieee1588_fwd_engine,
#endif
@@ -1554,19 +1551,6 @@ init_config(void)
"rte_gro_ctx_create() failed\n");
}
}
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC
- if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
- RTE_ETH_FOREACH_DEV(pid) {
- port = &ports[pid];
- const char *driver = port->dev_info.driver_name;
-
- if (strcmp(driver, "net_softnic") == 0)
- port->softport.fwd_lcore_arg = fwd_lcores;
- }
- }
-#endif
-
}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 7ff4c5dba..ac9fdaa53 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -58,12 +58,6 @@ typedef uint16_t portid_t;
typedef uint16_t queueid_t;
typedef uint16_t streamid_t;
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-#define SOFTNIC 1
-#else
-#define SOFTNIC 0
-#endif
-
enum {
PORT_TOPOLOGY_PAIRED,
PORT_TOPOLOGY_CHAINED,
@@ -154,16 +148,6 @@ struct port_flow {
uint8_t data[]; /**< Storage for flow rule description */
};
-#ifdef SOFTNIC
-/**
- * The data structure associate with softnic port
- */
-struct softnic_port {
- uint32_t default_tm_hierarchy_enable; /**< default tm hierarchy */
- struct fwd_lcore **fwd_lcore_arg; /**< softnic fwd core parameters */
-};
-#endif
-
/**
* The data structure associated with each port.
*/
@@ -196,9 +180,6 @@ struct rte_port {
struct port_flow *flow_list; /**< Associated flows. */
const struct rte_eth_rxtx_callback *rx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
const struct rte_eth_rxtx_callback *tx_dump_cb[RTE_MAX_QUEUES_PER_PORT+1];
-#ifdef SOFTNIC
- struct softnic_port softport; /**< softnic params */
-#endif
/**< metadata value to insert in Tx packets. */
uint32_t tx_metadata;
const struct rte_eth_rxtx_callback *tx_set_md_cb[RTE_MAX_QUEUES_PER_PORT+1];
@@ -266,9 +247,6 @@ extern struct fwd_engine tx_only_engine;
extern struct fwd_engine csum_fwd_engine;
extern struct fwd_engine icmp_echo_engine;
extern struct fwd_engine noisy_vnf_engine;
-#ifdef SOFTNIC
-extern struct fwd_engine softnic_fwd_engine;
-#endif
#ifdef RTE_LIBRTE_IEEE1588
extern struct fwd_engine ieee1588_fwd_engine;
#endif
diff --git a/doc/guides/nics/softnic.rst b/doc/guides/nics/softnic.rst
index c8962d90b..8f0dd53ea 100644
--- a/doc/guides/nics/softnic.rst
+++ b/doc/guides/nics/softnic.rst
@@ -82,29 +82,56 @@ Soft NIC device instance:
#. ``tm_n_queues``: number of traffic manager's scheduler queues. The traffic manager
is based on DPDK *librte_sched* library. (Optional: yes, Default value: 65,536 queues)
-#. ``tm_qsize0``: size of scheduler queue 0 per traffic class of the pipes/subscribers.
+#. ``tm_qsize0``: size of scheduler queue 0 (traffic class 0) of the pipes/subscribers.
(Optional: yes, Default: 64)
-#. ``tm_qsize1``: size of scheduler queue 1 per traffic class of the pipes/subscribers.
+#. ``tm_qsize1``: size of scheduler queue 1 (traffic class 1) of the pipes/subscribers.
(Optional: yes, Default: 64)
-#. ``tm_qsize2``: size of scheduler queue 2 per traffic class of the pipes/subscribers.
+#. ``tm_qsize2``: size of scheduler queue 2 (traffic class 2) of the pipes/subscribers.
(Optional: yes, Default: 64)
-#. ``tm_qsize3``: size of scheduler queue 3 per traffic class of the pipes/subscribers.
+#. ``tm_qsize3``: size of scheduler queue 3 (traffic class 3) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize4``: size of scheduler queue 4 (traffic class 4) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize5``: size of scheduler queue 5 (traffic class 5) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize6``: size of scheduler queue 6 (traffic class 6) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize7``: size of scheduler queue 7 (traffic class 7) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize8``: size of scheduler queue 8 (traffic class 8) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize9``: size of scheduler queue 9 (traffic class 9) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize10``: size of scheduler queue 10 (traffic class 10) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize11``: size of scheduler queue 11 (traffic class 11) of the pipes/subscribers.
+ (Optional: yes, Default: 64)
+
+#. ``tm_qsize12``: size of scheduler queue 12 (traffic class 12) of the pipes/subscribers.
(Optional: yes, Default: 64)
Soft NIC testing
----------------
-* Run testpmd application in Soft NIC forwarding mode with loopback feature
+* Run testpmd application with Soft NIC device with loopback feature
enabled on Soft NIC port:
.. code-block:: console
- ./testpmd -c 0x3 --vdev 'net_softnic0,firmware=<script path>/firmware.cli,cpu_id=0,conn_port=8086' -- -i
- --forward-mode=softnic --portmask=0x2
+ ./testpmd -c 0x7 -s 0x4 --vdev 'net_softnic0,firmware=<script path>/firmware.cli,cpu_id=0,conn_port=8086' -- -i
+ --portmask=0x2
.. code-block:: console
@@ -133,8 +160,8 @@ Soft NIC testing
pipeline TX table match stub
pipeline TX port in 0 table 0
- thread 1 pipeline RX enable
- thread 1 pipeline TX enable
+ thread 2 pipeline RX enable
+ thread 2 pipeline TX enable
Port 1: 00:00:00:00:00:00
Checking link statuses...
Done
@@ -172,7 +199,8 @@ Soft NIC testing
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
-* Start remote client (e.g. telnet) to communicate with the softnic device:
+* Softnic device can be configured using remote client (e.g. telnet). However,
+ testpmd application doesn't support configuration through telnet :
.. code-block:: console
@@ -246,8 +274,8 @@ command description provided in `softnic/rte_eth_softnic_cli.c`.
.. code-block:: console
- thread 1 pipeline RX enable (Soft NIC rx pipeline enable on cpu thread id 1)
- thread 1 pipeline TX enable (Soft NIC tx pipeline enable on cpu thread id 1)
+ thread 2 pipeline RX enable (Soft NIC rx pipeline enable on cpu thread id 2)
+ thread 2 pipeline TX enable (Soft NIC tx pipeline enable on cpu thread id 2)
QoS API Support:
----------------
@@ -340,19 +368,19 @@ commands.
1.10.11.12 2.20.21.22 100 200 6 action fwd port 0
pipeline TX table 0 rule add match hash ipv4_5tuple
1.10.11.13 2.20.21.23 100 200 6 action fwd port 1
- thread 25 pipeline RX enable
- thread 25 pipeline TX enable
+ thread 2 pipeline RX enable
+ thread 2 pipeline TX enable
* Run testpmd:
.. code-block:: console
- ./x86_64-native-linux-gcc/app/testpmd -l 23-25 -n 4 \
+ ./x86_64-native-linux-gcc/app/testpmd -c 0x7 -s 0x4 -n 4 \
--vdev 'net_softnic0, \
firmware=./drivers/net/softnic/ \
firmware.cli, \
cpu_id=1,conn_port=8086' -- \
- -i --forward-mode=softnic --rxq=2, \
+ -i --rxq=2, \
--txq=2, --disable-rss --portmask=0x4
* Configure flow rules on softnic:
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a360ecccf..64f705ec6 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -329,9 +329,6 @@ The available information categories are:
* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
-* ``softnic``: Demonstrates the softnic forwarding operation. In this mode, packet forwarding is
- similar to I/O mode except for the fact that packets are loopback to the softnic ports only. Therefore, portmask parameter should be set to softnic port only. The various software based custom NIC pipelines specified through the softnic firmware (DPDK packet framework script) can be tested in this mode. Furthermore, it allows to build 5-level hierarchical QoS scheduler as a default option that can be enabled through CLI once testpmd application is initialised. The user can modify the default scheduler hierarchy or can specify the new QoS Scheduler hierarchy through CLI. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y``.
-
* ``noisy``: Noisy neighbor simulation.
Simulate more realistic behavior of a guest machine engaged in receiving
and sending packets performing Virtual Network Function (VNF).
@@ -3106,13 +3103,6 @@ where:
* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
to ecn of 2'b11 when IP is caring TCP or SCTP
-Set port traffic management default hierarchy (softnic forwarding mode)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-set the traffic management default hierarchy on the port::
-
- testpmd> set port tm hierarchy default (port_id)
-
Filter Functions
----------------
--
2.21.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] app/testpmd: remove softnic forward mode
2020-06-23 9:32 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
@ 2020-07-10 16:59 ` Ferruh Yigit
0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2020-07-10 16:59 UTC (permalink / raw)
To: Jasvinder Singh, dev; +Cc: cristian.dumitrescu
On 6/23/2020 10:32 AM, Jasvinder Singh wrote:
> Softnic can be used like other virtual devices without
> needing any special mode. Therefore, remove softnic mode
> from testpmd app. Documentation is updated as well.
>
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-10 16:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 15:51 [dpdk-dev] [PATCH] app/testpmd: remove softnic forward mode Jasvinder Singh
2020-06-23 7:38 ` Phil Yang
2020-06-23 8:38 ` Singh, Jasvinder
2020-06-23 8:41 ` David Marchand
2020-06-23 8:49 ` Singh, Jasvinder
2020-06-23 9:32 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
2020-07-10 16:59 ` Ferruh Yigit
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).