[PATCH] driver_nl80211: set_country fix

Igal Chernobelsky igalc at ti.com
Tue Jun 25 07:16:51 EDT 2013



On 06/25/2013 11:19 AM, Jouni Malinen wrote:
> On Sun, Jun 23, 2013 at 04:07:46PM +0300, Igal Chernobelsky wrote:
>> Regulatory domain setting may take some time.
>> Getting reg domain info immediately after reg domain setting returns
>> invalid reg domain data. Loop is added to read reg domain info back and
>> to compare set country. If read country does not match, fail to 1 sec sleep
>> and retry get/compare again.
> Please add the details from your email from today to the commit
> message.. It was not immediately clear why this message would map with
> the implementation change and especially so why this would be needed in
> the first place.
Ok, I will update.
> I don't really like the one second sleep (blocking everything
> wpa_supplicant/hostapd is doing) here, though. cfg80211 regulatory is
> supposed to use events to indicate when regulatory changes. Couldn't
> those be used for this, too? A blocking sleep could work fine for cases
> where there is only a single interface, but it does not behave nicely if
> there are concurrent operations, so I would rather make only the case
> that absolutely needs this to block wait (or ideally, use a callback
> from the nl80211 event handler in case the country code change needs to
> wait for the kernel to complete processing).
>
I agree with you blocking-sleep function is not appropriate solution for 
many common tasks
but for some specific cases it can be simple and robust solution,
like for system/interface initialization where it is not possible to 
continue
until system setup is completed.
Please note, the function fails to blocking/sleep only in the case when 
reg domain setting is still
not finished and this use case usually happens only once during system 
initialization.
So I would regard code simplicity and performing system initialization 
synchronously.

-- 

Best regards
Igal



More information about the HostAP mailing list