Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - io-pkt shared memory (PCIe) driver, sending packets up the stack: (7 Items)
   
io-pkt shared memory (PCIe) driver, sending packets up the stack  
Starting with the sample io-pkt driver (sam.c) I've created a shared memory driver to provide network connections 
between two processor modules.  The shared memory is really PCI/PCIe.

It seems to work intermittently. I'm guessing that the handling of the m_buf content during transmit and generation of 
m_buf content during receive are not correct. 

Is there any reference material that describes the content of m_bufs during transmit?

Is the m_buf format passed up the stack (via ifp->if_input()) described anywhere?  Does each call to ifp->if_input() 
send one full packet up?

Thanks,
Gary
RE: io-pkt shared memory (PCIe) driver, sending packets up the stack  
Look at the existing driver source to see how
mbufs are handled during tx and rx.

Specifically the "native" io-pkt drivers
under sys/dev_qnx.  But the ported BSD
drivers under sys/dev are obviously correct
too!

--
aboyd

Re: io-pkt shared memory (PCIe) driver, sending packets up the stack  
Mbufs are pretty standard. You should probably look at what other 
drivers do to allocate them and fill them in with data.

One thing that can be a gotcha is that when sending mbufs you got to 
make sure to defrag them. Again, see other drivers for how that's done.

Did you read the accompanying doc/native_drvr.txt? It doesn't have much 
about mbufs, but is helpful together with sam.c.

/P

gary anderson wrote:
> Starting with the sample io-pkt driver (sam.c) I've created a shared memory driver to provide network connections 
between two processor modules.  The shared memory is really PCI/PCIe.
>
> It seems to work intermittently. I'm guessing that the handling of the m_buf content during transmit and generation of
 m_buf content during receive are not correct. 
>
> Is there any reference material that describes the content of m_bufs during transmit?
>
> Is the m_buf format passed up the stack (via ifp->if_input()) described anywhere?  Does each call to ifp->if_input() 
send one full packet up?
>
> Thanks,
> Gary
>
>
>
> _______________________________________________
>
> Networking Drivers
> http://community.qnx.com/sf/go/post43047
>
>   
RE: io-pkt shared memory (PCIe) driver, sending packets up the stack  
In your rx processing, make sure you set:

  m->m_len
  m->m_pkthdr.len
  m->pkthdr.rcvif

before you pass the mbuf up.

Also, be sure you do the NBPFILTER
thing - it is not optional.

Again, copy the existing drivers.

--
aboyd
Re: io-pkt shared memory (PCIe) driver, sending packets up the stack  
Patrick,

The native_drvr.txt was very helpful.  By defrag'ing I'm guess that you mean to traverse the linked list of m_bufs.  I 
have done that as it was done in the sam.c example.

I guess I have a more fundamental question on receive.  Does the m_buf chain passed up in the ifp->input() call contain 
a complete packet or just an arbitrary set of received bytes?  

Gary
Re: io-pkt shared memory (PCIe) driver, sending packets up the stack  
> I guess I have a more fundamental question on receive.  Does the m_buf chain passed up in the ifp->input() call 
contain a complete packet or just an arbitrary set of received bytes?  
>   

It should be a packet.

/P
Re: io-pkt shared memory (PCIe) driver, sending packets up the stack  
Patrik and Andrew,

Thanks to your help I have a completely functional LAN driver operating between two single board computers connected via
 PCIe through a non-transparent bridge.

Gary