mbuf: add m_get_raw and m_gethdr_raw

The intent is to eliminate the MT_NOINIT flag and consequently a branch
from the constructor.

Reviewed by:	gallatin
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31080
This commit is contained in:
Mateusz Guzik 2021-07-06 20:51:20 +02:00
parent 0a718a6e6e
commit c2c34ee540
2 changed files with 38 additions and 0 deletions

View File

@ -62,11 +62,21 @@ SDT_PROBE_DEFINE5_XLATE(sdt, , , m__init,
"uint32_t", "uint32_t",
"uint32_t", "uint32_t");
SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr_raw,
"uint32_t", "uint32_t",
"uint16_t", "uint16_t",
"struct mbuf *", "mbufinfo_t *");
SDT_PROBE_DEFINE3_XLATE(sdt, , , m__gethdr,
"uint32_t", "uint32_t",
"uint16_t", "uint16_t",
"struct mbuf *", "mbufinfo_t *");
SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get_raw,
"uint32_t", "uint32_t",
"uint16_t", "uint16_t",
"struct mbuf *", "mbufinfo_t *");
SDT_PROBE_DEFINE3_XLATE(sdt, , , m__get,
"uint32_t", "uint32_t",
"uint16_t", "uint16_t",

View File

@ -62,7 +62,9 @@
SDT_PROBE5(sdt, , , probe, arg0, arg1, arg2, arg3, arg4)
SDT_PROBE_DECLARE(sdt, , , m__init);
SDT_PROBE_DECLARE(sdt, , , m__gethdr_raw);
SDT_PROBE_DECLARE(sdt, , , m__gethdr);
SDT_PROBE_DECLARE(sdt, , , m__get_raw);
SDT_PROBE_DECLARE(sdt, , , m__get);
SDT_PROBE_DECLARE(sdt, , , m__getcl);
SDT_PROBE_DECLARE(sdt, , , m__getjcl);
@ -956,6 +958,19 @@ m_init(struct mbuf *m, int how, short type, int flags)
return (error);
}
static __inline struct mbuf *
m_get_raw(int how, short type)
{
struct mbuf *m;
struct mb_args args;
args.flags = 0;
args.type = type | MT_NOINIT;
m = uma_zalloc_arg(zone_mbuf, &args, how);
MBUF_PROBE3(m__get_raw, how, type, m);
return (m);
}
static __inline struct mbuf *
m_get(int how, short type)
{
@ -969,6 +984,19 @@ m_get(int how, short type)
return (m);
}
static __inline struct mbuf *
m_gethdr_raw(int how, short type)
{
struct mbuf *m;
struct mb_args args;
args.flags = M_PKTHDR;
args.type = type | MT_NOINIT;
m = uma_zalloc_arg(zone_mbuf, &args, how);
MBUF_PROBE3(m__gethdr_raw, how, type, m);
return (m);
}
static __inline struct mbuf *
m_gethdr(int how, short type)
{