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 6DFA6A00BE; Wed, 8 Jul 2020 03:37:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA7261DCFD; Wed, 8 Jul 2020 03:37:21 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3A83F1DC50 for ; Wed, 8 Jul 2020 03:37:19 +0200 (CEST) IronPort-SDR: fuJpem6s38aqUc70mZItmIE9p7wWQj9maET3bWHYUURQkNAXKyk9j0N171mxqR8GGIwQ32xsKZ +JCAu2D+413A== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="149235875" X-IronPort-AV: E=Sophos;i="5.75,326,1589266800"; d="scan'208";a="149235875" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 18:37:18 -0700 IronPort-SDR: EBFmkgS6cpEEFiYX8NaQ7LW0udeQ+FBh/+VqrAi8uEjbg80qOirkovEDHbe5LoYntZGJBhze8R +yiTmMfBcdTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,326,1589266800"; d="scan'208";a="297570812" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 07 Jul 2020 18:37:17 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , Chenxu Di Date: Wed, 8 Jul 2020 01:18:39 +0000 Message-Id: <20200708011841.22295-4-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708011841.22295-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200708011841.22295-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v4 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" 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 | 4 +++ app/test-pmd/config.c | 57 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 81c87c8c3..39ad93838 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -9291,6 +9291,10 @@ 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); +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) + ret = rte_pmd_i40e_set_gre_key_len(res->port_id, res->len); +#endif if (ret != 0) printf("Global config error\n"); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 75013100f..cf14b584f 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -3746,30 +3746,65 @@ 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, + 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_INFO, fdir_info); + rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, + RTE_ETH_FILTER_STATS, fdir_stat); + return 0; + } + +#ifdef RTE_LIBRTE_I40E_PMD + if (ret == -ENOTSUP) { + ret = rte_pmd_i40e_get_fdir_info(port_id, fdir_info); + if (!ret) + 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_info(port_id, fdir_info); + if (!ret) + ret = rte_pmd_ixgbe_get_fdir_stats(port_id, fdir_stat); + } +#endif + switch (ret) { + case 0: + break; + case -ENOTSUP: + printf("\n FDIR is not supported on port %-2d\n", + port_id); + break; + default: + printf("programming error: (%s)\n", strerror(-ret)); + break; + } + 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); 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_info(port_id, &fdir_info, &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