]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i40e: When removing VF MAC filters, only check PF-set MAC
authorJamie Bainbridge <jamie.bainbridge@gmail.com>
Tue, 24 Jun 2025 23:29:18 +0000 (09:29 +1000)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 21 Jul 2025 17:31:09 +0000 (10:31 -0700)
When the PF is processing an Admin Queue message to delete a VF's MACs
from the MAC filter, we currently check if the PF set the MAC and if
the VF is trusted.

This results in undesirable behaviour, where if a trusted VF with a
PF-set MAC sets itself down (which sends an AQ message to delete the
VF's MAC filters) then the VF MAC is erased from the interface.

This results in the VF losing its PF-set MAC which should not happen.

There is no need to check for trust at all, because an untrusted VF
cannot change its own MAC. The only check needed is whether the PF set
the MAC. If the PF set the MAC, then don't erase the MAC on link-down.

Resolve this by changing the deletion check only for PF-set MAC.

(the out-of-tree driver has also intentionally removed the check for VF
trust here with OOT driver version 2.26.8, this changes the Linux kernel
driver behaviour and comment to match the OOT driver behaviour)

Fixes: ea2a1cfc3b201 ("i40e: Fix VF MAC filter removal")
Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 2dbe38eb949412777e2f272fbe880750e7f6cb2a..7ccfc1191ae56f0524afd658194443cdb602ee2a 100644 (file)
@@ -3137,10 +3137,10 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
                const u8 *addr = al->list[i].addr;
 
                /* Allow to delete VF primary MAC only if it was not set
-                * administratively by PF or if VF is trusted.
+                * administratively by PF.
                 */
                if (ether_addr_equal(addr, vf->default_lan_addr.addr)) {
-                       if (i40e_can_vf_change_mac(vf))
+                       if (!vf->pf_set_mac)
                                was_unimac_deleted = true;
                        else
                                continue;