From owner-freebsd-net@FreeBSD.ORG Tue May 17 22:23:45 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B9E016A4CE for ; Tue, 17 May 2005 22:23:45 +0000 (GMT) Received: from blake.polstra.com (blake.polstra.com [64.81.189.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF4D143D82 for ; Tue, 17 May 2005 22:23:44 +0000 (GMT) (envelope-from jdp@polstra.com) Received: from strings.polstra.com (strings.polstra.com [64.81.189.67]) by blake.polstra.com (8.13.1/8.13.1) with ESMTP id j4HMNcJV065271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 17 May 2005 15:23:38 -0700 (PDT) (envelope-from jdp@strings.polstra.com) Received: (from jdp@localhost) by strings.polstra.com (8.13.1/8.13.1/Submit) id j4HMNcia028149; Tue, 17 May 2005 15:23:38 -0700 (PDT) (envelope-from jdp) Message-ID: X-Mailer: XFMail 1.5.5 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Tue, 17 May 2005 15:23:38 -0700 (PDT) From: John Polstra To: Ernest Smallis cc: freebsd-net@freebsd.org Subject: RE: PR kern/78968 MBuf cluster exhaustion. RFC (solutions) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2005 22:23:45 -0000 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