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 7F94043103 for ; Fri, 25 Aug 2023 20:44:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7910F42BC9; Fri, 25 Aug 2023 20:44:13 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2080.outbound.protection.outlook.com [40.107.223.80]) by mails.dpdk.org (Postfix) with ESMTP id E8038400D5; Fri, 25 Aug 2023 20:44:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jC2ynYIKP5sXSQeih4U+PyXecQQE2g0RB4tKmr8Py6CdumCG1XZN3m1WMveHijWRsI8Pmm+qetaDJEkNM8eCKgJL++gtm357vzOuH7GJD6gs5fYRp82ko4ahiAWUkl/wfcM6V/YivJLDb5WbS5pPMUxwW3Et/ZgGeaZkPGR99JYWosHrD2ExNH5wmZB+XUm+VZBIkGkC992DAWOu4lPDbg4hiyeV00EYuzHSEWWC+Ga29f1AVJitA41ynSMSIJ8BUAecPaA6iXW/gLSRKc6hoqr5PHjvmmIQGg/BzRsdaML2SpLoo8oV8mtnwA2fxTPVTdUR18ngTo1K8o6czFw8+Q== 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=NEhthegbpCTmk+snHU7Bh9/s8MYYjo+mhXIgAS2hhG8=; b=JUMFrXPOgTKOEhtU7kEzPeSdZtlEY4h3f12E/IbECQjX9U51HR3Dc+a+ho+ALr7fgVpkARL728Vn4n2mK0OUAm0URSDMvP2dHY9DHhtSARMRB7khnH6DujwNUZxqku3O9AEZbqRG8oTJKNzyuc43O50BWjnW+cNXn7uFQO/j30tsHBKiuP8ywwNaRaosDe0CVxb14U67p8n9RL9Q4Rp1a0sAs4h1hO4ekBHyH3FOM9NM6D4+md3T1aMyRmxRqvdLEg5tvxLbp9RAZobf+6oZk2KmXZFMgYSUjlRUlZJqnrSH8WhGhz6dFz1miRBW4kKYgF9LSMBLMHbtN7GctJ9J9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=NEhthegbpCTmk+snHU7Bh9/s8MYYjo+mhXIgAS2hhG8=; b=UfnvDlGfzphMuvvTyy8N84ZOEYY+i9ZJv5897UTQVBSSYRlv6Gzx6AzOZrdUd0nM2c3oG+r9rAeXhJY3N7ZnHT7e6GEsF0F5OUWd8/1W8f/TYeoiEAV9MBNyj3gtApeNOkwMewVp6VeazPOhwDC7n3w+P3vBgz5bkRCM3tc5kA6nuBQBMKBAUllniurIEqZ4bxPatBrAt3I4XwzEb/ukjMuvQgRjtCK9zztL3gJtHQLrD85xTMx43+UnUcsLcIEinzA6hSB9flgZyedUEQ8POUpRL39P/P9LUSEFF0FtBOz4KPrMzRxG30/eB33Pk98dPJv0DvfFekKjpWcVzjmG4g== Received: from SJ0PR03CA0338.namprd03.prod.outlook.com (2603:10b6:a03:39c::13) by SA3PR12MB7998.namprd12.prod.outlook.com (2603:10b6:806:320::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 18:44:09 +0000 Received: from CO1PEPF000044F1.namprd05.prod.outlook.com (2603:10b6:a03:39c:cafe::60) by SJ0PR03CA0338.outlook.office365.com (2603:10b6:a03:39c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.25 via Frontend Transport; Fri, 25 Aug 2023 18:44:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044F1.mail.protection.outlook.com (10.167.241.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.14 via Frontend Transport; Fri, 25 Aug 2023 18:44:06 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 25 Aug 2023 11:43:51 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 25 Aug 2023 11:43:48 -0700 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou CC: , Subject: [PATCH] net/mlx5: fix jump ipool entry size Date: Fri, 25 Aug 2023 21:43:30 +0300 Message-ID: <20230825184330.3334318-1-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F1:EE_|SA3PR12MB7998:EE_ X-MS-Office365-Filtering-Correlation-Id: a3b57dc1-619a-45ce-615a-08dba59b4355 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5P6bUzvuDWFuD/Ps+bzZJJqY2oe09CBX5Oay++U6d/zp6Pa9GYqvso5I6vCehqKVm//U+aiy7Pz4wJ8pSycXWU06BrU8dpr+VyQVsUOz/HCq8G+HnDfZj0JKHPmqDzfGc7A+st/Eevwg4DXdx5oNk19jhydExSlEaXdmRJHL0NdfAGHyxV3uKgFoa9Y+msVFFn5JLa2wVucxaem4VUwE4SlttRELPmpKJ0XM6jSjIcKa8yYCERYqPwrVZachO3Tb7cpBJ2H/xg+XsuHZr5ttaidT8W93dMX0p5WMkU2JPx1DiDZGMhiaNKz/EWlxZy4XqQ64mkQhw7wdYvGVjE6my1aCdPfDC1/qCzEvatBkHIY2F90Lt1JJGqZhj8vXiGS5pr+gq3lqC6D/v4oJlJxxfYEjI0vG+gR4WRaOuTxduELXFMVutqp2tYCXENmU9YXRdskEowot9AwImxRVJ74hOzdkfVx4XeOvmfL2MdVp9oBvWuWDAhYOnWsK0vuiOM3F4qw1JQtaXRtFkJdJjHGIEIGKMpgFBV2Qm9KEAHfvrccON7Ftd4Y4b441SWRJq2nvsGDpbnq35jH3ycFyJRZGXLV6/6w12KIPHuQwjCVC4MrT9FtXZJrhu9bc5QAS0Yul5JII/XCJbOF8NYOebKJI+HjjfIIh+fFphQ8YFZTl3blwo7uHTijkdFTBBYmyQEBA542z2601lHbzYlExZxofkpJsm53SxdNlG66kuR/LgAL9fC8Ex6sSW9zWcTtR/ctE X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199024)(82310400011)(1800799009)(186009)(40470700004)(46966006)(36840700001)(450100002)(356005)(7636003)(82740400003)(40460700003)(8676002)(4326008)(8936002)(54906003)(36756003)(41300700001)(7696005)(316002)(6666004)(70206006)(70586007)(110136005)(86362001)(6636002)(55016003)(40480700001)(47076005)(478600001)(26005)(16526019)(1076003)(336012)(36860700001)(83380400001)(2906002)(426003)(6286002)(2616005)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 18:44:06.9677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3b57dc1-619a-45ce-615a-08dba59b4355 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7998 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org In mlx5 PMD, MLX5_IPOOL_JUMP ipool configuration is used to initialize the ipool containing either: - flow table entry when DV flow engine is chosen or, - group table entry when HW steering flow engine is chosen. Default configuration for MLX5_IPOOL_JUMP ipool specified entry size as size of mlx5_flow_tbl_data_entry struct, used with DV flow engine. This could lead to memory corruption when mlx5_flow_group struct (used with HW steering flow engine) would have bigger size than mlx5_flow_tbl_data_entry. This patch fixes that. Entry size for MLX5_IPOOL_JUMP ipool is chosen dynamically based on device configuration. Fixes: d1559d66ed2d ("net/mlx5: add table management") Cc: suanmingm@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski --- drivers/net/mlx5/mlx5.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index b373306f98..7c79cbb7be 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -241,7 +241,12 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = { .type = "mlx5_port_id_ipool", }, [MLX5_IPOOL_JUMP] = { - .size = sizeof(struct mlx5_flow_tbl_data_entry), + /* + * MLX5_IPOOL_JUMP ipool entry size depends on selected flow engine. + * When HW steering is enabled mlx5_flow_group struct is used. + * Otherwise mlx5_flow_tbl_data_entry struct is used. + */ + .size = 0, .trunk_size = 64, .grow_trunk = 3, .grow_shift = 2, @@ -904,6 +909,14 @@ mlx5_flow_ipool_create(struct mlx5_dev_ctx_shared *sh) sizeof(struct mlx5_flow_handle) : MLX5_FLOW_HANDLE_VERBS_SIZE; break; +#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H) + /* Set MLX5_IPOOL_JUMP ipool entry size depending on selected flow engine. */ + case MLX5_IPOOL_JUMP: + cfg.size = sh->config.dv_flow_en == 2 ? + sizeof(struct mlx5_flow_group) : + sizeof(struct mlx5_flow_tbl_data_entry); + break; +#endif } if (sh->config.reclaim_mode) { cfg.release_mem_en = 1; -- 2.25.1