802.11基本传输方式-信道竞争机制及QoS的实现机制

802.11基本传输方式-信道竞争机制及QoS的实现机制

                                                                

 

本文主要介绍无线WIFI 802.11B/G中定义的基本传输方式,先看如下几个问题, 

802.11如何对无线传输信道进行侦听?如何进行冲突的避免? (处理和解决冲突问题) 

802.11 Sta如何认为当前链路是被占用还是空闲的呢? 

Channel获取的竞争机制是什么?

为什么802.11使用的是CSMA/CA,而不使用已经非常成熟的CSMA/CD?   

802.11QoS如何区分和保证不同数据的优优先级等;

支持WMM的AP如何在WMM和非WMM共存的环境中争取报文的优先转发?

 

一、 802.11无线介质访问控制的基本方式  (CSMA/CA)

        无线介质资源的访问控制方式可以主要分为DCF和PCF两种,DCF是基于竞争机制,多个分布式无线节点抢同一资源,类似于802.3中Ethernet Hub的CSMA/CD传输机制类似;PCF使用无竞争模式,所有的带宽分配(传输时间片)都由一个全局的Point控制;  目前绝大多数无线设备使用DCF模式,也是本文的重点。 

1.1 基本概念

CSMA 

Carrier Sense Multiple Access. A "listen before talk" scheme used to mediate the access to a transmission resource. All stations are allowed to access the resource (multiple access) but are required to make sure the resource is not in use before transmitting (carrier sense).

 

CSMA/CA  

Carrier Sense Multiple Access with Collision Avoidance. A CSMA method that tries to avoid simultaneous access (collsions) by deferring access to the medium. 

 

DCF (distributed coordination function )

The DCF is the basis of the standard CSMA/CA access mechanism. Like Ethernet, it first checks to see that the radio link is clear before transmitting. To avoid collisions, stations use a random backoff after each frame, with the first transmitter seizing the channel. In some circumstances, the DCF may use the CTS/RTS clearing technique to further reduce the possibility of collisions.

 

PCF (point coordination function)

The point coordination function provides contention-free services. Special stations called point coordinators are used to ensure that the medium is provided without contention. Point coordinators reside in access points, so the PCF is restricted to infrastructure networks. To gain priority over standard contention-based services, the PCF allows stations to transmit frames after a shorter interval. 

 

NAV (Network Allocation Vector )

The NAV is a timer that indicates the amount of time the medium will be reserved, in microseconds. Stations set the NAV to the time for which they expect to use the medium, including any frames necessary to complete the current operation. Other stations count down from the NAV to 0. When the NAV is nonzero, the virtual carrier-sensing function indicates that the medium is busy; when the NAV reaches 0, the virtual carrier-sensing function indicates that the medium is idle. NAV使用Carrier Sense中模拟的那部分,可用来监听当前链路是否被其他设备预留,预留时间为多少,或者链路为空闲状态。

 

1.2 无线媒介争抢过程 : Carrier Sense 载波侦听 / Collision Avoidance 冲突避免 / Backoff Procedure

        DCF使用CSMA/CA,那为什么802.11使用的是CSMA/CA,而不使用已经非常成熟的CSMA/CD?   (因为CSMA/CD应用于有线中,冲突域是一个完整的,即一旦有冲突发生,所有的unit都可以检测到并采取正确的行为,但是在802.11的无线环境中,由于信号覆盖问题,会出现Hidedden Station问题,Sta并不能检测到域内的所有冲突,则会导致错误,从这点上看CSMA/CD就无法应用在802.11上。)

 

我们将整个过程分成Carrier Sense和 Collision Avoidance两部分来说。 

 

1.2.1 Carrier Sense 载波侦听 

802.11的载波侦听使用了物理层和虚拟的载波侦听两种方式。 

物理链路和虚拟联络都被用来监听链路状态(Physical and NAV),只要有一个定义为busy,则线路状态为busy,只有两个状态都为idle,CS才认为线路为Idle状态。 

Physical carrier-sensing functions are provided by the physical layer in question and depend on the medium and modulation used.

Network Allocation Vector 被用来作为802.11的虚拟载波侦听机制。 NAV可以理解为一个Timer定时器用来定义当前链路还需要被占用多久,每一个监听的Sta都使用该NAV定时器,数据通信时,占领信道的Sta会通过各种报文中的duration字段来告知其他Sta我还需要用多久,而未获取信道资源的Sta通过对比收到包中的duration值来更新自身NAV的值(只有收到包的duration值大于本身的NAV timer才被更新), 当该值为0时才认为当前链路为空闲状态。在空闲状态后需要等待 xIFS+Backoff Time才可以获取发送报文的权力,具体描述如下。 

 

1.2.2 Collision Avoidance 冲突避免 / Backoff Procedure 

802.11的冲突避免使用了IFS和Backoff Algorithm两种机制共同实现。

1.2.2.1 IFS (Interframe Spacing)

包之间的间隔为IFS,可以理解为从检测到链路空闲到可能发送报文(进入Contention Window)的间隔(Sta从检测到链路为空闲状态开始到发送报文的时间为 (IFS+BackupTime(From Contenting Window))。 802.11定义了5种不同的包间隔,通过定义不同的时间长度来区分不同环境下报文的优先等级,如SIFS主要用于各种管理报文,如ack,rts/cts等,使之较数据报文有更有可能获取发送报文的权力;

 

a) SIFS short interframe space

The SIFS is used for the highest-priority transmissions, such as RTS/CTS frames and positive acknowledgments. High-priority transmissions can begin once the SIFS has elapsed. Once these high-priority transmissions begin, the medium becomes busy, so frames transmitted after the SIFS has elapsed have priority over frames that can be transmitted only after longer intervals.

b) PIFS PCF interframe space

The PIFS is used by the PCF during contention-free operation. Stations with data to transmit in the contention-free period can transmit after the PIFS has elapsed and preempt any contention-based traffic. When SIFS passes without any activity and PIFS time is elapsed, the BS may transmit a beacon frame. PIFS比SIFS值小的目的在于当DCF和PCF共存的环境下,PCF有高的发包优先级。

c) DIFS DCF interframe space

The DIFS is the minimum medium idle time for contention-based services. Stations may have immediate access to the medium if it has been free for a period longer than the DIFS.

d) AIFS arbitration interframe space (used by the QoS facility)

Defined by 802.11e,使用于无线QoS。The AIFS shall be used by QoS STAs to transmit all data frames, all management frames, and the following control frames: PS-Poll, RTS, CTS , BlockAckReq, and BlockAck . A STA using the EDCA shall obtain a TXOP for an AC if the STA’s CS mechanism determines that the medium is idle at the AIFS[AC] slot boundary , after a correctly received frame, and the backoff time for that AC has expired.

e) EIFS extended interframe space

It's used only by a station that has just received a bad or unknown frame to report the bad frame. The idea of giving this event the lowest priority is the fact that the receiver may have no idea of what is going on. It should wait a substantial time to avoid interfering with an ongoing dialog between two stations.

 

根据802.11-2007种的定义, xIFS均由SIFS和Slot组合而成 ,具体相互对应的关系, 

The PIFS and DIFS are derived by the following equations, as illustrated in Figure 9-12.

PIFS = a  SIFSTime + a SlotTime

DIFS = a  SIFSTime + 2 × a SlotTime

EIFS = a  SIFSTime + DIFS + ACKTxTime

AIFS[AC] = AIFSN[AC] × a SlotTime + a SIFSTime. (For No-AP, AIFSN>=2; For AP, AIFSN>=1)

 

1.2.2.2 Backoff Time (Contention Window)

 

        如上图所示,一个运行DCF的无线Sta要获得发送报文的权力需要在链路检测为Idle状态后等待 “DIFS+Backoff Time” 时间,如果在这段时间内未检测到链路被占用才能发送报文, 如果在Backoff Time阶段发送信道被占用,则会将Backoff Time - Defered Time(刚才等待的时间)= 新的Backoff Time再进行下一轮的竞争; Backoff timer只有在检测到当前链路位空闲时才减数,当timer=0时,链路仍为空闲状态,则认为获取信道资源,立即发送报文。若当Backoff Time=0时报文仍未被成功发送,则翻倍CW并重新计算Backoff time。 (具体算法如下)

Backoff Time = Random() × aSlotTime 

其中Radom = [0,CW] , CW属于[CWmin,CWmax] 。

初始时CW=CWmin,则Backoff time为 [0,CWmin]中的随机值乘上SlotTime,并使用该Backoff Time进行竞争, 若Backoff Time到0时报文仍未发送,则CW值翻倍,并重新计算Backoff Time,以此类推,若发送不成功则CW值继续指数增长(x2),待CW=CWmax后,一直保持CW=CWmax,只有等到重传次数到达极限后(分为短包/长包重传最大次数,分别计数),放弃发送此包并复位CW为CWmin;若报文发送成功,则CW初始为CWmin。

SlotTime 由PHY的速率决定,高速率时Slot值小,低速率时Slot值大; 

 

1.2.2.3 综合情况请看下图完整例子:

 

 

二、802.11 QoS 

        之前介绍的DCF中,各种数据报文之间是没有等级之分的。然而在实现中需要语音视频和普通数据报文需要区分,802.11在现有的DCF的基础上通过802.11e来对其QoS架构进行了定义。 

        QoS的目的在于区分不同报文的优先级并保证高优先级的报文被优先转发。  在802.11中DCF时,数据报文发送是通过CSMA/CA来竞争获取资源转发的,Sta在检测到链路空闲状态>= DFIS+BackoffTime时才有机会发送报文。所以从架构上802.11e也通过以下几部分定义来完成对报文的优先级区分及分类转发。 

1、将数据报文分成不同类型的AC(access categories 0-4), 分为BestEffort,Background,Video,Voice四部分; 

 

2、虚拟化报文发送队列,将一个物理的Sta分成8个虚拟的队列(0-7),每个队列可以作为一个独立Sta进行资源的竞争。(当然同一物理系统内部之间的竞争可以由虚拟的队列调度技术实现。) 原运行DCF的Sta只有一个发包队列;  

 

3、 定义AIFS,原来DCF使用值固定的DIFS。给不同优先级的队列定义值不相同的AIFS,即给不同优先级的队列提供有差别的等待时间来实现报文区分转发的可能性; 

 

根据IEEE802.11中的定义, AIFS的值如下换算,通过定义不同级别AC的AIFSN来区分得出不同AIFS值。 

AIFS[AC] = AIFSN[AC] × a SlotTime + a SIFSTime. (For No-AP, AIFSN>=2; For AP, AIFSN>=1)

 

有标准定义公式和图示可以看出,AIFS最小值可以为PIFS或DIFS。(至于有些资料和文献上写到AIFS的最小值等于DIFS,起码是片面的,着实让我迷惑了一阵,因为如果AIFS的最小值为DIFS的话,在与DCF共存的环境中怎么能竞争的过DCF呢?这个应该能算是解释了Jinfeng的疑问。)  如下图经典的AP的AIFSN的值为(2/1/1/1),标准定义默认No-AP Sta的AIFSN的值为(7/3/2/2)。下面是我们产品上的AP和Sta的默认参数。 

WS6603(config-wlan-ac-view)#display wmm-profile name dd  

  Client EDCA parameters:

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

         ECWmax  ECWmin  AIFSN  TXOPLimit

  AC_VO 3       2     2     47

  AC_VI   4       3       2     94

  AC_BE 10    4       3     0

  AC_BK 10      4       7     0

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

  AP EDCA parameters:

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

        ECWmax  ECWmin  AIFSN  TXOPLimit  Ack-Policy

  AC_VO 3     2      1      47         normal

  AC_VI   4       3      1      94         normal

  AC_BE 6    4       3      0          normal

  AC_BK   10     4      7      0          normal

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

 

4、不同的队列定义不同的CW值。给不同优先级的队列定义不同的CWmin和CWmax。 因为CW是计算Backoff Time非常的重要参数,通过此来分配不同优先级队列的随机等待时间来实现报文优先级的转发。

Backoff Time = Random * Slot; 其中Random = [0,CW], CW初始值=CWmin, CWmin=<CW<=CWmax.  

 

5、定义TXOP Limit, 来限制AC抢占无线媒介的时间长度。 

        关于信道是否空闲检测,虚拟的Carrier Sense使用NAV来标示当前链路忙闲状态,Sta运行独立的NAVTimer,并通过监控收到报文中的Duration字段来更新NAV的值(具体机制请看1.2.2.1载波侦听)。

TXOP Limit的度量单位是时间,通常上层表现为一个十进制的值,需要乘上一个32us。 

The default values for TXOP limit are expressed in milliseconds and are multiples of 32 μs. 

{

Duration = 

If TXOP=0, then Data+ACK+ 2SIFS;

elseif TXOP!=0, then SIFS+TXOP;

}

 

#Reference

1, 802.11-2007.pdf

2, O'Reilly.802.11.Wireless.Networks.The.Definitive.Guide.2nd.edition.Apr.2005.chm

3, Dynamic Contention Window for Quality of Service in IEEE 802.11 Networks.pdf

4, IEEE 802.11e Wireless LAN for Quality of Service.pdf

 

 

 

#Reference

1, 802.11-2007.pdf

2, O'Reilly.802.11.Wireless.Networks.The.Definitive.Guide.2nd.edition.Apr.2005.chm

3, Dynamic Contention Window for Quality of Service in IEEE 802.11 Networks.pdf

4, IEEE 802.11e Wireless LAN for Quality of Service.pdf

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值