Skip to content

Fix i40e/ice/iavf VF bonding after netdev lock changes

Jose Ignacio Tornos Martinez intel-wired-lan netdev stable 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest4 patches 8 repliesIn review
  2. v64 patches 6 repliesSuperseded
  3. v54 patches 8 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v44 patches15 repliesSuperseded
v35 patches12 repliesSuperseded
v24 patches5 repliesSuperseded
v13 patches2 repliesSuperseded

Changes in v7 from the cover letter

- Patches 1/4, 2/4 and 4/4: No changes from v6
- Patch 3/4:
Rebase on current net tree
Remove the multi-batch processing loop from version 6 according to Przemek Kitszel review: the loop cannot work without polling between iterations since the second call would fail the current_op check. Multi-batch scenario is extremely rare; send first batch and let watchdog handle remainder as v5 did
v6: https://lore.kernel.org/all/[email protected]/

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iavf: return EBUSY if reset in progress or not ready during MAC changedrivers/net/ethernet/intel/iavf/iavf_main.c+3 -00 replies
2/4i40e: skip unnecessary VF reset when setting trustdrivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+28 -102 replies
3/4iavf: send MAC change request synchronouslydrivers/net/ethernet/intel/iavf/iavf.h drivers/net/ethernet/intel/iavf/iavf_main.c drivers/net/ethernet/intel/iavf/iavf_virtchnl.c+165 -305 replies
4/4ice: skip unnecessary VF reset when setting trustdrivers/net/ethernet/intel/ice/ice_sriov.c+30 -51 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchPrzemek KitszelAleksandr LoktionovRafal Romanowski
1/4R-b R-b T-b
2/4T-b
3/4R-b T-b
4/4R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v7 thread

Cover letter [PATCH net v7 0/4] Fix i40e/ice/iavf VF bonding after netdev lock changes

This series fixes VF bonding failures introduced by commit ad7c7b2172c3 ("net: hold netdev instance lock during sysfs operations").

When adding VFs to a bond immediately after setting trust mode, MAC address changes fail with -EAGAIN, preventing bonding setup. This affects both i40e (700-series) and ice (800-series) Intel NICs.

The core issue is lock contention: iavf_set_mac() is now called with the netdev lock held and waits for MAC change completion while holding it. However, both the watchdog task that sends the request and the adminq_task that processes PF responses also need this lock, creating a deadlock where neither can run, causing timeouts.

Additionally, setting VF trust triggers an unnecessary ~10 second VF reset in i40e driver that delays bonding setup, even though filter synchronization happens naturally during normal VF operation. For ice driver, the delay is not so big, but in the same way the operation is not necessary.

This series:
1. Adds safety guard to prevent MAC changes during reset or early initialization (before VF is ready)
2. Eliminates unnecessary VF reset when setting trust in i40e (reset only if revoking trust and VF has advanced features configured).
3. Fixes lock contention by polling admin queue synchronously
4. Eliminates unnecessary VF reset when setting trust in ice, (reset only if revoking trust and VF has advanced features configured).

The key fix (patch 3/4) implements a synchronous MAC change operation similar to the approach used for ndo_change_mtu deadlock fix:
https://lore.kernel.org/intel-wired-lan/[email protected]/
Instead of scheduling work and waiting, it:

- Sends the virtchnl message directly (not via watchdog)
- Polls the admin queue hardware directly for responses
- Processes all messages inline (including non-MAC messages)
- Returns when complete or times out

This allows the operation to complete synchronously while holding netdev_lock, without relying on watchdog or adminq_task.

The function can sleep for up to 2.5 seconds polling hardware, but this is acceptable since netdev_lock is per-device and only serializes operations on the same interface.

Testing shows VF bonding now works reliably in ~5 seconds vs 15+ seconds before (i40e), without timeouts or errors (i40e and ice).

Tested on Intel 700-series (i40e) and 800-series (ice) dual-port NICs with iavf driver.

Thanks to Jan Tluka <[email protected]> and Yuying Ma <[email protected]> for reporting the issues.

Jose Ignacio Tornos Martinez (4):
iavf: return EBUSY if reset in progress or not ready during MAC change
i40e: skip unnecessary VF reset when setting trust
iavf: send MAC change request synchronously
ice: skip unnecessary VF reset when setting trust

All patches tested successfully with bonding setup.
---
v7:
- Patches 1/4, 2/4 and 4/4: No changes from v6
- Patch 3/4:
Rebase on current net tree
Remove the multi-batch processing loop from version 6 according to Przemek Kitszel review: the loop cannot work without polling between iterations since the second call would fail the current_op check. Multi-batch scenario is extremely rare; send first batch and let watchdog handle remainder as v5 did
v6: https://lore.kernel.org/all/[email protected]/

--
2.43.0