Commit Graph

99 Commits

Author SHA1 Message Date
Gordon Bergling
9048d9a933 sed(1): Add a reference for a 4.4BSD manual document
Obtained from:	OpenBSD
MFC after:	1 week
2021-04-08 21:07:31 +02:00
Gleb Smirnoff
cf6ff85fe8 Catch up with 6edfd179c8: document M_EXTPG. While here sore flags
as they are in sys/mbuf.h
2021-01-29 11:46:24 -08:00
Gordon Bergling
ac81581df3 mbuf(9): Some markup fixes
- whitespace at end of input line
- no blank before trailing delimiter: Dv MJUM16BYTES

MFC after:	3 days
2020-09-17 20:53:24 +00:00
John-Mark Gurney
b6dd8b71d1 fix up docs for m_getjcl as well.. 2020-07-24 00:47:14 +00:00
John-Mark Gurney
92b56ebaf7 document that m_get2 only accepts up to MJUMPAGESIZE.. 2020-07-24 00:35:21 +00:00
John Baldwin
82334850ea Add an external mbuf buffer type that holds multiple unmapped pages.
Unmapped mbufs allow sendfile to carry multiple pages of data in a
single mbuf, without mapping those pages.  It is a requirement for
Netflix's in-kernel TLS, and provides a 5-10% CPU savings on heavy web
serving workloads when used by sendfile, due to effectively
compressing socket buffers by an order of magnitude, and hence
reducing cache misses.

For this new external mbuf buffer type (EXT_PGS), the ext_buf pointer
now points to a struct mbuf_ext_pgs structure instead of a data
buffer.  This structure contains an array of physical addresses (this
reduces cache misses compared to an earlier version that stored an
array of vm_page_t pointers).  It also stores additional fields needed
for in-kernel TLS such as the TLS header and trailer data that are
currently unused.  To more easily detect these mbufs, the M_NOMAP flag
is set in m_flags in addition to M_EXT.

Various functions like m_copydata() have been updated to safely access
packet contents (using uiomove_fromphys()), to make things like BPF
safe.

NIC drivers advertise support for unmapped mbufs on transmit via a new
IFCAP_NOMAP capability.  This capability can be toggled via the new
'nomap' and '-nomap' ifconfig(8) commands.  For NIC drivers that only
transmit packet contents via DMA and use bus_dma, adding the
capability to if_capabilities and if_capenable should be all that is
required.

If a NIC does not support unmapped mbufs, they are converted to a
chain of mapped mbufs (using sf_bufs to provide the mapping) in
ip_output or ip6_output.  If an unmapped mbuf requires software
checksums, it is also converted to a chain of mapped mbufs before
computing the checksum.

Submitted by:	gallatin (earlier version)
Reviewed by:	gallatin, hselasky, rrs
Discussed with:	ae, kp (firewalls)
Relnotes:	yes
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20616
2019-06-29 00:48:33 +00:00
John Baldwin
773123546b Sync mbuf flags, types, and external buffer types with <sys/mbuf.h>.
Sponsored by:	Netflix
2019-06-28 19:49:47 +00:00
John Baldwin
7b29ab7e25 Use a tab after #define for EXT_* constants.
This matches other #define's in this manpage as well as <sys/mbuf.h>.

Sponsored by:	Netflix
2019-06-28 19:37:48 +00:00
Gleb Smirnoff
e8fd18f306 Shorten list of arguments to mbuf external storage freeing function.
All of these arguments are stored in m_ext, so there is no reason
to pass them in the argument list.  Not all functions need the second
argument, some don't even need the first one.  The second argument
lives in next cache line, so not dereferencing it is a performance
gain.  This was discovered in sendfile(2), which will be covered by
next commits.

The second goal of this commit is to bring even more flexibility
to m_ext mbufs, allowing to create more fields in m_ext, opaque to
the generic mbuf code, and potentially set and dereferenced by
subsystems.

Reviewed by:	gallatin, kbowling
Differential Revision:	https://reviews.freebsd.org/D12615
2017-10-09 20:35:31 +00:00
Andriy Voskoboinyk
1af4a58503 mbuf(9), mbuf_tags(9): fix function prototypes.
- Add m_getclr(9) symlink to ObsoleteFiles.inc (removed in r295481).
- Add const qualifiers in m_dup(), m_dup_pkthdr() and m_tag_copy_chain()
(r286450).
- Fix m_dup_pkthdr() definition (it's not the same as m_move_pkthdr()).

MFC after:	5 days
2016-10-10 17:16:02 +00:00
Kevin Lo
a951a78821 Update a comment to reflect r305051. 2016-08-30 08:34:49 +00:00
Mark Johnston
a3f6b02969 Document m_catpkt(), and remove misinformation about m_cat(9).
Since m_cat() may copy data from the second mbuf chain into the last mbuf
of the first chain, it may free the first mbuf of the second chain. Thus,
the second chain is not guaranteed to be valid after m_cat() returns.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D5497
2016-03-02 04:58:51 +00:00
Enji Cooper
f2e3428854 Remove MLINKS to more non-existent mbuf(9) macros
X-MFC with: r288295
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-09-27 04:55:43 +00:00
Enji Cooper
c91afdd4d0 Posthumously remove all references to MFREE(9)
The macro was removed in r90227

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-09-27 04:40:54 +00:00
Mark Johnston
f66b6464c6 Document m_collapse().
Reported by:	kmacy
Reviewed by:	kmacy
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-03-12 01:05:54 +00:00
Robert Watson
2a8c860fe3 In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET()
(and m_cljget() that underlies it) to allow the caller to avoid testing
M_EXT itself.  Update all callers to use the return value.

With this change, very few network device drivers remain aware of
M_EXT; the primary exceptions lie in mbuf-chain pretty printers for
debugging, and in a few cases, custom mbuf and cluster allocation
implementations.

NB: This is a difficult-to-test change as it touches many drivers for
which I don't have physical devices.  Instead we've gone for intensive
review, but further post-commit review would definitely be appreciated
to spot errors where changes could not easily be made mechanically,
but were largely mechanical in nature.

Differential Revision:	https://reviews.freebsd.org/D1440
Reviewed by:	adrian, bz, gnn
Sponsored by:	EMC / Isilon Storage Division
2015-01-06 12:59:37 +00:00
Christian Brueffer
1e9469d188 Fix various mdoc issues and some EOL whitespace.
Found with:	mandoc -Tlint
2014-12-21 10:57:42 +00:00
John-Mark Gurney
d31a976084 it is not cast to a pointer of the specified type, it is cast to the
specified type...

mtod(m, uint8_t) does not work, mtod(m, uint8_t *) does work..
2014-10-21 17:59:27 +00:00
John-Mark Gurney
e0912e08e4 spell out the arguments..
the + *offsetp does not belong w/ the type, move it outside the .Fn
macro...
2014-10-21 17:17:40 +00:00
Kevin Lo
33d8df4b31 Catch up with recent changes... 2014-06-05 03:16:23 +00:00
Kevin Lo
18f169af92 Document m_get2().
Reviewed by:	glebius
2014-04-30 08:51:30 +00:00
Kevin Lo
ada46fe963 Change type from int to short to match function prototypes.
Reviewed by:	glebius
2014-04-30 07:17:51 +00:00
Gleb Smirnoff
ba82ceef53 Remove notes about historical mbuf(9) allocator flags from documentation.
Sponsored by:	Nginx, Inc.
2014-01-16 13:58:55 +00:00
John-Mark Gurney
c89929d81a bump Dd
Reminded by:	gjb
2013-12-21 00:15:37 +00:00
John-Mark Gurney
5c35eb22d4 document the m_getjcl function... 2013-12-20 23:57:05 +00:00
Andre Oppermann
327210de43 Remove description of deprecated IP fragment checksum support.
Since SMPng it wasn't really supported anymore and if it worked
then only by chance.  Only very few drivers ever supported it.

Discussed with:	yongari
MFC after:	2 weeks
2012-11-13 20:52:17 +00:00
Kevin Lo
969ed8f744 The argument len of m_pullup(9) could be less than or equal to MHLEN.
Reviewed by:	glebius
2012-10-30 10:13:26 +00:00
Kevin Lo
2e3ee2392a Fix MINCLSIZE. It should be MHLEN + 1.
Reviewed by:	glebius
2012-10-25 08:38:43 +00:00
Glen Barber
73bbeaa529 Typo and mdoc(7) style fixes.
PR:		168117
Submitted by:	Nobuyuki Koganemaru (kogane&jp!freebsd!org)
MFC after:	3 days
2012-05-20 16:43:47 +00:00
Gleb Smirnoff
fa05d2156e It is already seven years since mbuf allocator uses same
M_WAITOK/M_NOWAIT flags as malloc(9). Update manual page.

Submitted by:	Vadim Goncharov <vadimnuclight tpu.ru>
2011-04-18 15:30:25 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Dag-Erling Smørgrav
c3a2dbe9e5 Document the MEXTADD macro.
MFC after:	2 weeks
2010-08-07 13:26:08 +00:00
Ruslan Ermilov
ea26d58729 Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.
Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true
since the advent of MBUMA.

Reviewed by:	arch

There are ongoing disputes as to whether we want to switch to directly using
UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
2008-03-25 09:39:02 +00:00
Poul-Henning Kamp
cf827063a9 Give MEXTADD() another argument to make both void pointers to the
free function controlable, instead of passing the KVA of the buffer
storage as the first argument.

Fix all conventional users of the API to pass the KVA of the buffer
as the first argument, to make this a no-op commit.

Likely break the only non-convetional user of the API, after informing
the relevant committer.

Update the mbuf(9) manual page, which was already out of sync on
this point.

Bump __FreeBSD_version to 800016 as there is no way to tell how
many arguments a CPP macro needs any other way.

This paves the way for giving sendfile(9) a way to wait for the
passed storage to have been accessed before returning.

This does not affect the memory layout or size of mbufs.

Parental oversight by:	sam and rwatson.

No MFC is anticipated.
2008-02-01 19:36:27 +00:00
Bruce M Simpson
d305f4b99e Document m_pulldown().
Obtained from:	MBUF issues in 4.4BSD IPv6/IPsec support (itojun)
2007-02-26 15:17:19 +00:00
Robert Watson
db430f9709 Expand history and authors section of mbuf.9 man page to discuss recent
transition to mbuma (FreeBSD 5.3) and the fact that mbufs are now limited
almost entirely to packet storage, with straight UMA zones being used for
most other network data types.
2007-02-15 14:44:46 +00:00
Julian Elischer
1009bd1b0d Explicitly emphasize a facet of m_pullup() that some people seem to
frequently forget. i.e. that you can not keep using pointers to
within the old chain.
2006-12-08 23:44:30 +00:00
Maxim Konovalov
1cb58a0783 o GC MT_FTABLE removed in rev. 1.192 mbuf.h.
o Correct MT_HEADER define.
2006-07-24 07:32:23 +00:00
Sam Leffler
47e2996e8b promote fast ipsec's m_clone routine for public use; it is renamed
m_unshare and the caller can now control how mbufs are allocated

Reviewed by:	andre, luigi, mlaier
MFC after:	1 week
2006-03-15 21:11:11 +00:00
Andre Oppermann
cb752e17a9 Remove references to MEXT_ADD_REF, MEXT_REM_REF and MEXT_IS_REF
which were removed with rev. 1.179 of mbuf.h.

Sponsored by:	TCP/IP Optimization Fundraise 2005
2005-11-18 17:04:49 +00:00
Sam Leffler
9c3fd40489 describe m_align 2005-08-08 00:50:25 +00:00
Hiten Pandya
571dba6ec9 Use 'manual page' instead of 'man page' for consistency.
Approved by:	re (hrs)
2005-06-28 20:15:19 +00:00
Ruslan Ermilov
4f06896130 Assorted markup fixes and minor wordsmithing.
Approved by:	re
2005-06-15 13:31:23 +00:00
John-Mark Gurney
7ac139a904 add m_copyup function.. This can be used to help make our ip stack less
alignment restrictive, and help performance on some ethernet cards which
currently copy the entire packet a couple bytes to get the packet aligned
properly...

Wordsmithing by:	dwhite
Obtained from:	NetBSD (code only)
I'll clean it up later:	rwatson
2005-03-17 19:34:57 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Sam Leffler
b9def06b29 document m_append 2004-12-08 17:47:49 +00:00
John-Mark Gurney
b7131a2672 document that m_free returns m_next of the free'd mbuf 2004-08-28 03:46:18 +00:00
Maxim Konovalov
9193b9a5a1 MT_TAG is dead. 2004-07-07 16:48:16 +00:00
Ruslan Ermilov
5203edcdc5 Mechanically kill hard sentence breaks and double whitespaces. 2004-07-03 18:29:24 +00:00