From owner-p4-projects Sun Feb 16 20:39:27 2003 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9DBE337B405; Sun, 16 Feb 2003 20:39:24 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4492B37B401; Sun, 16 Feb 2003 20:39:24 -0800 (PST) Received: from aslan.scsiguy.com (mail.scsiguy.com [63.229.232.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FC4A43F3F; Sun, 16 Feb 2003 20:39:23 -0800 (PST) (envelope-from gibbs@scsiguy.com) Received: from aslan.scsiguy.com (aslan.scsiguy.com [63.229.232.106]) by aslan.scsiguy.com (8.12.6/8.12.5) with ESMTP id h1H4cgOU039022; Sun, 16 Feb 2003 21:38:42 -0700 (MST) (envelope-from gibbs@scsiguy.com) Date: Sun, 16 Feb 2003 21:38:42 -0700 From: "Justin T. Gibbs" To: Sam Leffler , Perforce Change Reviews Subject: Re: PERFORCE change 24844 for review Message-ID: <47870000.1045456722@aslan.scsiguy.com> In-Reply-To: <200302082030.h18KUuR9063864@repoman.freebsd.org> References: <200302082030.h18KUuR9063864@repoman.freebsd.org> X-Mailer: Mulberry/3.0.1 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > http://perforce.freebsd.org/chv.cgi?CH=24844 > > Change 24844 by sam@sam_ebb on 2003/02/08 12:30:08 > > bus_dma'd em driver (works on x86, not on sparc) > replace rx logic with jumbo buffers (needs more work) There are lots of things that are a bit wierd about how this was bus dma'ed... o The TX and RX rings are allocated separately instead of as a single chunk. While on the x86, this doesn't matter since each chunk is exactly a PAGE_SIZE, on Alpha, this will likely result in 4K of wasted space allocated for each ring due to its larger page size. I don't know that any implementation will track these kinds of allocations at sub-page granularity, but if tag's size were not hardcoded, at least the implementaiton would have a chance to use the space. o The TX/RX rings are not synced when updated prior to informing the adapter of a change in the queues. I believe that NetBSD has the concept of requesting that stuff be mapped in "consistent memory", but the allocator need not honor that. If the consistent mapping succeeds, sync operations cost either nothing or are significantly cheaper. o bus dmamaps have a lifetime of a single packet. While loading a map is usually cheap, allocating a map may be very costly. The implementation may use the allocation of a map as a hint to increase its mapping space, bounce buffer pool, or to perform some other action that will decrease the chance that a load will block should all maps currently allocated against the tag be used at once. The map may be a fairly large object depending on the needs of the implementation. I would suggest changing the maps to have the same lifetime as the TX descriptors. o The driver allocates a duplicate "S/G list" for each tx descriptor. If the driver were converted to a "continuation style" and had the "bottom half" of packet processing performed in the callback, the mappings could be placed directly into the TX descriptors. One of my original complaints to thorpej about his bus dma implmentation was this forced "extra copy" of the mapping information in a format that neither the drivers nor most implementations (Not in IOMMU or SGMAP format) could directly pass on to hardware. On devices that can support large S/G lists, this can make dmamaps very costly (at 16bytes/element and many I/O devices supporting a list of 256 or more elements, each map could require a page or more!). The callback allows the implementation to reuse this space as soon as the callback returns. Having drivers make a copy that they cannot directly use negates this benefit. I really need to go document this stuff... -- Justin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message