LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 04-20-2009, 10:29 AM   #1
rrbarbosa
LQ Newbie
 
Registered: Apr 2009
Distribution: Ubuntu Hardy
Posts: 2

Rep: Reputation: 0
TCP ACKs in kernel code


Hello,

I am interested in two points of TCP implementation for kernel 2.6.

The first point is about the 'quickack mode' used to make the congestion window to grow faster during the 'slow-start' phase. The code on tcp_input.c shows that number of quick acks to be sent is equal to the half of the receiver window worth of packets:

tcp_input.c/tcp_incr_quickack
Code:
unsigned quickacks = tp->rcv_wnd/(2*tp->ack.rcv_mss);
Is the value of rcv_wnd is always equal to the value of advertised window sent in a TCP segment? More precisely, is it possible to know (aprox.) how many quick acks are scheduled to be sent by looking a network trace (i.e. tcpdump)?

The second point is that I understood that the linux implementation can send a delayed ack for more than two packets as the delayed ack mechanism is not based on the number of packets, but in the 'ato' (ack time out?!). And thus *not* following recommendation the RFC 2581 ("The requirement that an ACK "SHOULD" be generated for at least every second full-sized segment..."). Which is OK, as it is a SHOULD.

What I cannot understand is how the timer is controlled. I do not understand how "about to expire" is tested on the code bellow:

tcp_output.c/tcp_send_delayed_ack
Code:
/* If delack timer was blocked or is about to expire,
* send ACK now.
*/
if (tp->ack.blocked || time_before_eq(tp->ack.timeout, jiffies+(ato>>2))) {
	tcp_send_ack(sk);
	return;
}
Can somebody help me with those?

Thanks,
Rafael
 
Old 04-24-2009, 04:34 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,539

Rep: Reputation: 149Reputation: 149
Question 1: IMO not always. There's window scalling possible. For details look into tcp_output.c: tcp_select_window

Question 2: This piece of code sends the ack if it's not worth it to set a timer, because the time is too close. ato will usually be HZ/25. So ato/4 is HZ/100. Really short period of time
 
Old 05-22-2009, 08:13 AM   #3
rrbarbosa
LQ Newbie
 
Registered: Apr 2009
Distribution: Ubuntu Hardy
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mara View Post
Question 1: IMO not always. There's window scalling possible. For details look into tcp_output.c: tcp_select_window

Question 2: This piece of code sends the ack if it's not worth it to set a timer, because the time is too close. ato will usually be HZ/25. So ato/4 is HZ/100. Really short period of time
Thanks for the answer. Regarding question 2, ato/4 (1ms?) is not a so short period of time... but I understand the test now.

I've been working in other stuff for a while but now I back on the TCP code. Still trying to understand how ACKs are sent. I think I got most of it figured out. There is a part that I do not quite understand though.

On tcp_input.c , one ack is generated imediatelly in 3 cases by __tcp_ack_snd_check :

Code:
             /* More than one full frame received... */
         if (((tp->rcv_nxt - tp->rcv_wup) >  
                          inet_csk(sk)->icsk_ack.rcv_mss
              /* ... and right edge of window advances far enough.
               * (tcp_recvmsg() will send ACK otherwise). Or...
               */
              && __tcp_select_window(sk) >= tp->rcv_wnd) ||
             /* We ACK each frame or... */
             tcp_in_quickack_mode(sk) ||
             /* We have out of order data. */
             (ofo_possible && skb_peek(&tp->out_of_order_queue))) {
                 /* Then ack it now */
                 tcp_send_ack(sk);
The second and third options are clear, quick ack mode and out of order data. But I do not quite understand the first.

- What it means to receive a packet larger than the MSS?
- My understanding is that
Code:
__tcp_select_window(sk) >= tp->rcv_wnd
tests if the receiver window is going to grow. Is that correct?
- Summarizing, what is the first option testing??

Thanks,
Rafael
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The .c file of kernel source code where TCP connection takes place. indrajeetmopari Linux - Kernel 2 02-12-2008 07:52 PM
Linux change TCP kernel Parameter for TCP DELAY ACK TICKS linux_mando Linux - Networking 5 08-22-2006 09:20 AM
Anyone managed to disable Acks? Titanas25 Linux - Wireless Networking 0 05-17-2006 08:31 AM
Duplicate ACKs arunachalam Linux - Networking 3 11-07-2005 12:28 PM
TCP code modification enjoyzj Linux - Networking 2 04-23-2004 07:43 PM


All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration