On Fri, Jan 08, 2021 at 03:09:13PM -0600, Bjorn Helgaas wrote: > On Thu, Jan 07, 2021 at 10:54:38PM -0500, Don Dutile wrote: > > On 1/7/21 7:57 PM, Bjorn Helgaas wrote: > > > On Sun, Jan 03, 2021 at 10:24:37AM +0200, Leon Romanovsky wrote: > > > > > + **/ > > > > +int pci_set_msix_vec_count(struct pci_dev *dev, int numb) > > > > +{ > > > > + struct pci_dev *pdev = pci_physfn(dev); > > > > + > > > > + if (!dev->msix_cap || !pdev->msix_cap) > > > > + return -EINVAL; > > > > + > > > > + if (dev->driver || !pdev->driver || > > > > + !pdev->driver->sriov_set_msix_vec_count) > > > > + return -EOPNOTSUPP; > > > > + > > > > + if (numb < 0) > > > > + /* > > > > + * We don't support negative numbers for now, > > > > + * but maybe in the future it will make sense. > > > > + */ > > > > + return -EINVAL; > > > > + > > > > + return pdev->driver->sriov_set_msix_vec_count(dev, numb); > > > > > > So we write to a VF sysfs file, get here and look up the PF, call a PF > > > driver callback with the VF as an argument, the callback (at least for > > > mlx5) looks up the PF from the VF, then does some mlx5-specific magic > > > to the PF that influences the VF somehow? > > > > There's no PF lookup above.... it's just checking if a pdev has a > > driver with the desired msix-cap setting(reduction) feature. > > We started with the VF (the sysfs file is attached to the VF). "pdev" > is the corresponding PF; that's what I meant by "looking up the PF". > Then we call the PF driver sriov_set_msix_vec_count() method. > > I asked because this raises questions of whether we need mutual > exclusion or some other coordination between setting this for multiple > VFs. MSI-X are managed by HW and they are separated between VFs. IMHO, it will be better if SW won't do too much coordination. Thanks > > Obviously it's great to answer all these in email, but at the end of > the day, the rationale needs to be in the commit, either in code > comments or the commit log.