From patchwork Wed Feb 1 15:35:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 122873 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D154D41BA0; Wed, 1 Feb 2023 16:35:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61C2242D32; Wed, 1 Feb 2023 16:35:56 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2079.outbound.protection.outlook.com [40.107.92.79]) by mails.dpdk.org (Postfix) with ESMTP id 0D9E642B8E; Wed, 1 Feb 2023 16:35:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1nX/5U5+TsrQo/4WErulSnd0H/bGytUNw/HAxB7e0LGQ+0CVA5gUmPO9MgbqWSvVgwlRQQK1afc7wqBnjZOnm7mTLeJCB8OcALY8r5gv3lujYeo8QK7eLuO259CvSi1YOGuj/PH1aUDrzrFDW5HVczrCFUp+AN6MyO4D10HsqNrg3/8yCjdtRZLGov7PA7cRONucrFUzUvONqU4sIZt1ebVcEIY8xTL4ZThy9jeIfAUTq319TRwc4BGTp/4DTl8pz+L9sjmffR2ivvZMgI8NKTi0JcTkl3J3/MHOodlegtpB9VdQSKcngrdVK/jOWDRcPKSeixuFZW1AvY2SEqZgQ== 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=I9kQfpPIyHOxKzzgaUWwlFzIOMwBAX9r5XhVIdT//aU=; b=kd1K9glBmu78tUwf0PWP7YQHwTDg/dixe9vhV7OvBc0RfXXXScqHgOUZcErzrd90tFmzdn/mQ8ED4M8qQ8LL2JhBg3Bmob1sxXBBecgxQ0LQaLqfFKHAKMQ78YukpWPStFdBxCeyhPR/vZcEOxcR+H6m+HXrw3HzldtudrBwIwTUZId8Q+pk6+91edwNMLDiA10xsB6WL3yv1aXjN2KerAGfwB2qvWPodfxFIJtS5BWLLc4sJhU+mEd0Da+H+DFPa00ImAoKP5qzQCCkPKLstm/KompbMZrFVluyR0Zlv5ePx/UZd//QwldDWU4HOseSSkurXdbDi/eeXPvy+9Pb0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I9kQfpPIyHOxKzzgaUWwlFzIOMwBAX9r5XhVIdT//aU=; b=IfjJpnR/l7fFa1japQc2dd2t9PlgqB3cUIm3cwZkvA41muGgHsGgMQF4lxZIV8g4E7HYCzhK52ycxCpUeGjq1LAcF85NQ41dhZcgkO5L9f8d7xAd0t4bXLYQMIJHPV1rBY17JlnPKwmKWcMPhl7ZWhjiADSuPOpJdM9E6KBPwr628WYah7Ew4ao2sNX5NOxH4jY1RXH/dQrnC0KD9iHB5b4kx6cb7Q1voIHhljejEAw1YUpU8//V4+DQdBjTavGVFYtPJ/rjY2Nl88jbcti/h2JjV1h2L8adtHneDhMmJDSWbaXBDseKGouhOP6OeWGILjvphqshIl8MD3qQIZHuXA== Received: from DS7PR03CA0030.namprd03.prod.outlook.com (2603:10b6:5:3b8::35) by CY8PR12MB8242.namprd12.prod.outlook.com (2603:10b6:930:77::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25; Wed, 1 Feb 2023 15:35:51 +0000 Received: from DM6NAM11FT096.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::43) by DS7PR03CA0030.outlook.office365.com (2603:10b6:5:3b8::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.38 via Frontend Transport; Wed, 1 Feb 2023 15:35:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT096.mail.protection.outlook.com (10.13.173.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33 via Frontend Transport; Wed, 1 Feb 2023 15:35:51 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 1 Feb 2023 07:35:41 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 1 Feb 2023 07:35:40 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36 via Frontend Transport; Wed, 1 Feb 2023 07:35:38 -0800 From: Michael Baum To: CC: Matan Azrad , Akhil Goyal , "Ashish Gupta" , Fan Zhang , Kai Ji , Thomas Monjalon , , , Subject: [PATCH v2 1/2] compressdev: fix end of comp PMD list macro conflict Date: Wed, 1 Feb 2023 17:35:30 +0200 Message-ID: <20230201153531.912219-2-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230201153531.912219-1-michaelba@nvidia.com> References: <20230101134720.1709991-1-michaelba@nvidia.com> <20230201153531.912219-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT096:EE_|CY8PR12MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e4209e4-6014-4e56-f8ff-08db0469ffee X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AfspWeU8ZGa2ovsc8RpoACkmKYd8heWemVfPJkr8xwGbdByOmxoHubJEo35TalLvP14ImzupxnmqBqRm8pjUlhbqjlGjtzYJT02hYTScHagOFem1pRyK8s9SpAQs1PbaABKct7dCke8ytQDUPFAGyYmHDGGWNjclocvo48XIPiIEfd2D2SAnHUo527pmGyNOGvDf8RYqRwkchYSzH2iCG3c3PIyZOZA/4SK84IwsB/z1UB1fenHhBig+qwsthCWKc/HhqNuskv5dRyDY8wQMW90txDaEcsfiIDU+JPcbRZq2bPlaOr9cS2Bluyf0jEkj5X5fWnIoRbEEPBi+7T61khH8+PYXImtsMEF2o1hLgWhn+c+7xPMwh43qegp/xh1xozVT5tZNOKuWtIEA2saV+g5KkCtUXcle+6Vx3u6yLh6oWBUh/DofbzaAWSIs0sVb/hcs/VGyPrACQwGpyQ7GHv7MbjasnCFmai6cykJ1iQ+6afbvHcxW9iWM81/Dq0Y4YVBha2Vvj/MHCp2rwQNYRHeZb/w/OL9Ry8LQSzILYsCyY1WL4DzrbM6dURTFYfmW36uktQfxCkB7ZVW68Ota9yquMeo4GZWrYhXI5kn0lqyu4A9OlKlmDSzsL/PHHV7o50W/NdwN4V0N1SrBD32tsRHIijRRhtf82/oOqmSQ2gR7eyQWKPyrv/oWy3GQ0O9JVzmPtKicxCVQowneHSnha8PL/dmb5Ykqrnw+StV47JZbcDET9cGKjBG3tbi+V/aU X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(39860400002)(136003)(346002)(376002)(396003)(451199018)(36840700001)(40470700004)(46966006)(40460700003)(1076003)(36756003)(478600001)(40480700001)(55016003)(2906002)(7696005)(54906003)(5660300002)(6666004)(86362001)(316002)(36860700001)(336012)(426003)(83380400001)(70586007)(4326008)(6916009)(70206006)(47076005)(6286002)(186003)(356005)(26005)(41300700001)(82740400003)(7636003)(2616005)(8936002)(82310400005)(8676002)(141333003)(181643002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 15:35:51.3423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e4209e4-6014-4e56-f8ff-08db0469ffee X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT096.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8242 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 The "rte_compressdev_info_get()" function retrieves the contextual information of a device. The output structure "dev_info" contains a list of devices supported capabilities for each supported algorithm. In this function description, it says the element after the last valid element has op field set to "RTE_COMP_ALGO_LIST_END". On the other hand, when this function used by "rte_compressdev_capability_get()" function, it uses "RTE_COMP_ALGO_UNSPECIFIED" as end of list as same as the "RTE_COMP_END_OF_CAPABILITIES_LIST()". The mlx5 and qat PMDs use "RTE_COMP_ALGO_LIST_END" as the end of capabilities list. When "rte_compressdev_capability_get()" function is called with unsupported algorithm, it might read memory out of bound. This patch change the "rte_compressdev_info_get()" function description to say using "RTE_COMP_ALGO_UNSPECIFIED" as the end of capabilities list. In addition, it moves both mlx5 and qat PMDs to use "RTE_COMP_ALGO_UNSPECIFIED" through "RTE_COMP_END_OF_CAPABILITIES_LIST()" macro. Fixes: 5d432f364078 ("compressdev: add device capabilities") Fixes: 2d148597ce76 ("compress/qat: add gen-specific implementation") Fixes: 384bac8d6555 ("compress/mlx5: add supported capabilities") Cc: fiona.trahe@intel.com Cc: roy.fan.zhang@intel.com Cc: matan@nvidia.com Cc: stable@dpdk.org Signed-off-by: Michael Baum --- drivers/compress/mlx5/mlx5_compress.c | 4 +--- drivers/compress/qat/dev/qat_comp_pmd_gen1.c | 2 +- drivers/compress/qat/dev/qat_comp_pmd_gen4.c | 2 +- lib/compressdev/rte_compressdev.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index fb2bda9745..459e4b5e8a 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -96,9 +96,7 @@ static const struct rte_compressdev_capabilities mlx5_caps[] = { RTE_COMP_FF_HUFFMAN_DYNAMIC, .window_size = {.min = 10, .max = 15, .increment = 1}, }, - { - .algo = RTE_COMP_ALGO_LIST_END, - } + RTE_COMP_END_OF_CAPABILITIES_LIST() }; static void diff --git a/drivers/compress/qat/dev/qat_comp_pmd_gen1.c b/drivers/compress/qat/dev/qat_comp_pmd_gen1.c index 12d9d89072..3a8484eef1 100644 --- a/drivers/compress/qat/dev/qat_comp_pmd_gen1.c +++ b/drivers/compress/qat/dev/qat_comp_pmd_gen1.c @@ -26,7 +26,7 @@ const struct rte_compressdev_capabilities qat_gen1_comp_capabilities[] = { RTE_COMP_FF_OOP_LB_IN_SGL_OUT | RTE_COMP_FF_STATEFUL_DECOMPRESSION, .window_size = {.min = 15, .max = 15, .increment = 0} }, - {RTE_COMP_ALGO_LIST_END, 0, {0, 0, 0} } }; + RTE_COMP_END_OF_CAPABILITIES_LIST() }; static int qat_comp_dev_config_gen1(struct rte_compressdev *dev, diff --git a/drivers/compress/qat/dev/qat_comp_pmd_gen4.c b/drivers/compress/qat/dev/qat_comp_pmd_gen4.c index 79b2ceb414..05906f13e0 100644 --- a/drivers/compress/qat/dev/qat_comp_pmd_gen4.c +++ b/drivers/compress/qat/dev/qat_comp_pmd_gen4.c @@ -25,7 +25,7 @@ qat_gen4_comp_capabilities[] = { RTE_COMP_FF_OOP_SGL_IN_LB_OUT | RTE_COMP_FF_OOP_LB_IN_SGL_OUT, .window_size = {.min = 15, .max = 15, .increment = 0} }, - {RTE_COMP_ALGO_LIST_END, 0, {0, 0, 0} } }; + RTE_COMP_END_OF_CAPABILITIES_LIST() }; static int qat_comp_dev_config_gen4(struct rte_compressdev *dev, diff --git a/lib/compressdev/rte_compressdev.h b/lib/compressdev/rte_compressdev.h index 42bda9fc79..7eb5c58798 100644 --- a/lib/compressdev/rte_compressdev.h +++ b/lib/compressdev/rte_compressdev.h @@ -353,7 +353,7 @@ rte_compressdev_stats_reset(uint8_t dev_id); * @note The capabilities field of dev_info is set to point to the first * element of an array of struct rte_compressdev_capabilities. * The element after the last valid element has it's op field set to - * RTE_COMP_ALGO_LIST_END. + * RTE_COMP_ALGO_UNSPECIFIED. */ __rte_experimental void