1/21 ethernet - ieee 802.3 carrier sense multiple access with collision detection (csma/cd) all...

21
1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD) ights reserved. No part of this publication and file may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherw ut prior written permission of Professor Nen-Fu Huang (E-mail: [email protected]).

Post on 22-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

1/21Ethernet -

IEEE 802.3 Carrier Sense Multiple Access withCollision Detection (CSMA/CD)

All rights reserved. No part of this publication and file may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise,

without prior written permission of Professor Nen-Fu Huang (E-mail: [email protected]).

Page 2: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

2/21Ethernet -

Typical CSMA/CD Network

A C E

B D F

同軸電纜收發器電纜

終端器

終端器

收發器

Page 3: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

3/21Ethernet -

IEEE 802.3 Architecture

應用層

表達層

會議層

傳輸層

網路層

鏈結層

實體層

OSI參考模式

媒介擷取控制

邏輯鏈結控制 LLC (IEEE 802.2)

MAC

PLS實體層訊號處理

高層通訊協定

CSMA/CD

傳輸媒介

PMA MAUAUI

MDI

Page 4: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

4/21Ethernet -

CSMA/CD Protocol

Carrier Sense before transmissionCarrier Sense while transmissionCollision: Two or more stations transmitting simul

taneouslyBackoff: Random delay after collisionDeference: Defers transmission if channel is sense

d busyCollision Window (Slot time): Round-trip propagat

ion delay time plus some carrier sense time. In IEEE 802.3, this value is defined to be 51.2 us.

Page 5: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

5/21Ethernet -

CSMA/CD Collision Handling

Collision Signal is generated by Physical layer.Jam signal (collision enforcement): To make sure

that all stations involved in the collision will detect collision. A pattern of 32 bits.

Collision backoff and retransmission method (Truncated Binary Exponential Backoff Algorithm, BEBA):n : number of collisions experienced (n <= 16)k : Min (n,10) -- Truncationr : Random delay time (unit: slot time) between 0 <= r <

2k

Page 6: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

6/21Ethernet -

CSMA/CD Collision Handling

Slot time = 51.2 us.Disadvantage of BEBA:

Last-in-First-out effect: Stations with no or few collisions will have a better chance to transmit before stations that have waited longer.

Page 7: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

7/21Ethernet -

IEEE 802.3 Frame Format

Preamble SFD DA SA LEN LLC PAD FCS

7 1 2, 6 2, 6 2 4 位元組

I/G

I/G U/L

15-位元地址

46-位元地址

I/G = 0 Individual Address (個別地址)I/G = 1 Group Address (群體地址)U/L = 0 Globally Administered Address (整體性地址)U/L = 1 Locally Administered Address (區域性地址)

Preamble: (101010...1010) for Synchronization SFD: Start Frame Delimiter (10101011) DA: Destination Address SA: Source Address Length: Length of LLC-Frame LLC-Frame: Up to 1500 bytes PAD: Padding when LLC-Frame < 46 bytes FCS: Frame Check Sequence (CRC-32) MAC-frame size -- from DA to FCS

Min 64 bytes to distinguish from collision Max 1518 bytes to prevent dominating bandwidth

Page 8: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

8/21Ethernet -

Cyclic Redundancy Check (CRC32) Hardware Implementation

X0 X1 X2 X3 X4 X5 X6

X7 X8 X9 X10 X11 X12 X13X14 X15

X16 X 17X18 X19 X20 X21 X22 X23 X24 X25

X26 X27X28 X29 X30 X31

MUX

.

.= AND= XOR= NOT

MUX

A

B

C

O = A, C = 0

O = B, C = 1輸出

輸入控制訊號

Page 9: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

9/21Ethernet -

Flow Chart

傳送訊框

組成訊框 , i=1

線上有 訊號

傳送訊框

發生衝撞 送出擾亂訊號

傳送完畢

i > 16

Y

Y

Y

N

N

N

N

Y

i = i + 1

計算延遲時間

等待延遲時間

傳送成功 傳送失敗

接收訊框

開始接收

接收完畢

訊框過短 (衝撞)

位址辨識 成功

Y

Y

N

N

Y

訊框錯誤 接收成功

檢查碼 正確

尚有多餘 位元

對齊錯誤

長度欄位 內容正確

刪除訊框頭尾

長度錯誤

Y

Y

N

N

Y

N

Page 10: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

10/21Ethernet -

Collision Detection Window for Baseband CSMA/CD (=2a)

BA

a = 0.5, 傳輸時間 = 1

t0

BA

t0+a-

BA

t0+0.5

BA

t0+1-

衝撞

A 開始傳送訊框

B 開始傳送訊框

B 偵測出衝撞

A 偵測出衝撞

Page 11: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

11/21Ethernet -

Cable Signaling (Manchester Encoding)

1 0 1 0 1 1 1 0 0

Preamble Data

Idle Idle

... ...

-1.825V

-0.225V0V

1 0 1 0 1 1 1 0 0

Preamble Data

Idle Idle

... ...

-0.7V0V

+0.7V

100ns 50ns

Coaxial Cable

Transceiver Cable

Page 12: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

12/21Ethernet -

Network Configuration Example 1 (Single segment)

A D

B C E

同軸電纜

收發器電纜

終端器

終端器收發器

同軸電纜區段(最長 500 公尺)

(每區段最多接 100 個)(最長 50 公尺)

Page 13: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

13/21Ethernet -

Network Configuration Example 2 (Two segments)

D

B C A

第一段同軸電纜

同軸電纜區段(最長 500 公尺)

第二段同軸電纜

G H I

FE

同軸電纜區段(最長 500 公尺)

收發器電纜(最長 50 公尺)

訊號增益器

Page 14: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

14/21Ethernet -

Network Configuration Example 3 (Five segments, maximum)

C

A

B

F

D

E

G H

J

K

I

N

L

M

訊號增益器

半訊號增益器

半訊號增益器間電纜(最長 1000 公尺)區段 4

區段 1區段 2

區段 3

區段 5

1

2

3

4

5

6

Page 15: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

15/21Ethernet -

Architecture, Functions, and Implementation

傳送及接收

工作站界面

訊框包裝

鏈結管理

編碼及解碼

網路控制卡

收發器電纜

收發器

鏈結層

實體層

高層通訊協定

銅軸電纜

Page 16: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

16/21Ethernet -

Calculation of Slot time(Example 3)

元件

編碼器 0.1us 0.1us 5 5 2.0us

收發器電纜 5.13ns/公尺0 300公尺 300公尺 3.08us

收發器(傳送路徑) 0.05us 0.3us 3 3 2.10us

收發器(接收路徑) 0.05us 0.6us 3 0 1.95us

收發器(衝撞路徑) 0 0.9us 0 3 2.70us

同軸電纜 4.33ns/公尺0 1500公尺 1500公尺 12.99us

半訊號增益器間電纜 5.13ns/公尺0 1000公尺 1000公尺 10.26us

電纜驅動器 0.1us 0 2 2 0.40us

電纜接收器 0.1us 0 2 2 0.40us

訊號增益器(增益路徑) 0.2us 0.4us 2 0 1.20us

訊號增益器(衝撞路徑) 0.2us 0.2us 0 2 0.80us

載波感測 0 0.2us 5 0 1.00us

衝撞偵測 0 0.2us 0 5 1.00us

訊號上升時間 0 0.1us 3 0 0.30us

(至 70% 於 500公尺處)

訊號上升時間(由 50% 0 2.0us 0 3 6.00us

至 94% 於 500公尺處)

衝撞分割 0 0.2us 0 1 0.20us

元件 穩定延遲

元件 啟動延遲

前進路徑 元件數 整體延遲

回程路徑 元件數

訊號來回傳遞最長延遲 46.38us

Page 17: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

17/21Ethernet -

10BaseT Ethernet Examples

C

A

BF

D

E

G

H

集線器 (HUB)

無遮蔽式雙絞線 (UTP)最長 100 公尺

10BASE2 界面10BASE5 界面

10BASET

FE G

HC

A

B D

集線器(HUB)

10BASE2 界面10BASE5 界面10BASET

串聯線

Page 18: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

18/21Ethernet -

Half-duplex MACEthernets have always used a half-duplex MAC.Efficient bidirectional communications is effected by

rapidly changing the direction of communication on half-duplex channel.

For Ethernet, this is not a problem due to stations can quickly arbitrate for the ability to send their frames.

However, the extension of the Ethernet MAC algorithm to gigabit data rates does strain the ability to efficiently operate in this mode.

When the arbitration time (equal to the round-trip delay, in the worst-case) approaches or exceeds the time to transmit a typical frame, the efficiency of the algorithm suffers.

Page 19: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

19/21Ethernet -

Limitations of Half-duplex Operation

CSMA/CD implies an intimate relationship between the minimum length of a frame (L, measured in bit-times, not absolute time) and the maximum round-trip propagation delay (2a) of the network:

L > 2a If we want to allow very long networks, we can

make the minimum frame very long. Padding needs if a station wishes to send less data than this minimum frame. Reduces the transmission efficiency.

If we want to avoid the overhead of padding, we must reduce the extent of the network so that collision can be detected in all cases.

Page 20: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

20/21Ethernet -

Limitations of Half-duplex Operation

For the original 10 Mbps Ethernet, a compromise was struck.

Minimum frame = 512 bits (64 bytes), not including the preamble and Physical Layer overhead.

Minimum data field = 46 bytes rarely imposes a significant padding overhead (IP header + TCP header = 40 bytes).

At 10 Mbps, 512 bit-times is 51.2us. Depends on the type of cable used and the network configuration, the extent of a 10 Mbps Ethernet can be on the order of from 2-3 Km.

Preamble SFD DA SA LEN Data FCS

7 1 6 6 2 46 4 bytes

Minimum Frame Length (512 bits)

Page 21: 1/21 Ethernet - IEEE 802.3 Carrier Sense Multiple Access with Collision Detection (CSMA/CD)  All rights reserved. No part of this publication and file

21/21Ethernet -

Network ExtentFor a given minimum-length frame, the

extent of a network scales inversely with data rate.

10Mbps 100 Mbps 1000 Mbps

10,000 m

1,000 m

100 m

10m

~ 2800m

~ 205m

~ 20m