le dung csmaca

Upload: duong-hai

Post on 06-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Le Dung Csmaca

    1/31

    CarrierSenseMultipleAccesswithCollisionAvoidance

  • 8/2/2019 Le Dung Csmaca

    2/31

  • 8/2/2019 Le Dung Csmaca

    3/31

    CSMA/CDvs.CSMA/CA(1)

    CSMA/CD(CollisionDetection)istheMACmethodusedinawiredLAN(Ethernet).WiredLANstationscan(whereaswirelessstationscannot)detectcollisions.

    BasicCSMA/CDoperation:

    1) Waitforfreemedium2) Transmitframe3)

    Ifcollision,stoptransmissionimmediately

    4) Retransmitafterrandomtime(backoff)

    CSMA/CDrule:Backoffaftercollision

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    4/31

    CSMA/CDvs.CSMA/CA(2)

    CSMA/CA(CollisionAvoidance)istheMACmethodusedinawirelessLAN.Wirelessstationscannotdetectcollisions(i.e.thewholepacketswillbe

    transmittedanyway).BasicCSMA/CAoperation:

    1) Waitforfreemedium2) Waitarandomtime(backoff)3) Transmitframe4) Ifcollision,thestationsdonotnoticeit5) Collision=>erroneousframe=>noACKreturned

    CSMA/CArule:Backoffbeforecollision

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    5/31

    Basicwirelessmediumaccess

    .HereisInfrastructurebasicserviceset(BSS).

    .AllstationsandAPhaveequalpriority

    transmissionindownlink(fromtheAP)anduplink(fromastation)issimilar.

    CSMA:Onepacketatatime

    AP

    wiredLAN

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    6/31

    Wirelessmediumaccess(1)

    DIFS SIFS

    ACK

    (B=>A)

    Transmittedframe(A=>B)

    Whenaframeisreceivedwithoutbiterrors,thereceivingstation(B)sendsanAcknowledgement(ACK)framebacktothetransmitting

    station(A).

    Ifthereceivedframeiserroneous,noACKwillbesent

    CyclicRedundancyCheck(CRC)isusedforerrordetection

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    7/31

    Wirelessmediumaccess(2)

    DIFS SIFS DIFS

    ACK

    (B=>A)

    Transmittedframe(A=>B)

    Duringthetransmissionsequence(Frame+SIFS+ACK)themedium(radiochannel)isreserved.Thenextframecanbetransmittedat

    earliestafterthenextDIFSperiod.

    Nextframe(fromanystation)

    Earliestallowedtransmissiontimeofnextframe

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    8/31

    Wirelessmediumaccess(3)

    DIFS SIFS DIFS

    ACK

    (B=>A)

    Transmittedframe(A=>B)

    Therearetwomechanismsforreservingthechannel:

    PhysicalcarriersensingVirtualcarriersensingusingtheNetworkAllocationVector(NAV).

    Nextframe

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    9/31

  • 8/2/2019 Le Dung Csmaca

    10/31

    Wirelessmediumaccess(5)

    ThetwomostimportantinterframespacingtimesareSIFSandDIFS:

    SIFS(ShortInterframeSpace)=10s(16s)

    DIFS(DCFInterframeSpace)=50s(34s)

    Whentwostationstrytoaccessthemediumatthesametime,theonethathastowaitforthetimeSIFSwinsovertheonethathastowaitforthetimeDIFS.Inotherwords,SIFShashigherpriorityoverDIFS.

    802.11b 802.11g

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    11/31

    Wirelessmediumaccess(6)

    DIFS SIFS DIFS

    ACK

    Transmittedframe

    NAV

    Virtualcarriersensing

    ItmeansthataNAVvalueissetinallstationsthatwereabletoreceiveatransmittedframeandwereabletoreadtheNAVvalueinthisframe.

    NAVvalueisgivenhere Nextframe

    TransmissionisnotallowedaslongasNAVisnon-zero

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    12/31

    Wirelessmediumaccess(7)

    DIFS SIFS

    Transmittedframe

    NAV

    VirtualcarriersensingusingNAVisimportantinsituationswherethechannelshouldbereservedforalongertime(RTS/CTSusage,

    fragmentation,etc.).

    ACKACK

    Longtransaction

    DIFS

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    13/31

    NAVvalueiscarriedinMACheader

    MPDU(MACProtocolDataUnit)

    MACpayloadAddr1 Addr2 Addr3 Addr4(optional)

    FCS

    Durationfield:15bitscontaintheNAVvalueinnumberofmicroseconds.Thelast(sixteenth)bitiszero.

    AllstationsmustmonitortheheadersofallframestheyreceiveandstoretheNAVvalueinacounter.Thecounterdecrementsin

    stepsofonemicrosecond.Whenthecounterreacheszero,thechannelisavailableagain.

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    14/31

    Wirelessmediumaccess(8)

    DIFS SIFS t>DIFS

    ACK

    (B=>A)

    Transmittedframe(A=>B)

    Whenastationwantstosendaframeandthechannelhasbeenidleforatime>DIFS(countedfromthemomentthestationfirstprobed

    thechannel)=>cansendimmediately.

    Nextframe(fromanystation)

    ChannelwasidleatleastDIFSseconds

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    15/31

    Wirelessmediumaccess(9)

    DIFS SIFS DIFS

    ACK

    (B=>A)

    Transmittedframe(A=>B)

    Whenastationwantstosendaframeandthechannelisbusy=>thestationmustwaitabackofftimebeforeitisallowedtotransmitthe

    frame.Reason?Nexttwoslides

    Nextframe

    Channelwasbusywhenstationwantedtosendframe

    Backoff

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    16/31

    Nobackoff=>collisioniscertain

    Supposethatseveralstations(BandCinthefigure)arewaitingtoaccessthewirelessmedium.

    Whenthechannelbecomesidle,thesestationsstartsendingtheirpacketsatthesametime=>collision!

    StationA

    StationB

    StationC

    DIFS

    Collision!

    ACK

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    17/31

    Backoff=>collisionprobabilityisreduced

    Contendingstationsgeneraterandombackoffvaluesbn.Backoffcounterscountdownwards,startingfrombn.Whenacounterreacheszero,thestationisallowedtosenditsframe.Allothercountersstopcountinguntilthechannelbecomesidleagain.

    StationA

    StationB

    StationC

    DIFS

    bnislarge

    bnissmall

    Backoff

    RemainingbackofftimeACK

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    18/31

    Contentionwindow(CW)for802.11b

    Iftransmissionofaframewasunsuccessfulandtheframeisallowedtoberetransmitted,beforeeachretransmissiontheContentionWindow(CW)fromwhichbnischosenisincreased.

    DIFS CW=25-1=31slots(slot=20

    s)Initialattempt

    DIFS

    CW=26-1=63slots1stretransm.

    DIFS CW=2

    10

    -1=1023slots5th(andfurther)retransmissions

    :

    CW 802.11b

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    19/31

    Contentionwindow(CW)for802.11g

    Inthecaseof802.11goperation,theinitialCWlengthis15slots.Theslotdurationis9s.Thebackoffoperationof802.11gissubstantiallyfasterthanthatof802.11b.

    DIFS CW=24-1=15slots(slot=9

    s)Initialattempt

    DIFS

    CW=25-1=31slots1stretransm.

    DIFS CW=2

    10

    -1=1023slots6th(andfurther)retransmissions

    :

    CW 802.11g

    1.BasicCSMA/CAoperation

  • 8/2/2019 Le Dung Csmaca

    20/31

  • 8/2/2019 Le Dung Csmaca

    21/31

  • 8/2/2019 Le Dung Csmaca

    22/31

    Wirelessmediumaccess(2)

    StationA

    StationB

    StationC

    StationD

    DIFS DIFS

    Defer

    3)StationDalsowishestosendapacket

    4)However,stationBiswinnerandstartssendingpacket3

    4

    ACK

    2.Wirelessmediumaccessexample

  • 8/2/2019 Le Dung Csmaca

    23/31

    Wirelessmediumaccess(3)

    StationA

    StationB

    StationC

    StationD

    DIFS

    5)StationDstartssendingpacket.Nowthereisnocompetition.

    DIFS

    5

    ACK

    2.Wirelessmediumaccessexample

  • 8/2/2019 Le Dung Csmaca

    24/31

  • 8/2/2019 Le Dung Csmaca

    25/31

    3.UsageofRTS&CTS

    TheRTS/CTS(Request/ClearToSend)schemeisusedasacountermeasureagainstthehiddennodeproblem:

    AP

    WS1

    WS2

    Hiddennodeproblem:WS1andWS2canheartheAPbutnoteachother

    =>

    IfWS1sendsapacket,WS2doesnotnoticethis(andviceversa)=>collision!

  • 8/2/2019 Le Dung Csmaca

    26/31

    ReservationofmediumusingNAV

    RTS

    SIFS

    DIFS

    NAV=CTS+Data+ACK+3xSIFS

    CTS

    Dataframe

    ACK

    SIFS

    SIFS

    WS1

    AP

    NAV=Data+ACK+3xSIFS

    NAVinRTS

    NAVinCTS

    3.UsageofRTS&CTS

  • 8/2/2019 Le Dung Csmaca

    27/31

    DangerofcollisiononlyduringRTS

    WS2doesnotheartheRTSframe(andassociatedNAV),butcanheartheCTSframe(andassociatedNAV).

    RTS

    NAV=CTS+Data+ACK+3xSIFS

    CTSDataframe

    ACKWS1AP

    NAV=Data+ACK+3xSIFS

    NAVinRTS

    NAVinCTS

    Dangerofcollision

    3.UsageofRTS&CTS

  • 8/2/2019 Le Dung Csmaca

    28/31

    AdvantageofRTS&CTS(1)

    UsageofRTS/CTSoffersanadvantageifthedataframeisverylongcomparedtotheRTSframe:

    RTSCTS

    DataframeACK

    WS1AP

    Shortinterval:collisionnotlikely

    Dataframe

    ACK

    WS1

    AP

    Longinterval:collisionlikely

    (RTS/CTSnotused)

    (RTS/CTSused)

    3.UsageofRTS&CTS

  • 8/2/2019 Le Dung Csmaca

    29/31

    AdvantageofRTS&CTS(2)

    Alongcollisiondangerinterval(previousslide)shouldbeavoidedforthefollowingreasons:

    Largerprobabilityofcollision

    Greaterwasteofcapacityifacollisionoccursandtheframehastoberetransmitted.

    Athresholdparameter(dot11RTSThreshold)canbesetinthewirelessstation.FramesshorterthanthisvaluewillbetransmittedwithoutusingRTS/CTS.

    3.UsageofRTS&CTS

  • 8/2/2019 Le Dung Csmaca

    30/31

    4.Fragmentation

    FragmentationmakesuseoftheRTS/CTSschemeandtheNAV

    mechanism:

    RTS

    SIFS

    DIFS

    RTS

    CTS

    Frag0

    ACK0

    SIFS

    SIFS

    WS1

    AP

    CTS

    NAVinWS

    NAVinAP

    Frag1

    ACK1

    SIFS

    SIFS

    Frag0

    ACK0

    Athresholdparameter(dot11FragmentationThreshold)canbesetinthewirelessstation.Frameslongerthanthisvaluewillbetransmittedusingfragmentation.

  • 8/2/2019 Le Dung Csmaca

    31/31

    Sequencecontrolfield

    MPDU(MACProtocolDataUnit)

    MACpayloadAddr1 Addr2 Addr3 Addr4(optional)

    FCS

    Fragmentnumber(for

    identifyingfragments)

    Framesequencenumber(for

    identifyingframes)

    4.Fragmentation