From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CA61D2C60 for ; Wed, 7 Dec 2016 04:32:41 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 06 Dec 2016 19:32:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,310,1477983600"; d="scan'208";a="909513347" Received: from dpdk26.sh.intel.com ([10.239.128.228]) by orsmga003.jf.intel.com with ESMTP; 06 Dec 2016 19:32:39 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Wed, 7 Dec 2016 11:32:05 +0800 Message-Id: <1481081535-37448-23-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1481081535-37448-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v2 22/32] app/testpmd: use multicast promiscuous mode on i40e X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2016 03:32:42 -0000 Add testpmd CLI to set VF multicast promiscuous mode on i40e. Signed-off-by: Wenzhuo Lu --- app/test-pmd/cmdline.c | 86 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++ 2 files changed, 94 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d39712e..7e7a016 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -407,6 +407,9 @@ static void cmd_help_long_parsed(void *parsed_result, #ifdef RTE_LIBRTE_I40E_PMD "set vf unicast-promisc (port_id) (vf_id) (on|off)\n" " Set unicast promiscuous mode for a VF from the PF.\n\n" + + "set vf multicast-promisc (port_id) (vf_id) (on|off)\n" + " Set multicast promiscuous mode for a VF from the PF.\n\n" #endif "set flow_ctrl rx (on|off) tx (on|off) (high_water)" @@ -11576,6 +11579,88 @@ struct cmd_vf_unicast_promisc_result { NULL, }, }; + +/* VF multicast promiscuous mode configuration */ + +/* Common result structure for VF multicast promiscuous mode */ +struct cmd_vf_multicast_promisc_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t vf; + cmdline_fixed_string_t multicast_promisc; + uint8_t port_id; + uint32_t vf_id; + cmdline_fixed_string_t on_off; +}; + +/* Common CLI fields for VF multicast promiscuous mode enable disable */ +cmdline_parse_token_string_t cmd_vf_multicast_promisc_set = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + set, "set"); +cmdline_parse_token_string_t cmd_vf_multicast_promisc_vf = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + vf, "vf"); +cmdline_parse_token_string_t cmd_vf_multicast_promisc_multicast_promisc = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + multicast_promisc, "multicast-promisc"); +cmdline_parse_token_num_t cmd_vf_multicast_promisc_port_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + port_id, UINT8); +cmdline_parse_token_num_t cmd_vf_multicast_promisc_vf_id = + TOKEN_NUM_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + vf_id, UINT32); +cmdline_parse_token_string_t cmd_vf_multicast_promisc_on_off = + TOKEN_STRING_INITIALIZER + (struct cmd_vf_multicast_promisc_result, + on_off, "on#off"); + +static void +cmd_set_vf_multicast_promisc_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_vf_multicast_promisc_result *res = parsed_result; + int ret = 0; + int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + + ret = rte_pmd_i40e_set_vf_multicast_promisc(res->port_id, + res->vf_id, is_on); + switch (ret) { + case 0: + break; + case -EINVAL: + printf("invalid vf_id %d\n", res->vf_id); + break; + case -ENODEV: + printf("invalid port_id %d\n", res->port_id); + break; + default: + printf("programming error: (%s)\n", strerror(-ret)); + } +} + +cmdline_parse_inst_t cmd_set_vf_multicast_promisc = { + .f = cmd_set_vf_multicast_promisc_parsed, + .data = NULL, + .help_str = "set vf multicast promiscuous port_id vf_id on|off", + .tokens = { + (void *)&cmd_vf_multicast_promisc_set, + (void *)&cmd_vf_multicast_promisc_vf, + (void *)&cmd_vf_multicast_promisc_multicast_promisc, + (void *)&cmd_vf_multicast_promisc_port_id, + (void *)&cmd_vf_multicast_promisc_vf_id, + (void *)&cmd_vf_multicast_promisc_on_off, + NULL, + }, +}; #endif /* ******************************************************************************** */ @@ -11746,6 +11831,7 @@ struct cmd_vf_unicast_promisc_result { #endif #ifdef RTE_LIBRTE_I40E_PMD (cmdline_parse_inst_t *)&cmd_set_vf_unicast_promisc, + (cmdline_parse_inst_t *)&cmd_set_vf_multicast_promisc, #endif NULL, }; diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index e17e3d5..e1545b7 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -828,6 +828,14 @@ In promiscuous mode packets are not dropped if they aren't for the specified MAC testpmd> set vf unicast-promisc (port_id) (vf_id) (on|off) +set multicast promisc (for VF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Set the multicast promiscuous mode for a VF from PF. +In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: + + testpmd> set vf multicast-promisc (port_id) (vf_id) (on|off) + set flow_ctrl rx ~~~~~~~~~~~~~~~~ -- 1.9.3