lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP_SND_QUEUELEN vs TCP_SNDQUEUELEN_OVERFLOW


From: Art R.
Subject: Re: [lwip-users] TCP_SND_QUEUELEN vs TCP_SNDQUEUELEN_OVERFLOW
Date: Wed, 26 Mar 2008 07:24:05 -0700 (PDT)

Just trying to make lwIP as good as it can be.

Don't know if you would consider this, but ...

tcp.c (current 1.3.0)
line 315:   pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS;
line 995:   pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS;
Both TCP_MSS and 536 are constants. The compare could be done at compile
time in a #if rather than in compiled code at runtime. It's in code that's
low frequency of execution so it's not at all critical, but it might help
readability.

One could have the following at the top of tcp.c:

// Determine the initial MSS used when creating a TCP PCB
#if MSS > 536
#define TCP_INITIAL_MSS  (MSS)
#else
#define TCP_INITIAL_MSS  536
#endif

and replace the two lines cited with:
line 315:   pcb->mss = TCP_INITIAL_MSS;
line 995:   pcb->mss = TCP_INITIAL_MSS;

Regards,
Art R.




address@hidden wrote:
> 
> Hmm, that bit of code was rather a quick fix for the problem that 
> queuelen was an u8_t and was overflowing very fast and the maximum 
> increasement for one call of tcp_enqueue is 3. But that could be done 
> better, I agree. Especially care must be taken for misconfiguration 
> (TCP_SND_QUEUELEN < 3). In fact, this can be take care of completely by 
> checking the configuration.I'll take a look at it for 1.3.1. Thanks for 
> reporting.
> 
> Simon
> 
> 
> Art R. schrieb:
>> Greetings,
>>
>> I was reading the current 1.3.0 release code and ran across something I
>> find
>> puzzling.
>>
>> tcp_out.c 
>> line 164-6: 
>>   queuelen = pcb->snd_queuelen;
>>   /* check for configured max queuelen and possible overflow */
>>   if ((queuelen >= TCP_SND_QUEUELEN) || (queuelen >
>> TCP_SNDQUEUELEN_OVERFLOW)) {
>>
>> tcp.h
>> lines 333-334:
>> #define TCP_SNDQUEUELEN_OVERFLOW (0xffff-3)
>>   u16_t snd_queuelen; /* Available buffer space for sending (in
>> tcp_segs).
>> */
>>
>> The default value for TCP_SND_QUEUELEN in opt.h is 8, if I read it
>> correctly. In our tests, it typically has values in the range of 20 or
>> so.
>>
>> The setting for TCP_SNDQUEUELEN_OVERFLOW is 65532  (FFFF-3).
>> It does not seem sensible to be comparing pcb->snd_queuelen to both
>> TCP_SND_QUEUELEN and TCP_SNDQUEUELEN_OVERFLOW.
>> Is this intended? A bug? What is the intended purpose for
>> TCP_SNDQUEUELEN_OVERFLOW?
>>
>> HTH...
>>
>> Art R.
>>
>>
>>
>>
>>
>>   
> 
> 
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/TCP_SND_QUEUELEN-vs-TCP_SNDQUEUELEN_OVERFLOW-tp16291544p16301528.html
Sent from the lwip-users mailing list archive at Nabble.com.





reply via email to

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