From patchwork Wed Jul 1 08:24:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72583 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7ED00A0350; Wed, 1 Jul 2020 10:48:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68F231D155; Wed, 1 Jul 2020 10:47:35 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id BCBF51C21E for ; Wed, 1 Jul 2020 10:47:33 +0200 (CEST) IronPort-SDR: 80kCJQiyzNZFpcz6OvoCTdAFBlxsnihXFDSTiB98ZY2zSTM1mzS7pcUmEctaWSzYsu2To3dOoj lIURtDA1iK1A== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021331" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021331" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2020 01:47:33 -0700 IronPort-SDR: 8KbLP/vPbOg6sBNGbdcRKWAiAqB5X0ng/k4pm3gnrpOpFN6vRsUtJJ7KevNtLhXReQ5TqWMOko jnAXMqjgn9+Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495846" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:31 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:51 +0000 Message-Id: <20200701082451.34511-6-chenxux.di@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701082451.34511-1-chenxux.di@intel.com> References: <20200611060142.75465-1-chenxux.di@intel.com> <20200701082451.34511-1-chenxux.di@intel.com> Subject: [dpdk-dev] [PATCH v3 5/5] app/testpmd: support query RSS config in flow query 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" This patch support RSS action in flow query. It can display the RSS configuration of the specified rule. For example: we can create an RSS rule by command "flow create 0 ingress pattern eth / ipv4 / tcp / end actions rss types ipv4-tcp l3-src-only l4-dst-only end queues end func symmetric_toeplitz / end" and then query it "flow query 0 0 rss" the log will be follow RSS: queues: none function: symmetric_toeplitz types: ipv4-tcp l3-src-only l4-dst-only Signed-off-by: Chenxu Di --- app/test-pmd/config.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ed341c715..df2ea5d81 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1376,6 +1376,56 @@ port_flow_complain(struct rte_flow_error *error) return -err; } +static void +rss_config_display(struct rte_flow_action_rss *rss_conf) +{ + uint8_t i; + + if (rss_conf == NULL) { + printf("Invalid rule\n"); + return; + } + + printf("RSS:\n" + " queues: "); + if (rss_conf->queue_num == 0) + printf("none\n"); + for (i = 0; i < rss_conf->queue_num; i++) + printf("%d\n", rss_conf->queue[i]); + + printf(" function: "); + switch (rss_conf->func) { + case RTE_ETH_HASH_FUNCTION_DEFAULT: + printf("default\n"); + break; + case RTE_ETH_HASH_FUNCTION_TOEPLITZ: + printf("toeplitz\n"); + break; + case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR: + printf("simple_xor\n"); + break; + case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ: + printf("symmetric_toeplitz\n"); + break; + default: + printf("Unknown function\n"); + return; + } + + printf(" types:\n"); + if (rss_conf->types == 0) { + printf(" none\n"); + return; + } + for (i = 0; rss_type_table[i].str; i++) { + if ((rss_conf->types & + rss_type_table[i].rss_type) == + rss_type_table[i].rss_type && + rss_type_table[i].rss_type != 0) + printf(" %s\n", rss_type_table[i].str); + } +} + /** Validate flow rule. */ int port_flow_validate(portid_t port_id, @@ -1562,6 +1612,7 @@ port_flow_query(portid_t port_id, uint32_t rule, const char *name; union { struct rte_flow_query_count count; + struct rte_flow_action_rss rss_conf; } query; int ret; @@ -1583,6 +1634,7 @@ port_flow_query(portid_t port_id, uint32_t rule, return port_flow_complain(&error); switch (action->type) { case RTE_FLOW_ACTION_TYPE_COUNT: + case RTE_FLOW_ACTION_TYPE_RSS: break; default: printf("Cannot query action type %d (%s)\n", @@ -1607,6 +1659,9 @@ port_flow_query(portid_t port_id, uint32_t rule, query.count.hits, query.count.bytes); break; + case RTE_FLOW_ACTION_TYPE_RSS: + rss_config_display(&query.rss_conf); + break; default: printf("Cannot display result for action type %d (%s)\n", action->type, name);