Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - io-pkt-v6-hc Wifi driver transmit UDP on IPv6 issue: (4 Items)
   
io-pkt-v6-hc Wifi driver transmit UDP on IPv6 issue  
Hi all,

    I am develop a new wifi driver on QNX. I reference to the sam.c, and basically, this driver works fine. But I face a
 issue that transmit UDP on IPv6 with wifi driver. 
    I have en0 and wifi0 on QNX, I use the same source code to transmit UDP(on IPv6), en0 is successful, but wifi0 is 
strange, becase driver only get [Ethernet header(14bytes)] from io-pkt, no IPv6 header and UDP header ,data. I use 
following source code to transmit UDP(on IPv6).

mysocket=socket(AF_INET6,SOCK_DGRAM,0);
...
dst_sock_in.sin6_family = 0x18
dst_sock_in.sin6_port = 0x3930
dst_sock_in.sin6_scope_id = 0
dst_sock_in.sin6_addr.s6_addr = FE 80 0 12 0 0 0 0 2C 9 A FF FE 0 8F B1
...
send_bytes = sendto( g_Socket_Fd[ SOCKET_UDP ], Data_p, (size_t)Length, 0, ( struct sockaddr* )&dst_sock_in, sizeof( 
dst_sock_in ) );

But the driver only get below data:
            | +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
     -----+-------------------------------------------------+-----------------
 0000 | 2E 09 0A 00 8F B1 2E 09 0A 00 8F B4 86 DD      

No IPv6 header and UDP data.

Then I change the source code: use connect function, and use send() function to transmit UDP(on IPv6) data(this is 
described in Helo content of the IDE). Then the driver get IPv6 data and UDP header from io-pkt, although the udp length
 in UDP header is right, but there is no UDP data after the UDP header. Isend 5bytes udp data.

            | +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F
     -----+-------------------------------------------------+-----------------										
 0040 | 2E 09 0A 00 8F B1 2E 09 0A 00 8F B4 86 DD 60 00 											
 0050 | 00 00 00 0D 11 40 FE 80 00 00 00 00 00 00 2C 09 											
 0060 | 0A FF FE 00 8F 56 FE 80 00 00 00 00 00 00 2C 09 											
 0070 |  0A FF FE 00 8F 57 30 39 30 39 00 0D F5 CD                             											

Would you please give me some advice? I dont know whether there is any mistake in the driver source code. Since en0 
works fine with UDP(on IPv6).

NOTE: I use raw socket to compose UDP data, and it works fine on both en0 and wifi0.
(sock = socket (AF_INET6, SOCK_RAW, IPPROTO_UDP)

Thank you in andvance!


Attachment: Text udp_send.c 1.98 KB
Re: io-pkt-v6-hc Wifi driver transmit UDP on IPv6 issue  
Your wifi driver is only taking a single mbuf in the start routine and expecting the whole packet to be in that. io-pkt 
can send down packets that are contained in multiple mbufs and it expects the driver to handle this. Either setup a 
gather-DMA if the hardware is capable, or to do a defrag and pull all the mbufs in to a single cluster mbuf if the 
hardware can only do single DMA on transmit.
Re: io-pkt-v6-hc Wifi driver transmit UDP on IPv6 issue  
> Your wifi driver is only taking a single mbuf in the start routine and 
> expecting the whole packet to be in that. io-pkt can send down packets that 
> are contained in multiple mbufs and it expects the driver to handle this. 
> Either setup a gather-DMA if the hardware is capable, or to do a defrag and 
> pull all the mbufs in to a single cluster mbuf if the hardware can only do 
> single DMA on transmit.

Hi Nick,
    Thanks for your advice. My wifi driver have dequeue all the data in mbufs, wifi driver have a 1024 length buffer 
queue, so the io-pkt send multiple mbufs, wifi driver will queue the multiple data. It seems that this is not the reason
.
    I don't know why io-pkt not send UDP(on IPv6) data to wifi driver, the UDP data is small, only 5 bytes.

    Anyway, Thank you very much. 

Re: io-pkt-v6-hc Wifi driver transmit UDP on IPv6 issue  
> Your wifi driver is only taking a single mbuf in the start routine and 
> expecting the whole packet to be in that. io-pkt can send down packets that 
> are contained in multiple mbufs and it expects the driver to handle this. 
> Either setup a gather-DMA if the hardware is capable, or to do a defrag and 
> pull all the mbufs in to a single cluster mbuf if the hardware can only do 
> single DMA on transmit.

Hi Nick,
    You are right, it's my mistake! I only taking a single mbuf in the start routine. I should check the m_flags and 
defrag the data packet.
    Thank you very much for your help. I really appreciate for this!