From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 141EAA0C41; Wed, 23 Jun 2021 06:53:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C303041140; Wed, 23 Jun 2021 06:50:17 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 23E1C411C2 for ; Wed, 23 Jun 2021 06:50:16 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15N4k9p7025587 for ; Tue, 22 Jun 2021 21:50:15 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=uaqaN9FvN8mACyPIwMLg9Rf2sT6mww4mRDpN4Kw008Q=; b=kj1l8l5QZBNu8QTfXK5emNVK42NZ9cHCit+fAEcKh8TxTRQw5Y0JAR5moafPXdoX5I8H ga+yoH/h6HxJnc+p9pIpMmpwRjNB+BmLwcjQWdOWoZ6sGvT6ctXpDG+1EPK9WYd9HZM2 zKjzQcVplv1VEh0/khL0isc9amYLSKaBPoi0xLe4AzeMINAqHk00yj4FOJX9lMy6z9T7 kexTXLfxNkr+GmXVbKbGBivzYl/0dB3+b0mnP80PRBxnCoEaKJhQIC8Be10IXBaxdA3s +bToe1W992Y5H/hbYT4Kmn7xdRlEdEbKQTdbSUAqqTHda3zmNtCV+P2zazyNNwuWL6CV eg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 39bptj1gvp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 22 Jun 2021 21:50:15 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 22 Jun 2021 21:50:13 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 22 Jun 2021 21:50:13 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id BEDBA5B697B; Tue, 22 Jun 2021 21:50:06 -0700 (PDT) From: Nithin Dabilpuram To: CC: , , , , , , , Date: Wed, 23 Jun 2021 10:16:53 +0530 Message-ID: <20210623044702.4240-54-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210623044702.4240-1-ndabilpuram@marvell.com> References: <20210306153404.10781-1-ndabilpuram@marvell.com> <20210623044702.4240-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 5m59pw3s8clPFXY6QwBoiL4G1L_ba1QE X-Proofpoint-GUID: 5m59pw3s8clPFXY6QwBoiL4G1L_ba1QE X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-23_01:2021-06-22, 2021-06-23 signatures=0 Subject: [dpdk-dev] [PATCH v4 53/62] net/cnxk: support for RSS in rte flow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Satheesh Paul Added support for RSS action in rte flow code based on ROC. Signed-off-by: Satheesh Paul --- doc/guides/nics/features/cnxk.ini | 1 + doc/guides/nics/features/cnxk_vec.ini | 1 + doc/guides/nics/features/cnxk_vf.ini | 1 + drivers/net/cnxk/cnxk_rte_flow.c | 74 +++++++++++++++++++++++++++++++---- 4 files changed, 69 insertions(+), 8 deletions(-) diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini index 246caf9..eba4107 100644 --- a/doc/guides/nics/features/cnxk.ini +++ b/doc/guides/nics/features/cnxk.ini @@ -75,5 +75,6 @@ flag = Y pf = Y port_id = Y queue = Y +rss = Y security = Y vf = Y diff --git a/doc/guides/nics/features/cnxk_vec.ini b/doc/guides/nics/features/cnxk_vec.ini index 6c6aeb0..4871fac 100644 --- a/doc/guides/nics/features/cnxk_vec.ini +++ b/doc/guides/nics/features/cnxk_vec.ini @@ -73,5 +73,6 @@ flag = Y pf = Y port_id = Y queue = Y +rss = Y security = Y vf = Y diff --git a/doc/guides/nics/features/cnxk_vf.ini b/doc/guides/nics/features/cnxk_vf.ini index 8ec326a..81ee7cc 100644 --- a/doc/guides/nics/features/cnxk_vf.ini +++ b/doc/guides/nics/features/cnxk_vf.ini @@ -70,5 +70,6 @@ flag = Y pf = Y port_id = Y queue = Y +rss = Y security = Y vf = Y diff --git a/drivers/net/cnxk/cnxk_rte_flow.c b/drivers/net/cnxk/cnxk_rte_flow.c index 2dee19e..c61618a 100644 --- a/drivers/net/cnxk/cnxk_rte_flow.c +++ b/drivers/net/cnxk/cnxk_rte_flow.c @@ -56,14 +56,64 @@ const struct cnxk_rte_flow_term_info term[] = { }; static int -cnxk_map_actions(struct rte_eth_dev *eth_dev, +npc_rss_action_validate(struct rte_eth_dev *eth_dev, + const struct rte_flow_attr *attr, + const struct rte_flow_action *act) +{ + const struct rte_flow_action_rss *rss; + + rss = (const struct rte_flow_action_rss *)act->conf; + + if (attr->egress) { + plt_err("No support of RSS in egress"); + return -EINVAL; + } + + if (eth_dev->data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) { + plt_err("multi-queue mode is disabled"); + return -ENOTSUP; + } + + if (!rss || !rss->queue_num) { + plt_err("no valid queues"); + return -EINVAL; + } + + if (rss->func != RTE_ETH_HASH_FUNCTION_DEFAULT) { + plt_err("non-default RSS hash functions are not supported"); + return -ENOTSUP; + } + + if (rss->key_len && rss->key_len > ROC_NIX_RSS_KEY_LEN) { + plt_err("RSS hash key too large"); + return -ENOTSUP; + } + + return 0; +} + +static void +npc_rss_flowkey_get(struct cnxk_eth_dev *eth_dev, + const struct roc_npc_action *rss_action, + uint32_t *flowkey_cfg) +{ + const struct roc_npc_action_rss *rss; + + rss = (const struct roc_npc_action_rss *)rss_action->conf; + + *flowkey_cfg = cnxk_rss_ethdev_to_nix(eth_dev, rss->types, rss->level); +} + +static int +cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, const struct rte_flow_action actions[], - struct roc_npc_action in_actions[]) + struct roc_npc_action in_actions[], uint32_t *flowkey_cfg) { + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); const struct rte_flow_action_count *act_count; const struct rte_flow_action_queue *act_q; + int i = 0, rc = 0; int rq; - int i = 0; for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { switch (actions->type) { @@ -117,7 +167,12 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, break; case RTE_FLOW_ACTION_TYPE_RSS: + rc = npc_rss_action_validate(eth_dev, attr, actions); + if (rc) + goto err_exit; in_actions[i].type = ROC_NPC_ACTION_TYPE_RSS; + in_actions[i].conf = actions->conf; + npc_rss_flowkey_get(dev, &in_actions[i], flowkey_cfg); break; case RTE_FLOW_ACTION_TYPE_SECURITY: @@ -144,7 +199,7 @@ cnxk_map_flow_data(struct rte_eth_dev *eth_dev, const struct rte_flow_action actions[], struct roc_npc_attr *in_attr, struct roc_npc_item_info in_pattern[], - struct roc_npc_action in_actions[]) + struct roc_npc_action in_actions[], uint32_t *flowkey_cfg) { int i = 0; @@ -163,7 +218,8 @@ cnxk_map_flow_data(struct rte_eth_dev *eth_dev, } in_pattern[i].type = ROC_NPC_ITEM_TYPE_END; - return cnxk_map_actions(eth_dev, actions, in_actions); + return cnxk_map_actions(eth_dev, attr, actions, in_actions, + flowkey_cfg); } static int @@ -179,12 +235,13 @@ cnxk_flow_validate(struct rte_eth_dev *eth_dev, struct roc_npc *npc = &dev->npc; struct roc_npc_attr in_attr; struct roc_npc_flow flow; + uint32_t flowkey_cfg = 0; int rc; memset(&flow, 0, sizeof(flow)); rc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, - in_pattern, in_actions); + in_pattern, in_actions, &flowkey_cfg); if (rc) { rte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL, "Failed to map flow data"); @@ -206,11 +263,12 @@ cnxk_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, struct roc_npc *npc = &dev->npc; struct roc_npc_attr in_attr; struct roc_npc_flow *flow; - int errcode; + int errcode = 0; int rc; rc = cnxk_map_flow_data(eth_dev, attr, pattern, actions, &in_attr, - in_pattern, in_actions); + in_pattern, in_actions, + &npc->flowkey_cfg_state); if (rc) { rte_flow_error_set(error, 0, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL, "Failed to map flow data"); -- 2.8.4