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 2CA9545977; Fri, 13 Sep 2024 08:05:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAD9C432A8; Fri, 13 Sep 2024 08:00:57 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 8547C42E97 for ; Fri, 13 Sep 2024 08:00:17 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 18EA61A27C1; Fri, 13 Sep 2024 08:00:17 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 5490A1A2752; Fri, 13 Sep 2024 08:00:15 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 8F20B183DC05; Fri, 13 Sep 2024 14:00:14 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v1 33/43] net/dpaa2: soft parser flow verification Date: Fri, 13 Sep 2024 11:29:49 +0530 Message-Id: <20240913055959.3246917-34-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913055959.3246917-1-vanshika.shukla@nxp.com> References: <20240913055959.3246917-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Jun Yang Add flow supported by soft parser to verification list. Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_flow.c | 86 ++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index a376acffcf..72075473fc 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -66,7 +66,7 @@ struct rte_dpaa2_flow_item { }; static const -enum rte_flow_item_type dpaa2_supported_pattern_type[] = { +enum rte_flow_item_type dpaa2_hp_supported_pattern_type[] = { RTE_FLOW_ITEM_TYPE_END, RTE_FLOW_ITEM_TYPE_ETH, RTE_FLOW_ITEM_TYPE_VLAN, @@ -77,7 +77,14 @@ enum rte_flow_item_type dpaa2_supported_pattern_type[] = { RTE_FLOW_ITEM_TYPE_TCP, RTE_FLOW_ITEM_TYPE_SCTP, RTE_FLOW_ITEM_TYPE_GRE, - RTE_FLOW_ITEM_TYPE_GTP + RTE_FLOW_ITEM_TYPE_GTP, + RTE_FLOW_ITEM_TYPE_RAW +}; + +static const +enum rte_flow_item_type dpaa2_sp_supported_pattern_type[] = { + RTE_FLOW_ITEM_TYPE_VXLAN, + RTE_FLOW_ITEM_TYPE_ECPRI }; static const @@ -4560,20 +4567,21 @@ dpaa2_dev_verify_attr(struct dpni_attr *dpni_attr, int ret = 0; if (unlikely(attr->group >= dpni_attr->num_rx_tcs)) { - DPAA2_PMD_ERR("Priority group is out of range\n"); + DPAA2_PMD_ERR("Group/TC(%d) is out of range(%d)", + attr->group, dpni_attr->num_rx_tcs); ret = -ENOTSUP; } if (unlikely(attr->priority >= dpni_attr->fs_entries)) { - DPAA2_PMD_ERR("Priority within the group is out of range\n"); + DPAA2_PMD_ERR("Priority(%d) within group is out of range(%d)", + attr->priority, dpni_attr->fs_entries); ret = -ENOTSUP; } if (unlikely(attr->egress)) { - DPAA2_PMD_ERR( - "Flow configuration is not supported on egress side\n"); + DPAA2_PMD_ERR("Egress flow configuration is not supported"); ret = -ENOTSUP; } if (unlikely(!attr->ingress)) { - DPAA2_PMD_ERR("Ingress flag must be configured\n"); + DPAA2_PMD_ERR("Ingress flag must be configured"); ret = -EINVAL; } return ret; @@ -4584,27 +4592,41 @@ dpaa2_dev_verify_patterns(const struct rte_flow_item pattern[]) { unsigned int i, j, is_found = 0; int ret = 0; + const enum rte_flow_item_type *hp_supported; + const enum rte_flow_item_type *sp_supported; + uint64_t hp_supported_num, sp_supported_num; + + hp_supported = dpaa2_hp_supported_pattern_type; + hp_supported_num = RTE_DIM(dpaa2_hp_supported_pattern_type); + + sp_supported = dpaa2_sp_supported_pattern_type; + sp_supported_num = RTE_DIM(dpaa2_sp_supported_pattern_type); for (j = 0; pattern[j].type != RTE_FLOW_ITEM_TYPE_END; j++) { - for (i = 0; i < RTE_DIM(dpaa2_supported_pattern_type); i++) { - if (dpaa2_supported_pattern_type[i] - == pattern[j].type) { + is_found = 0; + for (i = 0; i < hp_supported_num; i++) { + if (hp_supported[i] == pattern[j].type) { is_found = 1; break; } } + if (is_found) + continue; + if (dpaa2_sp_loaded > 0) { + for (i = 0; i < sp_supported_num; i++) { + if (sp_supported[i] == pattern[j].type) { + is_found = 1; + break; + } + } + } if (!is_found) { + DPAA2_PMD_WARN("Flow type(%d) not supported", + pattern[j].type); ret = -ENOTSUP; break; } } - /* Lets verify other combinations of given pattern rules */ - for (j = 0; pattern[j].type != RTE_FLOW_ITEM_TYPE_END; j++) { - if (!pattern[j].spec) { - ret = -EINVAL; - break; - } - } return ret; } @@ -4651,43 +4673,39 @@ dpaa2_flow_validate(struct rte_eth_dev *dev, memset(&dpni_attr, 0, sizeof(struct dpni_attr)); ret = dpni_get_attributes(dpni, CMD_PRI_LOW, token, &dpni_attr); if (ret < 0) { - DPAA2_PMD_ERR( - "Failure to get dpni@%p attribute, err code %d\n", - dpni, ret); + DPAA2_PMD_ERR("Get dpni@%d attribute failed(%d)", + priv->hw_id, ret); rte_flow_error_set(error, EPERM, - RTE_FLOW_ERROR_TYPE_ATTR, - flow_attr, "invalid"); + RTE_FLOW_ERROR_TYPE_ATTR, + flow_attr, "invalid"); return ret; } /* Verify input attributes */ ret = dpaa2_dev_verify_attr(&dpni_attr, flow_attr); if (ret < 0) { - DPAA2_PMD_ERR( - "Invalid attributes are given\n"); + DPAA2_PMD_ERR("Invalid attributes are given"); rte_flow_error_set(error, EPERM, - RTE_FLOW_ERROR_TYPE_ATTR, - flow_attr, "invalid"); + RTE_FLOW_ERROR_TYPE_ATTR, + flow_attr, "invalid"); goto not_valid_params; } /* Verify input pattern list */ ret = dpaa2_dev_verify_patterns(pattern); if (ret < 0) { - DPAA2_PMD_ERR( - "Invalid pattern list is given\n"); + DPAA2_PMD_ERR("Invalid pattern list is given"); rte_flow_error_set(error, EPERM, - RTE_FLOW_ERROR_TYPE_ITEM, - pattern, "invalid"); + RTE_FLOW_ERROR_TYPE_ITEM, + pattern, "invalid"); goto not_valid_params; } /* Verify input action list */ ret = dpaa2_dev_verify_actions(actions); if (ret < 0) { - DPAA2_PMD_ERR( - "Invalid action list is given\n"); + DPAA2_PMD_ERR("Invalid action list is given"); rte_flow_error_set(error, EPERM, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, "invalid"); + RTE_FLOW_ERROR_TYPE_ACTION, + actions, "invalid"); goto not_valid_params; } not_valid_params: -- 2.25.1