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 7A8C242D07; Tue, 20 Jun 2023 13:02:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 637A440EDF; Tue, 20 Jun 2023 13:02:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 810064068E; Tue, 20 Jun 2023 13:02:08 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35K9fCjS023750; Tue, 20 Jun 2023 04:02:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=AdvuudnIkxlGlJkzge4Zb+jobLsnUac9ZyNp58eD7wc=; b=R3lc6Nt8Mfg8uHcldE4suYrvTKWwMNBlb0mzE1cVC1fQqzL05jP5Rn5ivhawtEQyK1g4 S+Mo//d1B6KQCsJ1haYzfPxqOlF2B8ldgK0hCB5M6O93BOM+UXKZw8cg5ssIrRl9suAr Kc/0h16jVMk+iLTzt21Yda8WvieDg1PQSKnlwII/5VkNFSrV+Ir7/S+I+LDp4pqF8dWm +35cZMifweOPH2wnT/rFpgSf0af3tC5tHl/DsYx3tF2I+TI74zpPjv2JzKiVlxQEZFWg i8hP5kBzEyF5iNgaHPnDSKJFqbItrtM3LbGwzmu8adYDaDf5GKcDKgMYUJN226M5+FGW qg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3r9cbkfh97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 20 Jun 2023 04:02:07 -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.48; Tue, 20 Jun 2023 04:02:05 -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.48 via Frontend Transport; Tue, 20 Jun 2023 04:02:05 -0700 Received: from satheeshpaullabpc.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id E1C183F7185; Tue, 20 Jun 2023 04:01:39 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul , Subject: [dpdk-dev] [PATCH] net/cnxk: fix incorrect queue index validation Date: Tue, 20 Jun 2023 16:31:37 +0530 Message-ID: <20230620110137.1416830-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 3CEWm_WYi5xzl4vK5OYfDFKP6CgfYBCU X-Proofpoint-ORIG-GUID: 3CEWm_WYi5xzl4vK5OYfDFKP6CgfYBCU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-20_07,2023-06-16_01,2023-05-22_02 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: Satheesh Paul When creating a flow rule directing traffic from PF to VF, current validation is incorrectly checking the RQ index in flow action with the PF's maximum configured RQs. This validation is applicable only when action target is an RQ of the PF. The validation has been modified accordingly. Fixes: 8c009b4505e ("net/cnxk: support flow API") Cc: stable@dpdk.org Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K --- drivers/net/cnxk/cnxk_flow.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c index 1b88542dcb..3b8348ae9c 100644 --- a/drivers/net/cnxk/cnxk_flow.c +++ b/drivers/net/cnxk/cnxk_flow.c @@ -117,13 +117,14 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, uint32_t *flowkey_cfg, uint16_t *dst_pf_func) { struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + const struct rte_flow_action_queue *act_q = NULL; const struct rte_flow_action_ethdev *act_ethdev; const struct rte_flow_action_port_id *port_act; - const struct rte_flow_action_queue *act_q; struct rte_eth_dev *portid_eth_dev; char if_name[RTE_ETH_NAME_MAX_LEN]; struct cnxk_eth_dev *hw_dst; struct roc_npc *roc_npc_dst; + bool is_vf_action = false; int i = 0, rc = 0; int rq; @@ -157,6 +158,7 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, case RTE_FLOW_ACTION_TYPE_VF: in_actions[i].type = ROC_NPC_ACTION_TYPE_VF; in_actions[i].conf = actions->conf; + is_vf_action = true; break; case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: @@ -189,13 +191,7 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, break; case RTE_FLOW_ACTION_TYPE_QUEUE: - act_q = (const struct rte_flow_action_queue *) - actions->conf; - rq = act_q->index; - if (rq >= eth_dev->data->nb_rx_queues) { - plt_npc_dbg("Invalid queue index"); - goto err_exit; - } + act_q = (const struct rte_flow_action_queue *)actions->conf; in_actions[i].type = ROC_NPC_ACTION_TYPE_QUEUE; in_actions[i].conf = actions->conf; break; @@ -241,6 +237,14 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr, } i++; } + + if (!is_vf_action && act_q) { + rq = act_q->index; + if (rq >= eth_dev->data->nb_rx_queues) { + plt_npc_dbg("Invalid queue index"); + goto err_exit; + } + } in_actions[i].type = ROC_NPC_ACTION_TYPE_END; return 0; -- 2.39.2