Title: 15-441 - Kesden
115-441 - Kesden
2ISO/OSI Reference Model
- Application
- Presentation
- Session
- Transport
- Network
- Data Link We are here
- Physical Weve been here
3The Data Link Layer
- The physical layer was responsible for hiding the
physical properties of the media. - The network layer is responsible for moving
packets from network to network. - The link layer is responsible for getting packets
from one machine to another on a particular
network. - For our purposes, a network is a collection of
machines connected via a communications channel
such that the connection logically appears as if
it was a single wire or bus, regardless of the
actual media or configuration.
4Link Layer Design Issues
- Management of the media, generally
- Encoding
- Framing
- Error-detection/Error-correction maybe
- Flow control maybe
5Management of the Media
- In many cases, there may be limitations about who
can use the actual physical network connection
and when. - Broadcast media, such as ethernet, is the classic
example. - This issue belongs to a sublayer of the data link
layer called the Medium Access Control (MAC)
layer.
6Link Types
- Broadcast
- Senders and receivers share medium all stations
hear all transmissions - Radio
- Sometimes wired, e.g. ethernet
- Point-to-point
- Fiber, RS232, USB (upstream vs. downstream)
- Switched
- Token ring
7Address Types
- Static anointed, soft-configured
- Static anointed, more hard-wired
- Ethernet, 48 bits ????
- 24 bits per manufacturer
- 24 bits assigned by manufacturer
- Port/Position on switch
- Dynamic Anyone else use 45?
- Special addresses, e.g. designated broadcast
8Encoding
- It is often the case that the physical layer has
personality. - For example, baseband signals send 1s and 0s as
high and low voltages. - But if the voltage doesnt change for a long
time, timing tolerance becomes and issue. - Long streams of 0s or 1s could lead to miscounted
bits. - Typically, it is the link layers responsibility
to mitigate this type of physical layer property. - This is done by encoding the bits in a way that
is not subject to this type of problem.
9NRZ (Non-Return to Zero)
0
1
0
0
1
1
0
0
1
- Easy thing to do
- Hard to count 0s or 1s
- Not necessarily balanced
10Ethernet Manchester Encoding
0 rising transition 1 falling transition
0
0
1
1
- 1 transitions per bit, but twice as much
bandwidth - High-low pattern has good electrical properties
- Balanced signal no net DC voltage.
- This allows AC coupled power supply on receiver.
- If code had a DC bias, it would be lost in the
transformer - on the receiver side.
114B/5B Encoding
- Data encoded as symbols with 5 bit symbols
representing 4 bit patterns - 100Mbps data requires 125Mhz
- Each valid symbol has at least two 1s
- Guarantees transitions
- 16 data symbols
- 8 additional symbols used for control
- Idle
- Frame boundary
- FDDI is one example
12Framing
- Physical layer is typically not error-free
- Link layer must discard correct and/or replace
defective data, depending on quality of service. - Typical approach is to break streams of 1s and
0s into more managable pieces called frames - Frames typically contain data bits and error
correction or error detection bits - Depending on the protocol, defective frames may
be corrected (if possible) or discarded. - Some link layer protocols might also handle
retransmission of defective frames
13Framing, Example
Which way do we lose more?
14Example Point-To-Point Protocol (PPP), cont
Can be omitted by negotiation
1
variable
2 or 4
1
1 or 2
1
1
Flag Address Control Protocol
Payload Checksum Flag 01111110 11111111
00000011
01111110
The network layer packet
Always all 1s. All stations accept all packets
Usually as shown. Indicates unnumbered frame. Can
provide numbered frames and reliable link layer
especially useful for noisy lines
Indicates end of frame
Which network layer is above?
Indicates start of frame
15Example Point-To-Point Protocol (PPP), cont
Options agreed
ESTABLISHED
AUTHENTICATE
Authentication successful
Carrier detect
failed
NETWORK
DEAD
failed
NCP configuration
OPEN
Carrier dropped
TERMINATE
done
16Example Point-To-Point Protocol (PPP), cont
1
3
2
1
LCP Packet
To match request and reply
What type?
17LCP Packet Types
Name Direction Description
Configure-request Initiator?Responder Data has proposed options and values
Configure-ACK Initiator?Responder All proposed options and values accepted
Configure-NAK Initiator?Responder Data has rejected options
Configure-Reject Initiator?Responder Data has non-negotiable options
Terminate-Request Initiator?Responder Request to close line
Terminate-ACK Initiator?Responder OK, line is closed
Code-Reject Initiator?Responder Unknown request
Protocol-Reject Initiator?Responder Unknown protocol
Echo-request Initiator?Responder Please echo this frame (send back) (testing)
Echo-reply Initiator?Responder Here is the frame back (testing)
Discard-request Initiator?Responder Throw this frame away (testing)
18Error Correction vs. Error Detection
- Error correction is the ability to determine that
a frame contains an error and then repair the
error (without additional communication). - Error detection is the ability to detect that a
frame contains a defect, but not necessarily to
have the ability to repair it. - Error detection and error correction often
involve adding additional bits called check bits
or parity bits to the original bits of data.
19Simple Parity
- Supply extra bit to force sum to even or odd
- 1011, 1 even parity
- 1010,0 odd parity
- Old modems, ascii data
- 7 bits, character
- 1 bit, parity
- Quite weak
20Close Enough?
- Consider the following code
- 0 jump
- 1 run
- If 1 bit is in error, the message will be
incorrect and misleading - Now, consider the following code
- 00 jump
- 11 run
- Now, if only 1 bit is in error, the message wont
make sense, but we know that there is an error. - Okay, one more code
- 000 jump
- 111 run
- Now, if only 1 bit is in error, we can figure out
which one it should be. If 2 bits are in error,
we know that the codeword is defective, but dont
know which bits are wrong.
21Hamming Distance
- The Hamming Distance between two codewords is the
number of bits that one would need to change to
convert one into the other. - The (minimum) Hamming distance of a code is the
minimum Hamming Distance between any pair of
codewords within the code. - Hamming distance is important, because it gives
us a way of determining how much error detection
and how much error correction is possible for a
given code.
22Thinking about Error Detection and Correction
T
T
T
If the targets are close enough, a miss might
hit the wrong one. If they are far enough apart,
a miss is more likely to land in between. If
they are really far apart, it is most likely that
the a miss will land closer to the intended
target than any other.
23Hamming Distance and EC/ED
- Like the example on the previous slide, Hamming
distance measures how far two things (codewords)
are apart. - Remember that Hamming Distance measures the
distance between two codewords by the number of
bits that would need to change to convert one
into another. - This is a useful measure, because as long as the
number of bits in error is less than the Hamming
Distance, the error will be detected -- the
codeword will be invalid. - Similarly, if the Hamming distance between the
codewords is more than double the number of bits
in the error, the defective codeword will be
closer to the correct one than to any other.
24Hamming Distance and EC/ED
- Review
- d bit errors can be detected if the Hamming
Distance of the code is greater than d - d bit errors can be corrected if the Hamming
Distance of the code is greater than 2d
25How Many Check Bits?
- If we have a dense code with m message bits, we
will need to add some r check bits to the message
to put distance between the code words - The total number of bits in the codeword
- n m r
- If we do this, each codeword will have n illegal
codewords within 1 bit. (Flip each bit). - To be able to correct an error, we need 1 more
bit than this, (n 1) bits to make sure that
1-bit errors will fall closer to one codeword
than any other.
26Hammings Code
- Label the bits of the codeword from
left-to-right, from 1 through n. - Check bits are stored in power of two bit
positions. - Data bits are stored in other positions
- Each parity bit is used to force the sum of
itself and the bits that it checks to an even
number (or odd) - Each bit is checked by one or more parity bits.
Specifically, lets consider a bit index i. If
we rewrite in terms of powers of 2, it is checked
by those powers of two that contribute to the
addition - For example, 7 4 2 1 so bit 7 contributes
to parity bits 4, 2, and 1.
27Hammings Code (Example)
- a _ _ 1 _ 1 0 0 _ 0 0
1 - 1 2 3 4 5
6 7 8 9 10 11 - 1 checks 3, 5, 7, 9, 11
- 1 1 0 0 1 3 set parity bit on to force
even parity - 2 checks 6, 7, 10, 11
- 0 0 0 1 1 set parity bit on to force
even parity - 4 checks 5, 6, 7
- 1 0 0 1 set parity bit on to force even
parity - 8 checks 9, 10, 11
- 0 0 1 1 set parity bit on to force even
parity - a 1 1 1 1 1 0 0 1 0
0 1 - 1 2 3 4 5
6 7 8 9 10 11
28Hammings Code (Ex.), cont.
- a 1 1 1 1 1 0 1 1 0 0
1 - 1 2 3 4 5
6 7 8 9 10 11 - 1 checks 3, 5, 7, 9, 11
- 1 1 1 0 1 4 parity should be 0, but it
is 1. Count 1 - 2 checks 6, 7, 10, 11
- 0 1 0 1 2 parity bit should be 0, but
isnt. Count 2, so count is 3 - 4 checks 5, 6, 7
- 1 0 1 2 parity bit should be 0, but
isnt. Count 4, so count7 - 8 checks 9, 10, 11
- 0 0 1 1 parity bit should be 1 and is.
Dont change count. Count is still 7 - So, if only 1 bit is in error, it is bit 7.
29Hammings Code (Ex.), cont.
- a 1 1 1 1 1 0 1 0 0 0
1 - 1 2 3 4 5
6 7 8 9 10 11 - 1 checks 3, 5, 7, 9, 11
- 1 1 1 0 1 4 parity should be 0, but it
is 1. Count 1 - 2 checks 6, 7, 10, 11
- 0 1 0 1 2 parity bit should be 0, but
isnt. Count 2, so count is 3 - 4 checks 5, 6, 7
- 1 0 1 2 parity bit should be 0, but
isnt. Count 4, so count7 - 8 checks 9, 10, 11
- 0 0 1 0 parity bit should be 1 but is 0.
Count 8, so count15. - This makes no sense! More than 1 bit is in error.
We cant fix it.
30Checksums
- Checksums are based on dividing binary
polynomials, modulus 2. - Both addition and subtraction are equal to XOR in
modulus 2 arithmetic - 10011011 11110000
- 11001010 10101111
- 01010001 01011111
- This can be used to perform long division.
31Checksums, cont.
- Given a message, we will add checksum bits
- These bits will be computed by dividing the
message by a generator polynomial modulus 2. - The remainder is the checksum
- The checksum is one bit smaller than the
generator polynomial. - Good polynomials wont divide the types of errors
common in a particular channel
32Checksum, cont.
- CRC-12 x12 x11 x3 x2 x1 1
- CRC-16 x16 x15 x2 1
- CRC-CCITT x16 x12 x5 1
- These can be represented as polynomials. For
example, consider CRC-12 - 1 1 0 0 0 0 0 0 0 1 1 1 1
33Checksum, cont.
- 1 1 0 0 0 0 1 0 1 0
- 1 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 0 0
- 1 0 0 1 1
- 1 0 0 1 1
- 1 0 0 1 1
- 1 0 1 1 0
- 1 0 0 1 1
- 1 0 1 0 0
- 1 0 0 1 1
- 1 1 1 0
This remainder is the checksum.