Skip to contentSkip to conversation

i40e: remove client instance on driver unload

PATCH New Jeff Kirsher 2 participants 6 messages Mar 30, 2017 – Mar 31, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 i40e: remove client instance on driver unload

From: Mitch Williams <[email protected]>

When the driver is unloaded, we need to remove the client instance, otherwise we leak memory.

Testing Hints (required if no HSD): On OFED 4.x, do "driverctl unset-override".

Change-ID If1e7882ac1f6ce15d004722fafbe31afbe0adc9a
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_client.c +3 -0
index 191028b1489b..d05296a7078e 100644
@@ -459,6 +459,9 @@ int i40e_lan_del_device(struct i40e_pf *pf)
 	struct i40e_device *ldev, *tmp;
 	int ret = -ENODEV;
 
+	/* First, remove any client instance. */
+	i40e_client_del_instance(pf);
+
 	mutex_lock(&i40e_device_mutex);
 	list_for_each_entry_safe(ldev, tmp, &i40e_devices, list) {
 		if (ldev->pf == pf) {
Signature · 1 line
2.12.0
#1 lore raw

PATCH v2 2/3 i40e: register existing client on probe

From: Mitch Williams <[email protected]>

In some cases, a client (i40iw) may already be present when probe is called. Check for this, and add a client instance if necessary.

Testing Hints (required if no HSD): On OFED 4.x, run 'driverctl unset-override' then reload i40e

Change-ID I2009312694b7ad81f1023919e4c6c86181f21689
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_client.c +6 -0
index d05296a7078e..eb2896fd52a6 100644
@@ -436,6 +436,12 @@ int i40e_lan_add_device(struct i40e_pf *pf)
 		 pf->hw.pf_id, pf->hw.bus.bus_id,
 		 pf->hw.bus.device, pf->hw.bus.func);
 
+	/* If a client has already been registered, we need to add an instance
+	 * of it to our new LAN device.
+	 */
+	if (registered_client)
+		i40e_client_add_instance(pf);
+
 	/* Since in some cases register may have happened before a device gets
 	 * added, we can schedule a subtask to go initiate the clients if
 	 * they can be launched at probe time.
Signature · 1 line
2.12.0
#2 lore raw

PATCH v2 2/3 i40e: register existing client on probe

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Thursday, March 30, 2017 12:46 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next S65 2/3 v2] i40e: register existing client on probe

From: Mitch Williams <[email protected]>

In some cases, a client (i40iw) may already be present when probe is called. Check for this, and add a client instance if necessary.

Quoted 8 lines

Testing Hints (required if no HSD): On OFED 4.x, run 'driverctl unset-override' then reload i40e

Change-ID I2009312694b7ad81f1023919e4c6c86181f21689
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 6 ++++++
 1 file changed, 6 insertions(+)
#3 lore raw

PATCH v2 3/3 i40e: close client on remove and shutdown

In reply to Jeff Kirsher

From: Mitch Williams <[email protected]>

When the driver is removed or shut down, close any attached clients (i.e. i40iw). This prevents a panic seen sometimes on forced driver removal or system shutdown when iWarp is running.

Change-ID I4f6161e5a73ffbb2fd5883567b007310302bfcb5
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +10 -0
index cb087d546a0a..da22850897c2 100644
@@ -11392,6 +11392,11 @@ static void i40e_remove(struct pci_dev *pdev)
 	if (pf->service_task.func)
 		cancel_work_sync(&pf->service_task);
 
+	/* Client close must be called explicitly here because the timer
+	 * has been stopped.
+	 */
+	i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
+
 	if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
 		i40e_free_vfs(pf);
 		pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
@@ -11632,6 +11637,11 @@ static void i40e_shutdown(struct pci_dev *pdev)
 	cancel_work_sync(&pf->service_task);
 	i40e_fdir_teardown(pf);
 
+	/* Client close must be called explicitly here because the timer
+	 * has been stopped.
+	 */
+	i40e_notify_client_of_netdev_close(pf->vsi[pf->lan_vsi], false);
+
 	if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE))
 		i40e_enable_mc_magic_wake(pf);
 
Signature · 1 line
2.12.0
#4 lore raw

PATCH v2 3/3 i40e: close client on remove and shutdown

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Thursday, March 30, 2017 12:46 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next S65 3/3 v2] i40e: close client on remove and shutdown

From: Mitch Williams <[email protected]>

When the driver is removed or shut down, close any attached clients (i.e. i40iw). This prevents a panic seen sometimes on forced driver removal or system shutdown when iWarp is running.

Quoted 5 lines
Change-ID I4f6161e5a73ffbb2fd5883567b007310302bfcb5
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
#5 lore raw

PATCH v2 1/3 i40e: remove client instance on driver unload

In reply to Jeff Kirsher
Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jeff Kirsher
Sent: Thursday, March 30, 2017 12:46 AM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next S65 1/3 v2] i40e: remove client instance on driver unload

From: Mitch Williams <[email protected]>

When the driver is unloaded, we need to remove the client instance, otherwise we leak memory.

Quoted 8 lines

Testing Hints (required if no HSD): On OFED 4.x, do "driverctl unset- override".

Change-ID If1e7882ac1f6ce15d004722fafbe31afbe0adc9a
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 3 +++
 1 file changed, 3 insertions(+)