* [PATCH] ath6kl: Fix target assert in p2p bringup with multi vif
@ 2012-04-05 6:46 Vasanthakumar Thiagarajan
2012-04-06 10:03 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-05 6:46 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, ath6kl-devel
Using interface 0 for p2p causes target assert. This is because
interface 0 is always initialized to non-p2p operations. Fix this
issue by initializing all the interfaces for p2p when fw is capable
of dynamic interface switching. When fw is not capable of dynamic
switching, make sure p2p is not brought up on interface which is
not initialized for this purpose.
Reported-by: Naveen Singh navesing@qca.qualcomm.com
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/cfg80211.c | 26 +++++++++++++++++++++++
drivers/net/wireless/ath/ath6kl/init.c | 31 ++++++++++++++++++----------
2 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 1272508..26fb3d7 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1451,9 +1451,35 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,
struct vif_params *params)
{
struct ath6kl_vif *vif = netdev_priv(ndev);
+ int i;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type %u\n", __func__, type);
+ /*
+ * Don't bring up p2p on an interface which is not initialized
+ * for p2p operation where fw does not have capability to switch
+ * dynamically between non-p2p and p2p type interface.
+ */
+ if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
+ vif->ar->fw_capabilities)) {
+ if (type == NL80211_IFTYPE_P2P_CLIENT ||
+ type == NL80211_IFTYPE_P2P_GO) {
+ if (vif->ar->vif_max > 1) {
+ for (i = vif->ar->max_norm_iface;
+ i < vif->ar->vif_max; i++) {
+ if (i == vif->fw_vif_idx)
+ break;
+ }
+ if (i == vif->ar->vif_max) {
+ ath6kl_err("Invalid interface to bring up P2P\n");
+ return -EINVAL;
+ }
+ } else
+ if (vif->fw_vif_idx != 0)
+ return -EINVAL;
+ }
+ }
+
switch (type) {
case NL80211_IFTYPE_STATION:
vif->next_mode = INFRA_NETWORK;
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 5949ab5..edd7788 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -488,22 +488,31 @@ int ath6kl_configure_target(struct ath6kl *ar)
fw_mode |= fw_iftype << (i * HI_OPTION_FW_MODE_BITS);
/*
- * By default, submodes :
+ * Submodes when fw does not support dynamic interface
+ * switching:
* vif[0] - AP/STA/IBSS
* vif[1] - "P2P dev"/"P2P GO"/"P2P Client"
* vif[2] - "P2P dev"/"P2P GO"/"P2P Client"
+ * Otherwise, All the interface are initialized to p2p dev.
*/
- for (i = 0; i < ar->max_norm_iface; i++)
- fw_submode |= HI_OPTION_FW_SUBMODE_NONE <<
- (i * HI_OPTION_FW_SUBMODE_BITS);
+ if (test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
+ ar->fw_capabilities)) {
+ for (i = 0; i < ar->vif_max; i++)
+ fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV <<
+ (i * HI_OPTION_FW_SUBMODE_BITS);
+ } else {
+ for (i = 0; i < ar->max_norm_iface; i++)
+ fw_submode |= HI_OPTION_FW_SUBMODE_NONE <<
+ (i * HI_OPTION_FW_SUBMODE_BITS);
- for (i = ar->max_norm_iface; i < ar->vif_max; i++)
- fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV <<
- (i * HI_OPTION_FW_SUBMODE_BITS);
+ for (i = ar->max_norm_iface; i < ar->vif_max; i++)
+ fw_submode |= HI_OPTION_FW_SUBMODE_P2PDEV <<
+ (i * HI_OPTION_FW_SUBMODE_BITS);
- if (ar->p2p && ar->vif_max == 1)
- fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV;
+ if (ar->p2p && ar->vif_max == 1)
+ fw_submode = HI_OPTION_FW_SUBMODE_P2PDEV;
+ }
if (ath6kl_bmi_write_hi32(ar, hi_app_host_interest,
HTC_PROTOCOL_VERSION) != 0) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ath6kl: Fix target assert in p2p bringup with multi vif
2012-04-05 6:46 [PATCH] ath6kl: Fix target assert in p2p bringup with multi vif Vasanthakumar Thiagarajan
@ 2012-04-06 10:03 ` Kalle Valo
2012-04-06 10:10 ` Vasanthakumar Thiagarajan
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2012-04-06 10:03 UTC (permalink / raw)
To: Vasanthakumar Thiagarajan; +Cc: linux-wireless, ath6kl-devel
On 04/05/2012 09:46 AM, Vasanthakumar Thiagarajan wrote:
> Using interface 0 for p2p causes target assert. This is because
> interface 0 is always initialized to non-p2p operations. Fix this
> issue by initializing all the interfaces for p2p when fw is capable
> of dynamic interface switching. When fw is not capable of dynamic
> switching, make sure p2p is not brought up on interface which is
> not initialized for this purpose.
>
> Reported-by: Naveen Singh navesing@qca.qualcomm.com
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
> ---
> drivers/net/wireless/ath/ath6kl/cfg80211.c | 26 +++++++++++++++++++++++
> drivers/net/wireless/ath/ath6kl/init.c | 31 ++++++++++++++++++----------
> 2 files changed, 46 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> index 1272508..26fb3d7 100644
> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> @@ -1451,9 +1451,35 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,
> struct vif_params *params)
> {
> struct ath6kl_vif *vif = netdev_priv(ndev);
> + int i;
>
> ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type %u\n", __func__, type);
>
> + /*
> + * Don't bring up p2p on an interface which is not initialized
> + * for p2p operation where fw does not have capability to switch
> + * dynamically between non-p2p and p2p type interface.
> + */
> + if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
> + vif->ar->fw_capabilities)) {
> + if (type == NL80211_IFTYPE_P2P_CLIENT ||
> + type == NL80211_IFTYPE_P2P_GO) {
> + if (vif->ar->vif_max > 1) {
> + for (i = vif->ar->max_norm_iface;
> + i < vif->ar->vif_max; i++) {
> + if (i == vif->fw_vif_idx)
> + break;
> + }
> + if (i == vif->ar->vif_max) {
> + ath6kl_err("Invalid interface to bring up P2P\n");
> + return -EINVAL;
> + }
> + } else
> + if (vif->fw_vif_idx != 0)
> + return -EINVAL;
> + }
> + }
IMHO this is difficult to read. Could it be simplified by reducing the
unnecessary indentation:
if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
vif->ar->fw_capabilities) &&
(type == NL80211_IFTYPE_P2P_CLIENT ||
type == NL80211_IFTYPE_P2P_GO)) {
if (vif->ar->vif_max == 0) {
if (vif->fw_vif_idx != 0)
return -EINVAL;
else
goto foo;
}
for (i = vif->ar->max_norm_iface;
i < vif->ar->vif_max; i++) {
if (i == vif->fw_vif_idx)
break;
}
}
if (i == vif->ar->vif_max) {
ath6kl_err("Invalid interface to bring up P2P\n");
return -EINVAL;
}
}
foo:
I'm sure I added bugs above but hopefully it still shows my idea. At
least you can combine the first two if statements and get rid of one
indentation level.
Kalle
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ath6kl: Fix target assert in p2p bringup with multi vif
2012-04-06 10:03 ` Kalle Valo
@ 2012-04-06 10:10 ` Vasanthakumar Thiagarajan
0 siblings, 0 replies; 3+ messages in thread
From: Vasanthakumar Thiagarajan @ 2012-04-06 10:10 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless, ath6kl-devel
On Friday 06 April 2012 03:33 PM, Kalle Valo wrote:
> On 04/05/2012 09:46 AM, Vasanthakumar Thiagarajan wrote:
>> Using interface 0 for p2p causes target assert. This is because
>> interface 0 is always initialized to non-p2p operations. Fix this
>> issue by initializing all the interfaces for p2p when fw is capable
>> of dynamic interface switching. When fw is not capable of dynamic
>> switching, make sure p2p is not brought up on interface which is
>> not initialized for this purpose.
>>
>> Reported-by: Naveen Singh navesing@qca.qualcomm.com
>> Signed-off-by: Vasanthakumar Thiagarajan<vthiagar@qca.qualcomm.com>
>> ---
>> drivers/net/wireless/ath/ath6kl/cfg80211.c | 26 +++++++++++++++++++++++
>> drivers/net/wireless/ath/ath6kl/init.c | 31 ++++++++++++++++++----------
>> 2 files changed, 46 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> index 1272508..26fb3d7 100644
>> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> @@ -1451,9 +1451,35 @@ static int ath6kl_cfg80211_change_iface(struct wiphy *wiphy,
>> struct vif_params *params)
>> {
>> struct ath6kl_vif *vif = netdev_priv(ndev);
>> + int i;
>>
>> ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: type %u\n", __func__, type);
>>
>> + /*
>> + * Don't bring up p2p on an interface which is not initialized
>> + * for p2p operation where fw does not have capability to switch
>> + * dynamically between non-p2p and p2p type interface.
>> + */
>> + if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
>> + vif->ar->fw_capabilities)) {
>> + if (type == NL80211_IFTYPE_P2P_CLIENT ||
>> + type == NL80211_IFTYPE_P2P_GO) {
>> + if (vif->ar->vif_max> 1) {
>> + for (i = vif->ar->max_norm_iface;
>> + i< vif->ar->vif_max; i++) {
>> + if (i == vif->fw_vif_idx)
>> + break;
>> + }
>> + if (i == vif->ar->vif_max) {
>> + ath6kl_err("Invalid interface to bring up P2P\n");
>> + return -EINVAL;
>> + }
>> + } else
>> + if (vif->fw_vif_idx != 0)
>> + return -EINVAL;
>> + }
>> + }
>
> IMHO this is difficult to read. Could it be simplified by reducing the
> unnecessary indentation:
>
> if (!test_bit(ATH6KL_FW_CAPABILITY_STA_P2PDEV_DUPLEX,
> vif->ar->fw_capabilities)&&
> (type == NL80211_IFTYPE_P2P_CLIENT ||
> type == NL80211_IFTYPE_P2P_GO)) {
>
> if (vif->ar->vif_max == 0) {
> if (vif->fw_vif_idx != 0)
> return -EINVAL;
> else
> goto foo;
> }
>
> for (i = vif->ar->max_norm_iface;
> i< vif->ar->vif_max; i++) {
> if (i == vif->fw_vif_idx)
> break;
> }
> }
>
> if (i == vif->ar->vif_max) {
> ath6kl_err("Invalid interface to bring up P2P\n");
> return -EINVAL;
> }
> }
>
> foo:
>
> I'm sure I added bugs above but hopefully it still shows my idea. At
> least you can combine the first two if statements and get rid of one
> indentation level.
I get your idea, i'll change it. Thanks!
Vasanth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-06 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-05 6:46 [PATCH] ath6kl: Fix target assert in p2p bringup with multi vif Vasanthakumar Thiagarajan
2012-04-06 10:03 ` Kalle Valo
2012-04-06 10:10 ` Vasanthakumar Thiagarajan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).