lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Problem with UDP and ARP queuing


From: David Haas
Subject: Re: [lwip-devel] Problem with UDP and ARP queuing
Date: Fri, 20 Aug 2004 08:45:48 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707

Tony,

You are right. Good catch! I did a fair amount of testing and did'nt see a problem, but I guess it would manifest itself as a slow memory leak and then only if there is more than one frame on the arp queue (which in my case is not that likely). I corrected my version.

David.


Mountifield, Tony wrote:

OK, I've just looked in more detail at pbuf_queue(). Just before the end 
(pbuf.c:754), it does a pbuf_ref() on the packet being queued, so I think 
etharp_queue() only needs to do a pbuf_ref() when putting the pointer directly 
into the ARP  table, and not when doing a pbuf_queue().

Cheers
Tony

-----Original Message-----
From: David Haas [mailto:address@hidden
Sent: 18 August 2004 16:34
To: lwip-devel
Subject: Re: [lwip-devel] Problem with UDP and ARP queuing


It turns out that

arp_table[i] = p;

and

pbuf_queue(arp_table[i].p, p);

really do the same thing: put p on the arp_table queue. The reason they are separate is that pbuf_queue() does not handle the case where the queue is empty and therefore the first argument would be zero. If the pbuf is being queued at all, then the arp table has a pointer to the pbuf. Later when it takes the pbuf off the queue it will call pbuf_free() with that pbuf pointer. So it needs to increment the reference count when the pbuf is being queued.

David.


Mountifield, Tony wrote:

Sorry, wrong "if".

You have (effectively):

      if (arp_table[i].p == NULL) {
          arp_table[i].p = p;
      } else {
          pbuf_queue(arp_table[i].p, p);
      }
      pbuf_ref(p);

whereas I have:

      if (arp_table[i].p == NULL) {
          pbuf_ref(p);
          arp_table[i].p = p;
      } else {
          pbuf_queue(arp_table[i].p, p);
      }

I'm not sure which of the two is correct. It depends whether
queueing requires a refcnt increment, and if so, whether pbuf_queue() handles it.


***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.

www.tandbergtv.com
***********************************************************************************



_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel





reply via email to

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