segment MAC Frame 512 segments segments PHY Block
segment流程 將MAC Frame分成 512個小區段 (segments) 每一個小區段(segments)前端皆會加 入一個PHY Block Header (PBH) 後面再加入一個PHY Block Check Sequence(PBCS)。 依靠PBH & PBCS來做前向錯誤更正 2021/10/16 2
segment程式說明 先新增 PHY Block Header (file mac-HPAV. h) 傳送封包之前的更新Header加入 SSN 負責記錄第N個segment 2021/10/16 3
判斷packet是否大於Segment. Threshold=512 對pkt. Tx做切割 並把資料丟入p[i],再將p傳回 2021/10/16 4
模擬結果 2021/10/16 5
判斷目前呼叫recv( )這個packet的傳輸方向 Mac-HPAV Receive a Packet Direction DOWN? No Yes Call Send () Begin Receiving Precedure 2021/10/16 10
Send Mac. HPAV: : send 設定data packet長度,並將各資訊填入Mac Header中frame control內的子欄位值,等待適當時機發送 rst_DC_BPC() Mac. HPAV : : send. DATA Mac. HPAV : : send. RTS 建立RTS packet,並等待適當時機發送 Yes Back-off timer busy? No channel idle? Yes No Start Back-off timer Yes Defer timer Busy? No Start Back-off timer with CIFS+CW Just return and wait for its expiring 基本上到此步驟, send()的 作就已完成 接下來就是發送之後所� 生的問題 eg. 重傳. 接收ACK 2021/10/16 11
defer. Handler() Defer timer expires check_pkt. CTRL() Check the return value =0? check_pkt. RTS() Yes Return Check the return value =0? Yes No No check_pkt. Tx() Return Check the return value =0? No Yes Return 2021/10/16 12
check_pkt. RTS() have RTS to send? No Return Yes Is channel idle? Yes Set Tx. State to MAC_RTS Call transmit() No Increase Contention Window rst_DC_CW() start back-off timer Time out=CW 2021/10/16 13
check_pkt. Tx() have DATA to send? No Return Yes Is channel idle? Yes Set Tx. State to MAC_SEND Call transmit() No Increase Contention Window rst_DC_CW() start back-off timer Time out=CW 2021/10/16 14
Retransmit. DATA() Retry count >= Max. Limit? Yes Free pkt. Tx_ reset Retry. Count and reset CW() No Call Send. RTS() Return Increase CW Call rst_DC_CW() Start Back-off timer with Time out=CW 2021/10/16 15
函數總整理 已有/修改 新增 函數名稱 功能 recv( ) 接收封包 send(p, h) 傳送封包 send. DATA(p) 傳送資料(RTS/data) send. RTS(ETHER_ADDR(dh->dh_ra)) 設定RTS封包至暫存 defer. Handler() 當計時器倒數結束時呼叫 check_pkt. Tx() 確認暫存內是否有封包待傳輸 check_pkt. RTS() 確認暫存內是否有RTS封包待傳輸 Transmit() 傳送資料(packet/RTS packet) recv. CTS() 接收CTS packet Retransmit. DATA() 重傳資料(packet/RTS packet) get. CW() 取得現狀態之Contention Window getpriority() 取得節點之Priority inc_cw() 增加Contention Window大小 rst_DC_CW() 重新設定Deferral Counter & Contention Window rst_cw() 重新設定Contention Window大小 rst_DC_BPC() 重新設定Deferral Counter & Backoff Procedure event Counter get. Segment. Threshold() 取得Segment. Threshold參數 Segment() 對pkt. Tx 做分割 2021/10/16 16
修改新增 檔案總整理 動作 檔案 修改 ns-allinone-2. 30ns-2. 30Makefile 備註 ns-allinone-2. 30ns-2. 30libtclns-default. tcl 新增 ns-allinone-2. 30ns-2. 30tcllanns-mac. tcl 新增mac-HPAV修改 ns-allinone-2. 30ns-2. 30mobiletworayground. cc 新增HPAV-phy修改 ns-allinone-2. 30ns-2. 30mobiletworayground. h 新增HPAV-phy修改 ns-allinone-2. 30ns-2. 30macchannel. cc 新增PLCchannel修改 ns-allinone-2. 30ns-2. 30macchannel. h 新增PLCchannel修改 ns-allinone-2. 30ns-2. 30mac-HPAV. cc 新增mac-HPAV ns-allinone-2. 30ns-2. 30mac-HPAV. h ns-allinone-2. 30ns-2. 30mac-HPAV-timers. cc 新增mac-HPAV-timers ns-allinone-2. 30ns-2. 30mac-HPAV-timers. h ns-allinone-2. 30ns-2. 30macHPAV-phy. h 新增HPAV-phy ns-allinone-2. 30ns-2. 30macHPAV-phy. cc ns-allinone-2. 30ns-2. 30mobilePLCPropagation. cc 新增PLCPropagation ns-allinone-2. 30ns-2. 30mobilePLCPropagation. h ns-allinone-2. 30ns-2. 30queueHPAVqueue. cc 新增HPAVqueue ns-allinone-2. 30ns-2. 30queueHPAVqueue. h ns-allinone-2. 30ns-2. 30PLCRouter. cc 新增PLCRouter ns-allinone-2. 30ns-2. 30PLCRouter. h ns-allinone-2. 30ns-2. 30mobilitytclPLCRouter. tcl 2021/10/16 17
- Slides: 18