From owner-freebsd-arch@FreeBSD.ORG Sun Jul 30 15:25:48 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AF52A16A4DD for ; Sun, 30 Jul 2006 15:25:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 590E843D45; Sun, 30 Jul 2006 15:25:48 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id F078146BE7; Sun, 30 Jul 2006 11:25:47 -0400 (EDT) Date: Sun, 30 Jul 2006 16:25:47 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Max Laier In-Reply-To: <200607301659.16323.max@love2party.net> Message-ID: <20060730160933.D16341@fledge.watson.org> References: <20060730141642.D16341@fledge.watson.org> <200607301659.16323.max@love2party.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freeebsd-net@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Changes in the network interface queueing handoff model X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2006 15:25:48 -0000 On Sun, 30 Jul 2006, Max Laier wrote: >> Conceptual review as well as banchmarking, etc, would be most welcome. > > This begs the question: What about ALTQ? > > If we maintain the fallback mechanism in _handoff, we can just add > ALTQ_IS_ENABLED() to the test. Otherwise every driver's startmbuf function > would have to take care of ALTQ itself, which is not preferable. Maxime just asked me the same question, and I realized that I had, of course, forgotten to mention ALTQ. A few observations/questions: - An underlying assumption of ALTQ is that queueing occurs in software. This turns out to be decreasingly true with modern network hardware, where the queueing occurs in a combination of software and hardware thanks to the descriptor ring. Has anyone compared the effectiveness of ALTQ on gig-e systems with the effectiveness on 10/100mbps systems? I would anticipate that it would have an effect on the latter, but little or no effect on the former? - ALTQ actually also already does a bit of what I describe -- IFQ_DRV_DEQUEUE() and friends actually manage two ifnet queues, if_snd (the public queue), and if_drv_head, a second queue protected by the device driver lock. Because it bulk dequeues from one queue to the other, it already works to amortize if_snd locking, at the cost of maintaining two queues and substantially more complicated logic. - One of the side effects of this change is that it does complicate device drivers, especially if they are going to rely on software queueing. In the example changes to if_em in my patch, the start path goes from a simple loop around the send queue to considering three cases: needing to queue, handling the optimized (empty) queue case, and needing to dequeue. Quite a bit of this logic will be common across device drivers and might be something we can abstract out some. There are two things going on in my proposed change: ownership (and hence locking and interface) with a queue moves, and code moves. It could be we could transfer the locking (etc) and move less code. Thoughts on this would be welcome. Notice that in the patch I do leave backwards compatible support for if_start, if only because rewriting all network device drivers is error prone and arduous. I assume this will be a temporary condition, but it could be that we could leave it as a permanent one to support older devices that won't be updated (ISA ethernet cards, etc), where the existing queueing model works reasonably well. In an earlier iteration of this patch, I had em_startmbuf() call a utility routine in if.c to handle enqueueing followed by calling em_start(). This meant no optimized fast path, but less code change. > I strongly agree with you comment about how messed up ifq_*/if_* in > if_var.h are - and I'm afraid that's partly me fault for bringing in ALTQ. Heh. I actually meant to remove that comment before posting the patch, so it's a bit more blunt than perhaps entirely wise. :-) A couple of times in the past I've attempted to work on a rename to basically swap the two naming schemes and clean things up, but usually I've stalled when it occurs to me just how big the task is. At this point, I think the right thing to do is make a decision about the semantics of the interface, and then walk the tree and clean up after we've simplified things. Robert N M Watson Computer Laboratory University of Cambridge