Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - sending data from io-pkt module upon DMA completion: (5 Items)
   
sending data from io-pkt module upon DMA completion  
Hi, 
I'm using a chip with internal DMA block.
When DMA completes I'll get a pulse from DMA ISR.
I'm writing io-pkt module that'll send the data upon DMA completion.
Can I use pulse_attach() function and send all the data(few megabytes) 
from inside the  pulse handler or should I use nw_pthread_create() to create separate thread ?
Can if_output() function be used from multiple threads/pulse handler or
some semaphore should be locked?

Thanks,
Yura
Re: sending data from io-pkt module upon DMA completion  
On Wed, Mar 18, 2009 at 05:38:54AM -0400, Yuri Shchors wrote:
> Hi, 
> I'm using a chip with internal DMA block.
> When DMA completes I'll get a pulse from DMA ISR.
> I'm writing io-pkt module that'll send the data upon DMA completion.
> Can I use pulse_attach() function and send all the data(few megabytes) 
> from inside the  pulse handler or should I use nw_pthread_create() to create separate thread ?

It sounds like you may be able to attach to the interrupt like
other drivers.  Maybe check out speedo_attach() in
sys/dev_qnx/speedo/detect.c which sets up an interrupt callout
and ISR.


> Can if_output() function be used from multiple threads/pulse handler or
> some semaphore should be locked?

ifp->if_output() has to be thread safe.  For example ether_output()
generally only acts on the packet in question or checks state when
needed.  ifp->if_start() is called with the ifp->if_snd_ex mutex
locked.
Re: sending data from io-pkt module upon DMA completion  
> On Wed, Mar 18, 2009 at 05:38:54AM -0400, Yuri Shchors wrote:

> It sounds like you may be able to attach to the interrupt like
> other drivers.  Maybe check out speedo_attach() in
> sys/dev_qnx/speedo/detect.c which sets up an interrupt callout
> and ISR.

Does this mean that I can use pulse_attach or InterruptAttach in the module init routine? Does the pulse callback block 
other io-pkt activity? 

> ifp->if_output() has to be thread safe.  For example ether_output()
> generally only acts on the packet in question or checks state when
> needed.  ifp->if_start() is called with the ifp->if_snd_ex mutex
> locked.
So I should call if_start before calling to if_output? I've used qnet ipv4 driver as a sample and havn't seen if_start 
there.

RE: sending data from io-pkt module upon DMA completion  
Hi Yura:

I'm a bit curious as to what you're trying to accomplish.  Do you have a
network card that you're trying to write a driver for or is this some
other sort of application?   

  Robert.

-----Original Message-----
From: Yuri Shchors [mailto:community-noreply@qnx.com] 
Sent: Wednesday, March 18, 2009 5:39 AM
To: ionetmig-networking
Subject: sending data from io-pkt module upon DMA completion

Hi,
I'm using a chip with internal DMA block.
When DMA completes I'll get a pulse from DMA ISR.
I'm writing io-pkt module that'll send the data upon DMA completion.
Can I use pulse_attach() function and send all the data(few megabytes)
from inside the  pulse handler or should I use nw_pthread_create() to
create separate thread ?
Can if_output() function be used from multiple threads/pulse handler or
some semaphore should be locked?

Thanks,
Yura

_______________________________________________
io-net migration
http://community.qnx.com/sf/go/post24654
Re: RE: sending data from io-pkt module upon DMA completion  
> Hi Yura:
> 
> I'm a bit curious as to what you're trying to accomplish.  Do you have a
> network card that you're trying to write a driver for or is this some
> other sort of application?   
> 
>   Robert.
> 

Hi,
I have a 533 Mhz, MPC8360 chip with DMA block and I need to push large amounts of data through it's 1Gbit ethernet 
MAC(up to max capacity - 125Mb/sec). The data arrives from external bus which has sufficient bandwidth. I've written 
standalone program that uses DMA to get the data. Now, I need to send it through the network. Writing a simple test 
program that sends raw IP packets, yields rather poor result (max speed about 40Mb/s), so I've decided to write io-pkt 
module to avoid unnecessary copying of data, since I know it's physical location.
Using mmap I can access the data brought by DMA. The io-pkt module
should make a packets from the data and send them. The problem is in getting notification from external program. The 
simplest way seem to be in using pulse_attach in module initialization routine and doing all the work in the pulse 
handler, but I don't know if it'll block rest of the io-pkt activity and in which thread's context it gets called. The 
thread is other possibility, which seems to be more complicated to me. Any advice is welcome.

Yura.