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 6A9B1A034E; Wed, 22 Dec 2021 10:27:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE73A40687; Wed, 22 Dec 2021 10:27:37 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by mails.dpdk.org (Postfix) with ESMTP id 8486740040; Wed, 22 Dec 2021 10:27:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VM6UY+3/2M+i6g2gAsKlNbLjv2/h2CqmlO+oPTpgEIcb7Ua08U0/GfijoZzMoGroN/0/bdqo5+NVSS7uOEk89OBImuPmj9e+FKRE+77P4gZMZ2L4xLJdNFBcn2kMiUuDtUN8uRMNJs79VWI6QRBobBgrNwyCwRNhJD7zr/LXiHAOLiB42rv0C5tfmNETrloit5HjXNPg/bodp/7rCjmQLrcPso5nhziWy+xBNMp+vCaIbX5YX3UsrePaV9yXyHQYGxr23kOg2nCMVKmpbj0/MQNmzOvpc8b1Bq1rQx2LabtsJDBSp7jedvBShgLdLHrwVp9XnybKhYUmHcf6v/SaTw== 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=RgHCX5Moi6nF2WHS29hnJMB+BIN8R73q2nrqOk4kblU=; b=JPALHgY/AlvQb10TrTS8oFvdFdcekaxw3m4tnCOrGO7IsvkGAld1sTTzu57LRWhrGIc6khwMqOPk2z1kCWeDDHUKN750oXzLwa0iGoJeyLFQF9FoWt4Wl32qwF9AlGDsCIBJukOjx6/pM4oZtAWGO3nqwozs5krWJOLTnh7sRxUvYM+LVSXBRp2XCdCpQxgH9wK7QlJ3wi+m1UfbV5dBQwUv2DWQkkIAgjtBvHDK4ZSouOpvIlYG4MTcC339P6rp3X7KNhYoQo78UjFMTdZ/znCl+XDEpNFfltz6V1DxWGVOMGeOPS/CDdNWw+jLc4whYhUkc8ETnn4nRFdrqAbWNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RgHCX5Moi6nF2WHS29hnJMB+BIN8R73q2nrqOk4kblU=; b=vC1jWPYcBPHT/rj1fZLR+jv9wnaTMxzLDsup9Cg37O8qBAuYz0H08gVJMjiOgJw2MyKCRa6uR0dU9nu6cgkakgtAvw4T8kT965efnm/h0IZVYFNSsp14R3FiGzU3S+DTzZ+QzWbswJSSKyl2sc0r6Uib1oZushjv+5wUU8DsppM= Received: from BN8PR12MB4772.namprd12.prod.outlook.com (2603:10b6:408:73::19) by BN8PR12MB3427.namprd12.prod.outlook.com (2603:10b6:408:62::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.17; Wed, 22 Dec 2021 09:27:34 +0000 Received: from BN8PR12MB4772.namprd12.prod.outlook.com ([fe80::f0e3:7554:e8d:ce1]) by BN8PR12MB4772.namprd12.prod.outlook.com ([fe80::f0e3:7554:e8d:ce1%7]) with mapi id 15.20.4823.019; Wed, 22 Dec 2021 09:27:34 +0000 From: "Namburu, Chandu-babu" To: "dev@dpdk.org" , "david.marchand@redhat.com" , "ferruh.yigit@intel.com" CC: "Sebastian, Selwin" , "Arsalan_Awan@mentor.com" , "stable@dpdk.org" Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware Thread-Topic: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware Thread-Index: AQHX55c3Zccbd8+00k6EShDY4vddU6w+W9NQ Date: Wed, 22 Dec 2021 09:27:34 +0000 Message-ID: References: <20211126102403.13223-1-chandu@amd.com> <20211202161034.519226-1-chandu@amd.com> In-Reply-To: <20211202161034.519226-1-chandu@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Enabled=true; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SetDate=2021-12-22T09:23:02Z; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Method=Privileged; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Name=Public-AIP 2.0; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ActionId=ab2a6fb5-a4a9-472b-8b26-ba52a3c4e30b; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ContentBits=1 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_enabled: true msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_setdate: 2021-12-22T09:27:32Z msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_method: Privileged msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_name: Public-AIP 2.0 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_actionid: 798b3cc1-3bff-436c-a873-b25ddccb3da7 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_contentbits: 0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 372c793d-e02b-43ba-4f15-08d9c52d498b x-ms-traffictypediagnostic: BN8PR12MB3427:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DO3/f3QvOpXXfVhyC69kN3r99+61GxSnndXpp8duLXWrNNprJ+2IPOTJoaFAj75pAGtqFVi1Qa8+GZP0nOVl+WqbntqZTpGIloQNxs3wqorLD7Yf/sdK9WuhYe+N3oLKi7Kamtnkoxo2jLxmm/aBruaOJKKwDq6HPfJONOcaVtBEoxtoseFvnVI+U3JuvvRvg+JNHNPHVoQfNwA+futw5G5tcQGeMNPmSDcssmGc/8lx9jz3KWDrMODi3kcxCil+7a4x8tii1fgWzUfjBKmx2SJPALFwCEOiAAovO0QVNK/RRpvOAqhP5XCHq5prP1rWFUj0GlrhTOFCatCUkSgOECyox1VhU1hQK7MOuU+ZAi93aoLFVLqlJbviK/zAc5nxrg+tOBiZ62yS1Id6UCe7FC22iYU6PaxRxZX0u/o47OhwC2xW78OfbjdgrumntEA2qKeaLSGe6uFyTs4/dpMD7XCLHJyzrL71puj0HLeeoqGgvMn/B4w9L/qVmxZ5u8GRsWuhPby/waSAUXa+gZ41ObFNqRP3im0qrKJUHkBVjqNhPJfjihQY4n1KUZZGn8sc/S3q6HGt6qHJEBQ4sOYv0JN11DU0cJ+4275m4dkHmznLz0K1eZdACSXY4Gxtx2ulTSUojDUCqXkiEAr9q13j6dgTeyH3ZuUYEJMwD0vZCN2wDG6K6P9bTDSZxsfcBNTkBlvp+FAPg9bq1786gjo5CQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR12MB4772.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(71200400001)(86362001)(8936002)(54906003)(53546011)(8676002)(316002)(6506007)(7696005)(33656002)(110136005)(38070700005)(2906002)(66446008)(122000001)(4326008)(38100700002)(55016003)(66556008)(64756008)(66476007)(66946007)(508600001)(83380400001)(76116006)(5660300002)(186003)(26005)(52536014)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uBml9zeMLqOHHrZPmqcpn50OUPmz/HsiAdFfR3gvtbPeZykmn+r/GF3Fy8Ke?= =?us-ascii?Q?HrLF1Ck+V15T5nmgyhRhIcKA3EdhecQrhzODCB14ORoDYodIohImX7fAYlfY?= =?us-ascii?Q?1CMhbKWBheKVcAFyVBjKy+/0ZZ6VxEShg68cXtA2TBwzOIO+OeEqN4fS5pOC?= =?us-ascii?Q?eqPuz/4CL7wMKvFALb3zz68O7bKb5/pnW0LmyU7JJCRL9aJZUpLQV30Q47OA?= =?us-ascii?Q?WgMKewclcTGUMFlSZrQXJcCbeHuhQ4DRBKBG5DKA02zqSL7ysRq65XMZSe5e?= =?us-ascii?Q?KjM7uOojKasuBObFRpVxrowNlCVVkmu1DLQTri+yRHY6YCkHIMMZ4QTLizU3?= =?us-ascii?Q?O0jVsXv3P0AKQzguWioyovxrsPCb6+ts4yaitVSTBiN3jY/I7pZE92pkKWN3?= =?us-ascii?Q?wcrE3yTKnRIyX2/KyxUQwcY6rf/4VaTYqSQSfpybCLYFnge1SAZJs1rqp2bk?= =?us-ascii?Q?+/D0yWDRWqzezv03szvXwlvhrdKz/GKXXKjYfrh0vIDiHLHDEC5FNZlfMyW7?= =?us-ascii?Q?KNUdj4JoMLRAe8by4ktceKhiBiFYFzioAbv239n9a95xsClwwMscuUSbSXM2?= =?us-ascii?Q?K91VAQb2UYIRzAF3xhm3gmP3r8BoNB7TErpeXsPGJDWsHllCiU+s/m51LGjL?= =?us-ascii?Q?z5y/AKfk4cqUSCiTmNH/wxJbQlaydYu0hGw8Y683uth/VMApAxYTzZDtawta?= =?us-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rmupRoO5O2rABOE9QE8?= =?us-ascii?Q?BQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB4772.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 372c793d-e02b-43ba-4f15-08d9c52d498b X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2021 09:27:34.6296 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RVeDaX/arRj+8LPuTtnJfuyQuEmR86BBzzqtxskNrYhMsZQ5PAYEeIB6lq8RF/qvfN40HXc97tapMvFE6g9+zA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3427 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 [Public] Hi David Marchand, I have submitted v2 patch with your suggestion in git log. Please review ch= anges. Regards, Chandu -----Original Message----- From: Namburu, Chandu-babu =20 Sent: Thursday, December 2, 2021 9:41 PM To: dev@dpdk.org; david.marchand@redhat.com Cc: Sebastian, Selwin ; Arsalan_Awan@mentor.com; = ferruh.yigit@intel.com; Namburu, Chandu-babu ; stable@dpdk.= org Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish A= MD hardware "bus/pci: optimize bus scan" broke axgbe on V1000/R1000. RV root complex pci device does not have any kernel driver assigned so it i= s removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions". Get root complex device id directly from pci sysfs instead of pci scan list= . Fixes: 991e0b1dbc4a (net/axgbe: add a HW quirk for register definitions) Cc: stable@dpdk.org Signed-off-by: Chandubabu Namburu --- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_eth= dev.c index 7d40c18a86..7b8d94ca3c 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -10,6 +10,8 @@ #include "axgbe_regs.h" #include "rte_time.h" =20 +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int a= xgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(s= truct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_= config(struct axgbe_port *pdata) pdata->power_down =3D 0; } =20 -static int -pci_device_cmp(const struct rte_device *dev, const void *_pci_id) +/* + * Return PCI root complex device id on success else 0 */ static=20 +uint16_t +get_pci_rc_devid(void) { - const struct rte_pci_device *pdev =3D RTE_DEV_TO_PCI_CONST(dev); - const struct rte_pci_id *pcid =3D _pci_id; + char pci_sysfs[PATH_MAX]; + const struct rte_pci_addr pci_rc_addr =3D {0, 0, 0, 0}; + unsigned long device_id; =20 - if (pdev->id.vendor_id =3D=3D AMD_PCI_VENDOR_ID && - pdev->id.device_id =3D=3D pcid->device_id) - return 0; - return 1; -} + snprintf(pci_sysfs, sizeof(pci_sysfs), "%s/" PCI_PRI_FMT "/device", + rte_pci_get_sysfs_path(), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function); =20 -static bool -pci_search_device(int device_id) -{ - struct rte_bus *pci_bus; - struct rte_pci_id dev_id; + /* get device id */ + if (eal_parse_sysfs_value(pci_sysfs, &device_id) < 0) { + PMD_INIT_LOG(ERR, "Error in reading PCI sysfs\n"); + return 0; + } =20 - dev_id.device_id =3D device_id; - pci_bus =3D rte_bus_find_by_name("pci"); - return (pci_bus !=3D NULL) && - (pci_bus->find_device(NULL, pci_device_cmp, &dev_id) !=3D NULL); + return (uint16_t)device_id; } =20 /* @@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) /* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ - if (pci_search_device(AMD_PCI_RV_ROOT_COMPLEX_ID)) { + if ((get_pci_rc_devid()) =3D=3D AMD_PCI_RV_ROOT_COMPLEX_ID) { pdata->xpcs_window_def_reg =3D PCS_V2_RV_WINDOW_DEF; pdata->xpcs_window_sel_reg =3D PCS_V2_RV_WINDOW_SELECT; } else { -- 2.25.1