From owner-cvs-src@FreeBSD.ORG Thu Mar 27 11:57:10 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF58837B401; Thu, 27 Mar 2003 11:57:10 -0800 (PST) Received: from ebb.errno.com (ebb.errno.com [66.127.85.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91EC043F93; Thu, 27 Mar 2003 11:57:09 -0800 (PST) (envelope-from sam@errno.com) Received: from melange (melange.errno.com [66.127.85.82]) (authenticated bits=0) by ebb.errno.com (8.12.8/8.12.6) with ESMTP id h2RJv3mm018845 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Thu, 27 Mar 2003 11:57:04 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <031301c2f49b$09d2bfb0$52557f42@errno.com> From: "Sam Leffler" To: "Mike Silbersack" , "Maxime Henrion" References: <200303260452.h2Q4quap015364@www.ambrisko.com> <20030326114030.U2075@odysseus.silby.com> <20030326183351.GJ57674@elvis.mu.org> <20030326130903.G2075@odysseus.silby.com> <20030327013224.P7674@odysseus.silby.com> Date: Thu, 27 Mar 2003 11:56:47 -0800 Organization: Errno Consulting MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4920.2300 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4920.2300 X-Spam-Status: No, hits=-9.8 required=5.0 tests=QUOTED_EMAIL_TEXT,REFERENCES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: Doug Ambrisko cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/conf options src/sys/netinet ip_output.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2003 19:57:12 -0000 > Ok, I think I have m_defrag in a working state, please review. > > Changes from last time: > > - It supports infinitely long chains. > - It has a "goal" argument which is supposed to be a hint to tell m_defrag > how long the chain can be. It is currently ignored; someone may want to > honor this later for optimization purposes. > - I fixed up the error case in if_xl, it only runs if needed now > > At the top of the if_loop and if_xl patches are debugging code I used to > make it was working right, they're certainly not going in. > > m_defrag should be totally free of debug code. I thought about this some more. If the purpose of m_defrag* is to handle problems in drivers where the s/g requirements are too large then you want to do the minimum amount of work since the results going to be used once and thrown away. This says to me that you want to coalesce only until you know you've got things in a form that the DMA engine can handle. This actually makes the requirements very close to those of the m_clone routine in fast ipsec except m_clone must generate a writable mbuf chain while the drivers are happy with having read-only elements. My experience was that you don't want to coalesce too agressively as you can end up copying lots of data for little positive effect. In particular I would not coalesce anything but mbufs (i.e. leave mbufs w/ external storage alone). Unfortunately this can leave you with a result that doesn't meet the max s/g requirements of the driver unless you make a second pass. Given that this problem should happen infrequently and that you're just trying to avoid discarding the packet I think you're best off doing a best effort job where you coalesce only mbufs and leave clusters/ext's alone. Then if the subsequent bus_dma_load_mbuf call fails you discard the packet. Other than the read/write requirements this is exactly m_clone. FWIW when I've dealt with this issue in drivers I've always said: if the packet doesn't fit in a cluster then return an error; otherwise allocate a cluster and copy everything in. This insures you know you'll need at most 1 s/g descriptor so you to pre-allocate the resource in the driver and not end up coalescing the data only to find you can't send it. Sam