2015-06-10 05:10:51

by Janusz Dziedzic

[permalink] [raw]
Subject: [RFC] ath9k: advertise p2p dev support when chanctx

Add p2p dev support when ath9k loaded with
use_chanctx=1. This will fix problem, when first
interface is an AP and next we would like to run
p2p_find. Before p2p scan failed.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
@Felix, Sujith please review. I am not sure if didn't miss some
case for NL80211_IFTYPE_P2P_DEVICE (special handling required?).

drivers/net/wireless/ath/ath9k/init.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index f8d11ef..7da1a17 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -736,13 +736,14 @@ static const struct ieee80211_iface_limit if_limits_multi[] = {
BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO) },
{ .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) },
+ { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) },
};

static const struct ieee80211_iface_combination if_comb_multi[] = {
{
.limits = if_limits_multi,
.n_limits = ARRAY_SIZE(if_limits_multi),
- .max_interfaces = 2,
+ .max_interfaces = 3,
.num_different_channels = 2,
.beacon_int_infra_match = true,
},
@@ -855,6 +856,9 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
BIT(NL80211_IFTYPE_MESH_POINT) |
BIT(NL80211_IFTYPE_WDS);

+ if (ath9k_is_chanctx_enabled())
+ hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
+
hw->wiphy->iface_combinations = if_comb;
hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
}
--
1.9.1



2015-06-15 15:47:37

by Sujith Manoharan

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

Janusz Dziedzic wrote:
> > At least the callbacks for adding/removing interfaces need
> > to be handled ?
> >
> Strange, but I didn't hit any problem yet with my simple patch.

Ok. But I am not very familiar with how p2p-device is supposed
to be used...

Sujith

2015-06-15 18:19:07

by Arend van Spriel

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

+ Jouni

On 06/15/15 17:47, Sujith Manoharan wrote:
> Janusz Dziedzic wrote:
>>> At least the callbacks for adding/removing interfaces need
>>> to be handled ?
>>>
>> Strange, but I didn't hit any problem yet with my simple patch.
>
> Ok. But I am not very familiar with how p2p-device is supposed
> to be used...

The p2p-device is designed to be used for p2p discovery and p2p action
frame exchange. It make it easier for driver and/or firmware to
determine if user-space request is p2p related or not. However, in
discussions with Jouni I got the impression that ath (or qca) firmware
and/or drivers did not need this design. Not sure if that claim is
unaffected by the "use_chanctx=1" parameter.

Regards,
Arend

> Sujith
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


2015-06-16 07:53:48

by Sujith

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

Janusz Dziedzic wrote:
> Works except case I described.
> p2p_find is combination of scan and ROC, and scan don't work when we
> have configured AP from wpa_supplicant.
> In case of adding p2p-device AP + P2P_FIND works perfectly, also AP +
> P2P_CLIENT/P2P_GO works OK when use_chanctx.
>
> Other fix I can image is change wpa_supplicant and add
> NL80211_SCAN_FLAG_AP to p2p_find, and set in ath9k driver
> wiphy->features |= NL80211_FEATURE_AP_SCAN;
>
> NL80211_FEATURE_AP_SCAN is not set when use_chanctx=1
>
> I am not sure which is better. First one required only fix in ath9k,
> second one also required changes in wpa_supplicant.

As Johannes mentioned in his email, adding p2p-device support
in ath9k is the simpler solution, without adding driver-specific
hacks to wpa_s. So this patch seems okay...

Sujith

2015-06-16 06:30:52

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

On 16 June 2015 at 03:25, Sujith Manoharan <[email protected]> wrote:
> Arend van Spriel wrote:
>> The p2p-device is designed to be used for p2p discovery and p2p action
>> frame exchange. It make it easier for driver and/or firmware to
>> determine if user-space request is p2p related or not. However, in
>> discussions with Jouni I got the impression that ath (or qca) firmware
>> and/or drivers did not need this design. Not sure if that claim is
>> unaffected by the "use_chanctx=1" parameter.
>
> Thanks for the explanation.
>
> I don't think advertising support for p2p-device is required for
> ath9k. P2P discovery works properly with the normal station/ap interface
> types and the 'use_chanctx' modparam simply enables multiple channel
> contexts.
>
Works except case I described.
p2p_find is combination of scan and ROC, and scan don't work when we
have configured AP from wpa_supplicant.
In case of adding p2p-device AP + P2P_FIND works perfectly, also AP +
P2P_CLIENT/P2P_GO works OK when use_chanctx.

Other fix I can image is change wpa_supplicant and add
NL80211_SCAN_FLAG_AP to p2p_find, and set in ath9k driver
wiphy->features |= NL80211_FEATURE_AP_SCAN;

NL80211_FEATURE_AP_SCAN is not set when use_chanctx=1

I am not sure which is better. First one required only fix in ath9k,
second one also required changes in wpa_supplicant.

BR
Janusz

2015-06-15 11:46:40

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

On 15 June 2015 at 13:38, Janusz Dziedzic <[email protected]> wrote:
> On 15 June 2015 at 12:33, Sujith Manoharan <[email protected]> wrote:
>> Janusz Dziedzic wrote:
>>> Add p2p dev support when ath9k loaded with
>>> use_chanctx=1. This will fix problem, when first
>>> interface is an AP and next we would like to run
>>> p2p_find. Before p2p scan failed.
>>>
>>> Signed-off-by: Janusz Dziedzic <[email protected]>
>>> ---
>>> @Felix, Sujith please review. I am not sure if didn't miss some
>>> case for NL80211_IFTYPE_P2P_DEVICE (special handling required?).
>>
>> At least the callbacks for adding/removing interfaces need
>> to be handled ?
>>
> Strange, but I didn't hit any problem yet with my simple patch.
>
>> But, can you describe the sequence of commands used that
>> resulted in this issue ?
>>
> 1. load ath9k with use_chanctx=1
> 2. run wpa_supplicant using wlan0
> 3. connect wlan0 to AP
3. setup AP using wlan0
> 4. run p2p_find form wpa_cli
> 5. scan will failed with Operation not supported (even I will
> force-ap-scan, while chanctx version using hw_scan callback ...)
> 6. p2p_find will fail
>
> BR
> Janusz

2015-06-16 01:25:09

by Sujith Manoharan

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

Arend van Spriel wrote:
> The p2p-device is designed to be used for p2p discovery and p2p action
> frame exchange. It make it easier for driver and/or firmware to
> determine if user-space request is p2p related or not. However, in
> discussions with Jouni I got the impression that ath (or qca) firmware
> and/or drivers did not need this design. Not sure if that claim is
> unaffected by the "use_chanctx=1" parameter.

Thanks for the explanation.

I don't think advertising support for p2p-device is required for
ath9k. P2P discovery works properly with the normal station/ap interface
types and the 'use_chanctx' modparam simply enables multiple channel
contexts.

Sujith

2015-06-15 10:49:24

by Sujith Manoharan

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

Janusz Dziedzic wrote:
> Add p2p dev support when ath9k loaded with
> use_chanctx=1. This will fix problem, when first
> interface is an AP and next we would like to run
> p2p_find. Before p2p scan failed.
>
> Signed-off-by: Janusz Dziedzic <[email protected]>
> ---
> @Felix, Sujith please review. I am not sure if didn't miss some
> case for NL80211_IFTYPE_P2P_DEVICE (special handling required?).

At least the callbacks for adding/removing interfaces need
to be handled ?

But, can you describe the sequence of commands used that
resulted in this issue ?

Sujith

2015-06-16 07:08:50

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

On Tue, 2015-06-16 at 08:30 +0200, Janusz Dziedzic wrote:

> Other fix I can image is change wpa_supplicant and add
> NL80211_SCAN_FLAG_AP to p2p_find, and set in ath9k driver
> wiphy->features |= NL80211_FEATURE_AP_SCAN;
>
> NL80211_FEATURE_AP_SCAN is not set when use_chanctx=1
>
> I am not sure which is better. First one required only fix in ath9k,
> second one also required changes in wpa_supplicant.

It would be unfortunate if a driver change required wpa_s changes. It
doesn't seem so bad to add p2p-device support to the driver, after all,
there isn't much it needs to do for that.

This seems like a strange quirk though - you can normally not do any p2p
operation when already operating as soft-AP (without P2P-device), no?

johannes


2015-06-15 11:38:16

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [RFC] ath9k: advertise p2p dev support when chanctx

On 15 June 2015 at 12:33, Sujith Manoharan <[email protected]> wrote:
> Janusz Dziedzic wrote:
>> Add p2p dev support when ath9k loaded with
>> use_chanctx=1. This will fix problem, when first
>> interface is an AP and next we would like to run
>> p2p_find. Before p2p scan failed.
>>
>> Signed-off-by: Janusz Dziedzic <[email protected]>
>> ---
>> @Felix, Sujith please review. I am not sure if didn't miss some
>> case for NL80211_IFTYPE_P2P_DEVICE (special handling required?).
>
> At least the callbacks for adding/removing interfaces need
> to be handled ?
>
Strange, but I didn't hit any problem yet with my simple patch.

> But, can you describe the sequence of commands used that
> resulted in this issue ?
>
1. load ath9k with use_chanctx=1
2. run wpa_supplicant using wlan0
3. connect wlan0 to AP
4. when we are connected, run p2p_find form wpa_cli
5. scan will failed with Operation not supported (even I will
force-ap-scan, while chanctx version using hw_scan callback ...)
6. p2p_find will fail

BR
Janusz