splitting m_flags to pkthdr.flags + m_flags
Gleb Smirnoff
glebius at FreeBSD.org
Fri Nov 2 12:38:19 UTC 2012
Hello networkers,
some (most) of m_flags bits are describing features that can
be present on a packet only, not on a single mbuf. Since we are
close to exhaustion of available bits, and many subsystems prefer
to use one of M_PROTO bits instead of grabbing a flag, I propose
to split m_flags to two parts:
In the m_flags remain:
#define M_EXT 0x00000001 /* has associated external storage */
#define M_PKTHDR 0x00000002 /* start of record */
#define M_EOR 0x00000004 /* end of record */
#define M_RDONLY 0x00000008 /* associated data is marked read-only */
and all M_PROTO flags.
struct pkthdr grows by one word and its new flag word now
posesses:
#define M_BCAST 0x00000200 /* send/received as link-level broadcast */
#define M_MCAST 0x00000400 /* send/received as link-level multicast */
#define M_FRAG 0x00000800 /* packet is a fragment of a larger packet */
#define M_FIRSTFRAG 0x00001000 /* packet is first fragment */
#define M_LASTFRAG 0x00002000 /* packet is last fragment */
#define M_SKIP_FIREWALL 0x00004000 /* skip firewall processing */
#define M_VLANTAG 0x00010000 /* ether_vtag is valid */
#define M_PROMISC 0x00020000 /* packet was not for us */
#define M_FLOWID 0x00400000 /* deprecated: flowid is valid */
#define M_HASHTYPEBITS 0x0F000000 /* mask of bits holding flowid hash type */
Some M_PROTO abusements like M_FASTFWD_OURS and recently added M_IP_NEXTHOP
also go to the pkthdr mbuf flags.
P.S.
An attentive reader may have noticed that I missed M_NOFREE and M_FREELIST.
Yep, these flags coming from historical mbuf allocator from FreeBSD 4.x times
are about to be deleted, we carefully examine them, but never set. Patch
for review attached.
--
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: historical_mbuf_flags.diff
Type: text/x-diff
Size: 5370 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20121102/d89af4e9/attachment.diff>
More information about the freebsd-net
mailing list