Re: [PATCH v1] net: liquidio: resolve VF pci_dev on demand for FLR requests
From: 최유호
Date: Tue Apr 21 2026 - 14:42:11 EST
Dear Simon,
Thanks for pointing out the correct tree target and the linker error
on net-next.
I will rework this, targeting 'net' and ensuring the necessary
functions are handled correctly.
Best regards,
On Tue, 21 Apr 2026 at 11:33, Simon Horman <horms@xxxxxxxxxx> wrote:
>
> On Sun, Apr 19, 2026 at 10:33:04PM -0400, Yuho Choi wrote:
> > The PF SR-IOV enable path caches VF pci_dev pointers in
> > dpiring_to_vfpcidev_lut[] by iterating with pci_get_device(). Those
> > entries do not own a reference, because the iterator drops the previous
> > device reference on each step. The cached pointer is then dereferenced
> > later when handling OCTEON_VF_FLR_REQUEST.
> >
> > This can leave stale VF pci_dev pointers in the lookup table and makes
> > the FLR path rely on a PCI device object whose lifetime is not pinned.
> >
> > Drop the long-lived lookup table and resolve the VF pci_dev only when an
> > FLR request arrives. Use the PF's SR-IOV metadata to derive the VF's
> > bus/devfn, get a referenced pci_dev for immediate use, issue the FLR,
> > and then drop the reference.
> >
> > Fixes: ca6139ffc67ee ("liquidio CN23XX: sysfs VF config support")
> > Fixes: 8c978d059224 ("liquidio CN23XX: Mailbox support")
> > Co-developed-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> > Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
> > Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Co-developed-by: Taegyu Kim <tmk5904@xxxxxxx>
> > Signed-off-by: Taegyu Kim <tmk5904@xxxxxxx>
> > Signed-off-by: Yuho Choi <dbgh9129@xxxxxxxxx>
>
> As this fixes code present in the net tree, it should be targeted
> at that tree, like this:
>
> Subject: [PATCH net] ...
>
> In this case the CI defaulted to the net-next tree.
> Which might be harmless. But please keep this in mind for next time.
>
> ...
>
> > diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> > index ad685f5d0a136..b967c7928b4a7 100644
> > --- a/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> > +++ b/drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c
> > @@ -26,6 +26,29 @@
> > #include "octeon_mailbox.h"
> > #include "cn23xx_pf_device.h"
> >
> > +static struct pci_dev *lio_vf_pci_dev_by_qno(struct octeon_device *oct, u32 q_no)
> > +{
> > + int vfidx, bus, devfn;
> > +
> > + if (!oct->sriov_info.rings_per_vf)
> > + return NULL;
> > +
> > + if (q_no % oct->sriov_info.rings_per_vf)
> > + return NULL;
> > +
> > + vfidx = q_no / oct->sriov_info.rings_per_vf;
> > + if (vfidx >= oct->sriov_info.num_vfs_alloced)
> > + return NULL;
> > +
> > + bus = pci_iov_virtfn_bus(oct->pci_dev, vfidx);
>
> When applied against net-next this causes a linker error with x86_64
> allmodconfig (at least) because pci_iov_virtfn_bus is not defined.
>
> > + devfn = pci_iov_virtfn_devfn(oct->pci_dev, vfidx);
> > + if (bus < 0 || devfn < 0)
> > + return NULL;
> > +
> > + return pci_get_domain_bus_and_slot(pci_domain_nr(oct->pci_dev->bus),
> > + bus, devfn);
> > +}
> > +
> > /**
> > * octeon_mbox_read:
> > * @mbox: Pointer mailbox
>
> --
> pw-bot: changes-requested