From patchwork Wed Jul 1 08:24:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenxu Di X-Patchwork-Id: 72582 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 1F1EAA0350; Wed, 1 Jul 2020 10:47:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EE981D147; Wed, 1 Jul 2020 10:47:33 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8A3CF1C43D for ; Wed, 1 Jul 2020 10:47:31 +0200 (CEST) IronPort-SDR: PkhqtX+vzZ5BxI1TKDpdPBO/2wP6vTCUPTLGh4Id2IZruDkyQLL+fGaMKE1aJxnVJucjkmU2bo ZrokSVziO8gw== X-IronPort-AV: E=McAfee;i="6000,8403,9668"; a="208021327" X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="208021327" 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:31 -0700 IronPort-SDR: /ggbVJlSDRM6rran+vmntP92/F5leEmqjiPcmjEg3PoYI9LBA425OSyAwSo3/Z75VnWLFzS6x4 hhNpaOS7QzFA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,299,1589266800"; d="scan'208";a="295495836" Received: from intel.sh.intel.com ([10.239.255.20]) by orsmga002.jf.intel.com with ESMTP; 01 Jul 2020 01:47:29 -0700 From: Chenxu Di To: dev@dpdk.org Cc: Yang Qiming , jia.guo@intel.com, Chenxu Di Date: Wed, 1 Jul 2020 08:24:50 +0000 Message-Id: <20200701082451.34511-5-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 4/5] net/i40e: enable flow query RSS 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 enables flow query function to get the configuration of the specified rule. Signed-off-by: Chenxu Di Acked-by: Jeff Guo > --- doc/guides/rel_notes/release_20_08.rst | 1 + drivers/net/i40e/i40e_flow.c | 49 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 1252a337a..a7fb3136d 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -90,6 +90,7 @@ New Features * Re-implemented get_fdir_info and get_fdir_stat in private API. * Re-implemented set_gre_key_len in private API. + * Added support for flow query RSS. * **Updated the Intel ixgbe driver.** diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 8f8df6fae..4186a5df2 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -43,6 +43,10 @@ static int i40e_flow_destroy(struct rte_eth_dev *dev, struct rte_flow_error *error); static int i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error); +static int i40e_flow_query(struct rte_eth_dev *dev, + struct rte_flow *flow, + const struct rte_flow_action *actions, + void *data, struct rte_flow_error *error); static int i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, const struct rte_flow_item *pattern, @@ -129,6 +133,7 @@ const struct rte_flow_ops i40e_flow_ops = { .create = i40e_flow_create, .destroy = i40e_flow_destroy, .flush = i40e_flow_flush, + .query = i40e_flow_query, }; static union i40e_filter_t cons_filter; @@ -5462,3 +5467,47 @@ i40e_flow_flush_rss_filter(struct rte_eth_dev *dev) return ret; } + +static int +i40e_flow_query(struct rte_eth_dev *dev __rte_unused, + struct rte_flow *flow, + const struct rte_flow_action *actions, + void *data, struct rte_flow_error *error) +{ + struct i40e_rss_filter *rss_rule = (struct i40e_rss_filter *)flow->rule; + enum rte_filter_type filter_type = flow->filter_type; + struct rte_flow_action_rss *rss_conf = data; + + if (!rss_rule) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, "Invalid rule"); + return -rte_errno; + } + + for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + switch (actions->type) { + case RTE_FLOW_ACTION_TYPE_VOID: + break; + case RTE_FLOW_ACTION_TYPE_RSS: + if (filter_type != RTE_ETH_FILTER_HASH) { + rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "action not supported"); + return -rte_errno; + } + rte_memcpy(rss_conf, + &rss_rule->rss_filter_info.conf, + sizeof(struct rte_flow_action_rss)); + break; + default: + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "action not supported"); + } + } + + return 0; +}