[PATCH net] i40e: Match VF MAC deletion behaviour with OOT driver

Jamie Bainbridge posted 1 patch 3 months, 2 weeks ago
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH net] i40e: Match VF MAC deletion behaviour with OOT driver
Posted by Jamie Bainbridge 3 months, 2 weeks ago
When the PF is processing an AQ message to delete a VF's MACs from the
MAC filter, the Linux kernel driver checks if the PF set the MAC and if
the VF is trusted. However, the out-of-tree driver has intentionally
removed the check for VF trust with OOT driver version 2.26.8.

This results in an undesirable behaviour difference between the OOT
driver and the Linux driver, 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 with the Linux
kernel driver but not with the OOT driver.

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

Change the Linux kernel driver and comment to match the OOT behaviour.

Fixes: ea2a1cfc3b201 ("i40e: Fix VF MAC filter removal")
Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 88e6bef69342c2e65d8d5b2d7df5ac2cc32ee3d9..45ccbb1cdda0a33527852096ee9759fc19db3a5d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -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;
-- 
2.39.5
Re: [PATCH net] i40e: Match VF MAC deletion behaviour with OOT driver
Posted by Simon Horman 3 months, 2 weeks ago
On Mon, Jun 23, 2025 at 09:04:41AM +1000, Jamie Bainbridge wrote:
> When the PF is processing an AQ message to delete a VF's MACs from the
> MAC filter, the Linux kernel driver checks if the PF set the MAC and if
> the VF is trusted. However, the out-of-tree driver has intentionally
> removed the check for VF trust with OOT driver version 2.26.8.
> 
> This results in an undesirable behaviour difference between the OOT
> driver and the Linux driver, 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 with the Linux
> kernel driver but not with the OOT driver.
> 
> This results in the VF losing its PF-set MAC which should not happen.
> 
> Change the Linux kernel driver and comment to match the OOT behaviour.
> 
> Fixes: ea2a1cfc3b201 ("i40e: Fix VF MAC filter removal")
> Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com>

Hi Jamie,

I hate to be a pain but I'm wondering if we could rephrase the subject
and patch description to emphasis that this is correcting undesirable
(incorrect?) behaviour. And as a footnote, that the new behaviour matches
the OOT driver.

Correctness is what matters most from an upstream PoV.

Thanks!