* [PATCH net] ice: fix vf->num_mac count with port representors
@ 2025-04-10 18:13 Jacob Keller
2025-04-11 5:52 ` Michal Swiatkowski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jacob Keller @ 2025-04-10 18:13 UTC (permalink / raw)
To: Anthony Nguyen, Intel Wired LAN, netdev; +Cc: Jacob Keller
The ice_vc_repr_add_mac() function indicates that it does not store the MAC
address filters in the firmware. However, it still increments vf->num_mac.
This is incorrect, as vf->num_mac should represent the number of MAC
filters currently programmed to firmware.
Indeed, we only perform this increment if the requested filter is a unicast
address that doesn't match the existing vf->hw_lan_addr. In addition,
ice_vc_repr_del_mac() does not decrement the vf->num_mac counter. This
results in the counter becoming out of sync with the actual count.
As it turns out, vf->num_mac is currently only used in legacy made without
port representors. The single place where the value is checked is for
enforcing a filter limit on untrusted VFs.
Upcoming patches to support VF Live Migration will use this value when
determining the size of the TLV for MAC address filters. Fix the
representor mode function to stop incrementing the counter incorrectly.
Fixes: ac19e03ef780 ("ice: allow process VF opcodes in different ways")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
I am not certain if there is currently a way to trigger a bug from
userspace due to this incorrect count, but I think it still warrants a net
fix.
---
drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
index 7c3006eb68dd071ab76e62d8715dc2729610586a..6446d0fcc0528656054e506c9208880ce1e417ea 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
@@ -4275,7 +4275,6 @@ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg)
}
ice_vfhw_mac_add(vf, &al->list[i]);
- vf->num_mac++;
break;
}
---
base-commit: a9843689e2de1a3727d58b4225e4f8664937aefd
change-id: 20250410-jk-fix-v-num-mac-count-55acd188162b
Best regards,
--
Jacob Keller <jacob.e.keller@intel.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] ice: fix vf->num_mac count with port representors
2025-04-10 18:13 [PATCH net] ice: fix vf->num_mac count with port representors Jacob Keller
@ 2025-04-11 5:52 ` Michal Swiatkowski
2025-04-12 18:51 ` Simon Horman
2025-05-06 7:24 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2 siblings, 0 replies; 4+ messages in thread
From: Michal Swiatkowski @ 2025-04-11 5:52 UTC (permalink / raw)
To: Jacob Keller; +Cc: Anthony Nguyen, Intel Wired LAN, netdev
On Thu, Apr 10, 2025 at 11:13:52AM -0700, Jacob Keller wrote:
> The ice_vc_repr_add_mac() function indicates that it does not store the MAC
> address filters in the firmware. However, it still increments vf->num_mac.
> This is incorrect, as vf->num_mac should represent the number of MAC
> filters currently programmed to firmware.
>
> Indeed, we only perform this increment if the requested filter is a unicast
> address that doesn't match the existing vf->hw_lan_addr. In addition,
> ice_vc_repr_del_mac() does not decrement the vf->num_mac counter. This
> results in the counter becoming out of sync with the actual count.
>
> As it turns out, vf->num_mac is currently only used in legacy made without
> port representors. The single place where the value is checked is for
> enforcing a filter limit on untrusted VFs.
>
> Upcoming patches to support VF Live Migration will use this value when
> determining the size of the TLV for MAC address filters. Fix the
> representor mode function to stop incrementing the counter incorrectly.
>
> Fixes: ac19e03ef780 ("ice: allow process VF opcodes in different ways")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> I am not certain if there is currently a way to trigger a bug from
> userspace due to this incorrect count, but I think it still warrants a net
> fix.
> ---
> drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> index 7c3006eb68dd071ab76e62d8715dc2729610586a..6446d0fcc0528656054e506c9208880ce1e417ea 100644
> --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> @@ -4275,7 +4275,6 @@ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg)
> }
>
> ice_vfhw_mac_add(vf, &al->list[i]);
> - vf->num_mac++;
> break;
> }
>
Right, thanks for fixing it.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> ---
> base-commit: a9843689e2de1a3727d58b4225e4f8664937aefd
> change-id: 20250410-jk-fix-v-num-mac-count-55acd188162b
>
> Best regards,
> --
> Jacob Keller <jacob.e.keller@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ice: fix vf->num_mac count with port representors
2025-04-10 18:13 [PATCH net] ice: fix vf->num_mac count with port representors Jacob Keller
2025-04-11 5:52 ` Michal Swiatkowski
@ 2025-04-12 18:51 ` Simon Horman
2025-05-06 7:24 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-04-12 18:51 UTC (permalink / raw)
To: Jacob Keller; +Cc: Anthony Nguyen, Intel Wired LAN, netdev
On Thu, Apr 10, 2025 at 11:13:52AM -0700, Jacob Keller wrote:
> The ice_vc_repr_add_mac() function indicates that it does not store the MAC
> address filters in the firmware. However, it still increments vf->num_mac.
> This is incorrect, as vf->num_mac should represent the number of MAC
> filters currently programmed to firmware.
>
> Indeed, we only perform this increment if the requested filter is a unicast
> address that doesn't match the existing vf->hw_lan_addr. In addition,
> ice_vc_repr_del_mac() does not decrement the vf->num_mac counter. This
> results in the counter becoming out of sync with the actual count.
>
> As it turns out, vf->num_mac is currently only used in legacy made without
> port representors. The single place where the value is checked is for
> enforcing a filter limit on untrusted VFs.
>
> Upcoming patches to support VF Live Migration will use this value when
> determining the size of the TLV for MAC address filters. Fix the
> representor mode function to stop incrementing the counter incorrectly.
>
> Fixes: ac19e03ef780 ("ice: allow process VF opcodes in different ways")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> I am not certain if there is currently a way to trigger a bug from
> userspace due to this incorrect count, but I think it still warrants a net
> fix.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [Intel-wired-lan] [PATCH net] ice: fix vf->num_mac count with port representors
2025-04-10 18:13 [PATCH net] ice: fix vf->num_mac count with port representors Jacob Keller
2025-04-11 5:52 ` Michal Swiatkowski
2025-04-12 18:51 ` Simon Horman
@ 2025-05-06 7:24 ` Buvaneswaran, Sujai
2 siblings, 0 replies; 4+ messages in thread
From: Buvaneswaran, Sujai @ 2025-05-06 7:24 UTC (permalink / raw)
To: Keller, Jacob E, Nguyen, Anthony L, Intel Wired LAN, netdev
Cc: Keller, Jacob E
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Jacob Keller
> Sent: Thursday, April 10, 2025 11:44 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Intel Wired LAN
> <intel-wired-lan@lists.osuosl.org>; netdev <netdev@vger.kernel.org>
> Cc: Keller, Jacob E <jacob.e.keller@intel.com>
> Subject: [Intel-wired-lan] [PATCH net] ice: fix vf->num_mac count with port
> representors
>
> The ice_vc_repr_add_mac() function indicates that it does not store the MAC
> address filters in the firmware. However, it still increments vf->num_mac.
> This is incorrect, as vf->num_mac should represent the number of MAC
> filters currently programmed to firmware.
>
> Indeed, we only perform this increment if the requested filter is a unicast
> address that doesn't match the existing vf->hw_lan_addr. In addition,
> ice_vc_repr_del_mac() does not decrement the vf->num_mac counter. This
> results in the counter becoming out of sync with the actual count.
>
> As it turns out, vf->num_mac is currently only used in legacy made without
> port representors. The single place where the value is checked is for
> enforcing a filter limit on untrusted VFs.
>
> Upcoming patches to support VF Live Migration will use this value when
> determining the size of the TLV for MAC address filters. Fix the representor
> mode function to stop incrementing the counter incorrectly.
>
> Fixes: ac19e03ef780 ("ice: allow process VF opcodes in different ways")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> I am not certain if there is currently a way to trigger a bug from userspace
> due to this incorrect count, but I think it still warrants a net fix.
> ---
> drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 -
> 1 file changed, 1 deletion(-)
>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-06 7:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 18:13 [PATCH net] ice: fix vf->num_mac count with port representors Jacob Keller
2025-04-11 5:52 ` Michal Swiatkowski
2025-04-12 18:51 ` Simon Horman
2025-05-06 7:24 ` [Intel-wired-lan] " Buvaneswaran, Sujai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).