From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 19 08:10:15 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 00D6C16A41F for ; Mon, 19 Sep 2005 08:10:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3C3C43D46 for ; Mon, 19 Sep 2005 08:10:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8J8AEAR096776 for ; Mon, 19 Sep 2005 08:10:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8J8AE5P096775; Mon, 19 Sep 2005 08:10:14 GMT (envelope-from gnats) Date: Mon, 19 Sep 2005 08:10:14 GMT Message-Id: <200509190810.j8J8AE5P096775@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Ruslan Ermilov Cc: Subject: Re: kern/86306: [patch] if_em.c locks up while trying to send a highly fragmented packet X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ruslan Ermilov List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2005 08:10:15 -0000 The following reply was made to PR kern/86306; it has been noted by GNATS. From: Ruslan Ermilov To: Dmitrij Tejblum Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: kern/86306: [patch] if_em.c locks up while trying to send a highly fragmented packet Date: Mon, 19 Sep 2005 11:09:46 +0300 On Mon, Sep 19, 2005 at 11:38:47AM +0400, Dmitrij Tejblum wrote: > Ruslan Ermilov wrote: > > Hi Dmitrij, > > On Sun, Sep 18, 2005 at 11:25:35PM +0400, Dmitrij Tejblum wrote: > > > When em_encap() tries to send a very long mbuf chain (i.e. more than > EM_MAX_SCATTER == 64 mbufs), bus_dmamap_load_mbuf_sg() may fail with EFBIG. > Then em_encap() fail, the packet is not sent and left in the output queue, > and thus no futher transmission is possible. > > Some other driver handle similar condition with m_defrag(9) function > (which is intended for this purpose). > > > > Can you please modify your patch as follows: > > 1) Count how much fragments are in the packet in em_encap() first, and > do m_defrag() if it exceeeds EM_MAX_SCATTER, like in if_dc.c. If it > is still EFBIG after that and bus_dmamap_load_mbuf_sg(), then free it > as you do to prevent re-enqueue. > > > So you think that if_dc.c is a better example than e.g. if_fxp.c and > if_xl.c? Why? I also suspect that your suggestion would be a > pessimisation. > Checking for a chain length shouldn't be much of pessimization, it's very fast, and I thought it'd save code duplication. But I don't insist on this one. If you would like to stay with try-and-fail approach, I don't mind. > 2) Put BPF processing back to em_start_locked(). > > > As I wrote, I think that if e.g. we were unable to defragment a packet it > is better to drop it and try to send the next, rather than stop and set > OACTIVE (since the code that clear OACTIVE assume that it is about TX > descriptors). (You didn't suggest to change that). I moved BPF processing > since it would not be a good idea to pass NULL to BPF. > I don't understand how moving BPF processing in em_encap() helps this, and how we can pass a NULL pointer if BPF processing stayed where it was, in start(). Also, in your patch, if either DMA loading of mbuf fails or mbuf chain defragmentation fails, NULL will be returned and no next packet will be processed (though I agree that in the latter case it would be logical to try the next packet). Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer