Page MenuHomeFreeBSD

iavf: fix the first TX credits update in head writeback mode
Needs ReviewPublic

Authored by wanpengqian_gmail.com on Fri, Oct 2, 3:37 AM.
Tags
None
Referenced Files
F174347562: D60216.diff
Fri, Oct 2, 2:31 PM
F174341111: D60216.id188357.diff
Fri, Oct 2, 1:16 PM
F174335357: D60216.diff
Fri, Oct 2, 12:04 PM
F174309844: D60216.diff
Fri, Oct 2, 6:37 AM
F174309803: D60216.id188357.diff
Fri, Oct 2, 6:36 AM
Subscribers

Details

Reviewers
vmaffione
kbowling
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

iavf_init_tx_cidx() has the same initial value as ixl_init_tx_cidx()
had: the end of the ring, which is right for the report status queue
(iavf_init_tx_rsqs()) but makes iavf_isc_txd_credits_update_hwb()
report one descriptor too many on the first update after an
initialization. Head writeback is off by default in iavf
(hw.iavf.enable_head_writeback). With it on, the netmap TX ring of a VF
shows no free slot as soon as the NIC has caught up after two or more
packets were submitted in one txsync. See the ixl change for the
details.

Initialize tx_cidx_processed to 0 in head writeback mode.

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Sponsored by: keelos.dev

Test Plan

Builds on main at f958aa7e7 (2026-10-02), GENERIC amd64.

Run-tested on hardware with 14.5-RELEASE's kernel plus this change (keelOS, a FreeBSD 14.5 based system); iavf_init_tx_cidx() and iavf_isc_txd_credits_update_hwb() are identical in main. A VF of the on-board X722 (0x8086:0x37cd), created with iovctl on ixl0 and attached to the host's iavf (passthrough : false), with hw.iavf.enable_head_writeback=1.

Reproducer: nmempty.c from D60217, nmempty iavf0 COUNT 15 2 0: 2 packets per NIOCTXSYNC, a second NIOCTXSYNC 20 ms later, no empty packets.

Before: iavf0: TX ring stuck after 2 packets: head 2 cur 2 tail 2 (of 1024).

After: 200 packets in bursts of 2 and 400 in bursts of 8 complete, and the ring ends with tail == head - 1.

With one packet per txsync the problem does not show (the reclaim that follows each packet finds the NIC one descriptor behind), which is why it needs a burst.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77592
Build 74475: arc lint + arc unit