From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 462A36936 for ; Thu, 18 Aug 2016 15:48:56 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 18 Aug 2016 06:48:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,539,1464678000"; d="scan'208";a="867603399" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 18 Aug 2016 06:48:54 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u7IDmrYL004105; Thu, 18 Aug 2016 14:48:53 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u7IDmrWX026617; Thu, 18 Aug 2016 14:48:53 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u7IDmrN1026613; Thu, 18 Aug 2016 14:48:53 +0100 From: Bernard Iremonger To: rahul.r.shah@intel.com, wenzhuo.lu@intel.com, dev@dpdk.org Cc: Bernard Iremonger Date: Thu, 18 Aug 2016 14:48:45 +0100 Message-Id: <1471528125-26357-6-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1471528125-26357-1-git-send-email-bernard.iremonger@intel.com> References: <1471528125-26357-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [RFC PATCH 5/5] app/test_pmd: add tests for new API's X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 13:48:58 -0000 add test for vf vlan anti spoof add test for vf mac anti spoof add test for vf ping add test for vf vlan strip add test for vf vlan insert add test for tx loopback add test for all queues drop enable bit add test for vf split drop enable bit add test for vf mac address add new API's to the testpmd guide Signed-off-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 700 ++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 68 ++- 2 files changed, 766 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f90befc..12e89c3 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -10585,6 +10585,697 @@ cmdline_parse_inst_t cmd_config_e_tag_filter_del = { }, }; +/* vf vlan anti spoof configuration */ + +/* Common result structure for vf vlan anti spoof */ +struct cmd_vf_vlan_anti_spoof_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t vlan; + cmdline_fixed_string_t antispoof; + uint8_t port_id; + uint32_t vf_id; + uint8_t on; +}; + +/* Common CLI fields for vf vlan anti spoof enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_vlan = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + vlan, "vlan"); +cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_antispoof = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + antispoof, "antispoof"); +cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_vlan_anti_spoof_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + vf_id, UINT32); +cmdline_parse_token_string_t cmd_vf_vlan_anti_spoof_on = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_anti_spoof_result, + on, UINT8); + +static void +cmd_set_vf_vlan_anti_spoof_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_vlan_anti_spoof_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + ret = rte_eth_dev_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, res->on); + if (ret < 0) + printf("vf vlan anti spoofing programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_vlan_anti_spoof = { + .f = cmd_set_vf_vlan_anti_spoof_parsed, + .data = NULL, + .help_str = "enable/disable vf vlan anti spoof", + .tokens = { + (void *)&cmd_vf_vlan_anti_spoof_set, + (void *)&cmd_vf_vlan_anti_spoof_vf, + (void *)&cmd_vf_vlan_anti_spoof_vlan, + (void *)&cmd_vf_vlan_anti_spoof_antispoof, + (void *)&cmd_vf_vlan_anti_spoof_port_id, + (void *)&cmd_vf_vlan_anti_spoof_vf_id, + (void *)&cmd_vf_vlan_anti_spoof_on, + NULL, + }, +}; + +/* vf mac anti spoof configuration */ + +/* Common result structure for vf mac anti spoof */ +struct cmd_vf_mac_anti_spoof_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t mac; + cmdline_fixed_string_t antispoof; + uint8_t port_id; + uint32_t vf_id; + uint8_t on; +}; + +/* Common CLI fields for vf mac anti spoof enable disable */ +cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_mac = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + mac, "mac"); +cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_antispoof = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + antispoof, "antispoof"); +cmdline_parse_token_num_t cmd_vf_mac_anti_spoof_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_mac_anti_spoof_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + vf_id, UINT32); +cmdline_parse_token_string_t cmd_vf_mac_anti_spoof_on = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_mac_anti_spoof_result, + on, UINT8); + +static void +cmd_set_vf_mac_anti_spoof_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_mac_anti_spoof_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_set_vf_mac_anti_spoof(res->port_id, res->vf_id, res->on); + if (ret < 0) + printf("vf vlan mac spoofing programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_mac_anti_spoof = { + .f = cmd_set_vf_mac_anti_spoof_parsed, + .data = NULL, + .help_str = "enable/disable vf mac anti spoof", + .tokens = { + (void *)&cmd_vf_mac_anti_spoof_set, + (void *)&cmd_vf_mac_anti_spoof_vf, + (void *)&cmd_vf_mac_anti_spoof_mac, + (void *)&cmd_vf_mac_anti_spoof_antispoof, + (void *)&cmd_vf_mac_anti_spoof_port_id, + (void *)&cmd_vf_mac_anti_spoof_vf_id, + (void *)&cmd_vf_mac_anti_spoof_on, + NULL, + }, +}; + +/* vf ping configuration */ + +/* Common result structure for vf ping */ +struct cmd_vf_ping_result { + cmdline_fixed_string_t vf; + cmdline_fixed_string_t ping; + uint8_t port_id; + int32_t vf_id; +}; + +/* Common CLI fields for ping vfs */ +cmdline_parse_token_string_t cmd_vf_ping_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_ping_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_ping_ping = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_ping_result, + ping, "ping"); +cmdline_parse_token_num_t cmd_vf_ping_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_ping_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_ping_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_ping_result, + vf_id, INT32); + +static void +cmd_vf_ping_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_ping_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_vf_ping(res->port_id, res->vf_id); + if (ret < 0) + printf("ping vfs programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_vf_ping = { + .f = cmd_vf_ping_parsed, + .data = NULL, + .help_str = "ping all or specified vf", + .tokens = { + (void *)&cmd_vf_ping_vf, + (void *)&cmd_vf_ping_ping, + (void *)&cmd_vf_ping_port_id, + (void *)&cmd_vf_ping_vf_id, + NULL, + }, +}; + +/* vf vlan strip configuration */ + +/* Common result structure for vf mac anti spoof */ +struct cmd_vf_vlan_strip_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t vlan; + cmdline_fixed_string_t strip; + uint8_t port_id; + uint16_t vf_id; + uint8_t on; +}; + +/* Common CLI fields for vf vlan strip enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_strip_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_strip_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_vlan_strip_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_strip_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_vlan_strip_vlan = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_strip_result, + vlan, "vlan"); +cmdline_parse_token_string_t cmd_vf_vlan_strip_strip = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_strip_result, + strip, "strip"); +cmdline_parse_token_num_t cmd_vf_vlan_strip_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_strip_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_vlan_strip_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_strip_result, + vf_id, UINT16); +cmdline_parse_token_string_t cmd_vf_vlan_strip_on = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_strip_result, + on, UINT8); + +static void +cmd_set_vf_vlan_strip_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_vlan_strip_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_set_vf_vlan_strip(res->port_id, res->vf_id, res->on); + if (ret < 0) + printf("vf vlan strip programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_vlan_strip = { + .f = cmd_set_vf_vlan_strip_parsed, + .data = NULL, + .help_str = "enable/disable vf vlan strip", + .tokens = { + (void *)&cmd_vf_vlan_strip_set, + (void *)&cmd_vf_vlan_strip_vf, + (void *)&cmd_vf_vlan_strip_vlan, + (void *)&cmd_vf_vlan_strip_strip, + (void *)&cmd_vf_vlan_strip_port_id, + (void *)&cmd_vf_vlan_strip_vf_id, + (void *)&cmd_vf_vlan_strip_on, + NULL, + }, +}; + +/* vf vlan insert configuration */ + +/* Common result structure for vf vlan insert */ +struct cmd_vf_vlan_insert_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t vlan; + cmdline_fixed_string_t insert; + uint8_t port_id; + uint16_t vf_id; + uint8_t on; +}; + +/* Common CLI fields for vf vlan insert enable disable */ +cmdline_parse_token_string_t cmd_vf_vlan_insert_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_insert_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_vlan_insert_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_insert_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_vlan_insert_vlan = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_insert_result, + vlan, "vlan"); +cmdline_parse_token_string_t cmd_vf_vlan_insert_insert = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_vlan_insert_result, + insert, "insert"); +cmdline_parse_token_num_t cmd_vf_vlan_insert_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_insert_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_vlan_insert_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_insert_result, + vf_id, UINT16); +cmdline_parse_token_string_t cmd_vf_vlan_insert_on = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_vlan_insert_result, + on, UINT8); + +static void +cmd_set_vf_vlan_insert_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_vlan_insert_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_set_vf_vlan_insert(res->port_id, res->vf_id, res->on); + if (ret < 0) + printf("vf vlan insert programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_vlan_insert = { + .f = cmd_set_vf_vlan_insert_parsed, + .data = NULL, + .help_str = "enable/disable vf vlan insert", + .tokens = { + (void *)&cmd_vf_vlan_insert_set, + (void *)&cmd_vf_vlan_insert_vf, + (void *)&cmd_vf_vlan_insert_vlan, + (void *)&cmd_vf_vlan_insert_insert, + (void *)&cmd_vf_vlan_insert_port_id, + (void *)&cmd_vf_vlan_insert_vf_id, + (void *)&cmd_vf_vlan_insert_on, + NULL, + }, +}; + +/* tx loopback configuration */ + +/* Common result structure for tx loopback */ +struct cmd_tx_loopback_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t tx; + cmdline_fixed_string_t loopback; + uint8_t port_id; + uint8_t on; +}; + +/* Common CLI fields for tx loopback enable disable */ +cmdline_parse_token_string_t cmd_tx_loopback_set = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_loopback_result, + set, "set"); +cmdline_parse_token_string_t cmd_tx_loopback_tx = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_loopback_result, + tx, "tx"); +cmdline_parse_token_string_t cmd_tx_loopback_loopback = + TOKEN_STRING_INITIALIZER + (struct cmd_tx_loopback_result, + loopback, "loopback"); +cmdline_parse_token_num_t cmd_tx_loopback_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_loopback_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_tx_loopback_on = + TOKEN_NUM_INITIALIZER + (struct cmd_tx_loopback_result, + on, UINT8); + +static void +cmd_set_tx_loopback_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_tx_loopback_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + ret = rte_eth_dev_set_tx_loopback(res->port_id, res->on); + if (ret < 0) + printf("tx loopback programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_tx_loopback = { + .f = cmd_set_tx_loopback_parsed, + .data = NULL, + .help_str = "enable/disable vf vlan insert", + .tokens = { + (void *)&cmd_tx_loopback_set, + (void *)&cmd_tx_loopback_tx, + (void *)&cmd_tx_loopback_loopback, + (void *)&cmd_tx_loopback_port_id, + (void *)&cmd_tx_loopback_on, + NULL, + }, +}; + +/* all queues drop enable configuration */ + +/* Common result structure for all queues drop enable */ +struct cmd_all_queues_drop_en_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t all; + cmdline_fixed_string_t queues; + cmdline_fixed_string_t drop; + uint8_t port_id; + uint8_t on; +}; + +/* Common CLI fields for tx loopback enable disable */ +cmdline_parse_token_string_t cmd_all_queues_drop_en_set = + TOKEN_STRING_INITIALIZER + (struct cmd_all_queues_drop_en_result, + set, "set"); +cmdline_parse_token_string_t cmd_all_queues_drop_en_all = + TOKEN_STRING_INITIALIZER + (struct cmd_all_queues_drop_en_result, + all, "all"); +cmdline_parse_token_string_t cmd_all_queues_drop_en_queues = + TOKEN_STRING_INITIALIZER + (struct cmd_all_queues_drop_en_result, + queues, "queues"); +cmdline_parse_token_string_t cmd_all_queues_drop_en_drop = + TOKEN_STRING_INITIALIZER + (struct cmd_all_queues_drop_en_result, + drop, "drop"); +cmdline_parse_token_num_t cmd_all_queues_drop_en_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_all_queues_drop_en_result, + port_id, UINT8); +cmdline_parse_token_string_t cmd_all_queues_drop_en_on = + TOKEN_NUM_INITIALIZER + (struct cmd_all_queues_drop_en_result, + on, UINT8); + +static void +cmd_set_all_queues_drop_en_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_all_queues_drop_en_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + ret = rte_eth_dev_set_all_queues_drop_en(res->port_id, res->on); + if (ret < 0) + printf("all queues drop enable programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_all_queues_drop_en = { + .f = cmd_set_all_queues_drop_en_parsed, + .data = NULL, + .help_str = "enable/disable all queues drop enable bits", + .tokens = { + (void *)&cmd_all_queues_drop_en_set, + (void *)&cmd_all_queues_drop_en_all, + (void *)&cmd_all_queues_drop_en_queues, + (void *)&cmd_all_queues_drop_en_drop, + (void *)&cmd_all_queues_drop_en_port_id, + (void *)&cmd_all_queues_drop_en_on, + NULL, + }, +}; + +/* vf split drop enable configuration */ + +/* Common result structure for vf split drop enable */ +struct cmd_vf_split_drop_en_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t split; + cmdline_fixed_string_t drop; + uint8_t port_id; + uint16_t vf_id; + uint8_t on; +}; + +/* Common CLI fields for vf split drop enable disable */ +cmdline_parse_token_string_t cmd_vf_split_drop_en_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_split_drop_en_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_split_drop_en_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_split_drop_en_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_split_drop_en_split = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_split_drop_en_result, + split, "split"); +cmdline_parse_token_string_t cmd_vf_split_drop_en_drop = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_split_drop_en_result, + drop, "drop"); +cmdline_parse_token_num_t cmd_vf_split_drop_en_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_split_drop_en_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_split_drop_en_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_split_drop_en_result, + vf_id, UINT16); +cmdline_parse_token_string_t cmd_vf_split_drop_en_on = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_split_drop_en_result, + on, UINT8); + +static void +cmd_set_vf_split_drop_en_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_split_drop_en_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_set_vf_split_drop_en(res->port_id, res->vf_id, res->on); + if (ret < 0) + printf("vf split drop enable programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_split_drop_en = { + .f = cmd_set_vf_split_drop_en_parsed, + .data = NULL, + .help_str = "enable/disable vf split drop enable", + .tokens = { + (void *)&cmd_vf_split_drop_en_set, + (void *)&cmd_vf_split_drop_en_vf, + (void *)&cmd_vf_split_drop_en_split, + (void *)&cmd_vf_split_drop_en_drop, + (void *)&cmd_vf_split_drop_en_port_id, + (void *)&cmd_vf_split_drop_en_vf_id, + (void *)&cmd_vf_split_drop_en_on, + NULL, + }, +}; + +/* vf mac address configuration */ + +/* Common result structure for vf mac address */ +struct cmd_set_vf_mac_addr_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t mac; + cmdline_fixed_string_t addr; + uint8_t port_id; + uint16_t vf_id; + struct ether_addr mac_addr; + +}; + +/* Common CLI fields for vf split drop enable disable */ +cmdline_parse_token_string_t cmd_set_vf_mac_addr_set = + TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + set, "set"); +cmdline_parse_token_string_t cmd_set_vf_mac_addr_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_set_vf_mac_addr_mac = + TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + mac, "mac"); +cmdline_parse_token_string_t cmd_set_vf_mac_addr_addr = + TOKEN_STRING_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + addr, "addr"); +cmdline_parse_token_num_t cmd_set_vf_mac_addr_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_set_vf_mac_addr_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_set_vf_mac_addr_result, + vf_id, UINT16); +cmdline_parse_token_etheraddr_t cmd_set_vf_mac_addr_mac_addr = + TOKEN_ETHERADDR_INITIALIZER(struct cmd_set_vf_mac_addr_result, + mac_addr); + +static void +cmd_set_vf_mac_addr_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_set_vf_mac_addr_result *res = parsed_result; + int ret = 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + if (res->vf_id > 63) { + printf("vf_id must be less than 64.\n"); + return; + } + + ret = rte_eth_dev_set_vf_mac_addr(res->port_id, res->vf_id, &res->mac_addr); + if (ret < 0) + printf("set vf mac addr programming error: (%s)\n", + strerror(-ret)); +} + +cmdline_parse_inst_t cmd_set_vf_mac_addr = { + .f = cmd_set_vf_mac_addr_parsed, + .data = NULL, + .help_str = "set vf mac address", + .tokens = { + (void *)&cmd_set_vf_mac_addr_set, + (void *)&cmd_set_vf_mac_addr_vf, + (void *)&cmd_set_vf_mac_addr_mac, + (void *)&cmd_set_vf_mac_addr_addr, + (void *)&cmd_set_vf_mac_addr_port_id, + (void *)&cmd_set_vf_mac_addr_vf_id, + (void *)&cmd_set_vf_mac_addr_mac_addr, + NULL, + }, +}; + /* ******************************************************************************** */ /* list of instructions */ @@ -10739,6 +11430,15 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_config_e_tag_forwarding_en_dis, (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_add, (cmdline_parse_inst_t *)&cmd_config_e_tag_filter_del, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_anti_spoof, + (cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof, + (cmdline_parse_inst_t *)&cmd_vf_ping, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_strip, + (cmdline_parse_inst_t *)&cmd_set_vf_vlan_insert, + (cmdline_parse_inst_t *)&cmd_set_tx_loopback, + (cmdline_parse_inst_t *)&cmd_set_all_queues_drop_en, + (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, + (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, NULL, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index f87e0c2..c26d901 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -473,6 +473,41 @@ For example, to change the port forwarding: RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02 +set tx loopback +~~~~~~~~~~~~~~~ + +Enable/disable tx loopback:: + + testpmd> set tx loopback (port_id) (on|off) + +set drop enable +~~~~~~~~~~~~~~~ + +set drop enable bit for all queues:: + + testpmd> set all queues drop (port_id) (on|off) + +set split drop enable (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +set split drop enable bit for VF from PF:: + + testpmd> set vf split drop (port_id) (vf_id) (on|off) + +set mac antispoof (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set mac antispoof for a VF from the PF:: + + testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) + +ping VF +~~~~~~~ + +Ping VF or all VF's from PF:: + + testpmd> vf ping (port_id) (vf_id | -1) + vlan set strip ~~~~~~~~~~~~~~ @@ -487,6 +522,28 @@ Set the VLAN strip for a queue on a port:: testpmd> vlan set stripq (on|off) (port_id,queue_id) +vlan set strip (for VF) +~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN strip for a VF from the PF:: + + testpmd> set vf vlan strip (port_id) (vf_id) (on|off) + +vlan set insert (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN insert for a VF from the PF:: + + testpmd> set vf vlan insert (port_id) (vf_id) (on|off) + +vlan set antispoof (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set VLAN antispoof for a VF from the PF:: + + testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off) + + vlan set filter ~~~~~~~~~~~~~~~ @@ -727,13 +784,20 @@ Remove a MAC address from a port:: testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX) -mac_addr add(for VF) -~~~~~~~~~~~~~~~~~~~~ +mac_addr add (for VF) +~~~~~~~~~~~~~~~~~~~~~ Add an alternative MAC address for a VF to a port:: testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX) +mac_addr set (for VF) +~~~~~~~~~~~~~~~~~~~~~ + +Set the MAC address for a VF from the PF:: + + testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX) + set port-uta ~~~~~~~~~~~~ -- 2.9.0