History log of /freebsd/sys/kern/kern_mbuf.c (Results 1 – 25 of 302)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.5.0
# c5a96f09 06-Mar-2025 Konstantin Belousov <kib@FreeBSD.org>

mb_unmapped_to_ext(): fix m_free()/m_freem() use

The top of the chain is supposed to be freed in mb_unmapped_to_ext(),
use m_freem(). The _mb_unmapped_to_ext() helper only needs to work on
the pass

mb_unmapped_to_ext(): fix m_free()/m_freem() use

The top of the chain is supposed to be freed in mb_unmapped_to_ext(),
use m_freem(). The _mb_unmapped_to_ext() helper only needs to work on
the passed mbuf, use m_free().

Reviewed by: glebius
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D49305

show more ...


Revision tags: release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3
# cf322978 28-Dec-2024 Konstantin Belousov <kib@FreeBSD.org>

mb_unmapped_to_ext(): return error code on error

to allow to distinguish the causes of failure.

Reviewed by: markj
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://r

mb_unmapped_to_ext(): return error code on error

to allow to distinguish the causes of failure.

Reviewed by: markj
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D48265

show more ...


Revision tags: release/14.2.0
# 314cb279 31-Oct-2024 John Baldwin <jhb@FreeBSD.org>

mbuf: Don't force all M_EXTPG mbufs to be read-only

Some M_EXTPG mbufs are read-only (e.g. those backing sendfile
requests), but others are not. Add a flags argument to
mb_alloc_ext_pgs that can be

mbuf: Don't force all M_EXTPG mbufs to be read-only

Some M_EXTPG mbufs are read-only (e.g. those backing sendfile
requests), but others are not. Add a flags argument to
mb_alloc_ext_pgs that can be used to set M_RDONLY when needed rather
than setting it unconditionally. Update mb_unmapped_to_ext to
preserve M_RDONLY from the unmapped mbuf.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D46783

show more ...


Revision tags: release/13.4.0
# badf44cc 04-Jun-2024 Gleb Smirnoff <glebius@FreeBSD.org>

mbuf: provide m_freemp()

This function follows both m_nextpkt and m_next linkage freeing all mbufs.
Note that existing m_freem() follows only m_next.

Reviewed by: khng
Differential Revision: https

mbuf: provide m_freemp()

This function follows both m_nextpkt and m_next linkage freeing all mbufs.
Note that existing m_freem() follows only m_next.

Reviewed by: khng
Differential Revision: https://reviews.freebsd.org/D45477

show more ...


Revision tags: release/14.1.0
# 51346bd5 03-May-2024 John Baldwin <jhb@FreeBSD.org>

mbuf: Add EXT_CTL for mbufs backed by a CTL backend buffer

This is somewhat similar to EXT_NET_DRV, but CTL isn't a network
driver.

Sponsored by: Chelsio Communications
Differential Revision: https

mbuf: Add EXT_CTL for mbufs backed by a CTL backend buffer

This is somewhat similar to EXT_NET_DRV, but CTL isn't a network
driver.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D44725

show more ...


# 71f8702f 08-Apr-2024 Gleb Smirnoff <glebius@FreeBSD.org>

mbuf: provide mc_get() that allocates struct mchain of given length

Implement m_getm2(), which is widely used via m_getm() macro, as a wrapper
around mc_get(). New code is advised to use mc_get().

mbuf: provide mc_get() that allocates struct mchain of given length

Implement m_getm2(), which is widely used via m_getm() macro, as a wrapper
around mc_get(). New code is advised to use mc_get().

Reviewed by: markj, tuexen
Differential Revision: https://reviews.freebsd.org/D44149

show more ...


Revision tags: release/13.3.0
# a03c2393 10-Nov-2023 Alexander Motin <mav@FreeBSD.org>

uma: Improve memory modified after free panic messages

- Pass zone pointer to trash_ctor() and report zone name in the panic
message. It may be difficult to figyre out zone just by the item size.

uma: Improve memory modified after free panic messages

- Pass zone pointer to trash_ctor() and report zone name in the panic
message. It may be difficult to figyre out zone just by the item size.
- Do not pass user arguments to internal trash calls, pass thezone.
- Report malloc type name in the same unified panic message.
- Report corruption offset from the beginning of the items instead of
the full pointer. It makes panic message shorter and more readable.

show more ...


Revision tags: release/14.0.0
# 6a88498e 09-Oct-2023 Zhenlei Huang <zlei@FreeBSD.org>

mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

mbuf: Add sysctl flag CTLFLAG_TUN to loader tunables

The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

1. kern.ipc.mb_use_ext_pgs
2. kern.ipc.nmbclusters
3. kern.ipc.nmbjumbop
4. kern.ipc.nmbjumbo9
5. kern.ipc.nmbjumbo16
6. kern.ipc.nmbufs

No functional change intended.

Reviewed by: kib, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42113

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0
# 64727619 01-Feb-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: use IfAPI in mbuf

Sponsored by: Juniper Networks, Inc.


# 1e6131ba 01-Feb-2023 Justin Hibbits <jhibbits@FreeBSD.org>

IfAPI: Add needed APIs for mbuf support

Summary:
Add 2 new APIs for supporting recent mbuf changes:
* 36e0a362ac added the m_snd_tag_alloc() wrapper around
if_snd_tag_alloc(). Push this down to t

IfAPI: Add needed APIs for mbuf support

Summary:
Add 2 new APIs for supporting recent mbuf changes:
* 36e0a362ac added the m_snd_tag_alloc() wrapper around
if_snd_tag_alloc(). Push this down to the ifnet level.
* 4d7a1361ef adds the m_rcvif_serialize()/m_rcvif_restore() KPIs to
serialize and restore an ifnet pointer. Add the necessary wrapper to
get the index generation for this.

Reviewed By: jhb
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38340

show more ...


Revision tags: release/12.4.0
# 440217b0 21-Sep-2022 Zhenlei Huang <zlei.huang@gmail.com>

debugnet: Fix parameter order in the calls to m_get()

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36643


# 840327e5 24-Aug-2022 Brooks Davis <brooks@FreeBSD.org>

mbuf: Don't support PAGE_SIZE < 4K

The Vax supported such things, but FreeBSD does not. This further
implies that MJUMPAGESIZE > MCLBYTES so assert this and remove code
handling them being equal.

mbuf: Don't support PAGE_SIZE < 4K

The Vax supported such things, but FreeBSD does not. This further
implies that MJUMPAGESIZE > MCLBYTES so assert this and remove code
handling them being equal.

Reviewed by: kp, imp, jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D36320

show more ...


# 81a34d37 17-Aug-2022 Gleb Smirnoff <glebius@FreeBSD.org>

protosw: retire pr_drain and use EVENTHANDLER(9) directly

The method was called for two different conditions: 1) the VM layer is
low on pages or 2) one of UMA zones of mbuf allocator exhausted.
This

protosw: retire pr_drain and use EVENTHANDLER(9) directly

The method was called for two different conditions: 1) the VM layer is
low on pages or 2) one of UMA zones of mbuf allocator exhausted.
This change 2) into a new event handler, but all affected network
subsystems modified to subscribe to both, so this change shall not
bring functional changes under different low memory situations.

There were three subsystems still using pr_drain: TCP, SCTP and frag6.
The latter had its protosw entry for the only reason to register its
pr_drain method.

Reviewed by: tuexen, melifaro
Differential revision: https://reviews.freebsd.org/D36164

show more ...


# 4d88d81c 25-May-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

mbuf(9): Implement a leaf network interface field in the mbuf packet header.

When packets are received they may traverse several network interfaces like
vlan(4) and lagg(9). When doing receive side

mbuf(9): Implement a leaf network interface field in the mbuf packet header.

When packets are received they may traverse several network interfaces like
vlan(4) and lagg(9). When doing receive side offloads it is important to
know the first network interface entry point, because that is where all
offloading is taking place. This makes it possible to track receive
side route changes for multiport setups, for example when lagg(9) receives
traffic from more than one port. This avoids having to install multiple
offloading rules for the same stream.

This field works similar to the existing "rcvif" mbuf packet header field.

Submitted by: jhb@
Reviewed by: gallatin@ and gnn@
Differential revision: https://reviews.freebsd.org/D35339
Sponsored by: NVIDIA Networking
Sponsored by: Netflix

show more ...


Revision tags: release/13.1.0
# 613acc64 27-Jan-2022 Kristof Provost <kp@FreeBSD.org>

mbuf: do not restore dying interfaces

When we remove an interface it is first removed from the interface list
V_ifnet (by if_unlink_ifnet()) and marked as IFF_DYING. We then wait for
any possible re

mbuf: do not restore dying interfaces

When we remove an interface it is first removed from the interface list
V_ifnet (by if_unlink_ifnet()) and marked as IFF_DYING. We then wait for
any possible references to stop being used (i.e.
epoch_wait/epoch_drain_callbacks) before we tear it fully down.

However, the index in ifindex_table is not removed, so m_rcvif_restore()
can still find the (now dying) interface.

This results in panics, for example when dummynet restores the rcvif
pointer and passes a packet to ip6_input() we can panic because the
AF_INET6 domain has already been removed (so we end up dereferencing a
NULL pointer there).

Check that the interface is not dying before we restore it, which is
equivalent to checking its presence in V_ifnet, and thus ensures that
future accesses (while in NET_EPOCH) are safe.

Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34076

(cherry picked from commit 703e533da5e2e4743d38bbf4605fec041bc69976)

show more ...


# 4d7a1361 27-Jan-2022 Gleb Smirnoff <glebius@FreeBSD.org>

ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif

Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.

Reviewed by: kp
Differential revis

ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif

Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33266
Fun note: git show e6abef09187a

(cherry picked from commit e1882428dcbbafd2814d7e17b977a8f686784b39)

show more ...


# 6c741ffb 03-May-2022 Marko Zec <zec@FreeBSD.org>

Revert "mbuf: do not restore dying interfaces"

This reverts commit 703e533da5e2e4743d38bbf4605fec041bc69976.

Revert "ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif"

This reverts co

Revert "mbuf: do not restore dying interfaces"

This reverts commit 703e533da5e2e4743d38bbf4605fec041bc69976.

Revert "ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif"

This reverts commit e1882428dcbbafd2814d7e17b977a8f686784b39.

Obtained from: github.com/glebius/FreeBSD/commits/backout-ifindex

show more ...


# 703e533d 27-Jan-2022 Kristof Provost <kp@FreeBSD.org>

mbuf: do not restore dying interfaces

When we remove an interface it is first removed from the interface list
V_ifnet (by if_unlink_ifnet()) and marked as IFF_DYING. We then wait for
any possible re

mbuf: do not restore dying interfaces

When we remove an interface it is first removed from the interface list
V_ifnet (by if_unlink_ifnet()) and marked as IFF_DYING. We then wait for
any possible references to stop being used (i.e.
epoch_wait/epoch_drain_callbacks) before we tear it fully down.

However, the index in ifindex_table is not removed, so m_rcvif_restore()
can still find the (now dying) interface.

This results in panics, for example when dummynet restores the rcvif
pointer and passes a packet to ip6_input() we can panic because the
AF_INET6 domain has already been removed (so we end up dereferencing a
NULL pointer there).

Check that the interface is not dying before we restore it, which is
equivalent to checking its presence in V_ifnet, and thus ensures that
future accesses (while in NET_EPOCH) are safe.

Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34076

show more ...


# e1882428 27-Jan-2022 Gleb Smirnoff <glebius@FreeBSD.org>

ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif

Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.

Reviewed by: kp
Differential revis

ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif

Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33266
Fun note: git show e6abef09187a

show more ...


# c6c52d8e 27-Dec-2021 Alexander Motin <mav@FreeBSD.org>

kern: Remove CTLFLAG_NEEDGIANT from some more sysctls.

MFC after: 2 weeks


# 0a048d4a 09-Dec-2021 Mateusz Guzik <mjg@FreeBSD.org>

mbuf: plug set-but-not-used vars

Sponsored by: Rubicon Communications, LLC ("Netgate")


Revision tags: release/12.3.0
# b6cbbcae 16-Nov-2021 Kristof Provost <kp@FreeBSD.org>

m_get3(): actually use the selected zone

Reported by: markj


# 32854e52 16-Nov-2021 Mark Johnston <markj@FreeBSD.org>

mbuf: Properly set the default value for mb_use_ext_pgs

Reported by: Jenkins
Fixes: fcaa890c4469 ("mbuf: Only allow extpg mbufs if the system has a direct map")
Pointy hat: markj


12345678910>>...13