Re: [PATCH] wilc1000: Allow setting power_save before driver is initialized

From: Ajay.Kathat
Date: Thu Dec 23 2021 - 09:02:37 EST


On 16/12/21 21:00, David Mosberger-Tang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Thu, 2021-12-16 at 13:01 +0000, Ajay.Kathat@xxxxxxxxxxxxx wrote:
>> On 16/12/21 11:07, David Mosberger-Tang wrote:
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>
>>> On Wed, 2021-12-15 at 13:01 +0000, Ajay.Kathat@xxxxxxxxxxxxx wrote:
>>>> On 13/12/21 02:50, David Mosberger-Tang wrote:
>>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>>
>>>>> Unfortunately, this patch doesn't seem to be sufficient. From what I
>>>>> can tell, if power-save mode is turned on before a station is
>>>>> associated with an access-point, there is no actual power savings. If
>>>>> I issue the command after the station is associated, it works perfectly
>>>>> fine.
>>>>>
>>>>> Ajay, does this make sense to you?
>>>> <snip>
>>>> Power-save mode is allowed to be enabled irrespective of station
>>>> association state. Before association, the power consumption should be
>>>> less with PSM enabled compared to PSM disabled. The WLAN automatic power
>>>> save delivery gets enabled after the association with AP.
>>>>
>>>> To check the power measurement before association, test without
>>>> wpa_supplicant.
>>>>
>>>>
>>>> Steps:
>>>> - load the module
>>>> - ifconfig wlan0 up
>>>> - iw dev wlan0 set power_save off (check the pwr measurement after PS
>>>> mode disabled)
>>>> - iw dev wlan0 set power_save on (check the pwr measurement after PS
>>>> mode enable)
>>> It appears wpa_supplicant consistently renders PSM ineffective:
>>>
>>> (current draw, 1 min avg):
>>> ------------------------------ --------------------------
>>> - base case (no module loaded): 16.8 mA
>>> - module loaded & PSM on : 16.8 mA
>>> - wpa_supplicant started : 19.6 mA
>>> - PSM on : 19.6 mA (no change)
>>> - PSM off : 19.6 mA (no change)
>>> - PSM on : 15.4 mA
>> From the above data, it looks like there is no difference with or without PSM
>> in your setup. I am not sure if the values are captured correctly. Did you use
>> power measurement ports in WILC extension for the current measurements.
> Oh, no, not at all! There is a nice power savings when PSM actually takes hold.
> Current drops from 19.6mA to 15.4mA as shown by the last two lines.
>
> This is average current draw at 120V for the entire board, as my board is not
> set up to measure chip current draw alone.
>
>>> What's strange is when I try this sequence a couple of times in a row,
>>> the device gets into a state where after starting wpa_supplicant, no
>>> amount of PSM on/off commands will get it to enter power-savings mode
>>> any more. When in that state, only removing wilc1000-spi.ko and adding
>>> it back gets it out of that state. A power-cycle does not. Very
>>> confusing.
>> Btw, I did a quick test to verify current measurement with PS mode off/on and observed numbers like below
>>
>> Tested by making the interface up(ifconfig wlan0 up) then issued 'iw' command to enable/disable PS mode.
>>
>> (current draw)
>> ------------------------------------------------------
>> - PSM off : 75.5 mA
>> - PSM on : 1.28 mA
>>
>>
>> I have verified for SPI module with the setup mentioned in link[1] and used power debugger[2]
>>
>> 1. https://ww1.microchip.com/downloads/en/Appnotes/ATWILC1000-Power-Measurement-for-Wi-Fi-Link-Controller-00002797A.pdf
>> 2. https://www.microchip.com/en-us/development-tool/ATPOWERDEBUGGER
> Sure, I assume your measurements are at 3.3V for the chip alone.
>
> But the question is: what happens once you start wpa_supplicant?


I verified with wpa_supplicant and it seems the power save mode is
working fine. Tested multiple times with wpa_supplicant running. I
didn't observe any issue in entering or exiting the power-save mode with
wpa_supplicant.

Try to verify without wpa_supplicant in your setup to observe if we are
seeing this same results in that case.

With wpa_supplicant, the current consumption is less when PS mode is
enabled but it would be more compared to without wpa_supplicant. Because
wpa_supplicant may have to perform continuous scan till association. And
after association, the device has to wake up periodically to receive the
beacon and broadcast packets when PS mode is enabled.

Please refer to the
"ATWILC1000-Power-Measurement-for-Wi-Fi-Link-Controller" document
section 4.4 which contains details about the power save scenario when
connected with AP.

Regards,
Ajay