On 6/24/26 18:30, Simon Horman wrote:
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://netdev-ai.bots.linux.dev/sashiko/
---
i40e: skip unnecessary VF reset when setting trust

This patch avoids the ~10 second VF reset delay on trust changes by
flipping the I40E_VIRTCHNL_VF_CAP_PRIVILEGE bit directly, and only
resorting to a full reset when revoking trust from a VF that has
advanced features (ADQ, cloud filters, UC/MC promisc) configured.

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c 
b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index a26c3d47ec15..0cc434b26eb8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -4987,19 +5004,20 @@ int i40e_ndo_set_vf_trust(struct net_device *netdev, 
int vf_id, bool setting)
        set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state);
        pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED;
- i40e_vc_reset_vf(vf, true);
+       /* Reset only if revoking trust and VF has advanced features configured 
*/
+       if (!setting &&
+           (vf->adq_enabled || vf->num_cloud_filters > 0 ||
+            test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states) ||
+            test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))) {

[High]
Does this revoke-trust heuristic miss MAC/VLAN filters that were only
installable while the VF was trusted?

No.


A trusted VF is allowed to add many more MAC addresses than
I40E_VC_MAX_MAC_ADDR_PER_VF (i40e_check_vf_permission() uses
I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF) and more than I40E_VC_MAX_VLAN_PER_VF
VLANs.  These quotas are enforced only at add-time.

The previous always-reset path went through i40e_vc_reset_vf() ->
i40e_cleanup_reset_vf() -> i40e_free_vf_res() -> i40e_vsi_release(),
which destroyed the VSI and its mac_filter_hash, and reset
vf->num_vlan = 0.

Current "reset only on revoke" does exactly the same.


The new fast path only flips the PRIVILEGE bit, leaving any

NOPE.
New "fast path" only *TESTS* the PRIVILEGE bit,
it does not "clear" it in fast path.

This is just negated/wrong/inverted logic on AI side


Reply via email to