From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 408E2A0093; Fri, 17 Jun 2022 07:07:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22DDD410FC; Fri, 17 Jun 2022 07:07:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 34AFD40689 for ; Fri, 17 Jun 2022 07:07:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655442456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ytLboxETkGAYazqbbwCPTLA9tMCyWH14nDwEcsoi+aU=; b=Lw/+HDU5Ok3pUbmh51gTF69Q7qpL5bGwhoEwPoMqlKBcPcAjmhodD7RxRw5MbJtjUj+I9o 4dx0648dc90E0t6VwPwj/JFMbAj05KobhVYdQMCvB9uUgN1Xc6yLN46kxTaHFQyGE01eFL lSljzXdNgR196wbFWqvg8LXXZJosrxc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-TGPyVp0zNOuAEED6pdPWyA-1; Fri, 17 Jun 2022 01:07:32 -0400 X-MC-Unique: TGPyVp0zNOuAEED6pdPWyA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8657980B70E; Fri, 17 Jun 2022 05:07:32 +0000 (UTC) Received: from fchome.redhat.com (unknown [10.40.193.132]) by smtp.corp.redhat.com (Postfix) with ESMTP id F06CD10725; Fri, 17 Jun 2022 05:07:29 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Xiaoyun Li , Aman Singh , Yuying Zhang , Beilei Xing Subject: [PATCH v2] net/i40e: move testpmd commands Date: Fri, 17 Jun 2022 07:07:26 +0200 Message-Id: <20220617050726.1273231-1-david.marchand@redhat.com> In-Reply-To: <20220523071031.1868862-5-david.marchand@redhat.com> References: <20220523071031.1868862-5-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Move related specific testpmd commands into this driver directory. While at it, fix checkpatch warnings. Signed-off-by: David Marchand --- 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 queue-region region_id " - "queue_start_index queue_num : 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 queue-region region_id " - "flowtype : 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 queue-region UP " - "region_id : 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 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 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 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 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 on|off", + .help_str = "set tc tx min-bandwidth ", .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 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 ", - .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 " - " ", - .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 ", - .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 " - " ", - .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 udp-src" - " udp-dst ip-src ip-dst " - " eth-src 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 udp-src" - " udp-dst ip-tos ip-ttl " - " ip-src ip-dst eth-src " - " 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 " - " udp-src udp-dst ip-src ip-dst" - " vlan-tci eth-src 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 tni ip-src" - " ip-dst eth-src " - " 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 tni " - " ip-src ip-dst vlan-tci " - " eth-src 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-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 eth-src 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