Outline
- Error Detection
- Theory
- CRC
- Internet checksum
- Network Adapters
- Architecture
- Device Drivers
Error Detection
- bit errors
- random change in value of a bit
- causes:
- thermal noise
- timing
- marginal (failing) equipment/connectors
- temperature or power levels
- characterized by Bit Error Rate (BER)
- burst errors:
- setting a sequence of bits to one or zero, or
flipping a sequence of bits
- causes:
- electrical interference
- sudden service interruption ("backhoe")
- characterized by burst length, burst rate
Error detection
- strategy: include additional information with what you send so
receiver can check integrity
- "code distance": how many bits in a packet must I flip in order
to get an erroneous valid packet
- effectiveness: how many bits errors/packet can be flipped without
escaping detection
- if an erroneous packet is detected, can try to reconstruct original
data (error correction) or discard packet (retransmission)
- parity bit detects all odd bit errors: 1, 3, ...
- internet checksum
- CRC
Error correction
- strategy: include additional information with what you send so
if there are any errors, receiver can reconstruct data
- error correction often implies error detection
- XOR: send N packets followed by one packet that has the
XOR of all preceding packets. If only one of the N packets is
corrupted, we can reconstruct it from the other N-1 packets, plus
the XOR
- triple-redundancy: send each packet 3 times, use majority voting
to reconstruct original packet
- CRC
- used when retransmission is impractical (high latency links)
or impossible (storage systems)
Checksum
- 16-bit Internet checksum used:
- over IP header,
- over TCP (mandatory) and UDP (optional) header, pseudo-header, data
- in other Internet protocols, e.g. ICMP
- RFC 1071 (http://www.cis.ohio-state.edu/htbin/rfc/rfc1071.html).
- 1's complement sum of all pairs of bytes (padded
with a zero byte if needed)
- on receipt, the sum must be all 1s
- detects all single-bit errors
- detects most burst errors
- does not detect 16-bit reorderings
2's complement arithmetic
- "Normal" binary addition is 2's complement arithmetic:
the negation of a number is the complement of the
number, plus one
- example: negation of 0011 is 1101
- 2's complement has exactly one representation for the value zero
1's complement arithmetic
- In 1's complement arithmetic, the negation of a number is the
complement of the number.
- example: negation of 0011 is 1100
- 2's complement has exactly one representation for the value zero
- 1's complement has two representations for the value zero:
all zeros and all ones
- 1's complement 16-bit sum is commutative, associative,
and byte-order independent.
Implementing 1's complement addition
- computer addition is generally 2's complement
- implementation: when the addition of two numbers generates a
carry (in 2's complement arithmetic), simply add the carry back in
| 2's | (10's) | 1's | (10's) |
|
1100 + | -4 + | 1100 + | -3 + |
|
0101 = | 5 = | 0101 = | 5 = |
|
1 0001 | 1(17) | 0010 | 2
|
- Using a 32-bit value to compute the 16-bit checksum, the carries can
be accumulated, then added in at the end.
In-class exercise
- compute the 16-bit checksum of the following 8 bytes of
data (given in hex):
12 34 56 78 8a bc de f0
Network devices
- NIC (network interface card)
- Physical Layer
- move bytes from the host to the network and from the network to the host
- architecture: controller, bus interface, network interface
Bus Interface
- move bytes from the host to the adapter and
from the adapter to the host
- very simple for programmed I/O
- more complex for DMA
- complexity:
Network Interface
- move bits from the adapter to the network and
from the network to the adapter
- convert bits to bytes
- synchronize with sender or receiver
- complexity:
- media access control (MAC) protocol
- synchronization with sender/receiver
- high speed device
- buffering
Network Device Controller
- very simple computer
- often programmable
- interrupt the host
- interpret commands in the control register
- set the status bits
- may do other functions such as computing the CRC, managing internal
buffers
Device Drivers
- the operating system component that communicates with a device
- does input, output, and management
- lower half is executed at interrupt time:
- does the actual I/O and management
- signals the upper half
- upper half is executed at system call time:
- requests I/O or management functions from lower half
- usually does resource management
- may cause device to interrupt, so lower half is executed
- communication often by shared state, so synchronization is essential