[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YAW/Wtr0thScxvK/@kroah.com>
Date: Mon, 18 Jan 2021 18:03:22 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Leon Romanovsky <leon@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leonro@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>,
Jakub Kicinski <kuba@...nel.org>, linux-pci@...r.kernel.org,
linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
Don Dutile <ddutile@...hat.com>,
Alex Williamson <alex.williamson@...hat.com>
Subject: Re: [PATCH mlx5-next v1 2/5] PCI: Add SR-IOV sysfs entry to read
number of MSI-X vectors
On Sun, Jan 10, 2021 at 05:07:24PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@...dia.com>
>
> Some SR-IOV capable devices provide an ability to configure specific
> number of MSI-X vectors on their VF prior driver is probed on that VF.
>
> In order to make management easy, provide new read-only sysfs file that
> returns a total number of possible to configure MSI-X vectors.
>
> cat /sys/bus/pci/devices/.../sriov_vf_total_msix
> = 0 - feature is not supported
> > 0 - total number of MSI-X vectors to consume by the VFs
>
> Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> ---
> Documentation/ABI/testing/sysfs-bus-pci | 14 +++++++++++
> drivers/pci/iov.c | 31 +++++++++++++++++++++++++
> drivers/pci/pci.h | 3 +++
> include/linux/pci.h | 2 ++
> 4 files changed, 50 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
> index 05e26e5da54e..64e9b700acc9 100644
> --- a/Documentation/ABI/testing/sysfs-bus-pci
> +++ b/Documentation/ABI/testing/sysfs-bus-pci
> @@ -395,3 +395,17 @@ Description:
> The file is writable if the PF is bound to a driver that
> supports the ->sriov_set_msix_vec_count() callback and there
> is no driver bound to the VF.
> +
> +What: /sys/bus/pci/devices/.../sriov_vf_total_msix
> +Date: January 2021
> +Contact: Leon Romanovsky <leonro@...dia.com>
> +Description:
> + This file is associated with the SR-IOV PFs.
> + It returns a total number of possible to configure MSI-X
> + vectors on the enabled VFs.
> +
> + The values returned are:
> + * > 0 - this will be total number possible to consume by VFs,
> + * = 0 - feature is not supported
> +
> + If no SR-IOV VFs are enabled, this value will return 0.
> diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
> index 42c0df4158d1..0a6ddf3230fd 100644
> --- a/drivers/pci/iov.c
> +++ b/drivers/pci/iov.c
> @@ -394,12 +394,22 @@ static ssize_t sriov_drivers_autoprobe_store(struct device *dev,
> return count;
> }
>
> +static ssize_t sriov_vf_total_msix_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct pci_dev *pdev = to_pci_dev(dev);
> +
> + return sprintf(buf, "%d\n", pdev->sriov->vf_total_msix);
Nit, please use sysfs_emit() for new sysfs files.
thanks,
greg k-h
Powered by blists - more mailing lists