Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - io-net convertor/driver issues: (4 Items)
   
io-net convertor/driver issues  
I am having issues getting my convertor/driver combination to work correctly with io-net. 

My driver will be working with IP packets directly so there is no need for my convertor to do anything other than just 
immediately pass the IP packets given to it to the driver and to the IP stack. 

I have setup my driver to have up-type foo, and my convertor to uptype IP and bot_type foo.

When sending IP packets (an ICMP echo request in my given test) from one of my devices to another here's what happens:

Requesting device
1) My convertor gets the request and passes it down to the driver
2) The driver receives the request and sends it to the other device

Receiving device
1) My driver receives the echo request and calls tx_up_start
2) My convertor receives the echo request and calls tx_up_start
3) TxDone is called in my driver (not by my convertor so I am assuming this is done by the ip stack) - is there any way 
I can see some log info on what io-net and the ip stack are doing with this?
4) I never receive an rxdown in my convertor for the echo response that I should see.

I have verified the contents of the npkt_t data portion and it matches the original IP packet that is sent to my 
convertor on the originating device. I have verified that the route table is configured correctly as well.

Does anyone have any pointers on what could be wrong here? I have to assume I am not setting something up right, but my 
code is completly based on the pppmgr and online documentation examples.
Re: io-net convertor/driver issues  
On Fri, Dec 05, 2008 at 09:59:52AM -0500, David Weiss wrote:
> I am having issues getting my convertor/driver combination to work correctly with io-net. 
> 
> My driver will be working with IP packets directly so there is no need for my convertor to do anything other than just
 immediately pass the IP packets given to it to the driver and to the IP stack. 
> 
> I have setup my driver to have up-type foo, and my convertor to uptype IP and bot_type foo.
> 
> When sending IP packets (an ICMP echo request in my given test) from one of my devices to another here's what happens:

> 
> Requesting device
> 1) My convertor gets the request and passes it down to the driver
> 2) The driver receives the request and sends it to the other device
> 
> Receiving device
> 1) My driver receives the echo request and calls tx_up_start
> 2) My convertor receives the echo request and calls tx_up_start
> 3) TxDone is called in my driver (not by my convertor so I am assuming this is done by the ip stack) - is there any 
way I can see some log info on what io-net and the ip stack are doing with this?
> 4) I never receive an rxdown in my convertor for the echo response that I should see.
> 
> I have verified the contents of the npkt_t data portion and it matches the original IP packet that is sent to my 
convertor on the originating device. I have verified that the route table is configured correctly as well.
> 
> Does anyone have any pointers on what could be wrong here? I have to assume I am not setting something up right, but 
my code is completly based on the pppmgr and online documentation examples.
> 

Check the output from 'netstat -pip', 'netstat -picmp'.  The
stack might log why it didn't like the packet.

-seanb
Re: io-net convertor/driver issues  
Both netstat's show 0 for everything.

Here's the code from my convertor's rx_up method

int rx_up(....)
   printf("foo_rx_up\n");

	struct foo_ctl *pctrl = func_hdl;

	if (npkt->flags & _NPKT_MSG) 
      {
		int ret = foo_message(pctrl, npkt, cell, endpoint, iface);
		return ret;
	}

   net_iov_t   *iov;
   net_buf_t   *buf;
   int i;
   uint8_t dst[1024] = {0};
   uint8_t* pTmp = (uint8_t*)dst;
   int data_len = 0;
   for (buf = TAILQ_FIRST(& npkt->buffers); buf != NULL; buf = TAILQ_NEXT(buf, ptrs)) 
   {
      for (i = 0, iov = buf->net_iov; i < buf->niov; i++, iov++) 
      {
         memcpy(pTmp, iov->iov_base, iov->iov_len);
         pTmp += iov->iov_len;
         data_len += iov->iov_len;
      }
   }

   printf("size of packet = %d\n", data_len);
   for (i = 0; i < data_len; i++)
   {
      printf("%02x ", dst[i]);
   }
   printf("\n");

  if(pctrl->npi->tx_up_start(pctrl->reg_hdl, npkt, 0, 0, pctrl->cell, pctrl->endpoint, 0, 0) != 0) 
   {
      printf("failed %d\n", errno);
      pctrl->npi->tx_done(pctrl->reg_hdl, npkt);
   }
   else
   {
      printf("success\n");
   }
   return 0;
}

//////////////////////////////////////////////
Here's the output from the printf's
/////////////////////////////////////////////
foo_rx_up

size of packet = 84

45 00 00 54 00 1a 00 00 ff 01 3a 3b c0 a8 00 02 c0 a8 00 01 08 00 07 25 e0 30 00 00 4f 00 00 00 0d 00 a6 06 00 08 09 0a 
0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 
33 34 35 36

FooDriver::TxDone

success
/////////////////////////////////////////////////////
End output
/////////////////////////////////////////////////////
The packet data listed above is a valid ICMP echo request from my other device as far as I can tell - and it's what the 
other device outputs when I display the data from my driver on that one. 

Is it possible that i am filling in something incorrectly in the npkt_t structure in my driver? I took the makepacket 
code directly out of your online docs, so I don't know why that would be incorrect, but I am at a loss as to why 
tx_up_start is returning success in this case if the data is not getting to the stack.

Thanks again for any help you can provide me with.
Re: io-net convertor/driver issues  
It turns out the converter needs to call reg_byte_pat() before it sends up an advertise in order for the stack to 
properly receive data from the convertor.