Page MenuHomeFreeBSD

xen/netfront: deal with mbuf data crossing a page boundary
ClosedPublic

Authored by royger on Jan 13 2022, 3:37 PM.
Tags
None
Referenced Files
F82164426: D33876.id101413.diff
Fri, Apr 26, 2:42 AM
F82164294: D33876.id112554.diff
Fri, Apr 26, 2:40 AM
F82163461: D33876.id.diff
Fri, Apr 26, 2:28 AM
Unknown Object (File)
Thu, Apr 25, 8:42 PM
Unknown Object (File)
Mar 27 2024, 1:46 PM
Unknown Object (File)
Mar 10 2024, 10:12 AM
Unknown Object (File)
Mar 10 2024, 10:12 AM
Unknown Object (File)
Mar 10 2024, 10:12 AM

Details

Summary

There's been a report recently of mbufs with data that crosses a page
boundary. It seems those mbufs are generated by the iSCSI target
system:

https://lists.xenproject.org/archives/html/xen-devel/2021-12/msg01581.html

In order to handle those mbufs correctly on netfront use the bus_dma
interface and explicitly request that segments must not cross a page
boundary. No other requirements are necessary, so it's expected that
bus_dma won't need to bounce the data and hence it shouldn't
introduce a too big performance penalty.

Using bus_dma requires some changes to netfront, mainly in order to
accommodate for the fact that now ring slots no longer have a 1:1
match with mbufs, as a single mbuf can use two ring slots if the data
buffer crosses a page boundary. Store the first packet of the mbuf
chain in every ring slot that's used, and use a mbuf tag in order to
store the bus_dma related structures and a refcount to keep track of
the pending slots before the mbuf chain can be freed.

Reported by: G.R.
Tested by: G.R.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43900
Build 40788: arc lint + arc unit