data link control (llc sublayer)cs353/lectures/lecture_16... · go-back-n arq: (sender window = n...

28
(A sublayer of the Data Link Control Data Link Layer ) Major functions: A) Framing: Dividing a packet from the Network layer into well defined frames for transmission over the Physical layer; and grouping them back into packets from the Physical layer to the Network layer. B) Regulating the rate of source-destination frame exchange (flow-control), guaranteeing error free delivery of frames to their target destination. Flow and Error control protocols(S/W): A) Framing Physical Layer Synchronized bit stream. Framing process: logical distinguishable DL_PDUs called “frame”. Frames are variable or fixed length.

Upload: others

Post on 24-Oct-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

  • (A sublayer of the Data Link Control

    Data Link Layer

    )

    Major functions:

    A) Framing:Dividing a packet from the Network layer into well defined frames for transmission over the Physical layer; and grouping them back into packets from the Physical layer to the Network layer.

    B) Regulating the rate of source-destination frame

    exchange (flow-control), guaranteeing error free delivery of frames to their target destination.

    Flow and Error control protocols(S/W):

    A)

    Framing Physical Layer Synchronized bit stream. Framing process: logical distinguishable DL_PDUs called “frame”.

    Frames are variable or fixed length.

  • Variable Size Frames:

    i)

    Character-Oriented Protocols:

    • “Flags” are used as frames separators. • If the 8_bit flag is part of the data (very likely!) we

    have a problem! • Solution use “ESC” (escape character), predefined

    pattern before any similar data character to the flag/ESC (but not the flag itself).

    • The receiver will remove any encountered ESC and

    consider the next byte as data.

  • ii) Bit oriented Protocols:

    • The data section is a sequence of bits (not chars). • We use 8-bit 01111110 as a “flag” delimiter to define

    “start” and “end” of a frame. • Problem? Yes, if 01111110 is part of the data! • Solution: Bit Stuffing—In the data, If a “0” is

    followed by a sequence of 11111 ( 5 ones) , an extra 0 is “stuffed”: 0111110101 or 011111001011, and will be removed by the Destination.

    • Hence, the receiver detecting 01111110 will be sure it is a “flag”. receiver.

  • B)

    Flow and Error Control

    I) • A mechanism that regulates traffic speed in order

    not to allow a fast sender to swamp a slow receiver.

    Flow Control:

    • Receiver’s buffer and info about its reception capabilities are used to in the process.

    • If the receiver buffer is “full” sender should refrain from Tx (transmission).

    II) • The receiver should be able to inform the sender of a

    frame about the followings:

    Error Control: (noisy channels)

    1) frame is “lost” (no arrival) 2) frame is” damaged”. (arrived but an error is

    detected). • Then coordinate ReTx of such frame by the sender.

    • “Error Control” protocols that maintain the above are

    called Automatic Repeat reQuest (ARQ).

  • Protocols

    • Software that handles the unidirectional “data” and control (ACK/NAC) frames, source to destination.

    • ACK/NACK might be “piggybacked” over reverse data frames traffics, saving extra control frames.

    A) i) Noiseless Channels: Simplest Protocol:

    Noise free, infinite buffer No error or flow control.

  • Sender:

    Make a DL frame

    Get frame (); (From Network Layer)

    TX the DL frame

    yes

    No

    Start

    Frame to send ?

  • Receiver:

    Yes

    No

    Get Frame () from physical L.

    Extract Network PDU packet

    Sent it to Network Layer

    DL frame arrival?

    Start

  • ii) Stop_&_Wait: flow control only.

    (Control flow) noiseless, but limited buffer

    • The simplest protocol might allow the sender to flood the receiver! (Why?—there is no feedback from the receiver to the sender about available receiving buffer)

    • The S&W provides a flow control via ACK.

  • Sender waits for ACK before sending next frame flow control (only).

    Sender:

    Yes

    Start

    Frame to send?

    Make a DL frame and send it

    Yes

    No ACK arrived?

    No

    Get frame from NL

    Wait for ACK which indicates that the receiver is ready to receive the next frame Flow Control

  • Receiver: PL frame arrives Get it Extract NL’s PDU and forward it to the NL Send ACK back to the sender: received the previous one and ready to get next frame Loop back to get the next Physical Layer frame

    B) Noisy Channels: (still limited size buffer)

    (possible errors in frames)

    i) Stop_&_Wait ARQ:

    • Noisy channel & limited buffer fixed window of size of 1 at both ends, sender & receiver.

    • “Erroneous” frames are discarded by the receiver. • A modulo-2 sequence number in frames and ACK’s for

    accurate detection of arrival/losses. • Hence, for lost/erroneous frames the receiver will not

    send ACK back to sender, which times out and ReTx (retransmit) the frame again.

    • ACK sequence number indicates the next expected frame

    number to be received. • Upon transmitting a frame:

    1) A timer2) A copy of the transmitted

    will start until its ACK arrives, or times out. frame is kept in a buffer

    until its good ACK

    arrives.

  • At sender: S&W ARQ

    Yes

    No

    Yes

    Yes Yes

    No

    No

    Seq #: Sn = 0

    NL Frame to send?

    1. Get the frame and buffer a copy. 2. Transmit the frame. 3. Start a timer. 4. Increment fame sequence number

    counter (Modulo-2).

    Time Out? ACK Sn arrival?

    • reset timer. • purge the buffered

    frame.

    • restart timer • reTx the

    buffered frame.

    Start

    Bad CRC?

    No

  • S&W ARQ

    At receiver:

    Just ignore the frame by not sending any ACK.

    Send the new ACK to get the next expected frame Rn

    Send the old ACK since it is lost and you are getting a duplicate frame

    No

    Bad

    1. Extract Network PDU and send it up to NL.

    2. Rn = (Rn + 1) mod 2

    Send ACK Rn back to the sender

    Frame Seq # == Rn?

    CRC ?

    Data frame arrived ???

    Yes

    Good

    Yes

    No

    Start

    Rn = 0

  • • Since the previous S&W ARQ protocol sends

    only one frame then waits for (a round trip delay) its ACK, wasting channel BW; it is very inefficient

    .

  • Duplicate ACK’s, when? If we time out early. Here is the scenario that justifies numbering both the frame & ACK.

    New.F

    New.F

    Dup.ACK

    Late.ACK

    F

    Dup.F

    Time out

    Source Destination

    Time Time

  • Go-Back-N ARQ: (sender window = n >1) • Noisy & limited buffer fixed receiver

    window of 1.

    • It is a solution

    to the inefficacy of S&W-ARQ via “pipelining” N frames in the round trip waiting time of the frame (window = N).

    • Instead of sending one frame and waiting for its ACK, we keep sending multiple (pipelined) frames for some window size (n), not wasting the BW.

    The above sliding window (fig b) is after receiving ACK3.

  • Sliding Window: A range of sequence #’s used by sender and receiver.

    1) Send Window (SW):

    If m = 4, SW seq#’s range is 0 to 14 (15 frames)

    size = (2m – 1) where m is the number of bits assigned for the sequence number.

    Max size send window = 2m – 1 = 15 frames (fixed) (There is one unused sequence number, WHY?)

    Go back to Sf Upon time out (ACK of frame did not arrive), Sn moves back N frames to where Sender window Sf

    pointer points; max value of N = (2m – 1) frames (the entire window).

    Sliding:

    (Sn − Sf)

  • • All damaged frames (or with sequence numbers higher than

    Rn) will be ignored

    (quietly) by the receiver, depending on the sender timeout and reTx process.

    • For arriving “duplicate” frames (already been received and buffered—hence before where Rn is currently pointing), the receiver will send back the last

    ACK (of the expected sequence number to arrive), assuming that such previously transmitted (Txed) frames were lost.

    • The receiver does not have to send individual frame ACK, it can send “cumulative” ACKn indicating the arrival of all frames up to the (n-1)th frame, and the expectation of the nth frame.

    • One timer is only maintained for the frame at the lower edge of

    send window since it is the first to time out, hence forcing the reTx of all outstanding (unACKed) frames at the sender buffer.

  • Go-Back-N ARQ:

  • An example of lost ACK:

    • Losing ACK is not very critical (as losing data frame), since the

    next ACK will suffice all previous un-received ones by the source.

  • • For example, losing ACK2&3 will be covered by ACK4 arrival, indicating the arrival of all frames before frame F4.

    • “Request• “

    ” indicates sending the frame pointed to by Sf. Arrival” indicates the arrival of ACK back to the sender.

    An example of lost Frame:

  • • Upon timeout, the sender resends all ACK’s pending frames F1-to-F3. • When the receiver gets good frames with sequence numbers

    higher than Rn (e.g., F2 & F3), it will (wastefully) ignore them.

    At sender:GBN

    ACK

    N

    Y

    NL frame ready T.O.

    Sw = 2m -1 = 15 of m = 4 bits Sf = fn = 0

    Event Arrived ?

    Full window?

    • Get Network packet. • Mack LLC Frame # Sn . • Save a copy of the frame and Tx it. • Increment Sn and start T.O. timer.

    reStart the timer

    reTx all frames starting from where Sf points until just before Sn i.e, go back (Sn – Sf) frames. Keep Sf value as is and step through via the window with Sn ! Move Sf forward, ACKing all frames with “sn” between Sf and (n-1), purging them

    from the buffer.

    Stop the Timers for ACKed frames

    Get ACKn

    Good CRC ?

    Expected ACK n?

    Y

    Y

    N

    N

  • Selective Repeat ARQ

    • Go.Back_N a receiver worries about ONLY one expected frame at time, and ignores all others unexpected healthy ones. This is not very efficient since it leads to dropping many valid frames arriving out of the one cell receiver window (size =1).

    • In selective repeat, the receiver window increased to 2 m-1

    (instead of 1) and valid frames that arrive within such windows are buffered, even when out of order.

    • Each transmitted frame has its own timeout (TO) counter.

    1) Frame arrival actions:

    Outside2)

    the receiving window ignore. Inside the receiving window, but not the expected send NAKRn (i.e., starting of the receiver window-- Rn) indicating request for reTx the specific frame with seq. # Rn.

    3)

    Only one NAK per receiving window position, defining the starting position of the window. Inside receive window, and is expected

    send ACK with the sequence # of next expected frame in the window, i.e., Rn+1;

    ,

    if such frame will fill the receiving window send the entire window to the network layer.

  • If such frame will complete a contiguous set of frames, then send them to the NL, and advance the receiving window pointer. Sender Win.Wg:

    Receiver Window WR:

    • With the arrival of expected frame, Rn moves to the right sending frames, orderly, to the Net Layer.

  • • Out-of-order frames, but still within the receive window will not be ignored; they will be placed in the appropriate corresponding places at the buffer.

    • In Selective Repeat ARQ, the size of the sender and receiver

    window must be at most one-half of 2m (i.e., 2m-1). (WHY?) See next paragraph • Special case, when more than (Sw/2) ACKs are lost (e.g., ACK1

    and ACK2), and the first frame timer times out and retransmitted (frame0), the receiver will accept it as part of its receive widow, whereas it has been accepted before and sent to the NL (i.e., it is a duplicate).

  • At the Sender

    N

    NAK

    ACK

    Good

    T.O.

    Y

    RTS

    ACK/NAK

    Sw = 2 m-1 Sf = Sn =0

    Event?

    • Get Net PDU & make LLC frame Sn and store & Tx it.

    • Advance Sn by 1 & start its timer

    • For all frames between Sf and (ACK# -1):

    1)Purge from buffer, and 2)Stop their timers. • Advance Sf to ACK#

    Send window not full?

    Sf

  • At the Receiver Rn = 0

    N

    - Sent F(Rn)to NL. - Purge F(Rn) - ACKneeded = True. - Advance Rn by 1

    ACK needed ?

    Is Rn slot marked ?

    Send ACK(Rn) ACKNeeded = false. NAK Set = false.

    Y

    Y

    N

    N

    Y

    Y

    Y

    NAKsent = false ACK Needed = false Mark all buffer slots false i.e, not ACKed yet

    Get frame

    CRC

    Send NAK (Rn) NAKsent = True

    Send NAK (Rn) NAKsent = True

    Store frame in its slot(seq #) Mark its corresponding slot used

    Frame arrival?

    NAK is sent for it before?

    Fseq# Rn && NOT(NAKsent) ?

    Frame Seq # in Wr && Slot (seq#) NOT Marked?

    -Sent ACK(Rn) -Rn = Rn + 1

    Y

    Y

    N

    N

    N

    Bad

    Good

  • • In case of a contiguous set of frames arrived, i.e., marked starting from Rn (e.g., 0,1, 2) they will be delivered up to the NL, advancing Rn to the next expected to arrive frame ( e.g., 3 has not yet arrived).

    Delivery of data in Selective Repeat ARQ

    --------------------------------------------------------------------------------------------------------------------------

    An Example where Frame 1 is lost