freebsd-dev/sys/dev/xen
Roger Pau Monné dabb3db7a8 xen/netfront: deal with mbuf data crossing a page boundary
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.
MFC: 1 week
Differential revision: https://reviews.freebsd.org/D33876
2022-11-03 13:32:21 +01:00
..
balloon xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
blkback Fix unused variable warning in xen's blkback.c 2022-07-26 19:59:55 +02:00
blkfront Fix unused variable warning in xen's blkfront.c 2022-07-26 19:59:55 +02:00
bus pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t. 2022-09-22 15:08:52 -07:00
console xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
control Adjust function definitions in xen's control.c to avoid clang 15 warnings 2022-07-26 19:59:55 +02:00
cpu xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
debug xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
efi xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00
evtchn xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
gntdev xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
grant_table xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
netback xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
netfront xen/netfront: deal with mbuf data crossing a page boundary 2022-11-03 13:32:21 +01:00
privcmd xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
timer xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
xenpci xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
xenstore xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00