From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Xiaoyun Li <xiaoyun.li@intel.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>,
Beilei Xing <beilei.xing@intel.com>
Subject: [PATCH v2] net/i40e: move testpmd commands
Date: Fri, 17 Jun 2022 07:07:26 +0200 [thread overview]
Message-ID: <20220617050726.1273231-1-david.marchand@redhat.com> (raw)
In-Reply-To: <20220523071031.1868862-5-david.marchand@redhat.com>
Move related specific testpmd commands into this driver directory.
While at it, fix checkpatch warnings.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- rebased on next-net,
- updated link in documentation to directly point at commands,
Changes since RFC v2:
- updated documentation,
- fixed some indent,
Changes since RFC v1:
- moved more i40e commands,
- fixed checkpatch warnings,
---
app/test-pmd/cmdline.c | 5438 +++++--------------
app/test-pmd/config.c | 43 -
app/test-pmd/testpmd.h | 2 -
doc/guides/nics/i40e.rst | 186 +-
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 178 +-
drivers/net/i40e/i40e_testpmd.c | 2634 +++++++++
drivers/net/i40e/meson.build | 2 +
7 files changed, 4185 insertions(+), 4298 deletions(-)
create mode 100644 drivers/net/i40e/i40e_testpmd.c
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a59e6166d5..23cf663d3f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -196,21 +196,12 @@ static void cmd_help_long_parsed(void *parsed_result,
"read txd (port_id) (queue_id) (txd_id)\n"
" Display a TX descriptor of a port TX queue.\n\n"
- "ddp get list (port_id)\n"
- " Get ddp profile info list\n\n"
-
- "ddp get info (profile_path)\n"
- " Get ddp profile information.\n\n"
-
"show vf stats (port_id) (vf_id)\n"
" Display a VF's statistics.\n\n"
"clear vf stats (port_id) (vf_id)\n"
" Reset a VF's statistics.\n\n"
- "show port (port_id) pctype mapping\n"
- " Get flow ptype to pctype mapping on a port\n\n"
-
"show port meter stats (port_id) (meter_id) (clear)\n"
" Get meter stats on a port\n\n"
@@ -366,9 +357,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)\n"
" Configure MACsec secure association (SA).\n\n"
- "set vf broadcast (port_id) (vf_id) (on|off)\n"
- " Set VF broadcast for a VF from the PF.\n\n"
-
"vlan set stripq (on|off) (port_id,queue_id)\n"
" Set the VLAN strip for a queue on a port.\n\n"
@@ -381,21 +369,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"set vf vlan antispoof (port_id) (vf_id) (on|off)\n"
" Set VLAN antispoof for a VF from the PF.\n\n"
- "set vf vlan tag (port_id) (vf_id) (on|off)\n"
- " Set VLAN tag for a VF from the PF.\n\n"
-
- "set vf tx max-bandwidth (port_id) (vf_id) (bandwidth)\n"
- " Set a VF's max bandwidth(Mbps).\n\n"
-
- "set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)\n"
- " Set all TCs' min bandwidth(%%) on a VF.\n\n"
-
- "set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (bandwidth)\n"
- " Set a TC's max bandwidth(Mbps) on a VF.\n\n"
-
- "set tx strict-link-priority (port_id) (tc_bitmap)\n"
- " Set some TCs' strict link priority mode on a physical port.\n\n"
-
"set tc tx min-bandwidth (port_id) (bw1, bw2, ...)\n"
" Set all TCs' min bandwidth(%%) for all PF and VFs.\n\n"
@@ -524,12 +497,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"set allmulti (port_id|all) (on|off)\n"
" Set the allmulti mode on port_id, or all.\n\n"
- "set vf promisc (port_id) (vf_id) (on|off)\n"
- " Set unicast promiscuous mode for a VF from the PF.\n\n"
-
- "set vf allmulti (port_id) (vf_id) (on|off)\n"
- " Set multicast promiscuous mode for a VF from the PF.\n\n"
-
"set flow_ctrl rx (on|off) tx (on|off) (high_water)"
" (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd"
" (on|off) autoneg (on|off) (port_id)\n"
@@ -661,42 +628,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"set link-down port (port_id)\n"
" Set link down for a port.\n\n"
- "ddp add (port_id) (profile_path[,backup_profile_path])\n"
- " Load a profile package on a port\n\n"
-
- "ddp del (port_id) (backup_profile_path)\n"
- " Delete a profile package from a port\n\n"
-
- "ptype mapping get (port_id) (valid_only)\n"
- " Get ptype mapping on a port\n\n"
-
- "ptype mapping replace (port_id) (target) (mask) (pky_type)\n"
- " Replace target with the pkt_type in ptype mapping\n\n"
-
- "ptype mapping reset (port_id)\n"
- " Reset ptype mapping on a port\n\n"
-
- "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
- " Update a ptype mapping item on a port\n\n"
-
"set port (port_id) ptype_mask (ptype_mask)\n"
" set packet types classification for a specific port\n\n"
- "set port (port_id) queue-region region_id (value) "
- "queue_start_index (value) queue_num (value)\n"
- " Set a queue region on a port\n\n"
-
- "set port (port_id) queue-region region_id (value) "
- "flowtype (value)\n"
- " Set a flowtype region index on a port\n\n"
-
- "set port (port_id) queue-region UP (value) region_id (value)\n"
- " Set the mapping of User Priority to "
- "queue region on a port\n\n"
-
- "set port (port_id) queue-region flush (on|off)\n"
- " flush all queue region related configuration\n\n"
-
"show port meter cap (port_id)\n"
" Show port meter capability information\n\n"
@@ -747,9 +681,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"set port meter stats mask (port_id) (mtr_id) (stats_mask)\n"
" meter update stats\n\n"
- "show port (port_id) queue-region\n"
- " show all queue region related configuration info\n\n"
-
"set port (port_id) fec_mode auto|off|rs|baser\n"
" set fec mode for a specific port\n\n"
@@ -846,22 +777,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"port (port_id) (rxq|txq) (queue_id) setup\n"
" Setup a rx/tx queue of port X.\n\n"
- "port config (port_id) pctype mapping reset\n"
- " Reset flow type to pctype mapping on a port\n\n"
-
- "port config (port_id) pctype mapping update"
- " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
- " Update a flow type to pctype mapping item on a port\n\n"
-
- "port config (port_id) pctype (pctype_id) hash_inset|"
- "fdir_inset|fdir_flx_inset get|set|clear field\n"
- " (field_idx)\n"
- " Configure RSS|FDIR|FDIR_FLX input set for some pctype\n\n"
-
- "port config (port_id) pctype (pctype_id) hash_inset|"
- "fdir_inset|fdir_flx_inset clear all"
- " Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n\n"
-
"port config (port_id) udp_tunnel_port add|rm vxlan|geneve|ecpri (udp_port)\n\n"
" Add/remove UDP tunnel port for tunneling offload\n\n"
@@ -957,13 +872,6 @@ static void cmd_help_long_parsed(void *parsed_result,
"filters:\n"
"--------\n\n"
-#ifdef RTE_NET_I40E
- "flow_director_filter (port_id) mode raw (add|del|update)"
- " flow (flow_id) (drop|fwd) queue (queue_id)"
- " fd_id (fd_id_value) packet (packet file name)\n"
- " Add/Del a raw type flow director filter.\n\n"
-#endif
-
"flow_director_mask (port_id) mode IP vlan (vlan_value)"
" src_mask (ipv4_src) (ipv6_src) (src_port)"
" dst_mask (ipv4_dst) (ipv6_dst) (dst_port)\n"
@@ -10125,450 +10033,6 @@ static cmdline_parse_inst_t cmd_dump_one = {
},
};
-/* *** queue region set *** */
-struct cmd_queue_region_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t cmd;
- cmdline_fixed_string_t region;
- uint8_t region_id;
- cmdline_fixed_string_t queue_start_index;
- uint8_t queue_id;
- cmdline_fixed_string_t queue_num;
- uint8_t queue_num_value;
-};
-
-static void
-cmd_queue_region_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_queue_region_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_queue_region_conf region_conf;
- enum rte_pmd_i40e_queue_region_op op_type;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- memset(®ion_conf, 0, sizeof(region_conf));
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_SET;
- region_conf.region_id = res->region_id;
- region_conf.queue_num = res->queue_num_value;
- region_conf.queue_start_index = res->queue_id;
-
- ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
- op_type, ®ion_conf);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented or supported\n");
- break;
- default:
- fprintf(stderr, "queue region config error: (%s)\n",
- strerror(-ret));
- }
-}
-
-static cmdline_parse_token_string_t cmd_queue_region_set =
-TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_queue_region_port =
- TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result, port, "port");
-static cmdline_parse_token_num_t cmd_queue_region_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_queue_region_cmd =
- TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
- cmd, "queue-region");
-static cmdline_parse_token_string_t cmd_queue_region_id =
- TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
- region, "region_id");
-static cmdline_parse_token_num_t cmd_queue_region_index =
- TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
- region_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
- TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
- queue_start_index, "queue_start_index");
-static cmdline_parse_token_num_t cmd_queue_region_queue_id =
- TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
- queue_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_queue_region_queue_num =
- TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
- queue_num, "queue_num");
-static cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
- TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
- queue_num_value, RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_queue_region = {
- .f = cmd_queue_region_parsed,
- .data = NULL,
- .help_str = "set port <port_id> queue-region region_id <value> "
- "queue_start_index <value> queue_num <value>: Set a queue region",
- .tokens = {
- (void *)&cmd_queue_region_set,
- (void *)&cmd_queue_region_port,
- (void *)&cmd_queue_region_port_id,
- (void *)&cmd_queue_region_cmd,
- (void *)&cmd_queue_region_id,
- (void *)&cmd_queue_region_index,
- (void *)&cmd_queue_region_queue_start_index,
- (void *)&cmd_queue_region_queue_id,
- (void *)&cmd_queue_region_queue_num,
- (void *)&cmd_queue_region_queue_num_value,
- NULL,
- },
-};
-
-/* *** queue region and flowtype set *** */
-struct cmd_region_flowtype_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t cmd;
- cmdline_fixed_string_t region;
- uint8_t region_id;
- cmdline_fixed_string_t flowtype;
- uint8_t flowtype_id;
-};
-
-static void
-cmd_region_flowtype_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_region_flowtype_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_queue_region_conf region_conf;
- enum rte_pmd_i40e_queue_region_op op_type;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- memset(®ion_conf, 0, sizeof(region_conf));
-
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_FLOWTYPE_SET;
- region_conf.region_id = res->region_id;
- region_conf.hw_flowtype = res->flowtype_id;
-
- ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
- op_type, ®ion_conf);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented or supported\n");
- break;
- default:
- fprintf(stderr, "region flowtype config error: (%s)\n",
- strerror(-ret));
- }
-}
-
-static cmdline_parse_token_string_t cmd_region_flowtype_set =
-TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_region_flowtype_port =
- TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
- port, "port");
-static cmdline_parse_token_num_t cmd_region_flowtype_port_index =
- TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_region_flowtype_cmd =
- TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
- cmd, "queue-region");
-static cmdline_parse_token_string_t cmd_region_flowtype_index =
- TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
- region, "region_id");
-static cmdline_parse_token_num_t cmd_region_flowtype_id =
- TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
- region_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
- TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
- flowtype, "flowtype");
-static cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
- TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
- flowtype_id, RTE_UINT8);
-static cmdline_parse_inst_t cmd_region_flowtype = {
- .f = cmd_region_flowtype_parsed,
- .data = NULL,
- .help_str = "set port <port_id> queue-region region_id <value> "
- "flowtype <value>: Set a flowtype region index",
- .tokens = {
- (void *)&cmd_region_flowtype_set,
- (void *)&cmd_region_flowtype_port,
- (void *)&cmd_region_flowtype_port_index,
- (void *)&cmd_region_flowtype_cmd,
- (void *)&cmd_region_flowtype_index,
- (void *)&cmd_region_flowtype_id,
- (void *)&cmd_region_flowtype_flow_index,
- (void *)&cmd_region_flowtype_flow_id,
- NULL,
- },
-};
-
-/* *** User Priority (UP) to queue region (region_id) set *** */
-struct cmd_user_priority_region_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t cmd;
- cmdline_fixed_string_t user_priority;
- uint8_t user_priority_id;
- cmdline_fixed_string_t region;
- uint8_t region_id;
-};
-
-static void
-cmd_user_priority_region_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_user_priority_region_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_queue_region_conf region_conf;
- enum rte_pmd_i40e_queue_region_op op_type;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- memset(®ion_conf, 0, sizeof(region_conf));
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_USER_PRIORITY_SET;
- region_conf.user_priority = res->user_priority_id;
- region_conf.region_id = res->region_id;
-
- ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
- op_type, ®ion_conf);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented or supported\n");
- break;
- default:
- fprintf(stderr, "user_priority region config error: (%s)\n",
- strerror(-ret));
- }
-}
-
-static cmdline_parse_token_string_t cmd_user_priority_region_set =
- TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_user_priority_region_port =
- TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
- port, "port");
-static cmdline_parse_token_num_t cmd_user_priority_region_port_index =
- TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_user_priority_region_cmd =
- TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
- cmd, "queue-region");
-static cmdline_parse_token_string_t cmd_user_priority_region_UP =
- TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
- user_priority, "UP");
-static cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
- TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
- user_priority_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_user_priority_region_region =
- TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
- region, "region_id");
-static cmdline_parse_token_num_t cmd_user_priority_region_region_id =
- TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
- region_id, RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_user_priority_region = {
- .f = cmd_user_priority_region_parsed,
- .data = NULL,
- .help_str = "set port <port_id> queue-region UP <value> "
- "region_id <value>: Set the mapping of User Priority (UP) "
- "to queue region (region_id) ",
- .tokens = {
- (void *)&cmd_user_priority_region_set,
- (void *)&cmd_user_priority_region_port,
- (void *)&cmd_user_priority_region_port_index,
- (void *)&cmd_user_priority_region_cmd,
- (void *)&cmd_user_priority_region_UP,
- (void *)&cmd_user_priority_region_UP_id,
- (void *)&cmd_user_priority_region_region,
- (void *)&cmd_user_priority_region_region_id,
- NULL,
- },
-};
-
-/* *** flush all queue region related configuration *** */
-struct cmd_flush_queue_region_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t cmd;
- cmdline_fixed_string_t flush;
- cmdline_fixed_string_t what;
-};
-
-static void
-cmd_flush_queue_region_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_flush_queue_region_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_queue_region_conf region_conf;
- enum rte_pmd_i40e_queue_region_op op_type;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- memset(®ion_conf, 0, sizeof(region_conf));
-
- if (strcmp(res->what, "on") == 0)
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
- else
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
-
- ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
- op_type, ®ion_conf);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented or supported\n");
- break;
- default:
- fprintf(stderr, "queue region config flush error: (%s)\n",
- strerror(-ret));
- }
-}
-
-static cmdline_parse_token_string_t cmd_flush_queue_region_set =
- TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_flush_queue_region_port =
- TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
- port, "port");
-static cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
- TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
- TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
- cmd, "queue-region");
-static cmdline_parse_token_string_t cmd_flush_queue_region_flush =
- TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
- flush, "flush");
-static cmdline_parse_token_string_t cmd_flush_queue_region_what =
- TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
- what, "on#off");
-
-static cmdline_parse_inst_t cmd_flush_queue_region = {
- .f = cmd_flush_queue_region_parsed,
- .data = NULL,
- .help_str = "set port <port_id> queue-region flush on|off"
- ": flush all queue region related configuration",
- .tokens = {
- (void *)&cmd_flush_queue_region_set,
- (void *)&cmd_flush_queue_region_port,
- (void *)&cmd_flush_queue_region_port_index,
- (void *)&cmd_flush_queue_region_cmd,
- (void *)&cmd_flush_queue_region_flush,
- (void *)&cmd_flush_queue_region_what,
- NULL,
- },
-};
-
-/* *** get all queue region related configuration info *** */
-struct cmd_show_queue_region_info {
- cmdline_fixed_string_t show;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t cmd;
-};
-
-static void
-cmd_show_queue_region_info_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_show_queue_region_info *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_queue_regions rte_pmd_regions;
- enum rte_pmd_i40e_queue_region_op op_type;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- memset(&rte_pmd_regions, 0, sizeof(rte_pmd_regions));
-
- op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
-
- ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
- op_type, &rte_pmd_regions);
-
- port_queue_region_info_display(res->port_id, &rte_pmd_regions);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented or supported\n");
- break;
- default:
- fprintf(stderr, "queue region config info show error: (%s)\n",
- strerror(-ret));
- }
-}
-
-static cmdline_parse_token_string_t cmd_show_queue_region_info_get =
-TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
- show, "show");
-static cmdline_parse_token_string_t cmd_show_queue_region_info_port =
- TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
- port, "port");
-static cmdline_parse_token_num_t cmd_show_queue_region_info_port_index =
- TOKEN_NUM_INITIALIZER(struct cmd_show_queue_region_info,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_queue_region_info_cmd =
- TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
- cmd, "queue-region");
-
-static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
- .f = cmd_show_queue_region_info_parsed,
- .data = NULL,
- .help_str = "show port <port_id> queue-region"
- ": show all queue region related configuration info",
- .tokens = {
- (void *)&cmd_show_queue_region_info_get,
- (void *)&cmd_show_queue_region_info_port,
- (void *)&cmd_show_queue_region_info_port_index,
- (void *)&cmd_show_queue_region_info_cmd,
- NULL,
- },
-};
-
/* *** Filters Control *** */
#define IPV4_ADDR_TO_UINT(ip_addr, ip) \
@@ -10593,197 +10057,9 @@ do { \
} \
} while (0)
-#ifdef RTE_NET_I40E
-
-static uint16_t
-str2flowtype(char *string)
-{
- uint8_t i = 0;
- static const struct {
- char str[32];
- uint16_t type;
- } flowtype_str[] = {
- {"raw", RTE_ETH_FLOW_RAW},
- {"ipv4", RTE_ETH_FLOW_IPV4},
- {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
- {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
- {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
- {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
- {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
- {"ipv6", RTE_ETH_FLOW_IPV6},
- {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
- {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
- {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
- {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
- {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
- {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
- {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
- {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
- {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
- {"gtpu", RTE_ETH_FLOW_GTPU},
- };
-
- for (i = 0; i < RTE_DIM(flowtype_str); i++) {
- if (!strcmp(flowtype_str[i].str, string))
- return flowtype_str[i].type;
- }
-
- if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
- return (uint16_t)atoi(string);
-
- return RTE_ETH_FLOW_UNKNOWN;
-}
-
-/* *** deal with flow director filter *** */
-struct cmd_flow_director_result {
- cmdline_fixed_string_t flow_director_filter;
- portid_t port_id;
- cmdline_fixed_string_t mode;
- cmdline_fixed_string_t mode_value;
- cmdline_fixed_string_t ops;
- cmdline_fixed_string_t flow;
- cmdline_fixed_string_t flow_type;
- cmdline_fixed_string_t drop;
- cmdline_fixed_string_t queue;
- uint16_t queue_id;
- cmdline_fixed_string_t fd_id;
- uint32_t fd_id_value;
- cmdline_fixed_string_t packet;
- char filepath[];
-};
-
-static void
-cmd_flow_director_filter_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_flow_director_result *res = parsed_result;
- int ret = 0;
- struct rte_pmd_i40e_flow_type_mapping
- mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
- struct rte_pmd_i40e_pkt_template_conf conf;
- uint16_t flow_type = str2flowtype(res->flow_type);
- uint16_t i, port = res->port_id;
- uint8_t add;
-
- memset(&conf, 0, sizeof(conf));
-
- if (flow_type == RTE_ETH_FLOW_UNKNOWN) {
- fprintf(stderr, "Invalid flow type specified.\n");
- return;
- }
- ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id,
- mapping);
- if (ret)
- return;
- if (mapping[flow_type].pctype == 0ULL) {
- fprintf(stderr, "Invalid flow type specified.\n");
- return;
- }
- for (i = 0; i < RTE_PMD_I40E_PCTYPE_MAX; i++) {
- if (mapping[flow_type].pctype & (1ULL << i)) {
- conf.input.pctype = i;
- break;
- }
- }
-
- conf.input.packet = open_file(res->filepath,
- &conf.input.length);
- if (!conf.input.packet)
- return;
- if (!strcmp(res->drop, "drop"))
- conf.action.behavior =
- RTE_PMD_I40E_PKT_TEMPLATE_REJECT;
- else
- conf.action.behavior =
- RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT;
- conf.action.report_status =
- RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID;
- conf.action.rx_queue = res->queue_id;
- conf.soft_id = res->fd_id_value;
- add = strcmp(res->ops, "del") ? 1 : 0;
- ret = rte_pmd_i40e_flow_add_del_packet_template(port,
- &conf,
- add);
- if (ret < 0)
- fprintf(stderr, "flow director config error: (%s)\n",
- strerror(-ret));
- close_file(conf.input.packet);
-}
-
-static cmdline_parse_token_string_t cmd_flow_director_filter =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- flow_director_filter, "flow_director_filter");
-static cmdline_parse_token_num_t cmd_flow_director_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_flow_director_ops =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- ops, "add#del#update");
-static cmdline_parse_token_string_t cmd_flow_director_flow =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- flow, "flow");
-static cmdline_parse_token_string_t cmd_flow_director_flow_type =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- flow_type, NULL);
-static cmdline_parse_token_string_t cmd_flow_director_drop =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- drop, "drop#fwd");
-static cmdline_parse_token_string_t cmd_flow_director_queue =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- queue, "queue");
-static cmdline_parse_token_num_t cmd_flow_director_queue_id =
- TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
- queue_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_flow_director_fd_id =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- fd_id, "fd_id");
-static cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
- TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
- fd_id_value, RTE_UINT32);
-
-static cmdline_parse_token_string_t cmd_flow_director_mode =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- mode, "mode");
-static cmdline_parse_token_string_t cmd_flow_director_mode_raw =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- mode_value, "raw");
-static cmdline_parse_token_string_t cmd_flow_director_packet =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- packet, "packet");
-static cmdline_parse_token_string_t cmd_flow_director_filepath =
- TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
- filepath, NULL);
-
-static cmdline_parse_inst_t cmd_add_del_raw_flow_director = {
- .f = cmd_flow_director_filter_parsed,
- .data = NULL,
- .help_str = "flow_director_filter ... : Add or delete a raw flow "
- "director entry on NIC",
- .tokens = {
- (void *)&cmd_flow_director_filter,
- (void *)&cmd_flow_director_port_id,
- (void *)&cmd_flow_director_mode,
- (void *)&cmd_flow_director_mode_raw,
- (void *)&cmd_flow_director_ops,
- (void *)&cmd_flow_director_flow,
- (void *)&cmd_flow_director_flow_type,
- (void *)&cmd_flow_director_drop,
- (void *)&cmd_flow_director_queue,
- (void *)&cmd_flow_director_queue_id,
- (void *)&cmd_flow_director_fd_id,
- (void *)&cmd_flow_director_fd_id_value,
- (void *)&cmd_flow_director_packet,
- (void *)&cmd_flow_director_filepath,
- NULL,
- },
-};
-
-#endif /* RTE_NET_I40E */
-
-/* *** deal with flow director mask *** */
-struct cmd_flow_director_mask_result {
- cmdline_fixed_string_t flow_director_mask;
+/* *** deal with flow director mask *** */
+struct cmd_flow_director_mask_result {
+ cmdline_fixed_string_t flow_director_mask;
portid_t port_id;
cmdline_fixed_string_t mode;
cmdline_fixed_string_t mode_value;
@@ -12390,249 +11666,121 @@ static cmdline_parse_inst_t cmd_set_macsec_sa = {
},
};
-/* VF unicast promiscuous mode configuration */
-
-/* Common result structure for VF unicast promiscuous mode */
-struct cmd_vf_promisc_result {
+/* Common definition of VF and TC TX bandwidth configuration */
+struct cmd_vf_tc_bw_result {
cmdline_fixed_string_t set;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t promisc;
+ cmdline_fixed_string_t tc;
+ cmdline_fixed_string_t tx;
+ cmdline_fixed_string_t min_bw;
portid_t port_id;
- uint32_t vf_id;
- cmdline_fixed_string_t on_off;
+ cmdline_fixed_string_t bw_list;
};
-/* Common CLI fields for VF unicast promiscuous mode enable disable */
-static cmdline_parse_token_string_t cmd_vf_promisc_set =
+static cmdline_parse_token_string_t cmd_vf_tc_bw_set =
TOKEN_STRING_INITIALIZER
- (struct cmd_vf_promisc_result,
+ (struct cmd_vf_tc_bw_result,
set, "set");
-static cmdline_parse_token_string_t cmd_vf_promisc_vf =
+static cmdline_parse_token_string_t cmd_vf_tc_bw_tc =
TOKEN_STRING_INITIALIZER
- (struct cmd_vf_promisc_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_vf_promisc_promisc =
+ (struct cmd_vf_tc_bw_result,
+ tc, "tc");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_tx =
+ TOKEN_STRING_INITIALIZER
+ (struct cmd_vf_tc_bw_result,
+ tx, "tx");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_min_bw =
TOKEN_STRING_INITIALIZER
- (struct cmd_vf_promisc_result,
- promisc, "promisc");
-static cmdline_parse_token_num_t cmd_vf_promisc_port_id =
+ (struct cmd_vf_tc_bw_result,
+ min_bw, "min-bandwidth");
+static cmdline_parse_token_num_t cmd_vf_tc_bw_port_id =
TOKEN_NUM_INITIALIZER
- (struct cmd_vf_promisc_result,
+ (struct cmd_vf_tc_bw_result,
port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_vf_promisc_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_promisc_result,
- vf_id, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_vf_promisc_on_off =
+static cmdline_parse_token_string_t cmd_vf_tc_bw_bw_list =
TOKEN_STRING_INITIALIZER
- (struct cmd_vf_promisc_result,
- on_off, "on#off");
+ (struct cmd_vf_tc_bw_result,
+ bw_list, NULL);
-static void
-cmd_set_vf_promisc_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
+static int
+vf_tc_min_bw_parse_bw_list(uint8_t *bw_list,
+ uint8_t *tc_num,
+ char *str)
{
- struct cmd_vf_promisc_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id,
- res->vf_id, is_on);
-#endif
+ uint32_t size;
+ const char *p, *p0 = str;
+ char s[256];
+ char *end;
+ char *str_fld[16];
+ uint16_t i;
+ int ret;
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ p = strchr(p0, '(');
+ if (p == NULL) {
+ fprintf(stderr,
+ "The bandwidth-list should be '(bw1, bw2, ...)'\n");
+ return -1;
}
-}
-
-static cmdline_parse_inst_t cmd_set_vf_promisc = {
- .f = cmd_set_vf_promisc_parsed,
- .data = NULL,
- .help_str = "set vf promisc <port_id> <vf_id> on|off: "
- "Set unicast promiscuous mode for a VF from the PF",
- .tokens = {
- (void *)&cmd_vf_promisc_set,
- (void *)&cmd_vf_promisc_vf,
- (void *)&cmd_vf_promisc_promisc,
- (void *)&cmd_vf_promisc_port_id,
- (void *)&cmd_vf_promisc_vf_id,
- (void *)&cmd_vf_promisc_on_off,
- NULL,
- },
-};
-
-/* VF multicast promiscuous mode configuration */
-
-/* Common result structure for VF multicast promiscuous mode */
-struct cmd_vf_allmulti_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t allmulti;
- portid_t port_id;
- uint32_t vf_id;
- cmdline_fixed_string_t on_off;
-};
+ p++;
+ p0 = strchr(p, ')');
+ if (p0 == NULL) {
+ fprintf(stderr,
+ "The bandwidth-list should be '(bw1, bw2, ...)'\n");
+ return -1;
+ }
+ size = p0 - p;
+ if (size >= sizeof(s)) {
+ fprintf(stderr,
+ "The string size exceeds the internal buffer size\n");
+ return -1;
+ }
+ snprintf(s, sizeof(s), "%.*s", size, p);
+ ret = rte_strsplit(s, sizeof(s), str_fld, 16, ',');
+ if (ret <= 0) {
+ fprintf(stderr, "Failed to get the bandwidth list.\n");
+ return -1;
+ }
+ *tc_num = ret;
+ for (i = 0; i < ret; i++)
+ bw_list[i] = (uint8_t)strtoul(str_fld[i], &end, 0);
-/* Common CLI fields for VF multicast promiscuous mode enable disable */
-static cmdline_parse_token_string_t cmd_vf_allmulti_set =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_allmulti_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_vf_allmulti_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_allmulti_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_vf_allmulti_allmulti =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_allmulti_result,
- allmulti, "allmulti");
-static cmdline_parse_token_num_t cmd_vf_allmulti_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_allmulti_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_vf_allmulti_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_allmulti_result,
- vf_id, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_vf_allmulti_on_off =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_allmulti_result,
- on_off, "on#off");
+ return 0;
+}
static void
-cmd_set_vf_allmulti_parsed(
+cmd_tc_min_bw_parsed(
void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_vf_allmulti_result *res = parsed_result;
+ struct cmd_vf_tc_bw_result *res = parsed_result;
+ struct rte_port *port;
+ uint8_t tc_num;
+ uint8_t bw[16];
int ret = -ENOTSUP;
- __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
-
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id,
- res->vf_id, is_on);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ port = &ports[res->port_id];
+ /** Check if the port is not started **/
+ if (port->port_status != RTE_PORT_STOPPED) {
+ fprintf(stderr, "Please stop port %d first\n", res->port_id);
+ return;
}
-}
-
-static cmdline_parse_inst_t cmd_set_vf_allmulti = {
- .f = cmd_set_vf_allmulti_parsed,
- .data = NULL,
- .help_str = "set vf allmulti <port_id> <vf_id> on|off: "
- "Set multicast promiscuous mode for a VF from the PF",
- .tokens = {
- (void *)&cmd_vf_allmulti_set,
- (void *)&cmd_vf_allmulti_vf,
- (void *)&cmd_vf_allmulti_allmulti,
- (void *)&cmd_vf_allmulti_port_id,
- (void *)&cmd_vf_allmulti_vf_id,
- (void *)&cmd_vf_allmulti_on_off,
- NULL,
- },
-};
-
-/* vf broadcast mode configuration */
-
-/* Common result structure for vf broadcast */
-struct cmd_set_vf_broadcast_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t broadcast;
- portid_t port_id;
- uint16_t vf_id;
- cmdline_fixed_string_t on_off;
-};
-
-/* Common CLI fields for vf broadcast enable disable */
-static cmdline_parse_token_string_t cmd_set_vf_broadcast_set =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_set_vf_broadcast_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- broadcast, "broadcast");
-static cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- vf_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_broadcast_result,
- on_off, "on#off");
-
-static void
-cmd_set_vf_broadcast_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_vf_broadcast_result *res = parsed_result;
- int ret = -ENOTSUP;
- __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
+ if (ret)
return;
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_broadcast(res->port_id,
- res->vf_id, is_on);
+#ifdef RTE_NET_IXGBE
+ ret = rte_pmd_ixgbe_set_tc_bw_alloc(res->port_id, tc_num, bw);
#endif
switch (ret) {
case 0:
break;
case -EINVAL:
- fprintf(stderr, "invalid vf_id %d or is_on %d\n",
- res->vf_id, is_on);
+ fprintf(stderr, "invalid bandwidth\n");
break;
case -ENODEV:
fprintf(stderr, "invalid port_id %d\n", res->port_id);
@@ -12645,3200 +11793,1434 @@ cmd_set_vf_broadcast_parsed(
}
}
-static cmdline_parse_inst_t cmd_set_vf_broadcast = {
- .f = cmd_set_vf_broadcast_parsed,
+static cmdline_parse_inst_t cmd_tc_min_bw = {
+ .f = cmd_tc_min_bw_parsed,
.data = NULL,
- .help_str = "set vf broadcast <port_id> <vf_id> on|off",
+ .help_str = "set tc tx min-bandwidth <port_id> <bw1, bw2, ...>",
.tokens = {
- (void *)&cmd_set_vf_broadcast_set,
- (void *)&cmd_set_vf_broadcast_vf,
- (void *)&cmd_set_vf_broadcast_broadcast,
- (void *)&cmd_set_vf_broadcast_port_id,
- (void *)&cmd_set_vf_broadcast_vf_id,
- (void *)&cmd_set_vf_broadcast_on_off,
+ (void *)&cmd_vf_tc_bw_set,
+ (void *)&cmd_vf_tc_bw_tc,
+ (void *)&cmd_vf_tc_bw_tx,
+ (void *)&cmd_vf_tc_bw_min_bw,
+ (void *)&cmd_vf_tc_bw_port_id,
+ (void *)&cmd_vf_tc_bw_bw_list,
NULL,
},
};
-/* vf vlan tag configuration */
-
-/* Common result structure for vf vlan tag */
-struct cmd_set_vf_vlan_tag_result {
+/** Set VXLAN encapsulation details */
+struct cmd_set_vxlan_result {
cmdline_fixed_string_t set;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t vlan;
- cmdline_fixed_string_t tag;
- portid_t port_id;
- uint16_t vf_id;
- cmdline_fixed_string_t on_off;
-};
-
-/* Common CLI fields for vf vlan tag enable disable */
-static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- vlan, "vlan");
-static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- tag, "tag");
-static cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- vf_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off =
- TOKEN_STRING_INITIALIZER
- (struct cmd_set_vf_vlan_tag_result,
- on_off, "on#off");
-
-static void
-cmd_set_vf_vlan_tag_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_vf_vlan_tag_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_vlan_tag(res->port_id,
- res->vf_id, is_on);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d or is_on %d\n",
- res->vf_id, is_on);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_set_vf_vlan_tag = {
- .f = cmd_set_vf_vlan_tag_parsed,
- .data = NULL,
- .help_str = "set vf vlan tag <port_id> <vf_id> on|off",
- .tokens = {
- (void *)&cmd_set_vf_vlan_tag_set,
- (void *)&cmd_set_vf_vlan_tag_vf,
- (void *)&cmd_set_vf_vlan_tag_vlan,
- (void *)&cmd_set_vf_vlan_tag_tag,
- (void *)&cmd_set_vf_vlan_tag_port_id,
- (void *)&cmd_set_vf_vlan_tag_vf_id,
- (void *)&cmd_set_vf_vlan_tag_on_off,
- NULL,
- },
-};
-
-/* Common definition of VF and TC TX bandwidth configuration */
-struct cmd_vf_tc_bw_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t tc;
- cmdline_fixed_string_t tx;
- cmdline_fixed_string_t min_bw;
- cmdline_fixed_string_t max_bw;
- cmdline_fixed_string_t strict_link_prio;
- portid_t port_id;
- uint16_t vf_id;
- uint8_t tc_no;
- uint32_t bw;
- cmdline_fixed_string_t bw_list;
- uint8_t tc_map;
-};
-
-static cmdline_parse_token_string_t cmd_vf_tc_bw_set =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_tc =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- tc, "tc");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_tx =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- tx, "tx");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_strict_link_prio =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- strict_link_prio, "strict-link-priority");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_min_bw =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- min_bw, "min-bandwidth");
-static cmdline_parse_token_string_t cmd_vf_tc_bw_max_bw =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- max_bw, "max-bandwidth");
-static cmdline_parse_token_num_t cmd_vf_tc_bw_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_vf_tc_bw_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- vf_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_vf_tc_bw_tc_no =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- tc_no, RTE_UINT8);
-static cmdline_parse_token_num_t cmd_vf_tc_bw_bw =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- bw, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_vf_tc_bw_bw_list =
- TOKEN_STRING_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- bw_list, NULL);
-static cmdline_parse_token_num_t cmd_vf_tc_bw_tc_map =
- TOKEN_NUM_INITIALIZER
- (struct cmd_vf_tc_bw_result,
- tc_map, RTE_UINT8);
-
-/* VF max bandwidth setting */
-static void
-cmd_vf_max_bw_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_vf_tc_bw_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_max_bw(res->port_id,
- res->vf_id, res->bw);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d or bandwidth %d\n",
- res->vf_id, res->bw);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_vf_max_bw = {
- .f = cmd_vf_max_bw_parsed,
- .data = NULL,
- .help_str = "set vf tx max-bandwidth <port_id> <vf_id> <bandwidth>",
- .tokens = {
- (void *)&cmd_vf_tc_bw_set,
- (void *)&cmd_vf_tc_bw_vf,
- (void *)&cmd_vf_tc_bw_tx,
- (void *)&cmd_vf_tc_bw_max_bw,
- (void *)&cmd_vf_tc_bw_port_id,
- (void *)&cmd_vf_tc_bw_vf_id,
- (void *)&cmd_vf_tc_bw_bw,
- NULL,
- },
-};
-
-static int
-vf_tc_min_bw_parse_bw_list(uint8_t *bw_list,
- uint8_t *tc_num,
- char *str)
-{
- uint32_t size;
- const char *p, *p0 = str;
- char s[256];
- char *end;
- char *str_fld[16];
- uint16_t i;
- int ret;
-
- p = strchr(p0, '(');
- if (p == NULL) {
- fprintf(stderr,
- "The bandwidth-list should be '(bw1, bw2, ...)'\n");
- return -1;
- }
- p++;
- p0 = strchr(p, ')');
- if (p0 == NULL) {
- fprintf(stderr,
- "The bandwidth-list should be '(bw1, bw2, ...)'\n");
- return -1;
- }
- size = p0 - p;
- if (size >= sizeof(s)) {
- fprintf(stderr,
- "The string size exceeds the internal buffer size\n");
- return -1;
- }
- snprintf(s, sizeof(s), "%.*s", size, p);
- ret = rte_strsplit(s, sizeof(s), str_fld, 16, ',');
- if (ret <= 0) {
- fprintf(stderr, "Failed to get the bandwidth list.\n");
- return -1;
- }
- *tc_num = ret;
- for (i = 0; i < ret; i++)
- bw_list[i] = (uint8_t)strtoul(str_fld[i], &end, 0);
-
- return 0;
-}
-
-/* TC min bandwidth setting */
-static void
-cmd_vf_tc_min_bw_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_vf_tc_bw_result *res = parsed_result;
- uint8_t tc_num;
- uint8_t bw[16];
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
- if (ret)
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_tc_bw_alloc(res->port_id, res->vf_id,
- tc_num, bw);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d or bandwidth\n", res->vf_id);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_vf_tc_min_bw = {
- .f = cmd_vf_tc_min_bw_parsed,
- .data = NULL,
- .help_str = "set vf tc tx min-bandwidth <port_id> <vf_id>"
- " <bw1, bw2, ...>",
- .tokens = {
- (void *)&cmd_vf_tc_bw_set,
- (void *)&cmd_vf_tc_bw_vf,
- (void *)&cmd_vf_tc_bw_tc,
- (void *)&cmd_vf_tc_bw_tx,
- (void *)&cmd_vf_tc_bw_min_bw,
- (void *)&cmd_vf_tc_bw_port_id,
- (void *)&cmd_vf_tc_bw_vf_id,
- (void *)&cmd_vf_tc_bw_bw_list,
- NULL,
- },
-};
-
-static void
-cmd_tc_min_bw_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_vf_tc_bw_result *res = parsed_result;
- struct rte_port *port;
- uint8_t tc_num;
- uint8_t bw[16];
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- port = &ports[res->port_id];
- /** Check if the port is not started **/
- if (port->port_status != RTE_PORT_STOPPED) {
- fprintf(stderr, "Please stop port %d first\n", res->port_id);
- return;
- }
-
- ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
- if (ret)
- return;
-
-#ifdef RTE_NET_IXGBE
- ret = rte_pmd_ixgbe_set_tc_bw_alloc(res->port_id, tc_num, bw);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid bandwidth\n");
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_tc_min_bw = {
- .f = cmd_tc_min_bw_parsed,
- .data = NULL,
- .help_str = "set tc tx min-bandwidth <port_id> <bw1, bw2, ...>",
- .tokens = {
- (void *)&cmd_vf_tc_bw_set,
- (void *)&cmd_vf_tc_bw_tc,
- (void *)&cmd_vf_tc_bw_tx,
- (void *)&cmd_vf_tc_bw_min_bw,
- (void *)&cmd_vf_tc_bw_port_id,
- (void *)&cmd_vf_tc_bw_bw_list,
- NULL,
- },
-};
-
-/* TC max bandwidth setting */
-static void
-cmd_vf_tc_max_bw_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_vf_tc_bw_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_vf_tc_max_bw(res->port_id, res->vf_id,
- res->tc_no, res->bw);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr,
- "invalid vf_id %d, tc_no %d or bandwidth %d\n",
- res->vf_id, res->tc_no, res->bw);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_vf_tc_max_bw = {
- .f = cmd_vf_tc_max_bw_parsed,
- .data = NULL,
- .help_str = "set vf tc tx max-bandwidth <port_id> <vf_id> <tc_no>"
- " <bandwidth>",
- .tokens = {
- (void *)&cmd_vf_tc_bw_set,
- (void *)&cmd_vf_tc_bw_vf,
- (void *)&cmd_vf_tc_bw_tc,
- (void *)&cmd_vf_tc_bw_tx,
- (void *)&cmd_vf_tc_bw_max_bw,
- (void *)&cmd_vf_tc_bw_port_id,
- (void *)&cmd_vf_tc_bw_vf_id,
- (void *)&cmd_vf_tc_bw_tc_no,
- (void *)&cmd_vf_tc_bw_bw,
- NULL,
- },
-};
-
-/** Set VXLAN encapsulation details */
-struct cmd_set_vxlan_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t vxlan;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
- uint32_t vni;
- uint16_t udp_src;
- uint16_t udp_dst;
- cmdline_ipaddr_t ip_src;
- cmdline_ipaddr_t ip_dst;
- uint16_t tci;
- uint8_t tos;
- uint8_t ttl;
- struct rte_ether_addr eth_src;
- struct rte_ether_addr eth_dst;
-};
-
-static cmdline_parse_token_string_t cmd_set_vxlan_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, set, "set");
-static cmdline_parse_token_string_t cmd_set_vxlan_vxlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan, "vxlan");
-static cmdline_parse_token_string_t cmd_set_vxlan_vxlan_tos_ttl =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
- "vxlan-tos-ttl");
-static cmdline_parse_token_string_t cmd_set_vxlan_vxlan_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
- "vxlan-with-vlan");
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "ip-version");
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, ip_version,
- "ipv4#ipv6");
-static cmdline_parse_token_string_t cmd_set_vxlan_vni =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "vni");
-static cmdline_parse_token_num_t cmd_set_vxlan_vni_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, vni, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_vxlan_udp_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "udp-src");
-static cmdline_parse_token_num_t cmd_set_vxlan_udp_src_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, udp_src, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_vxlan_udp_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "udp-dst");
-static cmdline_parse_token_num_t cmd_set_vxlan_udp_dst_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, udp_dst, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_tos =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "ip-tos");
-static cmdline_parse_token_num_t cmd_set_vxlan_ip_tos_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, tos, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_ttl =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "ip-ttl");
-static cmdline_parse_token_num_t cmd_set_vxlan_ip_ttl_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, ttl, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "ip-src");
-static cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_src_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result, ip_src);
-static cmdline_parse_token_string_t cmd_set_vxlan_ip_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "ip-dst");
-static cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_dst_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result, ip_dst);
-static cmdline_parse_token_string_t cmd_set_vxlan_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "vlan-tci");
-static cmdline_parse_token_num_t cmd_set_vxlan_vlan_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, tci, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_vxlan_eth_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "eth-src");
-static cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_src_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result, eth_src);
-static cmdline_parse_token_string_t cmd_set_vxlan_eth_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
- "eth-dst");
-static cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_dst_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result, eth_dst);
-
-static void cmd_set_vxlan_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_vxlan_result *res = parsed_result;
- union {
- uint32_t vxlan_id;
- uint8_t vni[4];
- } id = {
- .vxlan_id = rte_cpu_to_be_32(res->vni) & RTE_BE32(0x00ffffff),
- };
-
- vxlan_encap_conf.select_tos_ttl = 0;
- if (strcmp(res->vxlan, "vxlan") == 0)
- vxlan_encap_conf.select_vlan = 0;
- else if (strcmp(res->vxlan, "vxlan-with-vlan") == 0)
- vxlan_encap_conf.select_vlan = 1;
- else if (strcmp(res->vxlan, "vxlan-tos-ttl") == 0) {
- vxlan_encap_conf.select_vlan = 0;
- vxlan_encap_conf.select_tos_ttl = 1;
- }
- if (strcmp(res->ip_version, "ipv4") == 0)
- vxlan_encap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- vxlan_encap_conf.select_ipv4 = 0;
- else
- return;
- rte_memcpy(vxlan_encap_conf.vni, &id.vni[1], 3);
- vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
- vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
- vxlan_encap_conf.ip_tos = res->tos;
- vxlan_encap_conf.ip_ttl = res->ttl;
- if (vxlan_encap_conf.select_ipv4) {
- IPV4_ADDR_TO_UINT(res->ip_src, vxlan_encap_conf.ipv4_src);
- IPV4_ADDR_TO_UINT(res->ip_dst, vxlan_encap_conf.ipv4_dst);
- } else {
- IPV6_ADDR_TO_ARRAY(res->ip_src, vxlan_encap_conf.ipv6_src);
- IPV6_ADDR_TO_ARRAY(res->ip_dst, vxlan_encap_conf.ipv6_dst);
- }
- if (vxlan_encap_conf.select_vlan)
- vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
- rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes,
- RTE_ETHER_ADDR_LEN);
- rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes,
- RTE_ETHER_ADDR_LEN);
-}
-
-static cmdline_parse_inst_t cmd_set_vxlan = {
- .f = cmd_set_vxlan_parsed,
- .data = NULL,
- .help_str = "set vxlan ip-version ipv4|ipv6 vni <vni> udp-src"
- " <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst <ip-dst>"
- " eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_vxlan_set,
- (void *)&cmd_set_vxlan_vxlan,
- (void *)&cmd_set_vxlan_ip_version,
- (void *)&cmd_set_vxlan_ip_version_value,
- (void *)&cmd_set_vxlan_vni,
- (void *)&cmd_set_vxlan_vni_value,
- (void *)&cmd_set_vxlan_udp_src,
- (void *)&cmd_set_vxlan_udp_src_value,
- (void *)&cmd_set_vxlan_udp_dst,
- (void *)&cmd_set_vxlan_udp_dst_value,
- (void *)&cmd_set_vxlan_ip_src,
- (void *)&cmd_set_vxlan_ip_src_value,
- (void *)&cmd_set_vxlan_ip_dst,
- (void *)&cmd_set_vxlan_ip_dst_value,
- (void *)&cmd_set_vxlan_eth_src,
- (void *)&cmd_set_vxlan_eth_src_value,
- (void *)&cmd_set_vxlan_eth_dst,
- (void *)&cmd_set_vxlan_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_vxlan_tos_ttl = {
- .f = cmd_set_vxlan_parsed,
- .data = NULL,
- .help_str = "set vxlan-tos-ttl ip-version ipv4|ipv6 vni <vni> udp-src"
- " <udp-src> udp-dst <udp-dst> ip-tos <ip-tos> ip-ttl <ip-ttl>"
- " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
- " eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_vxlan_set,
- (void *)&cmd_set_vxlan_vxlan_tos_ttl,
- (void *)&cmd_set_vxlan_ip_version,
- (void *)&cmd_set_vxlan_ip_version_value,
- (void *)&cmd_set_vxlan_vni,
- (void *)&cmd_set_vxlan_vni_value,
- (void *)&cmd_set_vxlan_udp_src,
- (void *)&cmd_set_vxlan_udp_src_value,
- (void *)&cmd_set_vxlan_udp_dst,
- (void *)&cmd_set_vxlan_udp_dst_value,
- (void *)&cmd_set_vxlan_ip_tos,
- (void *)&cmd_set_vxlan_ip_tos_value,
- (void *)&cmd_set_vxlan_ip_ttl,
- (void *)&cmd_set_vxlan_ip_ttl_value,
- (void *)&cmd_set_vxlan_ip_src,
- (void *)&cmd_set_vxlan_ip_src_value,
- (void *)&cmd_set_vxlan_ip_dst,
- (void *)&cmd_set_vxlan_ip_dst_value,
- (void *)&cmd_set_vxlan_eth_src,
- (void *)&cmd_set_vxlan_eth_src_value,
- (void *)&cmd_set_vxlan_eth_dst,
- (void *)&cmd_set_vxlan_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_vxlan_with_vlan = {
- .f = cmd_set_vxlan_parsed,
- .data = NULL,
- .help_str = "set vxlan-with-vlan ip-version ipv4|ipv6 vni <vni>"
- " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst"
- " <ip-dst> vlan-tci <vlan-tci> eth-src <eth-src> eth-dst"
- " <eth-dst>",
- .tokens = {
- (void *)&cmd_set_vxlan_set,
- (void *)&cmd_set_vxlan_vxlan_with_vlan,
- (void *)&cmd_set_vxlan_ip_version,
- (void *)&cmd_set_vxlan_ip_version_value,
- (void *)&cmd_set_vxlan_vni,
- (void *)&cmd_set_vxlan_vni_value,
- (void *)&cmd_set_vxlan_udp_src,
- (void *)&cmd_set_vxlan_udp_src_value,
- (void *)&cmd_set_vxlan_udp_dst,
- (void *)&cmd_set_vxlan_udp_dst_value,
- (void *)&cmd_set_vxlan_ip_src,
- (void *)&cmd_set_vxlan_ip_src_value,
- (void *)&cmd_set_vxlan_ip_dst,
- (void *)&cmd_set_vxlan_ip_dst_value,
- (void *)&cmd_set_vxlan_vlan,
- (void *)&cmd_set_vxlan_vlan_value,
- (void *)&cmd_set_vxlan_eth_src,
- (void *)&cmd_set_vxlan_eth_src_value,
- (void *)&cmd_set_vxlan_eth_dst,
- (void *)&cmd_set_vxlan_eth_dst_value,
- NULL,
- },
-};
-
-/** Set NVGRE encapsulation details */
-struct cmd_set_nvgre_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t nvgre;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t tni;
- cmdline_ipaddr_t ip_src;
- cmdline_ipaddr_t ip_dst;
- uint16_t tci;
- struct rte_ether_addr eth_src;
- struct rte_ether_addr eth_dst;
-};
-
-static cmdline_parse_token_string_t cmd_set_nvgre_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, set, "set");
-static cmdline_parse_token_string_t cmd_set_nvgre_nvgre =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre, "nvgre");
-static cmdline_parse_token_string_t cmd_set_nvgre_nvgre_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre,
- "nvgre-with-vlan");
-static cmdline_parse_token_string_t cmd_set_nvgre_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "ip-version");
-static cmdline_parse_token_string_t cmd_set_nvgre_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, ip_version,
- "ipv4#ipv6");
-static cmdline_parse_token_string_t cmd_set_nvgre_tni =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "tni");
-static cmdline_parse_token_num_t cmd_set_nvgre_tni_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tni, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_nvgre_ip_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "ip-src");
-static cmdline_parse_token_num_t cmd_set_nvgre_ip_src_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_src);
-static cmdline_parse_token_string_t cmd_set_nvgre_ip_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "ip-dst");
-static cmdline_parse_token_ipaddr_t cmd_set_nvgre_ip_dst_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_dst);
-static cmdline_parse_token_string_t cmd_set_nvgre_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "vlan-tci");
-static cmdline_parse_token_num_t cmd_set_nvgre_vlan_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tci, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_nvgre_eth_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "eth-src");
-static cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_src_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_src);
-static cmdline_parse_token_string_t cmd_set_nvgre_eth_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
- "eth-dst");
-static cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_dst_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_dst);
-
-static void cmd_set_nvgre_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_nvgre_result *res = parsed_result;
- union {
- uint32_t nvgre_tni;
- uint8_t tni[4];
- } id = {
- .nvgre_tni = rte_cpu_to_be_32(res->tni) & RTE_BE32(0x00ffffff),
- };
-
- if (strcmp(res->nvgre, "nvgre") == 0)
- nvgre_encap_conf.select_vlan = 0;
- else if (strcmp(res->nvgre, "nvgre-with-vlan") == 0)
- nvgre_encap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- nvgre_encap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- nvgre_encap_conf.select_ipv4 = 0;
- else
- return;
- rte_memcpy(nvgre_encap_conf.tni, &id.tni[1], 3);
- if (nvgre_encap_conf.select_ipv4) {
- IPV4_ADDR_TO_UINT(res->ip_src, nvgre_encap_conf.ipv4_src);
- IPV4_ADDR_TO_UINT(res->ip_dst, nvgre_encap_conf.ipv4_dst);
- } else {
- IPV6_ADDR_TO_ARRAY(res->ip_src, nvgre_encap_conf.ipv6_src);
- IPV6_ADDR_TO_ARRAY(res->ip_dst, nvgre_encap_conf.ipv6_dst);
- }
- if (nvgre_encap_conf.select_vlan)
- nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
- rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes,
- RTE_ETHER_ADDR_LEN);
- rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,
- RTE_ETHER_ADDR_LEN);
-}
-
-static cmdline_parse_inst_t cmd_set_nvgre = {
- .f = cmd_set_nvgre_parsed,
- .data = NULL,
- .help_str = "set nvgre ip-version <ipv4|ipv6> tni <tni> ip-src"
- " <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
- " eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_nvgre_set,
- (void *)&cmd_set_nvgre_nvgre,
- (void *)&cmd_set_nvgre_ip_version,
- (void *)&cmd_set_nvgre_ip_version_value,
- (void *)&cmd_set_nvgre_tni,
- (void *)&cmd_set_nvgre_tni_value,
- (void *)&cmd_set_nvgre_ip_src,
- (void *)&cmd_set_nvgre_ip_src_value,
- (void *)&cmd_set_nvgre_ip_dst,
- (void *)&cmd_set_nvgre_ip_dst_value,
- (void *)&cmd_set_nvgre_eth_src,
- (void *)&cmd_set_nvgre_eth_src_value,
- (void *)&cmd_set_nvgre_eth_dst,
- (void *)&cmd_set_nvgre_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_nvgre_with_vlan = {
- .f = cmd_set_nvgre_parsed,
- .data = NULL,
- .help_str = "set nvgre-with-vlan ip-version <ipv4|ipv6> tni <tni>"
- " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
- " eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_nvgre_set,
- (void *)&cmd_set_nvgre_nvgre_with_vlan,
- (void *)&cmd_set_nvgre_ip_version,
- (void *)&cmd_set_nvgre_ip_version_value,
- (void *)&cmd_set_nvgre_tni,
- (void *)&cmd_set_nvgre_tni_value,
- (void *)&cmd_set_nvgre_ip_src,
- (void *)&cmd_set_nvgre_ip_src_value,
- (void *)&cmd_set_nvgre_ip_dst,
- (void *)&cmd_set_nvgre_ip_dst_value,
- (void *)&cmd_set_nvgre_vlan,
- (void *)&cmd_set_nvgre_vlan_value,
- (void *)&cmd_set_nvgre_eth_src,
- (void *)&cmd_set_nvgre_eth_src_value,
- (void *)&cmd_set_nvgre_eth_dst,
- (void *)&cmd_set_nvgre_eth_dst_value,
- NULL,
- },
-};
-
-/** Set L2 encapsulation details */
-struct cmd_set_l2_encap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t l2_encap;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
- uint16_t tci;
- struct rte_ether_addr eth_src;
- struct rte_ether_addr eth_dst;
-};
-
-static cmdline_parse_token_string_t cmd_set_l2_encap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, set, "set");
-static cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, l2_encap, "l2_encap");
-static cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, l2_encap,
- "l2_encap-with-vlan");
-static cmdline_parse_token_string_t cmd_set_l2_encap_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
- "ip-version");
-static cmdline_parse_token_string_t cmd_set_l2_encap_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, ip_version,
- "ipv4#ipv6");
-static cmdline_parse_token_string_t cmd_set_l2_encap_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
- "vlan-tci");
-static cmdline_parse_token_num_t cmd_set_l2_encap_vlan_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_l2_encap_result, tci, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_l2_encap_eth_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
- "eth-src");
-static cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_src_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result, eth_src);
-static cmdline_parse_token_string_t cmd_set_l2_encap_eth_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
- "eth-dst");
-static cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_dst_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result, eth_dst);
-
-static void cmd_set_l2_encap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_l2_encap_result *res = parsed_result;
-
- if (strcmp(res->l2_encap, "l2_encap") == 0)
- l2_encap_conf.select_vlan = 0;
- else if (strcmp(res->l2_encap, "l2_encap-with-vlan") == 0)
- l2_encap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- l2_encap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- l2_encap_conf.select_ipv4 = 0;
- else
- return;
- if (l2_encap_conf.select_vlan)
- l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
- rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes,
- RTE_ETHER_ADDR_LEN);
- rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes,
- RTE_ETHER_ADDR_LEN);
-}
-
-static cmdline_parse_inst_t cmd_set_l2_encap = {
- .f = cmd_set_l2_encap_parsed,
- .data = NULL,
- .help_str = "set l2_encap ip-version ipv4|ipv6"
- " eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_l2_encap_set,
- (void *)&cmd_set_l2_encap_l2_encap,
- (void *)&cmd_set_l2_encap_ip_version,
- (void *)&cmd_set_l2_encap_ip_version_value,
- (void *)&cmd_set_l2_encap_eth_src,
- (void *)&cmd_set_l2_encap_eth_src_value,
- (void *)&cmd_set_l2_encap_eth_dst,
- (void *)&cmd_set_l2_encap_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_l2_encap_with_vlan = {
- .f = cmd_set_l2_encap_parsed,
- .data = NULL,
- .help_str = "set l2_encap-with-vlan ip-version ipv4|ipv6"
- " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_l2_encap_set,
- (void *)&cmd_set_l2_encap_l2_encap_with_vlan,
- (void *)&cmd_set_l2_encap_ip_version,
- (void *)&cmd_set_l2_encap_ip_version_value,
- (void *)&cmd_set_l2_encap_vlan,
- (void *)&cmd_set_l2_encap_vlan_value,
- (void *)&cmd_set_l2_encap_eth_src,
- (void *)&cmd_set_l2_encap_eth_src_value,
- (void *)&cmd_set_l2_encap_eth_dst,
- (void *)&cmd_set_l2_encap_eth_dst_value,
- NULL,
- },
-};
-
-/** Set L2 decapsulation details */
-struct cmd_set_l2_decap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t l2_decap;
- cmdline_fixed_string_t pos_token;
- uint32_t vlan_present:1;
-};
-
-static cmdline_parse_token_string_t cmd_set_l2_decap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, set, "set");
-static cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, l2_decap,
- "l2_decap");
-static cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, l2_decap,
- "l2_decap-with-vlan");
-
-static void cmd_set_l2_decap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_l2_decap_result *res = parsed_result;
-
- if (strcmp(res->l2_decap, "l2_decap") == 0)
- l2_decap_conf.select_vlan = 0;
- else if (strcmp(res->l2_decap, "l2_decap-with-vlan") == 0)
- l2_decap_conf.select_vlan = 1;
-}
-
-static cmdline_parse_inst_t cmd_set_l2_decap = {
- .f = cmd_set_l2_decap_parsed,
- .data = NULL,
- .help_str = "set l2_decap",
- .tokens = {
- (void *)&cmd_set_l2_decap_set,
- (void *)&cmd_set_l2_decap_l2_decap,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_l2_decap_with_vlan = {
- .f = cmd_set_l2_decap_parsed,
- .data = NULL,
- .help_str = "set l2_decap-with-vlan",
- .tokens = {
- (void *)&cmd_set_l2_decap_set,
- (void *)&cmd_set_l2_decap_l2_decap_with_vlan,
- NULL,
- },
-};
-
-/** Set MPLSoGRE encapsulation details */
-struct cmd_set_mplsogre_encap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t mplsogre;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
- uint32_t label;
- cmdline_ipaddr_t ip_src;
- cmdline_ipaddr_t ip_dst;
- uint16_t tci;
- struct rte_ether_addr eth_src;
- struct rte_ether_addr eth_dst;
-};
-
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result, set,
- "set");
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result, mplsogre,
- "mplsogre_encap");
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- mplsogre, "mplsogre_encap-with-vlan");
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "ip-version");
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- ip_version, "ipv4#ipv6");
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_label =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "label");
-static cmdline_parse_token_num_t cmd_set_mplsogre_encap_label_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result, label,
- RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "ip-src");
-static cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_src_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result, ip_src);
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "ip-dst");
-static cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_dst_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result, ip_dst);
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "vlan-tci");
-static cmdline_parse_token_num_t cmd_set_mplsogre_encap_vlan_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result, tci,
- RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "eth-src");
-static cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_src_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- eth_src);
-static cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- pos_token, "eth-dst");
-static cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_dst_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result,
- eth_dst);
-
-static void cmd_set_mplsogre_encap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_mplsogre_encap_result *res = parsed_result;
- union {
- uint32_t mplsogre_label;
- uint8_t label[4];
- } id = {
- .mplsogre_label = rte_cpu_to_be_32(res->label<<12),
- };
-
- if (strcmp(res->mplsogre, "mplsogre_encap") == 0)
- mplsogre_encap_conf.select_vlan = 0;
- else if (strcmp(res->mplsogre, "mplsogre_encap-with-vlan") == 0)
- mplsogre_encap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- mplsogre_encap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- mplsogre_encap_conf.select_ipv4 = 0;
- else
- return;
- rte_memcpy(mplsogre_encap_conf.label, &id.label, 3);
- if (mplsogre_encap_conf.select_ipv4) {
- IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src);
- IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst);
- } else {
- IPV6_ADDR_TO_ARRAY(res->ip_src, mplsogre_encap_conf.ipv6_src);
- IPV6_ADDR_TO_ARRAY(res->ip_dst, mplsogre_encap_conf.ipv6_dst);
- }
- if (mplsogre_encap_conf.select_vlan)
- mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
- rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes,
- RTE_ETHER_ADDR_LEN);
- rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes,
- RTE_ETHER_ADDR_LEN);
-}
-
-static cmdline_parse_inst_t cmd_set_mplsogre_encap = {
- .f = cmd_set_mplsogre_encap_parsed,
- .data = NULL,
- .help_str = "set mplsogre_encap ip-version ipv4|ipv6 label <label>"
- " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
- " eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_mplsogre_encap_set,
- (void *)&cmd_set_mplsogre_encap_mplsogre_encap,
- (void *)&cmd_set_mplsogre_encap_ip_version,
- (void *)&cmd_set_mplsogre_encap_ip_version_value,
- (void *)&cmd_set_mplsogre_encap_label,
- (void *)&cmd_set_mplsogre_encap_label_value,
- (void *)&cmd_set_mplsogre_encap_ip_src,
- (void *)&cmd_set_mplsogre_encap_ip_src_value,
- (void *)&cmd_set_mplsogre_encap_ip_dst,
- (void *)&cmd_set_mplsogre_encap_ip_dst_value,
- (void *)&cmd_set_mplsogre_encap_eth_src,
- (void *)&cmd_set_mplsogre_encap_eth_src_value,
- (void *)&cmd_set_mplsogre_encap_eth_dst,
- (void *)&cmd_set_mplsogre_encap_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_mplsogre_encap_with_vlan = {
- .f = cmd_set_mplsogre_encap_parsed,
- .data = NULL,
- .help_str = "set mplsogre_encap-with-vlan ip-version ipv4|ipv6"
- " label <label> ip-src <ip-src> ip-dst <ip-dst>"
- " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_mplsogre_encap_set,
- (void *)&cmd_set_mplsogre_encap_mplsogre_encap_with_vlan,
- (void *)&cmd_set_mplsogre_encap_ip_version,
- (void *)&cmd_set_mplsogre_encap_ip_version_value,
- (void *)&cmd_set_mplsogre_encap_label,
- (void *)&cmd_set_mplsogre_encap_label_value,
- (void *)&cmd_set_mplsogre_encap_ip_src,
- (void *)&cmd_set_mplsogre_encap_ip_src_value,
- (void *)&cmd_set_mplsogre_encap_ip_dst,
- (void *)&cmd_set_mplsogre_encap_ip_dst_value,
- (void *)&cmd_set_mplsogre_encap_vlan,
- (void *)&cmd_set_mplsogre_encap_vlan_value,
- (void *)&cmd_set_mplsogre_encap_eth_src,
- (void *)&cmd_set_mplsogre_encap_eth_src_value,
- (void *)&cmd_set_mplsogre_encap_eth_dst,
- (void *)&cmd_set_mplsogre_encap_eth_dst_value,
- NULL,
- },
-};
-
-/** Set MPLSoGRE decapsulation details */
-struct cmd_set_mplsogre_decap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t mplsogre;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
-};
-
-static cmdline_parse_token_string_t cmd_set_mplsogre_decap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result, set,
- "set");
-static cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result, mplsogre,
- "mplsogre_decap");
-static cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
- mplsogre, "mplsogre_decap-with-vlan");
-static cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
- pos_token, "ip-version");
-static cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
- ip_version, "ipv4#ipv6");
-
-static void cmd_set_mplsogre_decap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_mplsogre_decap_result *res = parsed_result;
-
- if (strcmp(res->mplsogre, "mplsogre_decap") == 0)
- mplsogre_decap_conf.select_vlan = 0;
- else if (strcmp(res->mplsogre, "mplsogre_decap-with-vlan") == 0)
- mplsogre_decap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- mplsogre_decap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- mplsogre_decap_conf.select_ipv4 = 0;
-}
-
-static cmdline_parse_inst_t cmd_set_mplsogre_decap = {
- .f = cmd_set_mplsogre_decap_parsed,
- .data = NULL,
- .help_str = "set mplsogre_decap ip-version ipv4|ipv6",
- .tokens = {
- (void *)&cmd_set_mplsogre_decap_set,
- (void *)&cmd_set_mplsogre_decap_mplsogre_decap,
- (void *)&cmd_set_mplsogre_decap_ip_version,
- (void *)&cmd_set_mplsogre_decap_ip_version_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_mplsogre_decap_with_vlan = {
- .f = cmd_set_mplsogre_decap_parsed,
- .data = NULL,
- .help_str = "set mplsogre_decap-with-vlan ip-version ipv4|ipv6",
- .tokens = {
- (void *)&cmd_set_mplsogre_decap_set,
- (void *)&cmd_set_mplsogre_decap_mplsogre_decap_with_vlan,
- (void *)&cmd_set_mplsogre_decap_ip_version,
- (void *)&cmd_set_mplsogre_decap_ip_version_value,
- NULL,
- },
-};
-
-/** Set MPLSoUDP encapsulation details */
-struct cmd_set_mplsoudp_encap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t mplsoudp;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
- uint32_t label;
- uint16_t udp_src;
- uint16_t udp_dst;
- cmdline_ipaddr_t ip_src;
- cmdline_ipaddr_t ip_dst;
- uint16_t tci;
- struct rte_ether_addr eth_src;
- struct rte_ether_addr eth_dst;
-};
-
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result, set,
- "set");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result, mplsoudp,
- "mplsoudp_encap");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- mplsoudp, "mplsoudp_encap-with-vlan");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "ip-version");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- ip_version, "ipv4#ipv6");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_label =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "label");
-static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_label_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, label,
- RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "udp-src");
-static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_src_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, udp_src,
- RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "udp-dst");
-static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_dst_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, udp_dst,
- RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "ip-src");
-static cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_src_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result, ip_src);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "ip-dst");
-static cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_dst_value =
- TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result, ip_dst);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "vlan-tci");
-static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_vlan_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, tci,
- RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_src =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "eth-src");
-static cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_src_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- eth_src);
-static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_dst =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- pos_token, "eth-dst");
-static cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_dst_value =
- TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
- eth_dst);
-
-static void cmd_set_mplsoudp_encap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_mplsoudp_encap_result *res = parsed_result;
- union {
- uint32_t mplsoudp_label;
- uint8_t label[4];
- } id = {
- .mplsoudp_label = rte_cpu_to_be_32(res->label<<12),
- };
-
- if (strcmp(res->mplsoudp, "mplsoudp_encap") == 0)
- mplsoudp_encap_conf.select_vlan = 0;
- else if (strcmp(res->mplsoudp, "mplsoudp_encap-with-vlan") == 0)
- mplsoudp_encap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- mplsoudp_encap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- mplsoudp_encap_conf.select_ipv4 = 0;
- else
- return;
- rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3);
- mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
- mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
- if (mplsoudp_encap_conf.select_ipv4) {
- IPV4_ADDR_TO_UINT(res->ip_src, mplsoudp_encap_conf.ipv4_src);
- IPV4_ADDR_TO_UINT(res->ip_dst, mplsoudp_encap_conf.ipv4_dst);
- } else {
- IPV6_ADDR_TO_ARRAY(res->ip_src, mplsoudp_encap_conf.ipv6_src);
- IPV6_ADDR_TO_ARRAY(res->ip_dst, mplsoudp_encap_conf.ipv6_dst);
- }
- if (mplsoudp_encap_conf.select_vlan)
- mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
- rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes,
- RTE_ETHER_ADDR_LEN);
- rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes,
- RTE_ETHER_ADDR_LEN);
-}
-
-static cmdline_parse_inst_t cmd_set_mplsoudp_encap = {
- .f = cmd_set_mplsoudp_encap_parsed,
- .data = NULL,
- .help_str = "set mplsoudp_encap ip-version ipv4|ipv6 label <label>"
- " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src>"
- " ip-dst <ip-dst> eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_mplsoudp_encap_set,
- (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap,
- (void *)&cmd_set_mplsoudp_encap_ip_version,
- (void *)&cmd_set_mplsoudp_encap_ip_version_value,
- (void *)&cmd_set_mplsoudp_encap_label,
- (void *)&cmd_set_mplsoudp_encap_label_value,
- (void *)&cmd_set_mplsoudp_encap_udp_src,
- (void *)&cmd_set_mplsoudp_encap_udp_src_value,
- (void *)&cmd_set_mplsoudp_encap_udp_dst,
- (void *)&cmd_set_mplsoudp_encap_udp_dst_value,
- (void *)&cmd_set_mplsoudp_encap_ip_src,
- (void *)&cmd_set_mplsoudp_encap_ip_src_value,
- (void *)&cmd_set_mplsoudp_encap_ip_dst,
- (void *)&cmd_set_mplsoudp_encap_ip_dst_value,
- (void *)&cmd_set_mplsoudp_encap_eth_src,
- (void *)&cmd_set_mplsoudp_encap_eth_src_value,
- (void *)&cmd_set_mplsoudp_encap_eth_dst,
- (void *)&cmd_set_mplsoudp_encap_eth_dst_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_mplsoudp_encap_with_vlan = {
- .f = cmd_set_mplsoudp_encap_parsed,
- .data = NULL,
- .help_str = "set mplsoudp_encap-with-vlan ip-version ipv4|ipv6"
- " label <label> udp-src <udp-src> udp-dst <udp-dst>"
- " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
- " eth-src <eth-src> eth-dst <eth-dst>",
- .tokens = {
- (void *)&cmd_set_mplsoudp_encap_set,
- (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan,
- (void *)&cmd_set_mplsoudp_encap_ip_version,
- (void *)&cmd_set_mplsoudp_encap_ip_version_value,
- (void *)&cmd_set_mplsoudp_encap_label,
- (void *)&cmd_set_mplsoudp_encap_label_value,
- (void *)&cmd_set_mplsoudp_encap_udp_src,
- (void *)&cmd_set_mplsoudp_encap_udp_src_value,
- (void *)&cmd_set_mplsoudp_encap_udp_dst,
- (void *)&cmd_set_mplsoudp_encap_udp_dst_value,
- (void *)&cmd_set_mplsoudp_encap_ip_src,
- (void *)&cmd_set_mplsoudp_encap_ip_src_value,
- (void *)&cmd_set_mplsoudp_encap_ip_dst,
- (void *)&cmd_set_mplsoudp_encap_ip_dst_value,
- (void *)&cmd_set_mplsoudp_encap_vlan,
- (void *)&cmd_set_mplsoudp_encap_vlan_value,
- (void *)&cmd_set_mplsoudp_encap_eth_src,
- (void *)&cmd_set_mplsoudp_encap_eth_src_value,
- (void *)&cmd_set_mplsoudp_encap_eth_dst,
- (void *)&cmd_set_mplsoudp_encap_eth_dst_value,
- NULL,
- },
-};
-
-/** Set MPLSoUDP decapsulation details */
-struct cmd_set_mplsoudp_decap_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t mplsoudp;
- cmdline_fixed_string_t pos_token;
- cmdline_fixed_string_t ip_version;
- uint32_t vlan_present:1;
-};
-
-static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result, set,
- "set");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result, mplsoudp,
- "mplsoudp_decap");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
- mplsoudp, "mplsoudp_decap-with-vlan");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
- pos_token, "ip-version");
-static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version_value =
- TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
- ip_version, "ipv4#ipv6");
-
-static void cmd_set_mplsoudp_decap_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_mplsoudp_decap_result *res = parsed_result;
-
- if (strcmp(res->mplsoudp, "mplsoudp_decap") == 0)
- mplsoudp_decap_conf.select_vlan = 0;
- else if (strcmp(res->mplsoudp, "mplsoudp_decap-with-vlan") == 0)
- mplsoudp_decap_conf.select_vlan = 1;
- if (strcmp(res->ip_version, "ipv4") == 0)
- mplsoudp_decap_conf.select_ipv4 = 1;
- else if (strcmp(res->ip_version, "ipv6") == 0)
- mplsoudp_decap_conf.select_ipv4 = 0;
-}
-
-static cmdline_parse_inst_t cmd_set_mplsoudp_decap = {
- .f = cmd_set_mplsoudp_decap_parsed,
- .data = NULL,
- .help_str = "set mplsoudp_decap ip-version ipv4|ipv6",
- .tokens = {
- (void *)&cmd_set_mplsoudp_decap_set,
- (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap,
- (void *)&cmd_set_mplsoudp_decap_ip_version,
- (void *)&cmd_set_mplsoudp_decap_ip_version_value,
- NULL,
- },
-};
-
-static cmdline_parse_inst_t cmd_set_mplsoudp_decap_with_vlan = {
- .f = cmd_set_mplsoudp_decap_parsed,
- .data = NULL,
- .help_str = "set mplsoudp_decap-with-vlan ip-version ipv4|ipv6",
- .tokens = {
- (void *)&cmd_set_mplsoudp_decap_set,
- (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan,
- (void *)&cmd_set_mplsoudp_decap_ip_version,
- (void *)&cmd_set_mplsoudp_decap_ip_version_value,
- NULL,
- },
-};
-
-/** Set connection tracking object common details */
-struct cmd_set_conntrack_common_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t conntrack;
- cmdline_fixed_string_t common;
- cmdline_fixed_string_t peer;
- cmdline_fixed_string_t is_orig;
- cmdline_fixed_string_t enable;
- cmdline_fixed_string_t live;
- cmdline_fixed_string_t sack;
- cmdline_fixed_string_t cack;
- cmdline_fixed_string_t last_dir;
- cmdline_fixed_string_t liberal;
- cmdline_fixed_string_t state;
- cmdline_fixed_string_t max_ack_win;
- cmdline_fixed_string_t retrans;
- cmdline_fixed_string_t last_win;
- cmdline_fixed_string_t last_seq;
- cmdline_fixed_string_t last_ack;
- cmdline_fixed_string_t last_end;
- cmdline_fixed_string_t last_index;
- uint8_t stat;
- uint8_t factor;
- uint16_t peer_port;
- uint32_t is_original;
- uint32_t en;
- uint32_t is_live;
- uint32_t s_ack;
- uint32_t c_ack;
- uint32_t ld;
- uint32_t lb;
- uint8_t re_num;
- uint8_t li;
- uint16_t lw;
- uint32_t ls;
- uint32_t la;
- uint32_t le;
-};
-
-static cmdline_parse_token_string_t cmd_set_conntrack_set =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- set, "set");
-static cmdline_parse_token_string_t cmd_set_conntrack_conntrack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- conntrack, "conntrack");
-static cmdline_parse_token_string_t cmd_set_conntrack_common_com =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- common, "com");
-static cmdline_parse_token_string_t cmd_set_conntrack_common_peer =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- peer, "peer");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_peer_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- peer_port, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_is_orig =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- is_orig, "is_orig");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_is_orig_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- is_original, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_enable =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- enable, "enable");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_enable_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- en, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_live =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- live, "live");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_live_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- is_live, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_sack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- sack, "sack");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_sack_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- s_ack, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_cack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- cack, "cack");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_cack_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- c_ack, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_dir =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_dir, "last_dir");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_dir_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- ld, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_liberal =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- liberal, "liberal");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_liberal_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- lb, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_state =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- state, "state");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_state_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- stat, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_max_ackwin =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- max_ack_win, "max_ack_win");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_max_ackwin_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- factor, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_retrans =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- retrans, "r_lim");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_retrans_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- re_num, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_win =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_win, "last_win");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_win_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- lw, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_seq =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_seq, "last_seq");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_seq_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- ls, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_ack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_ack, "last_ack");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_ack_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- la, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_end =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_end, "last_end");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_end_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- le, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_common_last_index =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
- last_index, "last_index");
-static cmdline_parse_token_num_t cmd_set_conntrack_common_last_index_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
- li, RTE_UINT8);
-
-static void cmd_set_conntrack_common_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_conntrack_common_result *res = parsed_result;
-
- /* No need to swap to big endian. */
- conntrack_context.peer_port = res->peer_port;
- conntrack_context.is_original_dir = res->is_original;
- conntrack_context.enable = res->en;
- conntrack_context.live_connection = res->is_live;
- conntrack_context.selective_ack = res->s_ack;
- conntrack_context.challenge_ack_passed = res->c_ack;
- conntrack_context.last_direction = res->ld;
- conntrack_context.liberal_mode = res->lb;
- conntrack_context.state = (enum rte_flow_conntrack_state)res->stat;
- conntrack_context.max_ack_window = res->factor;
- conntrack_context.retransmission_limit = res->re_num;
- conntrack_context.last_window = res->lw;
- conntrack_context.last_index =
- (enum rte_flow_conntrack_tcp_last_index)res->li;
- conntrack_context.last_seq = res->ls;
- conntrack_context.last_ack = res->la;
- conntrack_context.last_end = res->le;
-}
-
-static cmdline_parse_inst_t cmd_set_conntrack_common = {
- .f = cmd_set_conntrack_common_parsed,
- .data = NULL,
- .help_str = "set conntrack com peer <port_id> is_orig <dir> enable <en>"
- " live <ack_seen> sack <en> cack <passed> last_dir <dir>"
- " liberal <en> state <s> max_ack_win <factor> r_lim <num>"
- " last_win <win> last_seq <seq> last_ack <ack> last_end <end>"
- " last_index <flag>",
- .tokens = {
- (void *)&cmd_set_conntrack_set,
- (void *)&cmd_set_conntrack_conntrack,
- (void *)&cmd_set_conntrack_common_com,
- (void *)&cmd_set_conntrack_common_peer,
- (void *)&cmd_set_conntrack_common_peer_value,
- (void *)&cmd_set_conntrack_common_is_orig,
- (void *)&cmd_set_conntrack_common_is_orig_value,
- (void *)&cmd_set_conntrack_common_enable,
- (void *)&cmd_set_conntrack_common_enable_value,
- (void *)&cmd_set_conntrack_common_live,
- (void *)&cmd_set_conntrack_common_live_value,
- (void *)&cmd_set_conntrack_common_sack,
- (void *)&cmd_set_conntrack_common_sack_value,
- (void *)&cmd_set_conntrack_common_cack,
- (void *)&cmd_set_conntrack_common_cack_value,
- (void *)&cmd_set_conntrack_common_last_dir,
- (void *)&cmd_set_conntrack_common_last_dir_value,
- (void *)&cmd_set_conntrack_common_liberal,
- (void *)&cmd_set_conntrack_common_liberal_value,
- (void *)&cmd_set_conntrack_common_state,
- (void *)&cmd_set_conntrack_common_state_value,
- (void *)&cmd_set_conntrack_common_max_ackwin,
- (void *)&cmd_set_conntrack_common_max_ackwin_value,
- (void *)&cmd_set_conntrack_common_retrans,
- (void *)&cmd_set_conntrack_common_retrans_value,
- (void *)&cmd_set_conntrack_common_last_win,
- (void *)&cmd_set_conntrack_common_last_win_value,
- (void *)&cmd_set_conntrack_common_last_seq,
- (void *)&cmd_set_conntrack_common_last_seq_value,
- (void *)&cmd_set_conntrack_common_last_ack,
- (void *)&cmd_set_conntrack_common_last_ack_value,
- (void *)&cmd_set_conntrack_common_last_end,
- (void *)&cmd_set_conntrack_common_last_end_value,
- (void *)&cmd_set_conntrack_common_last_index,
- (void *)&cmd_set_conntrack_common_last_index_value,
- NULL,
- },
-};
-
-/** Set connection tracking object both directions' details */
-struct cmd_set_conntrack_dir_result {
- cmdline_fixed_string_t set;
- cmdline_fixed_string_t conntrack;
- cmdline_fixed_string_t dir;
- cmdline_fixed_string_t scale;
- cmdline_fixed_string_t fin;
- cmdline_fixed_string_t ack_seen;
- cmdline_fixed_string_t unack;
- cmdline_fixed_string_t sent_end;
- cmdline_fixed_string_t reply_end;
- cmdline_fixed_string_t max_win;
- cmdline_fixed_string_t max_ack;
- uint32_t factor;
- uint32_t f;
- uint32_t as;
- uint32_t un;
- uint32_t se;
- uint32_t re;
- uint32_t mw;
- uint32_t ma;
-};
-
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_dir =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- dir, "orig#rply");
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_scale =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- scale, "scale");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_scale_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- factor, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_fin =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- fin, "fin");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_fin_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- f, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_ack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- ack_seen, "acked");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_ack_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- as, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_unack_data =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- unack, "unack_data");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_unack_data_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- un, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_sent_end =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- sent_end, "sent_end");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_sent_end_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- se, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_reply_end =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- reply_end, "reply_end");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_reply_end_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- re, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_max_win =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- max_win, "max_win");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_max_win_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- mw, RTE_UINT32);
-static cmdline_parse_token_string_t cmd_set_conntrack_dir_max_ack =
- TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
- max_ack, "max_ack");
-static cmdline_parse_token_num_t cmd_set_conntrack_dir_max_ack_value =
- TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
- ma, RTE_UINT32);
-
-static void cmd_set_conntrack_dir_parsed(void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_set_conntrack_dir_result *res = parsed_result;
- struct rte_flow_tcp_dir_param *dir = NULL;
-
- if (strcmp(res->dir, "orig") == 0)
- dir = &conntrack_context.original_dir;
- else if (strcmp(res->dir, "rply") == 0)
- dir = &conntrack_context.reply_dir;
- else
- return;
- dir->scale = res->factor;
- dir->close_initiated = res->f;
- dir->last_ack_seen = res->as;
- dir->data_unacked = res->un;
- dir->sent_end = res->se;
- dir->reply_end = res->re;
- dir->max_ack = res->ma;
- dir->max_win = res->mw;
-}
-
-static cmdline_parse_inst_t cmd_set_conntrack_dir = {
- .f = cmd_set_conntrack_dir_parsed,
- .data = NULL,
- .help_str = "set conntrack orig|rply scale <factor> fin <sent>"
- " acked <seen> unack_data <unack> sent_end <sent>"
- " reply_end <reply> max_win <win> max_ack <ack>",
- .tokens = {
- (void *)&cmd_set_conntrack_set,
- (void *)&cmd_set_conntrack_conntrack,
- (void *)&cmd_set_conntrack_dir_dir,
- (void *)&cmd_set_conntrack_dir_scale,
- (void *)&cmd_set_conntrack_dir_scale_value,
- (void *)&cmd_set_conntrack_dir_fin,
- (void *)&cmd_set_conntrack_dir_fin_value,
- (void *)&cmd_set_conntrack_dir_ack,
- (void *)&cmd_set_conntrack_dir_ack_value,
- (void *)&cmd_set_conntrack_dir_unack_data,
- (void *)&cmd_set_conntrack_dir_unack_data_value,
- (void *)&cmd_set_conntrack_dir_sent_end,
- (void *)&cmd_set_conntrack_dir_sent_end_value,
- (void *)&cmd_set_conntrack_dir_reply_end,
- (void *)&cmd_set_conntrack_dir_reply_end_value,
- (void *)&cmd_set_conntrack_dir_max_win,
- (void *)&cmd_set_conntrack_dir_max_win_value,
- (void *)&cmd_set_conntrack_dir_max_ack,
- (void *)&cmd_set_conntrack_dir_max_ack_value,
- NULL,
- },
-};
-
-/* Strict link priority scheduling mode setting */
-static void
-cmd_strict_link_prio_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_vf_tc_bw_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_set_tc_strict_prio(res->port_id, res->tc_map);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid tc_bitmap 0x%x\n", res->tc_map);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-}
-
-static cmdline_parse_inst_t cmd_strict_link_prio = {
- .f = cmd_strict_link_prio_parsed,
- .data = NULL,
- .help_str = "set tx strict-link-priority <port_id> <tc_bitmap>",
- .tokens = {
- (void *)&cmd_vf_tc_bw_set,
- (void *)&cmd_vf_tc_bw_tx,
- (void *)&cmd_vf_tc_bw_strict_link_prio,
- (void *)&cmd_vf_tc_bw_port_id,
- (void *)&cmd_vf_tc_bw_tc_map,
- NULL,
- },
-};
-
-/* Load dynamic device personalization*/
-struct cmd_ddp_add_result {
- cmdline_fixed_string_t ddp;
- cmdline_fixed_string_t add;
- portid_t port_id;
- char filepath[];
+ cmdline_fixed_string_t vxlan;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
+ uint32_t vni;
+ uint16_t udp_src;
+ uint16_t udp_dst;
+ cmdline_ipaddr_t ip_src;
+ cmdline_ipaddr_t ip_dst;
+ uint16_t tci;
+ uint8_t tos;
+ uint8_t ttl;
+ struct rte_ether_addr eth_src;
+ struct rte_ether_addr eth_dst;
};
-static cmdline_parse_token_string_t cmd_ddp_add_ddp =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, ddp, "ddp");
-static cmdline_parse_token_string_t cmd_ddp_add_add =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, add, "add");
-static cmdline_parse_token_num_t cmd_ddp_add_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_ddp_add_result, port_id,
- RTE_UINT16);
-static cmdline_parse_token_string_t cmd_ddp_add_filepath =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, filepath, NULL);
+static cmdline_parse_token_string_t cmd_set_vxlan_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, set, "set");
+static cmdline_parse_token_string_t cmd_set_vxlan_vxlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan, "vxlan");
+static cmdline_parse_token_string_t cmd_set_vxlan_vxlan_tos_ttl =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
+ "vxlan-tos-ttl");
+static cmdline_parse_token_string_t cmd_set_vxlan_vxlan_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, vxlan,
+ "vxlan-with-vlan");
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "ip-version");
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, ip_version,
+ "ipv4#ipv6");
+static cmdline_parse_token_string_t cmd_set_vxlan_vni =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "vni");
+static cmdline_parse_token_num_t cmd_set_vxlan_vni_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, vni, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_vxlan_udp_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "udp-src");
+static cmdline_parse_token_num_t cmd_set_vxlan_udp_src_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, udp_src, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_vxlan_udp_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "udp-dst");
+static cmdline_parse_token_num_t cmd_set_vxlan_udp_dst_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, udp_dst, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_tos =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "ip-tos");
+static cmdline_parse_token_num_t cmd_set_vxlan_ip_tos_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, tos, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_ttl =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "ip-ttl");
+static cmdline_parse_token_num_t cmd_set_vxlan_ip_ttl_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, ttl, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "ip-src");
+static cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_src_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result, ip_src);
+static cmdline_parse_token_string_t cmd_set_vxlan_ip_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "ip-dst");
+static cmdline_parse_token_ipaddr_t cmd_set_vxlan_ip_dst_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_vxlan_result, ip_dst);
+static cmdline_parse_token_string_t cmd_set_vxlan_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "vlan-tci");
+static cmdline_parse_token_num_t cmd_set_vxlan_vlan_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vxlan_result, tci, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_vxlan_eth_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "eth-src");
+static cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_src_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result, eth_src);
+static cmdline_parse_token_string_t cmd_set_vxlan_eth_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vxlan_result, pos_token,
+ "eth-dst");
+static cmdline_parse_token_etheraddr_t cmd_set_vxlan_eth_dst_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vxlan_result, eth_dst);
-static void
-cmd_ddp_add_parsed(
- void *parsed_result,
+static void cmd_set_vxlan_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_ddp_add_result *res = parsed_result;
- uint8_t *buff;
- uint32_t size;
- char *filepath;
- char *file_fld[2];
- int file_num;
- int ret = -ENOTSUP;
-
- if (!all_ports_stopped()) {
- fprintf(stderr, "Please stop all ports first\n");
- return;
- }
+ struct cmd_set_vxlan_result *res = parsed_result;
+ union {
+ uint32_t vxlan_id;
+ uint8_t vni[4];
+ } id = {
+ .vxlan_id = rte_cpu_to_be_32(res->vni) & RTE_BE32(0x00ffffff),
+ };
- filepath = strdup(res->filepath);
- if (filepath == NULL) {
- fprintf(stderr, "Failed to allocate memory\n");
- return;
+ vxlan_encap_conf.select_tos_ttl = 0;
+ if (strcmp(res->vxlan, "vxlan") == 0)
+ vxlan_encap_conf.select_vlan = 0;
+ else if (strcmp(res->vxlan, "vxlan-with-vlan") == 0)
+ vxlan_encap_conf.select_vlan = 1;
+ else if (strcmp(res->vxlan, "vxlan-tos-ttl") == 0) {
+ vxlan_encap_conf.select_vlan = 0;
+ vxlan_encap_conf.select_tos_ttl = 1;
}
- file_num = rte_strsplit(filepath, strlen(filepath), file_fld, 2, ',');
-
- buff = open_file(file_fld[0], &size);
- if (!buff) {
- free((void *)filepath);
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ vxlan_encap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ vxlan_encap_conf.select_ipv4 = 0;
+ else
return;
+ rte_memcpy(vxlan_encap_conf.vni, &id.vni[1], 3);
+ vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
+ vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
+ vxlan_encap_conf.ip_tos = res->tos;
+ vxlan_encap_conf.ip_ttl = res->ttl;
+ if (vxlan_encap_conf.select_ipv4) {
+ IPV4_ADDR_TO_UINT(res->ip_src, vxlan_encap_conf.ipv4_src);
+ IPV4_ADDR_TO_UINT(res->ip_dst, vxlan_encap_conf.ipv4_dst);
+ } else {
+ IPV6_ADDR_TO_ARRAY(res->ip_src, vxlan_encap_conf.ipv6_src);
+ IPV6_ADDR_TO_ARRAY(res->ip_dst, vxlan_encap_conf.ipv6_dst);
}
-
-#ifdef RTE_NET_I40E
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_process_ddp_package(res->port_id,
- buff, size,
- RTE_PMD_I40E_PKG_OP_WR_ADD);
-#endif
-
- if (ret == -EEXIST)
- fprintf(stderr, "Profile has already existed.\n");
- else if (ret < 0)
- fprintf(stderr, "Failed to load profile.\n");
- else if (file_num == 2)
- save_file(file_fld[1], buff, size);
-
- close_file(buff);
- free((void *)filepath);
+ if (vxlan_encap_conf.select_vlan)
+ vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
+ rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
+ rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
}
-static cmdline_parse_inst_t cmd_ddp_add = {
- .f = cmd_ddp_add_parsed,
+static cmdline_parse_inst_t cmd_set_vxlan = {
+ .f = cmd_set_vxlan_parsed,
.data = NULL,
- .help_str = "ddp add <port_id> <profile_path[,backup_profile_path]>",
+ .help_str = "set vxlan ip-version ipv4|ipv6 vni <vni> udp-src"
+ " <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst <ip-dst>"
+ " eth-src <eth-src> eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_ddp_add_ddp,
- (void *)&cmd_ddp_add_add,
- (void *)&cmd_ddp_add_port_id,
- (void *)&cmd_ddp_add_filepath,
+ (void *)&cmd_set_vxlan_set,
+ (void *)&cmd_set_vxlan_vxlan,
+ (void *)&cmd_set_vxlan_ip_version,
+ (void *)&cmd_set_vxlan_ip_version_value,
+ (void *)&cmd_set_vxlan_vni,
+ (void *)&cmd_set_vxlan_vni_value,
+ (void *)&cmd_set_vxlan_udp_src,
+ (void *)&cmd_set_vxlan_udp_src_value,
+ (void *)&cmd_set_vxlan_udp_dst,
+ (void *)&cmd_set_vxlan_udp_dst_value,
+ (void *)&cmd_set_vxlan_ip_src,
+ (void *)&cmd_set_vxlan_ip_src_value,
+ (void *)&cmd_set_vxlan_ip_dst,
+ (void *)&cmd_set_vxlan_ip_dst_value,
+ (void *)&cmd_set_vxlan_eth_src,
+ (void *)&cmd_set_vxlan_eth_src_value,
+ (void *)&cmd_set_vxlan_eth_dst,
+ (void *)&cmd_set_vxlan_eth_dst_value,
NULL,
},
};
-/* Delete dynamic device personalization*/
-struct cmd_ddp_del_result {
- cmdline_fixed_string_t ddp;
- cmdline_fixed_string_t del;
- portid_t port_id;
- char filepath[];
-};
-
-static cmdline_parse_token_string_t cmd_ddp_del_ddp =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, ddp, "ddp");
-static cmdline_parse_token_string_t cmd_ddp_del_del =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, del, "del");
-static cmdline_parse_token_num_t cmd_ddp_del_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_ddp_del_result, port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_ddp_del_filepath =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, filepath, NULL);
-
-static void
-cmd_ddp_del_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_ddp_del_result *res = parsed_result;
- uint8_t *buff;
- uint32_t size;
- int ret = -ENOTSUP;
-
- if (!all_ports_stopped()) {
- fprintf(stderr, "Please stop all ports first\n");
- return;
- }
-
- buff = open_file(res->filepath, &size);
- if (!buff)
- return;
-
-#ifdef RTE_NET_I40E
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_process_ddp_package(res->port_id,
- buff, size,
- RTE_PMD_I40E_PKG_OP_WR_DEL);
-#endif
-
- if (ret == -EACCES)
- fprintf(stderr, "Profile does not exist.\n");
- else if (ret < 0)
- fprintf(stderr, "Failed to delete profile.\n");
-
- close_file(buff);
-}
-
-static cmdline_parse_inst_t cmd_ddp_del = {
- .f = cmd_ddp_del_parsed,
+static cmdline_parse_inst_t cmd_set_vxlan_tos_ttl = {
+ .f = cmd_set_vxlan_parsed,
.data = NULL,
- .help_str = "ddp del <port_id> <backup_profile_path>",
+ .help_str = "set vxlan-tos-ttl ip-version ipv4|ipv6 vni <vni> udp-src"
+ " <udp-src> udp-dst <udp-dst> ip-tos <ip-tos> ip-ttl <ip-ttl>"
+ " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
+ " eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_ddp_del_ddp,
- (void *)&cmd_ddp_del_del,
- (void *)&cmd_ddp_del_port_id,
- (void *)&cmd_ddp_del_filepath,
+ (void *)&cmd_set_vxlan_set,
+ (void *)&cmd_set_vxlan_vxlan_tos_ttl,
+ (void *)&cmd_set_vxlan_ip_version,
+ (void *)&cmd_set_vxlan_ip_version_value,
+ (void *)&cmd_set_vxlan_vni,
+ (void *)&cmd_set_vxlan_vni_value,
+ (void *)&cmd_set_vxlan_udp_src,
+ (void *)&cmd_set_vxlan_udp_src_value,
+ (void *)&cmd_set_vxlan_udp_dst,
+ (void *)&cmd_set_vxlan_udp_dst_value,
+ (void *)&cmd_set_vxlan_ip_tos,
+ (void *)&cmd_set_vxlan_ip_tos_value,
+ (void *)&cmd_set_vxlan_ip_ttl,
+ (void *)&cmd_set_vxlan_ip_ttl_value,
+ (void *)&cmd_set_vxlan_ip_src,
+ (void *)&cmd_set_vxlan_ip_src_value,
+ (void *)&cmd_set_vxlan_ip_dst,
+ (void *)&cmd_set_vxlan_ip_dst_value,
+ (void *)&cmd_set_vxlan_eth_src,
+ (void *)&cmd_set_vxlan_eth_src_value,
+ (void *)&cmd_set_vxlan_eth_dst,
+ (void *)&cmd_set_vxlan_eth_dst_value,
NULL,
},
};
-/* Get dynamic device personalization profile info */
-struct cmd_ddp_info_result {
- cmdline_fixed_string_t ddp;
- cmdline_fixed_string_t get;
- cmdline_fixed_string_t info;
- char filepath[];
-};
-
-static cmdline_parse_token_string_t cmd_ddp_info_ddp =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, ddp, "ddp");
-static cmdline_parse_token_string_t cmd_ddp_info_get =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, get, "get");
-static cmdline_parse_token_string_t cmd_ddp_info_info =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, info, "info");
-static cmdline_parse_token_string_t cmd_ddp_info_filepath =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, filepath, NULL);
-
-static void
-cmd_ddp_info_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_ddp_info_result *res = parsed_result;
- uint8_t *pkg;
- uint32_t pkg_size;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- uint32_t i, j, n;
- uint8_t *buff;
- uint32_t buff_size = 0;
- struct rte_pmd_i40e_profile_info info;
- uint32_t dev_num = 0;
- struct rte_pmd_i40e_ddp_device_id *devs;
- uint32_t proto_num = 0;
- struct rte_pmd_i40e_proto_info *proto = NULL;
- uint32_t pctype_num = 0;
- struct rte_pmd_i40e_ptype_info *pctype;
- uint32_t ptype_num = 0;
- struct rte_pmd_i40e_ptype_info *ptype;
- uint8_t proto_id;
-
-#endif
-
- pkg = open_file(res->filepath, &pkg_size);
- if (!pkg)
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&info, sizeof(info),
- RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER);
- if (!ret) {
- printf("Global Track id: 0x%x\n", info.track_id);
- printf("Global Version: %d.%d.%d.%d\n",
- info.version.major,
- info.version.minor,
- info.version.update,
- info.version.draft);
- printf("Global Package name: %s\n\n", info.name);
- }
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&info, sizeof(info),
- RTE_PMD_I40E_PKG_INFO_HEADER);
- if (!ret) {
- printf("i40e Profile Track id: 0x%x\n", info.track_id);
- printf("i40e Profile Version: %d.%d.%d.%d\n",
- info.version.major,
- info.version.minor,
- info.version.update,
- info.version.draft);
- printf("i40e Profile name: %s\n\n", info.name);
- }
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&buff_size, sizeof(buff_size),
- RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE);
- if (!ret && buff_size) {
- buff = (uint8_t *)malloc(buff_size);
- if (buff) {
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- buff, buff_size,
- RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES);
- if (!ret)
- printf("Package Notes:\n%s\n\n", buff);
- free(buff);
- }
- }
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&dev_num, sizeof(dev_num),
- RTE_PMD_I40E_PKG_INFO_DEVID_NUM);
- if (!ret && dev_num) {
- buff_size = dev_num * sizeof(struct rte_pmd_i40e_ddp_device_id);
- devs = (struct rte_pmd_i40e_ddp_device_id *)malloc(buff_size);
- if (devs) {
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)devs, buff_size,
- RTE_PMD_I40E_PKG_INFO_DEVID_LIST);
- if (!ret) {
- printf("List of supported devices:\n");
- for (i = 0; i < dev_num; i++) {
- printf(" %04X:%04X %04X:%04X\n",
- devs[i].vendor_dev_id >> 16,
- devs[i].vendor_dev_id & 0xFFFF,
- devs[i].sub_vendor_dev_id >> 16,
- devs[i].sub_vendor_dev_id & 0xFFFF);
- }
- printf("\n");
- }
- free(devs);
- }
- }
-
- /* get information about protocols and packet types */
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&proto_num, sizeof(proto_num),
- RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM);
- if (ret || !proto_num)
- goto no_print_return;
-
- buff_size = proto_num * sizeof(struct rte_pmd_i40e_proto_info);
- proto = (struct rte_pmd_i40e_proto_info *)malloc(buff_size);
- if (!proto)
- goto no_print_return;
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)proto,
- buff_size,
- RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST);
- if (!ret) {
- printf("List of used protocols:\n");
- for (i = 0; i < proto_num; i++)
- printf(" %2u: %s\n", proto[i].proto_id,
- proto[i].name);
- printf("\n");
- }
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
- (uint8_t *)&pctype_num, sizeof(pctype_num),
- RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM);
- if (ret || !pctype_num)
- goto no_print_pctypes;
-
- buff_size = pctype_num * sizeof(struct rte_pmd_i40e_ptype_info);
- pctype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
- if (!pctype)
- goto no_print_pctypes;
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)pctype,
- buff_size,
- RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST);
- if (ret) {
- free(pctype);
- goto no_print_pctypes;
- }
-
- printf("List of defined packet classification types:\n");
- for (i = 0; i < pctype_num; i++) {
- printf(" %2u:", pctype[i].ptype_id);
- for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
- proto_id = pctype[i].protocols[j];
- if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
- for (n = 0; n < proto_num; n++) {
- if (proto[n].proto_id == proto_id) {
- printf(" %s", proto[n].name);
- break;
- }
- }
- }
- }
- printf("\n");
- }
- printf("\n");
- free(pctype);
-
-no_print_pctypes:
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)&ptype_num,
- sizeof(ptype_num),
- RTE_PMD_I40E_PKG_INFO_PTYPE_NUM);
- if (ret || !ptype_num)
- goto no_print_return;
-
- buff_size = ptype_num * sizeof(struct rte_pmd_i40e_ptype_info);
- ptype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
- if (!ptype)
- goto no_print_return;
-
- ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)ptype,
- buff_size,
- RTE_PMD_I40E_PKG_INFO_PTYPE_LIST);
- if (ret) {
- free(ptype);
- goto no_print_return;
- }
- printf("List of defined packet types:\n");
- for (i = 0; i < ptype_num; i++) {
- printf(" %2u:", ptype[i].ptype_id);
- for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
- proto_id = ptype[i].protocols[j];
- if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
- for (n = 0; n < proto_num; n++) {
- if (proto[n].proto_id == proto_id) {
- printf(" %s", proto[n].name);
- break;
- }
- }
- }
- }
- printf("\n");
- }
- free(ptype);
- printf("\n");
-
- ret = 0;
-no_print_return:
- free(proto);
-#endif
- if (ret == -ENOTSUP)
- fprintf(stderr, "Function not supported in PMD\n");
- close_file(pkg);
-}
-
-static cmdline_parse_inst_t cmd_ddp_get_info = {
- .f = cmd_ddp_info_parsed,
+static cmdline_parse_inst_t cmd_set_vxlan_with_vlan = {
+ .f = cmd_set_vxlan_parsed,
.data = NULL,
- .help_str = "ddp get info <profile_path>",
+ .help_str = "set vxlan-with-vlan ip-version ipv4|ipv6 vni <vni>"
+ " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src> ip-dst"
+ " <ip-dst> vlan-tci <vlan-tci> eth-src <eth-src> eth-dst"
+ " <eth-dst>",
.tokens = {
- (void *)&cmd_ddp_info_ddp,
- (void *)&cmd_ddp_info_get,
- (void *)&cmd_ddp_info_info,
- (void *)&cmd_ddp_info_filepath,
+ (void *)&cmd_set_vxlan_set,
+ (void *)&cmd_set_vxlan_vxlan_with_vlan,
+ (void *)&cmd_set_vxlan_ip_version,
+ (void *)&cmd_set_vxlan_ip_version_value,
+ (void *)&cmd_set_vxlan_vni,
+ (void *)&cmd_set_vxlan_vni_value,
+ (void *)&cmd_set_vxlan_udp_src,
+ (void *)&cmd_set_vxlan_udp_src_value,
+ (void *)&cmd_set_vxlan_udp_dst,
+ (void *)&cmd_set_vxlan_udp_dst_value,
+ (void *)&cmd_set_vxlan_ip_src,
+ (void *)&cmd_set_vxlan_ip_src_value,
+ (void *)&cmd_set_vxlan_ip_dst,
+ (void *)&cmd_set_vxlan_ip_dst_value,
+ (void *)&cmd_set_vxlan_vlan,
+ (void *)&cmd_set_vxlan_vlan_value,
+ (void *)&cmd_set_vxlan_eth_src,
+ (void *)&cmd_set_vxlan_eth_src_value,
+ (void *)&cmd_set_vxlan_eth_dst,
+ (void *)&cmd_set_vxlan_eth_dst_value,
NULL,
},
};
-/* Get dynamic device personalization profile info list*/
-#define PROFILE_INFO_SIZE 48
-#define MAX_PROFILE_NUM 16
-
-struct cmd_ddp_get_list_result {
- cmdline_fixed_string_t ddp;
- cmdline_fixed_string_t get;
- cmdline_fixed_string_t list;
- portid_t port_id;
+/** Set NVGRE encapsulation details */
+struct cmd_set_nvgre_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t nvgre;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t tni;
+ cmdline_ipaddr_t ip_src;
+ cmdline_ipaddr_t ip_dst;
+ uint16_t tci;
+ struct rte_ether_addr eth_src;
+ struct rte_ether_addr eth_dst;
};
-static cmdline_parse_token_string_t cmd_ddp_get_list_ddp =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, ddp, "ddp");
-static cmdline_parse_token_string_t cmd_ddp_get_list_get =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, get, "get");
-static cmdline_parse_token_string_t cmd_ddp_get_list_list =
- TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, list, "list");
-static cmdline_parse_token_num_t cmd_ddp_get_list_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_ddp_get_list_result, port_id,
- RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_nvgre_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, set, "set");
+static cmdline_parse_token_string_t cmd_set_nvgre_nvgre =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre, "nvgre");
+static cmdline_parse_token_string_t cmd_set_nvgre_nvgre_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, nvgre,
+ "nvgre-with-vlan");
+static cmdline_parse_token_string_t cmd_set_nvgre_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "ip-version");
+static cmdline_parse_token_string_t cmd_set_nvgre_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, ip_version,
+ "ipv4#ipv6");
+static cmdline_parse_token_string_t cmd_set_nvgre_tni =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "tni");
+static cmdline_parse_token_num_t cmd_set_nvgre_tni_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tni, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_nvgre_ip_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "ip-src");
+static cmdline_parse_token_num_t cmd_set_nvgre_ip_src_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_src);
+static cmdline_parse_token_string_t cmd_set_nvgre_ip_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "ip-dst");
+static cmdline_parse_token_ipaddr_t cmd_set_nvgre_ip_dst_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_nvgre_result, ip_dst);
+static cmdline_parse_token_string_t cmd_set_nvgre_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "vlan-tci");
+static cmdline_parse_token_num_t cmd_set_nvgre_vlan_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_nvgre_result, tci, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_nvgre_eth_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "eth-src");
+static cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_src_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_src);
+static cmdline_parse_token_string_t cmd_set_nvgre_eth_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_nvgre_result, pos_token,
+ "eth-dst");
+static cmdline_parse_token_etheraddr_t cmd_set_nvgre_eth_dst_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_nvgre_result, eth_dst);
-static void
-cmd_ddp_get_list_parsed(
- __rte_unused void *parsed_result,
+static void cmd_set_nvgre_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
-#ifdef RTE_NET_I40E
- struct cmd_ddp_get_list_result *res = parsed_result;
- struct rte_pmd_i40e_profile_list *p_list;
- struct rte_pmd_i40e_profile_info *p_info;
- uint32_t p_num;
- uint32_t size;
- uint32_t i;
-#endif
- int ret = -ENOTSUP;
+ struct cmd_set_nvgre_result *res = parsed_result;
+ union {
+ uint32_t nvgre_tni;
+ uint8_t tni[4];
+ } id = {
+ .nvgre_tni = rte_cpu_to_be_32(res->tni) & RTE_BE32(0x00ffffff),
+ };
-#ifdef RTE_NET_I40E
- size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
- p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
- if (!p_list) {
- fprintf(stderr, "%s: Failed to malloc buffer\n", __func__);
+ if (strcmp(res->nvgre, "nvgre") == 0)
+ nvgre_encap_conf.select_vlan = 0;
+ else if (strcmp(res->nvgre, "nvgre-with-vlan") == 0)
+ nvgre_encap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ nvgre_encap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ nvgre_encap_conf.select_ipv4 = 0;
+ else
return;
+ rte_memcpy(nvgre_encap_conf.tni, &id.tni[1], 3);
+ if (nvgre_encap_conf.select_ipv4) {
+ IPV4_ADDR_TO_UINT(res->ip_src, nvgre_encap_conf.ipv4_src);
+ IPV4_ADDR_TO_UINT(res->ip_dst, nvgre_encap_conf.ipv4_dst);
+ } else {
+ IPV6_ADDR_TO_ARRAY(res->ip_src, nvgre_encap_conf.ipv6_src);
+ IPV6_ADDR_TO_ARRAY(res->ip_dst, nvgre_encap_conf.ipv6_dst);
}
-
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_get_ddp_list(res->port_id,
- (uint8_t *)p_list, size);
-
- if (!ret) {
- p_num = p_list->p_count;
- printf("Profile number is: %d\n\n", p_num);
-
- for (i = 0; i < p_num; i++) {
- p_info = &p_list->p_info[i];
- printf("Profile %d:\n", i);
- printf("Track id: 0x%x\n", p_info->track_id);
- printf("Version: %d.%d.%d.%d\n",
- p_info->version.major,
- p_info->version.minor,
- p_info->version.update,
- p_info->version.draft);
- printf("Profile name: %s\n\n", p_info->name);
- }
- }
-
- free(p_list);
-#endif
-
- if (ret < 0)
- fprintf(stderr, "Failed to get ddp list\n");
+ if (nvgre_encap_conf.select_vlan)
+ nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
+ rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
+ rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
}
-static cmdline_parse_inst_t cmd_ddp_get_list = {
- .f = cmd_ddp_get_list_parsed,
+static cmdline_parse_inst_t cmd_set_nvgre = {
+ .f = cmd_set_nvgre_parsed,
+ .data = NULL,
+ .help_str = "set nvgre ip-version <ipv4|ipv6> tni <tni> ip-src"
+ " <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
+ " eth-dst <eth-dst>",
+ .tokens = {
+ (void *)&cmd_set_nvgre_set,
+ (void *)&cmd_set_nvgre_nvgre,
+ (void *)&cmd_set_nvgre_ip_version,
+ (void *)&cmd_set_nvgre_ip_version_value,
+ (void *)&cmd_set_nvgre_tni,
+ (void *)&cmd_set_nvgre_tni_value,
+ (void *)&cmd_set_nvgre_ip_src,
+ (void *)&cmd_set_nvgre_ip_src_value,
+ (void *)&cmd_set_nvgre_ip_dst,
+ (void *)&cmd_set_nvgre_ip_dst_value,
+ (void *)&cmd_set_nvgre_eth_src,
+ (void *)&cmd_set_nvgre_eth_src_value,
+ (void *)&cmd_set_nvgre_eth_dst,
+ (void *)&cmd_set_nvgre_eth_dst_value,
+ NULL,
+ },
+};
+
+static cmdline_parse_inst_t cmd_set_nvgre_with_vlan = {
+ .f = cmd_set_nvgre_parsed,
.data = NULL,
- .help_str = "ddp get list <port_id>",
+ .help_str = "set nvgre-with-vlan ip-version <ipv4|ipv6> tni <tni>"
+ " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
+ " eth-src <eth-src> eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_ddp_get_list_ddp,
- (void *)&cmd_ddp_get_list_get,
- (void *)&cmd_ddp_get_list_list,
- (void *)&cmd_ddp_get_list_port_id,
+ (void *)&cmd_set_nvgre_set,
+ (void *)&cmd_set_nvgre_nvgre_with_vlan,
+ (void *)&cmd_set_nvgre_ip_version,
+ (void *)&cmd_set_nvgre_ip_version_value,
+ (void *)&cmd_set_nvgre_tni,
+ (void *)&cmd_set_nvgre_tni_value,
+ (void *)&cmd_set_nvgre_ip_src,
+ (void *)&cmd_set_nvgre_ip_src_value,
+ (void *)&cmd_set_nvgre_ip_dst,
+ (void *)&cmd_set_nvgre_ip_dst_value,
+ (void *)&cmd_set_nvgre_vlan,
+ (void *)&cmd_set_nvgre_vlan_value,
+ (void *)&cmd_set_nvgre_eth_src,
+ (void *)&cmd_set_nvgre_eth_src_value,
+ (void *)&cmd_set_nvgre_eth_dst,
+ (void *)&cmd_set_nvgre_eth_dst_value,
NULL,
},
};
-/* Configure input set */
-struct cmd_cfg_input_set_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t cfg;
- portid_t port_id;
- cmdline_fixed_string_t pctype;
- uint8_t pctype_id;
- cmdline_fixed_string_t inset_type;
- cmdline_fixed_string_t opt;
- cmdline_fixed_string_t field;
- uint8_t field_idx;
+/** Set L2 encapsulation details */
+struct cmd_set_l2_encap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t l2_encap;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
+ uint16_t tci;
+ struct rte_ether_addr eth_src;
+ struct rte_ether_addr eth_dst;
};
-static void
-cmd_cfg_input_set_parsed(
- __rte_unused void *parsed_result,
+static cmdline_parse_token_string_t cmd_set_l2_encap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, set, "set");
+static cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, l2_encap, "l2_encap");
+static cmdline_parse_token_string_t cmd_set_l2_encap_l2_encap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, l2_encap,
+ "l2_encap-with-vlan");
+static cmdline_parse_token_string_t cmd_set_l2_encap_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
+ "ip-version");
+static cmdline_parse_token_string_t cmd_set_l2_encap_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, ip_version,
+ "ipv4#ipv6");
+static cmdline_parse_token_string_t cmd_set_l2_encap_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
+ "vlan-tci");
+static cmdline_parse_token_num_t cmd_set_l2_encap_vlan_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_l2_encap_result, tci, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_l2_encap_eth_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
+ "eth-src");
+static cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_src_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result, eth_src);
+static cmdline_parse_token_string_t cmd_set_l2_encap_eth_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_encap_result, pos_token,
+ "eth-dst");
+static cmdline_parse_token_etheraddr_t cmd_set_l2_encap_eth_dst_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_l2_encap_result, eth_dst);
+
+static void cmd_set_l2_encap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
-#ifdef RTE_NET_I40E
- struct cmd_cfg_input_set_result *res = parsed_result;
- enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
- struct rte_pmd_i40e_inset inset;
-#endif
- int ret = -ENOTSUP;
-
- if (!all_ports_stopped()) {
- fprintf(stderr, "Please stop all ports first\n");
- return;
- }
-
-#ifdef RTE_NET_I40E
- if (!strcmp(res->inset_type, "hash_inset"))
- inset_type = INSET_HASH;
- else if (!strcmp(res->inset_type, "fdir_inset"))
- inset_type = INSET_FDIR;
- else if (!strcmp(res->inset_type, "fdir_flx_inset"))
- inset_type = INSET_FDIR_FLX;
- ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id,
- &inset, inset_type);
- if (ret) {
- fprintf(stderr, "Failed to get input set.\n");
- return;
- }
-
- if (!strcmp(res->opt, "get")) {
- ret = rte_pmd_i40e_inset_field_get(inset.inset,
- res->field_idx);
- if (ret)
- printf("Field index %d is enabled.\n", res->field_idx);
- else
- printf("Field index %d is disabled.\n", res->field_idx);
- return;
- } else if (!strcmp(res->opt, "set"))
- ret = rte_pmd_i40e_inset_field_set(&inset.inset,
- res->field_idx);
- else if (!strcmp(res->opt, "clear"))
- ret = rte_pmd_i40e_inset_field_clear(&inset.inset,
- res->field_idx);
- if (ret) {
- fprintf(stderr, "Failed to configure input set field.\n");
- return;
- }
+ struct cmd_set_l2_encap_result *res = parsed_result;
- ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
- &inset, inset_type);
- if (ret) {
- fprintf(stderr, "Failed to set input set.\n");
+ if (strcmp(res->l2_encap, "l2_encap") == 0)
+ l2_encap_conf.select_vlan = 0;
+ else if (strcmp(res->l2_encap, "l2_encap-with-vlan") == 0)
+ l2_encap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ l2_encap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ l2_encap_conf.select_ipv4 = 0;
+ else
return;
- }
-#endif
-
- if (ret == -ENOTSUP)
- fprintf(stderr, "Function not supported\n");
+ if (l2_encap_conf.select_vlan)
+ l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
+ rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
+ rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
}
-static cmdline_parse_token_string_t cmd_cfg_input_set_port =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- port, "port");
-static cmdline_parse_token_string_t cmd_cfg_input_set_cfg =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- cfg, "config");
-static cmdline_parse_token_num_t cmd_cfg_input_set_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_cfg_input_set_pctype =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- pctype, "pctype");
-static cmdline_parse_token_num_t cmd_cfg_input_set_pctype_id =
- TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
- pctype_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_cfg_input_set_inset_type =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- inset_type,
- "hash_inset#fdir_inset#fdir_flx_inset");
-static cmdline_parse_token_string_t cmd_cfg_input_set_opt =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- opt, "get#set#clear");
-static cmdline_parse_token_string_t cmd_cfg_input_set_field =
- TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
- field, "field");
-static cmdline_parse_token_num_t cmd_cfg_input_set_field_idx =
- TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
- field_idx, RTE_UINT8);
-
-static cmdline_parse_inst_t cmd_cfg_input_set = {
- .f = cmd_cfg_input_set_parsed,
+static cmdline_parse_inst_t cmd_set_l2_encap = {
+ .f = cmd_set_l2_encap_parsed,
+ .data = NULL,
+ .help_str = "set l2_encap ip-version ipv4|ipv6"
+ " eth-src <eth-src> eth-dst <eth-dst>",
+ .tokens = {
+ (void *)&cmd_set_l2_encap_set,
+ (void *)&cmd_set_l2_encap_l2_encap,
+ (void *)&cmd_set_l2_encap_ip_version,
+ (void *)&cmd_set_l2_encap_ip_version_value,
+ (void *)&cmd_set_l2_encap_eth_src,
+ (void *)&cmd_set_l2_encap_eth_src_value,
+ (void *)&cmd_set_l2_encap_eth_dst,
+ (void *)&cmd_set_l2_encap_eth_dst_value,
+ NULL,
+ },
+};
+
+static cmdline_parse_inst_t cmd_set_l2_encap_with_vlan = {
+ .f = cmd_set_l2_encap_parsed,
.data = NULL,
- .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
- "fdir_inset|fdir_flx_inset get|set|clear field <field_idx>",
+ .help_str = "set l2_encap-with-vlan ip-version ipv4|ipv6"
+ " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_cfg_input_set_port,
- (void *)&cmd_cfg_input_set_cfg,
- (void *)&cmd_cfg_input_set_port_id,
- (void *)&cmd_cfg_input_set_pctype,
- (void *)&cmd_cfg_input_set_pctype_id,
- (void *)&cmd_cfg_input_set_inset_type,
- (void *)&cmd_cfg_input_set_opt,
- (void *)&cmd_cfg_input_set_field,
- (void *)&cmd_cfg_input_set_field_idx,
+ (void *)&cmd_set_l2_encap_set,
+ (void *)&cmd_set_l2_encap_l2_encap_with_vlan,
+ (void *)&cmd_set_l2_encap_ip_version,
+ (void *)&cmd_set_l2_encap_ip_version_value,
+ (void *)&cmd_set_l2_encap_vlan,
+ (void *)&cmd_set_l2_encap_vlan_value,
+ (void *)&cmd_set_l2_encap_eth_src,
+ (void *)&cmd_set_l2_encap_eth_src_value,
+ (void *)&cmd_set_l2_encap_eth_dst,
+ (void *)&cmd_set_l2_encap_eth_dst_value,
NULL,
},
};
-/* Clear input set */
-struct cmd_clear_input_set_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t cfg;
- portid_t port_id;
- cmdline_fixed_string_t pctype;
- uint8_t pctype_id;
- cmdline_fixed_string_t inset_type;
- cmdline_fixed_string_t clear;
- cmdline_fixed_string_t all;
+/** Set L2 decapsulation details */
+struct cmd_set_l2_decap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t l2_decap;
+ cmdline_fixed_string_t pos_token;
+ uint32_t vlan_present:1;
};
-static void
-cmd_clear_input_set_parsed(
- __rte_unused void *parsed_result,
+static cmdline_parse_token_string_t cmd_set_l2_decap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, set, "set");
+static cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, l2_decap,
+ "l2_decap");
+static cmdline_parse_token_string_t cmd_set_l2_decap_l2_decap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_l2_decap_result, l2_decap,
+ "l2_decap-with-vlan");
+
+static void cmd_set_l2_decap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
-#ifdef RTE_NET_I40E
- struct cmd_clear_input_set_result *res = parsed_result;
- enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
- struct rte_pmd_i40e_inset inset;
-#endif
- int ret = -ENOTSUP;
-
- if (!all_ports_stopped()) {
- fprintf(stderr, "Please stop all ports first\n");
- return;
- }
-
-#ifdef RTE_NET_I40E
- if (!strcmp(res->inset_type, "hash_inset"))
- inset_type = INSET_HASH;
- else if (!strcmp(res->inset_type, "fdir_inset"))
- inset_type = INSET_FDIR;
- else if (!strcmp(res->inset_type, "fdir_flx_inset"))
- inset_type = INSET_FDIR_FLX;
-
- memset(&inset, 0, sizeof(inset));
-
- ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id,
- &inset, inset_type);
- if (ret) {
- fprintf(stderr, "Failed to clear input set.\n");
- return;
- }
-
-#endif
+ struct cmd_set_l2_decap_result *res = parsed_result;
- if (ret == -ENOTSUP)
- fprintf(stderr, "Function not supported\n");
+ if (strcmp(res->l2_decap, "l2_decap") == 0)
+ l2_decap_conf.select_vlan = 0;
+ else if (strcmp(res->l2_decap, "l2_decap-with-vlan") == 0)
+ l2_decap_conf.select_vlan = 1;
}
-static cmdline_parse_token_string_t cmd_clear_input_set_port =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- port, "port");
-static cmdline_parse_token_string_t cmd_clear_input_set_cfg =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- cfg, "config");
-static cmdline_parse_token_num_t cmd_clear_input_set_port_id =
- TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_clear_input_set_pctype =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- pctype, "pctype");
-static cmdline_parse_token_num_t cmd_clear_input_set_pctype_id =
- TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
- pctype_id, RTE_UINT8);
-static cmdline_parse_token_string_t cmd_clear_input_set_inset_type =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- inset_type,
- "hash_inset#fdir_inset#fdir_flx_inset");
-static cmdline_parse_token_string_t cmd_clear_input_set_clear =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- clear, "clear");
-static cmdline_parse_token_string_t cmd_clear_input_set_all =
- TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
- all, "all");
-
-static cmdline_parse_inst_t cmd_clear_input_set = {
- .f = cmd_clear_input_set_parsed,
+static cmdline_parse_inst_t cmd_set_l2_decap = {
+ .f = cmd_set_l2_decap_parsed,
.data = NULL,
- .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
- "fdir_inset|fdir_flx_inset clear all",
+ .help_str = "set l2_decap",
.tokens = {
- (void *)&cmd_clear_input_set_port,
- (void *)&cmd_clear_input_set_cfg,
- (void *)&cmd_clear_input_set_port_id,
- (void *)&cmd_clear_input_set_pctype,
- (void *)&cmd_clear_input_set_pctype_id,
- (void *)&cmd_clear_input_set_inset_type,
- (void *)&cmd_clear_input_set_clear,
- (void *)&cmd_clear_input_set_all,
+ (void *)&cmd_set_l2_decap_set,
+ (void *)&cmd_set_l2_decap_l2_decap,
NULL,
},
};
-/* show vf stats */
+static cmdline_parse_inst_t cmd_set_l2_decap_with_vlan = {
+ .f = cmd_set_l2_decap_parsed,
+ .data = NULL,
+ .help_str = "set l2_decap-with-vlan",
+ .tokens = {
+ (void *)&cmd_set_l2_decap_set,
+ (void *)&cmd_set_l2_decap_l2_decap_with_vlan,
+ NULL,
+ },
+};
-/* Common result structure for show vf stats */
-struct cmd_show_vf_stats_result {
- cmdline_fixed_string_t show;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t stats;
- portid_t port_id;
- uint16_t vf_id;
+/** Set MPLSoGRE encapsulation details */
+struct cmd_set_mplsogre_encap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t mplsogre;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
+ uint32_t label;
+ cmdline_ipaddr_t ip_src;
+ cmdline_ipaddr_t ip_dst;
+ uint16_t tci;
+ struct rte_ether_addr eth_src;
+ struct rte_ether_addr eth_dst;
};
-/* Common CLI fields show vf stats*/
-static cmdline_parse_token_string_t cmd_show_vf_stats_show =
- TOKEN_STRING_INITIALIZER
- (struct cmd_show_vf_stats_result,
- show, "show");
-static cmdline_parse_token_string_t cmd_show_vf_stats_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_show_vf_stats_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_show_vf_stats_stats =
- TOKEN_STRING_INITIALIZER
- (struct cmd_show_vf_stats_result,
- stats, "stats");
-static cmdline_parse_token_num_t cmd_show_vf_stats_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_show_vf_stats_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_show_vf_stats_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_show_vf_stats_result,
- vf_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result, set,
+ "set");
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result, mplsogre,
+ "mplsogre_encap");
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_mplsogre_encap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ mplsogre, "mplsogre_encap-with-vlan");
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "ip-version");
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ ip_version, "ipv4#ipv6");
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_label =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "label");
+static cmdline_parse_token_num_t cmd_set_mplsogre_encap_label_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result, label,
+ RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "ip-src");
+static cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_src_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result, ip_src);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_ip_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "ip-dst");
+static cmdline_parse_token_ipaddr_t cmd_set_mplsogre_encap_ip_dst_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result, ip_dst);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "vlan-tci");
+static cmdline_parse_token_num_t cmd_set_mplsogre_encap_vlan_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsogre_encap_result, tci,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "eth-src");
+static cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_src_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ eth_src);
+static cmdline_parse_token_string_t cmd_set_mplsogre_encap_eth_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ pos_token, "eth-dst");
+static cmdline_parse_token_etheraddr_t cmd_set_mplsogre_encap_eth_dst_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsogre_encap_result,
+ eth_dst);
-static void
-cmd_show_vf_stats_parsed(
- void *parsed_result,
+static void cmd_set_mplsogre_encap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_show_vf_stats_result *res = parsed_result;
- struct rte_eth_stats stats;
- int ret = -ENOTSUP;
- static const char *nic_stats_border = "########################";
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
- memset(&stats, 0, sizeof(stats));
-
-#ifdef RTE_NET_I40E
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_get_vf_stats(res->port_id,
- res->vf_id,
- &stats);
-#endif
-#ifdef RTE_NET_BNXT
- if (ret == -ENOTSUP)
- ret = rte_pmd_bnxt_get_vf_stats(res->port_id,
- res->vf_id,
- &stats);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-
- printf("\n %s NIC statistics for port %-2d vf %-2d %s\n",
- nic_stats_border, res->port_id, res->vf_id, nic_stats_border);
-
- printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: "
- "%-"PRIu64"\n",
- stats.ipackets, stats.imissed, stats.ibytes);
- printf(" RX-errors: %-"PRIu64"\n", stats.ierrors);
- printf(" RX-nombuf: %-10"PRIu64"\n",
- stats.rx_nombuf);
- printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: "
- "%-"PRIu64"\n",
- stats.opackets, stats.oerrors, stats.obytes);
+ struct cmd_set_mplsogre_encap_result *res = parsed_result;
+ union {
+ uint32_t mplsogre_label;
+ uint8_t label[4];
+ } id = {
+ .mplsogre_label = rte_cpu_to_be_32(res->label<<12),
+ };
- printf(" %s############################%s\n",
- nic_stats_border, nic_stats_border);
+ if (strcmp(res->mplsogre, "mplsogre_encap") == 0)
+ mplsogre_encap_conf.select_vlan = 0;
+ else if (strcmp(res->mplsogre, "mplsogre_encap-with-vlan") == 0)
+ mplsogre_encap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ mplsogre_encap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ mplsogre_encap_conf.select_ipv4 = 0;
+ else
+ return;
+ rte_memcpy(mplsogre_encap_conf.label, &id.label, 3);
+ if (mplsogre_encap_conf.select_ipv4) {
+ IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src);
+ IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst);
+ } else {
+ IPV6_ADDR_TO_ARRAY(res->ip_src, mplsogre_encap_conf.ipv6_src);
+ IPV6_ADDR_TO_ARRAY(res->ip_dst, mplsogre_encap_conf.ipv6_dst);
+ }
+ if (mplsogre_encap_conf.select_vlan)
+ mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
+ rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
+ rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
}
-static cmdline_parse_inst_t cmd_show_vf_stats = {
- .f = cmd_show_vf_stats_parsed,
+static cmdline_parse_inst_t cmd_set_mplsogre_encap = {
+ .f = cmd_set_mplsogre_encap_parsed,
.data = NULL,
- .help_str = "show vf stats <port_id> <vf_id>",
+ .help_str = "set mplsogre_encap ip-version ipv4|ipv6 label <label>"
+ " ip-src <ip-src> ip-dst <ip-dst> eth-src <eth-src>"
+ " eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_show_vf_stats_show,
- (void *)&cmd_show_vf_stats_vf,
- (void *)&cmd_show_vf_stats_stats,
- (void *)&cmd_show_vf_stats_port_id,
- (void *)&cmd_show_vf_stats_vf_id,
+ (void *)&cmd_set_mplsogre_encap_set,
+ (void *)&cmd_set_mplsogre_encap_mplsogre_encap,
+ (void *)&cmd_set_mplsogre_encap_ip_version,
+ (void *)&cmd_set_mplsogre_encap_ip_version_value,
+ (void *)&cmd_set_mplsogre_encap_label,
+ (void *)&cmd_set_mplsogre_encap_label_value,
+ (void *)&cmd_set_mplsogre_encap_ip_src,
+ (void *)&cmd_set_mplsogre_encap_ip_src_value,
+ (void *)&cmd_set_mplsogre_encap_ip_dst,
+ (void *)&cmd_set_mplsogre_encap_ip_dst_value,
+ (void *)&cmd_set_mplsogre_encap_eth_src,
+ (void *)&cmd_set_mplsogre_encap_eth_src_value,
+ (void *)&cmd_set_mplsogre_encap_eth_dst,
+ (void *)&cmd_set_mplsogre_encap_eth_dst_value,
NULL,
},
};
-/* clear vf stats */
+static cmdline_parse_inst_t cmd_set_mplsogre_encap_with_vlan = {
+ .f = cmd_set_mplsogre_encap_parsed,
+ .data = NULL,
+ .help_str = "set mplsogre_encap-with-vlan ip-version ipv4|ipv6"
+ " label <label> ip-src <ip-src> ip-dst <ip-dst>"
+ " vlan-tci <vlan-tci> eth-src <eth-src> eth-dst <eth-dst>",
+ .tokens = {
+ (void *)&cmd_set_mplsogre_encap_set,
+ (void *)&cmd_set_mplsogre_encap_mplsogre_encap_with_vlan,
+ (void *)&cmd_set_mplsogre_encap_ip_version,
+ (void *)&cmd_set_mplsogre_encap_ip_version_value,
+ (void *)&cmd_set_mplsogre_encap_label,
+ (void *)&cmd_set_mplsogre_encap_label_value,
+ (void *)&cmd_set_mplsogre_encap_ip_src,
+ (void *)&cmd_set_mplsogre_encap_ip_src_value,
+ (void *)&cmd_set_mplsogre_encap_ip_dst,
+ (void *)&cmd_set_mplsogre_encap_ip_dst_value,
+ (void *)&cmd_set_mplsogre_encap_vlan,
+ (void *)&cmd_set_mplsogre_encap_vlan_value,
+ (void *)&cmd_set_mplsogre_encap_eth_src,
+ (void *)&cmd_set_mplsogre_encap_eth_src_value,
+ (void *)&cmd_set_mplsogre_encap_eth_dst,
+ (void *)&cmd_set_mplsogre_encap_eth_dst_value,
+ NULL,
+ },
+};
-/* Common result structure for clear vf stats */
-struct cmd_clear_vf_stats_result {
- cmdline_fixed_string_t clear;
- cmdline_fixed_string_t vf;
- cmdline_fixed_string_t stats;
- portid_t port_id;
- uint16_t vf_id;
+/** Set MPLSoGRE decapsulation details */
+struct cmd_set_mplsogre_decap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t mplsogre;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
};
-/* Common CLI fields clear vf stats*/
-static cmdline_parse_token_string_t cmd_clear_vf_stats_clear =
- TOKEN_STRING_INITIALIZER
- (struct cmd_clear_vf_stats_result,
- clear, "clear");
-static cmdline_parse_token_string_t cmd_clear_vf_stats_vf =
- TOKEN_STRING_INITIALIZER
- (struct cmd_clear_vf_stats_result,
- vf, "vf");
-static cmdline_parse_token_string_t cmd_clear_vf_stats_stats =
- TOKEN_STRING_INITIALIZER
- (struct cmd_clear_vf_stats_result,
- stats, "stats");
-static cmdline_parse_token_num_t cmd_clear_vf_stats_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_clear_vf_stats_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_clear_vf_stats_vf_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_clear_vf_stats_result,
- vf_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsogre_decap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result, set,
+ "set");
+static cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result, mplsogre,
+ "mplsogre_decap");
+static cmdline_parse_token_string_t cmd_set_mplsogre_decap_mplsogre_decap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
+ mplsogre, "mplsogre_decap-with-vlan");
+static cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
+ pos_token, "ip-version");
+static cmdline_parse_token_string_t cmd_set_mplsogre_decap_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsogre_decap_result,
+ ip_version, "ipv4#ipv6");
-static void
-cmd_clear_vf_stats_parsed(
- void *parsed_result,
+static void cmd_set_mplsogre_decap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_clear_vf_stats_result *res = parsed_result;
- int ret = -ENOTSUP;
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- if (ret == -ENOTSUP)
- ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
- res->vf_id);
-#endif
-#ifdef RTE_NET_BNXT
- if (ret == -ENOTSUP)
- ret = rte_pmd_bnxt_reset_vf_stats(res->port_id,
- res->vf_id);
-#endif
+ struct cmd_set_mplsogre_decap_result *res = parsed_result;
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
+ if (strcmp(res->mplsogre, "mplsogre_decap") == 0)
+ mplsogre_decap_conf.select_vlan = 0;
+ else if (strcmp(res->mplsogre, "mplsogre_decap-with-vlan") == 0)
+ mplsogre_decap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ mplsogre_decap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ mplsogre_decap_conf.select_ipv4 = 0;
}
-static cmdline_parse_inst_t cmd_clear_vf_stats = {
- .f = cmd_clear_vf_stats_parsed,
+static cmdline_parse_inst_t cmd_set_mplsogre_decap = {
+ .f = cmd_set_mplsogre_decap_parsed,
.data = NULL,
- .help_str = "clear vf stats <port_id> <vf_id>",
+ .help_str = "set mplsogre_decap ip-version ipv4|ipv6",
.tokens = {
- (void *)&cmd_clear_vf_stats_clear,
- (void *)&cmd_clear_vf_stats_vf,
- (void *)&cmd_clear_vf_stats_stats,
- (void *)&cmd_clear_vf_stats_port_id,
- (void *)&cmd_clear_vf_stats_vf_id,
+ (void *)&cmd_set_mplsogre_decap_set,
+ (void *)&cmd_set_mplsogre_decap_mplsogre_decap,
+ (void *)&cmd_set_mplsogre_decap_ip_version,
+ (void *)&cmd_set_mplsogre_decap_ip_version_value,
NULL,
},
};
-/* port config pctype mapping reset */
+static cmdline_parse_inst_t cmd_set_mplsogre_decap_with_vlan = {
+ .f = cmd_set_mplsogre_decap_parsed,
+ .data = NULL,
+ .help_str = "set mplsogre_decap-with-vlan ip-version ipv4|ipv6",
+ .tokens = {
+ (void *)&cmd_set_mplsogre_decap_set,
+ (void *)&cmd_set_mplsogre_decap_mplsogre_decap_with_vlan,
+ (void *)&cmd_set_mplsogre_decap_ip_version,
+ (void *)&cmd_set_mplsogre_decap_ip_version_value,
+ NULL,
+ },
+};
-/* Common result structure for port config pctype mapping reset */
-struct cmd_pctype_mapping_reset_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t config;
- portid_t port_id;
- cmdline_fixed_string_t pctype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t reset;
+/** Set MPLSoUDP encapsulation details */
+struct cmd_set_mplsoudp_encap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t mplsoudp;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
+ uint32_t label;
+ uint16_t udp_src;
+ uint16_t udp_dst;
+ cmdline_ipaddr_t ip_src;
+ cmdline_ipaddr_t ip_dst;
+ uint16_t tci;
+ struct rte_ether_addr eth_src;
+ struct rte_ether_addr eth_dst;
};
-/* Common CLI fields for port config pctype mapping reset*/
-static cmdline_parse_token_string_t cmd_pctype_mapping_reset_port =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- port, "port");
-static cmdline_parse_token_string_t cmd_pctype_mapping_reset_config =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- config, "config");
-static cmdline_parse_token_num_t cmd_pctype_mapping_reset_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_pctype_mapping_reset_pctype =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- pctype, "pctype");
-static cmdline_parse_token_string_t cmd_pctype_mapping_reset_mapping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_pctype_mapping_reset_reset =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_reset_result,
- reset, "reset");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result, set,
+ "set");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result, mplsoudp,
+ "mplsoudp_encap");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ mplsoudp, "mplsoudp_encap-with-vlan");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "ip-version");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ ip_version, "ipv4#ipv6");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_label =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "label");
+static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_label_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, label,
+ RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "udp-src");
+static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_src_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, udp_src,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_udp_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "udp-dst");
+static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_udp_dst_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, udp_dst,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "ip-src");
+static cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_src_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result, ip_src);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_ip_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "ip-dst");
+static cmdline_parse_token_ipaddr_t cmd_set_mplsoudp_encap_ip_dst_value =
+ TOKEN_IPADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result, ip_dst);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "vlan-tci");
+static cmdline_parse_token_num_t cmd_set_mplsoudp_encap_vlan_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_mplsoudp_encap_result, tci,
+ RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_src =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "eth-src");
+static cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_src_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ eth_src);
+static cmdline_parse_token_string_t cmd_set_mplsoudp_encap_eth_dst =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ pos_token, "eth-dst");
+static cmdline_parse_token_etheraddr_t cmd_set_mplsoudp_encap_eth_dst_value =
+ TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_mplsoudp_encap_result,
+ eth_dst);
-static void
-cmd_pctype_mapping_reset_parsed(
- void *parsed_result,
+static void cmd_set_mplsoudp_encap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_pctype_mapping_reset_result *res = parsed_result;
- int ret = -ENOTSUP;
+ struct cmd_set_mplsoudp_encap_result *res = parsed_result;
+ union {
+ uint32_t mplsoudp_label;
+ uint8_t label[4];
+ } id = {
+ .mplsoudp_label = rte_cpu_to_be_32(res->label<<12),
+ };
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ if (strcmp(res->mplsoudp, "mplsoudp_encap") == 0)
+ mplsoudp_encap_conf.select_vlan = 0;
+ else if (strcmp(res->mplsoudp, "mplsoudp_encap-with-vlan") == 0)
+ mplsoudp_encap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ mplsoudp_encap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ mplsoudp_encap_conf.select_ipv4 = 0;
+ else
return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_flow_type_mapping_reset(res->port_id);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3);
+ mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
+ mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
+ if (mplsoudp_encap_conf.select_ipv4) {
+ IPV4_ADDR_TO_UINT(res->ip_src, mplsoudp_encap_conf.ipv4_src);
+ IPV4_ADDR_TO_UINT(res->ip_dst, mplsoudp_encap_conf.ipv4_dst);
+ } else {
+ IPV6_ADDR_TO_ARRAY(res->ip_src, mplsoudp_encap_conf.ipv6_src);
+ IPV6_ADDR_TO_ARRAY(res->ip_dst, mplsoudp_encap_conf.ipv6_dst);
}
+ if (mplsoudp_encap_conf.select_vlan)
+ mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
+ rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
+ rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+ RTE_ETHER_ADDR_LEN);
}
-static cmdline_parse_inst_t cmd_pctype_mapping_reset = {
- .f = cmd_pctype_mapping_reset_parsed,
+static cmdline_parse_inst_t cmd_set_mplsoudp_encap = {
+ .f = cmd_set_mplsoudp_encap_parsed,
.data = NULL,
- .help_str = "port config <port_id> pctype mapping reset",
+ .help_str = "set mplsoudp_encap ip-version ipv4|ipv6 label <label>"
+ " udp-src <udp-src> udp-dst <udp-dst> ip-src <ip-src>"
+ " ip-dst <ip-dst> eth-src <eth-src> eth-dst <eth-dst>",
.tokens = {
- (void *)&cmd_pctype_mapping_reset_port,
- (void *)&cmd_pctype_mapping_reset_config,
- (void *)&cmd_pctype_mapping_reset_port_id,
- (void *)&cmd_pctype_mapping_reset_pctype,
- (void *)&cmd_pctype_mapping_reset_mapping,
- (void *)&cmd_pctype_mapping_reset_reset,
+ (void *)&cmd_set_mplsoudp_encap_set,
+ (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap,
+ (void *)&cmd_set_mplsoudp_encap_ip_version,
+ (void *)&cmd_set_mplsoudp_encap_ip_version_value,
+ (void *)&cmd_set_mplsoudp_encap_label,
+ (void *)&cmd_set_mplsoudp_encap_label_value,
+ (void *)&cmd_set_mplsoudp_encap_udp_src,
+ (void *)&cmd_set_mplsoudp_encap_udp_src_value,
+ (void *)&cmd_set_mplsoudp_encap_udp_dst,
+ (void *)&cmd_set_mplsoudp_encap_udp_dst_value,
+ (void *)&cmd_set_mplsoudp_encap_ip_src,
+ (void *)&cmd_set_mplsoudp_encap_ip_src_value,
+ (void *)&cmd_set_mplsoudp_encap_ip_dst,
+ (void *)&cmd_set_mplsoudp_encap_ip_dst_value,
+ (void *)&cmd_set_mplsoudp_encap_eth_src,
+ (void *)&cmd_set_mplsoudp_encap_eth_src_value,
+ (void *)&cmd_set_mplsoudp_encap_eth_dst,
+ (void *)&cmd_set_mplsoudp_encap_eth_dst_value,
NULL,
},
};
-/* show port pctype mapping */
+static cmdline_parse_inst_t cmd_set_mplsoudp_encap_with_vlan = {
+ .f = cmd_set_mplsoudp_encap_parsed,
+ .data = NULL,
+ .help_str = "set mplsoudp_encap-with-vlan ip-version ipv4|ipv6"
+ " label <label> udp-src <udp-src> udp-dst <udp-dst>"
+ " ip-src <ip-src> ip-dst <ip-dst> vlan-tci <vlan-tci>"
+ " eth-src <eth-src> eth-dst <eth-dst>",
+ .tokens = {
+ (void *)&cmd_set_mplsoudp_encap_set,
+ (void *)&cmd_set_mplsoudp_encap_mplsoudp_encap_with_vlan,
+ (void *)&cmd_set_mplsoudp_encap_ip_version,
+ (void *)&cmd_set_mplsoudp_encap_ip_version_value,
+ (void *)&cmd_set_mplsoudp_encap_label,
+ (void *)&cmd_set_mplsoudp_encap_label_value,
+ (void *)&cmd_set_mplsoudp_encap_udp_src,
+ (void *)&cmd_set_mplsoudp_encap_udp_src_value,
+ (void *)&cmd_set_mplsoudp_encap_udp_dst,
+ (void *)&cmd_set_mplsoudp_encap_udp_dst_value,
+ (void *)&cmd_set_mplsoudp_encap_ip_src,
+ (void *)&cmd_set_mplsoudp_encap_ip_src_value,
+ (void *)&cmd_set_mplsoudp_encap_ip_dst,
+ (void *)&cmd_set_mplsoudp_encap_ip_dst_value,
+ (void *)&cmd_set_mplsoudp_encap_vlan,
+ (void *)&cmd_set_mplsoudp_encap_vlan_value,
+ (void *)&cmd_set_mplsoudp_encap_eth_src,
+ (void *)&cmd_set_mplsoudp_encap_eth_src_value,
+ (void *)&cmd_set_mplsoudp_encap_eth_dst,
+ (void *)&cmd_set_mplsoudp_encap_eth_dst_value,
+ NULL,
+ },
+};
-/* Common result structure for show port pctype mapping */
-struct cmd_pctype_mapping_get_result {
- cmdline_fixed_string_t show;
- cmdline_fixed_string_t port;
- portid_t port_id;
- cmdline_fixed_string_t pctype;
- cmdline_fixed_string_t mapping;
+/** Set MPLSoUDP decapsulation details */
+struct cmd_set_mplsoudp_decap_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t mplsoudp;
+ cmdline_fixed_string_t pos_token;
+ cmdline_fixed_string_t ip_version;
+ uint32_t vlan_present:1;
};
-/* Common CLI fields for pctype mapping get */
-static cmdline_parse_token_string_t cmd_pctype_mapping_get_show =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_get_result,
- show, "show");
-static cmdline_parse_token_string_t cmd_pctype_mapping_get_port =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_get_result,
- port, "port");
-static cmdline_parse_token_num_t cmd_pctype_mapping_get_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_pctype_mapping_get_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_pctype_mapping_get_pctype =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_get_result,
- pctype, "pctype");
-static cmdline_parse_token_string_t cmd_pctype_mapping_get_mapping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_get_result,
- mapping, "mapping");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result, set,
+ "set");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result, mplsoudp,
+ "mplsoudp_decap");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
+ mplsoudp, "mplsoudp_decap-with-vlan");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
+ pos_token, "ip-version");
+static cmdline_parse_token_string_t cmd_set_mplsoudp_decap_ip_version_value =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_mplsoudp_decap_result,
+ ip_version, "ipv4#ipv6");
-static void
-cmd_pctype_mapping_get_parsed(
- void *parsed_result,
+static void cmd_set_mplsoudp_decap_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_pctype_mapping_get_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_flow_type_mapping
- mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
- int i, j, first_pctype;
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id, mapping);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- return;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- return;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- return;
- }
+ struct cmd_set_mplsoudp_decap_result *res = parsed_result;
-#ifdef RTE_NET_I40E
- for (i = 0; i < RTE_PMD_I40E_FLOW_TYPE_MAX; i++) {
- if (mapping[i].pctype != 0ULL) {
- first_pctype = 1;
-
- printf("pctype: ");
- for (j = 0; j < RTE_PMD_I40E_PCTYPE_MAX; j++) {
- if (mapping[i].pctype & (1ULL << j)) {
- printf(first_pctype ?
- "%02d" : ",%02d", j);
- first_pctype = 0;
- }
- }
- printf(" -> flowtype: %02d\n", mapping[i].flow_type);
- }
- }
-#endif
+ if (strcmp(res->mplsoudp, "mplsoudp_decap") == 0)
+ mplsoudp_decap_conf.select_vlan = 0;
+ else if (strcmp(res->mplsoudp, "mplsoudp_decap-with-vlan") == 0)
+ mplsoudp_decap_conf.select_vlan = 1;
+ if (strcmp(res->ip_version, "ipv4") == 0)
+ mplsoudp_decap_conf.select_ipv4 = 1;
+ else if (strcmp(res->ip_version, "ipv6") == 0)
+ mplsoudp_decap_conf.select_ipv4 = 0;
}
-static cmdline_parse_inst_t cmd_pctype_mapping_get = {
- .f = cmd_pctype_mapping_get_parsed,
+static cmdline_parse_inst_t cmd_set_mplsoudp_decap = {
+ .f = cmd_set_mplsoudp_decap_parsed,
.data = NULL,
- .help_str = "show port <port_id> pctype mapping",
+ .help_str = "set mplsoudp_decap ip-version ipv4|ipv6",
.tokens = {
- (void *)&cmd_pctype_mapping_get_show,
- (void *)&cmd_pctype_mapping_get_port,
- (void *)&cmd_pctype_mapping_get_port_id,
- (void *)&cmd_pctype_mapping_get_pctype,
- (void *)&cmd_pctype_mapping_get_mapping,
+ (void *)&cmd_set_mplsoudp_decap_set,
+ (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap,
+ (void *)&cmd_set_mplsoudp_decap_ip_version,
+ (void *)&cmd_set_mplsoudp_decap_ip_version_value,
NULL,
},
};
-/* port config pctype mapping update */
+static cmdline_parse_inst_t cmd_set_mplsoudp_decap_with_vlan = {
+ .f = cmd_set_mplsoudp_decap_parsed,
+ .data = NULL,
+ .help_str = "set mplsoudp_decap-with-vlan ip-version ipv4|ipv6",
+ .tokens = {
+ (void *)&cmd_set_mplsoudp_decap_set,
+ (void *)&cmd_set_mplsoudp_decap_mplsoudp_decap_with_vlan,
+ (void *)&cmd_set_mplsoudp_decap_ip_version,
+ (void *)&cmd_set_mplsoudp_decap_ip_version_value,
+ NULL,
+ },
+};
-/* Common result structure for port config pctype mapping update */
-struct cmd_pctype_mapping_update_result {
- cmdline_fixed_string_t port;
- cmdline_fixed_string_t config;
- portid_t port_id;
- cmdline_fixed_string_t pctype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t update;
- cmdline_fixed_string_t pctype_list;
- uint16_t flow_type;
+/** Set connection tracking object common details */
+struct cmd_set_conntrack_common_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t conntrack;
+ cmdline_fixed_string_t common;
+ cmdline_fixed_string_t peer;
+ cmdline_fixed_string_t is_orig;
+ cmdline_fixed_string_t enable;
+ cmdline_fixed_string_t live;
+ cmdline_fixed_string_t sack;
+ cmdline_fixed_string_t cack;
+ cmdline_fixed_string_t last_dir;
+ cmdline_fixed_string_t liberal;
+ cmdline_fixed_string_t state;
+ cmdline_fixed_string_t max_ack_win;
+ cmdline_fixed_string_t retrans;
+ cmdline_fixed_string_t last_win;
+ cmdline_fixed_string_t last_seq;
+ cmdline_fixed_string_t last_ack;
+ cmdline_fixed_string_t last_end;
+ cmdline_fixed_string_t last_index;
+ uint8_t stat;
+ uint8_t factor;
+ uint16_t peer_port;
+ uint32_t is_original;
+ uint32_t en;
+ uint32_t is_live;
+ uint32_t s_ack;
+ uint32_t c_ack;
+ uint32_t ld;
+ uint32_t lb;
+ uint8_t re_num;
+ uint8_t li;
+ uint16_t lw;
+ uint32_t ls;
+ uint32_t la;
+ uint32_t le;
};
-/* Common CLI fields for pctype mapping update*/
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_port =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- port, "port");
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_config =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- config, "config");
-static cmdline_parse_token_num_t cmd_pctype_mapping_update_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_pctype =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- pctype, "pctype");
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_mapping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_update =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- update, "update");
-static cmdline_parse_token_string_t cmd_pctype_mapping_update_pc_type =
- TOKEN_STRING_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- pctype_list, NULL);
-static cmdline_parse_token_num_t cmd_pctype_mapping_update_flow_type =
- TOKEN_NUM_INITIALIZER
- (struct cmd_pctype_mapping_update_result,
- flow_type, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_conntrack_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_set_conntrack_conntrack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ conntrack, "conntrack");
+static cmdline_parse_token_string_t cmd_set_conntrack_common_com =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ common, "com");
+static cmdline_parse_token_string_t cmd_set_conntrack_common_peer =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ peer, "peer");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_peer_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ peer_port, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_is_orig =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ is_orig, "is_orig");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_is_orig_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ is_original, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_enable =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ enable, "enable");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_enable_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ en, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_live =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ live, "live");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_live_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ is_live, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_sack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ sack, "sack");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_sack_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ s_ack, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_cack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ cack, "cack");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_cack_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ c_ack, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_dir =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_dir, "last_dir");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_dir_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ ld, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_liberal =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ liberal, "liberal");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_liberal_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ lb, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_state =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ state, "state");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_state_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ stat, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_max_ackwin =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ max_ack_win, "max_ack_win");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_max_ackwin_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ factor, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_retrans =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ retrans, "r_lim");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_retrans_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ re_num, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_win =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_win, "last_win");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_win_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ lw, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_seq =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_seq, "last_seq");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_seq_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ ls, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_ack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_ack, "last_ack");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_ack_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ la, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_end =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_end, "last_end");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_end_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ le, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_common_last_index =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_common_result,
+ last_index, "last_index");
+static cmdline_parse_token_num_t cmd_set_conntrack_common_last_index_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_common_result,
+ li, RTE_UINT8);
-static void
-cmd_pctype_mapping_update_parsed(
- void *parsed_result,
+static void cmd_set_conntrack_common_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_pctype_mapping_update_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_flow_type_mapping mapping;
- unsigned int i;
- unsigned int nb_item;
- unsigned int pctype_list[RTE_PMD_I40E_PCTYPE_MAX];
-#endif
-
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
-
-#ifdef RTE_NET_I40E
- nb_item = parse_item_list(res->pctype_list, "pctypes",
- RTE_PMD_I40E_PCTYPE_MAX, pctype_list, 1);
- mapping.flow_type = res->flow_type;
- for (i = 0, mapping.pctype = 0ULL; i < nb_item; i++)
- mapping.pctype |= (1ULL << pctype_list[i]);
- ret = rte_pmd_i40e_flow_type_mapping_update(res->port_id,
- &mapping,
- 1,
- 0);
-#endif
+ struct cmd_set_conntrack_common_result *res = parsed_result;
- switch (ret) {
- case 0:
- break;
- case -EINVAL:
- fprintf(stderr, "invalid pctype or flow type\n");
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
+ /* No need to swap to big endian. */
+ conntrack_context.peer_port = res->peer_port;
+ conntrack_context.is_original_dir = res->is_original;
+ conntrack_context.enable = res->en;
+ conntrack_context.live_connection = res->is_live;
+ conntrack_context.selective_ack = res->s_ack;
+ conntrack_context.challenge_ack_passed = res->c_ack;
+ conntrack_context.last_direction = res->ld;
+ conntrack_context.liberal_mode = res->lb;
+ conntrack_context.state = (enum rte_flow_conntrack_state)res->stat;
+ conntrack_context.max_ack_window = res->factor;
+ conntrack_context.retransmission_limit = res->re_num;
+ conntrack_context.last_window = res->lw;
+ conntrack_context.last_index =
+ (enum rte_flow_conntrack_tcp_last_index)res->li;
+ conntrack_context.last_seq = res->ls;
+ conntrack_context.last_ack = res->la;
+ conntrack_context.last_end = res->le;
}
-static cmdline_parse_inst_t cmd_pctype_mapping_update = {
- .f = cmd_pctype_mapping_update_parsed,
+static cmdline_parse_inst_t cmd_set_conntrack_common = {
+ .f = cmd_set_conntrack_common_parsed,
.data = NULL,
- .help_str = "port config <port_id> pctype mapping update"
- " <pctype_id_0,[pctype_id_1]*> <flowtype_id>",
+ .help_str = "set conntrack com peer <port_id> is_orig <dir> enable <en>"
+ " live <ack_seen> sack <en> cack <passed> last_dir <dir>"
+ " liberal <en> state <s> max_ack_win <factor> r_lim <num>"
+ " last_win <win> last_seq <seq> last_ack <ack> last_end <end>"
+ " last_index <flag>",
.tokens = {
- (void *)&cmd_pctype_mapping_update_port,
- (void *)&cmd_pctype_mapping_update_config,
- (void *)&cmd_pctype_mapping_update_port_id,
- (void *)&cmd_pctype_mapping_update_pctype,
- (void *)&cmd_pctype_mapping_update_mapping,
- (void *)&cmd_pctype_mapping_update_update,
- (void *)&cmd_pctype_mapping_update_pc_type,
- (void *)&cmd_pctype_mapping_update_flow_type,
+ (void *)&cmd_set_conntrack_set,
+ (void *)&cmd_set_conntrack_conntrack,
+ (void *)&cmd_set_conntrack_common_com,
+ (void *)&cmd_set_conntrack_common_peer,
+ (void *)&cmd_set_conntrack_common_peer_value,
+ (void *)&cmd_set_conntrack_common_is_orig,
+ (void *)&cmd_set_conntrack_common_is_orig_value,
+ (void *)&cmd_set_conntrack_common_enable,
+ (void *)&cmd_set_conntrack_common_enable_value,
+ (void *)&cmd_set_conntrack_common_live,
+ (void *)&cmd_set_conntrack_common_live_value,
+ (void *)&cmd_set_conntrack_common_sack,
+ (void *)&cmd_set_conntrack_common_sack_value,
+ (void *)&cmd_set_conntrack_common_cack,
+ (void *)&cmd_set_conntrack_common_cack_value,
+ (void *)&cmd_set_conntrack_common_last_dir,
+ (void *)&cmd_set_conntrack_common_last_dir_value,
+ (void *)&cmd_set_conntrack_common_liberal,
+ (void *)&cmd_set_conntrack_common_liberal_value,
+ (void *)&cmd_set_conntrack_common_state,
+ (void *)&cmd_set_conntrack_common_state_value,
+ (void *)&cmd_set_conntrack_common_max_ackwin,
+ (void *)&cmd_set_conntrack_common_max_ackwin_value,
+ (void *)&cmd_set_conntrack_common_retrans,
+ (void *)&cmd_set_conntrack_common_retrans_value,
+ (void *)&cmd_set_conntrack_common_last_win,
+ (void *)&cmd_set_conntrack_common_last_win_value,
+ (void *)&cmd_set_conntrack_common_last_seq,
+ (void *)&cmd_set_conntrack_common_last_seq_value,
+ (void *)&cmd_set_conntrack_common_last_ack,
+ (void *)&cmd_set_conntrack_common_last_ack_value,
+ (void *)&cmd_set_conntrack_common_last_end,
+ (void *)&cmd_set_conntrack_common_last_end_value,
+ (void *)&cmd_set_conntrack_common_last_index,
+ (void *)&cmd_set_conntrack_common_last_index_value,
NULL,
},
};
-/* ptype mapping get */
-
-/* Common result structure for ptype mapping get */
-struct cmd_ptype_mapping_get_result {
- cmdline_fixed_string_t ptype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t get;
- portid_t port_id;
- uint8_t valid_only;
+/** Set connection tracking object both directions' details */
+struct cmd_set_conntrack_dir_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t conntrack;
+ cmdline_fixed_string_t dir;
+ cmdline_fixed_string_t scale;
+ cmdline_fixed_string_t fin;
+ cmdline_fixed_string_t ack_seen;
+ cmdline_fixed_string_t unack;
+ cmdline_fixed_string_t sent_end;
+ cmdline_fixed_string_t reply_end;
+ cmdline_fixed_string_t max_win;
+ cmdline_fixed_string_t max_ack;
+ uint32_t factor;
+ uint32_t f;
+ uint32_t as;
+ uint32_t un;
+ uint32_t se;
+ uint32_t re;
+ uint32_t mw;
+ uint32_t ma;
};
-/* Common CLI fields for ptype mapping get */
-static cmdline_parse_token_string_t cmd_ptype_mapping_get_ptype =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_get_result,
- ptype, "ptype");
-static cmdline_parse_token_string_t cmd_ptype_mapping_get_mapping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_get_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_ptype_mapping_get_get =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_get_result,
- get, "get");
-static cmdline_parse_token_num_t cmd_ptype_mapping_get_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_get_result,
- port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_ptype_mapping_get_valid_only =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_get_result,
- valid_only, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_dir =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ dir, "orig#rply");
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_scale =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ scale, "scale");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_scale_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ factor, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_fin =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ fin, "fin");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_fin_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ f, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_ack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ ack_seen, "acked");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_ack_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ as, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_unack_data =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ unack, "unack_data");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_unack_data_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ un, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_sent_end =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ sent_end, "sent_end");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_sent_end_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ se, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_reply_end =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ reply_end, "reply_end");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_reply_end_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ re, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_max_win =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ max_win, "max_win");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_max_win_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ mw, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_set_conntrack_dir_max_ack =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ max_ack, "max_ack");
+static cmdline_parse_token_num_t cmd_set_conntrack_dir_max_ack_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_conntrack_dir_result,
+ ma, RTE_UINT32);
-static void
-cmd_ptype_mapping_get_parsed(
- void *parsed_result,
+static void cmd_set_conntrack_dir_parsed(void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_ptype_mapping_get_result *res = parsed_result;
- int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- int max_ptype_num = 256;
- struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num];
- uint16_t count;
- int i;
-#endif
+ struct cmd_set_conntrack_dir_result *res = parsed_result;
+ struct rte_flow_tcp_dir_param *dir = NULL;
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ if (strcmp(res->dir, "orig") == 0)
+ dir = &conntrack_context.original_dir;
+ else if (strcmp(res->dir, "rply") == 0)
+ dir = &conntrack_context.reply_dir;
+ else
return;
-
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_ptype_mapping_get(res->port_id,
- mapping,
- max_ptype_num,
- &count,
- res->valid_only);
-#endif
-
- switch (ret) {
- case 0:
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
-
-#ifdef RTE_NET_I40E
- if (!ret) {
- for (i = 0; i < count; i++)
- printf("%3d\t0x%08x\n",
- mapping[i].hw_ptype, mapping[i].sw_ptype);
- }
-#endif
+ dir->scale = res->factor;
+ dir->close_initiated = res->f;
+ dir->last_ack_seen = res->as;
+ dir->data_unacked = res->un;
+ dir->sent_end = res->se;
+ dir->reply_end = res->re;
+ dir->max_ack = res->ma;
+ dir->max_win = res->mw;
}
-static cmdline_parse_inst_t cmd_ptype_mapping_get = {
- .f = cmd_ptype_mapping_get_parsed,
+static cmdline_parse_inst_t cmd_set_conntrack_dir = {
+ .f = cmd_set_conntrack_dir_parsed,
.data = NULL,
- .help_str = "ptype mapping get <port_id> <valid_only>",
+ .help_str = "set conntrack orig|rply scale <factor> fin <sent>"
+ " acked <seen> unack_data <unack> sent_end <sent>"
+ " reply_end <reply> max_win <win> max_ack <ack>",
.tokens = {
- (void *)&cmd_ptype_mapping_get_ptype,
- (void *)&cmd_ptype_mapping_get_mapping,
- (void *)&cmd_ptype_mapping_get_get,
- (void *)&cmd_ptype_mapping_get_port_id,
- (void *)&cmd_ptype_mapping_get_valid_only,
+ (void *)&cmd_set_conntrack_set,
+ (void *)&cmd_set_conntrack_conntrack,
+ (void *)&cmd_set_conntrack_dir_dir,
+ (void *)&cmd_set_conntrack_dir_scale,
+ (void *)&cmd_set_conntrack_dir_scale_value,
+ (void *)&cmd_set_conntrack_dir_fin,
+ (void *)&cmd_set_conntrack_dir_fin_value,
+ (void *)&cmd_set_conntrack_dir_ack,
+ (void *)&cmd_set_conntrack_dir_ack_value,
+ (void *)&cmd_set_conntrack_dir_unack_data,
+ (void *)&cmd_set_conntrack_dir_unack_data_value,
+ (void *)&cmd_set_conntrack_dir_sent_end,
+ (void *)&cmd_set_conntrack_dir_sent_end_value,
+ (void *)&cmd_set_conntrack_dir_reply_end,
+ (void *)&cmd_set_conntrack_dir_reply_end_value,
+ (void *)&cmd_set_conntrack_dir_max_win,
+ (void *)&cmd_set_conntrack_dir_max_win_value,
+ (void *)&cmd_set_conntrack_dir_max_ack,
+ (void *)&cmd_set_conntrack_dir_max_ack_value,
NULL,
},
};
-/* ptype mapping replace */
+/* show vf stats */
-/* Common result structure for ptype mapping replace */
-struct cmd_ptype_mapping_replace_result {
- cmdline_fixed_string_t ptype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t replace;
+/* Common result structure for show vf stats */
+struct cmd_show_vf_stats_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t stats;
portid_t port_id;
- uint32_t target;
- uint8_t mask;
- uint32_t pkt_type;
+ uint16_t vf_id;
};
-/* Common CLI fields for ptype mapping replace */
-static cmdline_parse_token_string_t cmd_ptype_mapping_replace_ptype =
+/* Common CLI fields show vf stats*/
+static cmdline_parse_token_string_t cmd_show_vf_stats_show =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- ptype, "ptype");
-static cmdline_parse_token_string_t cmd_ptype_mapping_replace_mapping =
+ (struct cmd_show_vf_stats_result,
+ show, "show");
+static cmdline_parse_token_string_t cmd_show_vf_stats_vf =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_ptype_mapping_replace_replace =
+ (struct cmd_show_vf_stats_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_show_vf_stats_stats =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- replace, "replace");
-static cmdline_parse_token_num_t cmd_ptype_mapping_replace_port_id =
+ (struct cmd_show_vf_stats_result,
+ stats, "stats");
+static cmdline_parse_token_num_t cmd_show_vf_stats_port_id =
TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
+ (struct cmd_show_vf_stats_result,
port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_ptype_mapping_replace_target =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- target, RTE_UINT32);
-static cmdline_parse_token_num_t cmd_ptype_mapping_replace_mask =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- mask, RTE_UINT8);
-static cmdline_parse_token_num_t cmd_ptype_mapping_replace_pkt_type =
+static cmdline_parse_token_num_t cmd_show_vf_stats_vf_id =
TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_replace_result,
- pkt_type, RTE_UINT32);
+ (struct cmd_show_vf_stats_result,
+ vf_id, RTE_UINT16);
static void
-cmd_ptype_mapping_replace_parsed(
+cmd_show_vf_stats_parsed(
void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_ptype_mapping_replace_result *res = parsed_result;
+ struct cmd_show_vf_stats_result *res = parsed_result;
+ struct rte_eth_stats stats;
int ret = -ENOTSUP;
+ static const char *nic_stats_border = "########################";
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
+ memset(&stats, 0, sizeof(stats));
+
#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_ptype_mapping_replace(res->port_id,
- res->target,
- res->mask,
- res->pkt_type);
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_get_vf_stats(res->port_id,
+ res->vf_id,
+ &stats);
+#endif
+#ifdef RTE_NET_BNXT
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_bnxt_get_vf_stats(res->port_id,
+ res->vf_id,
+ &stats);
#endif
switch (ret) {
case 0:
break;
case -EINVAL:
- fprintf(stderr, "invalid ptype 0x%8x or 0x%8x\n",
- res->target, res->pkt_type);
+ fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
break;
case -ENODEV:
fprintf(stderr, "invalid port_id %d\n", res->port_id);
@@ -15849,162 +13231,99 @@ cmd_ptype_mapping_replace_parsed(
default:
fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
}
-}
-
-static cmdline_parse_inst_t cmd_ptype_mapping_replace = {
- .f = cmd_ptype_mapping_replace_parsed,
- .data = NULL,
- .help_str =
- "ptype mapping replace <port_id> <target> <mask> <pkt_type>",
- .tokens = {
- (void *)&cmd_ptype_mapping_replace_ptype,
- (void *)&cmd_ptype_mapping_replace_mapping,
- (void *)&cmd_ptype_mapping_replace_replace,
- (void *)&cmd_ptype_mapping_replace_port_id,
- (void *)&cmd_ptype_mapping_replace_target,
- (void *)&cmd_ptype_mapping_replace_mask,
- (void *)&cmd_ptype_mapping_replace_pkt_type,
- NULL,
- },
-};
-
-/* ptype mapping reset */
-
-/* Common result structure for ptype mapping reset */
-struct cmd_ptype_mapping_reset_result {
- cmdline_fixed_string_t ptype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t reset;
- portid_t port_id;
-};
-
-/* Common CLI fields for ptype mapping reset*/
-static cmdline_parse_token_string_t cmd_ptype_mapping_reset_ptype =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_reset_result,
- ptype, "ptype");
-static cmdline_parse_token_string_t cmd_ptype_mapping_reset_mapping =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_reset_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_ptype_mapping_reset_reset =
- TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_reset_result,
- reset, "reset");
-static cmdline_parse_token_num_t cmd_ptype_mapping_reset_port_id =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_reset_result,
- port_id, RTE_UINT16);
-
-static void
-cmd_ptype_mapping_reset_parsed(
- void *parsed_result,
- __rte_unused struct cmdline *cl,
- __rte_unused void *data)
-{
- struct cmd_ptype_mapping_reset_result *res = parsed_result;
- int ret = -ENOTSUP;
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
+ printf("\n %s NIC statistics for port %-2d vf %-2d %s\n",
+ nic_stats_border, res->port_id, res->vf_id, nic_stats_border);
-#ifdef RTE_NET_I40E
- ret = rte_pmd_i40e_ptype_mapping_reset(res->port_id);
-#endif
+ printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: "
+ "%-"PRIu64"\n",
+ stats.ipackets, stats.imissed, stats.ibytes);
+ printf(" RX-errors: %-"PRIu64"\n", stats.ierrors);
+ printf(" RX-nombuf: %-10"PRIu64"\n",
+ stats.rx_nombuf);
+ printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: "
+ "%-"PRIu64"\n",
+ stats.opackets, stats.oerrors, stats.obytes);
- switch (ret) {
- case 0:
- break;
- case -ENODEV:
- fprintf(stderr, "invalid port_id %d\n", res->port_id);
- break;
- case -ENOTSUP:
- fprintf(stderr, "function not implemented\n");
- break;
- default:
- fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
- }
+ printf(" %s############################%s\n",
+ nic_stats_border, nic_stats_border);
}
-static cmdline_parse_inst_t cmd_ptype_mapping_reset = {
- .f = cmd_ptype_mapping_reset_parsed,
+static cmdline_parse_inst_t cmd_show_vf_stats = {
+ .f = cmd_show_vf_stats_parsed,
.data = NULL,
- .help_str = "ptype mapping reset <port_id>",
+ .help_str = "show vf stats <port_id> <vf_id>",
.tokens = {
- (void *)&cmd_ptype_mapping_reset_ptype,
- (void *)&cmd_ptype_mapping_reset_mapping,
- (void *)&cmd_ptype_mapping_reset_reset,
- (void *)&cmd_ptype_mapping_reset_port_id,
+ (void *)&cmd_show_vf_stats_show,
+ (void *)&cmd_show_vf_stats_vf,
+ (void *)&cmd_show_vf_stats_stats,
+ (void *)&cmd_show_vf_stats_port_id,
+ (void *)&cmd_show_vf_stats_vf_id,
NULL,
},
};
-/* ptype mapping update */
+/* clear vf stats */
-/* Common result structure for ptype mapping update */
-struct cmd_ptype_mapping_update_result {
- cmdline_fixed_string_t ptype;
- cmdline_fixed_string_t mapping;
- cmdline_fixed_string_t reset;
+/* Common result structure for clear vf stats */
+struct cmd_clear_vf_stats_result {
+ cmdline_fixed_string_t clear;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t stats;
portid_t port_id;
- uint8_t hw_ptype;
- uint32_t sw_ptype;
+ uint16_t vf_id;
};
-/* Common CLI fields for ptype mapping update*/
-static cmdline_parse_token_string_t cmd_ptype_mapping_update_ptype =
+/* Common CLI fields clear vf stats*/
+static cmdline_parse_token_string_t cmd_clear_vf_stats_clear =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
- ptype, "ptype");
-static cmdline_parse_token_string_t cmd_ptype_mapping_update_mapping =
+ (struct cmd_clear_vf_stats_result,
+ clear, "clear");
+static cmdline_parse_token_string_t cmd_clear_vf_stats_vf =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
- mapping, "mapping");
-static cmdline_parse_token_string_t cmd_ptype_mapping_update_update =
+ (struct cmd_clear_vf_stats_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_clear_vf_stats_stats =
TOKEN_STRING_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
- reset, "update");
-static cmdline_parse_token_num_t cmd_ptype_mapping_update_port_id =
+ (struct cmd_clear_vf_stats_result,
+ stats, "stats");
+static cmdline_parse_token_num_t cmd_clear_vf_stats_port_id =
TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
+ (struct cmd_clear_vf_stats_result,
port_id, RTE_UINT16);
-static cmdline_parse_token_num_t cmd_ptype_mapping_update_hw_ptype =
- TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
- hw_ptype, RTE_UINT8);
-static cmdline_parse_token_num_t cmd_ptype_mapping_update_sw_ptype =
+static cmdline_parse_token_num_t cmd_clear_vf_stats_vf_id =
TOKEN_NUM_INITIALIZER
- (struct cmd_ptype_mapping_update_result,
- sw_ptype, RTE_UINT32);
+ (struct cmd_clear_vf_stats_result,
+ vf_id, RTE_UINT16);
static void
-cmd_ptype_mapping_update_parsed(
+cmd_clear_vf_stats_parsed(
void *parsed_result,
__rte_unused struct cmdline *cl,
__rte_unused void *data)
{
- struct cmd_ptype_mapping_update_result *res = parsed_result;
+ struct cmd_clear_vf_stats_result *res = parsed_result;
int ret = -ENOTSUP;
-#ifdef RTE_NET_I40E
- struct rte_pmd_i40e_ptype_mapping mapping;
-#endif
+
if (port_id_is_invalid(res->port_id, ENABLED_WARN))
return;
#ifdef RTE_NET_I40E
- mapping.hw_ptype = res->hw_ptype;
- mapping.sw_ptype = res->sw_ptype;
- ret = rte_pmd_i40e_ptype_mapping_update(res->port_id,
- &mapping,
- 1,
- 0);
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_reset_vf_stats(res->port_id,
+ res->vf_id);
+#endif
+#ifdef RTE_NET_BNXT
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_bnxt_reset_vf_stats(res->port_id,
+ res->vf_id);
#endif
switch (ret) {
case 0:
break;
case -EINVAL:
- fprintf(stderr, "invalid ptype 0x%8x\n", res->sw_ptype);
+ fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
break;
case -ENODEV:
fprintf(stderr, "invalid port_id %d\n", res->port_id);
@@ -16017,17 +13336,16 @@ cmd_ptype_mapping_update_parsed(
}
}
-static cmdline_parse_inst_t cmd_ptype_mapping_update = {
- .f = cmd_ptype_mapping_update_parsed,
+static cmdline_parse_inst_t cmd_clear_vf_stats = {
+ .f = cmd_clear_vf_stats_parsed,
.data = NULL,
- .help_str = "ptype mapping update <port_id> <hw_ptype> <sw_ptype>",
+ .help_str = "clear vf stats <port_id> <vf_id>",
.tokens = {
- (void *)&cmd_ptype_mapping_update_ptype,
- (void *)&cmd_ptype_mapping_update_mapping,
- (void *)&cmd_ptype_mapping_update_update,
- (void *)&cmd_ptype_mapping_update_port_id,
- (void *)&cmd_ptype_mapping_update_hw_ptype,
- (void *)&cmd_ptype_mapping_update_sw_ptype,
+ (void *)&cmd_clear_vf_stats_clear,
+ (void *)&cmd_clear_vf_stats_vf,
+ (void *)&cmd_clear_vf_stats_stats,
+ (void *)&cmd_clear_vf_stats_port_id,
+ (void *)&cmd_clear_vf_stats_vf_id,
NULL,
},
};
@@ -18046,9 +15364,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs,
(cmdline_parse_inst_t *)&cmd_dump,
(cmdline_parse_inst_t *)&cmd_dump_one,
-#ifdef RTE_NET_I40E
- (cmdline_parse_inst_t *)&cmd_add_del_raw_flow_director,
-#endif
(cmdline_parse_inst_t *)&cmd_set_flow_director_ip_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_mac_vlan_mask,
(cmdline_parse_inst_t *)&cmd_set_flow_director_tunnel_mask,
@@ -18085,14 +15400,6 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_vf_rate_limit,
(cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter,
(cmdline_parse_inst_t *)&cmd_set_vf_mac_addr,
- (cmdline_parse_inst_t *)&cmd_set_vf_promisc,
- (cmdline_parse_inst_t *)&cmd_set_vf_allmulti,
- (cmdline_parse_inst_t *)&cmd_set_vf_broadcast,
- (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag,
- (cmdline_parse_inst_t *)&cmd_vf_max_bw,
- (cmdline_parse_inst_t *)&cmd_vf_tc_min_bw,
- (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,
(cmdline_parse_inst_t *)&cmd_set_vxlan,
(cmdline_parse_inst_t *)&cmd_set_vxlan_tos_ttl,
@@ -18113,29 +15420,10 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_mplsoudp_decap_with_vlan,
(cmdline_parse_inst_t *)&cmd_set_conntrack_common,
(cmdline_parse_inst_t *)&cmd_set_conntrack_dir,
- (cmdline_parse_inst_t *)&cmd_ddp_add,
- (cmdline_parse_inst_t *)&cmd_ddp_del,
- (cmdline_parse_inst_t *)&cmd_ddp_get_list,
- (cmdline_parse_inst_t *)&cmd_ddp_get_info,
- (cmdline_parse_inst_t *)&cmd_cfg_input_set,
- (cmdline_parse_inst_t *)&cmd_clear_input_set,
(cmdline_parse_inst_t *)&cmd_show_vf_stats,
(cmdline_parse_inst_t *)&cmd_clear_vf_stats,
(cmdline_parse_inst_t *)&cmd_show_port_supported_ptypes,
(cmdline_parse_inst_t *)&cmd_set_port_ptypes,
- (cmdline_parse_inst_t *)&cmd_ptype_mapping_get,
- (cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,
- (cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,
- (cmdline_parse_inst_t *)&cmd_ptype_mapping_update,
-
- (cmdline_parse_inst_t *)&cmd_pctype_mapping_get,
- (cmdline_parse_inst_t *)&cmd_pctype_mapping_reset,
- (cmdline_parse_inst_t *)&cmd_pctype_mapping_update,
- (cmdline_parse_inst_t *)&cmd_queue_region,
- (cmdline_parse_inst_t *)&cmd_region_flowtype,
- (cmdline_parse_inst_t *)&cmd_user_priority_region,
- (cmdline_parse_inst_t *)&cmd_flush_queue_region,
- (cmdline_parse_inst_t *)&cmd_show_queue_region_info_all,
(cmdline_parse_inst_t *)&cmd_show_port_tm_cap,
(cmdline_parse_inst_t *)&cmd_show_port_tm_level_cap,
(cmdline_parse_inst_t *)&cmd_show_port_tm_node_cap,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 82a1ff85b8..62833fe97c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -6302,49 +6302,6 @@ close_file(uint8_t *buf)
return -1;
}
-void
-port_queue_region_info_display(portid_t port_id, void *buf)
-{
-#ifdef RTE_NET_I40E
- uint16_t i, j;
- struct rte_pmd_i40e_queue_regions *info =
- (struct rte_pmd_i40e_queue_regions *)buf;
- static const char *queue_region_info_stats_border = "-------";
-
- if (!info->queue_region_number)
- printf("there is no region has been set before");
-
- printf("\n %s All queue region info for port=%2d %s",
- queue_region_info_stats_border, port_id,
- queue_region_info_stats_border);
- printf("\n queue_region_number: %-14u \n",
- info->queue_region_number);
-
- for (i = 0; i < info->queue_region_number; i++) {
- printf("\n region_id: %-14u queue_number: %-14u "
- "queue_start_index: %-14u \n",
- info->region[i].region_id,
- info->region[i].queue_num,
- info->region[i].queue_start_index);
-
- printf(" user_priority_num is %-14u :",
- info->region[i].user_priority_num);
- for (j = 0; j < info->region[i].user_priority_num; j++)
- printf(" %-14u ", info->region[i].user_priority[j]);
-
- printf("\n flowtype_num is %-14u :",
- info->region[i].flowtype_num);
- for (j = 0; j < info->region[i].flowtype_num; j++)
- printf(" %-14u ", info->region[i].hw_flowtype[j]);
- }
-#else
- RTE_SET_USED(port_id);
- RTE_SET_USED(buf);
-#endif
-
- printf("\n\n");
-}
-
void
show_macs(portid_t port_id)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index ab333c7324..eeefb5e70f 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1147,8 +1147,6 @@ uint8_t *open_file(const char *file_path, uint32_t *size);
int save_file(const char *file_path, uint8_t *buf, uint32_t size);
int close_file(uint8_t *buf);
-void port_queue_region_info_display(portid_t port_id, void *buf);
-
enum print_warning {
ENABLED_WARN = 0,
DISABLED_WARN
diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst
index aedb1afc4b..a7b51618b0 100644
--- a/doc/guides/nics/i40e.rst
+++ b/doc/guides/nics/i40e.rst
@@ -568,8 +568,7 @@ of the region index, queue number, queue start index, user priority, traffic
classes and so on. Depending on commands from the command line, it will call
i40e private APIs and start the process of setting or flushing the queue
region configuration. As this feature is specific for i40e only private
-APIs are used. These new ``test_pmd`` commands are as shown below. For
-details please refer to :doc:`../testpmd_app_ug/index`.
+APIs are used.
.. code-block:: console
@@ -761,6 +760,189 @@ Mirror rule limitation for X722
Due to firmware restriction of X722, the same VSI cannot have more than one mirror rule.
+.. _net_i40e_testpmd_commands:
+
+Testpmd driver specific commands
+--------------------------------
+
+Some i40e driver specific features are integrated in testpmd.
+
+RSS queue region
+~~~~~~~~~~~~~~~~
+
+Set RSS queue region span on a port::
+
+ testpmd> set port (port_id) queue-region region_id (value) \
+ queue_start_index (value) queue_num (value)
+
+Set flowtype mapping on a RSS queue region on a port::
+
+ testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
+
+where:
+
+* For the flowtype(pctype) of packet,the specific index for each type has
+ been defined in file i40e_type.h as enum i40e_filter_pctype.
+
+Set user priority mapping on a RSS queue region on a port::
+
+ testpmd> set port (port_id) queue-region UP (value) region_id (value)
+
+Flush all queue region related configuration on a port::
+
+ testpmd> set port (port_id) queue-region flush (on|off)
+
+where:
+
+* ``on``: is just an enable function which server for other configuration,
+ it is for all configuration about queue region from up layer,
+ at first will only keep in DPDK software stored in driver,
+ only after "flush on", it commit all configuration to HW.
+
+* ``"off``: is just clean all configuration about queue region just now,
+ and restore all to DPDK i40e driver default config when start up.
+
+Show all queue region related configuration info on a port::
+
+ testpmd> show port (port_id) queue-region
+
+.. note::
+
+ Queue region only support on PF by now, so these command is
+ only for configuration of queue region on PF port.
+
+set promisc (for VF)
+~~~~~~~~~~~~~~~~~~~~
+
+Set the unicast promiscuous mode for a VF from PF.
+It's supported by Intel i40e NICs now.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf promisc (port_id) (vf_id) (on|off)
+
+set allmulticast (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set the multicast promiscuous mode for a VF from PF.
+It's supported by Intel i40e NICs now.
+In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
+
+ testpmd> set vf allmulti (port_id) (vf_id) (on|off)
+
+set broadcast mode (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set broadcast mode for a VF from the PF::
+
+ testpmd> set vf broadcast (port_id) (vf_id) (on|off)
+
+vlan set tag (for VF)
+~~~~~~~~~~~~~~~~~~~~~
+
+Set VLAN tag for a VF from the PF::
+
+ testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
+
+set tx max bandwidth (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set TX max absolute bandwidth (Mbps) for a VF from PF::
+
+ testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
+
+set tc tx min bandwidth (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set all TCs' TX min relative bandwidth (%) for a VF from PF::
+
+ testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
+
+set tc tx max bandwidth (for VF)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
+
+ testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
+
+set tc strict link priority mode
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Set some TCs' strict link priority mode on a physical port::
+
+ testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
+
+ddp add
+~~~~~~~
+
+Load a dynamic device personalization (DDP) profile and store backup profile::
+
+ testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
+
+ddp del
+~~~~~~~
+
+Delete a dynamic device personalization profile and restore backup profile::
+
+ testpmd> ddp del (port_id) (backup_profile_path)
+
+ddp get list
+~~~~~~~~~~~~
+
+Get loaded dynamic device personalization (DDP) package info list::
+
+ testpmd> ddp get list (port_id)
+
+ddp get info
+~~~~~~~~~~~~
+
+Display information about dynamic device personalization (DDP) profile::
+
+ testpmd> ddp get info (profile_path)
+
+ptype mapping
+~~~~~~~~~~~~~
+
+List all items from the ptype mapping table::
+
+ testpmd> ptype mapping get (port_id) (valid_only)
+
+Where:
+
+* ``valid_only``: A flag indicates if only list valid items(=1) or all items(=0).
+
+Replace a specific or a group of software defined ptype with a new one::
+
+ testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
+
+where:
+
+* ``target``: A specific software ptype or a mask to represent a group of software ptypes.
+
+* ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
+
+* ``pkt_type``: The new software ptype to replace the old ones.
+
+Update hardware defined ptype to software defined packet type mapping table::
+
+ testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
+
+where:
+
+* ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
+
+* ``sw_ptype``: software ptype as the value of the ptype mapping table.
+
+Reset ptype mapping table::
+
+ testpmd> ptype mapping reset (port_id)
+
+show port pctype mapping
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+List all items from the pctype mapping table::
+
+ testpmd> show port (port_id) pctype mapping
+
High Performance of Small Packets on 40GbE NIC
----------------------------------------------
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f311b7d27b..dc3c63507b 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -431,20 +431,6 @@ For example::
testpmd> read txd 0 0 4
0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
-ddp get list
-~~~~~~~~~~~~
-
-Get loaded dynamic device personalization (DDP) package info list::
-
- testpmd> ddp get list (port_id)
-
-ddp get info
-~~~~~~~~~~~~
-
-Display information about dynamic device personalization (DDP) profile::
-
- testpmd> ddp get info (profile_path)
-
show vf stats
~~~~~~~~~~~~~
@@ -459,13 +445,6 @@ Reset VF statistics::
testpmd> clear vf stats (port_id) (vf_id)
-show port pctype mapping
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-List all items from the pctype mapping table::
-
- testpmd> show port (port_id) pctype mapping
-
show rx offloading capabilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -997,13 +976,6 @@ Configure MACsec secure association (SA)::
The IDX value must be 0 or 1.
Check the NIC Datasheet for hardware limits.
-set broadcast mode (for VF)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set broadcast mode for a VF from the PF::
-
- testpmd> set vf broadcast (port_id) (vf_id) (on|off)
-
vlan set stripq
~~~~~~~~~~~~~~~
@@ -1025,13 +997,6 @@ Set VLAN insert for a VF from the PF::
testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
-vlan set tag (for VF)
-~~~~~~~~~~~~~~~~~~~~~
-
-Set VLAN tag for a VF from the PF::
-
- testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
-
vlan set antispoof (for VF)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1158,50 +1123,6 @@ Where:
Check the NIC Datasheet for hardware limits.
-RSS queue region
-~~~~~~~~~~~~~~~~
-
-Set RSS queue region span on a port::
-
- testpmd> set port (port_id) queue-region region_id (value) \
- queue_start_index (value) queue_num (value)
-
-Set flowtype mapping on a RSS queue region on a port::
-
- testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
-
-where:
-
-* For the flowtype(pctype) of packet,the specific index for each type has
- been defined in file i40e_type.h as enum i40e_filter_pctype.
-
-Set user priority mapping on a RSS queue region on a port::
-
- testpmd> set port (port_id) queue-region UP (value) region_id (value)
-
-Flush all queue region related configuration on a port::
-
- testpmd> set port (port_id) queue-region flush (on|off)
-
-where:
-
-* ``on``: is just an enable function which server for other configuration,
- it is for all configuration about queue region from up layer,
- at first will only keep in DPDK software stored in driver,
- only after "flush on", it commit all configuration to HW.
-
-* ``"off``: is just clean all configuration about queue region just now,
- and restore all to DPDK i40e driver default config when start up.
-
-Show all queue region related configuration info on a port::
-
- testpmd> show port (port_id) queue-region
-
-.. note::
-
- Queue region only support on PF by now, so these command is
- only for configuration of queue region on PF port.
-
csum parse-tunnel
~~~~~~~~~~~~~~~~~
@@ -1463,52 +1384,6 @@ Set the allmulti mode for a port or for all ports::
Same as the ifconfig (8) option. Controls how multicast packets are handled.
-set promisc (for VF)
-~~~~~~~~~~~~~~~~~~~~
-
-Set the unicast promiscuous mode for a VF from PF.
-It's supported by Intel i40e NICs now.
-In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
-
- testpmd> set vf promisc (port_id) (vf_id) (on|off)
-
-set allmulticast (for VF)
-~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set the multicast promiscuous mode for a VF from PF.
-It's supported by Intel i40e NICs now.
-In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
-
- testpmd> set vf allmulti (port_id) (vf_id) (on|off)
-
-set tx max bandwidth (for VF)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set TX max absolute bandwidth (Mbps) for a VF from PF::
-
- testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
-
-set tc tx min bandwidth (for VF)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set all TCs' TX min relative bandwidth (%) for a VF from PF::
-
- testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
-
-set tc tx max bandwidth (for VF)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
-
- testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
-
-set tc strict link priority mode
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Set some TCs' strict link priority mode on a physical port::
-
- testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
-
set tc tx min bandwidth
~~~~~~~~~~~~~~~~~~~~~~~
@@ -1741,57 +1616,6 @@ Enable/disable E-tag based forwarding on a port::
testpmd> E-tag set forwarding (on|off) port (port_id)
-ddp add
-~~~~~~~
-
-Load a dynamic device personalization (DDP) profile and store backup profile::
-
- testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
-
-ddp del
-~~~~~~~
-
-Delete a dynamic device personalization profile and restore backup profile::
-
- testpmd> ddp del (port_id) (backup_profile_path)
-
-ptype mapping
-~~~~~~~~~~~~~
-
-List all items from the ptype mapping table::
-
- testpmd> ptype mapping get (port_id) (valid_only)
-
-Where:
-
-* ``valid_only``: A flag indicates if only list valid items(=1) or all items(=0).
-
-Replace a specific or a group of software defined ptype with a new one::
-
- testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
-
-where:
-
-* ``target``: A specific software ptype or a mask to represent a group of software ptypes.
-
-* ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
-
-* ``pkt_type``: The new software ptype to replace the old ones.
-
-Update hardware defined ptype to software defined packet type mapping table::
-
- testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
-
-where:
-
-* ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
-
-* ``sw_ptype``: software ptype as the value of the ptype mapping table.
-
-Reset ptype mapping table::
-
- testpmd> ptype mapping reset (port_id)
-
config per port Rx offloading
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -5720,3 +5544,5 @@ Driver specific commands
Some drivers provide specific features.
See:
+
+- :ref:`net_i40e_testpmd_commands`
diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
new file mode 100644
index 0000000000..86159e5c1c
--- /dev/null
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -0,0 +1,2634 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2016 Intel Corporation.
+ */
+#include <rte_pmd_i40e.h>
+
+#include <cmdline_parse_num.h>
+#include <cmdline_parse_string.h>
+
+#include "testpmd.h"
+
+/* *** queue region set *** */
+struct cmd_queue_region_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t cmd;
+ cmdline_fixed_string_t region;
+ uint8_t region_id;
+ cmdline_fixed_string_t queue_start_index;
+ uint8_t queue_id;
+ cmdline_fixed_string_t queue_num;
+ uint8_t queue_num_value;
+};
+
+static void
+cmd_queue_region_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_queue_region_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_queue_region_conf region_conf;
+ enum rte_pmd_i40e_queue_region_op op_type;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ memset(®ion_conf, 0, sizeof(region_conf));
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_SET;
+ region_conf.region_id = res->region_id;
+ region_conf.queue_num = res->queue_num_value;
+ region_conf.queue_start_index = res->queue_id;
+
+ ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+ op_type, ®ion_conf);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented or supported\n");
+ break;
+ default:
+ fprintf(stderr, "queue region config error: (%s)\n",
+ strerror(-ret));
+ }
+}
+
+static cmdline_parse_token_string_t cmd_queue_region_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_queue_region_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_queue_region_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_queue_region_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ cmd, "queue-region");
+static cmdline_parse_token_string_t cmd_queue_region_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ region, "region_id");
+static cmdline_parse_token_num_t cmd_queue_region_index =
+ TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+ region_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_queue_region_queue_start_index =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ queue_start_index, "queue_start_index");
+static cmdline_parse_token_num_t cmd_queue_region_queue_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+ queue_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_queue_region_queue_num =
+ TOKEN_STRING_INITIALIZER(struct cmd_queue_region_result,
+ queue_num, "queue_num");
+static cmdline_parse_token_num_t cmd_queue_region_queue_num_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_queue_region_result,
+ queue_num_value, RTE_UINT8);
+
+static cmdline_parse_inst_t cmd_queue_region = {
+ .f = cmd_queue_region_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> queue-region region_id <value> "
+ "queue_start_index <value> queue_num <value>: Set a queue region",
+ .tokens = {
+ (void *)&cmd_queue_region_set,
+ (void *)&cmd_queue_region_port,
+ (void *)&cmd_queue_region_port_id,
+ (void *)&cmd_queue_region_cmd,
+ (void *)&cmd_queue_region_id,
+ (void *)&cmd_queue_region_index,
+ (void *)&cmd_queue_region_queue_start_index,
+ (void *)&cmd_queue_region_queue_id,
+ (void *)&cmd_queue_region_queue_num,
+ (void *)&cmd_queue_region_queue_num_value,
+ NULL,
+ },
+};
+
+/* *** queue region and flowtype set *** */
+struct cmd_region_flowtype_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t cmd;
+ cmdline_fixed_string_t region;
+ uint8_t region_id;
+ cmdline_fixed_string_t flowtype;
+ uint8_t flowtype_id;
+};
+
+static void
+cmd_region_flowtype_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_region_flowtype_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_queue_region_conf region_conf;
+ enum rte_pmd_i40e_queue_region_op op_type;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ memset(®ion_conf, 0, sizeof(region_conf));
+
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_FLOWTYPE_SET;
+ region_conf.region_id = res->region_id;
+ region_conf.hw_flowtype = res->flowtype_id;
+
+ ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+ op_type, ®ion_conf);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented or supported\n");
+ break;
+ default:
+ fprintf(stderr, "region flowtype config error: (%s)\n",
+ strerror(-ret));
+ }
+}
+
+static cmdline_parse_token_string_t cmd_region_flowtype_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_region_flowtype_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_region_flowtype_port_index =
+ TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_region_flowtype_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+ cmd, "queue-region");
+static cmdline_parse_token_string_t cmd_region_flowtype_index =
+ TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+ region, "region_id");
+static cmdline_parse_token_num_t cmd_region_flowtype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+ region_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_region_flowtype_flow_index =
+ TOKEN_STRING_INITIALIZER(struct cmd_region_flowtype_result,
+ flowtype, "flowtype");
+static cmdline_parse_token_num_t cmd_region_flowtype_flow_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_region_flowtype_result,
+ flowtype_id, RTE_UINT8);
+static cmdline_parse_inst_t cmd_region_flowtype = {
+ .f = cmd_region_flowtype_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> queue-region region_id <value> "
+ "flowtype <value>: Set a flowtype region index",
+ .tokens = {
+ (void *)&cmd_region_flowtype_set,
+ (void *)&cmd_region_flowtype_port,
+ (void *)&cmd_region_flowtype_port_index,
+ (void *)&cmd_region_flowtype_cmd,
+ (void *)&cmd_region_flowtype_index,
+ (void *)&cmd_region_flowtype_id,
+ (void *)&cmd_region_flowtype_flow_index,
+ (void *)&cmd_region_flowtype_flow_id,
+ NULL,
+ },
+};
+
+/* *** User Priority (UP) to queue region (region_id) set *** */
+struct cmd_user_priority_region_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t cmd;
+ cmdline_fixed_string_t user_priority;
+ uint8_t user_priority_id;
+ cmdline_fixed_string_t region;
+ uint8_t region_id;
+};
+
+static void
+cmd_user_priority_region_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_user_priority_region_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_queue_region_conf region_conf;
+ enum rte_pmd_i40e_queue_region_op op_type;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ memset(®ion_conf, 0, sizeof(region_conf));
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_USER_PRIORITY_SET;
+ region_conf.user_priority = res->user_priority_id;
+ region_conf.region_id = res->region_id;
+
+ ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+ op_type, ®ion_conf);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented or supported\n");
+ break;
+ default:
+ fprintf(stderr, "user_priority region config error: (%s)\n",
+ strerror(-ret));
+ }
+}
+
+static cmdline_parse_token_string_t cmd_user_priority_region_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_user_priority_region_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_user_priority_region_port_index =
+ TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_user_priority_region_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+ cmd, "queue-region");
+static cmdline_parse_token_string_t cmd_user_priority_region_UP =
+ TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+ user_priority, "UP");
+static cmdline_parse_token_num_t cmd_user_priority_region_UP_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+ user_priority_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_user_priority_region_region =
+ TOKEN_STRING_INITIALIZER(struct cmd_user_priority_region_result,
+ region, "region_id");
+static cmdline_parse_token_num_t cmd_user_priority_region_region_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_user_priority_region_result,
+ region_id, RTE_UINT8);
+
+static cmdline_parse_inst_t cmd_user_priority_region = {
+ .f = cmd_user_priority_region_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> queue-region UP <value> "
+ "region_id <value>: Set the mapping of User Priority (UP) "
+ "to queue region (region_id) ",
+ .tokens = {
+ (void *)&cmd_user_priority_region_set,
+ (void *)&cmd_user_priority_region_port,
+ (void *)&cmd_user_priority_region_port_index,
+ (void *)&cmd_user_priority_region_cmd,
+ (void *)&cmd_user_priority_region_UP,
+ (void *)&cmd_user_priority_region_UP_id,
+ (void *)&cmd_user_priority_region_region,
+ (void *)&cmd_user_priority_region_region_id,
+ NULL,
+ },
+};
+
+/* *** flush all queue region related configuration *** */
+struct cmd_flush_queue_region_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t cmd;
+ cmdline_fixed_string_t flush;
+ cmdline_fixed_string_t what;
+};
+
+static void
+cmd_flush_queue_region_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_flush_queue_region_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_queue_region_conf region_conf;
+ enum rte_pmd_i40e_queue_region_op op_type;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ memset(®ion_conf, 0, sizeof(region_conf));
+
+ if (strcmp(res->what, "on") == 0)
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON;
+ else
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF;
+
+ ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+ op_type, ®ion_conf);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented or supported\n");
+ break;
+ default:
+ fprintf(stderr, "queue region config flush error: (%s)\n",
+ strerror(-ret));
+ }
+}
+
+static cmdline_parse_token_string_t cmd_flush_queue_region_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_flush_queue_region_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_flush_queue_region_port_index =
+ TOKEN_NUM_INITIALIZER(struct cmd_flush_queue_region_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_flush_queue_region_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+ cmd, "queue-region");
+static cmdline_parse_token_string_t cmd_flush_queue_region_flush =
+ TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+ flush, "flush");
+static cmdline_parse_token_string_t cmd_flush_queue_region_what =
+ TOKEN_STRING_INITIALIZER(struct cmd_flush_queue_region_result,
+ what, "on#off");
+
+static cmdline_parse_inst_t cmd_flush_queue_region = {
+ .f = cmd_flush_queue_region_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id> queue-region flush on|off"
+ ": flush all queue region related configuration",
+ .tokens = {
+ (void *)&cmd_flush_queue_region_set,
+ (void *)&cmd_flush_queue_region_port,
+ (void *)&cmd_flush_queue_region_port_index,
+ (void *)&cmd_flush_queue_region_cmd,
+ (void *)&cmd_flush_queue_region_flush,
+ (void *)&cmd_flush_queue_region_what,
+ NULL,
+ },
+};
+
+/* *** get all queue region related configuration info *** */
+struct cmd_show_queue_region_info {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t cmd;
+};
+
+static void
+port_queue_region_info_display(portid_t port_id, void *buf)
+{
+ uint16_t i, j;
+ struct rte_pmd_i40e_queue_regions *info =
+ (struct rte_pmd_i40e_queue_regions *)buf;
+ static const char *queue_region_info_stats_border = "-------";
+
+ if (!info->queue_region_number)
+ printf("there is no region has been set before");
+
+ printf("\n %s All queue region info for port=%2d %s",
+ queue_region_info_stats_border, port_id,
+ queue_region_info_stats_border);
+ printf("\n queue_region_number: %-14u\n",
+ info->queue_region_number);
+
+ for (i = 0; i < info->queue_region_number; i++) {
+ printf("\n region_id: %-14u queue_number: %-14u "
+ "queue_start_index: %-14u\n",
+ info->region[i].region_id,
+ info->region[i].queue_num,
+ info->region[i].queue_start_index);
+
+ printf(" user_priority_num is %-14u :",
+ info->region[i].user_priority_num);
+ for (j = 0; j < info->region[i].user_priority_num; j++)
+ printf(" %-14u ", info->region[i].user_priority[j]);
+
+ printf("\n flowtype_num is %-14u :",
+ info->region[i].flowtype_num);
+ for (j = 0; j < info->region[i].flowtype_num; j++)
+ printf(" %-14u ", info->region[i].hw_flowtype[j]);
+ }
+
+ printf("\n\n");
+}
+
+static void
+cmd_show_queue_region_info_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_show_queue_region_info *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_queue_regions rte_pmd_regions;
+ enum rte_pmd_i40e_queue_region_op op_type;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ memset(&rte_pmd_regions, 0, sizeof(rte_pmd_regions));
+
+ op_type = RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET;
+
+ ret = rte_pmd_i40e_rss_queue_region_conf(res->port_id,
+ op_type, &rte_pmd_regions);
+
+ port_queue_region_info_display(res->port_id, &rte_pmd_regions);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented or supported\n");
+ break;
+ default:
+ fprintf(stderr, "queue region config info show error: (%s)\n",
+ strerror(-ret));
+ }
+}
+
+static cmdline_parse_token_string_t cmd_show_queue_region_info_get =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+ show, "show");
+static cmdline_parse_token_string_t cmd_show_queue_region_info_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+ port, "port");
+static cmdline_parse_token_num_t cmd_show_queue_region_info_port_index =
+ TOKEN_NUM_INITIALIZER(struct cmd_show_queue_region_info,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_queue_region_info_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_queue_region_info,
+ cmd, "queue-region");
+
+static cmdline_parse_inst_t cmd_show_queue_region_info_all = {
+ .f = cmd_show_queue_region_info_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> queue-region"
+ ": show all queue region related configuration info",
+ .tokens = {
+ (void *)&cmd_show_queue_region_info_get,
+ (void *)&cmd_show_queue_region_info_port,
+ (void *)&cmd_show_queue_region_info_port_index,
+ (void *)&cmd_show_queue_region_info_cmd,
+ NULL,
+ },
+};
+
+static uint16_t
+str2flowtype(char *string)
+{
+ uint8_t i = 0;
+ static const struct {
+ char str[32];
+ uint16_t type;
+ } flowtype_str[] = {
+ {"raw", RTE_ETH_FLOW_RAW},
+ {"ipv4", RTE_ETH_FLOW_IPV4},
+ {"ipv4-frag", RTE_ETH_FLOW_FRAG_IPV4},
+ {"ipv4-tcp", RTE_ETH_FLOW_NONFRAG_IPV4_TCP},
+ {"ipv4-udp", RTE_ETH_FLOW_NONFRAG_IPV4_UDP},
+ {"ipv4-sctp", RTE_ETH_FLOW_NONFRAG_IPV4_SCTP},
+ {"ipv4-other", RTE_ETH_FLOW_NONFRAG_IPV4_OTHER},
+ {"ipv6", RTE_ETH_FLOW_IPV6},
+ {"ipv6-frag", RTE_ETH_FLOW_FRAG_IPV6},
+ {"ipv6-tcp", RTE_ETH_FLOW_NONFRAG_IPV6_TCP},
+ {"ipv6-udp", RTE_ETH_FLOW_NONFRAG_IPV6_UDP},
+ {"ipv6-sctp", RTE_ETH_FLOW_NONFRAG_IPV6_SCTP},
+ {"ipv6-other", RTE_ETH_FLOW_NONFRAG_IPV6_OTHER},
+ {"l2_payload", RTE_ETH_FLOW_L2_PAYLOAD},
+ {"ipv6-ex", RTE_ETH_FLOW_IPV6_EX},
+ {"ipv6-tcp-ex", RTE_ETH_FLOW_IPV6_TCP_EX},
+ {"ipv6-udp-ex", RTE_ETH_FLOW_IPV6_UDP_EX},
+ {"gtpu", RTE_ETH_FLOW_GTPU},
+ };
+
+ for (i = 0; i < RTE_DIM(flowtype_str); i++) {
+ if (!strcmp(flowtype_str[i].str, string))
+ return flowtype_str[i].type;
+ }
+
+ if (isdigit(string[0]) && atoi(string) > 0 && atoi(string) < 64)
+ return (uint16_t)atoi(string);
+
+ return RTE_ETH_FLOW_UNKNOWN;
+}
+
+/* *** deal with flow director filter *** */
+struct cmd_flow_director_result {
+ cmdline_fixed_string_t flow_director_filter;
+ portid_t port_id;
+ cmdline_fixed_string_t mode;
+ cmdline_fixed_string_t mode_value;
+ cmdline_fixed_string_t ops;
+ cmdline_fixed_string_t flow;
+ cmdline_fixed_string_t flow_type;
+ cmdline_fixed_string_t drop;
+ cmdline_fixed_string_t queue;
+ uint16_t queue_id;
+ cmdline_fixed_string_t fd_id;
+ uint32_t fd_id_value;
+ cmdline_fixed_string_t packet;
+ char filepath[];
+};
+
+static void
+cmd_flow_director_filter_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl, __rte_unused void *data)
+{
+ struct cmd_flow_director_result *res = parsed_result;
+ int ret = 0;
+ struct rte_pmd_i40e_flow_type_mapping
+ mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
+ struct rte_pmd_i40e_pkt_template_conf conf;
+ uint16_t flow_type = str2flowtype(res->flow_type);
+ uint16_t i, port = res->port_id;
+ uint8_t add;
+
+ memset(&conf, 0, sizeof(conf));
+
+ if (flow_type == RTE_ETH_FLOW_UNKNOWN) {
+ fprintf(stderr, "Invalid flow type specified.\n");
+ return;
+ }
+ ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id,
+ mapping);
+ if (ret)
+ return;
+ if (mapping[flow_type].pctype == 0ULL) {
+ fprintf(stderr, "Invalid flow type specified.\n");
+ return;
+ }
+ for (i = 0; i < RTE_PMD_I40E_PCTYPE_MAX; i++) {
+ if (mapping[flow_type].pctype & (1ULL << i)) {
+ conf.input.pctype = i;
+ break;
+ }
+ }
+
+ conf.input.packet = open_file(res->filepath,
+ &conf.input.length);
+ if (!conf.input.packet)
+ return;
+ if (!strcmp(res->drop, "drop"))
+ conf.action.behavior =
+ RTE_PMD_I40E_PKT_TEMPLATE_REJECT;
+ else
+ conf.action.behavior =
+ RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT;
+ conf.action.report_status =
+ RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID;
+ conf.action.rx_queue = res->queue_id;
+ conf.soft_id = res->fd_id_value;
+ add = strcmp(res->ops, "del") ? 1 : 0;
+ ret = rte_pmd_i40e_flow_add_del_packet_template(port,
+ &conf,
+ add);
+ if (ret < 0)
+ fprintf(stderr, "flow director config error: (%s)\n",
+ strerror(-ret));
+ close_file(conf.input.packet);
+}
+
+static cmdline_parse_token_string_t cmd_flow_director_filter =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ flow_director_filter, "flow_director_filter");
+static cmdline_parse_token_num_t cmd_flow_director_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_flow_director_ops =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ ops, "add#del#update");
+static cmdline_parse_token_string_t cmd_flow_director_flow =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ flow, "flow");
+static cmdline_parse_token_string_t cmd_flow_director_flow_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ flow_type, NULL);
+static cmdline_parse_token_string_t cmd_flow_director_drop =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ drop, "drop#fwd");
+static cmdline_parse_token_string_t cmd_flow_director_queue =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ queue, "queue");
+static cmdline_parse_token_num_t cmd_flow_director_queue_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ queue_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_flow_director_fd_id =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ fd_id, "fd_id");
+static cmdline_parse_token_num_t cmd_flow_director_fd_id_value =
+ TOKEN_NUM_INITIALIZER(struct cmd_flow_director_result,
+ fd_id_value, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_flow_director_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode, "mode");
+static cmdline_parse_token_string_t cmd_flow_director_mode_raw =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ mode_value, "raw");
+static cmdline_parse_token_string_t cmd_flow_director_packet =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ packet, "packet");
+static cmdline_parse_token_string_t cmd_flow_director_filepath =
+ TOKEN_STRING_INITIALIZER(struct cmd_flow_director_result,
+ filepath, NULL);
+
+static cmdline_parse_inst_t cmd_add_del_raw_flow_director = {
+ .f = cmd_flow_director_filter_parsed,
+ .data = NULL,
+ .help_str = "flow_director_filter ... : Add or delete a raw flow "
+ "director entry on NIC",
+ .tokens = {
+ (void *)&cmd_flow_director_filter,
+ (void *)&cmd_flow_director_port_id,
+ (void *)&cmd_flow_director_mode,
+ (void *)&cmd_flow_director_mode_raw,
+ (void *)&cmd_flow_director_ops,
+ (void *)&cmd_flow_director_flow,
+ (void *)&cmd_flow_director_flow_type,
+ (void *)&cmd_flow_director_drop,
+ (void *)&cmd_flow_director_queue,
+ (void *)&cmd_flow_director_queue_id,
+ (void *)&cmd_flow_director_fd_id,
+ (void *)&cmd_flow_director_fd_id_value,
+ (void *)&cmd_flow_director_packet,
+ (void *)&cmd_flow_director_filepath,
+ NULL,
+ },
+};
+
+/* VF unicast promiscuous mode configuration */
+
+/* Common result structure for VF unicast promiscuous mode */
+struct cmd_vf_promisc_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t promisc;
+ portid_t port_id;
+ uint32_t vf_id;
+ cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF unicast promiscuous mode enable disable */
+static cmdline_parse_token_string_t cmd_vf_promisc_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_promisc_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_vf_promisc_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_promisc_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_vf_promisc_promisc =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_promisc_result,
+ promisc, "promisc");
+static cmdline_parse_token_num_t cmd_vf_promisc_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_promisc_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_vf_promisc_vf_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_promisc_result,
+ vf_id, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_vf_promisc_on_off =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_promisc_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_promisc_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_promisc_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_unicast_promisc(res->port_id, res->vf_id, is_on);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_set_vf_promisc = {
+ .f = cmd_set_vf_promisc_parsed,
+ .data = NULL,
+ .help_str = "set vf promisc <port_id> <vf_id> on|off: "
+ "Set unicast promiscuous mode for a VF from the PF",
+ .tokens = {
+ (void *)&cmd_vf_promisc_set,
+ (void *)&cmd_vf_promisc_vf,
+ (void *)&cmd_vf_promisc_promisc,
+ (void *)&cmd_vf_promisc_port_id,
+ (void *)&cmd_vf_promisc_vf_id,
+ (void *)&cmd_vf_promisc_on_off,
+ NULL,
+ },
+};
+
+/* VF multicast promiscuous mode configuration */
+
+/* Common result structure for VF multicast promiscuous mode */
+struct cmd_vf_allmulti_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t allmulti;
+ portid_t port_id;
+ uint32_t vf_id;
+ cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for VF multicast promiscuous mode enable disable */
+static cmdline_parse_token_string_t cmd_vf_allmulti_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_allmulti_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_vf_allmulti_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_allmulti_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_vf_allmulti_allmulti =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_allmulti_result,
+ allmulti, "allmulti");
+static cmdline_parse_token_num_t cmd_vf_allmulti_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_allmulti_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_vf_allmulti_vf_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_allmulti_result,
+ vf_id, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_vf_allmulti_on_off =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_allmulti_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_allmulti_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_allmulti_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id, res->vf_id, is_on);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d\n", res->vf_id);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_set_vf_allmulti = {
+ .f = cmd_set_vf_allmulti_parsed,
+ .data = NULL,
+ .help_str = "set vf allmulti <port_id> <vf_id> on|off: "
+ "Set multicast promiscuous mode for a VF from the PF",
+ .tokens = {
+ (void *)&cmd_vf_allmulti_set,
+ (void *)&cmd_vf_allmulti_vf,
+ (void *)&cmd_vf_allmulti_allmulti,
+ (void *)&cmd_vf_allmulti_port_id,
+ (void *)&cmd_vf_allmulti_vf_id,
+ (void *)&cmd_vf_allmulti_on_off,
+ NULL,
+ },
+};
+
+/* vf broadcast mode configuration */
+
+/* Common result structure for vf broadcast */
+struct cmd_set_vf_broadcast_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t broadcast;
+ portid_t port_id;
+ uint16_t vf_id;
+ cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf broadcast enable disable */
+static cmdline_parse_token_string_t cmd_set_vf_broadcast_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_set_vf_broadcast_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_set_vf_broadcast_broadcast =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ broadcast, "broadcast");
+static cmdline_parse_token_num_t cmd_set_vf_broadcast_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_set_vf_broadcast_vf_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ vf_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_vf_broadcast_on_off =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_broadcast_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_broadcast_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_set_vf_broadcast_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_broadcast(res->port_id, res->vf_id, is_on);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+ res->vf_id, is_on);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_set_vf_broadcast = {
+ .f = cmd_set_vf_broadcast_parsed,
+ .data = NULL,
+ .help_str = "set vf broadcast <port_id> <vf_id> on|off",
+ .tokens = {
+ (void *)&cmd_set_vf_broadcast_set,
+ (void *)&cmd_set_vf_broadcast_vf,
+ (void *)&cmd_set_vf_broadcast_broadcast,
+ (void *)&cmd_set_vf_broadcast_port_id,
+ (void *)&cmd_set_vf_broadcast_vf_id,
+ (void *)&cmd_set_vf_broadcast_on_off,
+ NULL,
+ },
+};
+
+/* vf vlan tag configuration */
+
+/* Common result structure for vf vlan tag */
+struct cmd_set_vf_vlan_tag_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t vlan;
+ cmdline_fixed_string_t tag;
+ portid_t port_id;
+ uint16_t vf_id;
+ cmdline_fixed_string_t on_off;
+};
+
+/* Common CLI fields for vf vlan tag enable disable */
+static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ vf, "vf");
+static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_vlan =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ vlan, "vlan");
+static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_tag =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ tag, "tag");
+static cmdline_parse_token_num_t cmd_set_vf_vlan_tag_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_set_vf_vlan_tag_vf_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ vf_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_set_vf_vlan_tag_on_off =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_vf_vlan_tag_result,
+ on_off, "on#off");
+
+static void
+cmd_set_vf_vlan_tag_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_set_vf_vlan_tag_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ __rte_unused int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_vlan_tag(res->port_id, res->vf_id, is_on);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d or is_on %d\n",
+ res->vf_id, is_on);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_set_vf_vlan_tag = {
+ .f = cmd_set_vf_vlan_tag_parsed,
+ .data = NULL,
+ .help_str = "set vf vlan tag <port_id> <vf_id> on|off",
+ .tokens = {
+ (void *)&cmd_set_vf_vlan_tag_set,
+ (void *)&cmd_set_vf_vlan_tag_vf,
+ (void *)&cmd_set_vf_vlan_tag_vlan,
+ (void *)&cmd_set_vf_vlan_tag_tag,
+ (void *)&cmd_set_vf_vlan_tag_port_id,
+ (void *)&cmd_set_vf_vlan_tag_vf_id,
+ (void *)&cmd_set_vf_vlan_tag_on_off,
+ NULL,
+ },
+};
+
+/* Common definition of VF and TC TX bandwidth configuration */
+struct cmd_vf_tc_bw_result {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t vf;
+ cmdline_fixed_string_t tc;
+ cmdline_fixed_string_t tx;
+ cmdline_fixed_string_t max_bw;
+ cmdline_fixed_string_t min_bw;
+ cmdline_fixed_string_t strict_link_prio;
+ portid_t port_id;
+ uint16_t vf_id;
+ uint8_t tc_no;
+ uint32_t bw;
+ cmdline_fixed_string_t bw_list;
+ uint8_t tc_map;
+};
+
+static cmdline_parse_token_string_t cmd_vf_tc_bw_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ set, "set");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_tc =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ tc, "tc");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_tx =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ tx, "tx");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_strict_link_prio =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ strict_link_prio, "strict-link-priority");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_max_bw =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ max_bw, "max-bandwidth");
+static cmdline_parse_token_string_t cmd_vf_tc_bw_min_bw =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ min_bw, "min-bandwidth");
+static cmdline_parse_token_num_t cmd_vf_tc_bw_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_tc_bw_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_vf_tc_bw_vf_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_tc_bw_result,
+ vf_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_vf_tc_bw_tc_no =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_tc_bw_result,
+ tc_no, RTE_UINT8);
+static cmdline_parse_token_num_t cmd_vf_tc_bw_bw =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_tc_bw_result,
+ bw, RTE_UINT32);
+static cmdline_parse_token_string_t cmd_vf_tc_bw_bw_list =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ bw_list, NULL);
+static cmdline_parse_token_num_t cmd_vf_tc_bw_tc_map =
+ TOKEN_NUM_INITIALIZER(struct cmd_vf_tc_bw_result,
+ tc_map, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_vf_tc_bw_vf =
+ TOKEN_STRING_INITIALIZER(struct cmd_vf_tc_bw_result,
+ vf, "vf");
+
+/* VF max bandwidth setting */
+static void
+cmd_vf_max_bw_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_tc_bw_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_max_bw(res->port_id,
+ res->vf_id, res->bw);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d or bandwidth %d\n",
+ res->vf_id, res->bw);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_vf_max_bw = {
+ .f = cmd_vf_max_bw_parsed,
+ .data = NULL,
+ .help_str = "set vf tx max-bandwidth <port_id> <vf_id> <bandwidth>",
+ .tokens = {
+ (void *)&cmd_vf_tc_bw_set,
+ (void *)&cmd_vf_tc_bw_vf,
+ (void *)&cmd_vf_tc_bw_tx,
+ (void *)&cmd_vf_tc_bw_max_bw,
+ (void *)&cmd_vf_tc_bw_port_id,
+ (void *)&cmd_vf_tc_bw_vf_id,
+ (void *)&cmd_vf_tc_bw_bw,
+ NULL,
+ },
+};
+
+static int
+vf_tc_min_bw_parse_bw_list(uint8_t *bw_list, uint8_t *tc_num, char *str)
+{
+ uint32_t size;
+ const char *p, *p0 = str;
+ char s[256];
+ char *end;
+ char *str_fld[16];
+ uint16_t i;
+ int ret;
+
+ p = strchr(p0, '(');
+ if (p == NULL) {
+ fprintf(stderr,
+ "The bandwidth-list should be '(bw1, bw2, ...)'\n");
+ return -1;
+ }
+ p++;
+ p0 = strchr(p, ')');
+ if (p0 == NULL) {
+ fprintf(stderr,
+ "The bandwidth-list should be '(bw1, bw2, ...)'\n");
+ return -1;
+ }
+ size = p0 - p;
+ if (size >= sizeof(s)) {
+ fprintf(stderr,
+ "The string size exceeds the internal buffer size\n");
+ return -1;
+ }
+ snprintf(s, sizeof(s), "%.*s", size, p);
+ ret = rte_strsplit(s, sizeof(s), str_fld, 16, ',');
+ if (ret <= 0) {
+ fprintf(stderr, "Failed to get the bandwidth list.\n");
+ return -1;
+ }
+ *tc_num = ret;
+ for (i = 0; i < ret; i++)
+ bw_list[i] = (uint8_t)strtoul(str_fld[i], &end, 0);
+
+ return 0;
+}
+
+/* TC min bandwidth setting */
+static void
+cmd_vf_tc_min_bw_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_tc_bw_result *res = parsed_result;
+ uint8_t tc_num;
+ uint8_t bw[16];
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = vf_tc_min_bw_parse_bw_list(bw, &tc_num, res->bw_list);
+ if (ret)
+ return;
+
+ ret = rte_pmd_i40e_set_vf_tc_bw_alloc(res->port_id, res->vf_id, tc_num, bw);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid vf_id %d or bandwidth\n", res->vf_id);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_vf_tc_min_bw = {
+ .f = cmd_vf_tc_min_bw_parsed,
+ .data = NULL,
+ .help_str = "set vf tc tx min-bandwidth <port_id> <vf_id>"
+ " <bw1, bw2, ...>",
+ .tokens = {
+ (void *)&cmd_vf_tc_bw_set,
+ (void *)&cmd_vf_tc_bw_vf,
+ (void *)&cmd_vf_tc_bw_tc,
+ (void *)&cmd_vf_tc_bw_tx,
+ (void *)&cmd_vf_tc_bw_min_bw,
+ (void *)&cmd_vf_tc_bw_port_id,
+ (void *)&cmd_vf_tc_bw_vf_id,
+ (void *)&cmd_vf_tc_bw_bw_list,
+ NULL,
+ },
+};
+
+/* TC max bandwidth setting */
+static void
+cmd_vf_tc_max_bw_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_tc_bw_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_vf_tc_max_bw(res->port_id, res->vf_id, res->tc_no, res->bw);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr,
+ "invalid vf_id %d, tc_no %d or bandwidth %d\n",
+ res->vf_id, res->tc_no, res->bw);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_vf_tc_max_bw = {
+ .f = cmd_vf_tc_max_bw_parsed,
+ .data = NULL,
+ .help_str = "set vf tc tx max-bandwidth <port_id> <vf_id> <tc_no>"
+ " <bandwidth>",
+ .tokens = {
+ (void *)&cmd_vf_tc_bw_set,
+ (void *)&cmd_vf_tc_bw_vf,
+ (void *)&cmd_vf_tc_bw_tc,
+ (void *)&cmd_vf_tc_bw_tx,
+ (void *)&cmd_vf_tc_bw_max_bw,
+ (void *)&cmd_vf_tc_bw_port_id,
+ (void *)&cmd_vf_tc_bw_vf_id,
+ (void *)&cmd_vf_tc_bw_tc_no,
+ (void *)&cmd_vf_tc_bw_bw,
+ NULL,
+ },
+};
+
+/* Strict link priority scheduling mode setting */
+static void
+cmd_strict_link_prio_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_vf_tc_bw_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_set_tc_strict_prio(res->port_id, res->tc_map);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid tc_bitmap 0x%x\n", res->tc_map);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_strict_link_prio = {
+ .f = cmd_strict_link_prio_parsed,
+ .data = NULL,
+ .help_str = "set tx strict-link-priority <port_id> <tc_bitmap>",
+ .tokens = {
+ (void *)&cmd_vf_tc_bw_set,
+ (void *)&cmd_vf_tc_bw_tx,
+ (void *)&cmd_vf_tc_bw_strict_link_prio,
+ (void *)&cmd_vf_tc_bw_port_id,
+ (void *)&cmd_vf_tc_bw_tc_map,
+ NULL,
+ },
+};
+
+/* Load dynamic device personalization*/
+struct cmd_ddp_add_result {
+ cmdline_fixed_string_t ddp;
+ cmdline_fixed_string_t add;
+ portid_t port_id;
+ char filepath[];
+};
+
+static cmdline_parse_token_string_t cmd_ddp_add_ddp =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, ddp, "ddp");
+static cmdline_parse_token_string_t cmd_ddp_add_add =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, add, "add");
+static cmdline_parse_token_num_t cmd_ddp_add_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ddp_add_result, port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_ddp_add_filepath =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_add_result, filepath, NULL);
+
+static void
+cmd_ddp_add_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ddp_add_result *res = parsed_result;
+ uint8_t *buff;
+ uint32_t size;
+ char *filepath;
+ char *file_fld[2];
+ int file_num;
+ int ret = -ENOTSUP;
+
+ if (!all_ports_stopped()) {
+ fprintf(stderr, "Please stop all ports first\n");
+ return;
+ }
+
+ filepath = strdup(res->filepath);
+ if (filepath == NULL) {
+ fprintf(stderr, "Failed to allocate memory\n");
+ return;
+ }
+ file_num = rte_strsplit(filepath, strlen(filepath), file_fld, 2, ',');
+
+ buff = open_file(file_fld[0], &size);
+ if (!buff) {
+ free((void *)filepath);
+ return;
+ }
+
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_process_ddp_package(res->port_id, buff, size,
+ RTE_PMD_I40E_PKG_OP_WR_ADD);
+ if (ret == -EEXIST)
+ fprintf(stderr, "Profile has already existed.\n");
+ else if (ret < 0)
+ fprintf(stderr, "Failed to load profile.\n");
+ else if (file_num == 2)
+ save_file(file_fld[1], buff, size);
+
+ close_file(buff);
+ free((void *)filepath);
+}
+
+static cmdline_parse_inst_t cmd_ddp_add = {
+ .f = cmd_ddp_add_parsed,
+ .data = NULL,
+ .help_str = "ddp add <port_id> <profile_path[,backup_profile_path]>",
+ .tokens = {
+ (void *)&cmd_ddp_add_ddp,
+ (void *)&cmd_ddp_add_add,
+ (void *)&cmd_ddp_add_port_id,
+ (void *)&cmd_ddp_add_filepath,
+ NULL,
+ },
+};
+
+/* Delete dynamic device personalization*/
+struct cmd_ddp_del_result {
+ cmdline_fixed_string_t ddp;
+ cmdline_fixed_string_t del;
+ portid_t port_id;
+ char filepath[];
+};
+
+static cmdline_parse_token_string_t cmd_ddp_del_ddp =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, ddp, "ddp");
+static cmdline_parse_token_string_t cmd_ddp_del_del =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, del, "del");
+static cmdline_parse_token_num_t cmd_ddp_del_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ddp_del_result, port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_ddp_del_filepath =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_del_result, filepath, NULL);
+
+static void
+cmd_ddp_del_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ddp_del_result *res = parsed_result;
+ uint8_t *buff;
+ uint32_t size;
+ int ret = -ENOTSUP;
+
+ if (!all_ports_stopped()) {
+ fprintf(stderr, "Please stop all ports first\n");
+ return;
+ }
+
+ buff = open_file(res->filepath, &size);
+ if (!buff)
+ return;
+
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_process_ddp_package(res->port_id, buff, size,
+ RTE_PMD_I40E_PKG_OP_WR_DEL);
+ if (ret == -EACCES)
+ fprintf(stderr, "Profile does not exist.\n");
+ else if (ret < 0)
+ fprintf(stderr, "Failed to delete profile.\n");
+
+ close_file(buff);
+}
+
+static cmdline_parse_inst_t cmd_ddp_del = {
+ .f = cmd_ddp_del_parsed,
+ .data = NULL,
+ .help_str = "ddp del <port_id> <backup_profile_path>",
+ .tokens = {
+ (void *)&cmd_ddp_del_ddp,
+ (void *)&cmd_ddp_del_del,
+ (void *)&cmd_ddp_del_port_id,
+ (void *)&cmd_ddp_del_filepath,
+ NULL,
+ },
+};
+
+/* Get dynamic device personalization profile info */
+struct cmd_ddp_info_result {
+ cmdline_fixed_string_t ddp;
+ cmdline_fixed_string_t get;
+ cmdline_fixed_string_t info;
+ char filepath[];
+};
+
+static cmdline_parse_token_string_t cmd_ddp_info_ddp =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, ddp, "ddp");
+static cmdline_parse_token_string_t cmd_ddp_info_get =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, get, "get");
+static cmdline_parse_token_string_t cmd_ddp_info_info =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, info, "info");
+static cmdline_parse_token_string_t cmd_ddp_info_filepath =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_info_result, filepath, NULL);
+
+static void
+cmd_ddp_info_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ddp_info_result *res = parsed_result;
+ uint8_t *pkg;
+ uint32_t pkg_size;
+ int ret = -ENOTSUP;
+ uint32_t i, j, n;
+ uint8_t *buff;
+ uint32_t buff_size = 0;
+ struct rte_pmd_i40e_profile_info info;
+ uint32_t dev_num = 0;
+ struct rte_pmd_i40e_ddp_device_id *devs;
+ uint32_t proto_num = 0;
+ struct rte_pmd_i40e_proto_info *proto = NULL;
+ uint32_t pctype_num = 0;
+ struct rte_pmd_i40e_ptype_info *pctype;
+ uint32_t ptype_num = 0;
+ struct rte_pmd_i40e_ptype_info *ptype;
+ uint8_t proto_id;
+
+ pkg = open_file(res->filepath, &pkg_size);
+ if (!pkg)
+ return;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&info, sizeof(info),
+ RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER);
+ if (!ret) {
+ printf("Global Track id: 0x%x\n", info.track_id);
+ printf("Global Version: %d.%d.%d.%d\n",
+ info.version.major,
+ info.version.minor,
+ info.version.update,
+ info.version.draft);
+ printf("Global Package name: %s\n\n", info.name);
+ }
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&info, sizeof(info),
+ RTE_PMD_I40E_PKG_INFO_HEADER);
+ if (!ret) {
+ printf("i40e Profile Track id: 0x%x\n", info.track_id);
+ printf("i40e Profile Version: %d.%d.%d.%d\n",
+ info.version.major,
+ info.version.minor,
+ info.version.update,
+ info.version.draft);
+ printf("i40e Profile name: %s\n\n", info.name);
+ }
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&buff_size, sizeof(buff_size),
+ RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE);
+ if (!ret && buff_size) {
+ buff = (uint8_t *)malloc(buff_size);
+ if (buff) {
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ buff, buff_size,
+ RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES);
+ if (!ret)
+ printf("Package Notes:\n%s\n\n", buff);
+ free(buff);
+ }
+ }
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&dev_num, sizeof(dev_num),
+ RTE_PMD_I40E_PKG_INFO_DEVID_NUM);
+ if (!ret && dev_num) {
+ buff_size = dev_num * sizeof(struct rte_pmd_i40e_ddp_device_id);
+ devs = (struct rte_pmd_i40e_ddp_device_id *)malloc(buff_size);
+ if (devs) {
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)devs, buff_size,
+ RTE_PMD_I40E_PKG_INFO_DEVID_LIST);
+ if (!ret) {
+ printf("List of supported devices:\n");
+ for (i = 0; i < dev_num; i++) {
+ printf(" %04X:%04X %04X:%04X\n",
+ devs[i].vendor_dev_id >> 16,
+ devs[i].vendor_dev_id & 0xFFFF,
+ devs[i].sub_vendor_dev_id >> 16,
+ devs[i].sub_vendor_dev_id & 0xFFFF);
+ }
+ printf("\n");
+ }
+ free(devs);
+ }
+ }
+
+ /* get information about protocols and packet types */
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&proto_num, sizeof(proto_num),
+ RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM);
+ if (ret || !proto_num)
+ goto no_print_return;
+
+ buff_size = proto_num * sizeof(struct rte_pmd_i40e_proto_info);
+ proto = (struct rte_pmd_i40e_proto_info *)malloc(buff_size);
+ if (!proto)
+ goto no_print_return;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)proto,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST);
+ if (!ret) {
+ printf("List of used protocols:\n");
+ for (i = 0; i < proto_num; i++)
+ printf(" %2u: %s\n", proto[i].proto_id, proto[i].name);
+ printf("\n");
+ }
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size,
+ (uint8_t *)&pctype_num, sizeof(pctype_num),
+ RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM);
+ if (ret || !pctype_num)
+ goto no_print_pctypes;
+
+ buff_size = pctype_num * sizeof(struct rte_pmd_i40e_ptype_info);
+ pctype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
+ if (!pctype)
+ goto no_print_pctypes;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)pctype,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST);
+ if (ret) {
+ free(pctype);
+ goto no_print_pctypes;
+ }
+
+ printf("List of defined packet classification types:\n");
+ for (i = 0; i < pctype_num; i++) {
+ printf(" %2u:", pctype[i].ptype_id);
+ for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
+ proto_id = pctype[i].protocols[j];
+ if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
+ for (n = 0; n < proto_num; n++) {
+ if (proto[n].proto_id == proto_id) {
+ printf(" %s", proto[n].name);
+ break;
+ }
+ }
+ }
+ }
+ printf("\n");
+ }
+ printf("\n");
+ free(pctype);
+
+no_print_pctypes:
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)&ptype_num,
+ sizeof(ptype_num),
+ RTE_PMD_I40E_PKG_INFO_PTYPE_NUM);
+ if (ret || !ptype_num)
+ goto no_print_return;
+
+ buff_size = ptype_num * sizeof(struct rte_pmd_i40e_ptype_info);
+ ptype = (struct rte_pmd_i40e_ptype_info *)malloc(buff_size);
+ if (!ptype)
+ goto no_print_return;
+
+ ret = rte_pmd_i40e_get_ddp_info(pkg, pkg_size, (uint8_t *)ptype,
+ buff_size,
+ RTE_PMD_I40E_PKG_INFO_PTYPE_LIST);
+ if (ret) {
+ free(ptype);
+ goto no_print_return;
+ }
+ printf("List of defined packet types:\n");
+ for (i = 0; i < ptype_num; i++) {
+ printf(" %2u:", ptype[i].ptype_id);
+ for (j = 0; j < RTE_PMD_I40E_PROTO_NUM; j++) {
+ proto_id = ptype[i].protocols[j];
+ if (proto_id != RTE_PMD_I40E_PROTO_UNUSED) {
+ for (n = 0; n < proto_num; n++) {
+ if (proto[n].proto_id == proto_id) {
+ printf(" %s", proto[n].name);
+ break;
+ }
+ }
+ }
+ }
+ printf("\n");
+ }
+ free(ptype);
+ printf("\n");
+
+ ret = 0;
+no_print_return:
+ free(proto);
+ if (ret == -ENOTSUP)
+ fprintf(stderr, "Function not supported in PMD\n");
+ close_file(pkg);
+}
+
+static cmdline_parse_inst_t cmd_ddp_get_info = {
+ .f = cmd_ddp_info_parsed,
+ .data = NULL,
+ .help_str = "ddp get info <profile_path>",
+ .tokens = {
+ (void *)&cmd_ddp_info_ddp,
+ (void *)&cmd_ddp_info_get,
+ (void *)&cmd_ddp_info_info,
+ (void *)&cmd_ddp_info_filepath,
+ NULL,
+ },
+};
+
+/* Get dynamic device personalization profile info list*/
+#define PROFILE_INFO_SIZE 48
+#define MAX_PROFILE_NUM 16
+
+struct cmd_ddp_get_list_result {
+ cmdline_fixed_string_t ddp;
+ cmdline_fixed_string_t get;
+ cmdline_fixed_string_t list;
+ portid_t port_id;
+};
+
+static cmdline_parse_token_string_t cmd_ddp_get_list_ddp =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, ddp, "ddp");
+static cmdline_parse_token_string_t cmd_ddp_get_list_get =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, get, "get");
+static cmdline_parse_token_string_t cmd_ddp_get_list_list =
+ TOKEN_STRING_INITIALIZER(struct cmd_ddp_get_list_result, list, "list");
+static cmdline_parse_token_num_t cmd_ddp_get_list_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ddp_get_list_result, port_id,
+ RTE_UINT16);
+
+static void
+cmd_ddp_get_list_parsed(__rte_unused void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ddp_get_list_result *res = parsed_result;
+ struct rte_pmd_i40e_profile_list *p_list;
+ struct rte_pmd_i40e_profile_info *p_info;
+ uint32_t p_num;
+ uint32_t size;
+ uint32_t i;
+ int ret = -ENOTSUP;
+
+ size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
+ p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
+ if (!p_list) {
+ fprintf(stderr, "%s: Failed to malloc buffer\n", __func__);
+ return;
+ }
+
+ if (ret == -ENOTSUP)
+ ret = rte_pmd_i40e_get_ddp_list(res->port_id,
+ (uint8_t *)p_list, size);
+
+ if (!ret) {
+ p_num = p_list->p_count;
+ printf("Profile number is: %d\n\n", p_num);
+
+ for (i = 0; i < p_num; i++) {
+ p_info = &p_list->p_info[i];
+ printf("Profile %d:\n", i);
+ printf("Track id: 0x%x\n", p_info->track_id);
+ printf("Version: %d.%d.%d.%d\n",
+ p_info->version.major,
+ p_info->version.minor,
+ p_info->version.update,
+ p_info->version.draft);
+ printf("Profile name: %s\n\n", p_info->name);
+ }
+ }
+
+ free(p_list);
+
+ if (ret < 0)
+ fprintf(stderr, "Failed to get ddp list\n");
+}
+
+static cmdline_parse_inst_t cmd_ddp_get_list = {
+ .f = cmd_ddp_get_list_parsed,
+ .data = NULL,
+ .help_str = "ddp get list <port_id>",
+ .tokens = {
+ (void *)&cmd_ddp_get_list_ddp,
+ (void *)&cmd_ddp_get_list_get,
+ (void *)&cmd_ddp_get_list_list,
+ (void *)&cmd_ddp_get_list_port_id,
+ NULL,
+ },
+};
+
+/* Configure input set */
+struct cmd_cfg_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t opt;
+ cmdline_fixed_string_t field;
+ uint8_t field_idx;
+};
+
+static void
+cmd_cfg_input_set_parsed(__rte_unused void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_cfg_input_set_result *res = parsed_result;
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+ int ret = -ENOTSUP;
+
+ if (!all_ports_stopped()) {
+ fprintf(stderr, "Please stop all ports first\n");
+ return;
+ }
+
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+ ret = rte_pmd_i40e_inset_get(res->port_id, res->pctype_id, &inset, inset_type);
+ if (ret) {
+ fprintf(stderr, "Failed to get input set.\n");
+ return;
+ }
+
+ if (!strcmp(res->opt, "get")) {
+ ret = rte_pmd_i40e_inset_field_get(inset.inset, res->field_idx);
+ if (ret)
+ printf("Field index %d is enabled.\n", res->field_idx);
+ else
+ printf("Field index %d is disabled.\n", res->field_idx);
+ return;
+ }
+
+ if (!strcmp(res->opt, "set"))
+ ret = rte_pmd_i40e_inset_field_set(&inset.inset, res->field_idx);
+ else if (!strcmp(res->opt, "clear"))
+ ret = rte_pmd_i40e_inset_field_clear(&inset.inset, res->field_idx);
+ if (ret) {
+ fprintf(stderr, "Failed to configure input set field.\n");
+ return;
+ }
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id, &inset, inset_type);
+ if (ret) {
+ fprintf(stderr, "Failed to set input set.\n");
+ return;
+ }
+
+ if (ret == -ENOTSUP)
+ fprintf(stderr, "Function not supported\n");
+}
+
+static cmdline_parse_token_string_t cmd_cfg_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ port, "port");
+static cmdline_parse_token_string_t cmd_cfg_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ cfg, "config");
+static cmdline_parse_token_num_t cmd_cfg_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_cfg_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype, "pctype");
+static cmdline_parse_token_num_t cmd_cfg_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ pctype_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_cfg_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ inset_type, "hash_inset#fdir_inset#fdir_flx_inset");
+static cmdline_parse_token_string_t cmd_cfg_input_set_opt =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ opt, "get#set#clear");
+static cmdline_parse_token_string_t cmd_cfg_input_set_field =
+ TOKEN_STRING_INITIALIZER(struct cmd_cfg_input_set_result,
+ field, "field");
+static cmdline_parse_token_num_t cmd_cfg_input_set_field_idx =
+ TOKEN_NUM_INITIALIZER(struct cmd_cfg_input_set_result,
+ field_idx, RTE_UINT8);
+
+static cmdline_parse_inst_t cmd_cfg_input_set = {
+ .f = cmd_cfg_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field <field_idx>",
+ .tokens = {
+ (void *)&cmd_cfg_input_set_port,
+ (void *)&cmd_cfg_input_set_cfg,
+ (void *)&cmd_cfg_input_set_port_id,
+ (void *)&cmd_cfg_input_set_pctype,
+ (void *)&cmd_cfg_input_set_pctype_id,
+ (void *)&cmd_cfg_input_set_inset_type,
+ (void *)&cmd_cfg_input_set_opt,
+ (void *)&cmd_cfg_input_set_field,
+ (void *)&cmd_cfg_input_set_field_idx,
+ NULL,
+ },
+};
+
+/* Clear input set */
+struct cmd_clear_input_set_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t cfg;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ uint8_t pctype_id;
+ cmdline_fixed_string_t inset_type;
+ cmdline_fixed_string_t clear;
+ cmdline_fixed_string_t all;
+};
+
+static void
+cmd_clear_input_set_parsed(__rte_unused void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_clear_input_set_result *res = parsed_result;
+ enum rte_pmd_i40e_inset_type inset_type = INSET_NONE;
+ struct rte_pmd_i40e_inset inset;
+ int ret = -ENOTSUP;
+
+ if (!all_ports_stopped()) {
+ fprintf(stderr, "Please stop all ports first\n");
+ return;
+ }
+
+ if (!strcmp(res->inset_type, "hash_inset"))
+ inset_type = INSET_HASH;
+ else if (!strcmp(res->inset_type, "fdir_inset"))
+ inset_type = INSET_FDIR;
+ else if (!strcmp(res->inset_type, "fdir_flx_inset"))
+ inset_type = INSET_FDIR_FLX;
+
+ memset(&inset, 0, sizeof(inset));
+
+ ret = rte_pmd_i40e_inset_set(res->port_id, res->pctype_id, &inset, inset_type);
+ if (ret) {
+ fprintf(stderr, "Failed to clear input set.\n");
+ return;
+ }
+
+ if (ret == -ENOTSUP)
+ fprintf(stderr, "Function not supported\n");
+}
+
+static cmdline_parse_token_string_t cmd_clear_input_set_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ port, "port");
+static cmdline_parse_token_string_t cmd_clear_input_set_cfg =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ cfg, "config");
+static cmdline_parse_token_num_t cmd_clear_input_set_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_clear_input_set_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ pctype, "pctype");
+static cmdline_parse_token_num_t cmd_clear_input_set_pctype_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_clear_input_set_result,
+ pctype_id, RTE_UINT8);
+static cmdline_parse_token_string_t cmd_clear_input_set_inset_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ inset_type, "hash_inset#fdir_inset#fdir_flx_inset");
+static cmdline_parse_token_string_t cmd_clear_input_set_clear =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ clear, "clear");
+static cmdline_parse_token_string_t cmd_clear_input_set_all =
+ TOKEN_STRING_INITIALIZER(struct cmd_clear_input_set_result,
+ all, "all");
+
+static cmdline_parse_inst_t cmd_clear_input_set = {
+ .f = cmd_clear_input_set_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype <pctype_id> hash_inset|"
+ "fdir_inset|fdir_flx_inset clear all",
+ .tokens = {
+ (void *)&cmd_clear_input_set_port,
+ (void *)&cmd_clear_input_set_cfg,
+ (void *)&cmd_clear_input_set_port_id,
+ (void *)&cmd_clear_input_set_pctype,
+ (void *)&cmd_clear_input_set_pctype_id,
+ (void *)&cmd_clear_input_set_inset_type,
+ (void *)&cmd_clear_input_set_clear,
+ (void *)&cmd_clear_input_set_all,
+ NULL,
+ },
+};
+
+/* port config pctype mapping reset */
+
+/* Common result structure for port config pctype mapping reset */
+struct cmd_pctype_mapping_reset_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t reset;
+};
+
+/* Common CLI fields for port config pctype mapping reset*/
+static cmdline_parse_token_string_t cmd_pctype_mapping_reset_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ port, "port");
+static cmdline_parse_token_string_t cmd_pctype_mapping_reset_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ config, "config");
+static cmdline_parse_token_num_t cmd_pctype_mapping_reset_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_pctype_mapping_reset_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ pctype, "pctype");
+static cmdline_parse_token_string_t cmd_pctype_mapping_reset_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_pctype_mapping_reset_reset =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_reset_result,
+ reset, "reset");
+
+static void
+cmd_pctype_mapping_reset_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_pctype_mapping_reset_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_flow_type_mapping_reset(res->port_id);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_pctype_mapping_reset = {
+ .f = cmd_pctype_mapping_reset_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype mapping reset",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_reset_port,
+ (void *)&cmd_pctype_mapping_reset_config,
+ (void *)&cmd_pctype_mapping_reset_port_id,
+ (void *)&cmd_pctype_mapping_reset_pctype,
+ (void *)&cmd_pctype_mapping_reset_mapping,
+ (void *)&cmd_pctype_mapping_reset_reset,
+ NULL,
+ },
+};
+
+/* show port pctype mapping */
+
+/* Common result structure for show port pctype mapping */
+struct cmd_pctype_mapping_get_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+};
+
+/* Common CLI fields for pctype mapping get */
+static cmdline_parse_token_string_t cmd_pctype_mapping_get_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_get_result,
+ show, "show");
+static cmdline_parse_token_string_t cmd_pctype_mapping_get_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_get_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_pctype_mapping_get_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_pctype_mapping_get_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_pctype_mapping_get_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_get_result,
+ pctype, "pctype");
+static cmdline_parse_token_string_t cmd_pctype_mapping_get_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_get_result,
+ mapping, "mapping");
+
+static void
+cmd_pctype_mapping_get_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_pctype_mapping_get_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_flow_type_mapping
+ mapping[RTE_PMD_I40E_FLOW_TYPE_MAX];
+ int i, j, first_pctype;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_flow_type_mapping_get(res->port_id, mapping);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ return;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ return;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ return;
+ }
+
+ for (i = 0; i < RTE_PMD_I40E_FLOW_TYPE_MAX; i++) {
+ if (mapping[i].pctype != 0ULL) {
+ first_pctype = 1;
+
+ printf("pctype: ");
+ for (j = 0; j < RTE_PMD_I40E_PCTYPE_MAX; j++) {
+ if (mapping[i].pctype & (1ULL << j)) {
+ printf(first_pctype ? "%02d" : ",%02d", j);
+ first_pctype = 0;
+ }
+ }
+ printf(" -> flowtype: %02d\n", mapping[i].flow_type);
+ }
+ }
+}
+
+static cmdline_parse_inst_t cmd_pctype_mapping_get = {
+ .f = cmd_pctype_mapping_get_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> pctype mapping",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_get_show,
+ (void *)&cmd_pctype_mapping_get_port,
+ (void *)&cmd_pctype_mapping_get_port_id,
+ (void *)&cmd_pctype_mapping_get_pctype,
+ (void *)&cmd_pctype_mapping_get_mapping,
+ NULL,
+ },
+};
+
+/* port config pctype mapping update */
+
+/* Common result structure for port config pctype mapping update */
+struct cmd_pctype_mapping_update_result {
+ cmdline_fixed_string_t port;
+ cmdline_fixed_string_t config;
+ portid_t port_id;
+ cmdline_fixed_string_t pctype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t update;
+ cmdline_fixed_string_t pctype_list;
+ uint16_t flow_type;
+};
+
+/* Common CLI fields for pctype mapping update*/
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ port, "port");
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_config =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ config, "config");
+static cmdline_parse_token_num_t cmd_pctype_mapping_update_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_pctype =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ pctype, "pctype");
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_update =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ update, "update");
+static cmdline_parse_token_string_t cmd_pctype_mapping_update_pc_type =
+ TOKEN_STRING_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ pctype_list, NULL);
+static cmdline_parse_token_num_t cmd_pctype_mapping_update_flow_type =
+ TOKEN_NUM_INITIALIZER(struct cmd_pctype_mapping_update_result,
+ flow_type, RTE_UINT16);
+
+static void
+cmd_pctype_mapping_update_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_pctype_mapping_update_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_flow_type_mapping mapping;
+ unsigned int i;
+ unsigned int nb_item;
+ unsigned int pctype_list[RTE_PMD_I40E_PCTYPE_MAX];
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ nb_item = parse_item_list(res->pctype_list, "pctypes", RTE_PMD_I40E_PCTYPE_MAX,
+ pctype_list, 1);
+ mapping.flow_type = res->flow_type;
+ for (i = 0, mapping.pctype = 0ULL; i < nb_item; i++)
+ mapping.pctype |= (1ULL << pctype_list[i]);
+ ret = rte_pmd_i40e_flow_type_mapping_update(res->port_id,
+ &mapping,
+ 1,
+ 0);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid pctype or flow type\n");
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_pctype_mapping_update = {
+ .f = cmd_pctype_mapping_update_parsed,
+ .data = NULL,
+ .help_str = "port config <port_id> pctype mapping update"
+ " <pctype_id_0,[pctype_id_1]*> <flowtype_id>",
+ .tokens = {
+ (void *)&cmd_pctype_mapping_update_port,
+ (void *)&cmd_pctype_mapping_update_config,
+ (void *)&cmd_pctype_mapping_update_port_id,
+ (void *)&cmd_pctype_mapping_update_pctype,
+ (void *)&cmd_pctype_mapping_update_mapping,
+ (void *)&cmd_pctype_mapping_update_update,
+ (void *)&cmd_pctype_mapping_update_pc_type,
+ (void *)&cmd_pctype_mapping_update_flow_type,
+ NULL,
+ },
+};
+
+/* ptype mapping get */
+
+/* Common result structure for ptype mapping get */
+struct cmd_ptype_mapping_get_result {
+ cmdline_fixed_string_t ptype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t get;
+ portid_t port_id;
+ uint8_t valid_only;
+};
+
+/* Common CLI fields for ptype mapping get */
+static cmdline_parse_token_string_t cmd_ptype_mapping_get_ptype =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_get_result,
+ ptype, "ptype");
+static cmdline_parse_token_string_t cmd_ptype_mapping_get_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_get_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_ptype_mapping_get_get =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_get_result,
+ get, "get");
+static cmdline_parse_token_num_t cmd_ptype_mapping_get_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_get_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_ptype_mapping_get_valid_only =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_get_result,
+ valid_only, RTE_UINT8);
+
+static void
+cmd_ptype_mapping_get_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ptype_mapping_get_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ int max_ptype_num = 256;
+ struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num];
+ uint16_t count;
+ int i;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_ptype_mapping_get(res->port_id,
+ mapping,
+ max_ptype_num,
+ &count,
+ res->valid_only);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+
+ if (!ret) {
+ for (i = 0; i < count; i++)
+ printf("%3d\t0x%08x\n",
+ mapping[i].hw_ptype, mapping[i].sw_ptype);
+ }
+}
+
+static cmdline_parse_inst_t cmd_ptype_mapping_get = {
+ .f = cmd_ptype_mapping_get_parsed,
+ .data = NULL,
+ .help_str = "ptype mapping get <port_id> <valid_only>",
+ .tokens = {
+ (void *)&cmd_ptype_mapping_get_ptype,
+ (void *)&cmd_ptype_mapping_get_mapping,
+ (void *)&cmd_ptype_mapping_get_get,
+ (void *)&cmd_ptype_mapping_get_port_id,
+ (void *)&cmd_ptype_mapping_get_valid_only,
+ NULL,
+ },
+};
+
+/* ptype mapping replace */
+
+/* Common result structure for ptype mapping replace */
+struct cmd_ptype_mapping_replace_result {
+ cmdline_fixed_string_t ptype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t replace;
+ portid_t port_id;
+ uint32_t target;
+ uint8_t mask;
+ uint32_t pkt_type;
+};
+
+/* Common CLI fields for ptype mapping replace */
+static cmdline_parse_token_string_t cmd_ptype_mapping_replace_ptype =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ ptype, "ptype");
+static cmdline_parse_token_string_t cmd_ptype_mapping_replace_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_ptype_mapping_replace_replace =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ replace, "replace");
+static cmdline_parse_token_num_t cmd_ptype_mapping_replace_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_ptype_mapping_replace_target =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ target, RTE_UINT32);
+static cmdline_parse_token_num_t cmd_ptype_mapping_replace_mask =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ mask, RTE_UINT8);
+static cmdline_parse_token_num_t cmd_ptype_mapping_replace_pkt_type =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_replace_result,
+ pkt_type, RTE_UINT32);
+
+static void
+cmd_ptype_mapping_replace_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ptype_mapping_replace_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_ptype_mapping_replace(res->port_id,
+ res->target,
+ res->mask,
+ res->pkt_type);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid ptype 0x%8x or 0x%8x\n",
+ res->target, res->pkt_type);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_ptype_mapping_replace = {
+ .f = cmd_ptype_mapping_replace_parsed,
+ .data = NULL,
+ .help_str =
+ "ptype mapping replace <port_id> <target> <mask> <pkt_type>",
+ .tokens = {
+ (void *)&cmd_ptype_mapping_replace_ptype,
+ (void *)&cmd_ptype_mapping_replace_mapping,
+ (void *)&cmd_ptype_mapping_replace_replace,
+ (void *)&cmd_ptype_mapping_replace_port_id,
+ (void *)&cmd_ptype_mapping_replace_target,
+ (void *)&cmd_ptype_mapping_replace_mask,
+ (void *)&cmd_ptype_mapping_replace_pkt_type,
+ NULL,
+ },
+};
+
+/* ptype mapping reset */
+
+/* Common result structure for ptype mapping reset */
+struct cmd_ptype_mapping_reset_result {
+ cmdline_fixed_string_t ptype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t reset;
+ portid_t port_id;
+};
+
+/* Common CLI fields for ptype mapping reset*/
+static cmdline_parse_token_string_t cmd_ptype_mapping_reset_ptype =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_reset_result,
+ ptype, "ptype");
+static cmdline_parse_token_string_t cmd_ptype_mapping_reset_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_reset_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_ptype_mapping_reset_reset =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_reset_result,
+ reset, "reset");
+static cmdline_parse_token_num_t cmd_ptype_mapping_reset_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_reset_result,
+ port_id, RTE_UINT16);
+
+static void
+cmd_ptype_mapping_reset_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ptype_mapping_reset_result *res = parsed_result;
+ int ret = -ENOTSUP;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_pmd_i40e_ptype_mapping_reset(res->port_id);
+ switch (ret) {
+ case 0:
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_ptype_mapping_reset = {
+ .f = cmd_ptype_mapping_reset_parsed,
+ .data = NULL,
+ .help_str = "ptype mapping reset <port_id>",
+ .tokens = {
+ (void *)&cmd_ptype_mapping_reset_ptype,
+ (void *)&cmd_ptype_mapping_reset_mapping,
+ (void *)&cmd_ptype_mapping_reset_reset,
+ (void *)&cmd_ptype_mapping_reset_port_id,
+ NULL,
+ },
+};
+
+/* ptype mapping update */
+
+/* Common result structure for ptype mapping update */
+struct cmd_ptype_mapping_update_result {
+ cmdline_fixed_string_t ptype;
+ cmdline_fixed_string_t mapping;
+ cmdline_fixed_string_t reset;
+ portid_t port_id;
+ uint8_t hw_ptype;
+ uint32_t sw_ptype;
+};
+
+/* Common CLI fields for ptype mapping update*/
+static cmdline_parse_token_string_t cmd_ptype_mapping_update_ptype =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ ptype, "ptype");
+static cmdline_parse_token_string_t cmd_ptype_mapping_update_mapping =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ mapping, "mapping");
+static cmdline_parse_token_string_t cmd_ptype_mapping_update_update =
+ TOKEN_STRING_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ reset, "update");
+static cmdline_parse_token_num_t cmd_ptype_mapping_update_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_num_t cmd_ptype_mapping_update_hw_ptype =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ hw_ptype, RTE_UINT8);
+static cmdline_parse_token_num_t cmd_ptype_mapping_update_sw_ptype =
+ TOKEN_NUM_INITIALIZER(struct cmd_ptype_mapping_update_result,
+ sw_ptype, RTE_UINT32);
+
+static void
+cmd_ptype_mapping_update_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_ptype_mapping_update_result *res = parsed_result;
+ int ret = -ENOTSUP;
+ struct rte_pmd_i40e_ptype_mapping mapping;
+
+ if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+ return;
+
+ mapping.hw_ptype = res->hw_ptype;
+ mapping.sw_ptype = res->sw_ptype;
+ ret = rte_pmd_i40e_ptype_mapping_update(res->port_id,
+ &mapping,
+ 1,
+ 0);
+ switch (ret) {
+ case 0:
+ break;
+ case -EINVAL:
+ fprintf(stderr, "invalid ptype 0x%8x\n", res->sw_ptype);
+ break;
+ case -ENODEV:
+ fprintf(stderr, "invalid port_id %d\n", res->port_id);
+ break;
+ case -ENOTSUP:
+ fprintf(stderr, "function not implemented\n");
+ break;
+ default:
+ fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+ }
+}
+
+static cmdline_parse_inst_t cmd_ptype_mapping_update = {
+ .f = cmd_ptype_mapping_update_parsed,
+ .data = NULL,
+ .help_str = "ptype mapping update <port_id> <hw_ptype> <sw_ptype>",
+ .tokens = {
+ (void *)&cmd_ptype_mapping_update_ptype,
+ (void *)&cmd_ptype_mapping_update_mapping,
+ (void *)&cmd_ptype_mapping_update_update,
+ (void *)&cmd_ptype_mapping_update_port_id,
+ (void *)&cmd_ptype_mapping_update_hw_ptype,
+ (void *)&cmd_ptype_mapping_update_sw_ptype,
+ NULL,
+ },
+};
+
+static struct testpmd_driver_commands i40e_cmds = {
+ .commands = {
+ {
+ &cmd_queue_region,
+ "set port (port_id) queue-region region_id (value) "
+ "queue_start_index (value) queue_num (value)\n"
+ " Set a queue region on a port\n",
+ },
+ {
+ &cmd_region_flowtype,
+ "set port (port_id) queue-region region_id (value) "
+ "flowtype (value)\n"
+ " Set a flowtype region index on a port\n",
+ },
+ {
+ &cmd_user_priority_region,
+ "set port (port_id) queue-region UP (value) region_id (value)\n"
+ " Set the mapping of User Priority to "
+ "queue region on a port\n",
+ },
+ {
+ &cmd_flush_queue_region,
+ "set port (port_id) queue-region flush (on|off)\n"
+ " flush all queue region related configuration\n",
+ },
+ {
+ &cmd_show_queue_region_info_all,
+ "show port (port_id) queue-region\n"
+ " show all queue region related configuration info\n",
+ },
+ {
+ &cmd_add_del_raw_flow_director,
+ "flow_director_filter (port_id) mode raw (add|del|update)"
+ " flow (flow_id) (drop|fwd) queue (queue_id)"
+ " fd_id (fd_id_value) packet (packet file name)\n"
+ " Add/Del a raw type flow director filter.\n",
+ },
+ {
+ &cmd_set_vf_promisc,
+ "set vf promisc (port_id) (vf_id) (on|off)\n"
+ " Set unicast promiscuous mode for a VF from the PF.\n",
+ },
+ {
+ &cmd_set_vf_allmulti,
+ "set vf allmulti (port_id) (vf_id) (on|off)\n"
+ " Set multicast promiscuous mode for a VF from the PF.\n",
+ },
+ {
+ &cmd_set_vf_broadcast,
+ "set vf broadcast (port_id) (vf_id) (on|off)\n"
+ " Set VF broadcast for a VF from the PF.\n",
+ },
+ {
+ &cmd_set_vf_vlan_tag,
+ "set vf vlan tag (port_id) (vf_id) (on|off)\n"
+ " Set VLAN tag for a VF from the PF.\n",
+ },
+ {
+ &cmd_vf_max_bw,
+ "set vf tx max-bandwidth (port_id) (vf_id) (bandwidth)\n"
+ " Set a VF's max bandwidth(Mbps).\n",
+ },
+ {
+ &cmd_vf_tc_min_bw,
+ "set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)\n"
+ " Set all TCs' min bandwidth(%%) on a VF.\n",
+ },
+ {
+ &cmd_vf_tc_max_bw,
+ "set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (bandwidth)\n"
+ " Set a TC's max bandwidth(Mbps) on a VF.\n",
+ },
+ {
+ &cmd_strict_link_prio,
+ "set tx strict-link-priority (port_id) (tc_bitmap)\n"
+ " Set some TCs' strict link priority mode on a physical port.\n",
+ },
+ {
+ &cmd_ddp_add,
+ "ddp add (port_id) (profile_path[,backup_profile_path])\n"
+ " Load a profile package on a port\n",
+ },
+ {
+ &cmd_ddp_del,
+ "ddp del (port_id) (backup_profile_path)\n"
+ " Delete a profile package from a port\n",
+ },
+ {
+ &cmd_ddp_get_list,
+ "ddp get list (port_id)\n"
+ " Get ddp profile info list\n",
+ },
+ {
+ &cmd_ddp_get_info,
+ "ddp get info (profile_path)\n"
+ " Get ddp profile information.\n",
+ },
+ {
+ &cmd_cfg_input_set,
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset get|set|clear field\n"
+ " (field_idx)\n"
+ " Configure RSS|FDIR|FDIR_FLX input set for some pctype\n",
+ },
+ {
+ &cmd_clear_input_set,
+ "port config (port_id) pctype (pctype_id) hash_inset|"
+ "fdir_inset|fdir_flx_inset clear all\n"
+ " Clear RSS|FDIR|FDIR_FLX input set completely for some pctype\n",
+ },
+ {
+ &cmd_ptype_mapping_get,
+ "ptype mapping get (port_id) (valid_only)\n"
+ " Get ptype mapping on a port\n",
+ },
+ {
+ &cmd_ptype_mapping_replace,
+ "ptype mapping replace (port_id) (target) (mask) (pky_type)\n"
+ " Replace target with the pkt_type in ptype mapping\n",
+ },
+ {
+ &cmd_ptype_mapping_reset,
+ "ptype mapping reset (port_id)\n"
+ " Reset ptype mapping on a port\n",
+ },
+ {
+ &cmd_ptype_mapping_update,
+ "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n"
+ " Update a ptype mapping item on a port\n",
+ },
+ {
+ &cmd_pctype_mapping_get,
+ "show port (port_id) pctype mapping\n"
+ " Get flow ptype to pctype mapping on a port\n",
+ },
+ {
+ &cmd_pctype_mapping_reset,
+ "port config (port_id) pctype mapping reset\n"
+ " Reset flow type to pctype mapping on a port\n",
+ },
+ {
+ &cmd_pctype_mapping_update,
+ "port config (port_id) pctype mapping update"
+ " (pctype_id_0[,pctype_id_1]*) (flow_type_id)\n"
+ " Update a flow type to pctype mapping item on a port\n",
+ },
+ { NULL, NULL },
+ },
+};
+TESTPMD_ADD_DRIVER_COMMANDS(i40e_cmds)
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index ce5317b811..84fd42754e 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -27,6 +27,8 @@ sources = files(
'rte_pmd_i40e.c',
)
+testpmd_sources = files('i40e_testpmd.c')
+
deps += ['hash']
includes += include_directories('base')
--
2.36.1
next prev parent reply other threads:[~2022-06-17 5:07 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 7:57 [RFC PATCH 0/4] Split driver specific commands out of testpmd David Marchand
2022-05-13 7:57 ` [RFC PATCH 1/4] app/testpmd: register driver specific commands David Marchand
2022-05-13 10:30 ` David Marchand
2022-05-13 7:57 ` [RFC PATCH 2/4] net/bonding: move testpmd commands David Marchand
2022-05-13 10:09 ` Min Hu (Connor)
2022-05-18 17:24 ` David Marchand
2022-05-18 23:25 ` Konstantin Ananyev
2022-05-19 7:40 ` David Marchand
2022-05-19 11:26 ` Thomas Monjalon
2022-05-20 6:59 ` Andrew Rybchenko
2022-05-24 9:40 ` Konstantin Ananyev
2022-05-24 10:15 ` Thomas Monjalon
2022-05-24 22:41 ` Konstantin Ananyev
2022-05-13 7:57 ` [RFC PATCH 3/4] net/i40e: " David Marchand
2022-05-13 7:57 ` [RFC PATCH 4/4] net/ixgbe: " David Marchand
2022-05-18 19:46 ` [RFC PATCH v2 0/5] Split driver specific commands out of testpmd David Marchand
2022-05-18 19:46 ` [RFC PATCH v2 1/5] app/testpmd: mark cmdline symbols as static David Marchand
2022-05-20 6:28 ` Andrew Rybchenko
2022-05-18 19:46 ` [RFC PATCH v2 2/5] app/testpmd: register driver specific commands David Marchand
2022-05-20 6:55 ` Andrew Rybchenko
2022-05-18 19:46 ` [RFC PATCH v2 3/5] net/bonding: move testpmd commands David Marchand
2022-05-20 6:55 ` Andrew Rybchenko
2022-05-18 19:46 ` [RFC PATCH v2 4/5] net/i40e: " David Marchand
2022-05-18 19:46 ` [RFC PATCH v2 5/5] net/ixgbe: " David Marchand
2022-05-20 7:04 ` [RFC PATCH v2 0/5] Split driver specific commands out of testpmd Andrew Rybchenko
2022-05-23 7:10 ` [PATCH 0/6] " David Marchand
2022-05-23 7:10 ` [PATCH 1/6] app/testpmd: mark most cmdline symbols as static David Marchand
2022-05-23 10:19 ` Dumitrescu, Cristian
2022-05-23 18:09 ` Ferruh Yigit
2022-05-23 7:10 ` [PATCH 2/6] app/testpmd: register driver specific commands David Marchand
2022-05-23 18:10 ` Ferruh Yigit
2022-05-24 10:53 ` David Marchand
2022-05-24 11:43 ` Ferruh Yigit
2022-05-24 17:21 ` Thomas Monjalon
2022-05-24 17:44 ` David Marchand
2022-05-24 17:51 ` Thomas Monjalon
2022-05-23 7:10 ` [PATCH 3/6] net/bonding: move testpmd commands David Marchand
2022-05-23 18:10 ` Ferruh Yigit
2022-06-17 5:06 ` [PATCH v2] " David Marchand
2022-06-20 17:53 ` Ferruh Yigit
2022-05-23 7:10 ` [PATCH 4/6] net/i40e: " David Marchand
2022-06-17 5:07 ` David Marchand [this message]
2022-06-20 17:53 ` [PATCH v2] " Ferruh Yigit
2022-05-23 7:10 ` [PATCH 5/6] app/testpmd: drop ixgbe bypass commands David Marchand
2022-05-23 18:10 ` Ferruh Yigit
2022-06-17 5:07 ` [PATCH v2 1/3] app/testpmd: restore " David Marchand
2022-06-17 5:07 ` [PATCH v2 2/3] net/ixgbe: move testpmd commands David Marchand
2022-06-17 5:07 ` [PATCH v2 3/3] net/ixgbe: move bypass init in a testpmd command David Marchand
2022-06-20 19:04 ` Ferruh Yigit
2022-06-23 12:35 ` Zhang, Qi Z
2022-07-21 8:05 ` [PATCH v3 1/3] app/testpmd: restore ixgbe bypass commands David Marchand
2022-07-21 8:05 ` [PATCH v3 2/3] net/ixgbe: move testpmd commands David Marchand
2022-07-21 8:05 ` [PATCH v3 3/3] net/ixgbe: move bypass init in a testpmd command David Marchand
2022-08-25 10:37 ` Ferruh Yigit
2022-08-25 11:44 ` [PATCH v3 1/3] app/testpmd: restore ixgbe bypass commands Ferruh Yigit
2022-05-23 7:10 ` [PATCH 6/6] net/ixgbe: move testpmd commands David Marchand
2022-05-23 18:09 ` [PATCH 0/6] Split driver specific commands out of testpmd Ferruh Yigit
2022-05-24 20:06 ` [PATCH v2 0/2] " David Marchand
2022-05-24 20:06 ` [PATCH v2 1/2] app/testpmd: mark most cmdline symbols as static David Marchand
2022-05-31 15:15 ` Andrew Rybchenko
2022-05-24 20:06 ` [PATCH v2 2/2] app/testpmd: register driver specific commands David Marchand
2022-05-24 20:28 ` Thomas Monjalon
2022-05-31 15:14 ` Andrew Rybchenko
2022-05-31 15:18 ` David Marchand
2022-05-31 15:18 ` [PATCH v2 0/2] Split driver specific commands out of testpmd Andrew Rybchenko
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=20220617050726.1273231-1-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=aman.deep.singh@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=xiaoyun.li@intel.com \
--cc=yuying.zhang@intel.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).