Layer 2 - Datalink

Responsible for moving data along the network.  Topology doesn't matter... not responsible for plotting the data's route.  Instead it handles sending data from one node to another in one hop.

OSI specs specify 8 functions:

Line Control

Controls how data is sent accross one line to avoid collisions.

Limited scenerios:

  • Two way simultaneous point-to-point.  Two nodes.  Duplex Link.  No need for control.
  • Two way simultaneous multi-point.  More than two nodes.  Half-duplex.  Need to control who takes turn when.
  • Two way alternate point-to-point.  Token passing elmiinations collisions, but is expensive and complicated.
  • Two way alternate multi-point.  Polls secondary stations.  Primary waits.  If all have nothing to say, primary transmits.  Next transmitter becomes primary.  Generates lots of overhead; slow.

Frame Syncronization

Responsible for syncing data with respect for time.

PDU - Protocol Data Unit: the fragment of data in a transmission, aka a frame.

Also responsible for when each PDU begins and ends.

Determines whether they actually arrive or if they arrive out of sequence.

Two ways to syncronize:

  • Character oriented or asyncronous syncronization.  "A thing of the past".  Deals character-by-character as opposed to frame-by-frame.  Start bit sent.  Character sent.  Stop bit sent.  Slow and not very efficient.
  • Syncronous frame syncronization.  One pattern signifies idle line.  Continously transmitted.  When a frame needs to be transmitted, SYN characters are sent. Frame is sent.  SYN is sent again.  Idle pattern resumes.  Most procotols use this.

Data Delimiting

Separation of overhead from meaningful traffic.

Three ways of delimiting:

  • Character oriented.  A certain character is designated as a delimiter.  After it is the field, and the character again.  Creates overhead.
  • Byte count.  Fields are of a fixed length.  No delimiter characters.  Places load on receiving end.
  • Bit oriented.  Combines both of the above.  Data portion is variable length.  Start bit comes before frame, then fields are fixed length.  Then data comes after.  Then a fixed length footer.  Allows for flexible lengths of data.

Transparency

Every layer should not care what the layers above and below it are doing in order to carry out it's functionality.

Bit stuffing: We define an unlikey sequence of bits that represents headers or footers for a layer's data.  If other bits outside or inside of these headers/footers match possible sequences, they have extra predetermined bits added to them in order to make them not match.  Of course this is made to be reversable so the original data can be recovered.

Error Detection and Recovery

Noise one source of errors.  Some frames will be ruined.

  • They will disappear.
  • They will arrive altered.
  • They will arrive out of sequence.

Datalink must be at least able to identify these conditions.  Correcting them is not as vital.

As technology advances, connections become more reliable and this functionality becomes less vital, as the need for this is outweighed by the need to make Datalink lightweight.

CRC: Cyclic Redundancy Check, algorythm commonly used.

Checksum of the frame is calculated on the starting end and placed in the footer or header.  Receiver also generates the checksum.  Only if they match is the frame accepted.

Forward Error Correction: Equivilent of a RAID frame.  Put redundant data inside a frame, allowing the receiver to recalculate the contents of the frame even if it has been damaged.  Lessens need for retransmission.  Works quite well, but adds redundant data, not efficient.  Only a little more efficient than retransmitting when an error occurs.  Is useful when lag times are high and noise/errors are high, and immediate reception of frame intact is needed.

You can stop after transmission and wait for acknoledgement.  If none is received we can retransmit.  However this is slow.

Pipeline: Transmit frames without waiting.  Receive acknoledgements as they come.  Retransmit for frames that were not acknoledged, as well as frames that come after it.  So limit them to a number of frames per pipeline.  Also sometimes called "Go back and".

Flow Control

Controls how much data can be transmitted in one frame.

Keeps a buffer for data. Once it overflows:

  • Overflow discarded.
  • Tell tramsitter to stop.

Higher link quality, bigger buffers. 

Addressing

Uses GUIDs to identify nodes.

MAC address: Media Access Control

Connection Establishment and Release

Manages logical/virtual connections once physical connections are established.

PPP

Point to point. Implementation of Datalink layer to handle transmissions between two points in one hop.  Handles Link Control, Authentication Operations, Network Layer Operations.  No Error Detection (relegated to higher layers).