Date: Thu, 9 May 2002 08:23:08 -0500 (CDT) From: mark tinguely <tinguely@web.cs.ndsu.nodak.edu> To: freebsd-hackers@FreeBSD.ORG, les@safety.net Subject: Re: Mbuf questions Message-ID: <200205091323.g49DN8H00652@web.cs.ndsu.nodak.edu> In-Reply-To: <200205081430.g48EUll27242@ns3.safety.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205091323.g49DN8H00652>