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 48F7143C8E; Tue, 12 Mar 2024 09:04:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 551DF41157; Tue, 12 Mar 2024 09:04:10 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2110.outbound.protection.outlook.com [40.107.94.110]) by mails.dpdk.org (Postfix) with ESMTP id 8AEB3410D0; Tue, 12 Mar 2024 09:04:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOeRNgVj3hioywvD3mXJDaCz9lMfxD1IQJd4nsCwVksOZVN3U5tfmeVD2JBe47jcOwpmeC4M81mdK9ydCBcErEPRjOPPJi1atwT77grApTLEUS2zkylLUMDFERwzXs+T97J5rZAU4wHc7Bx14Tw53qz6Zrcv0zcSoMAstGAWHqCvdwVOBtD0UuAIlvEBYR1bt/NiLQkqOeE1N4e6A5ATG6L+1ATg9bK4AjooolVgeHO4RaihrcjqBxHrnqt0GmRSMRvmA4Aicrjxn3TjxUSOpxpQ0Rr5OGZ9ng++FwuPc99kRchSSH7jpIhp9ZGP52FRkHFHil3+S1Kct1A8khefCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mRKvj3slw7Uwr7nCtUJ+loPD4eBzfq7w67C8KcDg6uI=; b=BfQQdAnpW2iVBcYWF+ER0t443kAEJm0RpYxU3t9rwpVwtczTTcVL753jA5MTyDv93b1JdFKEvzcFC+IbQAkCe6+6XUtFu1ChiVQuBxwDzBuFjO7XNTM0gfNFurptQPYSqlCxmoyFb3+vB3+0CuFA5pabN4sWF+dYPGKVdxTvYmytqU0ewHBbaCS0lQs8go4Yz5+Wf7ruuIkynp7rCjSVQ5g2gw0F7ZXzV/WqhcMIIKwaS72GRgzRvK408Gw/Vx3GIXc/SXz5fP8KwD0lemwlBO0FeWHIdK5ToqqP//L24U9APTmpRr+IeTDU0ncajdwYGHcEu8m4TWzlslbRlODq8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mRKvj3slw7Uwr7nCtUJ+loPD4eBzfq7w67C8KcDg6uI=; b=IL0Z8Cw4r2pBbpDeh6yNnAEO80wbxWIPhextcIrqawsI71PNsoquJo+7z7P6SEMSMPO3NwSnhvW9aGByXniItIOxxRa7579lNSTfBvoYAHa0TZv4stp/mgSe3IVDbC7gb4ZAl8ZajalDOkGWsCTdejjH0jaSUhcuwGQuKSXYy3Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by PH0PR13MB4987.namprd13.prod.outlook.com (2603:10b6:510:75::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 08:04:06 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7362.035; Tue, 12 Mar 2024 08:04:06 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , stable@dpdk.org Subject: [PATCH 2/2] net/nfp: fix incorrect queue index Date: Tue, 12 Mar 2024 16:02:45 +0800 Message-Id: <20240312080245.2783410-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240312080245.2783410-1-chaoyong.he@corigine.com> References: <20240312080245.2783410-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR07CA0099.namprd07.prod.outlook.com (2603:10b6:a03:12b::40) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB4987:EE_ X-MS-Office365-Filtering-Correlation-Id: 98c93aea-17a3-4f3e-c54f-08dc426afd03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yl5h42pbtpgnVT/NH40rYkmcAACHQdP26imciGlvjeEZDHcZ8S18LI6fioGlhGrw9qqTz3qNo8CIT2bok7qhGw2QNNR4903nq3RRqJzwAyJTyV1K7YpKCXDqfC45x4wXGPdXmDoYCzj0S6YIJI489LFOCJKbTxItUKankzG1S2etwo2z8U3u4puf3slcM4VstglSvcIa7+X3vcEpAG00HkcAwH19My/TcEQjrGwcOttd4cCdoV3HY79++jvr5WGzRGMcnQ3lxmNfeDaRagCESQRw1dwEcK5LHFwXAHrKDBLA9Wy8TByNh8XBOlyyqVpAD1dtHDVN85sDl6uLrpodtFT5/KLj32iO6mBOyJthBXjsMBEc+K5RQJemaZreMWyaF1KLzGyp4y+wCxaCfo154mk/woNuH5iOp+P0495MoIZX66FXZFBYE/rtP1rbGWw8bnTNu1nn1WDdqszHIg625jT4QhEF4hXHyThwzxmpvUphkv1nojZm/kKomDwWqOWtENyRBX1/NakkVADKPkG3ITYaPOvCxZTf2cUMGzzIJ30XDq/qACoHKvxGlB9c6brP5wGtmzBMLl/2ZoOqQwEVKL810QkTe5E1th/LMkjM8B0Go1JC6YGLlP9eRFDRxfRne2HulXG3J1kUHT6byK973x6gNEA/tuH2DRRMvd/wLs1Cda58xFfTuEiA/3HSNIEbGTFixsdaPJai0DeaOR3OVYexMAKlIWDg3ByJh7Wtyig= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?EnXoifhlrlmNZr309lNCuVuPGnx8qDfuqtX0l7YXEQ6aLzZYNGJ2sBeyrr+e?= =?us-ascii?Q?0Id+44k4p7mtq3U1pCxa72uujZruKjltk4XKPJugZjqtW3kC1oy6EgZ6Mi4u?= =?us-ascii?Q?fWhaSJfLTys9CT6XTVQv7LBEAKU5ifwVJIm/UAbKPw3QYhn4nwwqB/S9/SuE?= =?us-ascii?Q?UP3b0z/OMXZbk2Rrm6NmXDy43YWPG5G1mM+p9Z2wWMCFToMtGCaPa7mGMhZi?= =?us-ascii?Q?W9M3+52qSgPFZVHgq2AwSkjw0ekQVBj3dDUoHilRS6TgY8EGn5asF3KCtYG+?= =?us-ascii?Q?HSbQKV01z96eEq3qOqHBJGzjkuY/XHy1J5OBRnsotxR4lUWNjBv8Izj512Fb?= =?us-ascii?Q?69nDyFLdSqcaCJkt4F2y4QUDr4vEVIR7GY4hqCJgmh0OMiL6kFRyQXr+xiGX?= =?us-ascii?Q?Nw4QwPIMXABvPoKskTUvbtPDtiOhanbKMV5IbtWPlksWnBFNtQCX85g91MEs?= =?us-ascii?Q?OXwpEYFEBTIjGT2nZqCd7YiTpcrMa7D07m8+9OJVDZU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TcBdkPidykDDquSQCPizN2YYSEzSbeLS?= =?us-ascii?Q?q22cdVsWSHtvvy35PqbX4Q/STPkfAd1qzLukbElLGtcaTFMlSLEAQ2tM81WH?= =?us-ascii?Q?F2YY8gR8CG3cMUMwmpYi4YINecKCOBQn1kymIeTZr1fzqCSMZOzSH3Cfivdk?= =?us-ascii?Q?NT56CQoB6bDiQnI2Pas0Jm0joHzoIEGPDyoyF+MVt5mSIveVNeEyqoHqRlA+?= =?us-ascii?Q?IQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98c93aea-17a3-4f3e-c54f-08dc426afd03 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 08:04:06.1346 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lbjWib6zfVl+V4lwsKhJRWmwnHOFTWCgnzsqzIDKW+s1Apcsf1EF4gaWQNK/qBhjwlkhf0SysrxjVAqJCemsoWtPWVkBnTiZI2dd+dP9LmQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4987 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: Long Wu When user adds a queue flow rule with incorrect queue index, the rule can be added successfully but the packets are not directed to the queue. The reason is that queue action does not check validity of queue index in driver. Add code to check queue index in queue action. Fixes: 7493f8a527cc ("net/nfp: support queue flow action") Cc: Chaoyong He Cc: stable@dpdk.org Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/nfp_net_flow.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c index bd983aaf6a..ff6ce3ee45 100644 --- a/drivers/net/nfp/nfp_net_flow.c +++ b/drivers/net/nfp/nfp_net_flow.c @@ -564,8 +564,9 @@ nfp_net_flow_action_mark(struct rte_flow *nfp_flow, action_data->mark_id = mark->id; } -static void -nfp_net_flow_action_queue(struct rte_flow *nfp_flow, +static int +nfp_net_flow_action_queue(struct rte_eth_dev *dev, + struct rte_flow *nfp_flow, const struct rte_flow_action *action) { struct nfp_net_cmsg_action *action_data; @@ -573,15 +574,24 @@ nfp_net_flow_action_queue(struct rte_flow *nfp_flow, action_data = (struct nfp_net_cmsg_action *)nfp_flow->payload.action_data; queue = action->conf; + if (queue->index >= dev->data->nb_rx_queues || + dev->data->rx_queues[queue->index] == NULL) { + PMD_DRV_LOG(ERR, "Queue index is illegal"); + return -EINVAL; + } action_data->action |= NFP_NET_CMSG_ACTION_QUEUE; action_data->queue = queue->index; + + return 0; } static int -nfp_net_flow_compile_actions(const struct rte_flow_action actions[], +nfp_net_flow_compile_actions(struct rte_eth_dev *dev, + const struct rte_flow_action actions[], struct rte_flow *nfp_flow) { + int ret = 0; const struct rte_flow_action *action; for (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; ++action) { @@ -596,7 +606,7 @@ nfp_net_flow_compile_actions(const struct rte_flow_action actions[], break; case RTE_FLOW_ACTION_TYPE_QUEUE: PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_QUEUE"); - nfp_net_flow_action_queue(nfp_flow, action); + ret = nfp_net_flow_action_queue(dev, nfp_flow, action); break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); @@ -604,7 +614,7 @@ nfp_net_flow_compile_actions(const struct rte_flow_action actions[], } } - return 0; + return ret; } static void @@ -670,7 +680,7 @@ nfp_net_flow_setup(struct rte_eth_dev *dev, goto free_flow; } - ret = nfp_net_flow_compile_actions(actions, nfp_flow); + ret = nfp_net_flow_compile_actions(dev, actions, nfp_flow); if (ret != 0) { PMD_DRV_LOG(ERR, "NFP flow action process failed."); goto free_flow; -- 2.39.1