From owner-freebsd-arch@FreeBSD.ORG Thu Nov 21 00:00:36 2013 Return-Path: Delivered-To: freebsd-arch@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 2CD4CAE0; Thu, 21 Nov 2013 00:00:36 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id E0D552317; Thu, 21 Nov 2013 00:00:34 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 6093F7300A; Thu, 21 Nov 2013 01:02:45 +0100 (CET) Date: Thu, 21 Nov 2013 01:02:45 +0100 From: Luigi Rizzo To: George Neville-Neil Subject: Re: svn commit: r258328 - head/sys/net Message-ID: <20131121000245.GA30549@onelab2.iet.unipi.it> References: <201311182258.rAIMwEFd048783@svn.freebsd.org> <023E719B-1059-4670-8556-EBAC18A2F007@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <023E719B-1059-4670-8556-EBAC18A2F007@freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Adrian Chadd , "src-committers@freebsd.org" , FreeBSD Net , "svn-src-all@freebsd.org" , "freebsd-arch@freebsd.org" , "svn-src-head@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2013 00:00:36 -0000 On Wed, Nov 20, 2013 at 05:29:37PM -0500, George Neville-Neil wrote: > > On Nov 20, 2013, at 17:02 , Adrian Chadd wrote: > > > Can we revert this and just quickly put together something else that > > won't potentially come back to bite us with weird side effects? > > > > My suggestions (and I'm happy to do this work if needed): > > > > * create a lightweight mbuf queue representation so an mbuf list isn't > > just the mbuf header pointer; > > * create a new ether input (say, ether_input_multi) that takes an mbuf > > list, so existing driver code does the right thing. > > > > After that it'd be nice to write a set of mbuf list macros for > > abstract the whole queue, dequeue, concat, iterate, etc (like > > sys/queue.h, but for mbufs.) > > > > What do people think? > > > > (I've been doing it for m->next chained things, but not m->m_nextpkt things..) > > I think the right way to do this is to move forwards and not backwards. > This change has the nice effect of not breaking anything else in the > tree while providing us with a feature that will be useful. I am a bit torn on this. George is right - we should move forward, and we have been discussing this trivial change for two years. It is impossible to tell when someone will find the time to implement the mbuf queue and the new method (more on this later). So we should not back it out. At the same time: in principle this change does not break anything, but Robert is right that some of the 50-100 drivers we have might forget to clear m_nextpkt and cause trouble. So it would be nice to implement some protection, maybe something as simple as setting a flag in the first mbuf to tell that this is a chain and not a single mbuf. We have 12 M_PROTO* flags to use. For the next step: I am still wondering what is the best way to implement an alternate ifp->if_input_multi method (which takes an mbuf queue as an argument, and can be checked by the compiler). I am not too fond of having two different input methods, as it complicates life when one has to intercept packets. On the other hand, globally changing all drivers to use the if_input_multi() method is too much trouble, so i suspect we will have to come up with some nice trick, e.g. use a pseudo mbuf with m_type = MT_MBQUEUE and overload the m_hdr fields as queue pointers. cheers luigi