From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,c09fde94de7a03ee X-Google-Attributes: gidfee84,public From: map@zk3.dec.com (Mark Parenti) Subject: Re: Physically contiguous large buffers. Date: 1996/03/29 Message-ID: <4jgot8$e6r@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 144978865 distribution: world references: <3151E589.10DA@newbridge.com> <4j6ba9$avv@news.xmission.com> organization: Digital Equipment Corporation reply-to: map@zk3.dec.com (Mark Parenti) newsgroups: comp.unix.osf.osf1 originator: map@sawdst.zk3.dec.com Nagesh Chintada wrote: >Hi folks, > >Does anyone know HOW I can allocate buffers that are physically contiguous AND >large enough to hold about 10kbytes of data, under OSF1? The context is a >network device driver receive buffer, which needs to DMA frames of the size >10kbytes. Any info will be helpful. Nagesh, It depends on what you mean by "physically contiguous". If you mean from the point of view of the device out on the PCI bus (which is what I think you mean based on your description) then you don't have to do anything special. When you call dma_map_load() the appropriate mapping will happen to make your buffer appear to be physically contiguous on the PCI bus even if it is not physically contiguous in main memory. The PCI adapter hardware then does the scatter gather on the fly during the actual transfer. There are some situations where you may not get a physically contiguous bus map by default (although I've never seen one in practice). If you really require the buffer to be physically congtigous you should set the DMA_CONTIG flag in your dma_map_alloc()/dma_map_load() calls. This will guarantee that either you get contiguous mapping or the request will fail. With 10K you are not going to have a problem, this is mostly an issue for multi-MB buffers (we might not have enough contiguous scatter gather registers). If you really need the buffer to be physically contiguous in system memory then you have two choice. On V3.x you will need to use the undocumented method described in steal_mem.c. In V4.0 there is a contig_alloc() call that allows drivers to allocate physically contiguous chunks of main memory. As was mentioned in Chris' post, anything less than 8K (1 page) is guaranteed to be physically contiguous regardless of what method you use. Mark Parenti Digital Equipment Corporation UNIX Engineering Group