linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pierre Crégut" <pierre.cregut@orange.com>
To: linux-pci@vger.kernel.org
Cc: "Pierre Crégut" <pierre.cregut@orange.com>
Subject: [PATCH] PCI/IOV: update num_VFs earlier
Date: Mon, 25 Mar 2019 09:18:03 +0100	[thread overview]
Message-ID: <20190325081803.30094-1-pierre.cregut@orange.com> (raw)

Ensure that iov->num_VFs is set before a netlink message is sent when
the number of VFs is changed. Otherwise /sys/.../sriov_numvfs is not
updated when read immediately after receiving the netlink message.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=202991
Signed-off-by: Pierre Crégut <pierre.cregut@orange.com>
---
 drivers/pci/iov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 3aa115ed3a65..a9655c10e87f 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -351,6 +351,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
 		goto err_pcibios;
 	}
 
+	iov->num_VFs = nr_virtfn;
 	pci_iov_set_numvfs(dev, nr_virtfn);
 	iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
 	pci_cfg_access_lock(dev);
@@ -363,7 +364,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
 		goto err_pcibios;
 
 	kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
-	iov->num_VFs = nr_virtfn;
 
 	return 0;
 
@@ -379,6 +379,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
 	if (iov->link != dev->devfn)
 		sysfs_remove_link(&dev->dev.kobj, "dep_link");
 
+	iov->num_VFs = 0;
 	pci_iov_set_numvfs(dev, 0);
 	return rc;
 }
-- 
2.17.1


             reply	other threads:[~2019-03-25  8:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25  8:18 Pierre Crégut [this message]
2019-03-29  8:00 [PATCH] PCI/IOV: update num_VFs earlier Pierre Crégut
2019-04-05 22:33 ` Bjorn Helgaas
2019-04-26  8:11   ` CREGUT Pierre IMT/OLN
2019-06-13 23:51     ` Bjorn Helgaas
2019-10-01 23:45     ` Bjorn Helgaas
2019-10-03  9:04       ` CREGUT Pierre IMT/OLN
2019-10-03 22:10         ` Bjorn Helgaas
2019-10-03 22:36           ` Jakub Kicinski
2019-10-03 22:37           ` Duyck, Alexander H
2019-10-08 21:38           ` Bjorn Helgaas
2019-10-08 22:06             ` Don Dutile
2019-10-09 12:31               ` Bjorn Helgaas
2019-10-09 14:20                 ` Don Dutile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190325081803.30094-1-pierre.cregut@orange.com \
    --to=pierre.cregut@orange.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).