From owner-freebsd-hackers Thu May 1 15:08:35 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id PAA20653 for hackers-outgoing; Thu, 1 May 1997 15:08:35 -0700 (PDT) Received: from plains.nodak.edu (tinguely@plains.NoDak.edu [134.129.111.64]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA20648; Thu, 1 May 1997 15:08:30 -0700 (PDT) Received: (from tinguely@localhost) by plains.nodak.edu (8.8.5/8.8.5) id RAA03104; Thu, 1 May 1997 17:08:23 -0500 (CDT) Date: Thu, 1 May 1997 17:08:23 -0500 (CDT) From: Mark Tinguely Message-Id: <199705012208.RAA03104@plains.nodak.edu> To: freebsd-atm@freebsd.org, freebsd-hackers@freebsd.org Subject: custom free for external mbuf Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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); \ ! } \ ) /*