From 2cffba4210257492f6aaedb8664fada4482f7d93 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 20 Jan 2015 18:12:49 +0000 Subject: [PATCH] Years ago, MSIZE had to be known in probably to allocate memory for the mbuf layer up front. These days it only matters for sizing of macros in , so move it there. MCLSHIFT, MCLBYTES, and MCLOFSET can move also (a decade ago, architectures had different mbuf sizes. you don't want to know more) ok guenther, ports fallout checked for by sthen --- sys/sys/mbuf.h | 16 +++++++++++++++- sys/sys/param.h | 18 +----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 22ff1e831e5..f5136e5995e 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.183 2014/10/03 01:02:47 dlg Exp $ */ +/* $OpenBSD: mbuf.h,v 1.184 2015/01/20 18:12:49 deraadt Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -38,6 +38,15 @@ #include #include +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than PAGE_SIZE (the software page size) and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 256 /* size of an mbuf */ + /* * Mbufs are of a single size, MSIZE (sys/param.h), which * includes overhead. An mbuf may add a single "mbuf cluster" of size @@ -53,6 +62,11 @@ #define MINCLSIZE (MHLEN + MLEN + 1) /* smallest amount to put in cluster */ #define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */ +#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ + /* 2K cluster can hold Ether frame */ +#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ +#define MCLOFSET (MCLBYTES - 1) + /* Packet tags structure */ struct m_tag { SLIST_ENTRY(m_tag) m_tag_link; /* List of packet tags */ diff --git a/sys/sys/param.h b/sys/sys/param.h index fe28564658d..f37af027152 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.113 2015/01/20 18:08:16 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.114 2015/01/20 18:12:49 deraadt Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -120,22 +120,6 @@ #define NODEV (dev_t)(-1) /* non-existent device */ -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than PAGE_SIZE (the software page size) and, - * on machines that exchange pages of input or output buffers with mbuf - * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple - * of the hardware page size. - */ -#define MSIZE 256 /* size of an mbuf */ - -#ifdef _KERNEL -#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ - /* 2K cluster can hold Ether frame */ -#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ -#define MCLOFSET (MCLBYTES - 1) -#endif /* _KERNEL */ - #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) -- 2.20.1