From: "Yang, Qiming" <qiming.yang@intel.com>
To: "Di, ChenxuX" <chenxux.di@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Xing, Beilei" <beilei.xing@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/5] app/testpmd: re-implement commands by using private API
Date: Tue, 30 Jun 2020 10:34:20 +0000 [thread overview]
Message-ID: <BN6PR11MB001728289A9F65B4DE8AB43FE56F0@BN6PR11MB0017.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200615021858.13985-4-chenxux.di@intel.com>
> -----Original Message-----
> From: Di, ChenxuX <chenxux.di@intel.com>
> Sent: Monday, June 15, 2020 10:19
> To: dev@dpdk.org
> Cc: Xing, Beilei <beilei.xing@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Di, ChenxuX <chenxux.di@intel.com>
> Subject: [PATCH v2 3/5] app/testpmd: re-implement commands by using
> private API
>
> The legacy filter API will be superseded. This patch use private api to change
> the implementation of commands global_config <port_id> gre-key-len
> <key_len> and show port fdir <port_id>
>
> Signed-off-by: Chenxu Di <chenxux.di@intel.com>
> ---
> app/test-pmd/cmdline.c | 23 ++++++++----- app/test-pmd/config.c | 74
> +++++++++++++++++++++++++++++++++++-------
> 2 files changed, 78 insertions(+), 19 deletions(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 996a49876..01d793e89 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -9280,15 +9280,22 @@ cmd_global_config_parsed(void *parsed_result,
> {
> struct cmd_global_config_result *res = parsed_result;
> struct rte_eth_global_cfg conf;
> - int ret;
> + int ret = -ENOTSUP;
>
> - memset(&conf, 0, sizeof(conf));
> - conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
> - 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);
> - if (ret != 0)
> - printf("Global config error\n");
> +#ifdef RTE_LIBRTE_I40E_PMD
> + if (ret == -ENOTSUP)
> + ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res-
> >len); #endif
> + if (ret == -ENOTSUP) {
Why you double check the ret? recommend
If()
#ifdefine
...
#endif
...
And if it is needed to check ret as you set the return value as - ENOTSUP?
And it's weird to set as NOT SUPPORT, don't change the exist logical.
Below all have the same issue.
> + memset(&conf, 0, sizeof(conf));
> + conf.cfg_type = RTE_ETH_GLOBAL_CFG_TYPE_GRE_KEY_LEN;
> + 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);
> + }
> +
> + if (ret < 0)
> + printf("Global config error: (%s)\n", strerror(-ret));
> }
>
> cmdline_parse_token_string_t cmd_global_config_cmd = diff --git
> a/app/test-pmd/config.c b/app/test-pmd/config.c index
> 016bcb09c..f519246c7 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -3729,30 +3729,82 @@ 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;
> +#ifdef RTE_LIBRTE_I40E_PMD
> + 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
> + if (ret == -ENOTSUP) {
> + 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 ret;
> + }
> + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
> + RTE_ETH_FILTER_INFO, fdir_info);
> + }
> +
> + if (ret < 0)
> + printf("Get fdir infos error: (%s)\n", strerror(-ret));
> +
> + return ret;
> +}
> +
> +static int
> +get_fdir_stat(portid_t port_id, struct rte_eth_fdir_stats *fdir_stat) {
> + int ret;
> +#ifdef RTE_LIBRTE_I40E_PMD
> + 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
> + if (ret == -ENOTSUP) {
> + 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 ret;
> + }
> + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR,
> + RTE_ETH_FILTER_STATS, fdir_stat);
> + }
> +
> + if (ret < 0)
> + printf("Get fdir infos error: (%s)\n", strerror(-ret));
> +
> + return ret;
> +}
> +
> void
> fdir_get_infos(portid_t port_id)
> {
> struct rte_eth_fdir_stats fdir_stat;
> struct rte_eth_fdir_info fdir_info;
> - int ret;
>
> static const char *fdir_stats_border =
> "########################";
>
> 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);
> + if (get_fdir_info(port_id, &fdir_info))
> + 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);
> + if (get_fdir_stat(port_id, &fdir_stat))
> + return;
> +
> printf("\n %s FDIR infos for port %-2d %s\n",
> fdir_stats_border, port_id, fdir_stats_border);
> printf(" MODE: ");
> --
> 2.17.1
next prev parent reply other threads:[~2020-06-30 10:34 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 6:01 [dpdk-dev] [PATCH 0/5] re-implement legacy filter functions by " Chenxu Di
2020-06-11 6:01 ` [dpdk-dev] [PATCH 1/5] net/i40e: add private APIs Chenxu Di
2020-06-11 6:01 ` [dpdk-dev] [PATCH 2/5] net/ixgbe: " Chenxu Di
2020-06-11 6:01 ` [dpdk-dev] [PATCH 3/5] app/testpmd: re-implement commands by using private API Chenxu Di
2020-06-16 20:12 ` Kevin Traynor
2020-06-17 10:12 ` Di, ChenxuX
2020-06-30 6:20 ` Jeff Guo
2020-06-11 6:01 ` [dpdk-dev] [PATCH 4/5] net/i40e: enable flow query RSS Chenxu Di
2020-06-11 6:01 ` [dpdk-dev] [PATCH 5/5] app/testpmd: support query RSS config in flow query Chenxu Di
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 0/5] re-implement legacy filter functions by private API Chenxu Di
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 1/5] net/i40e: add private APIs Chenxu Di
2020-06-30 4:22 ` Jeff Guo
2020-06-30 10:24 ` Yang, Qiming
2020-07-01 1:30 ` Di, ChenxuX
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 2/5] net/ixgbe: " Chenxu Di
2020-06-30 5:25 ` Jeff Guo
2020-06-30 10:25 ` Yang, Qiming
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 3/5] app/testpmd: re-implement commands by using private API Chenxu Di
2020-06-30 10:34 ` Yang, Qiming [this message]
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 4/5] net/i40e: enable flow query RSS Chenxu Di
2020-06-30 6:48 ` Jeff Guo
2020-06-30 10:27 ` Yang, Qiming
2020-07-01 1:15 ` Di, ChenxuX
2020-06-15 2:18 ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: support query RSS config in flow query Chenxu Di
2020-06-30 6:37 ` Jeff Guo
2020-06-30 10:40 ` Yang, Qiming
2020-07-01 1:25 ` Di, ChenxuX
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 0/5] re-implement legacy filter functions by private API Chenxu Di
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 1/5] net/i40e: add private APIs Chenxu Di
2020-07-03 5:44 ` Jeff Guo
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 2/5] net/ixgbe: " Chenxu Di
2020-07-03 5:44 ` Jeff Guo
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 3/5] app/testpmd: re-implement commands by using private API Chenxu Di
2020-07-03 5:54 ` Jeff Guo
2020-07-06 9:10 ` Yang, Qiming
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 4/5] net/i40e: enable flow query RSS Chenxu Di
2020-07-03 5:57 ` Jeff Guo
2020-07-01 8:24 ` [dpdk-dev] [PATCH v3 5/5] app/testpmd: support query RSS config in flow query Chenxu Di
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 0/5] re-implement legacy filter functions by private API Chenxu Di
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 1/5] net/i40e: add private APIs Chenxu Di
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 2/5] net/ixgbe: " Chenxu Di
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 3/5] app/testpmd: re-implement commands by using private API Chenxu Di
2020-07-08 3:31 ` Yang, Qiming
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 4/5] net/i40e: enable flow query RSS Chenxu Di
2020-07-08 1:18 ` [dpdk-dev] [PATCH v4 5/5] app/testpmd: support query RSS config in flow query Chenxu Di
2020-07-08 3:32 ` Yang, Qiming
2020-07-08 9:05 ` [dpdk-dev] [PATCH v4 0/5] re-implement legacy filter functions by private API Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN6PR11MB001728289A9F65B4DE8AB43FE56F0@BN6PR11MB0017.namprd11.prod.outlook.com \
--to=qiming.yang@intel.com \
--cc=beilei.xing@intel.com \
--cc=chenxux.di@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).