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 E179CA0350; Tue, 30 Jun 2020 08:48:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8E6481BE90; Tue, 30 Jun 2020 08:48:52 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 9B73D1B952 for ; Tue, 30 Jun 2020 08:48:50 +0200 (CEST) IronPort-SDR: XS5TK6IssAOYOqKW+5iqOS4vxp+QJ77wVGGjsGCtOyXUEDPtSpFf8qZ2Ttcoux7ixEQ7X+d/Z5 AeosLlyhaONA== X-IronPort-AV: E=McAfee;i="6000,8403,9666"; a="147712548" X-IronPort-AV: E=Sophos;i="5.75,296,1589266800"; d="scan'208";a="147712548" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2020 23:48:49 -0700 IronPort-SDR: Rhww+KYT4IRdjQ3JQn010vq+QU8Yc3zMtNtwq8xhrkype72B4GpL8LTl7A5mk6oUwHIU8vil91 OShyyb1DOa5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,296,1589266800"; d="scan'208";a="281123944" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.180]) ([10.67.68.180]) by orsmga006.jf.intel.com with ESMTP; 29 Jun 2020 23:48:48 -0700 To: Chenxu Di , dev@dpdk.org Cc: beilei.xing@intel.com, Yang Qiming References: <20200611060142.75465-1-chenxux.di@intel.com> <20200615021858.13985-1-chenxux.di@intel.com> <20200615021858.13985-5-chenxux.di@intel.com> From: Jeff Guo Message-ID: <40e0d986-f86c-1e94-d53a-d54ec29aff20@intel.com> Date: Tue, 30 Jun 2020 14:48:47 +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: <20200615021858.13985-5-chenxux.di@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2 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" hi, chenxu On 6/15/2020 10:18 AM, Chenxu Di wrote: > This patch enables flow query function to get the > configuration ofthe specified rule. "ofthe" should be "of the". > > Signed-off-by: Chenxu Di > --- > drivers/net/i40e/i40e_flow.c | 51 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c > index 8f8df6fae..b070802bd 100644 > --- a/drivers/net/i40e/i40e_flow.c > +++ b/drivers/net/i40e/i40e_flow.c > @@ -43,6 +43,11 @@ 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 +134,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 +5468,48 @@ 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) This line is no need to separate and please check also below code. > +{ > + 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; > +}