Print an informational message in iavf_mac_add_ok() when the PF
confirms the primary MAC filter. This gives operators a clear
confirmation of the active MAC address in dmesg.

Save the confirmed address to a local variable and emit the log after
releasing mac_vlan_list_lock to avoid holding a spinlock across printk.
Print f->macaddr directly rather than adapter->hw.mac.addr: the filter
address is the value the PF actually accepted and is protected by the
held lock, while hw.mac.addr is not.

Suggested-by: Norbert Zulinski <[email protected]>
Signed-off-by: Aleksandr Loktionov <[email protected]>
---
 drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c 
b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
index 146fc680..62b0910 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
@@ -692,19 +692,31 @@ void iavf_del_ether_addrs(struct iavf_adapter *adapter)
  * iavf_mac_add_ok
  * @adapter: adapter structure
  *
- * Submit list of filters based on PF response.
+ * Mark MAC filters as handled after PF confirms the add request.
+ * Logs the confirmed primary MAC address when applicable.
  **/
 static void iavf_mac_add_ok(struct iavf_adapter *adapter)
 {
        struct iavf_mac_filter *f, *ftmp;
+       u8 primary_mac[ETH_ALEN] = {};
+       bool log_primary = false;
 
        spin_lock_bh(&adapter->mac_vlan_list_lock);
        list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, list) {
                f->is_new_mac = false;
-               if (!f->add && !f->add_handled)
+               if (!f->add && !f->add_handled) {
                        f->add_handled = true;
+                       if (f->is_primary) {
+                               ether_addr_copy(primary_mac, f->macaddr);
+                               log_primary = true;
+                       }
+               }
        }
        spin_unlock_bh(&adapter->mac_vlan_list_lock);
+
+       if (log_primary)
+               netdev_info(adapter->netdev,
+                           "MAC address set to %pM\n", primary_mac);
 }
 
 /**
-- 
2.52.0

Reply via email to