From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 02D5C45B00
	for <public@inbox.dpdk.org>; Thu, 10 Oct 2024 11:17:45 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id E680A4064C;
	Thu, 10 Oct 2024 11:17:44 +0200 (CEST)
Received: from NAM11-DM6-obe.outbound.protection.outlook.com
 (mail-dm6nam11on2136.outbound.protection.outlook.com [40.107.223.136])
 by mails.dpdk.org (Postfix) with ESMTP id EE722400D6;
 Thu, 10 Oct 2024 11:17:41 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=L/TaQK0Ks0eAlZSZV8PQnNFdfXmVO3jH+YaLZ0TC/mXYyFMj/84/AD9j9T+p2+9KoQeQrJgrx3zxHNBKN2cmJeSiD1RXkPClJFk0bkdiEgwui02u4/YQ4OeqGznM72oMnRoGtBkDMOQktItoSXIrSHNvxT1cKFkKf395M0xZykey4WSaVxA3wNGpxI6/8RfxUwr2cjqD4L+VI+CViUxw/QEuZwbocR6JA+Y9m85aMaD6rb+XZMGLjidplOoL376lYLSXA5yOEvD7WjYimG0dE2YD4EJQryK4XBioWTvB7csy/nqORDsjaJh2BkaCLbFPjowzYX3Ab4X0PvOk4G2qMA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 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=EKadea9M6MeGbY4rGjlVCmx/DDemtsU0ZZfE2zS3ICA=;
 b=xTWufiv9dXy+tyvTauPB3bOXQll0z3AeTx66aqzmtL2uCSnc5u9fAzOoBcPOZ2bFImkRyP8AKcS92VPquoTAI8335zGxUZZnZZKwPl2RJINrtjO9Fkfa7BRSfR00Tm74R7Td1SS4IZ261M7Ds6PtAVks1R6jC1B0lAiPicvkmKrD30OCoAcFjuScYstncJNae6qmBFRbtdOht1L/n/LHUtSbmIAw7bEh3pw+XAoN2qSv1ofNR+T+vhU7bZFEnsNGMaEfPFw7LOw12pPnp017WfktKmgI7AhJsfBublhATAOgVHYKbiZyDUF9RJnvOHTwXm/hL8l8EbYoxb6q4K1W1A==
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=EKadea9M6MeGbY4rGjlVCmx/DDemtsU0ZZfE2zS3ICA=;
 b=W2+qYWqEbkxo0ca1g6na5XTiY1HcpvKjjPp8nJPs3dT/awDcYOjqwx6oyd1iqqnCAGaveWeOkA3XJ49fFmF4JCUf4rcveP1TBoliIeWXQDYpc5kArASmG56LWf2iyvUdkVjnHpKDEWoiKelMnvHDEbZRN07y6x+xBkTaApnclBs=
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 MW3PR13MB3980.namprd13.prod.outlook.com (2603:10b6:303:5c::15)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct
 2024 09:17:40 +0000
Received: from SJ0PR13MB5545.namprd13.prod.outlook.com
 ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com
 ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8026.020; Thu, 10 Oct 2024
 09:17:40 +0000
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
 peng.zhang@corigine.com, stable@dpdk.org, Long Wu <long.wu@corigine.com>
Subject: [PATCH 02/10] net/nfp: fix malloc name problem in secondary process
Date: Thu, 10 Oct 2024 17:17:08 +0800
Message-Id: <20241010091716.3631747-3-chaoyong.he@corigine.com>
X-Mailer: git-send-email 2.39.1
In-Reply-To: <20241010091716.3631747-1-chaoyong.he@corigine.com>
References: <20241010091716.3631747-1-chaoyong.he@corigine.com>
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: TP0P295CA0060.TWNP295.PROD.OUTLOOK.COM
 (2603:1096:910:3::15) To SJ0PR13MB5545.namprd13.prod.outlook.com
 (2603:10b6:a03:424::5)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB3980:EE_
X-MS-Office365-Filtering-Correlation-Id: dc111f84-b184-484f-d895-08dce90c63c9
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
 ARA:13230040|366016|376014|52116014|1800799024|38350700014; 
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?27h7u9vs9L3ztbbILJy7Mjt7FKT14czQ1p68bH9/VyOdyjkO5VJqd1/y4vxf?=
 =?us-ascii?Q?brILc9B3Kr3itBqM6hcKBpru/TiqR5Llt5g2qPKSnhVhYBowiwn3HxiaQp3Q?=
 =?us-ascii?Q?C/SWk7iOriV3aEu4wNmm+jSRbopj9a3TQPcOgmaJfoO7DoQ4PvSVAosSulib?=
 =?us-ascii?Q?Wh7IMod3+oiaWLSvAZVYGsnSIYB+POgMh+ZB4OSddaVq4nhFwL2czWr8ha5v?=
 =?us-ascii?Q?Dhl31DacQHT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/RBxs8pqg/PHdwlNCw9FunkiDiiyFAx?=
 =?us-ascii?Q?JH3HL/He977/EU2n9MHTRhNDT2FiHdtBmLpl9KlRny3UYyEmo+GTzLd9Derz?=
 =?us-ascii?Q?eNOzOWEHMlUsL/+qKZ/T7d4LJM+qSCGTDWZO74sNop5JjNxO+65puRJbJ/OE?=
 =?us-ascii?Q?cGZB0RrxSJDiPs9DYJICzUJNQwjz3UC088zzuMihTmlwW7FC2oxo4ZSI6wte?=
 =?us-ascii?Q?H6jNlEkhJ7not4doCcpNHWrrR9H/6vPwtBTtUqhwhqz4bA=3D=3D?=
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:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014); DIR:OUT;
 SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jAxgthDjreFcJfnUj8uE/rZcICN4npQ0xdwGQsdTQls1g+TB/9ji1lyR4EBk?=
 =?us-ascii?Q?2xpTH6O97oCQf6Om73fOzfQwMhy6z2ojs3O1i6mBlwb+csv8MVutkm9c25S/?=
 =?us-ascii?Q?THOowx1dBP6AdIkyKa9u+gL1ZJ3wKCySPqBBJhV0LB8mTKRnjJBKg9Mf3VSs?=
 =?us-ascii?Q?ebaLXJhoTVlgknjQ4cZ/tCg431YCcuRXXWfjm8Gtm7SBzJehjfVFDgscmOKr?=
 =?us-ascii?Q?MMEO1IcKIniojjGyGu5Z+Z8HeNnJV0g8zICM2zONRrwOfnpVT75E3PKrcs79?=
 =?us-ascii?Q?TYI6oVP26VpK8hHd5bFBeI09ghKpDQ+E2zts573P9SoLsNtY//w0jA8D/icp?=
 =?us-ascii?Q?rDJJtv88B6vxsXBK7mKnyom4yrnEkJYns4z21voqPuxlK3Rs9+Kklx1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-ascii?Q?5YFy7qhmDNfXM4UP4qDeCOTT7pCIZA9OTlwshz2NqMDktmOvmzUgIiUnD+nQ?=
 =?us-ascii?Q?z11bcphgiOJVgaAG1NVOCmckaHdtO4kZcRrBVervNH5V2f4tV91OcNVe2NAH?=
 =?us-ascii?Q?wjCatf5fz6gxo17OTsrP8Mgt569uChJdO7cGTrsSrrDIj2SNTbTlE3HUp5Fs?=
 =?us-ascii?Q?TRz9RuEGP14UHSotiph/F6RpVbtXA9EKSvlW1hkotuWr/njR1miS31LRGJ4X?=
 =?us-ascii?Q?aW6GrUHIb7B8QFhhDx2gPteADTmgnc7kag4OB5Imjg+vJpjpLbGhF4Xo+xum?=
 =?us-ascii?Q?BAHTb6CCmuEfxmoPHtFk50EZQXsffO3RS3/58Ljr5962nZAeNh26xNw7ahtH?=
 =?us-ascii?Q?3g=3D=3D?=
X-OriginatorOrg: corigine.com
X-MS-Exchange-CrossTenant-Network-Message-Id: dc111f84-b184-484f-d895-08dce90c63c9
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 09:17:40.4839 (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: h6vPpsZujtPxKVir3seQBpwgavcNiDP1bfm+3fQEdr/iisQ73OsZkmgsW25miIJfFiyJL2PKkGitcxeWJXOFDCu+LPREvd1R8AhaQgDhbIw=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB3980
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

The original logic keeps using the same name parameter when malloc
memory in secondary process, which may cause error when using
multiple PF cards.

Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 64a06440f5..3732abc9fe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2669,7 +2669,8 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
 	}
 
 	/* Allocate memory for the PF "device" */
-	snprintf(name, sizeof(name), "nfp_pf%d", 0);
+	function_id = pci_dev->addr.function & 0x7;
+	snprintf(name, sizeof(name), "nfp_pf%d", function_id);
 	pf_dev = rte_zmalloc(name, sizeof(*pf_dev), 0);
 	if (pf_dev == NULL) {
 		PMD_INIT_LOG(ERR, "Can't allocate memory for the PF device");
@@ -2714,7 +2715,6 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
 	}
 
 	/* Read the app ID of the firmware loaded */
-	function_id = pci_dev->addr.function & 0x7;
 	snprintf(app_name, sizeof(app_name), "_pf%u_net_app_id", function_id);
 	app_fw_id = nfp_rtsym_read_le(sym_tbl, app_name, &ret);
 	if (ret != 0) {
-- 
2.39.1