Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29028734
  • 博文数量: 101
  • 博客积分: 4011
  • 博客等级: 上校
  • 技术积分: 1150
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-18 10:37
个人简介

落魄青年,挨踢民工,已经转行

文章分类

全部博文(101)

文章存档

2008年(47)

2007年(54)

分类: 系统运维

2007-12-02 19:55:54

CSMA/CD

There are certain phases of media access:

Carrier Sense

Stations that want to transmit frames must perform a carrier sense check. If the media is idle for about two bit times the station is allowed to start transmission.

In case the media isn't idle because a frame is passing, transmission must not start immediately if the passing frame is just over. There must be an inter frame gap of 9,6 µs.

Multiple Access

Multiple stations may perform carrier sense and access the media at the same time: multiple access = multiple transmissions.

The physical signals of these frames will be corrupted by collisions; the frames cannot be received properly any more. Ethernet transceivers of transmitting stations will detect this collision.

Collision Detection

A transmitting transceiver always compare the bits being sent to those that can be received simultanously. If incoming/outgoing signals are different, this may (or may not) be caused by a collision.

If a collision condition had been detected, the transceiver will do as follows:

1. Jam Sequence

The transceiver will stop transmission of the current frame; this runt frame will be extended by a so-called 'jam sequence' which is a 32-bit extension. This jam sequence is a dummy checksum with an always invalid FCS value.

Collisions can be detected by transceivers because of invalid voltage levels. But this can only be done by transceivers that are connected to the same cable segment (local collisions); this cannot be done by stations behind repeaters (remote collisions): If a collision passed a repeater, voltage levels are valid again because the transmitting repeater port is unable to repeat the bad voltage levels. As a result, invalid voltage levels can only be detected on the local segment where the collision had happened. If a transceiver detects (a) 'frame short' and (b) 'checksum error' this will prove that the frame was corrupted by a collision; these frames are called runts.

This way of collision detection depends on some specific conventions:

2. Truncated Binary Exponential Backoff

Each transceiver has a collision counter. If a collision is detected during frame transmission, the collision counter is incremented by one. (If the transceiver is in listening mode, collisions won't cause the counter to be incremented.) Each time a transmission was successfull (without collisions), the collision counter is set to zero. If the collision counter is incremented to 16, the transceiver will send a SQE signal to the controller indicating 'carrier lost'. This mechanism results in the autopartitioning feature of repeaters; reconnection means that the port's transceiver indicates 'carrier available' again.

After each collision the transceiver has to wait for certain time before retransmission (backoff time). The backoff time is a multiple of the signal's maximum round trip delay (max. RDT 51,2 µs); the absolute value is randomized:

n = value of collision counter / restricted to value of 10.

backoff time = 51,2 µs * 2 0..(n-1)

The collision counter may exceed a value of 10, the variable n may not (truncated binary exponential backoff).

This will cause:

A. The more collisions, the more backoff time.

B. If two stations are waiting because their frames were corrupted by collisions, a third station can transmit a frame because the media is idle.

3. Retransmission

After the backoff time had passed, the concerned transceivers will perform carrier sense again.

Round Trip Delay: 51,2 µs

The collision detection function depends on a maximum round trip delay of 51,2 µs. This means: A transceiver has to transmit as long as any collision signal may need to arrive at the sending transceiver (collision detection is done by comparing voltage levels / see above).

Therefore, Ethernet segments are restricted to certain lengths equal to a given maximum round trip delay of 51,2 µs.

1. Slot Time (25,6 µs)

After 25,6 µs the first bit of a frame has to arrive at the logical segment's end (including all repeaters / including all segments connected by repeaters). As long as the frame's header didn't arrive the segment's end, any other station between frame header and the segment's end may begin to transmit a frame (= multiple access). Collisions may only occur within the first 25,6 µs of a current transmission (slot time; collision window); this is equal to 32 byte times / 256 bit times.

If a collision happens only a few microseconds (1 bit = 0,1 µs) before end of slot time (few microsends less than 25,6 µs), the collision (caused by station B) will take another 25,6 µs until it arrives at the transceiver that transmits the first frame (station A). Station A has still to send bits (of the same frame) at this time in order to ensure that its collision detection function will detect the collision by comparing input/output voltage levels. This means that any transmission has to last for at least 2 * 2,56 µs = 51,2 µs (RTD time) / 2 * 32 byte times = 64 byte times.

3. Mindest-Paket-Länge (64 bytes)

This results in a minimum frame length of 64 bytes. This minimum frame length is related to a RTD of 51,2 µs.

4. Maximale Kabel-Längen

Because Ethernet's RTD of 51,2 µs must not be exceeded, cable lengths are related to Ethernet's slot time of 25,6 µs. Because physical transmission speed depends on the type of cable, the use of different cables results in different length restrictions.

Anyway, signal delay caused by repeaters must be taken into account as well.

5. Collision Domain / Time Domain

All cable segments within the 51,2 µs time domain build a collision domain: Collisions may only occur within these cable segments; and: any collision within this time domain can be detected by any transceiver.

6. Late Kollisions

In case of illegal cable length / exceeded slot time collisions cannot not be detected in time (= within 51,2 µs = within the first 64 bytes) by station A (see above) if station B resides at an illegal (additional) cable segment not covered by the slot time (not part of the collision domain).

These collisions are called late collisions because from station A's point of view they arrive too late (after the 64th byte has been sent) respectively they occured after more than 25,6 µs related to start of transmission by station A.

Protocol analyzers can detect late collisions while generating test frames longer than 64 bytes. Late collisions indicate illegal cable length.

Between Ethernet frames there must be an inter frame gap of at least 9,6 µs (96 bit times).

Ethernet repeaters only accept incoming frames in case of valid IFG time. Frames arriving within the IFG time are discarded.

These frames have to be retransmitted by the source station. Because the source adapter cannot detect that the frame has been discarded, retransmission has to be initiated by higher layer protocols providing data flow control (connection-oriented protocols). Because these protocols (LLC type 2, SPX, TCP, and others) expect frame acknowledgment (to be sent by the peer station) within certain time, retransmission will only be initiated in case that the acknowledgment timer expired. These ACK timers do not count in microsends rather than probably in seconds (especially under WAN conditions); the loss of frames cannot be detected as soon as in case of collisions. This will cause significant less performance.

If an Ethernet adapter transmits frames with an IFG less than 9,6 µs to a destination station beyond at least one repeater, many frames may be discarded by repeaters. This will cause many retransmissions resulting in bandwidth problems.

Normal Ethernet adapters cannot detect inter frame gaps being too short; therefore, protocol analyzers can only detect invalid IFGs using special measurement hardware.

阅读(2257) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~