mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
net: mana: Add handler for sriov configure
Add callback function for the pci_driver / sriov_configure. It asks the NIC to provide certain number of VFs, or disable VFs if the request is zero. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Link: https://patch.msgid.link/20260710192735.2921300-1-haiyangz@linux.microsoft.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
922cc43c62
commit
ce6b4d3216
|
|
@ -2456,6 +2456,8 @@ static void mana_gd_remove(struct pci_dev *pdev)
|
|||
{
|
||||
struct gdma_context *gc = pci_get_drvdata(pdev);
|
||||
|
||||
pci_disable_sriov(pdev);
|
||||
|
||||
mana_rdma_remove(&gc->mana_ib);
|
||||
mana_remove(&gc->mana, false);
|
||||
|
||||
|
|
@ -2525,6 +2527,27 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
|
|||
pci_disable_device(pdev);
|
||||
}
|
||||
|
||||
static int mana_sriov_configure(struct pci_dev *pdev, int numvfs)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
dev_info(&pdev->dev, "Requested num VFs: %d\n", numvfs);
|
||||
|
||||
if (numvfs > 0) {
|
||||
err = pci_enable_sriov(pdev, numvfs);
|
||||
} else {
|
||||
if (pci_vfs_assigned(pdev)) {
|
||||
dev_warn(&pdev->dev,
|
||||
"Cannot disable SR-IOV while VFs are assigned\n");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
pci_disable_sriov(pdev);
|
||||
}
|
||||
|
||||
return err ? err : numvfs;
|
||||
}
|
||||
|
||||
static const struct pci_device_id mana_id_table[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF2_DEVICE_ID) },
|
||||
|
|
@ -2540,6 +2563,7 @@ static struct pci_driver mana_driver = {
|
|||
.suspend = mana_gd_suspend,
|
||||
.resume = mana_gd_resume,
|
||||
.shutdown = mana_gd_shutdown,
|
||||
.sriov_configure = mana_sriov_configure,
|
||||
};
|
||||
|
||||
static int __init mana_driver_init(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user