From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87E63A0519; Fri, 3 Jul 2020 07:54:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CD111D983; Fri, 3 Jul 2020 07:54:09 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 726B41D969 for ; Fri, 3 Jul 2020 07:54:06 +0200 (CEST) IronPort-SDR: sRhSfx0s9aqlCpvQS1wVIfZIgy99mc4MJbetcFkzlC9CKRlOmWLhuLJnxNyiM+dnSzhiGiFzUF otUjXr2m+TEg== X-IronPort-AV: E=McAfee;i="6000,8403,9670"; a="212119769" X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="212119769" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 22:54:05 -0700 IronPort-SDR: vfu+iEvseamlmIiHWvq6X0mpEGVB7EYCvQbtKNmphT4EyCds6nKFIzqY1b0CLOexJrlC9D1WaO mOoNuEID10YA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,307,1589266800"; d="scan'208";a="278332617" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.176]) ([10.67.68.176]) by orsmga003.jf.intel.com with ESMTP; 02 Jul 2020 22:54:04 -0700 To: Chenxu Di , dev@dpdk.org Cc: Yang Qiming References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> <20200701082451.34511-4-chenxux.di@intel.com> From: Jeff Guo Message-ID: <635577a2-361a-987d-a6fa-17ef0790ad52@intel.com> Date: Fri, 3 Jul 2020 13:54:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200701082451.34511-4-chenxux.di@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v3 3/5] app/testpmd: re-implement commands by using private API 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" hi, chenxu Please use --in-relpy-to  next time to help reviewers check all relevant comments, and some minor comment, after fix it you could bring my ACK in the coming version, thanks. On 7/1/2020 4:24 PM, Chenxu Di wrote: > The legacy filter API will be superseded. This patch use > private api to change the implementation of commands > global_config gre-key-len and > show port fdir > > Signed-off-by: Chenxu Di > --- > app/test-pmd/cmdline.c | 6 ++++ > app/test-pmd/config.c | 65 +++++++++++++++++++++++++++++++++++------- > 2 files changed, 61 insertions(+), 10 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 996a49876..466c54aa9 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -9287,6 +9287,12 @@ cmd_global_config_parsed(void *parsed_result, > conf.cfg.gre_key_len = res->len; > ret = rte_eth_dev_filter_ctrl(res->port_id, RTE_ETH_FILTER_NONE, > RTE_ETH_FILTER_SET, &conf); > + This blank line is no need. > +#ifdef RTE_LIBRTE_I40E_PMD > + if (ret == -ENOTSUP) > + ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res->len); > +#endif > + This blank line is also no need, since if the above macro is no defined, there will be two blank lines here. > if (ret != 0) > printf("Global config error\n"); > } > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index a7112c998..ed341c715 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -3727,6 +3727,50 @@ print_fdir_flow_type(uint32_t flow_types_mask) > printf("\n"); > } > > +static int > +get_fdir_info(portid_t port_id, struct rte_eth_fdir_info *fdir_info) > +{ > + int ret; > + > + ret = rte_eth_dev_filter_supported(port_id, > + RTE_ETH_FILTER_FDIR); > + if (!ret) > + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, > + RTE_ETH_FILTER_INFO, fdir_info); > + > +#ifdef RTE_LIBRTE_I40E_PMD > + if (ret == -ENOTSUP) > + ret = rte_pmd_i40e_get_fdir_info(port_id, fdir_info); > +#endif > +#ifdef RTE_LIBRTE_IXGBE_PMD > + if (ret == -ENOTSUP) > + ret = rte_pmd_ixgbe_get_fdir_info(port_id, fdir_info); > +#endif > + return ret; > +} > + > +static int > +get_fdir_stat(portid_t port_id, struct rte_eth_fdir_stats *fdir_stat) > +{ > + int ret; > + > + ret = rte_eth_dev_filter_supported(port_id, > + RTE_ETH_FILTER_FDIR); > + if (!ret) > + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, > + RTE_ETH_FILTER_STATS, fdir_stat); > + > +#ifdef RTE_LIBRTE_I40E_PMD > + if (ret == -ENOTSUP) > + ret = rte_pmd_i40e_get_fdir_stats(port_id, fdir_stat); > +#endif > +#ifdef RTE_LIBRTE_IXGBE_PMD > + if (ret == -ENOTSUP) > + ret = rte_pmd_ixgbe_get_fdir_stats(port_id, fdir_stat); > +#endif > + return ret; > +} > + > void > fdir_get_infos(portid_t port_id) > { > @@ -3738,19 +3782,20 @@ fdir_get_infos(portid_t port_id) > > if (port_id_is_invalid(port_id, ENABLED_WARN)) > return; > - ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_FDIR); > - if (ret < 0) { > - printf("\n FDIR is not supported on port %-2d\n", > - port_id); > - return; > - } > > memset(&fdir_info, 0, sizeof(fdir_info)); > - rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, > - RTE_ETH_FILTER_INFO, &fdir_info); > + ret = get_fdir_info(port_id, &fdir_info); > + if (ret) { > + printf("Get fdir infos error: (%s)\n", strerror(-ret)); > + return; > + } > memset(&fdir_stat, 0, sizeof(fdir_stat)); > - rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, > - RTE_ETH_FILTER_STATS, &fdir_stat); > + ret = get_fdir_stat(port_id, &fdir_stat); > + if (ret) { > + printf("Get fdir status error: (%s)\n", strerror(-ret)); > + return; > + } > + > printf("\n %s FDIR infos for port %-2d %s\n", > fdir_stats_border, port_id, fdir_stats_border); > printf(" MODE: ");