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 805AEA2EDB for ; Mon, 30 Sep 2019 06:01:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 474694C8D; Mon, 30 Sep 2019 06:01:26 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AFC68343C for ; Mon, 30 Sep 2019 06:01:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2019 21:01:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,565,1559545200"; d="scan'208";a="181238139" Received: from dpdk-yahui-skylake.sh.intel.com ([10.67.119.16]) by orsmga007.jf.intel.com with ESMTP; 29 Sep 2019 21:01:13 -0700 From: Yahui Cao To: Qiming Yang , Wenzhuo Lu Cc: dev@dpdk.org, Qi Zhang , Xiaolong Ye , Beilei Xing , Yahui Cao Date: Mon, 30 Sep 2019 19:45:42 +0800 Message-Id: <20190930114547.74803-5-yahui.cao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190930114547.74803-1-yahui.cao@intel.com> References: <20190927170424.71348-1-yahui.cao@intel.com> <20190930114547.74803-1-yahui.cao@intel.com> Subject: [dpdk-dev] [PATCH v5 4/9] 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" 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 | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 984f54ea2..bd2a0c091 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -10,6 +10,8 @@ #define ICE_FDIR_IPV6_TC_OFFSET 20 #define ICE_IPV6_TC_MASK (0xFF << ICE_FDIR_IPV6_TC_OFFSET) +#define ICE_FDIR_MAX_QREGION_SIZE 128 + #define ICE_FDIR_INSET_ETH_IPV4 (\ ICE_INSET_DMAC | \ ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | ICE_INSET_IPV4_TOS | \ @@ -649,6 +651,63 @@ 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 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, + "Discontinuous queue region"); + 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 <= ICE_FDIR_MAX_QREGION_SIZE))) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, act, + "The region size should be any of the following values:" + "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[], @@ -660,6 +719,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) { @@ -694,6 +754,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