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 D801642C69; Fri, 9 Jun 2023 08:01:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E110442D12; Fri, 9 Jun 2023 08:01:32 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id F2AC041148; Fri, 9 Jun 2023 08:01:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q7Ja4DKGxm+V/zfB+vAy/8SacvgygGAZaEvzL00mlXyFPdbKJNqHzXozu+5tXu1wKtiAGg+JqQqj+tf1RG3uQoM7VDryhcJSBtCBIkxK6qVsMRn1SO8NUqssEvnmD6f9D4h6YwLQK07ZidAyfFstaERkt/3i+017gLMnYsUZRlMIFvMQAFtlA6zW0POIrpSpH9xZoBVERz3F7oSg7mpmp5Wn1tVxOv4JF/yO/Ws3KyLhdg4h7rxuSa0cvZ1bqNgkx1Y5vYlX+Oj0pROdw8zrQl6x9cWrORm/ylqvyLxDVo6vufY1SXIooswpX+WFC3GaAG5wcz51rmeqNrCv4/N8Bw== 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=lP487A+N934sP2MWkJW2LzQUQ+xouiNrNa+TXcQzqj8=; b=hwCc7ZvNCRwIm1QbnfiF7R411KGE+4I0CYscBtK17AlU+ruRFiYvl4xgQiBFyA8jZ4Nz6u22UGeXKectmlDJ7KDw9NNPBGGMIz81oH1b2QUfz1kBx34Yg2SgiN3O03mLaruCLXFIx+LpoiaKOQyU1WslnZc4QA1MX4sD3pjDDKbXwZYlcIVPJv50dcpzcOjnwqpqJY/h1vcqDKDbrG1apIEYSGX+aAIYq9nm3fwEeet0tU54Sye8KmOBaFARxE6g3Zqlbdr9p2gx4CLPgWnY6RdOMM0gYLyo+dSOTd1724o7R5vGBRU8Z4lRtu6JtzrB5IrxBe3JiFEyEDMuml9kkw== 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=lP487A+N934sP2MWkJW2LzQUQ+xouiNrNa+TXcQzqj8=; b=fOeg/8cL1uzvCuwvVTcoLrYiydtTj1ST6KNomoeqg9Oscn0CwYbS59dKJ6NaYEDOrOqSzrk20hgNOlvdYNzWZ45xYLgyRSlsUQvYTd5KXByNrOMUIxyCIk1y+xzoX8Th69kyfQpBI8LzoLyweuFlzy5dBDr2OccZm/VQSqGacQg= 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 CO1PR13MB5046.namprd13.prod.outlook.com (2603:10b6:303:f4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Fri, 9 Jun 2023 06:01:29 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::d2cb:a650:e1ce:2174]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::d2cb:a650:e1ce:2174%3]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 06:01:29 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Long Wu , chaoyong.he@corigine.com, stable@dpdk.org Subject: [PATCH 2/3] net/nfp: fix representor creation failed Date: Fri, 9 Jun 2023 14:00:59 +0800 Message-Id: <20230609060100.1306648-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230609060100.1306648-1-chaoyong.he@corigine.com> References: <20230609060100.1306648-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2P153CA0035.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO1PR13MB5046:EE_ X-MS-Office365-Filtering-Correlation-Id: dd33d3f3-0f31-4f43-2cba-08db68aef7b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L7bhrr8eHVQ1Yl9X8bXRd4a3lZ0DBtkWXSjQky8bwXYQtMgDObrUqMnpPBkKqIqvkikWOurzPUpdCmnOOaB65IVjQefTgBON0l/PjETmfZFxbkF9RuT2cLZ5P5reXllxJALqpUYGfKkasP/Vkfa5xOf2La59TCld+RIJpX1FV9Y4STiRU2QhdK6GMvwDRuEPQtaG9D2c2HEAA/1x6A3Rn2WZEfxq29kIRz+lxVHegL8ydefwcWVKrqBk45/U6HjYJ+zvx7PC11Y7PUze33aGeRPxBVtrfw1yHPee8n/ZEwsglxbV7avkXkkaU32BcEwCwjIn8wh9YZw2ri3pJQY5mCCzFMVbAGV1Tjn6Cik5MUo/CccQeh1NRYeAmm/d0UH3Mu6OhHnURfZXpesrhn8Kcn2sQLLIhy1lwkoEztl/5O8WA16TNd9K91AHGt6aSsKyTrf4Rhfq36oJprTjJCD46rMMi8XgqQL/s/l2eTyCS1lKSQxFCEEoXpPor35pBqT/i2MkeCbaB7HlJyq/oqPQxk7iGlYTGi/46q8SReM3A28QM7TFOfQWT3TGsFvpJacRwPaX1oSvgZvYb1dO4djGU8lgojsQuplyQJwxpTMDZRdPaw8ISiemY0C2Cy7zDrA3 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:(13230028)(4636009)(396003)(39840400004)(136003)(346002)(376002)(366004)(451199021)(41300700001)(4326008)(66946007)(450100002)(66556008)(8676002)(478600001)(8936002)(6916009)(66476007)(2906002)(316002)(6666004)(44832011)(5660300002)(6486002)(52116002)(6506007)(6512007)(1076003)(26005)(186003)(2616005)(83380400001)(36756003)(38100700002)(38350700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VlErcGJMZkRrK3VQNnlZRGFhWVplWDRJazZaQXJTUWowK0ljbEJyZkNhaU9z?= =?utf-8?B?OFdtbCt2eTlEWWl4R2tYUDhIUDZIRTNzcVhlQk1mYXhsWUU4aVFobFMrd2Q5?= =?utf-8?B?TEh4UjB6RFlhSFpxSHBoclZQc2d4VmQ0MSt1Y1BWY3RONWx2L2dwbUVCTGhJ?= =?utf-8?B?ZnlReVZVYm5CU1ZwTXNQR3RmUUdrQXY5TW9CWFAydmMvak5GUDIycFZLRTNh?= =?utf-8?B?b080STM3SnNBUnNpK3VWZ0hsYUJWL3FSL1Rma1FPWnozdVpnRDVQWDlvcEdO?= =?utf-8?B?MUJyOUpGTXdPanFaUnhvYnkyc3U3SUkxT0lLdlNzbDh5UkdIT05WeXVGUEwx?= =?utf-8?B?Tk1TK3h0UmFnUzI1aUFybElLeDVjNVhHdHJFQ3RWaitONlRyQk1TTVZlcEdO?= =?utf-8?B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-Exchange-CrossTenant-Network-Message-Id: dd33d3f3-0f31-4f43-2cba-08db68aef7b6 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 06:01:29.4715 (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: qvO3O/j9imNncQIZus90YkMJyiHHinD7B+NGKRH5bTq3+zTIWhlDfwU71Lh28j1SWO+QycK6TVCMgenVCpUhsffTlopG3XxvYxss4f9csTw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR13MB5046 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 The former logic does not consider the simultaneous initialization of several NICs using flower firmware. The reason the initialization failed was because several NICs use the same name parameter when we call rte_eth_dev_create(). We use the PCI address to give each NIC a unique name parameter and let the initializtion succeed. Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework") Cc: chaoyong.he@corigine.com Cc: stable@dpdk.org Signed-off-by: Long Wu Reviewed-by: Niklas Söderlund Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower_representor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 3225a4b84a..5118c9c57c 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -723,6 +723,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower) { int i; int ret; + struct rte_device *device; struct rte_eth_dev *eth_dev; struct nfp_eth_table *nfp_eth_table; struct nfp_eth_table_port *eth_port; @@ -746,7 +747,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower) /* PF vNIC reprs get a random MAC address */ rte_eth_random_addr(flower_repr.mac_addr.addr_bytes); - sprintf(flower_repr.name, "flower_repr_pf"); + + device = &app_fw_flower->pf_hw->pf_dev->pci_dev->device; + + snprintf(flower_repr.name, sizeof(flower_repr.name), + "%s_flower_repr_pf", device->name); /* Create a eth_dev for this representor */ ret = rte_eth_dev_create(eth_dev->device, flower_repr.name, @@ -767,7 +772,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower) /* Copy the real mac of the interface to the representor struct */ rte_ether_addr_copy(ð_port->mac_addr, &flower_repr.mac_addr); - sprintf(flower_repr.name, "flower_repr_p%d", i); + snprintf(flower_repr.name, sizeof(flower_repr.name), + "%s_fl_repr_p%d", device->name, i); /* * Create a eth_dev for this representor @@ -798,7 +804,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower) /* VF reprs get a random MAC address */ rte_eth_random_addr(flower_repr.mac_addr.addr_bytes); - sprintf(flower_repr.name, "flower_repr_vf%d", i); + snprintf(flower_repr.name, sizeof(flower_repr.name), + "%s_fl_repr_vf%d", device->name, i); /* This will also allocate private memory for the device*/ ret = rte_eth_dev_create(eth_dev->device, flower_repr.name, -- 2.39.1