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 231BDA0C4C; Wed, 1 Dec 2021 10:01:07 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9D9B411EE; Wed, 1 Dec 2021 10:01:06 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 9BBDC40E78 for ; Wed, 1 Dec 2021 10:01:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638349265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2VavLWzx7CiJVn1C9ucVeZSXydlk3vbrLJwsWeXv81c=; b=VE15ydqzo0+t2MYWBPDZBbGUnu4/tVAZbpJETdSJLxlwkvWT+G2Xhp3JOmXlYsBwc/Min9 i9LLrfI7HytCbo2z0s5+ebhNdJP9K04Xh4h18oMj+lzYw2AtzPj24hsCxqSA8X3HL1hd6k r+XfkZ2RxjdGoi/GMJy6v1mKij+QEV4= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-378-Ph2d8BFoMPODrhfFIULfTA-1; Wed, 01 Dec 2021 04:01:02 -0500 X-MC-Unique: Ph2d8BFoMPODrhfFIULfTA-1 Received: by mail-lj1-f199.google.com with SMTP id b14-20020a05651c0b0e00b0021a1a39c481so8478646ljr.3 for ; Wed, 01 Dec 2021 01:01:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2VavLWzx7CiJVn1C9ucVeZSXydlk3vbrLJwsWeXv81c=; b=DcpG2HvGSk88ACYxUG9dkA/wPn1bpJxnvCoNmmEEszM+q9nrDweSPoHqKLneybJTM8 JUx/6/YJjV4gCmtGV2ZWCyNN+A6LUPeHLjC7z6eLZk1J3K+4uvxMjZEHFepXu3LJBQzv bkdd9BxNS5unodbbj2R7Hv+Kvf1HO75TSWQZ+6TU7gZEn2pfyj4ToTUnglO+saDMAb9r Czcgrd+9JYPArd7hBLinP8NuaZjQxgOt8CVTHX4ooaM01WTg2JpAB/50mhq700LdiXnA AL/+rT6pTe0ff34K45sngu1KZBUu2tQAm250eRChfTsAXwla454111hSgFFrwed41U3U daBg== X-Gm-Message-State: AOAM5309ViOYNI0Lj+W6Jpe8a/wL+DI0vFgb58wuZrduCThoD0vBtv1r 83q8vDg5zFWrOAu5Ua6isMVUZbJUV+QVk9g9b4rLsYCu7rsXBLZNzczAGMdwH/P9q5KeCUy1/tV WZ5YsQoC+Ka3acdBf7cw= X-Received: by 2002:a05:6512:aca:: with SMTP id n10mr4737026lfu.265.1638349260911; Wed, 01 Dec 2021 01:01:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbg2dAlosC3dCfSma1IFEUJXoVALWAe4noGcOLwOL60XUTyx0Y2fsW6iEjxkIdcoSKWNNSQiaAEPK8mlrcxnk= X-Received: by 2002:a05:6512:aca:: with SMTP id n10mr4737010lfu.265.1638349260678; Wed, 01 Dec 2021 01:01:00 -0800 (PST) MIME-Version: 1.0 References: <20211126102403.13223-1-chandu@amd.com> In-Reply-To: <20211126102403.13223-1-chandu@amd.com> From: David Marchand Date: Wed, 1 Dec 2021 10:00:49 +0100 Message-ID: Subject: Re: [PATCH v1] net/axgbe: use PCI root complex device to distinguish AMD hardware To: Chandubabu Namburu Cc: dev , Selwin Sebastian , Arsalan_Awan@mentor.com, "Yigit, Ferruh" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 On Fri, Nov 26, 2021 at 11:24 AM Chandubabu Namburu wrote: > > "bus/pci: optimize bus scan" broke axgbe on V1000/R1000. > RV root complex pci device does not have any kernel driver assigned > so it is 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 Please end the sentences with a '.'. As you described, this change is a fix. Please add a Fixes: tag and Cc: stable@dpdk.org in the commitlog if you think it should be backported to LTS releases. https://doc.dpdk.org/guides/contributing/patches.html#patch-for-stable-releases > > 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_ethdev.c > index 9cd056d04a..26babde354 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" > > +#include "eal_filesystem.h" > + > static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); > static int axgbe_dev_configure(struct rte_eth_dev *dev); > static int axgbe_dev_start(struct rte_eth_dev *dev); > @@ -1923,28 +1925,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) > pdata->power_down = 0; > } > > -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 uint16_t > +get_pci_rc_devid(void) > { > - const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev); > - const struct rte_pci_id *pcid = _pci_id; > + char pci_sysfs[PATH_MAX]; > + const struct rte_pci_addr pci_rc_addr = {0, 0, 0, 0}; > + unsigned long device_id; > > - if (pdev->id.vendor_id == AMD_PCI_VENDOR_ID && > - pdev->id.device_id == 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); The use of rte_pci_get_sysfs_path() and in general is ugly because it only works for Linux. We could come up with a better API in the pci bus, but I don't think it is worth it atm. We can live with your implementation since this driver is only compiled on Linux. -- David Marchand