Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Optimise performance to io-pkt or should i not use the stack?: (9 Items)
   
Optimise performance to io-pkt or should i not use the stack?  
Hello

Optimise performance to io-pkt or should

I had wrote a network program for my QNX target.

The target is a PowerPC type MPC8377 running 600MHz on the core and 400Mhz on the ram.

The program generates packages, send them through io-pkt with using BPF. And read the package process generate a new and
 etc.
In my testsetup the package size is 100bytes, and is send every 200us.

Io-pkt take 24% of the CPU usage and my application too 9% of the Cpu time.

So the point is that i think that io-pkt not is preforming well in this embedded network application.
Can i do something to speed it up?
The io-pkt service two network chips would it be better to start a instance of io-pkt for my application and one for the
 normal network traffic like qconn, telnet etc?

Another thing is that it also could be possible to load the driver mpc85xx.so in my application and then setup 
everything for my network driver.
Would this be easy to do?
Is there on QNX  an example where they load a ethernet driver and setup phy mbufs etc, or something similar?

If I chose this it also will remove the task switch between the io-pkt and my application.


/Lasse
Re: Optimise performance to io-pkt or should i not use the stack?  
I'm a bit surprised by the numbers you get.

But you could create your own protocol lsm I guess. AFAIK there isn't 
really a doc on how to do it but it is illustrated in the user guide and 
there are some examples to look at in the code under sys/lsm/:
http://www.qnx.com/developers/docs/6.4.1/io-pkt_en/user_guide/overview.html

Lycka till!
/P

Re: Optimise performance to io-pkt or should i not use the stack?  
How are you measuring the 24% - if you are using hogs then you would do better
with taking a kernel trace - hogs is notoriously inaccurate for io-pkt profiling.

Lasse Skov wrote:
> Hello
> 
> Optimise performance to io-pkt or should
> 
> I had wrote a network program for my QNX target.
> 
> The target is a PowerPC type MPC8377 running 600MHz on the core and 400Mhz on the ram.
> 
> The program generates packages, send them through io-pkt with using BPF. And read the package process generate a new 
and etc.
> In my testsetup the package size is 100bytes, and is send every 200us.
> 
> Io-pkt take 24% of the CPU usage and my application too 9% of the Cpu time.
> 
> So the point is that i think that io-pkt not is preforming well in this embedded network application.
> Can i do something to speed it up?
> The io-pkt service two network chips would it be better to start a instance of io-pkt for my application and one for 
the normal network traffic like qconn, telnet etc?
> 
> Another thing is that it also could be possible to load the driver mpc85xx.so in my application and then setup 
everything for my network driver.
> Would this be easy to do?
> Is there on QNX  an example where they load a ethernet driver and setup phy mbufs etc, or something similar?
> 
> If I chose this it also will remove the task switch between the io-pkt and my application.
> 
> 
> /Lasse
> 
> 
> 
> _______________________________________________
> 
> Technology
> http://community.qnx.com/sf/go/post40863
> 

-- 
cburgess@qnx.com
Re: Optimise performance to io-pkt or should i not use the stack?  
I used top but think that this is calculation just like hogs.

If i try to setup kernel event trace when my program running my target went down and writing this out on my serial 
console.

INSTR: dropped 725 events!
INSTR: dropped 1 buffers!
INSTR: dropped 715 events!
INSTR: dropped 1 buffers!
INSTR: dropped 714 events!
INSTR: dropped 1 buffers!
INSTR: dropped 724 events!
INSTR: dropped 1 buffers!

What is it my instrumented kernel exactly trying to tell me?

/Lasse
Re: Optimise performance to io-pkt or should i not use the stack?  
It means that tracelogger cannot get the buffers to permanent storage.   In high performance
scenarios, use direct mapping mode.

eg

tracelogger -S32M -M

which will log a max of 32M to /dev/shmem/tracebuffer.kev

Lasse Skov wrote:
> I used top but think that this is calculation just like hogs.
> 
> If i try to setup kernel event trace when my program running my target went down and writing this out on my serial 
console.
> 
> INSTR: dropped 725 events!
> INSTR: dropped 1 buffers!
> INSTR: dropped 715 events!
> INSTR: dropped 1 buffers!
> INSTR: dropped 714 events!
> INSTR: dropped 1 buffers!
> INSTR: dropped 724 events!
> INSTR: dropped 1 buffers!
> 
> What is it my instrumented kernel exactly trying to tell me?
> 
> /Lasse
> 
> 
> 
> _______________________________________________
> 
> Technology
> http://community.qnx.com/sf/go/post40991
> 

-- 
cburgess@qnx.com
Re: Optimise performance to io-pkt or should i not use the stack?  
Okay thanks now i got a file.
But it is not so good... my target is really busy.

I added the file so you can see.

Did you know if there is a example on how to load a devnp network driver.
I think that if i load the driver... do the stuff for connect the driver to the phy and the just bring my ethernet 
packages to the driver.?
Attachment: Text tracebuffer.kev 360.38 KB
Re: Optimise performance to io-pkt or should i not use the stack?  
Hi Lasse:

I really don't think that you want to do that.  You'd have to duplicate the stack interface into the drivers and that 
would be, to say the least, difficult.

I'd recommend looking at two alternatives:

1) Writing your own filter
http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Filtering_wiki_page

This is essentially the same as putting your application in the same context as the stack (almost the same as working 
with the driver directly).  The down side of this is that you are operating in the same processing context as the stack 
so you may find it too restrictive.

2) Try using the nraw interface (it's an unsupported example of a filter that provides a resource manager interface to 
read and write raw ethernet packets).  See 
http://community.qnx.com/integration/viewvc/viewvc.cgi/trunk/lib/io-pkt/sys/lsm/nraw/?root=core_networking&system=
exsy1001

This bypasses the stack processing altogether.  

Out of curiosity, are you incurring any packet loss that may be resulting in re-transmissions or are you strictly trying
 to send your own formatted packets?

   Robert 
Re: Optimise performance to io-pkt or should i not use the stack?  
Hi Robert

And thanks for your answer.

Okay i think that i will try your 2. option.

And if i should make it at little bit clear of what I trying to do. :)


I have my own protocol (EtherCAT) implemented on QNX. And it working with the BPC device i send packages through now.
I'm simply taking all traffic from the ethernet port, (always the same port, and really hardware near in my situation).
My EtherCAT program has it's own FIFO it insert the EtherCAT telegrams in, dont know if you know the protocol but it's 
pretty simple.

So my point is that i will try to get more performance out of my program, with trying to do something on the network 
side.
In the start i chose the bpf because it was pretty simple to send and recive packages with.
As i know BPF taking packages out of the stack, so i think it will be faster if i use the nraw interface. So packages 
not should be processed there.

But still i think i will be faster if i setup the network device in my program. But I know that this not will be a 
simple workaround, but I still see this like the best solution if it should preform freaky. :)
Is there some example in the core networking code where I can see what I should do for loading and setting the network 
driver up.?
I know that if I do this Im not having any function there take care of the network interface, and all statics and 
package loss should be calculated and watched in my program.

First I think that I will try the solution with the nraw interface an se how this will work.
And maybe look on how to load the driver if nraw still take too much time with task switching and etc.

Hope this make it a bit more clear of what I trying to do.

/Lasse

> Hi Lasse:
> 
> I really don't think that you want to do that.  You'd have to duplicate the 
> stack interface into the drivers and that would be, to say the least, 
> difficult.
> 
> I'd recommend looking at two alternatives:
> 
> 1) Writing your own filter
> http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/
> Filtering_wiki_page
> 
> This is essentially the same as putting your application in the same context 
> as the stack (almost the same as working with the driver directly).  The down 
> side of this is that you are operating in the same processing context as the 
> stack so you may find it too restrictive.
> 
> 2) Try using the nraw interface (it's an unsupported example of a filter that 
> provides a resource manager interface to read and write raw ethernet packets).
>   See 
> http://community.qnx.com/integration/viewvc/viewvc.cgi/trunk/lib/io-pkt/sys/
> lsm/nraw/?root=core_networking&system=exsy1001
> 
> This bypasses the stack processing altogether.  
> 
> Out of curiosity, are you incurring any packet loss that may be resulting in 
> re-transmissions or are you strictly trying to send your own formatted packets
> ?
> 
>    Robert 


Re: Optimise performance to io-pkt or should i not use the stack?  
> But still i think i will be faster if i setup the network device in my program. But I know that this not will be a 
simple workaround, but I still see this like the best solution if it should preform freaky. :)
>   
As I think I suggested before, writing your own lsm can do that. You'd 
be running your own code (protocol) inside the stack as a loadable ".so".

/P