All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shradha Shah <sshah@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-net-drivers@solarflare.com>
Subject: [PATCH net-next v3 14/15] sfc: force removal of VF and vport on driver removal
Date: Tue, 2 Jun 2015 11:40:46 +0100	[thread overview]
Message-ID: <556D882E.6000603@solarflare.com> (raw)
In-Reply-To: <556D8710.6060706@solarflare.com>

From: Daniel Pieczko <dpieczko@solarflare.com>

When the driver unloads, force the unbind and removal of any
VFs in the host with the PF.  The PF cannot remove vports and
vswitches if they are still being used by a VF driver, and when
unloading the sfc driver the removal order is not guaranteed,
so the instruction from the PF to the VF to unbind enforces a
suitable ordering so that vswitches and vports can be removed.

As a result of this, manually unbinding the driver from a single
PF will result in all of its VFs in the host also being removed.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10_sriov.c | 9 +++++++++
 drivers/net/ethernet/sfc/efx.c        | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
index 083c534..41ab18d 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.c
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -448,11 +448,20 @@ int efx_ef10_sriov_init(struct efx_nic *efx)
 void efx_ef10_sriov_fini(struct efx_nic *efx)
 {
 	struct efx_ef10_nic_data *nic_data = efx->nic_data;
+	unsigned int i;
 	int rc;
 
 	if (!nic_data->vf)
 		return;
 
+	/* Remove any VFs in the host */
+	for (i = 0; i < efx->vf_count; ++i) {
+		struct efx_nic *vf_efx = nic_data->vf[i].efx;
+
+		if (vf_efx)
+			vf_efx->pci_dev->driver->remove(vf_efx->pci_dev);
+	}
+
 	rc = efx_ef10_pci_sriov_disable(efx);
 	if (rc)
 		netif_dbg(efx, drv, efx->net_dev,
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index de16cec..62b2139 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -2902,7 +2902,8 @@ static void efx_pci_remove_main(struct efx_nic *efx)
 }
 
 /* Final NIC shutdown
- * This is called only at module unload (or hotplug removal).
+ * This is called only at module unload (or hotplug removal).  A PF can call
+ * this on its VFs to ensure they are unbound first.
  */
 static void efx_pci_remove(struct pci_dev *pci_dev)
 {

  parent reply	other threads:[~2015-06-02 10:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 10:36 [PATCH net-next v3 00/15] sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest Shradha Shah
2015-06-02 10:37 ` [PATCH net-next v3 01/15] sfc: Add code to export port_num in netdev->dev_port Shradha Shah
2015-06-02 10:37 ` [PATCH net-next v3 02/15] sfc: Add paranthesis correctly on all branches of the if statement Shradha Shah
2015-06-02 10:37 ` [PATCH net-next v3 03/15] sfc: Add sysfs entry for flags (link control and primary) Shradha Shah
2015-06-02 10:38 ` [PATCH net-next v3 04/15] sfc: Implement ndo_gets_phys_port_id() for EF10 VFs Shradha Shah
2015-06-02 10:38 ` [PATCH net-next v3 05/15] sfc: add "port_" prefix to MAC stats Shradha Shah
2015-06-02 10:38 ` [PATCH net-next v3 06/15] sfc: set the port-id when calling MC_CMD_MAC_STATS Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 07/15] sfc: display vadaptor statistics for all interfaces Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 08/15] sfc: DMA the VF stats only when requested Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 09/15] sfc: update netdevice statistics to use vadaptor stats Shradha Shah
2015-06-02 10:39 ` [PATCH net-next v3 10/15] sfc: suppress ENOENT error messages from MC_CMD_MAC_STATS Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 11/15] sfc: suppress vadaptor stats when EVB is not present Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 12/15] sfc: don't update stats on VF when called in atomic context Shradha Shah
2015-06-02 10:40 ` [PATCH net-next v3 13/15] sfc: do not allow VFs to be destroyed if assigned to guests Shradha Shah
2015-06-02 10:40 ` Shradha Shah [this message]
2015-06-02 10:41 ` [PATCH net-next v3 15/15] sfc: leak vports if a VF is assigned during PF unload Shradha Shah
2015-06-02 20:02 ` [PATCH net-next v3 00/15] sfc: ndo_get_phys_port_id, vadaptor stats and PF unload when Vf's assigned to guest David Miller

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=556D882E.6000603@solarflare.com \
    --to=sshah@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.