This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

potential eCos mbox issue on AT91


Hi,

I am debugging a strange disappearance of packets when it is posted to
a sys_mbox on my AT91.

After running a continous ping test (ping every 3 seconds) for 30-40
minutes, the received packet seems to be eaten up somewhere and I was
able to trace it to just before the packet is posted to a sys_mbox.

What is interesting is that the same packet buffer and mbox msg are
used until the problem occured, from that point new packet buffers and
mbox msgs are allocated.

I would very much appreciate if someone can help me debug the sys_mbox.

Thanks,
David

[1] Log message when the failure is about to happen.

slipif_input: alloc
pbuf_alloc(length=1024)
pbuf_alloc: allocated pbuf 0x0041def8
pbuf_alloc(length=1024) == 0x0041def8
slipif: Got packet size[60]
tcpip_input: post to mbox 0x004f3578
tcpip_thread: IP packet 0x004f3578
ip_input: iphdr->dest 0x200000a netif->ip_addr 0x200000a (0xa, 0xa, 0x2000000)
ip_input: packet accepted on interface sl
ip_input:
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        60     | (v, hl, tos, len)
+-------------------------------+
|     3739      |000|       0   | (id, flags, offset)
+-------------------------------+
|  128  |    1  |    0x1824     | (ttl, proto, chksum)
+-------------------------------+
|   10  |    0  |    0  |    1  | (src)
+-------------------------------+
|   10  |    0  |    0  |    2  | (dest)
+-------------------------------+
ip_input: p->len 60 p->tot_len 60
pbuf_header: old 0x0041df08 new 0x0041df1c (-20)
icmp_input: ping
pbuf_header: old 0x0041df1c new 0x0041df08 (20)
ip_output_if: sl0
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |        60     | (v, hl, tos, len)
+-------------------------------+
|     3739      |000|       0   | (id, flags, offset)
+-------------------------------+
|  128  |    1  |    0x1824     | (ttl, proto, chksum)
+-------------------------------+
|   10  |    0  |    0  |    2  | (src)
+-------------------------------+
|   10  |    0  |    0  |    1  | (dest)
+-------------------------------+
netif->output()pbuf_free(0x0041def8)
pbuf_free: deallocating 0x0041def8
tcpip: ip_reass_tmr()
slipif_input: alloc
pbuf_alloc(length=1024)
pbuf_alloc: allocated pbuf 0x0041def8
pbuf_alloc(length=1024) == 0x0041def8
slipif: Got packet size[76]
tcpip_input: post to mbox 0x004f3578
slipif_input: alloc
pbuf_alloc(length=1024)
pbuf_alloc: allocated pbuf 0x0041e308
pbuf_alloc(length=1024) == 0x0041e308
slipif: Got packet size[92]
tcpip_input: post to mbox 0x00431740
slipif_input: alloc
pbuf_alloc(length=1024)
pbuf_alloc: allocated pbuf 0x0041e718
pbuf_alloc(length=1024) == 0x0041e718
slipif: Got packet size[30]
tcpip_input: post to mbox 0x00431740
slipif_input: alloc
pbuf_alloc(length=1024)
pbuf_alloc: allocated pbuf 0x0041eb28
pbuf_alloc(length=1024) == 0x0041eb28

[2] Relevant code in packages/net/lwip_tcpip/current/src/api/tcpip.c

static void
tcpip_thread(void *arg)
{
 struct tcpip_msg *msg;

(void)arg;

 ip_init();
#if LWIP_UDP
 udp_init();
#endif
#if LWIP_TCP
 tcp_init();
#endif
#if IP_REASSEMBLY
 sys_timeout(1000, ip_timer, NULL);
#endif
 if (tcpip_init_done != NULL) {
   tcpip_init_done(tcpip_init_done_arg);
 }

 while (1) {                          /* MAIN Loop */
   sys_mbox_fetch(mbox, (void *)&msg);
   switch (msg->type) {
   case TCPIP_MSG_API:
     LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
     api_msg_input(msg->msg.apimsg);
     break;
   case TCPIP_MSG_INPUT:
     LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
     ip_input(msg->msg.inp.p, msg->msg.inp.netif);
     break;
   case TCPIP_MSG_CALLBACK:
     LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
     msg->msg.cb.f(msg->msg.cb.ctx);
     break;
   default:
     break;
   }
   memp_free(MEMP_TCPIP_MSG, msg);
 }
}

err_t
tcpip_input(struct pbuf *p, struct netif *inp)
{
 struct tcpip_msg *msg;

 msg = memp_malloc(MEMP_TCPIP_MSG);
 if (msg == NULL) {
   pbuf_free(p);
   return ERR_MEM;
 }

 msg->type = TCPIP_MSG_INPUT;
 msg->msg.inp.p = p;
 msg->msg.inp.netif = inp;
 LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_input: post to mbox %p\n", (void *)msg));
 sys_mbox_post(mbox, msg);
 return ERR_OK;
}

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]