From owner-freebsd-current@FreeBSD.ORG Wed Jun 4 15:36:02 2014 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88766F7; Wed, 4 Jun 2014 15:36:02 +0000 (UTC) Received: from mail-ie0-x236.google.com (mail-ie0-x236.google.com [IPv6:2607:f8b0:4001:c03::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43E142F8A; Wed, 4 Jun 2014 15:36:02 +0000 (UTC) Received: by mail-ie0-f182.google.com with SMTP id x19so7416231ier.27 for ; Wed, 04 Jun 2014 08:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=wy8tZNPFTyn/b+dhIM087qyepPMQ6QA0kzTT0YorLIY=; b=k7WECjz6qtC4P3AG2Dn2kKXkahFqv4KJkb2K4p5UV/M+YTotQF+L42vSiamAPT6pyO 1BFS2iGM3+4iP5Ct14q/2F9iiyUPpMKrW6rozLihnLw5CMGFqIx7z8BOGdZlZIC/m8HX 0e4dxa7Av6l+UIX+Ia+PG8Lr76RtZOtrX9CxV8NNapQOL9O2cVhy0IRImA7XHakQkTmv XrJ02JG07HRZsKyQSb98jAphk1wUs88Vra5xDfAObko6GGmecGPn5Jx9bl9XeN2ohrKi 4icGZ1oYTbAOl0xkDeIEyeyFbippjlew7kno8PRlAf3+kbfm/LsXS8BmvZy8x/aYmsXe pKDw== X-Received: by 10.50.110.98 with SMTP id hz2mr8023362igb.47.1401896161570; Wed, 04 Jun 2014 08:36:01 -0700 (PDT) MIME-Version: 1.0 Sender: mr.kodiak@gmail.com Received: by 10.64.26.229 with HTTP; Wed, 4 Jun 2014 08:35:31 -0700 (PDT) In-Reply-To: <20140604134945.GA64688@onelab2.iet.unipi.it> References: <20140604134945.GA64688@onelab2.iet.unipi.it> From: Bryan Venteicher Date: Wed, 4 Jun 2014 10:35:31 -0500 X-Google-Sender-Auth: _06ZtIXSFTyM-ZMlpYmgyZvT5EQ Message-ID: Subject: Re: BUG: some drivers return ENOBUFS when the mbuf is actually queued To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: jfv@freebsd.org, Bryan Venteicher , current@freebsd.org, stefanogarzarella@gmail.com X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2014 15:36:02 -0000 On Wed, Jun 4, 2014 at 8:49 AM, Luigi Rizzo wrote: > Hi, > if I read correctly the code, there are a few network device drivers > (igb, ixgbe, i40e, vtnet, vmxnet) where ifp->if_transmit(ifp, m) > can return ENOBUFS even when 'm' has _not_ been dropped: > > e1000/if_igb.c :: igb_mq_start() > can return ENOBUFS from igb_xmit() > > ixgbe/ixgbe_main.c :: ixgbe_mq_start_locked() > can return ENOBUFS from ixgbe_xmit() > (similar for i40) > > virtio/network/if_vtnet.c :: vtnet_txq_mq_start > can return ENOBUFS if virtqueue_full() > > In all these cases, the error comes from a later attempt to transfer > mbufs from the buf_ring to the NIC ring. > > All drivers using if_transmit() seem correct, as well as a bunch > of others (cxgbe, sfxge, mxge ...) that reassign if_transmit and I > checked for correctness. > > I think that when the current buffer has been queued, returning > ENOBUFS is extremely confusing and should not be done. > > I would also argue that the return from ifp->if_transmit(ifp, m) > should only tell what happened to 'm', not other things > such as the status of the queue. > > Any objections if i fix the above drivers ? > > No objection for vtnet and vmxnet. > cheers > luigi > > (For those curious: i found this issue when using emulated > netmap mode on top of a standard driver. The netmap emulation > code assumes that ENOBUFS indicates that the driver has > m_free()'d the mbuf, same as it happens on linux, and the > bug was causing panics in my system). > >