From owner-svn-src-head@FreeBSD.ORG Sat Aug 24 20:26:42 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0EB38251; Sat, 24 Aug 2013 20:26:42 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DF365217D; Sat, 24 Aug 2013 20:26:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7OKQf2Y047548; Sat, 24 Aug 2013 20:26:41 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r7OKQfWa047547; Sat, 24 Aug 2013 20:26:41 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201308242026.r7OKQfWa047547@svn.freebsd.org> From: Andre Oppermann Date: Sat, 24 Aug 2013 20:26:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254807 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Aug 2013 20:26:42 -0000 Author: andre Date: Sat Aug 24 20:26:41 2013 New Revision: 254807 URL: http://svnweb.freebsd.org/changeset/base/254807 Log: Compact m_hdr by packing the type and flags fields into one uint32_t. The mbuf type is an enumerator with only a handful of types in use and thus reduced from int to 8bits allowing for 255 types to be specified. Only 5 types have been in use for a long time. The flags field gets the remaining 24 bits with 12 bits for global persistent flags and 12 bits for protocol/layer specific overlays. Some of the global flags/functionality can be moved to the csum_flags or ext_flags bits in the future. MT_VENDOR[1-4] and MT_EXP[1-4] types for vendor-internal and experimental local mapping are added. The size of m_hdr shrinks from 24/40 to 20/32bytes (32/64bit architectures). Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat Aug 24 20:06:00 2013 (r254806) +++ head/sys/sys/mbuf.h Sat Aug 24 20:26:41 2013 (r254807) @@ -82,23 +82,18 @@ struct mb_args { }; #endif /* _KERNEL */ -#if defined(__LP64__) -#define M_HDR_PAD 6 -#else -#define M_HDR_PAD 2 -#endif - /* * Header present at the beginning of every mbuf. + * Size ILP32: 20 + * LP64: 32 */ struct m_hdr { struct mbuf *mh_next; /* next buffer in chain */ struct mbuf *mh_nextpkt; /* next chain in queue/record */ caddr_t mh_data; /* location of data */ - int mh_len; /* amount of data in this mbuf */ - int mh_flags; /* flags; see below */ - short mh_type; /* type of data in this mbuf */ - uint8_t pad[M_HDR_PAD];/* word align */ + int32_t mh_len; /* amount of data in this mbuf */ + uint32_t mh_type:8, /* type of data in this mbuf */ + mh_flags:24; /* flags; see below */ }; /* @@ -206,7 +201,10 @@ struct mbuf { #define m_dat M_dat.M_databuf /* - * mbuf flags. + * mbuf flags of global significance and layer crossing. + * Those of only protocol/layer specific significance are to be mapped + * to M_PROTO[1-12] and cleared at layer handoff boundaries. + * NB: Limited to the lower 24 bits. */ #define M_EXT 0x00000001 /* has associated external storage */ #define M_PKTHDR 0x00000002 /* start of record */ @@ -430,12 +428,24 @@ struct mbuf { #define CSUM_FRAGMENT 0x0 /* Unused */ /* - * mbuf types. + * mbuf types describing the content of the mbuf (including external storage). */ #define MT_NOTMBUF 0 /* USED INTERNALLY ONLY! Object is not mbuf */ #define MT_DATA 1 /* dynamic (data) allocation */ #define MT_HEADER MT_DATA /* packet header, use M_PKTHDR instead */ + +#define MT_VENDOR1 4 /* for vendor-internal use */ +#define MT_VENDOR2 5 /* for vendor-internal use */ +#define MT_VENDOR3 6 /* for vendor-internal use */ +#define MT_VENDOR4 7 /* for vendor-internal use */ + #define MT_SONAME 8 /* socket name */ + +#define MT_EXP1 9 /* for experimental use */ +#define MT_EXP2 10 /* for experimental use */ +#define MT_EXP3 11 /* for experimental use */ +#define MT_EXP4 12 /* for experimental use */ + #define MT_CONTROL 14 /* extra-data protocol message */ #define MT_OOBDATA 15 /* expedited data */ #define MT_NTYPES 16 /* number of mbuf types for mbtypes[] */