]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/irdma: Fix Passthrough mode in VM
authorMustafa Ismail <mustafa.ismail@intel.com>
Fri, 25 Feb 2022 16:32:10 +0000 (10:32 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:12 +0000 (14:06 +0200)
[ Upstream commit b200189626b5cefbaf8be9cadd7a28215e065bb9 ]

Using PCI_FUNC macro in a VM, when the device is in passthrough mode does
not provide the real function instance. This means that currently, devices
will not probe unless the instance in the VM matches the instance in the
host.

Fix this by getting the pf_id from the LAN during the probe.

Fixes: 8498a30e1b94 ("RDMA/irdma: Register auxiliary driver and implement private channel OPs")
Link: https://lore.kernel.org/r/20220225163211.127-3-shiraz.saleem@intel.com
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/irdma/hw.c
drivers/infiniband/hw/irdma/i40iw_if.c
drivers/infiniband/hw/irdma/main.c
drivers/infiniband/hw/irdma/main.h

index b4c657f5f2f95cb6d0c2c681e51d5d9579133717..f99c40893ffac227969f31d4f3e0638b12430409 100644 (file)
@@ -1608,7 +1608,7 @@ static enum irdma_status_code irdma_initialize_dev(struct irdma_pci_f *rf)
        info.fpm_commit_buf = mem.va;
 
        info.bar0 = rf->hw.hw_addr;
-       info.hmc_fn_id = PCI_FUNC(rf->pcidev->devfn);
+       info.hmc_fn_id = rf->pf_id;
        info.hw = &rf->hw;
        status = irdma_sc_dev_init(rf->rdma_ver, &rf->sc_dev, &info);
        if (status)
index d219f64b2c3d5fbd8b98f8c40ce267d773ef6a9e..a6f758b61b0c428a64bb56f43a261caac0594b69 100644 (file)
@@ -77,6 +77,7 @@ static void i40iw_fill_device_info(struct irdma_device *iwdev, struct i40e_info
        rf->rdma_ver = IRDMA_GEN_1;
        rf->gen_ops.request_reset = i40iw_request_reset;
        rf->pcidev = cdev_info->pcidev;
+       rf->pf_id = cdev_info->fid;
        rf->hw.hw_addr = cdev_info->hw_addr;
        rf->cdev = cdev_info;
        rf->msix_count = cdev_info->msix_count;
index 51a41359e0b41a1ff72b4a75d28a2d63fad4277a..c556a36e76703bbad6a90ec4660dbab9edfa8f32 100644 (file)
@@ -226,6 +226,7 @@ static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf
        rf->hw.hw_addr = pf->hw.hw_addr;
        rf->pcidev = pf->pdev;
        rf->msix_count =  pf->num_rdma_msix;
+       rf->pf_id = pf->hw.pf_id;
        rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector];
        rf->default_vsi.vsi_idx = vsi->vsi_num;
        rf->protocol_used = IRDMA_ROCE_PROTOCOL_ONLY;
index cb218cab79ac12d9e9f195d4075bf0aa77156d55..fb7faa85e4c9df2ec185e1e456d9677e95907bd3 100644 (file)
@@ -257,6 +257,7 @@ struct irdma_pci_f {
        u8 *mem_rsrc;
        u8 rdma_ver;
        u8 rst_to;
+       u8 pf_id;
        enum irdma_protocol_used protocol_used;
        u32 sd_type;
        u32 msix_count;