Page MenuHomeFreeBSD

Add functions to allocate and copy into anonymous unmapped mbuf lists
ClosedPublic

Authored by rmacklem on Jun 7 2020, 11:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 3, 9:27 AM
Unknown Object (File)
Mar 31 2024, 5:59 AM
Unknown Object (File)
Mar 19 2024, 10:35 PM
Unknown Object (File)
Mar 19 2024, 11:08 AM
Unknown Object (File)
Mar 4 2024, 4:21 PM
Unknown Object (File)
Feb 21 2024, 8:50 PM
Unknown Object (File)
Jan 7 2024, 6:08 AM
Unknown Object (File)
Jan 7 2024, 6:08 AM
Subscribers

Details

Summary

The nfs-over-tls code needs to allocate ext_pgs mbufs with anonymous pages
allocated to them and copy data from a regular mbuf list into this list.
This is needed, since KERN_TLS tx only handles ext_pgs mbufs.

Since these were generic mbuf handling routines, I thought they might
have other uses, so I put them in sys/kern/kern_mbuf.c.

They could easily be renamed and moved to sys/rpc if they are felt not
to be useful elsewhere.
--> The nfs-over-tls code always calls these with M_WAITOK.

As such, maybe they shouldn't even have a "how" argument?
Test Plan

They have been tested in the nfs-over-tls code, although only
for the M_WAITOK case.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kern/kern_mbuf.c
1598 ↗(On Diff #72807)

m can be null only on the first iteration, right? I would have allocated the initial m outside the loop, parly to avoid the test on each iteration (which the compiler might optimize out), but more to reduce the cognitive load on the reader, by removing complexity from the loop.

1631 ↗(On Diff #72807)

memcpy() seems to be preferred these days for new code

Made the changes suggested by gallatin@, which
I do think makes the code more readable.

This revision is now accepted and ready to land.Jun 9 2020, 5:09 PM