[PATCH v1] net/axgbe: use PCI root complex device to distinguish AMD hardware
David Marchand
david.marchand at redhat.com
Wed Dec 1 10:00:49 CET 2021
On Fri, Nov 26, 2021 at 11:24 AM Chandubabu Namburu <chandu at amd.com> 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 at 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 <chandu at amd.com>
> ---
> 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
More information about the dev
mailing list