WLAN Legacy PowerSave
作者:互联网
节电模式
节电模式是为了节省电池电源,这个机制在使用电池的设备上非常有用,节电模式可以让设备运行更长的时间,其一般的STA模式用,WLAN的节电模式有两种一种是Legacy PowerSave,另外一种比较新的模式是WMMPS,我们先讨论Legacy PowerSave,而仅仅Legacy PowerSave就有Powersave Poll 【PS-POLL】和Non-PS-Poll两种,客户端在同一个时刻只能支持一种模式,如果设备不支持WMM,则只能使用legacy PowerSave,如果设备支持WMM但是不支持WMMPS那么在设备的关联请求的WMM信息元素中会看到WME Qos对应的字段都为0,如下:
PS-PLL机制的步骤
1,一个支持PS-PLL机制的STA连接到AP在AssociationResponse后,STA发送一个power manament位为1的NULL Data帧给AP
2,AP回复Ack表示STA将进入省电模式并且AP同意STA进入省电模式,AP开始为进入省电模式的STA缓存数据
3,当AP有缓存数据时,AP会在beacon种的TIM(Traffic Indication MAP)中指示,在TIM中的Parital Virtual Bitmap字段中包含了AP缓存数据的AID
4-5-6,STA通常在ListenIntervalTime苏醒,STA检查beacon的TIM中的AID,如果发现次AID和自己对应就知道AP有给自己缓存的数据,此时STA发送PS-POLL给AP
7,AP对PS-POLL进行ACK,
8,此时STA准备好接收数据
9,AP发送数据给STA,STA检查发送的数据帧头的MoreData置位,STA明白AP还有更多的帧要发给自己
10,STA紧接着又发送一次PS-POLL获取第二帧数据,以此类推直到MoreData为0后进入省电状态
11,AP在Beacon的TIM中移除此AID,表示AP没有给STA缓存的帧了
在第10部,为什么不想第1步一样需要发送一个PowerManament为1的NULL Data给AP而直接进入省电模式呢,因为PS-POLL的PM位一直是1,如下图:
PS-POLL帧格式
PS-POLL是一种特殊的控制帧,它没有Duration表示AID,PM恒为1
由于没有Duration字段,其他的STA在监听到PS-POLL后延迟等待多长时间访问信道呢,答案是SIFS+ACK time
STA多长时间从省电模式苏醒
通常情况下,在关联请求帧里可以看到STA的省电苏醒时间(Max Listen Interval Time)单位是ms
在转包中我们可以看到此STA的苏醒时间为600秒,但这不意味STA不能在600毫秒前苏醒,在最好的情况STA 将获取缓冲区数据。 但是如果 STA 唤醒获取缓冲区数据,AP 会继续通过 Beacon 的TIM信息元素说明。 在每个 AID 的 AP 内部有一个计时器如果在计时器超时后数据还没有发送,则 AP 会丢弃该 STA 的所有缓冲区数据包并重置计时器。 这个计时器在规范中没有固定值,
Non-PS-POLL的步骤
Steps for Non-PS-POLL [Switch to Active Mode or Fast Powersave] Mechanism:
To understand it in simple way let’s take one scenario.
Assumptions:
a. One client/station is connected to AP.
b. Client supports Non-PS-POLL mechanism from legacy powersave.
Steps:
1. After Association response client sends one Null Data packet with power management bit 1 to AP.
2. AP replies with ACK.
This indicates that client is going to sleep and AP agrees on the same. This time onwards AP started buffering any data that are intended for the sleeping client.
3. When AP has buffer data, it indicates in Beacon frame.
♦ Beacon frame has TIM [Traffic Indication Map] field. Under TIM there is Partial Virtual Bitmap to indicate for which AID AP has buffer data.
♦ Multicast bit is set to 0 for unicast Data.
4. Client generally wakes up at listen interval time.
5. STA checks the beacon and if the beacon has AID of this STA, then STA knows that AP has buffer data.
So steps 1-5 are same as PS-POLL mechanism.
6. As STA supports non-pspoll mechanism. So STA sends NULL frame with PM=0 that means STA is in awake state.
7. Now AP sends all buffer data one by one without expecting any frame like PS-POLL from STA.
8. As long as More Data bit is set to 1 STA should be in awake state. Once more data bit set to 0, then STA sends NULL frame to AP indicating that STA is going to powersave mode. In case of PS-POLL no extra frame was sent to indicate AP that it goes for powersave.
9. AP removes AID from PVB in Beacon.
Sniffer check for Non-PS-POLL sequence:
Let’s see the sniffer capture to understand this.
How do we test PS-POLL or Non-PS-POLL powersave?
In generally DHCP packet exchanges will use powersave mechanism from AP side. Like, before AP sending DHCP offer, AP will indicate in Beacon for power save station and follow powersave mechanism depending on STA supports ps-poll or non-ps-poll.
We can start ping or iperf data from AP backend to STA wireless IP and see powersave mechanism in sniffer capture.
Basically, any data from AP should use powersave mechanism before sending to sleeping stations.
After legacy powersave we should know about WMMPS.
标签:PS,WLAN,STA,powersave,AP,Legacy,AID,POLL,PowerSave 来源: https://www.cnblogs.com/sudochen/p/16292297.html