Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Map mbuf packet into device memory: (3 Items)
   
Map mbuf packet into device memory  
Hello.

My device has a dedicated memory to put packets buffer inside and save CPU RAM space.

The issue is I do not know how to allocate a mbuf inside this physical memory.
Is mmap able to do such ?
Is that the purpose of its "addr" parameter ?

Once again, thank you very much for your help.
Guillaume.
Re: Map mbuf packet into device memory  
I doubt this is a good idea.

mbuf being hold all the time, buffering, waiting for client application
come to read it out of the stack, ... The memory in your device may run
out very quickly.

I would suggest do a copy in the driver layer.

-xtang



On Wed, 2009-06-24 at 09:42 -0400, Guillaume Varlet wrote:
> Hello.
> 
> My device has a dedicated memory to put packets buffer inside and save
> CPU RAM space.
> 
> The issue is I do not know how to allocate a mbuf inside this physical
> memory.
> Is mmap able to do such ?
> Is that the purpose of its "addr" parameter ?
> 
> Once again, thank you very much for your help.
> Guillaume.
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post32441
> 
> 
> 
Re: Map mbuf packet into device memory  
On Wed, Jun 24, 2009 at 09:42:19AM -0400, Guillaume Varlet wrote:
> Hello.
> 
> My device has a dedicated memory to put packets buffer inside and save CPU RAM space.
> 
> The issue is I do not know how to allocate a mbuf inside this physical memory.
> Is mmap able to do such ?
> Is that the purpose of its "addr" parameter ?
> 
> Once again, thank you very much for your help.


This is for receive right?  If you know the physical offset
you can mmap it in with or use mmap_device_memory().  For
an example of pointing an mbuf in it and reusing it after
mfree() grep for MEXTADD in the wpi driver which also uses
its own receive pool.

http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/sys/dev/pci/if_wpi.c?root=core_networking&rev=904&system=
exsy1001&view=log

-seanb