Skip to contentSkip to conversation

iavf: cleanups, dead code removal

PATCH In review Michal Schmidt 4 participants 17 messages Oct 16, 2023 – Oct 24, 2023

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

cover iavf: cleanups, dead code removal

The first 3 patches are quite simple cleanups.
Patch 4 removes the whole unused iavf client interface and the supporting code.

Michal Schmidt (4):
iavf: rely on netdev's own registered state
iavf: use unregister_netdev
iavf: add a common function for undoing the interrupt scheme
iavf: delete the iavf client interface

 drivers/net/ethernet/intel/iavf/Makefile      |   2 +-
 drivers/net/ethernet/intel/iavf/iavf.h        |  28 -
 drivers/net/ethernet/intel/iavf/iavf_client.c | 578 ------------------
 drivers/net/ethernet/intel/iavf/iavf_client.h | 169 -----
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 121 +---
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  14 -
 6 files changed, 20 insertions(+), 892 deletions(-)
 delete mode 100644 drivers/net/ethernet/intel/iavf/iavf_client.c
 delete mode 100644 drivers/net/ethernet/intel/iavf/iavf_client.h
Signature · 6 lines
2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#14 lore raw

PATCH 4/4 iavf: delete the iavf client interface

The iavf client interface was added in 2017 by commit ed0e894de7c1 ("i40evf: add client interface"), but there have never been any in-tree callers.

It's not useful for future development either. The Intel out-of-tree iavf and irdma drivers instead use an auxiliary bus, which is a better solution.

Remove the iavf client interface code. Also gone are the client_task work and the client_lock mutex.

---
 drivers/net/ethernet/intel/iavf/Makefile      |   2 +-
 drivers/net/ethernet/intel/iavf/iavf.h        |  27 -
 drivers/net/ethernet/intel/iavf/iavf_client.c | 578 ------------------
 drivers/net/ethernet/intel/iavf/iavf_client.h | 169 -----
 drivers/net/ethernet/intel/iavf/iavf_main.c   |  82 ---
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  14 -
 6 files changed, 1 insertion(+), 871 deletions(-)
 delete mode 100644 drivers/net/ethernet/intel/iavf/iavf_client.c
 delete mode 100644 drivers/net/ethernet/intel/iavf/iavf_client.h
drivers/net/ethernet/intel/iavf/Makefile +1 -1
index 9c3e45c54d01..2d154a4e2fd7 100644
@@ -13,4 +13,4 @@ obj-$(CONFIG_IAVF) += iavf.o
 
 iavf-objs := iavf_main.o iavf_ethtool.o iavf_virtchnl.o iavf_fdir.o \
 	     iavf_adv_rss.o \
-	     iavf_txrx.o iavf_common.o iavf_adminq.o iavf_client.o
+	     iavf_txrx.o iavf_common.o iavf_adminq.o
drivers/net/ethernet/intel/iavf/iavf.h +0 -27
index f026d0670338..e7ab89dc883a 100644
@@ -63,7 +63,6 @@ struct iavf_vsi {
 	DECLARE_BITMAP(state, __IAVF_VSI_STATE_SIZE__);
 	int base_vector;
 	u16 qs_handle;
-	void *priv;     /* client driver data reference. */
 };
 
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
@@ -256,7 +255,6 @@ struct iavf_adapter {
 	struct work_struct reset_task;
 	struct work_struct adminq_task;
 	struct work_struct finish_config;
-	struct delayed_work client_task;
 	wait_queue_head_t down_waitqueue;
 	wait_queue_head_t reset_waitqueue;
 	wait_queue_head_t vc_waitqueue;
@@ -265,7 +263,6 @@ struct iavf_adapter {
 	int num_vlan_filters;
 	struct list_head mac_filter_list;
 	struct mutex crit_lock;
-	struct mutex client_lock;
 	/* Lock to protect accesses to MAC and VLAN lists */
 	spinlock_t mac_vlan_list_lock;
 	char misc_vector_name[IFNAMSIZ + 9];
@@ -282,10 +279,6 @@ struct iavf_adapter {
 	u64 hw_csum_rx_error;
 	u32 rx_desc_count;
 	int num_msix_vectors;
-	int num_rdma_msix;
-	int rdma_base_vector;
-	u32 client_pending;
-	struct iavf_client_instance *cinst;
 	struct msix_entry *msix_entries;
 
 	u32 flags;
@@ -294,10 +287,6 @@ struct iavf_adapter {
 #define IAVF_FLAG_RESET_PENDING		BIT(4)
 #define IAVF_FLAG_RESET_NEEDED		BIT(5)
 #define IAVF_FLAG_WB_ON_ITR_CAPABLE		BIT(6)
-#define IAVF_FLAG_SERVICE_CLIENT_REQUESTED	BIT(9)
-#define IAVF_FLAG_CLIENT_NEEDS_OPEN		BIT(10)
-#define IAVF_FLAG_CLIENT_NEEDS_CLOSE		BIT(11)
-#define IAVF_FLAG_CLIENT_NEEDS_L2_PARAMS	BIT(12)
 #define IAVF_FLAG_LEGACY_RX			BIT(15)
 #define IAVF_FLAG_REINIT_ITR_NEEDED		BIT(16)
 #define IAVF_FLAG_QUEUES_DISABLED		BIT(17)
@@ -388,11 +377,6 @@ struct iavf_adapter {
 	u32 link_speed_mbps;
 
 	enum virtchnl_ops current_op;
-#define CLIENT_ALLOWED(_a) ((_a)->vf_res ? \
-			    (_a)->vf_res->vf_cap_flags & \
-				VIRTCHNL_VF_OFFLOAD_RDMA : \
-			    0)
-#define CLIENT_ENABLED(_a) ((_a)->cinst)
 /* RSS by the PF should be preferred over RSS via other methods. */
 #define RSS_PF(_a) ((_a)->vf_res->vf_cap_flags & \
 		    VIRTCHNL_VF_OFFLOAD_RSS_PF)
@@ -460,12 +444,6 @@ struct iavf_adapter {
 
 /* Ethtool Private Flags */
 
-/* lan device, used by client interface */
-struct iavf_device {
-	struct list_head list;
-	struct iavf_adapter *vf;
-};
-
 /* needed by iavf_ethtool.c */
 extern char iavf_driver_name[];
 
@@ -569,11 +547,6 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
 int iavf_config_rss(struct iavf_adapter *adapter);
 int iavf_lan_add_device(struct iavf_adapter *adapter);
 int iavf_lan_del_device(struct iavf_adapter *adapter);
-void iavf_client_subtask(struct iavf_adapter *adapter);
-void iavf_notify_client_message(struct iavf_vsi *vsi, u8 *msg, u16 len);
-void iavf_notify_client_l2_params(struct iavf_vsi *vsi);
-void iavf_notify_client_open(struct iavf_vsi *vsi);
-void iavf_notify_client_close(struct iavf_vsi *vsi, bool reset);
 void iavf_enable_channels(struct iavf_adapter *adapter);
 void iavf_disable_channels(struct iavf_adapter *adapter);
 void iavf_add_cloud_filter(struct iavf_adapter *adapter);
drivers/net/ethernet/intel/iavf/iavf_client.c deleted +0 -578

578 lines not on this page · raw message

drivers/net/ethernet/intel/iavf/iavf_client.h deleted +0 -169

169 lines not on this page · raw message

drivers/net/ethernet/intel/iavf/iavf_main.c +0 -82

184 lines not on this page · raw message

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +0 -14
index 82b84a93bcc8..64c4443dbef9 100644
@@ -3,7 +3,6 @@
 
 #include "iavf.h"
 #include "iavf_prototype.h"
-#include "iavf_client.h"
 
 /**
  * iavf_send_pf_msg
@@ -2309,19 +2308,6 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,
 		if (v_opcode != adapter->current_op)
 			return;
 		break;
-	case VIRTCHNL_OP_RDMA:
-		/* Gobble zero-length replies from the PF. They indicate that
-		 * a previous message was received OK, and the client doesn't
-		 * care about that.
-		 */
-		if (msglen && CLIENT_ENABLED(adapter))
-			iavf_notify_client_message(&adapter->vsi, msg, msglen);
-		break;
-
-	case VIRTCHNL_OP_CONFIG_RDMA_IRQ_MAP:
-		adapter->client_pending &=
-				~(BIT(VIRTCHNL_OP_CONFIG_RDMA_IRQ_MAP));
-		break;
 	case VIRTCHNL_OP_GET_RSS_HENA_CAPS: {
 		struct virtchnl_rss_hena *vrh = (struct virtchnl_rss_hena *)msg;
 
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/4 iavf: rely on netdev's own registered state

In reply to Michal Schmidt

The information whether a netdev has been registered is already present in the netdev itself. There's no need for a driver flag with the same meaning.

---
 drivers/net/ethernet/intel/iavf/iavf.h      | 1 -
 drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++------
 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +0 -1
index 44daf335e8c5..f026d0670338 100644
@@ -377,7 +377,6 @@ struct iavf_adapter {
 	unsigned long crit_section;
 
 	struct delayed_work watchdog_task;
-	bool netdev_registered;
 	bool link_up;
 	enum virtchnl_link_speed link_speed;
 	/* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set
drivers/net/ethernet/intel/iavf/iavf_main.c +3 -6
index f35d74566faa..d2f4648a6156 100644
@@ -2021,7 +2021,7 @@ static void iavf_finish_config(struct work_struct *work)
 	mutex_lock(&adapter->crit_lock);
 
 	if ((adapter->flags & IAVF_FLAG_SETUP_NETDEV_FEATURES) &&
-	    adapter->netdev_registered &&
+	    adapter->netdev->reg_state == NETREG_REGISTERED &&
 	    !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
 		netdev_update_features(adapter->netdev);
 		adapter->flags &= ~IAVF_FLAG_SETUP_NETDEV_FEATURES;
@@ -2029,7 +2029,7 @@ static void iavf_finish_config(struct work_struct *work)
 
 	switch (adapter->state) {
 	case __IAVF_DOWN:
-		if (!adapter->netdev_registered) {
+		if (adapter->netdev->reg_state != NETREG_REGISTERED) {
 			err = register_netdevice(adapter->netdev);
 			if (err) {
 				dev_err(&adapter->pdev->dev, "Unable to register netdev (%d)\n",
@@ -2043,7 +2043,6 @@ static void iavf_finish_config(struct work_struct *work)
 						  __IAVF_INIT_CONFIG_ADAPTER);
 				goto out;
 			}
-			adapter->netdev_registered = true;
 		}
 
 		/* Set the real number of queues when reset occurs while
@@ -5173,10 +5172,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_work_sync(&adapter->finish_config);
 
 	rtnl_lock();
-	if (adapter->netdev_registered) {
+	if (netdev->reg_state == NETREG_REGISTERED)
 		unregister_netdevice(netdev);
-		adapter->netdev_registered = false;
-	}
 	rtnl_unlock();
 
 	if (CLIENT_ALLOWED(adapter)) {
Signature · 1 line
2.41.0
#5 lore raw

PATCH 2/4 iavf: use unregister_netdev

In reply to Michal Schmidt

Use unregister_netdev, which takes rtnl_lock for us. We don't have to check the reg_state under rtnl_lock. There's nothing to race with. We have just cancelled the finish_config work.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -3
index d2f4648a6156..6036a4582196 100644
@@ -5171,10 +5171,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_delayed_work_sync(&adapter->watchdog_task);
 	cancel_work_sync(&adapter->finish_config);
 
-	rtnl_lock();
 	if (netdev->reg_state == NETREG_REGISTERED)
-		unregister_netdevice(netdev);
-	rtnl_unlock();
+		unregister_netdev(netdev);
 
 	if (CLIENT_ALLOWED(adapter)) {
 		err = iavf_lan_del_device(adapter);
Signature · 1 line
2.41.0
#10 lore raw

PATCH 3/4 iavf: add a common function for undoing the interrupt scheme

In reply to Michal Schmidt

Add a new function iavf_free_interrupt_scheme that does the inverse of iavf_init_interrupt_scheme. Symmetry is nice. And there will be three callers already.

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 26 ++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +15 -11
index 6036a4582196..791517cafc3c 100644
@@ -1954,6 +1954,17 @@ static int iavf_init_interrupt_scheme(struct iavf_adapter *adapter)
 	return err;
 }
 
+/**
+ * iavf_free_interrupt_scheme - Undo what iavf_init_interrupt_scheme does
+ * @adapter: board private structure
+ **/
+static void iavf_free_interrupt_scheme(struct iavf_adapter *adapter)
+{
+	iavf_free_q_vectors(adapter);
+	iavf_reset_interrupt_capability(adapter);
+	iavf_free_queues(adapter);
+}
+
 /**
  * iavf_free_rss - Free memory used by RSS structs
  * @adapter: board private structure
@@ -1982,11 +1993,9 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter, bool runni
 	if (running)
 		iavf_free_traffic_irqs(adapter);
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
-	err =  iavf_init_interrupt_scheme(adapter);
+	err = iavf_init_interrupt_scheme(adapter);
 	if (err)
 		goto err;
 
@@ -2973,9 +2982,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
 	spin_unlock_bh(&adapter->cloud_filter_list_lock);
 
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 	memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
 	iavf_shutdown_adminq(&adapter->hw);
 	adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
@@ -5206,9 +5213,7 @@ static void iavf_remove(struct pci_dev *pdev)
 	iavf_free_all_tx_resources(adapter);
 	iavf_free_all_rx_resources(adapter);
 	iavf_free_misc_irq(adapter);
-
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
 	iavf_free_rss(adapter);
 
@@ -5224,7 +5229,6 @@ static void iavf_remove(struct pci_dev *pdev)
 
 	iounmap(hw->hw_addr);
 	pci_release_regions(pdev);
-	iavf_free_queues(adapter);
 	kfree(adapter->vf_res);
 	spin_lock_bh(&adapter->mac_vlan_list_lock);
 	/* If we got removed before an up/down sequence, we've got a filter
Signature · 1 line
2.41.0
Reviewed-by on v1 1/4
#2 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state

In reply to Michal Schmidt
Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Monday, October 16, 2023 6:49 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state

Quoted 5 lines

The information whether a netdev has been registered is already present in the netdev itself. There's no need for a driver flag with the same meaning.

Thanks Michal, nice cleanup!

Quoted 74 lines
---
 drivers/net/ethernet/intel/iavf/iavf.h      | 1 -
 drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++------
 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +0 -1
index 44daf335e8c5..f026d0670338 100644
@@ -377,7 +377,6 @@ struct iavf_adapter {
 	unsigned long crit_section;
 
 	struct delayed_work watchdog_task;
-	bool netdev_registered;
 	bool link_up;
 	enum virtchnl_link_speed link_speed;
 	/* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED

is set

drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
index f35d74566faa..d2f4648a6156 100644
@@ -2021,7 +2021,7 @@ static void iavf_finish_config(struct work_struct
 *work)
 	mutex_lock(&adapter->crit_lock);
 
 	if ((adapter->flags & IAVF_FLAG_SETUP_NETDEV_FEATURES) &&
-	    adapter->netdev_registered &&
+	    adapter->netdev->reg_state == NETREG_REGISTERED &&
 	    !test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
 		netdev_update_features(adapter->netdev);
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -1
 		adapter->flags &= ~IAVF_FLAG_SETUP_NETDEV_FEATURES;
@@ -2029,7 +2029,7 @@ static void iavf_finish_config(struct work_struct
 *work)
 
 	switch (adapter->state) {
 	case __IAVF_DOWN:
-		if (!adapter->netdev_registered) {
+		if (adapter->netdev->reg_state != NETREG_REGISTERED) {
 			err = register_netdevice(adapter->netdev);
 			if (err) {

dev_err(&adapter->pdev->dev, "Unable to
register netdev (%d)\n",

drivers/net/ethernet/intel/iavf/iavf_main.c +0 -1
@@ -2043,7 +2043,6 @@ static void iavf_finish_config(struct work_struct
 *work)
 
 __IAVF_INIT_CONFIG_ADAPTER);
 				goto out;
 			}
-			adapter->netdev_registered = true;
 		}
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -4
 		/* Set the real number of queues when reset occurs while
@@ -5173,10 +5172,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_work_sync(&adapter->finish_config);
 
 	rtnl_lock();
-	if (adapter->netdev_registered) {
+	if (netdev->reg_state == NETREG_REGISTERED)
 		unregister_netdevice(netdev);
-		adapter->netdev_registered = false;
-	}
 	rtnl_unlock();
 
 	if (CLIENT_ALLOWED(adapter)) {
--

2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 2/4
#6 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

In reply to Michal Schmidt
Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Monday, October 16, 2023 6:49 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

Quoted 5 lines

Use unregister_netdev, which takes rtnl_lock for us. We don't have to check the reg_state under rtnl_lock. There's nothing to race with. We have just cancelled the finish_config work.

Quoted 28 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -4
index d2f4648a6156..6036a4582196 100644
@@ -5171,10 +5171,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_delayed_work_sync(&adapter->watchdog_task);
 	cancel_work_sync(&adapter->finish_config);
 
-	rtnl_lock();
 	if (netdev->reg_state == NETREG_REGISTERED)
-		unregister_netdevice(netdev);
-	rtnl_unlock();
+		unregister_netdev(netdev);
 
 	if (CLIENT_ALLOWED(adapter)) {
 		err = iavf_lan_del_device(adapter);
--

2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 3/4
#11 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme

In reply to Michal Schmidt
Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Monday, October 16, 2023 6:49 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme

Quoted 5 lines

Add a new function iavf_free_interrupt_scheme that does the inverse of iavf_init_interrupt_scheme. Symmetry is nice. And there will be three callers already.

I like symmetry :)

Quoted 81 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 26 ++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +11 -0
index 6036a4582196..791517cafc3c 100644
@@ -1954,6 +1954,17 @@ static int iavf_init_interrupt_scheme(struct
 iavf_adapter *adapter)
 	return err;
 }
 
+/**
+ * iavf_free_interrupt_scheme - Undo what iavf_init_interrupt_scheme does
+ * @adapter: board private structure
+ **/
+static void iavf_free_interrupt_scheme(struct iavf_adapter *adapter)
+{
+	iavf_free_q_vectors(adapter);
+	iavf_reset_interrupt_capability(adapter);
+	iavf_free_queues(adapter);
+}
+
 /**
  * iavf_free_rss - Free memory used by RSS structs

* @adapter: board private structure

drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
@@ -1982,11 +1993,9 @@ static int iavf_reinit_interrupt_scheme(struct

iavf_adapter *adapter, bool runni

drivers/net/ethernet/intel/iavf/iavf_main.c +3 -7
 	if (running)
 		iavf_free_traffic_irqs(adapter);
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
-	err =  iavf_init_interrupt_scheme(adapter);
+	err = iavf_init_interrupt_scheme(adapter);
 	if (err)
 		goto err;
@@ -2973,9 +2982,7 @@ static void iavf_disable_vf(struct iavf_adapter
 *adapter)
 	spin_unlock_bh(&adapter->cloud_filter_list_lock);
 
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 	memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
 	iavf_shutdown_adminq(&adapter->hw);
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -5
 	adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
@@ -5206,9 +5213,7 @@ static void iavf_remove(struct pci_dev *pdev)
 	iavf_free_all_tx_resources(adapter);
 	iavf_free_all_rx_resources(adapter);
 	iavf_free_misc_irq(adapter);
-
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
 	iavf_free_rss(adapter);
 
@@ -5224,7 +5229,6 @@ static void iavf_remove(struct pci_dev *pdev)
 
 	iounmap(hw->hw_addr);
 	pci_release_regions(pdev);
-	iavf_free_queues(adapter);
 	kfree(adapter->vf_res);
 	spin_lock_bh(&adapter->mac_vlan_list_lock);
 	/* If we got removed before an up/down sequence, we've got a filter
--

2.41.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 1/4
#3 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state

In reply to Michal Schmidt
Quoted 5 lines · Michal Schmidt

The information whether a netdev has been registered is already present in the netdev itself. There's no need for a driver flag with the same meaning.

Thanks!

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 2/4
#8 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

In reply to Michal Schmidt
Quoted 6 lines · Michal Schmidt

Use unregister_netdev, which takes rtnl_lock for us. We don't have to check the reg_state under rtnl_lock. There's nothing to race with. We have just cancelled the finish_config work.

---

Quoted 8 lines
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index d2f4648a6156..6036a4582196 100644

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_remove(struct pci_dev *pdev) · line 5175

Quoted 8 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -3
@@ -5171,10 +5171,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_delayed_work_sync(&adapter->watchdog_task);
 	cancel_work_sync(&adapter->finish_config);
 
-	rtnl_lock();
 	if (netdev->reg_state == NETREG_REGISTERED)
-		unregister_netdevice(netdev);
-	rtnl_unlock();
+		unregister_netdev(netdev);

This appears to have two tabs still, and thus be over-indented, as unregister_netdevice was indented twice due to the if statement.

I can fix this locally when applying it to Intel Wired LAN dev-queue.

However, if a v2 is needed, please fix this when sending.

Thanks,
Jake

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_remove(struct pci_dev *pdev) · line 5178

Quoted 3 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
 	if (CLIENT_ALLOWED(adapter)) {
 		err = iavf_lan_del_device(adapter);

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 3/4
#12 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme

In reply to Michal Schmidt
Quoted 6 lines · Michal Schmidt

Add a new function iavf_free_interrupt_scheme that does the inverse of iavf_init_interrupt_scheme. Symmetry is nice. And there will be three callers already.

---

Quoted 62 lines
 drivers/net/ethernet/intel/iavf/iavf_main.c | 26 ++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +15 -10
index 6036a4582196..791517cafc3c 100644
@@ -1954,6 +1954,17 @@ static int iavf_init_interrupt_scheme(struct iavf_adapter *adapter)
 	return err;
 }
 
+/**
+ * iavf_free_interrupt_scheme - Undo what iavf_init_interrupt_scheme does
+ * @adapter: board private structure
+ **/
+static void iavf_free_interrupt_scheme(struct iavf_adapter *adapter)
+{
+	iavf_free_q_vectors(adapter);
+	iavf_reset_interrupt_capability(adapter);
+	iavf_free_queues(adapter);
+}
+
 /**
  * iavf_free_rss - Free memory used by RSS structs
  * @adapter: board private structure
@@ -1982,11 +1993,9 @@ static int iavf_reinit_interrupt_scheme(struct iavf_adapter *adapter, bool runni
 	if (running)
 		iavf_free_traffic_irqs(adapter);
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
-	err =  iavf_init_interrupt_scheme(adapter);
+	err = iavf_init_interrupt_scheme(adapter);
 	if (err)
 		goto err;
 
@@ -2973,9 +2982,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)
 	spin_unlock_bh(&adapter->cloud_filter_list_lock);
 
 	iavf_free_misc_irq(adapter);
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
-	iavf_free_queues(adapter);
+	iavf_free_interrupt_scheme(adapter);
 	memset(adapter->vf_res, 0, IAVF_VIRTCHNL_VF_RESOURCE_SIZE);
 	iavf_shutdown_adminq(&adapter->hw);
 	adapter->flags &= ~IAVF_FLAG_RESET_PENDING;
@@ -5206,9 +5213,7 @@ static void iavf_remove(struct pci_dev *pdev)
 	iavf_free_all_tx_resources(adapter);
 	iavf_free_all_rx_resources(adapter);
 	iavf_free_misc_irq(adapter);
-
-	iavf_reset_interrupt_capability(adapter);
-	iavf_free_q_vectors(adapter);
+	iavf_free_interrupt_scheme(adapter);
 
 	iavf_free_rss(adapter);
 

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_remove(struct pci_dev *pdev) · line 5227

Quoted 4 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -1
@@ -5224,7 +5229,6 @@ static void iavf_remove(struct pci_dev *pdev)
 
 	iounmap(hw->hw_addr);
 	pci_release_regions(pdev);
-	iavf_free_queues(adapter);

Strictly speaking this does change some flow because we didn't release queues until much later.. but I think that should be ok. I don't see how waiting to free the queues would matter here.

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_remove(struct pci_dev *pdev) · line 5234

Quoted 3 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
 	kfree(adapter->vf_res);
 	spin_lock_bh(&adapter->mac_vlan_list_lock);
 	/* If we got removed before an up/down sequence, we've got a filter

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Reviewed-by on v1 4/4
#15 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 4/4] iavf: delete the iavf client interface

In reply to Michal Schmidt
Quoted 8 lines · Michal Schmidt

The iavf client interface was added in 2017 by commit ed0e894de7c1 ("i40evf: add client interface"), but there have never been any in-tree callers.

It's not useful for future development either. The Intel out-of-tree iavf and irdma drivers instead use an auxiliary bus, which is a better solution.

Quoted 5 lines

Remove the iavf client interface code. Also gone are the client_task work and the client_lock mutex.

---

Yea this interface is not supported by any current out-of-tree driver I could find either. From what I can tell the last version of out-of-tree iAVF which shipped this interface was 2021, iavf 4.2.1, which appears to have released in 2021.

I was unable to determine when the last time any software which used this interface was supported... It appears to have never been used in-tree at all.

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#9 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

In reply to Jacob Keller
Quoted 32 lines · Jacob Keller
Quoted 6 lines · Michal Schmidt

Use unregister_netdev, which takes rtnl_lock for us. We don't have to check the reg_state under rtnl_lock. There's nothing to race with. We have just cancelled the finish_config work.

---

Quoted 8 lines
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index d2f4648a6156..6036a4582196 100644

drivers/net/ethernet/intel/iavf/iavf_main.c static void iavf_remove(struct pci_dev *pdev) · line 5175

Quoted 8 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -3
@@ -5171,10 +5171,8 @@ static void iavf_remove(struct pci_dev *pdev)
 	cancel_delayed_work_sync(&adapter->watchdog_task);
 	cancel_work_sync(&adapter->finish_config);
 
-	rtnl_lock();
 	if (netdev->reg_state == NETREG_REGISTERED)
-		unregister_netdevice(netdev);
-	rtnl_unlock();
+		unregister_netdev(netdev);

This appears to have two tabs still, and thus be over-indented, as unregister_netdevice was indented twice due to the if statement.

Quoted 7 lines

I can fix this locally when applying it to Intel Wired LAN dev-queue.

However, if a v2 is needed, please fix this when sending.

Thanks,
Jake

Oh, for some reason I thought the check against reg_state was also removed. Please ignore this comment.

Thanks,
Jake
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#4 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state

In reply to Jacob Keller
Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Tuesday, October 17, 2023 7:30 PM
To: [email protected]
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state

Quoted 4 lines · Michal Schmidt

The information whether a netdev has been registered is already present in the netdev itself. There's no need for a driver flag with the same meaning.

Quoted 6 lines
Quoted 1 line

Thanks!

_______________________________________________

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#7 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

In reply to Drewek, Wojciech
Quoted 35 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Drewek, Wojciech
Sent: Tuesday, October 17, 2023 10:07 AM
To: mschmidt <[email protected]>; [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Schmidt
Sent: Monday, October 16, 2023 6:49 PM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Brandeburg, Jesse <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev

Quoted 5 lines

Use unregister_netdev, which takes rtnl_lock for us. We don't have to check the reg_state under rtnl_lock. There's nothing to race with. We have just cancelled the finish_config work.

Quoted 4 lines
---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 5 lines

drivers/net/ethernet/intel/iavf/iavf_main.c

Quoted 5 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index d2f4648a6156..6036a4582196 100644
#13 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme

In reply to Jacob Keller
Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Tuesday, October 17, 2023 7:36 PM
To: [email protected]
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme

Quoted 6 lines · Michal Schmidt

Add a new function iavf_free_interrupt_scheme that does the inverse of iavf_init_interrupt_scheme. Symmetry is nice. And there will be three callers already.

---

Quoted 4 lines
 drivers/net/ethernet/intel/iavf/iavf_main.c | 26
++++++++++++---------
 1 file changed, 15 insertions(+), 11 deletions(-)
Quoted 5 lines

drivers/net/ethernet/intel/iavf/iavf_main.c

Quoted 5 lines
drivers/net/ethernet/intel/iavf/iavf_main.c +0 -0
index 6036a4582196..791517cafc3c 100644

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#16 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next 4/4] iavf: delete the iavf client interface

In reply to Jacob Keller
Quoted 30 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jacob Keller
Sent: Tuesday, October 17, 2023 7:47 PM
To: [email protected]
Subject: Re: [Intel-wired-lan] [PATCH iwl-next 4/4] iavf: delete the iavf client interface

Quoted 8 lines · Michal Schmidt

The iavf client interface was added in 2017 by commit ed0e894de7c1 ("i40evf: add client interface"), but there have never been any in-tree callers.

It's not useful for future development either. The Intel out-of-tree iavf and irdma drivers instead use an auxiliary bus, which is a better solution.

Quoted 5 lines

Remove the iavf client interface code. Also gone are the client_task work and the client_lock mutex.

---

Yea this interface is not supported by any current out-of-tree driver I could find either. From what I can tell the last version of out-of-tree iAVF which shipped this interface was 2021, iavf 4.2.1, which appears to have released in 2021.

Quoted 8 lines

I was unable to determine when the last time any software which used this interface was supported... It appears to have never been used in-tree at all.

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan