tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Mbufs stored in RX queues

On Thu, Dec 22, 2011 at 12:19:43AM +0100, Aymeric Vincent wrote:
> (Michael van Elst) writes:
> > The mbuf needs to exist before the interrupt is requested. If you want to
> > pass up a new mbuf you need to copy the data to that new mbuf first. Some
> > drivers even do this, but only for small packets that fit into a single
> > header mbuf.
> But my case is if the data is stored outside the mbuf (M_EXT). I agree
> that the memory which is written by the DMA should be available prior to
> the interrupt, and in sufficient quantity to hold enough packets before
> the RX interrupt is triggered. My question is specifically about the
> mbuf structs in this case. I don't see the point of having a lot of them
> lying around.

You are right, that you do not need the mbuf headers for the receive
buffers themselves until you send the data to the protocol stack.

But then you have to write your own buffer and memory management
instead of using the mbuf abstraction that is used everywhere
else. And the gain would be 11% less memory usage for just
the receive buffers (mbuf header is 256 bytes, the mbuf cluster
used for M_EXT is 2048 bytes).

                                Michael van Elst
                                "A potential Snark may lurk in every tree."

Home | Main Index | Thread Index | Old Index