Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 1996 20:00:52 +0100 (MET)
From:      Andreas Klemm <andreas@knobel.gun.de>
To:        nao@sbl.cl.nec.co.jp (Naoki Hamada)
Cc:        hackers@freebsd.org, current@freebsd.org
Subject:   Re: mbuf enhancement patch
Message-ID:  <199602181900.UAA02120@knobel.gun.de>
In-Reply-To: <199602151344.WAA16411@sirius.sbl.cl.nec.co.jp> from "Naoki Hamada" at Feb 15, 96 10:44:13 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 
> Hello, guys!
> 
> I found mbuf's are not buffered though mclusters are. So here is my
> patch for /sys/sys/mbuf.h. This seems to provide me slightly good
> network performance.

Did one of the core team members accept these patches
officially ?! Will they go into -current ?

	Andreas ///

> 
> -nao
> 
> --- mbuf.h.orig	Thu Feb 15 20:48:22 1996
> +++ mbuf.h	Thu Feb 15 21:35:27 1996
> @@ -165,6 +165,8 @@
>  /*
>   * mbuf allocation/deallocation macros:
>   *
> + *	MMALLOC(struct mbuf *m, int how, int type)
> + * allocates an mbuf.
>   *	MGET(struct mbuf *m, int how, int type)
>   * allocates an mbuf and initializes it to contain internal data.
>   *
> @@ -172,8 +174,18 @@
>   * allocates an mbuf and initializes it to contain a packet header
>   * and internal data.
>   */
> +#define	MMALLOC(m, how, type) \
> +	MBUFLOCK( \
> +	if (mfree == 0) {\
> +		MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
> +	} else { \
> +		(m) = mfree; \
> +		mfree = (m)->m_next; \
> +	} \
> +	)
> +
>  #define	MGET(m, how, type) { \
> -	MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
> +	MMALLOC((m), (how), (type)); \
>  	if (m) { \
>  		(m)->m_type = (type); \
>  		MBUFLOCK(mbstat.m_mtypes[type]++;) \
> @@ -186,7 +198,7 @@
>  }
>  
>  #define	MGETHDR(m, how, type) { \
> -	MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
> +	MMALLOC((m), (how), (type)); \
>  	if (m) { \
>  		(m)->m_type = (type); \
>  		MBUFLOCK(mbstat.m_mtypes[type]++;) \
> @@ -270,7 +282,10 @@
>  		MCLFREE((m)->m_ext.ext_buf); \
>  	  } \
>  	  (nn) = (m)->m_next; \
> -	  FREE((m), mbtypes[(m)->m_type]); \
> +	  MBUFLOCK ( \
> +	    (m)->m_next = mfree; \
> +	    mfree = (m); \
> +	  ) \
>  	}
>  #endif
>  
> @@ -358,6 +373,7 @@
>  };
>  
>  #ifdef	KERNEL
> +struct	mbuf *mfree;
>  extern	struct mbuf *mbutl;		/* virtual address of mclusters */
>  extern	char *mclrefcnt;		/* cluster reference counts */
>  struct	mbstat mbstat;
> 


-- 
andreas@knobel.gun.de         /\/\___      Wiechers & Partner Datentechnik GmbH
   Andreas Klemm          ___/\/\/         $$  Support Unix - aklemm@wup.de  $$
pgp p-key  http://www-swiss.ai.mit.edu/~bal/pks-toplev.html  >>> powered by <<<
ftp://sunsite.unc.edu/pub/Linux/system/Printing/aps-491.tgz  >>>    FreeBSD <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602181900.UAA02120>