lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] PBUF starvation


From: Alexandre Malo
Subject: Re: [lwip-users] PBUF starvation
Date: Tue, 28 Jul 2009 16:11:25 -0400

Im talking of

/**
 * Pass a received packet to tcpip_thread for input processing
 *
 * @param p the received packet, p->payload pointing to the Ethernet header
or
 *          to an IP header (if netif doesn't got NETIF_FLAG_ETHARP flag)
 * @param inp the network interface on which the packet was received
 */
err_t
tcpip_input(struct pbuf *p, struct netif *inp)

in TCP_IP.c

I forced the mailbox to be really small to see if this was causing the
problem. And it did.

I was just wondering if it was TCP_IP::tcpip_input job's to do the free or
the the caller. (In my case Im using free_rtos and using a rx task.

Alex
----- Original Message ----- 
From: <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Tuesday, July 28, 2009 4:02 PM
Subject: Re: [lwip-users] PBUF starvation


> I don't really get which function you are talking about, but if the
> input mbox is full (thus a received pbuf cannot be passed from the
> driver to lwIP), of course it has to be freed by someone. Normally, the
> function passing the pbuf to the mbox would return an error that would
> allow the driver freeing the pbuf.
>
> This situation (receive-mbox too full) is perfectly normal for systems
> that cannot handle packets at wire-speed.
>
> Simon
>
>
>
> Alexandre Malo wrote:
> > Hi,
> >
> >   I am having PBUF starvation. After a time, some PBUF isnt freed and
> > will never be. I believe, after debuging and adding trace to the pbuf
> > file that it is cause by the TCP_INPUT function. I'm using TCPIP thread.
> >
> > Im keeping a list of allocated pbuf pointer with a time of allocation.
> >
> > With this list I found that many PBUF were not freed and remain
> > allocated. All the threads are running correctly.
> >
> > I think the problem is located in TCP_INPUT. When the mbox of TCP
> > thread is full, the pbuf isn't freed.  Should the PBUF be freed there
> > or should it be my FEC port that free the pbuf?
> >
> >
> >   struct tcpip_msg *msg;
> >
> >   if (mbox != SYS_MBOX_NULL) {
> >     msg = memp_malloc(MEMP_TCPIP_MSG_API);
> >     if (msg == NULL) {
> >       return ERR_MEM;
> >     }
> >
> >     msg->type = TCPIP_MSG_CALLBACK;
> >     msg->msg.cb.f = f;
> >     msg->msg.cb.ctx = ctx;
> >     if (block) {
> >       sys_mbox_post(mbox, msg);
> >     } else {
> >       if (sys_mbox_trypost(mbox, msg) != ERR_OK) {
> >         // FREE THE PBUF HERE??? //
> >         memp_free(MEMP_TCPIP_MSG_API, msg);
> >         return ERR_MEM;
> >       }
> >     }
> >     return ERR_OK;
> >   }
> >   return ERR_VAL;
> >
> >
> > Thanks!
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > lwip-users mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]