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 016D745B4C; Tue, 22 Oct 2024 21:15:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17B86402E9; Tue, 22 Oct 2024 21:15:00 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 91E7F40C35 for ; Tue, 22 Oct 2024 21:13:11 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 764681A0FA1; Tue, 22 Oct 2024 21:13:11 +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 324C11A050D; Tue, 22 Oct 2024 21:13:11 +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 953B8183DC03; Wed, 23 Oct 2024 03:13:10 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v4 32/42] net/dpaa2: soft parser flow verification Date: Wed, 23 Oct 2024 00:42:45 +0530 Message-Id: <20241022191256.516818-33-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241022191256.516818-1-vanshika.shukla@nxp.com> References: <20241014120126.170790-1-vanshika.shukla@nxp.com> <20241022191256.516818-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 | 84 +++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index 58ea0f578f..018ffec266 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 @@ -4556,16 +4563,17 @@ 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"); + 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"); + 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"); + DPAA2_PMD_ERR("Egress flow configuration is not supported"); ret = -ENOTSUP; } if (unlikely(!attr->ingress)) { @@ -4580,27 +4588,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; } @@ -4647,43 +4669,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", - 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"); + 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"); + 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"); + 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