All of lore.kernel.org
 help / color / mirror / Atom feed
* Socket buffer allocation outside DMA-able memory
@ 2006-06-02 13:26 art
  2006-06-06 12:37 ` ashley jones
  0 siblings, 1 reply; 10+ messages in thread
From: art @ 2006-06-02 13:26 UTC (permalink / raw)
  To: linux-mips

Hello all!
I work with ADM5120 chip. it has embedded switch.
Switch descriptor has 25-bit dma addres field - so addressible only
32Mb!
My system has 64Mb memory. But I have to set 32Mb to make it work!
I thought that setting DMA mask can help. So in
/arch/mips/adm5120/setup.c i make:

static struct platform_device adm5120hcd_device = {
        .name           = "adm5120-hcd",
        .id             = -1,
        .dev            = {
        .dma_mask               = &hcd_dmamask,
        .coherent_dma_mask      = 0x01ffffff,
        },
        .num_resources  = ARRAY_SIZE(adm5120_hcd_resources),
        .resource       = adm5120_hcd_resources,
};
But It is wrong, because dev_alloc_skb dont know to which device it
allocates buffer!

How to tell kernel allocate skbuffers in less then 32Mb addrspace whet
system has 64Mb?

-- 
Best regards,
 art                          mailto:art@sigrand.ru

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: Socket buffer allocation outside DMA-able memory
@ 2006-06-06 13:33 ` Zhan, Rongkai
  0 siblings, 0 replies; 10+ messages in thread
From: Zhan, Rongkai @ 2006-06-06 13:33 UTC (permalink / raw)
  To: ashley jones, art, linux-mips

[-- Attachment #1: Type: text/plain, Size: 2158 bytes --]

Hi,

 

Maybe you can enable ISA bus. And then add your low 32MB memory into ZONE_DMA, while the high 32MB memory into ZONE_NORMAL.

In the case, you are required to redefine MAX_DMA_ADDRESS to (PAGE_OFFSET + 0x00200000) in asm-mips/dma.h

 

 

Just a noise.

 

Best Regards,
Mark. Zhan

________________________________

From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of ashley jones
Sent: Tuesday, June 06, 2006 8:38 PM
To: art; linux-mips@linux-mips.org
Subject: Re: Socket buffer allocation outside DMA-able memory

 

hi,

       I guess your 25 bit dma address field will be word alligned, so ur dma engine will be able to index up to 64 MB( 25+2 = 27 bits).

 

        If that is not the case then you can use one of the foll. work around,

 

  * dont give whole 64 MB to linux, give only Lower 32 MB.

  * Give only upper 32 MB to linux, and give memory to ur dma engine from lower 32 MB, and once you recv any data you copy to skb and submit to linux. ( ofcourse your performance will get hit in this case.)

 

 

Regards,

A'Jones.



art <art@sigrand.ru> wrote:

	Hello all!
	I work with ADM5120 chip. it has embedded switch.
	Switch descriptor has 25-bit dma addres field - so addressible only
	32Mb!
	My system has 64Mb memory. But I have to set 32Mb to make it work!
	I thought that setting DMA mask can help. So in
	/arch/mips/adm5120/setup.c i make:
	
	static struct platform_device adm5120hcd_device = {
	.name = "adm5120-hcd",
	.id = -1,
	.dev = {
	.dma_mask = &hcd_dmamask,
	.coherent_dma_mask = 0x01ffffff,
	},
	.num_resources = ARRAY_SIZE(adm5120_hcd_resources),
	.resource = adm5120_hcd_resources,
	};
	But It is wrong, because dev_alloc_skb dont know to which device it
	allocates buffer!
	
	How to tell kernel allocate skbuffers in less then 32Mb addrspace whet
	system has 64Mb?
	
	-- 
	Best regards,
	art mailto:art@sigrand.ru
	
	
	

 

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


[-- Attachment #2: Type: text/html, Size: 9082 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread
* RE: Socket buffer allocation outside DMA-able memory
@ 2006-06-06 14:02 ` Zhan, Rongkai
  0 siblings, 0 replies; 10+ messages in thread
From: Zhan, Rongkai @ 2006-06-06 14:02 UTC (permalink / raw)
  To: Zhan, Rongkai, ashley jones, art, linux-mips

After having a look at the latest 2.6.17-rc6 codes, __dev_alloc_skb is defined like this:

#ifndef CONFIG_HAVE_ARCH_DEV_ALLOC_SKB
/**
 *	__dev_alloc_skb - allocate an skbuff for sending
 *	@length: length to allocate
 *	@gfp_mask: get_free_pages mask, passed to alloc_skb
 *
 *	Allocate a new &sk_buff and assign it a usage count of one. The
 *	buffer has unspecified headroom built in. Users should allocate
 *	the headroom they think they need without accounting for the
 *	built in space. The built in space is used for optimisations.
 *
 *	%NULL is returned in there is no free memory.
 */
static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
					      gfp_t gfp_mask)
{
	struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
	if (likely(skb))
		skb_reserve(skb, NET_SKB_PAD);
	return skb;
}
#else
extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
#endif


Therefore, you also can consider to implement your machine-specific __dev_alloc_skb() function, and force the skb is allocated from your low 32MB memory zone.

Best Regards,
Mark. Zhan
________________________________________
From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of Zhan, Rongkai
Sent: Tuesday, June 06, 2006 9:34 PM
To: ashley jones; art; linux-mips@linux-mips.org
Subject: RE: Socket buffer allocation outside DMA-able memory

Hi,

Maybe you can enable ISA bus. And then add your low 32MB memory into ZONE_DMA, while the high 32MB memory into ZONE_NORMAL.
In the case, you are required to redefine MAX_DMA_ADDRESS to (PAGE_OFFSET + 0x00200000) in asm-mips/dma.h


Just a noise.

Best Regards,
Mark. Zhan
________________________________________
From: linux-mips-bounce@linux-mips.org [mailto:linux-mips-bounce@linux-mips.org] On Behalf Of ashley jones
Sent: Tuesday, June 06, 2006 8:38 PM
To: art; linux-mips@linux-mips.org
Subject: Re: Socket buffer allocation outside DMA-able memory

hi,
       I guess your 25 bit dma address field will be word alligned, so ur dma engine will be able to index up to 64 MB( 25+2 = 27 bits).
 
        If that is not the case then you can use one of the foll. work around,
 
  * dont give whole 64 MB to linux, give only Lower 32 MB.
  * Give only upper 32 MB to linux, and give memory to ur dma engine from lower 32 MB, and once you recv any data you copy to skb and submit to linux. ( ofcourse your performance will get hit in this case.)
 
 
Regards,
A'Jones.


art <art@sigrand.ru> wrote:
Hello all!
I work with ADM5120 chip. it has embedded switch.
Switch descriptor has 25-bit dma addres field - so addressible only
32Mb!
My system has 64Mb memory. But I have to set 32Mb to make it work!
I thought that setting DMA mask can help. So in
/arch/mips/adm5120/setup.c i make:

static struct platform_device adm5120hcd_device = {
.name = "adm5120-hcd",
.id = -1,
.dev = {
.dma_mask = &hcd_dmamask,
.coherent_dma_mask = 0x01ffffff,
},
.num_resources = ARRAY_SIZE(adm5120_hcd_resources),
.resource = adm5120_hcd_resources,
};
But It is wrong, because dev_alloc_skb dont know to which device it
allocates buffer!

How to tell kernel allocate skbuffers in less then 32Mb addrspace whet
system has 64Mb?

-- 
Best regards,
art mailto:art@sigrand.ru


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-06-07  7:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-02 13:26 Socket buffer allocation outside DMA-able memory art
2006-06-06 12:37 ` ashley jones
2006-06-07  3:48   ` Re[2]: " art
2006-06-07  5:17     ` ashley jones
2006-06-07  7:37       ` Re[4]: " art
  -- strict thread matches above, loose matches on Subject: below --
2006-06-06 13:33 Zhan, Rongkai
2006-06-06 13:33 ` Zhan, Rongkai
2006-06-06 14:02 Zhan, Rongkai
2006-06-06 14:02 ` Zhan, Rongkai
     [not found] ` <10452.060607@sigrand.ru>
2006-06-07  4:11   ` Mark.Zhan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.