Skip to contentSkip to conversation

iavf: Add waiting for response from PF in set mac

PATCH Superseded Mateusz Palczewski 2 participants 2 messages Apr 15, 2022 – Apr 29, 2022

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 iavf: Add waiting for response from PF in set mac

Make iavf_set_mac synchronous by waiting for a response from a PF. Without this iavf_set_mac is always returning success even though set_mac can be rejected by a PF. This ensures that when set_mac exits netdev MAC is updated. This is needed for sending ARPs with correct MAC after changing VF's MAC. This is also needed by bonding module.

---
v3: Resent the patch to apply to next-queue
v2: Changed __IAVF_IN_CRITICAL_TASK to crit_lock

---
 drivers/net/ethernet/intel/iavf/iavf.h        |   7 +-
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 123 +++++++++++++++---
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  61 ++++++++-
 3 files changed, 170 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +6 -1
index 49aed3e..fda1198 100644
@@ -146,7 +146,8 @@ struct iavf_mac_filter {
 		u8 remove:1;        /* filter needs to be removed */
 		u8 add:1;           /* filter needs to be added */
 		u8 is_primary:1;    /* filter is a default VF MAC */
-		u8 padding:4;
+		u8 add_handled:1;   /* received response for filter add */
+		u8 padding:3;
 	};
 };
 
@@ -248,6 +249,7 @@ struct iavf_adapter {
 	struct work_struct adminq_task;
 	struct delayed_work client_task;
 	wait_queue_head_t down_waitqueue;
+	wait_queue_head_t vc_waitqueue;
 	struct iavf_q_vector *q_vectors;
 	struct list_head vlan_filter_list;
 	struct list_head mac_filter_list;
@@ -292,6 +294,7 @@ struct iavf_adapter {
 #define IAVF_FLAG_QUEUES_DISABLED		BIT(17)
 #define IAVF_FLAG_SETUP_NETDEV_FEATURES		BIT(18)
 #define IAVF_FLAG_REINIT_MSIX_NEEDED		BIT(20)
+#define IAVF_FLAG_INITIAL_MAC_SET		BIT(23)
 /* duplicates for common code */
 #define IAVF_FLAG_DCB_ENABLED			0
 	/* flags for admin queue service task */
@@ -559,6 +562,8 @@ void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
 void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid);
 void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
 void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid);
+int iavf_replace_primary_mac(struct iavf_adapter *adapter,
+			     const u8 *new_mac);
 void
 iavf_set_vlan_offload_features(struct iavf_adapter *adapter,
 			       netdev_features_t prev_features,
drivers/net/ethernet/intel/iavf/iavf_main.c +105 -18

170 lines not on this page · raw message

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +59 -2

106 lines not on this page · raw message

Signature · 1 line
2.27.0
#1 lore raw

PATCH v3 1/1 iavf: Add waiting for response from PF in set mac

drivers/net/ethernet/intel/iavf/iavf.h struct iavf_mac_filter {

Quoted 36 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: Friday, April 15, 2022 10:50 AM
To: intel-wired-lan at lists.osuosl.org
Cc: Palczewski, Mateusz <[email protected]>; Sylwester Dziedziuch <[email protected]>
Subject: [Intel-wired-lan] [PATCH net-next v3] iavf: Add waiting for response from PF in set mac

Make iavf_set_mac synchronous by waiting for a response from a PF. Without this iavf_set_mac is always returning success even though set_mac can be rejected by a PF.
This ensures that when set_mac exits netdev MAC is updated. This is needed for sending ARPs with correct MAC after changing VF's MAC. This is also needed by bonding module.

---
v3: Resent the patch to apply to next-queue
v2: Changed __IAVF_IN_CRITICAL_TASK to crit_lock

---
 drivers/net/ethernet/intel/iavf/iavf.h        |   7 +-
 drivers/net/ethernet/intel/iavf/iavf_main.c   | 123 +++++++++++++++---
 .../net/ethernet/intel/iavf/iavf_virtchnl.c   |  61 ++++++++-
 3 files changed, 170 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +0 -0
index 49aed3e..fda1198 100644
@@ -146,7 +146,8 @@ struct iavf_mac_filter {