2010/07/06
ns-linux-util.h

struct tcp_sock {
__u32 snd_nxt; /* Next sequence we send */
__u32 snd_una; /* First byte we want an ack for */
__u32 snd_ssthresh; /* Slow start size threshold */
__u32 snd_cwnd; /* Sending congestion window */
__u16 snd_cwnd_cnt; /* Linear increase counter */
__u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
__u32 snd_cwnd_stamp;
__u32 bytes_acked;
}



0 コメント | コメントを書く | コメントの表示
2010/06/22
HighSpeed TCP



b(w)について
0.1:b(w)の最小値
0.5:b(w)の最大値
log83000:cwndが83000のとき,b(w)が0.1になる
log38:cwndが38のとき,b(w)が0.5になる



0 コメント | コメントを書く | コメントの表示
2009/10/23
NS-2 tracefile


1 2 3 4 5 6 7 8 9 10 11 12
r 18.41875265 _4_ AGT --- 4157 tcp 1070 [dd 4 3 800]

13 15 17
------- [0:0 4:0 30 4][2880 0]
14 16 18

1 2 _3_ 4 5 6 7 8 [9 10 11 12] ------- [13:14 15:16 17 18][19 20] 21 22
%c %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] ------- [%d:%d %d:%d %d %d]


1.s/r/d/f:send, receive, drop, forward
2.Time:時刻
3.Node ID:ノード番号
4.Trace Name:トレース名(どこの層のデータか?)
 AGT:AGENT:Transport Layer
 RTR:ROUTER:Network layer
 MAC:MAC:Datalink Layer
5.Reason:パケットドロップの理由
 RET:Retry
 CBK:Callback
 TTL:Time to Live
 COL:Collision
6.Event Identifier:イベント識別子
7.Packet Type:IPパケット中のタイプ
8.Packet Size:IPパケット長
9.Time To Send Data:
10.Destination MAC Address:宛先MACアドレス
11.Source MAC Address:送信元MACアドレス
12.Type(ARP, IP):Ethernetヘッダ中のタイプ
13.Source IP Address:送信元IPアドレス
14.Source Port:送信元ポート
15.Destination IP Address:宛先IPアドレス
16.Destination Port Address:宛先ポート
17.TTL:Time To Live
18.Next hop node:次ホップのノード番号

19.?
20.?
21.?
22.?

参考
http://nsnam.isi.edu/nsnam/index.php/NS-2_Trace_Formats
http://metalone.net/pukiwiki/index.php?%5B%5BNS-2%A4%CB%A4%C4%A4%A4%A4%C6%5D%5D



1 コメント | コメントを書く | コメントの表示
TCP vegas

struct vegas {
u32 beg_snd_nxt; // 最新RTT秒間に測定したRTTの中でも最も新しいRTT
u32 beg_snd_una; // 最新RTT秒間に測定したRTTの中でも最も古いRTT
u32 beg_snd_cwnd; // cwnd保存用
u8 doing_vegas_now; //
u16 cntRTT; // 最新のRTT秒間に測定したRTTの数
u32 minRTT; // 最新のRTT秒間に測定した最小RTT
u32 baseRTT; // TCPフロー全体の最小RTT
}



0 コメント | コメントを書く | コメントの表示
2009/10/22
cwndとdwnd

cwnd:congestion window
dwnd:delay-based window



0 コメント | コメントを書く | コメントの表示
2009/10/21
function name in TCP-Linux for NS-2

cong_avoid
・ACKを受け取るたびに呼び出され,輻輳ウィンドウサイズを増加させることができる.これはtcp.cc中のopencwndに相当する.
・ackは最新のacknowledgementのバイト数
・rttは最新のacknowledgementから測定される
・in_flightは最新のacknowledgementの前の伝送中(in flight:飛行中)のパケット?
・good_ackは,現在の状況が通常状態(重複ACKがない,パケットロスがない,SACKが用いられていない)であることを示す.値が1の場合通常状態,0の場合疑わしい状態.

ssthresh
・TCPフローがパケットロスを検出したときに呼び出される
・パケットロスを検出した後,フローのslow start thresholdを返す.

min_cwnd


undo_cwnd


rtt_sample
・新しいRTTサンプルが得られた時に呼び出される.主に遅延ベースの輻輳制御アルゴリズムに用いられ,たいていタイムスタンプと同化している.

set_state


cwnd_event


pkts_acked


init


release


参考
http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/tutorial/index.html#Congestion_control_algorithm_interface



0 コメント | コメントを書く | コメントの表示
TCP メモ

Compound TCPだと,低スループットの時はRTTベースで制御している.
アドホックネットワークだと,RTTの変動が大きいから微妙だろうか.

アドホックネットワーク
・低スループット
・スループットの変動が大きい
・高遅延
・高ジッタ

スループットが低下(cwndが減少)するポイント
1.他の人も使い始めた(キュー長の増大によるRTT増加)
2.距離が延びて利得が減る
3.パケットロス(干渉)
4.パケットロス(キューあふれ)
5.ホップ数の増加(RTTと距離の増加)


RTTと有効帯域はどのように変化しているか

RTT有効帯域cwndどうする
1増加減少減らす
2変化なし移動速度に応じて減少/td>減らす
3変化なし変化なし変化なし
4増加最大値減らす
5機器遅延増加減少減らす



Throughput = cwnd/RTT

Vegasは最小RTTから帯域幅を予測する
無線アドホックネットワークでは経路変化が激しい
帯域幅を予測することは不可能

無線はパケットロス率が高い:輻輳とロスは見分けがつかない
とりあえずパケットロスはスルーの方向がいいか
でもVegasのようなRTTベースも厳しい

センサネットワーク:リアルタイム伝送
測定データを常に送り続ける必要がある
データ自体は大きくないか.音声,映像じゃなければ

負荷が高いところは通りたくない
負荷分散はルーティング時にしてくれる?

ある程度鈍感なTCPのほうがいいのかなー
1回のRTT測定で評価しないで,サンプルする期間をちょっと長くするか



0 コメント | コメントを書く | コメントの表示
2009/10/20
AIMD High Speed TCP

AIMD:Additive Increase Multiplicative Decrease
増加は足し算・減少は掛け算

TCPは輻輳回避フェーズにおいて2つのパラメータを用いる.
AIMD( a, b )
a:増加パラメータ
b:減少パラメータ

aは1ACKごとにcwndの値をa増やす.
bはパケットロス時にcwndの値にbかける.

Reno(NewReno)ではa=1,b=0.5となっている.
High Speed TCPにおいては,cwnd(t-1)に依存してaとbは決定される.


| Congestion | Packet Loss
| Avoidance |
------+-----------------+-----------------
| cwnd(t) | cwnd(t)
| =cwnd(t-1)+a(w) | =cwnd(t-1)*b(w)
------+-----------------+-----------------
Reno | a=1 | b=0.5
------+-----------------+-----------------
HSTCP | cwnd(t-1) a(w) | b(w)
| --------- ---- | ----
| 38 1 | 0.50
| 118 2 | 0.44
| 221 3 | 0.41
| 347 4 | 0.38
| 495 5 | 0.37
| 663 6 | 0.35
| 851 7 | 0.34
| 1058 8 | 0.33
| 1284 9 | 0.32
| 1529 10 | 0.31
| 1793 11 | 0.30
| 2076 12 | 0.29
| 2378 13 | 0.28
| 2699 14 | 0.28
| 3039 15 | 0.27
| 3399 16 | 0.27
| 3778 17 | 0.26
| 4177 18 | 0.26
| 4596 19 | 0.25
| 5036 20 | 0.25
| 5497 21 | 0.24
| 5979 22 | 0.24
| 6483 23 | 0.23
| 7009 24 | 0.23
| 7558 25 | 0.22
| 8130 26 | 0.22
| 8726 27 | 0.22
| 9346 28 | 0.21
| 9991 29 | 0.21
| 10661 30 | 0.21
| 11358 31 | 0.20
| 12082 32 | 0.20
| 12834 33 | 0.20
| 13614 34 | 0.19
| 14424 35 | 0.19
| 15265 36 | 0.19
| 16137 37 | 0.19
| 17042 38 | 0.18
| 17981 39 | 0.18
| 18955 40 | 0.18
| 19965 41 | 0.17
| 21013 42 | 0.17
| 22101 43 | 0.17
| 23230 44 | 0.17
| 24402 45 | 0.16
| 25618 46 | 0.16
| 26881 47 | 0.16
| 28193 48 | 0.16
| 29557 49 | 0.15
| 30975 50 | 0.15
| 32450 51 | 0.15
| 33986 52 | 0.15
| 35586 53 | 0.14
| 37253 54 | 0.14
| 38992 55 | 0.14
| 40808 56 | 0.14
| 42707 57 | 0.13
| 44694 58 | 0.13
| 46776 59 | 0.13
| 48961 60 | 0.13
| 51258 61 | 0.13
| 53677 62 | 0.12
| 56230 63 | 0.12
| 58932 64 | 0.12
| 61799 65 | 0.12
| 64851 66 | 0.11
| 68113 67 | 0.11
| 71617 68 | 0.11
| 75401 69 | 0.10
| 79517 70 | 0.10
| 84035 71 | 0.10
| 89053 72 | 0.10
| 94717 73 | 0.09

This table was computed with the following Perl program:
RFCに載っているものにちょっとだけ変更を加えた.
てかRFCに載ってるやつ,printfのところのダブルクォート足りてないような・・・?
あと,\nで改行しておいた.
log83000とか,log38ってどこから出てきたんだ.
あと1.2乗と12.8かけてるところも.

********************************************************************************

#!/usr/bin/perl

$top = 100000; #MAX value of cwnd
$num = 38; #Initial value of cwnd

if ($num == 38) {
print " w a(w) b(w)\n";
print " ---- ---- ----\n";
print " 38 1 0.50\n";
$oldb = 0.50;
$olda = 1;
}

while ($num < $top) {
$bw = (0.1 -0.5)*(log($num)-log(38))/(log(83000)-log(38))+0.5;
$aw = ($num**2*2.0*$bw) / ((2.0-$bw)*$num**1.2*12.8);
if ($aw > $olda + 1) {
printf "%6d %5d %3.2f0\n", $num, $aw, $bw;
$olda = $aw;
}
$num ++;
}

********************************************************************************

参考文献
http://tiki.is.os-omicron.org/tiki.cgi?c=v&p=AIMD
http://icfamon.dl.ac.uk/papers/DataTAG-WP2/reports/task1/20021001-Yee.pdf
http://www.ietf.org/rfc/rfc3649.txt



0 コメント | コメントを書く | コメントの表示
NS-2 TCP Variable Name

snd_ssthresh
・unsigned
・Slow Start threshold

snd_cwnd
・unsigned
・Congestion window

snd_cwnd_cnt
・unsigned(16 bit)
・Fraction of congestion window which is not accumulated to 1
・Ackカウント

snd_cwnd_clamp
・unsigned(16bit)
・upper bound of the congestion window
・シナリオファイルにおいて,値の設定が可能
set tcp [new Agent/TCP/Linux]
$tcp set window_ xxxxxxxx


参考
http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/tutorial/index.html



0 コメント | コメントを書く | コメントの表示
2009/10/19
NS-2 TCP実装

環境
・NS-2.34-allinone

手順
・http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/tutorial/tutorial/tcp_naivereno.cのソースをダウンロード
・サンプルのソースを"ns-2.34/tcp/linux"ディレクトリにコピー
・"ns-2.34/Makefile"中の"OBJ_CC = \"以下に,"tcp_naivereno.o"があることを確認
・"ns-2.34"ディレクトリでmake
・tclファイルでは$ns at 0 "$tcp select_ca naive_reno"を記述
・ns hogehoge.tcl


自分でTCPを作った場合の手順
・TCPソース中に下のコードを記述(nameの値がselect_caで用いられる)

static struct tcp_congestion_ops YourCongestionControlStructure {
.name = "mytest1"
.ssthresh = tcp_mytest1_ssthresh,
.cong_avoid = tcp_mytest1_cong_avoid,
.min_cwnd = _mytest1_min_cwnd
}

・tclファイルでは$ns at 0 "$tcp select_ca mytest1"を記述
・"ns-2.34/Makefile"中の"OBJ_CC = \"以下に,"tcp/linux/tcp_mytest1.o"を記述
・"ns-2.34"ディレクトリでmake
・ns hogehoge.tcl

http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/tutorial/#selectca
上記ページの訳
このプロセスでは新しい服装制御方式を実装する.
1.データ構造とインターフェースと輻輳制御インタフェースを理解して.
2.輻輳制御方式に名前を付けて.--この名前はselect_caコマンドで使われる.
3.少なくとも3つの輻輳制御関数(cong_avoid, ssthresh, and min_cwnd)が輻輳制御インタフェースには必要だよ.
4.コンスタントなstruct,"struct tcp_congestion_ops YourCongestionControlStructure {...}"を,cong_avoid, ssthresh, min_cwnd に名前を入れて作る.
5.ヘッダファイル"linux-linux-util.h" and "ns-linux-c.h"をインクルードする.
6.(mytcpfile.c)みたいな自分のファイルを,"tcp/linux/"ディレクトリにコピーしておく.
7.Makefileに,"tcp/linux/mytcpfile.o"のエントリを追加して,コンパイラが自分のファイルをコンパイルするようにさせる.
8.コンパイルして実行してシミュレーションの結果をチェックする.

The process to implement a new (and simple) congestion control algorithm
1.Understand the data structure interface and congestion control interface
2.Give a name for your congestion control algorithm -- this name will be used in the "select_ca" command.
3.Implement at least the three required congestion control functions (cong_avoid, ssthresh, and min_cwnd) in the congestion control interface
4.Create a constant struct struct tcp_congestion_ops YourCongestionControlStructure {...} with the name, cong_avoid, ssthresh, and min_cwnd (and/or o
ther congetion implemented functions) filled

5.Include two header files: "linux-linux-util.h" and "ns-linux-c.h".
6.copy your file (mytcpfile.c) to tcp/linux/ directory
7.Add an entry in Makefile: tcp/linux/mytcpfile.o to let the compiler knows to compile your file
8.compile, run and check the simulation results

参考
http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/tutorial



0 コメント | コメントを書く | コメントの表示
Template Design: © 2007 Envy Inc.