diff options
| author | Justin Hibbits <jhibbits@FreeBSD.org> | 2026-08-10 18:24:08 +0000 |
|---|---|---|
| committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2026-08-22 16:03:31 +0000 |
| commit | 1d445ae68446771c78161a3eca35acdb04ef78ab (patch) | |
| tree | 8ddaf97b977fe00e2ec895f8c94fe2ebd7db203c /pythonmod/examples | |
| parent | d59c7ea2701fe7b73b32eef49a7c712ef38de5a0 (diff) | |
dpaa/eth: fast-path single-page TX frame build
The TX SG-build loop in dpaa_eth_if_start_locked() walked page
boundaries with PAGE_MASK arithmetic even for buffers that lived
entirely within one page -- the common case, since MCLBYTES
is smaller than PAGE_SIZE. Add a fast path that emits a single SGT
entry for wholly-in-one-page segments and skips the inner while
entirely.
Fix the following bugs while we're here:
1. "if (m->m_len == 0) continue;" in the outer loop never
advanced m -- any zero-length mbuf hung the TX path in an
infinite loop. Fix this by switching to a for loop, with the
advancement in the post-clause.
2. In the inner (page-splitting) loop, the cap
"if (m->m_len < ssize) ssize = m->m_len;" compared against
the mbuf's original length, not the remaining bytes. A single mbuf
whose data started mid-page and ran into a second page would produce
a second SGT entry with ssize > rem, over-reading past the buffer end
into whatever followed in kernel memory. Fixed by tracking a local
rem and capping ssize against it.
3. If the whole mbuf chain consisted of zero-length segments,
the final-flag store "fi_sgt[i - 1].final = 1" wrote to
index -1. Reject empty frames up front now instead.
As part of this, rename the inner counter from dsize to rem for clarity
instead of playing double-duty in both inner and outer loops.
Diffstat (limited to 'pythonmod/examples')
0 files changed, 0 insertions, 0 deletions
