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 6208BA00C2; Sun, 1 Jan 2023 14:47:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 009B240693; Sun, 1 Jan 2023 14:47:44 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by mails.dpdk.org (Postfix) with ESMTP id D0CB840689; Sun, 1 Jan 2023 14:47:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YKM5Ea3app1v/nUTdcbmEt3VLwT9yCimdXBPeXlNRXGueam/Dg5g2Mr+796QeMPqFZrO37EVzju5ibdsvo50FGTyv9m5i7B5TZiWQYJqtlxe6UGyjzk3zAIqQar5mvnig4I/g4rsRuxFJz5OECHgNe4oWjHQh6ztJRXwkC8h0IPtHIZ6sdq6wVbfB2/0s1P/wvJM2WKZ2Fe5mjMKxTA4byyv/qDaXSFs1e8PpNVVOsOBKLtKiijsTneNCck2ZF/jUyzMlkgov22AA94d3Row/Pnpjt7Ch/ohdAZ+oISB8RPKlWUiaeO9pnbRGmK3+6ZaZ98+bcBfCqV3z7DCQcG2oQ== 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=HmtJOQgnSH0BXOPImpTanxK/SYMj6aqUmv+EK4cRjnw=; b=TUbHrxZXeGvQYb6Mu3ogJ8tZ1cWNvuJetqeaxM4x2ulG+lxDlE1jyBRdA4+uSwH+IoSsMSkm5ZQrijW/T1ZSRhg4pqRgBmvmlsYdXqOAAzLwQdDVHuKBb3YTKkwB/2mexBp7w7CIGwnoX5NYDKDlBGBFj18R3sYfCQ0UNtBR1iyL5EdXFkhc0WUTWnUxadwiyOUtrROOrp12icvTgsX7zisza62QTAAMRQW0xqYoZhbZ/f3N6iuP2O8dfMgP5mfqgW5qAlIYzWsxSzcu8R6z1hU5WbtVnRUJqcLwliYiMA012OFg40jYlqEyhsIezKNOVPD0OJJr2ltuc5CK40KWeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=HmtJOQgnSH0BXOPImpTanxK/SYMj6aqUmv+EK4cRjnw=; b=JxdXzJ4gZYTT3VnRqwY2if6tqzmN0mc3I+2A1YfmPXat6pdjj1IivlbM9J0UmX5Eposim7RAVFsffusvO3FYB93FJva1+hqHx+la506ILsvwknC2bAo/zZhIEzVVfHRwDo9LT18TINOQhgGsm1BhPflQKnPXRgrY7o/HfRjp6vEQk5Ztxpd8i2S+5sN9LqL8Im3vQF95aFDm0RYpzlg+Iu1pmJfgUAwLoqyr377jt4MdlUO/gNkjqtJvPXR0kFhVgatvJtUpbIqQOVyCRzYUJMBYym5s8PVunhzMewq22bMdcBLaxXyDMwdKKWml4QnruOLeHSf43xHvYonOOqwRqw== Received: from MN2PR03CA0014.namprd03.prod.outlook.com (2603:10b6:208:23a::19) by BL1PR12MB5802.namprd12.prod.outlook.com (2603:10b6:208:392::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.18; Sun, 1 Jan 2023 13:47:39 +0000 Received: from BL02EPF0000EE3F.namprd05.prod.outlook.com (2603:10b6:208:23a:cafe::6) by MN2PR03CA0014.outlook.office365.com (2603:10b6:208:23a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.19 via Frontend Transport; Sun, 1 Jan 2023 13:47:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by BL02EPF0000EE3F.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.10 via Frontend Transport; Sun, 1 Jan 2023 13:47:38 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 1 Jan 2023 05:47:35 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Sun, 1 Jan 2023 05:47:34 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36 via Frontend Transport; Sun, 1 Jan 2023 05:47:32 -0800 From: Michael Baum To: CC: Matan Azrad , Akhil Goyal , "Ashish Gupta" , Fan Zhang , Kai Ji , Thomas Monjalon , , , Subject: [PATCH] compressdev: fix end of comp PMD list macro conflict Date: Sun, 1 Jan 2023 15:47:20 +0200 Message-ID: <20230101134720.1709991-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0000EE3F:EE_|BL1PR12MB5802:EE_ X-MS-Office365-Filtering-Correlation-Id: a4bb111b-98c6-4cc2-7ab4-08daebfebf4a 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: QjYb4RBeHccPVYwa1NDQp6evtBk5DWzB/rDKBmIC+p86CUPQaC6KyReLZ6tG5cjzivtSWvGrwUqphfb5rPFBK4hJC08gF1FZOJo93KYTFeVYTCpusPtswKPndnsh3V1zs5G6e840lIG6prsbraxDtmoVDdeWDz0Lbzk7G/780Pw+823TmioOuFQLXY2ptluTn6ibfKFh59BQpoZ3jCGO+ykBkHhG+pLpnGPJIruIXAG9g/oqlV6Rr0kZM2S/r+Ios5uKhZPNIk0oqwhSaJkmywOjGxXxveTYLy/cOzVkG8ec672VrhX3Fb236ANjBQXuw6+3GI2buq+3+v17X3HRE/QoeKW+DUSj9z7KMpx4cVrQWhumoE4BDBkhTuKmBtcp0NMeKNYaG3H+edw6aVccZjSo2qNyYrz1SEIWzal5ughwWe0cacATQMYtz7g1J3Ygp1PBrirT84z3k80ALB6fiUTmY+5jcuQJHxZtYX4eFGUeSRrLXo2zeWV0LVrvHnEuTm7PK4ocwpYeGQS1QtuGldlurZ96FUmTYScdhpSWET3vmxDbisj8p7vhCwcNNOK/ezi+MS1Gk8KO34uQ+b4DPCb9T/ns0SeCHCZ8jj+GhChIYf4ypGIZs3lMTGxwqE+8Hv5OYYZmBaKH/Em4/lhMm9iMfbXxy1NSU5rddsq8Ojb/X24OfPgQZ98uwy8Q/H6bLIZ9rHadzAK0lNMmmzVeJ16VjHXoefBaSr9Ne9pSgZ+6jomqusE0Y4/S6jR/689E7pYW4zXajQZeH6rMOD3ec+T3Mmzl6ZR51rexQk9/7eY= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(396003)(39860400002)(376002)(451199015)(46966006)(36840700001)(40470700004)(6666004)(7696005)(36756003)(478600001)(82310400005)(36860700001)(86362001)(55016003)(40480700001)(82740400003)(7636003)(356005)(40460700003)(426003)(6286002)(26005)(186003)(1076003)(336012)(2616005)(83380400001)(47076005)(5660300002)(70206006)(4326008)(8676002)(70586007)(8936002)(2906002)(6916009)(41300700001)(54906003)(316002)(22166003)(141333003)(181643002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jan 2023 13:47:38.7864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4bb111b-98c6-4cc2-7ab4-08daebfebf4a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0000EE3F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5802 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 --- After this change, I'm not sure about the purpose of "RTE_COMP_ALGO_LIST_END". There is no any other use of it in DPDK code, and it isn't represent the number of algorithms supported by the API since the "RTE_COMP_ALGO_UNSPECIFIED" is part of the enum. Due to the compress API is experimental I think the "RTE_COMP_ALGO_LIST_END" can be removed. 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 -- 2.25.1