When the PF rejects a cloud filter add request it may include a diagnostic string in the virtchnl response. Use dev_info() to log it so operators can diagnose offload failures without enabling verbose tracing. Use %.*s with an explicit length bound to avoid reading past the end of the message buffer when the PF fills all 4096 bytes and leaves no NUL terminator. Add the missing cloud_filter_list_lock around both the VIRTCHNL_OP_ADD_CLOUD_FILTER and VIRTCHNL_OP_DEL_CLOUD_FILTER error paths to close a pre-existing race against iavf_add_cloud_filter() and iavf_del_cloud_filter(). Apply the same %.*s fix to the equivalent VIRTCHNL_OP_ADD_FDIR_FILTER error path which carried the same bug. Suggested-by: Grzegorz Szczurek Signed-off-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c index 4f2defd..146fc680 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -2388,6 +2388,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, case VIRTCHNL_OP_ADD_CLOUD_FILTER: { struct iavf_cloud_filter *cf, *cftmp; + spin_lock_bh(&adapter->cloud_filter_list_lock); list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, list) { @@ -2398,16 +2399,23 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, v_retval)); iavf_print_cloud_filter(adapter, &cf->f); + if (msglen) + dev_info(&adapter->pdev->dev, + "%.*s\n", + (int)msglen, + (const char *)msg); list_del(&cf->list); kfree(cf); adapter->num_cloud_filters--; } } + spin_unlock_bh(&adapter->cloud_filter_list_lock); } break; case VIRTCHNL_OP_DEL_CLOUD_FILTER: { struct iavf_cloud_filter *cf; + spin_lock_bh(&adapter->cloud_filter_list_lock); list_for_each_entry(cf, &adapter->cloud_filter_list, list) { if (cf->state == __IAVF_CF_DEL_PENDING) { @@ -2419,6 +2427,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, &cf->f); } } + spin_unlock_bh(&adapter->cloud_filter_list_lock); } break; case VIRTCHNL_OP_ADD_FDIR_FILTER: { @@ -2434,8 +2443,10 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, v_retval)); iavf_print_fdir_fltr(adapter, fdir); if (msglen) - dev_err(&adapter->pdev->dev, - "%s\n", msg); + dev_info(&adapter->pdev->dev, + "%.*s\n", + (int)msglen, + (const char *)msg); list_del(&fdir->list); iavf_dec_fdir_active_fltr(adapter, fdir); kfree(fdir); -- 2.52.0 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 Signed-off-by: Aleksandr Loktionov --- 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