From owner-freebsd-net@FreeBSD.ORG Thu Dec 19 15:16:09 2013 Return-Path: Delivered-To: freebsd-net@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 24A9E868; Thu, 19 Dec 2013 15:16:09 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9465D1958; Thu, 19 Dec 2013 15:16:08 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id rBJFG6Oo071117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Dec 2013 19:16:06 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id rBJFG6OK071116; Thu, 19 Dec 2013 19:16:06 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 19 Dec 2013 19:16:06 +0400 From: Gleb Smirnoff To: Adrian Chadd Subject: Re: Removing queue length check in ip_output (was Re: buf_ring in HEAD is racy) Message-ID: <20131219151606.GB71033@FreeBSD.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: Jack F Vogel , Michael Tuexen , Ryan Stone , freebsd-net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 15:16:09 -0000 On Wed, Dec 18, 2013 at 01:04:43PM -0800, Adrian Chadd wrote: A> How about we can this check in ip_output(): A> A> /* A> * Verify that we have any chance at all of being able to queue the A> * packet or packet fragments, unless ALTQ is enabled on the given A> * interface in which case packetdrop should be done by queueing. A> */ A> n = ip_len / mtu + 1; /* how many fragments ? */ A> if ( A> #ifdef ALTQ A> (!ALTQ_IS_ENABLED(&ifp->if_snd)) && A> #endif /* ALTQ */ A> (ifp->if_snd.ifq_len + n) >= ifp->if_snd.ifq_maxlen ) { A> error = ENOBUFS; A> IPSTAT_INC(ips_odropped); A> ifp->if_snd.ifq_drops += n; A> goto bad; A> } A> A> .. it's totally bogus in an if_transmit / SMP world. There's no A> locking and there's no guarantee that there will be headroom in the A> queue between this point and the later call to the if_output() method. My vote is to remove this. But better leave a comment that we need an API to send a bunch of packets (or fail them all) via an interface. -- Totus tuus, Glebius.