From owner-freebsd-hackers Mon Jun 30 19:19:13 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id TAA01207 for hackers-outgoing; Mon, 30 Jun 1997 19:19:13 -0700 (PDT) Received: from lestat.nas.nasa.gov (lestat.nas.nasa.gov [129.99.50.29]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id TAA01197 for ; Mon, 30 Jun 1997 19:19:09 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lestat.nas.nasa.gov (8.8.5/8.6.12) with SMTP id TAA27715; Mon, 30 Jun 1997 19:15:02 -0700 (PDT) Message-Id: <199707010215.TAA27715@lestat.nas.nasa.gov> X-Authentication-Warning: lestat.nas.nasa.gov: localhost [127.0.0.1] didn't use HELO protocol To: Julian Elischer Cc: Vivek Sadananda Pai , freebsd-hackers@freebsd.org Subject: Re: mbuf external storage Reply-To: Jason Thorpe From: Jason Thorpe Date: Mon, 30 Jun 1997 19:15:01 -0700 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Mon, 30 Jun 1997 18:44:29 -0700 Julian Elischer wrote: > > I'm interested in mbufs with external storage, particularly when that > > storage is not in the form of mbufs clusters. I've examined the mbuf.h > > file, and the structure for external storage is: > > > > struct m_ext { > > caddr_t ext_buf; /* start of buffer */ > > void (*ext_free) /* free routine if not the usual */ > > __P((caddr_t, u_int)); > > u_int ext_size; /* size of buffer, for ext_free */ > > void (*ext_ref) /* add a reference to the ext object */ > > __P((caddr_t, u_int)); > > }; > > Yes I added this to version 1.17 of mbuf.h > this was inspired by code in the old BSD4.3 code that I needed for > some applications. This was also in OSF1 which became Digital Unix. I also recommend taking a look at the external storage mbuf code in NetBSD that was done by Matt Thomas and myself. NetBSD actively uses it in the handling of UNIX domain sockets, and I'm experimenting using it for DMA buffer loan-out for high performance network interfaces (such as Myrinet and Hippi); doing this really effectively is going to require an additional function call interface to deal with the transmit case, however... that's to-be-attacked later. The reference counting scheme is done with a ring, and the (*ext_free)() function takes an additional opaque cookie for use by that routine. > > I also searched through old mail on this topic, and it seems that this > > structure used to be a lot richer, with some form of "opaque" argument > > (ext_arg) that could be used by whatever was allocating/freeing the > > external memory. Having something like this would be extremely useful > > in certain scenarios, and I've used it to good effect in Digital Unix. ...yes... a struct buf *, for a biodone() call, for example. Or a softc for a device (if you're freeing a loaned-out DMA buffer). > > We're examining FreeBSD as a platform for doing some I/O research, and > > the package we want to port uses this "ext_arg" convention. > > > > The struct was actually not so rich. > there was TALK of adding even more than I did. > > do a search in current and hackers using > "mbuf AND external" > > > I agree that the opaque argument would be useful. > > > > Does anyone know if there are any plans of (re)including this, or if > > there's some reason why it was removed? > It was never there. > It might be useful to include it.. I just overload the 'ext_size' > argument. (as nothing uses it). That's seriously bogus... ext_size _is_ used in e.g. NetBSD's NFS code, and when you think about running on 64-bit architectures (like the Alpha, which FreeBSD has ambitions about running on), then you can't resort to such a kludge. Jason R. Thorpe thorpej@nas.nasa.gov NASA Ames Research Center Home: 408.866.1912 NAS: M/S 258-6 Work: 415.604.0935 Moffett Field, CA 94035 Pager: 415.428.6939