From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4E7C6FADC for ; Mon, 16 Jan 2017 06:52:20 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 15 Jan 2017 21:52:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,237,1477983600"; d="scan'208";a="31011522" Received: from dpdk26.sh.intel.com ([10.239.128.228]) by orsmga002.jf.intel.com with ESMTP; 15 Jan 2017 21:52:19 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Bernard Iremonger Date: Mon, 16 Jan 2017 13:51:48 +0800 Message-Id: <1484545911-40432-24-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1484545911-40432-1-git-send-email-wenzhuo.lu@intel.com> References: <1480637533-37425-1-git-send-email-wenzhuo.lu@intel.com> <1484545911-40432-1-git-send-email-wenzhuo.lu@intel.com> Subject: [dpdk-dev] [PATCH v10 23/26] app/testpmd: handle i40e in VF VLAN filter command 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: Mon, 16 Jan 2017 05:52:21 -0000 From: Bernard Iremonger modify set_vf_rx_vlan function to handle the i40e PMD. Signed-off-by: Bernard Iremonger --- app/test-pmd/cmdline.c | 38 +++++++++++++++++++++++++++++++------- app/test-pmd/config.c | 13 ------------- app/test-pmd/testpmd.h | 2 -- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1500170..22fcbcb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6863,7 +6863,6 @@ static void cmd_vf_mac_addr_parsed(void *parsed_result, }, }; -#ifdef RTE_LIBRTE_IXGBE_PMD /* *** ADD/REMOVE A VLAN IDENTIFIER TO/FROM A PORT VLAN RX FILTER *** */ struct cmd_vf_rx_vlan_filter { cmdline_fixed_string_t rx_vlan; @@ -6881,11 +6880,37 @@ struct cmd_vf_rx_vlan_filter { __attribute__((unused)) void *data) { struct cmd_vf_rx_vlan_filter *res = parsed_result; + int ret = -ENOTSUP; - if (!strcmp(res->what, "add")) - set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 1); - else - set_vf_rx_vlan(res->port_id, res->vlan_id,res->vf_mask, 0); + __rte_unused int is_add = (strcmp(res->what, "add") == 0) ? 1 : 0; + +#ifdef RTE_LIBRTE_IXGBE_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_ixgbe_set_vf_vlan_filter(res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_set_vf_vlan_filter(res->port_id, + res->vlan_id, res->vf_mask, is_add); +#endif + + switch (ret) { + case 0: + break; + case -EINVAL: + printf("invalid vlan_id %d or vf_mask %"PRIu64"\n", + res->vlan_id, res->vf_mask); + break; + case -ENODEV: + printf("invalid port_id %d\n", res->port_id); + break; + case -ENOTSUP: + printf("function not implemented or supported\n"); + break; + default: + printf("programming error: (%s)\n", strerror(-ret)); + } } cmdline_parse_token_string_t cmd_vf_rx_vlan_filter_rx_vlan = @@ -6926,7 +6951,6 @@ struct cmd_vf_rx_vlan_filter { NULL, }, }; -#endif /* *** SET RATE LIMIT FOR A QUEUE OF A PORT *** */ struct cmd_queue_rate_limit_result { @@ -12109,9 +12133,9 @@ struct cmd_set_vf_vlan_tag_result { (cmdline_parse_inst_t *)&cmd_set_vf_split_drop_en, (cmdline_parse_inst_t *)&cmd_set_vf_rxmode, (cmdline_parse_inst_t *)&cmd_set_vf_traffic, - (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_vf_rate_limit, #endif + (cmdline_parse_inst_t *)&cmd_vf_rxvlan_filter, (cmdline_parse_inst_t *)&cmd_set_vf_mac_addr, (cmdline_parse_inst_t *)&cmd_set_vf_promisc, (cmdline_parse_inst_t *)&cmd_set_vf_allmulti, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 11a930d..5834498 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2846,19 +2846,6 @@ struct igb_ring_desc_16_bytes { "diag=%d\n", port_id, diag); } - -void -set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, uint64_t vf_mask, uint8_t on) -{ - int diag; - - diag = rte_pmd_ixgbe_set_vf_vlan_filter(port_id, vlan_id, vf_mask, on); - - if (diag == 0) - return; - printf("rte_pmd_ixgbe_set_vf_vlan_filter for port_id=%d failed " - "diag=%d\n", port_id, diag); -} #endif int diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 22ce2d6..87153d7 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -598,8 +598,6 @@ void port_rss_reta_info(portid_t port_id, uint16_t nb_entries); void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on); -void set_vf_rx_vlan(portid_t port_id, uint16_t vlan_id, - uint64_t vf_mask, uint8_t on); int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate); int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, -- 1.9.3