diff mbox

[RFC] ath9k: advertise p2p dev support when chanctx

Message ID 1433913034-17801-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show

Commit Message

Janusz.Dziedzic@tieto.com June 10, 2015, 5:10 a.m. UTC
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 <janusz.dziedzic@tieto.com>
---
@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(-)

Comments

Sujith Manoharan June 15, 2015, 10:33 a.m. UTC | #1
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 <janusz.dziedzic@tieto.com>
> ---
> @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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Janusz.Dziedzic@tieto.com June 15, 2015, 11:38 a.m. UTC | #2
On 15 June 2015 at 12:33, Sujith Manoharan <sujith@msujith.org> 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 <janusz.dziedzic@tieto.com>
>> ---
>> @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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Janusz.Dziedzic@tieto.com June 15, 2015, 11:46 a.m. UTC | #3
On 15 June 2015 at 13:38, Janusz Dziedzic <janusz.dziedzic@tieto.com> wrote:
> On 15 June 2015 at 12:33, Sujith Manoharan <sujith@msujith.org> 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 <janusz.dziedzic@tieto.com>
>>> ---
>>> @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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan June 15, 2015, 3:47 p.m. UTC | #4
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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel June 15, 2015, 6:19 p.m. UTC | #5
+ 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan June 16, 2015, 1:25 a.m. UTC | #6
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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Janusz.Dziedzic@tieto.com June 16, 2015, 6:30 a.m. UTC | #7
On 16 June 2015 at 03:25, Sujith Manoharan <sujith@msujith.org> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg June 16, 2015, 7:08 a.m. UTC | #8
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan June 16, 2015, 7:53 a.m. UTC | #9
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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);
 	}