Title: Hardware Building Blocks
1Hardware Building Blocks
2Nodes
- Assume general-purpose (programmable) computers
- e.g., workstations. Sometimes replaced with
special-purpose hardware. - Finite memory (implies limited buffer space)
- Connects to network via a network adaptor
- Fast processor, slow memory
3Links
- Sometimes you install your own
- Sometimes leased from the phone company
STSSynchronous Transport SignalOCOptical
carrier
4Other Media
- Never underestimate the bandwidth of a station
wagon full of magnetic tapes - Cable Modems
- Terrestrial Microwave - comparable to coax
- Satellite Microwave
- Geosynchronous orbit (22,356 miles)
- Latency 300msec
- Radio - low bandwidth- cellular radio
5Low Earth Orbit Satellites (LEOS)
- 100 miles, non-stationary
- Traffic is passed between satellites
- Access from anywhere on earth.
- 40 to 400 satellites
- Cellular antenna
6Shannons Law
- CBlog(1S/N)
- Cachievable bandwidth
- Bbandwidth of the line (frequency)
- Saverage signal power
- Naverage noise power
- Signal to noise ratio S/N typical 1000
- For B3000Hz, C30Kbps max given signal to noise
ratio to home
7Encoding
8Overview
- Problem Encode the binary data that the source
node wants to send to the destination node into
the signal that propagates over the media - The media is analog and generally induces errors
9Signalling
Signal
Node
Node
Adaptor
Adaptor
Bits
10Synchronization Tasks
- Bit Synchronization (physical layer)
- character/word synchronization
- frame synchronization (data link layer)
11Data Communication
- Asynchronous (RS-232 serial lines)
- old and simple
- provides bit and character synchronization
- optional parity error detection
- Synchronous transmission
- More efficient for large blocks
- bit synchronous with clock transmitted
- Character or bit oriented
12Non-Return to Zero (NRZ)
0 0 1 0 1 1 1 1 0 1 0 0
0 0 1 0
Bits
NRZ
- Problem Consecutive 1s or 0s
- Low signal (0) may be interpreted as no signal
- High signal (1) leads to baseline wander
- Unable to recover clock
13NRZI and Manchester
- Non-return to Zero Inverted (NRZI) Make a
transition from the current signal to encode a
one, and stay at the current signal to encode a
zero - solves the problem of consecutive ones.
- Manchester Transmits the XOR of the NRZ encoded
data and the clock only 50 efficient.
14Example
Manchester encoding allows the clocks to be
synchronized NRZI eliminates consecutive 1s and
baseline wander Consecutive zeros can still cause
baseline wander
Bits
0 0 1 0 1 1 1 1 0 1 0 0 0
0 1 0
NRZ
Clock
Mancester
NRZI
154B/5B
- Problem consecutive zeros
- Idea Every 4 bits of data is encoded in a 5-bit
code, with the 5-bit codes selected to have no
more than one leading 0 and no more than two
trailing 0 (i.e., never get more than three
consecutive 0s). - Resulting 5-bit codes are then transmitted using
the NRZI encoding. Achieves 80 efficiency. - We already dealt with consecutive 1s with NRZI
164B/5B
- At most one zero on each end
- data
- 1111 1000 0011 1101
- 4B/5B
- 11101 10010 10101 11011
- NRZI
- 0 10110 11100 11001 01101
17Framing
18Overview
- Problem Breaking sequence of bits into a frame
- Must determine first and last bit of the frame
- Typically implemented by network adapter
- Adapter fetches (deposits) frames out of (into)
host memory
19Four Approaches
- Clock Based
- fixed length frames, high reliability required
- Sentinels
- Special character to delineate frames, replace
character in data stream - Character Count
- Frame length at certain position in frame
- Physical layer invalid codes
- requires physical layer redundancy
20Byte-Oriented Protocols
- Sentinel Approach
- BISYNC (Binary Synchronous Communication)
- IMP-IMP (Interface Message Processor)
- Problem ETX character might appear in the data
portion of the frame. - Solution Escape the ETX character with a DLE
character in BISYNC escape the DLE character
with a DLE character in IMP-IMP.
8
8
8
8
8
16
SYN
SYN
STX
ETX
SOH
Header
Body
CRC
DLEData-link-escape
8
8
8
8
128
8
8
16
DLE
SYN
SYN
CRC
DLE
Header
STX
Body
ETX
21- Byte Counting Approach (DDCMP)
- Problem Count field is corrupted (framing
error). - Solution Catch when CRC fails.
22Bit-Oriented Protocols
- HDLC High-Level Data Link Control (also SDLC and
PPP) - Delineate frame with a special bit-sequence
01111110
23- Bit Stuffing
- Sender any time five consecutive 1s have been
transmitted from the body of the message, insert
a 0. - Receiver should five consecutive 1s arrive, look
at next bit(s) - if next bit is a 0 remove it
- if next bits are 10 end-of-frame marker
- if next bits are 11 error
24Bit stuffing Example
- Original Data
- 001111111000011111100
- Bit Stuffed
- 00111110110000111110100
- Receiver
- 001111101100001111101001111110
End of Frame
25Clock-Based Framing
- SONET Synchronous Optical Network
- ITU standard for transmission over fiber
- STS-1 (51.84 Mbps)
26- Byte-interleaved multiplexing
- Each frame is ????s long.
27Error Detection
28Cyclic Redundancy Check
- Add k bits of redundant data to an n-bit message.
- Represent n-bit message as an n-1 degree
polynomial e.g., MSG10011010 corresponds to
M(x) x7 x4 x3 x1. - Let k be the degree of some divisor polynomial
C(x) e.g., C(x) x3 x2 1.
29CRC
- Transmit polynomial P(x) that is evenly divisible
by C(x), and receive polynomial P(x) E(x)
E(x)0 implies no errors. - Recipient divides (P(x) E(x)) by C(x) the
remainder will be zero in only two cases E(x)
was zero (i.e. there was no error), or E(x) is
exactly divisible by C(x). Choose C(x) to make
second case extremely rare.
30Mod 2 Arithmetic review
1111 1010 0101
11001 x 101
11001 11001
1111101
31- Sender
- multiply M(x) by xk for our example, we get
- x10 x7 x6 x4 (10011010000)
- divide result by C(x) (1101)
- Send 10011010000 - 101 10011010101, since this
must be exactly divisible by C(x)
11111001 10011010000 Message 1101 1001
1101 1000 1101 1011 1101
1100 1101 1000
1101 101 Remainder
Generator 1101
32- Want to ensure that C(x) does not divide evenly
into polynomial E(x). - All single-bit errors, as long as the xk and x0
terms have non-zero coefficients. - All double-bit errors, as long as C(x) has a
factor with at least three terms. - Any odd number of errors, as long as C(x)
contains the factor (x 1). - Any burst error (i.e sequence of consecutive
errored bits) for which the length of the burst
is less than k bits. - Most burst errors of larger than k bits can also
be detected.
33- Common polynomials for C(x)
CRC CRC-8 CRC-10 CRC-12 CRC-16 CRC-CCITT CRC-32
C(x) x8x2x11 x10x9x5x4x11 x12x11x3x2x1
1 x16x15x21 x16x12x51 x32x26x23x22x16x
12x11x10 x8x7x5x4x2x1
34Even Parity
Actually consists of using x1 polynomial Given
message 0111, multiply by x to get 01110 Now
divide by x111 11 01110 11
0010 11
1remainder Message 01110101111 even parity
0101
35Two-Dimensional Parity
36Internet Checksum Algorithm
- Idea view message as a sequence of 16-bit
integers. - Add these integers together using 16-bit ones
- complement arithmetic, and then take the ones
- complement of the result. That 16-bit number is
the checksum.
37- u_short
- cksum(u_short buf, int count)
-
- register u_long sum 0
- while (count--)
-
- sum buf
- if (sum 0xFFFF0000)
-
- / carry occurred, so wrap around /
- sum 0xFFFF
- sum
-
-
- return (sum 0xFFFF)
38Checksum Example
- Message 0xe123 0x2045, count2
- sum 0xE123
- sum 0x2045 0x10168
- the carry can be at most one, so mask the high
bits and add one - sum 0x016810x0169
- return sum0xFE96
- sent message 0xe123 0x2045 0xFE96
- on receive sum0x01690xFE960xFFFF
- return sum0 if there were no errors
39Reliable Transmission
40Overview
- Recover from Corrupt Frames
- Error Correction Codes (ECC) also called Forward
Error Correction (FEC) - Acknowledgements and Timeouts also called
Automatic Repeat reQuest (ARQ)
41(No Transcript)
42Stop-and-Wait
- Problem Keeping the pipe full.
- Example 1.5Mbps link x 45ms RTT 67.5Kb (8KB).
Assuming frame size of 1KB, stop-and-wait uses
about one-eighth of the link's capacity. Want the
sender to be able to transmit up to 8 frames
before having to wait for an ACK.
43Receiver
Sender
Frame 0
Ack0
Frame 1
Time
Ack 1
Frame 0
Ack 0
44Sliding Window
- Idea Allow sender to transmit multiple frames
before receiving an ACK, thereby keeping the pipe
full. - There is an upper limit on the number of
outstanding (un-ACKed) frames allowed.
45Sender
Receiver
.
.
Time
46- Sender
- Assign sequence number to each frame (SeqNum)
- Maintain three state variables
- send window size (SWS)
- last acknowledgment received (LAR)
- last frame sent (LFS)
- Maintain invariant LFS - LAR 1 lt SWS
- When ACK arrives, advance LAR, thereby opening
window - Buffer up to SWS frames
ltSWS
LAR
LFS
47Receiver
- Maintain three state variables
- receive window size (RWS)
- last frame acceptable (LFA)
- next frame expected (NFE)
- Maintain invariant LFA - NFE 1 lt RWS
ltRWS
NFE
LFA
48Cumulative Acks
- Frame SeqNum arrives
- if NFE lt SeqNum lt LFA ----gt accept
- if SeqNum lt NFE or SeqNum gt LFA ----gt discarded
- Send cumulative ACK
- Variations
- Selective Acknowledgements (SAKS)
- Negative Acknowledgements (NAKS)
49Cumulative Acks
- Assume NFE5, RWS4, LFA9
- Frames can arrive out of order
- Assume frames 6 and 7 arrive
- They cant be acked because 5 hasnt arrived
- When frame 5 arrives, all three frames will be
acknowledged - Could NAK 5 to indicate it needs to be resent
- Could selectively ack 6 and 7
50Sequence Number Space
- SeqNum field is finite sequence numbers wrap
around - Sequence number space must be larger than number
of outstanding frames - SWS lt MaxSeqNum-1 is not sufficient
- suppose 3-bit SeqNum field (0..7)
- SWSRWS7
- sender transmit frames 0..6
51Sequence Number
- arrive successfully, but ACKs lost
- sender retransmits 0..6
- receiver expecting 7,0..5, but receives second
incarnation of old 0..5 - SWS lt (MaxSeqNum1)/2 is correct rule
- Intuitively, SeqNum slides between two halves
of sequence number space
52Concurrent Logical Channels
- Multiplex several logical channels over a single
point-to-point link run stop-and-wait on each
logical channel. - Maintain three bits of state for each channel
- boolean saying whether the channel is currently
busy - sequence number for frames sent on this logical
channel - next sequence number to expect on this logical
channel - ARPANET supported eight logical channels over
each ground link (16 over each satellite link).
53Implementation
typedef struct header Swpport sport /
source / Swpport dport / dest /
u_short ulen / length / SwpSeqno SeqNum
/ sequence of this frame/ SwpSeqno AckNum
/ Ack of received frames / u_char
flags / flag bits / SWPhdr
From ASP
54State
typedef struct / Sender side state
/ SwpSeqno LAR / seqno of last ack received
/ SwpSeqno LFS / seqno of last frame sent
/ Semaphone sendWindowNotFull SwpHdr hdr /
pre-initialized header / struct txq_slot
Event timeout / event associated with
send-timeout / Sessn lls / session to resend
message on / Msg msg txqSWS SwpSeqno
NFE / Seqno of next frame expected / struct
rxq_slot int received / is msg valid?
/ Msg msg rxqRWS SwpState
55Concurrent Logical Channels
- Header for each frame included a 3-bit channel
number and a 1-bit sequence number, for a total
of 4 bits same number of bits as the sliding
window protocol requires to support up to eight
outstanding frames on the link. - Separates reliability from flow control and frame
order.
56Ethernet
57Overview
- History
- Developed by Xerox PARC in mid-1970s
- Roots in Aloha packet-radio network
- Standardized by Xerox, DEC, and Intel in 1978
- Similar to IEEE 802.3 standard
- Manchester encoding, synchronous transmission
58CSMA/CD
- CSMA/CD
- carrier sense
- multiple access
- collision detection
- Bandwidth 10Mbps and 100Mbps
- Problem Distributed algorithm that provides fair
access to a shared medium
59Physical Properties
- Classical Ethernet (thick-net)
- maximum segment of 500m
- transceiver taps at least 2.5m apart
- connect multiple segments with repeaters
- no more than 2 repeaters between any pair of
nodes (1500m total) - maximum of 1024 hosts
- also called 10Base5
60Alternative technologies
- 10Base2 (thin-net) 200m daisy-chain
configuration - 10BaseT (twisted-pair) 100m star configuration
61Frame Format
- Addresses
- Unique, 48-bit unicast address assigned to each
adaptor - Example 802be4b12
- Broadcast all 1s
- Multicast first bit is 1
62Addressing
- Adaptor receives all frames it accepts (passes
to host) - Frames addressed to its own unicast address
- Frames addressed to the broadcast address
- Frames addressed to any multicast address it has
been programmed to accept - All frames when in promiscuous mode
63Transmitter Algorithm
- If line is idle
- Send immediately
- Upper bound message size of 1500 bytes
- Must wait 51?s between back-to-back frames
- If line is busy
- Wait until idle and transmit immediately
- Called 1-persistent (special case of
p-persistent)
64Collision
- jam for 512 bits, then stop transmitting frame
- minimum frame is 64 bytes (header 46 bytes of
data) - delay and try again
- 1st time uniformly distributed between 0 and
51.2?s - 2nd time uniformly distributed between 0 and
102.4?s - 3rd time uniformly distributed between 0 and
204.8?s - give up after several tries (usually 16)
- exponential backoff
65Collisions
66Minimum Packet Size
- Packet must fill whole pipe in order to block
other hosts from starting transmission - The packet must continue until a collision is
detected from a transmission starting just before
the original frame arrived - The minimum packet size is twice the number of
bits needed to fill the pipe
67Example
- 10 base T- 100 meter length, 10Mbps
- At Speed of Light 2108m/s
68Experiences
- Observe in Practice
- 10-200 hosts (not 1024)
- Length shorter than 1500m (RTT closer to 5? than
51?) - Packet length is bimodal
- High-level flow control and host performance
limit load - Recommendations
- Do not overload (30 utilization is about max)
- Implement controllers correctly
- Use large packets
- Get the rest of the system right (broadcast,
retransmission)
69FDDI
70Overview
- Token Ring Networks
- PRONET 10Mbps and 80 Mbps rings
- IBM 4Mbps token ring
- 16Mbps IEEE 802.5/token ring
- 100Mbps Fiber Distributed Data Interface (FDDI)
71Basic Idea
- frames flow in one direction upstream to
downstream - special bit pattern (token) rotates around ring
- must capture token before transmitting
- release token after done transmitting
- immediate release
- delayed release
- remove your frame when it comes back around
- stations get round-robin service
72Physical Properties of FDDI
- Dual Ring Configuration
- Single and Dual Attachment Stations
73Characteristics
- Each station imposes a delay (e.g., 50ns)
- Maximum of 500 stations
- Upper limit of 100km (200km of fiber)
- Uses 4B/5B encoding
- Can be implemented over copper (CDDI)
74Timed Token Algorithm
- Token Holding Time (THT) upper limit on how long
a station can hold the token. - Token Rotation Time (TRT) how long it takes the
token to traverse the ring. - TRT lt ActiveNodes x THT RingLatency
- Target Token Rotation Time (TTRT) agreed-upon
upper bound on TRT.
75- Algorithm
- each node measures TRT between successive
arrivals of the token - if measured TRT gt TTRT, then token is late so
don't send data - if measured TRT lt TTRT, then token is early so OK
to send data - define two classes of traffic
- synchronous data can always send
- asynchronous data can send only if token is
early - worse case 2xTTRT between seeing token
- not possible to have back-to-back rotations that
take 2xTTRT time
76Token Maintenance
- Lost Token
- no token when initializing ring
- bit error corrupts token pattern
- node holding token crashes
- Generating a Token (and agreeing on TTRT)
- execute when join ring or suspect a failure
- each node sends a special claim frame that
includes the node's bid for the TTRT - when receive claim frame, update bid and forward
- if your claim frame makes it all the way around
the ring - your bid was the lowest
- everyone knows TTRT
- you insert new token
77- Monitoring for a Valid Token
- should see valid transmission (frame or token)
periodically - maximum gap ring latency max frame lt 2.5ms
- set timer at 2.5ms and send claim frame if it
fires
78Frame Format
- Control Field
- 1st bit asynchronous (0) versus synchronous (1)
data - 2nd bit 16-bit (0) versus 48-bit (1) addresses
- last 6 bits demux key (includes reserved
patterns for token and claim frame) - Status Field
- from receiver back to sender
- error in frame
- recognized address
- accepted frame (flow control)
79Network Adaptors
80Overview
- Typically where data link functionality is
implemented - Framing
- Error Detection
- Media Access Control (MAC)
Host I/O Bus
81Host Perspective
- Control Status Register (CSR)
- Available at some memory address
- CPU can read and write
- CPU instructs Adaptor (e.g., transmit)
- Adaptor informs CPU (e.g., receive error)
- Example
- LE_RINT 0x0400 Received packet Interrupt (RC)
- LE_TINT 0x0200 Transmitted packet Interrupt
(RC) - LE_IDON 0x0100 Initialization Done (RC)
- LE_IENA 0x0040 Interrupt Enable (RW)
- LE_INIT 0x0001 Initialize (RW1)
82Moving Frames Between Host and Adaptor
- Direct Memory Access (DMA)
- Programmed I/O (PIO)
Memory Buffers
Buffer Descriptor List
CPU
Memory
Memory
Adaptor
83Device Driver
- Interrupt Handler
- interrupt_handler()
-
- disable_interrupts()
- / some error occurred /
- if (csr LE_ERR)
-
- print_and_clear_error()
-
- / transmit interrupt /
- if (csr LE_TINT)
-
- csr LE_TINT LE_INEA
- semSignal(xmit_queue)
-
- / receive interrupt /
- if (csr LE_RINT)
-
- receive_interrupt()
84- Transmit Routine
- transmit(Msg msg)
-
- char src, dst
- Context c
- int len
- semWait(xmit_queue)
- semWait(mutex)
- disable_interrupts()
- dst next_xmit_buf()
- msgWalkInit(c, msg)
- while ((src msgWalk(c, len)) ! 0)
- copy_data_to_lance(src, dst, len)
- msgWalkDone(c)
- enable_interrupts()
- semSignal(mutex)
- return
85- Receive Interrupt Routine
- receive_interrupt()
-
- Msg msg, new_msg
- char buf
- while (rdl next_rcv_desc())
-
- / create process to handle this message /
- msg rdl-gtmsg
- process_create(ethDemux, msg)
- / msg eventually freed in ethDemux /
- / now allocate a replacement /
- buf msgConstructAllocate(new_msg, MTU)
- rdl-gtmsg new_msg
- rdl-gtbuf buf
- install_rcv_desc(rdl)
-