리눅스에서 tcp slow start and congestion avoidance 동작에 관

swunk의 이미지

아래 코드는 tcp slow start와 congestion avoidance가 구현되어 있는 리눅스 코드 입니다. tcp_input.c에 정의 되어 있습니다.

   1699 static __inline__ void tcp_cong_avoid(struct tcp_opt *tp)
   1700 {
   1701         if (tp->snd_cwnd <= tp->snd_ssthresh) {
   1702                 /* In "safe" area, increase. */
   1703                 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
   1704                         tp->snd_cwnd++;
   1705         } else {
   1706                 /* In dangerous area, increase slowly.
   1707                  * In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd
   1708                  */
   1709                 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
   1710                         if (tp->snd_cwnd < tp->snd_cwnd_clamp)
   1711                                 tp->snd_cwnd++;
   1712                         tp->snd_cwnd_cnt=0;
   1713                 } else
   1714                         tp->snd_cwnd_cnt++;
   1715         }
   1716         tp->snd_cwnd_stamp = tcp_time_stamp;
   1717 }

그런데...

cwnd가 threshhold 보다 작을때는 exponential 증가가 되어야 하는데 코드에 보면은 리니어 하게 증가 시키고 있습니다.tp->snd_cwnd++ 어떻게 된거죠 ?

또한 ..

1707라인에 주석으로 처리되어 있는

1707 * In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd 이 내용이 의미하는 바는 무엇인가요? congestion avoidance phase에서 왜 cwnd 값을 하나씩 증가 시키지 않고 위와 같이 증가시키는 건가요 ?

제가 알고 있는대로 라면 위의 코드는 잡다한 거 다 빼고 아래와 같이 되어야 할것 같은데요

   1699 static __inline__ void tcp_cong_avoid(struct tcp_opt *tp) 
   1700 { 
   1701         if (tp->snd_cwnd <= tp->snd_ssthresh) { 
   1702                 /* slow start 상태 exponetial하게 증가 */ 
   1703                 if (tp->snd_cwnd < tp->snd_cwnd_clamp) 
   1704                         tp->snd_cwnd=tp->snd_cwnd*2; 
   1705         }
                    else //congestion avoidance 상태 리니어 하게 증가
                     { 
   1706                         tp->snd_cwnd++; 
   1712          } 
   1716         tp->snd_cwnd_stamp = tcp_time_stamp; 
   1717 }

이렇게 되어야 할것 같은데...

추가질문 하나 더 드리자면
2.4.20 커널에서 사용하는 TCP가 어느 버전 인가요?
RENO 인가요 ?
new reno 인가요 ?
vega 인가요 ?

아니면 ...

답변 부탁드립니다.

swunk의 이미지

너무 뒤로 밀려서 많은 분들이 못 보는것 같아서...
위에 질문에 대한 답변 부탁드립니다.

익명 사용자의 이미지

어제 산 Unix Network Programming 3판에 보면 Linux는 BSD 코드를 쓰는 것이 아니라 새로 작성했다고 되어 있던데요.