History log of /dragonfly/sys/kern/uipc_mbuf.c (Results 1 – 25 of 147)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b44c913f 28-Feb-2024 Aaron LI <aly@aaronly.me>

net: Reimplement packet loop detection based on mbuf tags

The original naive implementation based on mbuf 'm_pkthdr.loop_cnt' was
flawed:

* There were likely some code paths that allocated mbufs fa

net: Reimplement packet loop detection based on mbuf tags

The original naive implementation based on mbuf 'm_pkthdr.loop_cnt' was
flawed:

* There were likely some code paths that allocated mbufs failed to
initialize the 'loop_cnt' to be zero. This caused unwanted packet
drops in gif(4), as reported by Kyle Butt (iteratee).

* The 'loop_cnt' was system-wide and thus cannot distinguish between the
nesting of specific drivers. For example, it would break an actually
valid setup that makes use of both gif(4) and gre(4).

As a result, follow the FreeBSD's way and reimplement the packet loop
detection based on mbuf tags. Each driver is allocated a unique mbuf
tag cookie, and thus a unique mbuf tag will be created to track the
nesting level of each driver.

The if_tunnel_check_nesting() was derived from FreeBSD but I changed it
to use only one mbuf tag for each cookie (i.e., driver). Although it
can no longer directly detect that a packet loops through the same
interface, it would still be prevented as that would lead to infinite
recursions.

Update gif(4), gre(4) and wg(4) to use the new loop detection facility.

Bump __DragonFly_version as well.

Reported-by: Kyle Butt (iteratee)

show more ...


# 1d7290e5 13-Jan-2024 Aaron LI <aly@aaronly.me>

mbuf(9): Add 'm_pkthdr.loop_cnt' for loop detection

Extend the 'm_pkthdr' struct to provide the 'loop_cnt' member by using
currently unused space. Therefore, drivers (e.g., gif, gre, wg) can
make u

mbuf(9): Add 'm_pkthdr.loop_cnt' for loop detection

Extend the 'm_pkthdr' struct to provide the 'loop_cnt' member by using
currently unused space. Therefore, drivers (e.g., gif, gre, wg) can
make use of this new member to easily implement loop detection.

Bump __DragonFly_version.

Discussed-with: dillon
Referred-to: OpenBSD

show more ...


# 8a7a7510 22-Dec-2023 Aaron LI <aly@aaronly.me>

objcache(9): Remove the unused ocflag arg from objcache_reclaimlist()


# 58618f27 12-Jan-2024 Aaron LI <aly@aaronly.me>

mbuf(9): Add assertions of off/len parameters for _m_copyback2()

Similar to the similar assertions in several other functions.


# 4e4d812d 03-Jan-2024 Aaron LI <aly@aaronly.me>

mbuf(9): Add assertion of 'offset == 0' for m_devget()

As commented above the m_devget() function, the 'offset' argument is
ill-defined and unused; all callers should specify 0 for it. So add an
as

mbuf(9): Add assertion of 'offset == 0' for m_devget()

As commented above the m_devget() function, the 'offset' argument is
ill-defined and unused; all callers should specify 0 for it. So add an
assertion for that.

Meanwhile, fix two callers that didn't satisfy this.

show more ...


# 279c625b 03-Jan-2024 Aaron LI <aly@aaronly.me>

mbuf(9): Tweak a wrongly wrapped conditional in m_free()


# 2a074a6d 03-Jan-2024 Aaron LI <aly@aaronly.me>

mbuf(9): Fix a serious bug: remove extra pointer to caddr_t/c_caddr_t

The 'caddr_t' and 'c_caddr_t' types are already *pointer* to 'char' and
'const char', respectively, so no need and can't add one

mbuf(9): Fix a serious bug: remove extra pointer to caddr_t/c_caddr_t

The 'caddr_t' and 'c_caddr_t' types are already *pointer* to 'char' and
'const char', respectively, so no need and can't add one more pointer to
them.

This bug was my mistake in commit
ef09a3ed3479755d29ff48a4e81912847e96139a.
It broke the pointer arithmetic and caused some weird issues (e.g.,
system panic, SSH connection lost when transferring lots of data).

show more ...


# e843874b 28-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Various minor updates and style cleanups

- Fix the comment that MSIZE/MCLBYTES is defined in <sys/param.h>
instead of <machine/param.h>; update the man page accordingly.
- Adjust some typ

mbuf(9): Various minor updates and style cleanups

- Fix the comment that MSIZE/MCLBYTES is defined in <sys/param.h>
instead of <machine/param.h>; update the man page accordingly.
- Adjust some type casts in mtod() to be more consistent.
- Add the '__unused' attribute to actually unused parameters.
- Remove unused NCL_INIT/NMB_INIT macros from 'uipc_mbuf.c'.
- Use '__func__' instead of hard-coding function names.
- Fix several typos.
- Various style cleanups, mainly whitesapce adjustments.

show more ...


# ef09a3ed 28-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Use 'void *' in several public APIs to save casts in callers

Update the following public APIs to use 'void *' or 'const void *'
instead of 'caddr_t'/'c_caddr_t'/'char *', so that callers no

mbuf(9): Use 'void *' in several public APIs to save casts in callers

Update the following public APIs to use 'void *' or 'const void *'
instead of 'caddr_t'/'c_caddr_t'/'char *', so that callers no longer
need to do explicit casts:

- m_append()
- m_copyback()
- m_copyback2()
- m_copydata()
- m_devget()
- m_extadd()

show more ...


# 89ac0fe9 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Use 'c_caddr_t' (const) for m_copyback()/m_copyback2()


# 5a94fd7a 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Fix a code bug in m_dup_data()


# 03c0424b 21-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Restrict m_copyback() to forbid mbuf expansion

Most uses of m_copyback() are in-place updates to a portion (e.g., the
header) of a packet, so no mbuf allocation is required. It's more clea

mbuf(9): Restrict m_copyback() to forbid mbuf expansion

Most uses of m_copyback() are in-place updates to a portion (e.g., the
header) of a packet, so no mbuf allocation is required. It's more clear
to make m_copyback() forbid mbuf expansion instead of let it implicitly
do allocation with how=M_NOWAIT. Due to the lack of a return value, the
caller is hard to identify an m_copyback() failure, so diagnostics info
will be printed to the console in that case.

Change the original m_copyback2() to be an inline function, and
implement both m_copyback() and m_copyback2() as wrappers of it.

Bump __DragonFly_version for this behavior change.

Discussed-with: dillon

show more ...


# 10ab128c 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Improve m_copyback2() to use the trailing space

Make use of the trailing space of the last mbuf if available, both in
skipping the offset and in copying back the data.

As a side benefit of

mbuf(9): Improve m_copyback2() to use the trailing space

Make use of the trailing space of the last mbuf if available, both in
skipping the offset and in copying back the data.

As a side benefit of this change, the 'm0->m_len' field no longer needs
to be initialized and can simply be 0, as in a newly allocated mbuf.

Referred to both OpenBSD and FreeBSD; however, they only try to use the
trailing space in copying the data.

show more ...


# 257f89eb 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Improve m_copyback2() to support mbuf clusters

Update to use m_getl() to allocate mbuf clusters whenever necessary.

Referred to OpenBSD.


# 0d413bfe 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Minor cleanups to m_copyback2()


# a754d566 22-Dec-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Add m_copyback2() for a better m_copyback()

The existing m_copyback() may extends the mbuf chain if necessary, but
it doesn't return a value to indicate whether the allocation fails. In
ad

mbuf(9): Add m_copyback2() for a better m_copyback()

The existing m_copyback() may extends the mbuf chain if necessary, but
it doesn't return a value to indicate whether the allocation fails. In
addition, it doesn't allow to specify the M_WAITOK/M_NOWAIT flag for
mbuf allocation.

Extend m_copyback() and name it m_copyback2() that has the 'how'
parameter to specify M_WAITOK/M_NOWAIT flag and return an error code to
indication the success/failure.

Reimplement the original m_copyback() using m_copyback2() with
how=M_NOWAIT.

Referred-to: OpenBSD

show more ...


# 09195ea1 06-Nov-2023 Aaron LI <aly@aaronly.me>

mbuf(9): Remove obsolete and unused 'kern.ipc.mbuf_wait' sysctl

This sysctl MIB has been obsolete and unused since the re-implementation
of mbuf allocation using objcache(9) in commit 7b6f875 (year

mbuf(9): Remove obsolete and unused 'kern.ipc.mbuf_wait' sysctl

This sysctl MIB has been obsolete and unused since the re-implementation
of mbuf allocation using objcache(9) in commit 7b6f875 (year 2005).
Remove this sysctl MIB.

Update the mbuf.9 manpage about the 'how' argument to avoid ambiguity,
i.e., MGET()/m_get() etc. would not fail if how=M_WAITOK.

show more ...


Revision tags: v6.4.0, v6.4.0rc1, v6.5.0, v6.2.2, v6.2.1, v6.2.0, v6.3.0, v6.0.1, v6.0.0, v6.0.0rc1, v6.1.0, v5.8.3, v5.8.2, v5.8.1, v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# 3f7b7260 23-Oct-2019 Sascha Wildner <saw@online.de>

world/kernel: Use the rounddown2() macro in various places.

Tested-by: zrj


Revision tags: v5.6.2, v5.6.1, v5.6.0, v5.6.0rc1, v5.7.0, v5.4.3, v5.4.2
# fcf6efef 02-Mar-2019 Sascha Wildner <saw@online.de>

kernel: Remove numerous #include <sys/thread2.h>.

Most of them were added when we converted spl*() calls to
crit_enter()/crit_exit(), almost 14 years ago. We can now
remove a good chunk of them agai

kernel: Remove numerous #include <sys/thread2.h>.

Most of them were added when we converted spl*() calls to
crit_enter()/crit_exit(), almost 14 years ago. We can now
remove a good chunk of them again for where crit_*() are
no longer used.

I had to adjust some files that were relying on thread2.h
or headers that it includes coming in via other headers
that it was removed from.

show more ...


Revision tags: v5.4.1, v5.4.0, v5.5.0, v5.4.0rc1
# baf09c85 21-Jul-2018 Sepherosa Ziehau <sephe@dragonflybsd.org>

mbuf: Reduce objcache name verbosity.


Revision tags: v5.2.2, v5.2.1, v5.2.0, v5.3.0, v5.2.0rc, v5.0.2, v5.0.1, v5.0.0, v5.0.0rc2, v5.1.0, v5.0.0rc1
# 3609ac1a 14-Aug-2017 Matthew Dillon <dillon@apollo.backplane.com>

kernel - Increase default mbufs

* Increase default mbuf clusters by 4x

* Increase default mbuf jclusters by 2x

* Change the minimum (for now) to a smaller portion of the total mbuf
capacity.


# ceb127be 08-Aug-2017 Sepherosa Ziehau <sephe@dragonflybsd.org>

mbuf: Minor style change.


Revision tags: v4.8.1, v4.8.0, v4.6.2, v4.9.0, v4.8.0rc, v4.6.1
# afd2da4d 03-Aug-2016 Matthew Dillon <dillon@apollo.backplane.com>

kernel - Remove PG_ZERO and zeroidle (page-zeroing) entirely

* Remove the PG_ZERO flag and remove all page-zeroing optimizations,
entirely. Aftering doing a substantial amount of testing, these

kernel - Remove PG_ZERO and zeroidle (page-zeroing) entirely

* Remove the PG_ZERO flag and remove all page-zeroing optimizations,
entirely. Aftering doing a substantial amount of testing, these
optimizations, which existed all the way back to CSRG BSD, no longer
provide any benefit on a modern system.

- Pre-zeroing a page only takes 80ns on a modern cpu. vm_fault overhead
in general is ~at least 1 microscond.

- Pre-zeroing a page leads to a cold-cache case on-use, forcing the fault
source (e.g. a userland program) to actually get the data from main
memory in its likely immediate use of the faulted page, reducing
performance.

- Zeroing the page at fault-time is actually more optimal because it does
not require any reading of dynamic ram and leaves the cache hot.

- Multiple synth and build tests show that active idle-time zeroing of
pages actually reduces performance somewhat and incidental allocations
of already-zerod pages (from page-table tear-downs) do not affect
performance in any meaningful way.

* Remove bcopyi() and obbcopy() -> collapse into bcopy(). These other
versions existed because bcopy() used to be specially-optimized and
could not be used in all situations. That is no longer true.

* Remove bcopy function pointer argument to m_devget(). It is no longer
used. This function existed to help support ancient drivers which might
have needed a special memory copy to read and write mapped data. It has
long been supplanted by BUSDMA.

show more ...


Revision tags: v4.6.0, v4.6.0rc2, v4.6.0rc, v4.7.0, v4.4.3, v4.4.2, v4.4.1, v4.4.0, v4.5.0, v4.4.0rc, v4.2.4, v4.3.1
# 14f961d0 24-Jul-2015 Sepherosa Ziehau <sephe@dragonflybsd.org>

mbuf: Add helper functions to inc/dec mbuf limits

While I'm here, refactor code a little bit.


# 506e14da 24-Jul-2015 Sepherosa Ziehau <sephe@dragonflybsd.org>

mbuf: Staticize mbupdatelimits


123456