bnx2x: Deprecate pci_get_bus_and_slot()
authorSinan Kaya <okaya@codeaurora.org>
Tue, 19 Dec 2017 05:37:49 +0000 (00:37 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 17 Jan 2018 14:16:46 +0000 (08:16 -0600)
pci_get_bus_and_slot() is restrictive such that it assumes domain=0 as
where a PCI device is present. This restricts the device drivers to be
reused for other domain numbers.

Getting ready to remove pci_get_bus_and_slot() function in favor of
pci_get_domain_bus_and_slot().

Introduce bnx2x_vf_domain() function to extract the domain information
and save it to VF specific data structure.

Use the saved domain value while calling pci_get_domain_bus_and_slot().

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
Acked-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h

index 3591077..ffa7959 100644 (file)
@@ -812,7 +812,7 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
        if (!vf)
                return false;
 
-       dev = pci_get_bus_and_slot(vf->bus, vf->devfn);
+       dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn);
        if (dev)
                return bnx2x_is_pcie_pending(dev);
        return false;
@@ -1041,6 +1041,13 @@ void bnx2x_iov_init_dmae(struct bnx2x *bp)
                REG_WR(bp, DMAE_REG_BACKWARD_COMP_EN, 0);
 }
 
+static int bnx2x_vf_domain(struct bnx2x *bp, int vfid)
+{
+       struct pci_dev *dev = bp->pdev;
+
+       return pci_domain_nr(dev->bus);
+}
+
 static int bnx2x_vf_bus(struct bnx2x *bp, int vfid)
 {
        struct pci_dev *dev = bp->pdev;
@@ -1606,6 +1613,7 @@ int bnx2x_iov_nic_init(struct bnx2x *bp)
                struct bnx2x_virtf *vf = BP_VF(bp, vfid);
 
                /* fill in the BDF and bars */
+               vf->domain = bnx2x_vf_domain(bp, vfid);
                vf->bus = bnx2x_vf_bus(bp, vfid);
                vf->devfn = bnx2x_vf_devfn(bp, vfid);
                bnx2x_vf_set_bars(bp, vf);
index 53466f6..eb814c6 100644 (file)
@@ -182,6 +182,7 @@ struct bnx2x_virtf {
        u32 error;      /* 0 means all's-well */
 
        /* BDF */
+       unsigned int domain;
        unsigned int bus;
        unsigned int devfn;