Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 1997 17:08:23 -0500 (CDT)
From:      Mark Tinguely <tinguely@plains.nodak.edu>
To:        freebsd-atm@freebsd.org, freebsd-hackers@freebsd.org
Subject:   custom free for external mbuf
Message-ID:  <199705012208.RAA03104@plains.nodak.edu>

next in thread | raw e-mail | index | archive | help
back in October, I said that I wanted to add a permanent association
between an external mbuf and the external buffer. I call this M_PERM.
below is a context diff from 2.2.1-RELEASE. I have a card that holds
hundreds of mbufs until the ATM card gets data, then they will pass
through some networks stack and when released they get requeued to
the ATM card. I want to lower the cost of making/breaking the mbuf
to external connection, and besides since I hold so many mbufs in the
ATM queue, I do not want to have other devices fighting the card for
resources.

This is backward compatible with other external mbuf and should have
no impact with existing code.

The line:
	m->m_next = (struct mbuf *) 0; 
could be put in the ext_free() routine, I added it here to be consistant
with the rest of the macro.

As a side issue, I still have a concern with others drivers setting the
ext_free() routine without checking if there is already a ext_free() routine.

we hashed this a bit back in October, I refined my changes. I am sending this
to hackers for comments before submitting. If there strong objections to the
change, I will keep it only as a local change for the driver.

--mark.
	---------- sys/sys/mbuf.h and /usr/include/sys/mbuf.h ------------
*** mbuf.h.orig	Mon Aug 19 13:30:15 1996
--- mbuf.h	Thu May  1 14:37:08 1997
***************
*** 123,128 ****
--- 123,129 ----
  #define	M_PKTHDR	0x0002	/* start of record */
  #define	M_EOR		0x0004	/* end of record */
  #define	M_PROTO1	0x0008	/* protocol-specific */
+ #define	M_PERM		0x0010	/* permanently associated external storage */
  
  /* mbuf pkthdr flags, also in m_flags */
  #define	M_BCAST		0x0100	/* send/received as link-level broadcast */
***************
*** 287,296 ****
  		} \
  	  } \
  	  (n) = (m)->m_next; \
! 	  (m)->m_type = MT_FREE; \
! 	  mbstat.m_mtypes[MT_FREE]++; \
! 	  (m)->m_next = mmbfree; \
! 	  mmbfree = (m); \
  	)
  
  /*
--- 288,301 ----
  		} \
  	  } \
  	  (n) = (m)->m_next; \
! 	  if ((m)->m_flags & M_PERM)  \
! 		m->m_next = (struct mbuf *) 0; \
! 	  else { \
! 		(m)->m_type = MT_FREE; \
! 		mbstat.m_mtypes[MT_FREE]++; \
! 		(m)->m_next = mmbfree; \
! 		mmbfree = (m); \
! 	  } \
  	)
  
  /*



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