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 2FCBDA2EDB for ; Sat, 7 Sep 2019 20:24:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5EF0D1F15D; Sat, 7 Sep 2019 20:24:39 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 819A71F084 for ; Sat, 7 Sep 2019 20:24:37 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2019 11:24:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,478,1559545200"; d="scan'208";a="267679004" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.5]) by orsmga001.jf.intel.com with ESMTP; 07 Sep 2019 11:24:34 -0700 Date: Sun, 8 Sep 2019 02:22:29 +0800 From: Ye Xiaolong To: Yahui Cao Cc: Qiming Yang , Wenzhuo Lu , dev@dpdk.org, Qi Zhang , Beilei Xing Message-ID: <20190907182229.GD110251@intel.com> References: <20190906120058.108073-1-yahui.cao@intel.com> <20190906120058.108073-8-yahui.cao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906120058.108073-8-yahui.cao@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [dpdk-dev 07/12] net/ice: enable FDIR queue group 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" On 09/06, Yahui Cao wrote: >FDIR can send packet to a group of queues and distruibte it by RSS. > >Signed-off-by: Yahui Cao >--- > drivers/net/ice/ice_fdir_filter.c | 65 +++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > >diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c >index df4d0329c..ebbe1bd6c 100644 >--- a/drivers/net/ice/ice_fdir_filter.c >+++ b/drivers/net/ice/ice_fdir_filter.c >@@ -741,6 +741,62 @@ static struct ice_flow_engine ice_fdir_engine = { > .type = ICE_FLOW_ENGINE_FDIR, > }; > >+static int >+ice_fdir_parse_action_qregion(struct ice_pf *pf, >+ struct rte_flow_error *error, >+ const struct rte_flow_action *act, >+ struct ice_fdir_filter_conf *filter) >+{ >+ const struct rte_flow_action_rss *rss = act->conf; >+ uint32_t i; >+ >+ if (act->type != RTE_FLOW_ACTION_TYPE_RSS) { >+ rte_flow_error_set(error, EINVAL, >+ RTE_FLOW_ERROR_TYPE_ACTION, act, >+ "Invalid action."); >+ return -rte_errno; >+ } >+ >+ if (rss->queue_num <= 1) { >+ rte_flow_error_set(error, EINVAL, >+ RTE_FLOW_ERROR_TYPE_ACTION, act, >+ "Queue region size can't be 0 or 1."); >+ return -rte_errno; >+ } >+ >+ /* check if queue index for queue region is continuos */ s/continuos/continuous >+ for (i = 0; i < rss->queue_num - 1; i++) { >+ if (rss->queue[i + 1] != rss->queue[i] + 1) { >+ rte_flow_error_set(error, EINVAL, >+ RTE_FLOW_ERROR_TYPE_ACTION, act, >+ "Invalid queue region indexes."); Change the error message to "discontinuous queue region." to be more specific? >+ return -rte_errno; >+ } >+ } >+ >+ if (rss->queue[rss->queue_num - 1] >= pf->dev_data->nb_rx_queues) { >+ rte_flow_error_set(error, EINVAL, >+ RTE_FLOW_ERROR_TYPE_ACTION, act, >+ "Invalid queue region indexes."); >+ return -rte_errno; >+ } >+ >+ if (!(rte_is_power_of_2(rss->queue_num) && (rss->queue_num <= 128))) { Use a macro fro the 128. >+ rte_flow_error_set(error, EINVAL, >+ RTE_FLOW_ERROR_TYPE_ACTION, act, >+ "The region sizes should be any of the following values:" s/sizes/size >+ "1, 2, 4, 8, 16, 32, 64, 128 as long as the total number " >+ "of queues do not exceed the VSI allocation."); >+ return -rte_errno; >+ } >+ >+ filter->input.q_index = rss->queue[0]; >+ filter->input.q_region = rte_fls_u32(rss->queue_num) - 1; >+ filter->input.dest_ctl = ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP; >+ >+ return 0; >+} >+ > static int > ice_fdir_parse_action(struct ice_adapter *ad, > const struct rte_flow_action actions[], >@@ -752,6 +808,7 @@ ice_fdir_parse_action(struct ice_adapter *ad, > const struct rte_flow_action_mark *mark_spec = NULL; > uint32_t dest_num = 0; > uint32_t mark_num = 0; >+ int ret; > > for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { > switch (actions->type) { >@@ -785,6 +842,14 @@ ice_fdir_parse_action(struct ice_adapter *ad, > ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX; > filter->input.q_index = 0; > break; >+ case RTE_FLOW_ACTION_TYPE_RSS: >+ dest_num++; >+ >+ ret = ice_fdir_parse_action_qregion(pf, >+ error, actions, filter); >+ if (ret) >+ return ret; >+ break; > case RTE_FLOW_ACTION_TYPE_MARK: > mark_num++; > >-- >2.17.1 >