From owner-freebsd-hackers Thu May 9 6:23:25 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from web.cs.ndsu.nodak.edu (web.cs.ndsu.NoDak.edu [134.129.125.7]) by hub.freebsd.org (Postfix) with ESMTP id 85D3037B401 for ; Thu, 9 May 2002 06:23:09 -0700 (PDT) Received: (from tinguely@localhost) by web.cs.ndsu.nodak.edu (8.11.4/8.11.4) id g49DN8H00652; Thu, 9 May 2002 08:23:08 -0500 (CDT) (envelope-from tinguely) Date: Thu, 9 May 2002 08:23:08 -0500 (CDT) From: mark tinguely Message-Id: <200205091323.g49DN8H00652@web.cs.ndsu.nodak.edu> To: freebsd-hackers@FreeBSD.ORG, les@safety.net Subject: Re: Mbuf questions In-Reply-To: <200205081430.g48EUll27242@ns3.safety.net> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > A kernel routine uses m_copydata to gather ethernet data into a > KMALLOC'd buffer, processes it, and now needs to put it back into an > mbuf. I would prefer that the resulting mbuf have the data together in > an external buffer, so that the cycles spent aren't wasted. > > I currently use m_copyback to put the data back into the original mbuf > chain, but an going nuts trying to get the chain to shrink when the > data shrinks without the next invocation of m_copydata panicing. why don't you place the buffer pointer into an external mbuf. this requires you to set several fields but you can use the macro MCLGET as a reference. You will also need to use the ext_free() pointer to a routine to correctly free the buffer when the mbuf is released. There is only one ext_free() per mbuf, if a stack layer also uses this function, then we lose the earlier function unless saved/restored as part of the mbuf setup/freeing. --mark tinguely To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message