[RFC] nl80211: allow Android P2P functionality

YanBo dreamfly281 at gmail.com
Thu May 16 12:17:25 EDT 2013

On Thu, May 16, 2013 at 3:42 PM, Johannes Berg
<johannes at sipsolutions.net> wrote:
> Hi,
>> Seems device is created success
>> p2p0     DOWN                            0x00001002
>> 00:0a:62:27:26:4d
>> wlan0    DOWN                            0x00001002
>> 00:0a:62:27:26:4c
> Looks like.
>> D/wpa_supplicant( 2431): nl80211: RFKILL status not available
>> D/wpa_supplicant( 2431): nl80211: Set mode ifindex 23 iftype 2 (STATION)
>> D/wpa_supplicant( 2431): nl80211: Failed to set interface 23 to mode
>> 2: -22 (Invalid argument)
> That seems like you didn't patch the supplicant with this patch? With
> this patch it won't try to set to mode 2 (station). Or is 23 the 'wlan0'
> interface? I doubt it though, it's in station mode and should be ok.

Good catch, I just forgot merge this patch into the wpa_supplicant,
This warning disppeared after merge the patch.
>> And the reason the the wpa_supplicant get the "failed to set
>> interface" is because the code run into  nl80211.c
>>         if (otype == NL80211_IFTYPE_P2P_DEVICE) {
>>                 if (ntype == NL80211_IFTYPE_P2P_DEVICE)
>>                         return 0;
>>                 return -EINVAL;
>>         }
>> #endif
> Yes it's not supposed to change the iftype here.
>> BTW the wlan0 will always keep in DOWN status after the p2p0 device
>> UP, and it will show
>> root at android:/data/misc/wifi # netcfg wlan0 up
>> netcfg wlan0 up
>> action 'up' failed (Device or resource busy)
>> Seems the p2p0 and wlan0 can not be UP at the same time?  I though
>> there are both virtual interface and can work in different mode at the
>> same time. anything I miss?
> That depends on your driver.
In my humble opinion, for the fullmac driver, it seems easy to handler
this case, cause they create the p2p0 and wlan0 by themselves.
but for mac80211 driver, normally we just register one physical entity
by call ieee80211_alloc_hw(), but the virtual device wlan0 and p2p0
are all created based on this, so when try to 'UP' one of them when
another has been in 'UP' status, the upper layer(cfg80211/mac80211?)
will report this device in busy status cause the physical entity has
been opened already. (CMIIW, maybe there are some special flag that I
don't know can be set to avoid such device busy block)

If above is correctly, does that mean we need create two physical
entities in driver layer by call  ieee80211_alloc_hw() twice, and one
used to create the p2p0 virtual device and another used for wlan0
(station mode) virtual device? then they will not conflict when try to
open them at the same time?


BR /Yanbo

More information about the HostAP mailing list