PR kern/78968 MBuf cluster exhaustion. RFC (solutions)

John Polstra jdp at polstra.com
Tue May 17 15:23:45 PDT 2005


On 17-May-2005 Ernest Smallis wrote:

> Hi All, I am seeing this problem as well:
> a. The kernel is in a tight loop via the fxp driver since there are
> frames that need to be DMA'd but cannot be because 'b.'
> b. The fxp driver calls m_getcl( ) which returns ENOBUFS since there
> are no clusters to satisfy the request. This goes on constantly so
> it appears the system is hung.

I'll describe the usual solution for this kind of bug.

  - A packet comes in, the device generates an interrupt, and you
    take the mbuf containing the received packet from the
    descriptor.

  - Now you call m_getcl() to replenish the descriptor, but it
    returns ENOBUFS.

  - Take the mbuf containing the received packet (from the first
    step) and reuse it to replenish the descriptor, discarding the
    mbuf contents and thus dropping the freshly received packet.

In this way you ensure that the receive descriptors always have mbufs,
no matter what happens.  Yes, you have to drop a perfectly good
received packet in order to accomplish this.  But you are going to end
up dropping a packet regardless, if you can't replenish the descriptor.

John


More information about the freebsd-net mailing list