RE: [PATCH] mwifiex: printk() overflow with 32-byte SSIDs

2016-11-08 Thread Amitkumar Karwar
> From: Brian Norris [mailto:briannor...@chromium.org]
> Sent: Wednesday, November 09, 2016 7:58 AM
> To: Amitkumar Karwar; Nishant Sarmukadam; Kalle Valo
> Cc: linux-ker...@vger.kernel.org; linux-wireless@vger.kernel.org; Cathy
> Luo; secur...@kernel.org; sta...@vger.kernel.org; Brian Norris
> Subject: [PATCH] mwifiex: printk() overflow with 32-byte SSIDs
> 
> SSIDs aren't guaranteed to be 0-terminated. Let's cap the max length
> when we print them out.
> 
> This can be easily noticed by connecting to a network with a 32-octet
> SSID:
> 
> [ 3903.502925] mwifiex_pcie :01:00.0: info: trying to associate to
> '0123456789abcdef0123456789abcdef ' bssid
> xx:xx:xx:xx:xx:xx
> 
> Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell
> mwifiex driver")
> Signed-off-by: Brian Norris 
> Cc: 
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index 39ce76ad00bc..16241d21727b 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -,8 +,9 @@ mwifiex_cfg80211_assoc(struct mwifiex_private
> *priv, size_t ssid_len,
>   is_scanning_required = 1;
>   } else {
>   mwifiex_dbg(priv->adapter, MSG,
> - "info: trying to associate to '%s' bssid
> %pM\n",
> - (char *)req_ssid.ssid, bss->bssid);
> + "info: trying to associate to '%.*s' bssid
> %pM\n",
> + req_ssid.ssid_len, (char *)req_ssid.ssid,
> + bss->bssid);
>   memcpy(>cfg_bssid, bss->bssid, ETH_ALEN);
>   break;
>   }
> @@ -2283,8 +2284,8 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy,
> struct net_device *dev,
>   }
> 
>   mwifiex_dbg(adapter, INFO,
> - "info: Trying to associate to %s and bssid %pM\n",
> - (char *)sme->ssid, sme->bssid);
> + "info: Trying to associate to %.*s and bssid %pM\n",
> + (int)sme->ssid_len, (char *)sme->ssid, sme->bssid);
> 
>   if (!mwifiex_stop_bg_scan(priv))
>   cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy);
> @@ -2417,8 +2418,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy,
> struct net_device *dev,
>   }
> 
>   mwifiex_dbg(priv->adapter, MSG,
> - "info: trying to join to %s and bssid %pM\n",
> - (char *)params->ssid, params->bssid);
> + "info: trying to join to %.*s and bssid %pM\n",
> + params->ssid_len, (char *)params->ssid, params->bssid);
> 
>   mwifiex_set_ibss_params(priv, params);
> 
> --
> 2.8.0.rc3.226.g39d4020

Thanks for fixing this.

Acked-by: Amitkumar Karwar 

Regards,
Amitkumar


Re: [PATCH v2 3/3] iwlwifi: pcie: trans: Remove unused 'shift_param'

2016-11-08 Thread Luca Coelho
On Tue, 2016-11-08 at 21:50 -0800, Kirtika Ruchandani wrote:
> shift_param is defined and set in iwl_pcie_load_cpu_sections
> but not used. Fix this to avoid -Wunused-but-set-variable
> warning.
> The code using it turned into dead code with commit dcab8ecd5617
> which added a separate function iwl_pcie_load_given_ucode_8000
> (then 8000b) for IWL_DEVICE_FAMILY_8000. Commit 76f8c0e17edc
> removed the dead code but left shift_param as is.
> 
> iwlwifi/pcie/trans.c: In function ‘iwl_pcie_load_cpu_sections’:
> iwlwifi/pcie/trans.c:871:6: warning: variable ‘shift_param’ set but not used 
> [-Wunused-but-set-variable]
> 
> Fixes: dcab8ecd5617 (iwlwifi: mvm: support ucode load for family_8000 B0 only)
> Fixes: 76f8c0e17edc (iwlwifi: pcie: remove dead code)
> 
> Signed-off-by: Kirtika Ruchandani 
> Cc: Sara Sharon 
> Cc: Luca Coelho 
> Cc: Eran Harary 

I'll remove Harary's Cc here too, since this email is not valid anymore
and I don't know his new one (and he probably doesn't care anymore
anyway).

--
Luca.


Re: [PATCH v2 2/3] iwlwifi: mvm: rs: Remove unused 'mcs' variable

2016-11-08 Thread Luca Coelho
Another nitpick
On Tue, 2016-11-08 at 21:50 -0800, Kirtika Ruchandani wrote:
> Commit 5fc0f76c4 introduced Rx stats from debugfs, the function
> iwl_mvm_reset_frame_stats from that commit defines and sets mcs but does not 
> use
> it. Compiling iwlwifi with W=1 gives this warning -
> 
> iwlwifi/mvm/rs.c: In function ‘iwl_mvm_update_frame_stats’:
> iwlwifi/mvm/rs.c:3074:14: warning: variable ‘mcs’ set but not used 
> [-Wunused-but-set-variable]
> 
> Fixes: 5fc0f76c43bd (iwlwifi: mvm: add Rx frames statistics via debugfs)

You forgot the quotes here, but no worries, I'll add them.

--
Luca.


Re: [PATCH v2 1/3] iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables

2016-11-08 Thread Luca Coelho
(removed Erarn Harary from the Cc list, since this email is not valid
anymore)

Hi Kirtika,
Just a couple of nitpicks, nothing important, so no need to resend.


On Tue, 2016-11-08 at 21:50 -0800, Kirtika Ruchandani wrote:
> mvmvif is defined and set in rs_mimo_allow but not used. Compiling
> iwlwifi with W=1 gives the following warning, remove it. mvmsta is used only 
> to
> obtain mvmvif so remove it as well.
> 
> iwlwifi/mvm/rs.c: In function 'rs_mimo_allow':
> iwlwifi/mvm/rs.c:165:22: warning: variable 'mvmvif' set but not 
> used.[-Wunused-but-set-variable]
> 
> This fix removes calls to iwl_mvm_sta_from_mac & iwl_mvm_vif_from_mac. They 
> are
> both accessors, and do not have any side-effects.
> Commit e621c2282 removed a workaround that disabled MIMO on P2P, 'mvmvif' was
> used for that workaround, but not removed with it.
> 
> Fixes: e621c2282e31 ("iwlwifi: rs: Remove workaround that disables MIMO on 
> P2P")
> 

Usually the Fixes: tag is together with the other tags (such as Cc,
Signed-off-by), i.e. no empty line here.


> Signed-off-by: Kirtika Ruchandani 
> Cc: Alexander Bondar 
> Cc: Emmanuel Grumbach 

And the Signed-off-by tag is usually the last one here, after all Cc's
and stuff.  But it doesn't matter much.

-- 
Cheers,
Luca.


Re: [PATCH v2 0/3] Fix -Wunused-but-set-variable in iwlwifi/pcie/trans and iwlwifi/mvm/rs

2016-11-08 Thread Coelho, Luciano
On Tue, 2016-11-08 at 21:49 -0800, Kirtika Ruchandani wrote:
> This patchset is part of the effort led by Arnd Bergmann to clean up
> warnings in the kernel. This and following patchsets will focus on 
> "-Wunused-but-set-variable" as it among the noisier ones. These were
> found compiling with W=1.
> 
> -- 
> Changes in v2:
> - Made the following changes suggested by Arnd in all 3 patches
>   1. Each patch has a unique subject line.
>   2. Add the commit that introduced/led to the warning with the "Fixes:" line.
>   3. cc linux-wireles, cc commit authors.
> 
> Kirtika Ruchandani (3):
>   iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables
>   iwlwifi: mvm: rs: Remove unused 'mcs' variable
>   iwlwifi: pcie: trans: Remove unused 'shift_param'
> 
>  drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 10 +-
>  drivers/net/wireless/intel/iwlwifi/pcie/trans.c |  3 ---
>  2 files changed, 1 insertion(+), 12 deletions(-)

Thanks, Kirtika! I'll push these patches via our internal tree and
include them in my next pull request to Kalle.

-- 
Cheers,
Luca.

[PATCH v2 3/3] iwlwifi: pcie: trans: Remove unused 'shift_param'

2016-11-08 Thread Kirtika Ruchandani
shift_param is defined and set in iwl_pcie_load_cpu_sections
but not used. Fix this to avoid -Wunused-but-set-variable
warning.
The code using it turned into dead code with commit dcab8ecd5617
which added a separate function iwl_pcie_load_given_ucode_8000
(then 8000b) for IWL_DEVICE_FAMILY_8000. Commit 76f8c0e17edc
removed the dead code but left shift_param as is.

iwlwifi/pcie/trans.c: In function ‘iwl_pcie_load_cpu_sections’:
iwlwifi/pcie/trans.c:871:6: warning: variable ‘shift_param’ set but not used 
[-Wunused-but-set-variable]

Fixes: dcab8ecd5617 (iwlwifi: mvm: support ucode load for family_8000 B0 only)
Fixes: 76f8c0e17edc (iwlwifi: pcie: remove dead code)

Signed-off-by: Kirtika Ruchandani 
Cc: Sara Sharon 
Cc: Luca Coelho 
Cc: Eran Harary 
Cc: Liad Kaufman 
Cc: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index ae95533..1b27a39 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -868,15 +868,12 @@ static int iwl_pcie_load_cpu_sections(struct iwl_trans 
*trans,
  int cpu,
  int *first_ucode_section)
 {
-   int shift_param;
int i, ret = 0;
u32 last_read_idx = 0;
 
if (cpu == 1) {
-   shift_param = 0;
*first_ucode_section = 0;
} else {
-   shift_param = 16;
(*first_ucode_section)++;
}
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 1/3] iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables

2016-11-08 Thread Kirtika Ruchandani
mvmvif is defined and set in rs_mimo_allow but not used. Compiling
iwlwifi with W=1 gives the following warning, remove it. mvmsta is used only to
obtain mvmvif so remove it as well.

iwlwifi/mvm/rs.c: In function 'rs_mimo_allow':
iwlwifi/mvm/rs.c:165:22: warning: variable 'mvmvif' set but not 
used.[-Wunused-but-set-variable]

This fix removes calls to iwl_mvm_sta_from_mac & iwl_mvm_vif_from_mac. They are
both accessors, and do not have any side-effects.
Commit e621c2282 removed a workaround that disabled MIMO on P2P, 'mvmvif' was
used for that workaround, but not removed with it.

Fixes: e621c2282e31 ("iwlwifi: rs: Remove workaround that disables MIMO on P2P")

Signed-off-by: Kirtika Ruchandani 
Cc: Alexander Bondar 
Cc: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 227c5ed..0b79f4a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -161,9 +161,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
  struct rs_rate *rate,
  const struct rs_tx_column *next_col)
 {
-   struct iwl_mvm_sta *mvmsta;
-   struct iwl_mvm_vif *mvmvif;
-
if (!sta->ht_cap.ht_supported)
return false;
 
@@ -176,9 +173,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta))
return false;
 
-   mvmsta = iwl_mvm_sta_from_mac80211(sta);
-   mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
-
if (mvm->nvm_data->sku_cap_mimo_disabled)
return false;
 
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 2/3] iwlwifi: mvm: rs: Remove unused 'mcs' variable

2016-11-08 Thread Kirtika Ruchandani
Commit 5fc0f76c4 introduced Rx stats from debugfs, the function
iwl_mvm_reset_frame_stats from that commit defines and sets mcs but does not use
it. Compiling iwlwifi with W=1 gives this warning -

iwlwifi/mvm/rs.c: In function ‘iwl_mvm_update_frame_stats’:
iwlwifi/mvm/rs.c:3074:14: warning: variable ‘mcs’ set but not used 
[-Wunused-but-set-variable]

Fixes: 5fc0f76c43bd (iwlwifi: mvm: add Rx frames statistics via debugfs)

Signed-off-by: Kirtika Ruchandani 
Cc: Eyal Shapira 
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 0b79f4a..80f99c3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3065,7 +3065,7 @@ static void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm)
 
 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
 {
-   u8 nss = 0, mcs = 0;
+   u8 nss = 0;
 
spin_lock(>drv_stats_lock);
 
@@ -3093,11 +3093,9 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 
rate, bool agg)
 
if (rate & RATE_MCS_HT_MSK) {
mvm->drv_rx_stats.ht_frames++;
-   mcs = rate & RATE_HT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1;
} else if (rate & RATE_MCS_VHT_MSK) {
mvm->drv_rx_stats.vht_frames++;
-   mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_VHT_MCS_NSS_MSK) >>
   RATE_VHT_MCS_NSS_POS) + 1;
} else {
-- 
2.8.0.rc3.226.g39d4020



[PATCH v2 0/3] Fix -Wunused-but-set-variable in iwlwifi/pcie/trans and iwlwifi/mvm/rs

2016-11-08 Thread Kirtika Ruchandani
This patchset is part of the effort led by Arnd Bergmann to clean up
warnings in the kernel. This and following patchsets will focus on 
"-Wunused-but-set-variable" as it among the noisier ones. These were
found compiling with W=1.

-- 
Changes in v2:
- Made the following changes suggested by Arnd in all 3 patches
  1. Each patch has a unique subject line.
  2. Add the commit that introduced/led to the warning with the "Fixes:" line.
  3. cc linux-wireles, cc commit authors.

Kirtika Ruchandani (3):
  iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables
  iwlwifi: mvm: rs: Remove unused 'mcs' variable
  iwlwifi: pcie: trans: Remove unused 'shift_param'

 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 10 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c |  3 ---
 2 files changed, 1 insertion(+), 12 deletions(-)

-- 
2.8.0.rc3.226.g39d4020



[PATCH] mwifiex: fix memory leak in mwifiex_save_hidden_ssid_channels()

2016-11-08 Thread Ricky Liang
kmemleak reports memory leak in mwifiex_save_hidden_ssid_channels():

unreferenced object 0xffc0a2914780 (size 192):
  comm "ksdioirqd/mmc2", pid 2004, jiffies 4307182506 (age 820.684s)
  hex dump (first 32 bytes):
00 06 47 49 4e 2d 32 67 01 03 c8 60 6c 03 01 40  ..GIN-2g...`l..@
07 10 54 57 20 34 04 1e 64 05 24 84 03 24 95 04  ..TW 4..d.$..$..
  backtrace:
[] create_object+0x164/0x2b4
[] kmemleak_alloc+0x50/0x88
[] __kmalloc_track_caller+0x1bc/0x264
[] kmemdup+0x38/0x64
[] mwifiex_fill_new_bss_desc+0x3c/0x130 [mwifiex]
[] mwifiex_save_curr_bcn+0x4ec/0x640 [mwifiex]
[] mwifiex_handle_event_ext_scan_report+0x1d4/0x268 
[mwifiex]
[] mwifiex_process_sta_event+0x378/0x898 [mwifiex]
[] mwifiex_process_event+0x1a8/0x1e8 [mwifiex]
[] mwifiex_main_process+0x258/0x534 [mwifiex]
[] 0xffbffc258858
[] process_sdio_pending_irqs+0xf8/0x160
[] sdio_irq_thread+0x9c/0x1a4
[] kthread+0xf4/0x100
[] ret_from_fork+0xc/0x50
[] 0x

Signed-off-by: Ricky Liang 
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c 
b/drivers/net/wireless/marvell/mwifiex/scan.c
index 97c9765..98ce072 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -1671,6 +1671,10 @@ static int mwifiex_save_hidden_ssid_channels(struct 
mwifiex_private *priv,
}
 
 done:
+   /* beacon_ie buffer was allocated in function
+* mwifiex_fill_new_bss_desc(). Free it now.
+*/
+   kfree(bss_desc->beacon_buf);
kfree(bss_desc);
return 0;
 }
-- 
2.6.6



Re: [v5] ath9k: Switch to using mac80211 intermediate software queues.

2016-11-08 Thread Tim Shepard


> While at it, could you also add to the commit log some info how awesome this
> patch is from user's point of view and how it helps. For example, before and
> and after numbers and other results.

That varies wildly, depending on many details of the scenario
(including the wireless capabilities of the clients connected to the
AP using this patch, and how far away those clients are).  There's
really not enough room in a commit message to explain enough to make
any such claimed numbers reproducible.

And, BTW, this patch alone is not really where the big improvement
comes from.  This just cuts ath9k over to use the new
transmit-a-packet interface between the mac80211 layer and the
wireless device driver.  All the good work to improve latency is being
done on the new mac80211 interface to the driver to transmit a packet.
If you want numbers in a commit message, those numbers belong over on
those commits, not on this ath9k commit, IMHO.

And there's different patches that taken together achieve the best
improvement, and in various subsets differing amounts of improvement,
which again all depends on the scenarios.

And all this is complicated by how often real users are involved in
scenarios where this matters (hard to say).


This mainly improves things when you have an ath9k interface with
packets queued simultaneously to different wireless destinations,
which is typically when the ath9k interface is serving as an AP.

And I would expect similar improvements for any wireless driver cut
over to use the new mac80211 interface.  (This patch might be a
helpful guide to other wireless driver maintainers wishing to see the
same improvements other wireless drivers.)

I hope that the above paragraphs were helpful.

-Tim Shepard
 s...@alum.mit.edu


[PATCH] mwifiex: printk() overflow with 32-byte SSIDs

2016-11-08 Thread Brian Norris
SSIDs aren't guaranteed to be 0-terminated. Let's cap the max length
when we print them out.

This can be easily noticed by connecting to a network with a 32-octet
SSID:

[ 3903.502925] mwifiex_pcie :01:00.0: info: trying to associate to
'0123456789abcdef0123456789abcdef ' bssid
xx:xx:xx:xx:xx:xx

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex 
driver")
Signed-off-by: Brian Norris 
Cc: 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 39ce76ad00bc..16241d21727b 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -,8 +,9 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, 
size_t ssid_len,
is_scanning_required = 1;
} else {
mwifiex_dbg(priv->adapter, MSG,
-   "info: trying to associate to '%s' bssid 
%pM\n",
-   (char *)req_ssid.ssid, bss->bssid);
+   "info: trying to associate to '%.*s' bssid 
%pM\n",
+   req_ssid.ssid_len, (char *)req_ssid.ssid,
+   bss->bssid);
memcpy(>cfg_bssid, bss->bssid, ETH_ALEN);
break;
}
@@ -2283,8 +2284,8 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct 
net_device *dev,
}
 
mwifiex_dbg(adapter, INFO,
-   "info: Trying to associate to %s and bssid %pM\n",
-   (char *)sme->ssid, sme->bssid);
+   "info: Trying to associate to %.*s and bssid %pM\n",
+   (int)sme->ssid_len, (char *)sme->ssid, sme->bssid);
 
if (!mwifiex_stop_bg_scan(priv))
cfg80211_sched_scan_stopped_rtnl(priv->wdev.wiphy);
@@ -2417,8 +2418,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct 
net_device *dev,
}
 
mwifiex_dbg(priv->adapter, MSG,
-   "info: trying to join to %s and bssid %pM\n",
-   (char *)params->ssid, params->bssid);
+   "info: trying to join to %.*s and bssid %pM\n",
+   params->ssid_len, (char *)params->ssid, params->bssid);
 
mwifiex_set_ibss_params(priv, params);
 
-- 
2.8.0.rc3.226.g39d4020



Re: [v5] ath9k: Switch to using mac80211 intermediate software queues.

2016-11-08 Thread Kalle Valo
Toke Høiland-Jørgensen wrote:
> This switches ath9k over to using the mac80211 intermediate software
> queueing mechanism for data packets. It removes the queueing inside the
> driver, except for the retry queue, and instead pulls from mac80211 when
> a packet is needed. The retry queue is used to store a packet that was
> pulled but can't be sent immediately.
> 
> The old code path in ath_tx_start that would queue packets has been
> removed completely, as has the qlen limit tunables (since there's no
> longer a queue in the driver to limit).
> 
> Based on Tim's original patch set, but reworked quite thoroughly.
> 
> Cc: Tim Shepard 
> Cc: Felix Fietkau 
> Signed-off-by: Toke Høiland-Jørgensen 
> Signed-off-by: Felix Fietkau 

All dependencies have trickled down to ath.git but unfortunately doesn't apply
anymore, so please rebase. Hopefully the last time :)

While at it, could you also add to the commit log some info how awesome this
patch is from user's point of view and how it helps. For example, before and
and after numbers and other results.

error: patch failed: drivers/net/wireless/ath/ath9k/xmit.c:921
error: drivers/net/wireless/ath/ath9k/xmit.c: patch does not apply
stg import: Diff does not apply cleanly

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/patch/9311037/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



make-wifi-fast linuxplumbers talk summarized on lwn.net

2016-11-08 Thread Dave Taht
and available here:

https://lwn.net/SubscriberLink/705884/1bdb9c4aa048b0d5/

After the talk I discussed with several folk about applying the same
debloating techniques to other chipsets.

I don't remember, unfortunately, who all those folk were, nor the
candidate chipsets!

-- 
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org


Re: [v2] cw1200: Don't leak memory if krealloc failes

2016-11-08 Thread Kalle Valo
Johannes Thumshirn  wrote:
> The call to krealloc() in wsm_buf_reserve() directly assigns the newly
> returned memory to buf->begin. This is all fine except when krealloc()
> failes we loose the ability to free the old memory pointed to by
> buf->begin. If we just create a temporary variable to assign memory to
> and assign the memory to it we can mitigate the memory leak.
> 
> Signed-off-by: Johannes Thumshirn 
> Cc: Johannes Berg 

Patch applied to wireless-drivers-next.git, thanks.

9afdd6128c39 cw1200: Don't leak memory if krealloc failes

-- 
https://patchwork.kernel.org/patch/9358185/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [1/8] mwifiex: prevent register accesses after host is sleeping

2016-11-08 Thread Kalle Valo
Amitkumar Karwar  wrote:
> Following is mwifiex driver-firmware host sleep handshake.
> It involves three threads. suspend handler, interrupt handler, interrupt
> processing in main work queue.
> 
> 1) Enter suspend handler
> 2) Download HS_CFG command
> 3) Response from firmware for HS_CFG
> 4) Suspend thread waits until handshake completes(i.e hs_activate becomes
>true)
> 5) SLEEP from firmware
> 6) SLEEP confirm downloaded to firmware.
> 7) SLEEP confirm response from firmware
> 8) Driver processes SLEEP confirm response and set hs_activate to wake up
> suspend thread
> 9) Exit suspend handler
> 10) Read sleep cookie in loop and wait until it indicates firmware is
> sleep.
> 11) After processing SLEEP confirm response, we are at the end of interrupt
> processing routine. Recheck if there are interrupts received while we were
> processing them.
> 
> During suspend-resume stress test, it's been observed that we may end up
> acessing PCIe hardware(in 10 and 11) when PCIe bus is closed which leads
> to a kernel crash.
> 
> This patch solves the problem with below changes.
> a) action 10 above can be done before 8
> b) Skip 11 if hs_activated is true. SLEEP confirm response
> is the last interrupt from firmware. No need to recheck for
> pending interrupts.
> c) Add flush_workqueue() in suspend handler.
> 
> Signed-off-by: Amitkumar Karwar 
> Reviewed-by: Brian Norris 
> Tested-by: Brian Norris 

8 patches applied to wireless-drivers-next.git, thanks.

ec815dd2a5f1 mwifiex: prevent register accesses after host is sleeping
5190f2e40591 mwifiex: report error to PCIe for suspend failure
c44c040300d7 mwifiex: Fix NULL pointer dereference in skb_dequeue()
113630b581d6 mwifiex: vendor_ie length check for parse WMM IEs
a936ea543657 mwifiex: add memrw command information in README
77f486c8bb39 mwifiex: update tx_pkts_queued for requeued packets
49abe5c83cd0 mwifiex: fix command timeout problem seen in stress tests
3d8bd85c2c9e mwifiex: fix p2p device doesn't find in scan problem

-- 
https://patchwork.kernel.org/patch/9353809/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [-next] mwifiex: fix missing destroy_workqueue() on error in mwifiex_add_virtual_intf()

2016-11-08 Thread Kalle Valo
Wei Yongjun  wrote:
> From: Wei Yongjun 
> 
> Add the missing destroy_workqueue() before return from
> mwifiex_add_virtual_intf() in the error handling case.
> 
> Signed-off-by: Wei Yongjun 

Patch applied to wireless-drivers-next.git, thanks.

424342ff0e03 mwifiex: fix missing destroy_workqueue() on error in 
mwifiex_add_virtual_intf()

-- 
https://patchwork.kernel.org/patch/9356567/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: brcmfmac: proto: add callback for queuing TX data

2016-11-08 Thread Kalle Valo
Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> So far our core code was calling brcmf_fws_process_skb which wasn't
> a proper thing to do. If case of devices using msgbuf protocol fwsignal
> shouldn't be used. It was an unnecessary extra layer simply calling
> a protocol specifix txdata function.
> 
> Please note we already have txdata callback, but it's used for calls
> between bcdc and fwsignal so it couldn't be simply used there.
> 
> This makes core code more generic (instead of bcdc/fwsignal specific).
> 
> Signed-off-by: Rafał Miłecki 

Patch applied to wireless-drivers-next.git, thanks.

b073ac1fcf42 brcmfmac: proto: add callback for queuing TX data

-- 
https://patchwork.kernel.org/patch/9351305/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [v2] rt2x00: add support for mac addr from device tree

2016-11-08 Thread Kalle Valo
Mathias Kresin  wrote:
> On some devices the EEPROMs of Ralink Wi-Fi chips have a default Ralink
> MAC address set (RT3062F: 00:0C:43:30:62:00, RT3060F:
> 00:0C:43:30:60:00). Using multiple of these devices in the same network
> can cause nasty issues.
> 
> Allow to override the MAC in the EEPROM with (a known good) one set in
> the device tree to bypass the issue.
> 
> Signed-off-by: Mathias Kresin 
> Acked-by: Stanislaw Gruszka 

Patch applied to wireless-drivers-next.git, thanks.

9766cb709089 rt2x00: add support for mac addr from device tree

-- 
https://patchwork.kernel.org/patch/9300893/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH] wireless: fix bogus maybe-uninitialized warning

2016-11-08 Thread Kalle Valo
Arnd Bergmann  writes:

> The hostap_80211_rx() function is supposed to set up the mac addresses
> for four possible cases, based on two bits of input data. For
> some reason, gcc decides that it's possible that none of the these
> four cases apply and the addresses remain uninitialized:
>
> drivers/net/wireless/intersil/hostap/hostap_80211_rx.c: In function 
> ‘hostap_80211_rx’:
> arch/x86/include/asm/string_32.h:77:14: warning: ‘src’ may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
> drivers/net/wireless/intel/ipw2x00/libipw_rx.c: In function ‘libipw_rx’:
> arch/x86/include/asm/string_32.h:77:14: error: ‘dst’ may be used 
> uninitialized in this function [-Werror=maybe-uninitialized]
> arch/x86/include/asm/string_32.h:78:22: error: ‘*((void *)+4)’ may be 
> used uninitialized in this function [-Werror=maybe-uninitialized]
>
> This warning is clearly nonsense, but changing the last case into
> 'default' makes it obvious to the compiler too, which avoids the
> warning and probably leads to better object code too.
>
> The same code is duplicated several times in the kernel, so this
> patch uses the same workaround for all copies. The exact configuration
> was hit only very rarely in randconfig builds and I only saw it
> in three drivers, but I assume that all of them are potentially
> affected, and it's better to keep the code consistent.
>
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/net/wireless/ath/ath6kl/wmi.c  | 8 
>  drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 2 +-
>  drivers/net/wireless/intersil/hostap/hostap_80211_rx.c | 2 +-
>  net/wireless/lib80211_crypt_tkip.c | 2 +-
>  4 files changed, 7 insertions(+), 7 deletions(-)

[...]

> --- a/net/wireless/lib80211_crypt_tkip.c
> +++ b/net/wireless/lib80211_crypt_tkip.c
> @@ -556,7 +556,7 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
>   memcpy(hdr, hdr11->addr3, ETH_ALEN);/* DA */
>   memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */
>   break;
> - case 0:
> + default:
>   memcpy(hdr, hdr11->addr1, ETH_ALEN);/* DA */
>   memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
>   break;

Ideally we prefer that drivers/net/wireless and net/wireless changes are
split into different patches as they get applied to different trees.
Johannes, is it ok if I take this change through my tree this time?

-- 
Kalle Valo


Re: [1/2] rsi: New firware loading method for RSI 91X devices

2016-11-08 Thread Kalle Valo
Prameela Rani Garnepudi  wrote:
> RSI deprecated the old firmware loading method and introduced
> new method using soft boot loader for 9113 chipsets.
> Current driver only supports 9113 device model hence firmware
> loading method has been changed.
> 
> In the new method, complete RAM image and flash image are present
> in the flash. Two firmwares present in the device, Boot loader firmware
> and functional firmware. Boot loader firmware is fixed but functional
> firmware can be changed. Before loading the functional firmware, host
> issues commands to check whether existing firmware in the chip and the
> firmware file content to load are same or not. If not, host issues
> commands to load the RAM image and then boot loaded switches to the
> functioanl firmware.
> 
> Signed-off-by: Prameela Rani Garnepudi 

These two patches are quite big, difficult to review. Smaller changes
would help with that. Will review later.

2 patches set to Deferred.

9388629 [1/2] rsi: New firware loading method for RSI 91X devices
9388627 [2/2] rsi: Device initialization sequence is changed

-- 
https://patchwork.kernel.org/patch/9388629/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [3/3] rsi: Updated boot parameters

2016-11-08 Thread Kalle Valo
Prameela Rani Garnepudi  wrote:
> * Switch clock info is divided in to different clock information fields for
>   readability and synchronization with firmware code.
> * Other parameters are added for future use and to make the frame size in sync
>   with latest firmware. Otherwise firmware will discard the frame considering
>   corrupted frame.
> 
> Signed-off-by: Prameela Rani Garnepudi 

This looks broken and no reply to my comment.

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/patch/9374883/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: [PATCH 2/4] ath10k: Add support to update btcoex priority value via nl80211

2016-11-08 Thread kbuild test robot
Hi Tamizh,

[auto build test ERROR on ath6kl/ath-next]
[cannot apply to v4.9-rc4 next-20161108]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/ath10k-Add-support-for-BTCOEX-feature/20161109-043718
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath10k/mac.c:7508:35: warning: 'struct 
>> cfg80211_btcoex_priority' declared inside parameter list
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
  ^
>> drivers/net/wireless/ath/ath10k/mac.c:7508:35: warning: its scope is only 
>> this definition or declaration, which is probably not what you want
   drivers/net/wireless/ath/ath10k/mac.c: In function 
'ath10k_mac_get_btcoex_prio':
>> drivers/net/wireless/ath/ath10k/mac.c:7512:21: error: dereferencing pointer 
>> to incomplete type
 if (btcoex_priority->wlan_be_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7513:18: error: 
'WIPHY_WLAN_BE_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7513:18: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/net/wireless/ath/ath10k/mac.c:7515:21: error: dereferencing pointer 
to incomplete type
 if (btcoex_priority->wlan_bk_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7516:18: error: 
'WIPHY_WLAN_BK_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7518:21: error: dereferencing pointer 
to incomplete type
 if (btcoex_priority->wlan_vi_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7519:18: error: 
'WIPHY_WLAN_VI_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7521:21: error: dereferencing pointer 
to incomplete type
 if (btcoex_priority->wlan_vo_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7522:18: error: 
'WIPHY_WLAN_VO_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7524:21: error: dereferencing pointer 
to incomplete type
 if (btcoex_priority->wlan_beacon_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7525:18: error: 
'WIPHY_WLAN_BEACON_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7527:21: error: dereferencing pointer 
to incomplete type
 if (btcoex_priority->wlan_mgmt_preferred)
^
   drivers/net/wireless/ath/ath10k/mac.c:7528:18: error: 
'WIPHY_WLAN_MGMT_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c: At top level:
   drivers/net/wireless/ath/ath10k/mac.c:7534:11: warning: 'struct 
cfg80211_btcoex_priority' declared inside parameter list
   struct cfg80211_btcoex_priority *btcoex_priority)
  ^
   drivers/net/wireless/ath/ath10k/mac.c: In function 
'ath10k_mac_op_set_btcoex_priority':
>> drivers/net/wireless/ath/ath10k/mac.c:7553:16: warning: passing argument 1 
>> of 'ath10k_mac_get_btcoex_prio' from incompatible pointer type
 btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
   ^
   drivers/net/wireless/ath/ath10k/mac.c:7508:1: note: expected 'struct 
cfg80211_btcoex_priority *' but argument is of type 'struct 
cfg80211_btcoex_priority *'
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
^
   drivers/net/wireless/ath/ath10k/mac.c: At top level:
   drivers/net/wireless/ath/ath10k/mac.c:7611:2: error: unknown field 
'set_btcoex' specified in initializer
 .set_btcoex = ath10k_mac_op_set_btcoex,
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7611:2: warning: initialization from 
incompatible pointer type
   drivers/net/wireless/ath/ath10k/mac.c:7611:2: warning: (near initialization 
for 'ath10k_ops.reconfig_complete')
   drivers/net/wire

Re: [PATCH 2/4] ath10k: Add support to update btcoex priority value via nl80211

2016-11-08 Thread kbuild test robot
Hi Tamizh,

[auto build test ERROR on ath6kl/ath-next]
[cannot apply to v4.9-rc4 next-20161108]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/ath10k-Add-support-for-BTCOEX-feature/20161109-043718
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath10k/mac.c:7508:35: warning: 'struct 
>> cfg80211_btcoex_priority' declared inside parameter list will not be visible 
>> outside of this definition or declaration
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
  ^~~~
   drivers/net/wireless/ath/ath10k/mac.c: In function 
'ath10k_mac_get_btcoex_prio':
>> drivers/net/wireless/ath/ath10k/mac.c:7512:21: error: dereferencing pointer 
>> to incomplete type 'struct cfg80211_btcoex_priority'
 if (btcoex_priority->wlan_be_preferred)
^~
>> drivers/net/wireless/ath/ath10k/mac.c:7513:18: error: 
>> 'WIPHY_WLAN_BE_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
 ^~~
   drivers/net/wireless/ath/ath10k/mac.c:7513:18: note: each undeclared 
identifier is reported only once for each function it appears in
>> drivers/net/wireless/ath/ath10k/mac.c:7516:18: error: 
>> 'WIPHY_WLAN_BK_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
 ^~~
>> drivers/net/wireless/ath/ath10k/mac.c:7519:18: error: 
>> 'WIPHY_WLAN_VI_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
 ^~~
>> drivers/net/wireless/ath/ath10k/mac.c:7522:18: error: 
>> 'WIPHY_WLAN_VO_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
 ^~~
>> drivers/net/wireless/ath/ath10k/mac.c:7525:18: error: 
>> 'WIPHY_WLAN_BEACON_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
 ^~~
>> drivers/net/wireless/ath/ath10k/mac.c:7528:18: error: 
>> 'WIPHY_WLAN_MGMT_PREFERRED' undeclared (first use in this function)
  btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
 ^
   drivers/net/wireless/ath/ath10k/mac.c: At top level:
   drivers/net/wireless/ath/ath10k/mac.c:7534:11: warning: 'struct 
cfg80211_btcoex_priority' declared inside parameter list will not be visible 
outside of this definition or declaration
   struct cfg80211_btcoex_priority *btcoex_priority)
  ^~~~
   drivers/net/wireless/ath/ath10k/mac.c: In function 
'ath10k_mac_op_set_btcoex_priority':
>> drivers/net/wireless/ath/ath10k/mac.c:7553:43: error: passing argument 1 of 
>> 'ath10k_mac_get_btcoex_prio' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
 btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
  ^~~
   drivers/net/wireless/ath/ath10k/mac.c:7508:1: note: expected 'struct 
cfg80211_btcoex_priority *' but argument is of type 'struct 
cfg80211_btcoex_priority *'
ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
^~
   drivers/net/wireless/ath/ath10k/mac.c: At top level:
   drivers/net/wireless/ath/ath10k/mac.c:7611:2: error: unknown field 
'set_btcoex' specified in initializer
 .set_btcoex = ath10k_mac_op_set_btcoex,
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7611:36: error: initialization from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 .set_btcoex = ath10k_mac_op_set_btcoex,
   ^~~~
   drivers/net/wireless/ath/ath10k/mac.c:7611:36: note: (near initialization 
for 'ath10k_ops.reconfig_complete')
>> drivers/net/wireless/ath/ath10k/mac.c:7612:2: error: unknown field 
>> 'set_btcoex_priority' specified in initializer
 .set_btcoex_priority  = ath10k_mac_op_set_btcoex_priority,
 ^
   drivers/net/wireless/ath/ath10k/mac.c:7612:26: error: initialization from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 .set_btcoex_priority  = ath10k_mac_op_set_btcoex_priority,
 ^
   drivers/n

Re: [PATCH 1/4] ath10k: Add support to enable or disable btcoex via nl80211

2016-11-08 Thread kbuild test robot
Hi Tamizh,

[auto build test ERROR on ath6kl/ath-next]
[also build test ERROR on v4.9-rc4 next-20161108]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/c_traja-qti-qualcomm-com/ath10k-Add-support-for-BTCOEX-feature/20161109-043718
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath10k/mac.c:7548:2: error: unknown field 
>> 'set_btcoex' specified in initializer
 .set_btcoex = ath10k_mac_op_set_btcoex,
 ^
>> drivers/net/wireless/ath/ath10k/mac.c:7548:36: error: initialization from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
 .set_btcoex = ath10k_mac_op_set_btcoex,
   ^~~~
   drivers/net/wireless/ath/ath10k/mac.c:7548:36: note: (near initialization 
for 'ath10k_ops.reconfig_complete')
   cc1: some warnings being treated as errors

vim +/set_btcoex +7548 drivers/net/wireless/ath/ath10k/mac.c

  7542  .add_chanctx= ath10k_mac_op_add_chanctx,
  7543  .remove_chanctx = ath10k_mac_op_remove_chanctx,
  7544  .change_chanctx = ath10k_mac_op_change_chanctx,
  7545  .assign_vif_chanctx = 
ath10k_mac_op_assign_vif_chanctx,
  7546  .unassign_vif_chanctx   = 
ath10k_mac_op_unassign_vif_chanctx,
  7547  .switch_vif_chanctx = 
ath10k_mac_op_switch_vif_chanctx,
> 7548  .set_btcoex = ath10k_mac_op_set_btcoex,
  7549  
  7550  CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
  7551  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 4/4] ath10k: Add support to read btcoex related data from DT

2016-11-08 Thread c_traja
From: Tamizh chelvam 

BTCOEX feature is not supported by all qca40xx chipsets.
Since btcoex enabled by default in firmware, host needs to
enable COEX support depends on the hardware. This patch is
used to read btcoex_support flag and btcoex gpio pin
number from DT. Depends on the btcoex_support flag value
host will expose BTCOEX support and btcoex gpio pin
number to target.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/core.c  |   44 ++-
 drivers/net/wireless/ath/ath10k/core.h  |9 +++
 drivers/net/wireless/ath/ath10k/debug.c |3 +++
 drivers/net/wireless/ath/ath10k/mac.c   |4 ++-
 drivers/net/wireless/ath/ath10k/wmi.c   |1 +
 drivers/net/wireless/ath/ath10k/wmi.h   |2 ++
 6 files changed, 61 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 7005e2a..eec2436 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1439,6 +1439,39 @@ static int ath10k_download_cal_data(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
+{
+   struct device_node *node;
+   u32 btcoex_support = 0;
+   int ret;
+
+   node = ar->dev->of_node;
+   if (!node)
+   goto out;
+
+   ret = of_property_read_u32(node, "btcoex_support", _support);
+   if (ret) {
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_FOUND;
+   goto out;
+   }
+
+   if (btcoex_support)
+   ar->btcoex_support = ATH10K_DT_BTCOEX_SUPPORTED;
+   else
+   ar->btcoex_support = ATH10K_DT_BTCOEX_NOT_SUPPORTED;
+
+   ret = of_property_read_u32(node, "btcoex_gpio_pin",
+  >btcoex_gpio_pin);
+   if (ret) {
+   ar->btcoex_gpio_pin = -1;
+   goto out;
+   }
+
+out:
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex support flag :%d gpio %d\n",
+  ar->btcoex_support, ar->btcoex_gpio_pin);
+}
+
 static int ath10k_init_uart(struct ath10k *ar)
 {
int ret;
@@ -1920,14 +1953,23 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
val |= WMI_10_4_BSS_CHANNEL_INFO_64;
 
+   ath10k_core_fetch_btcoex_dt(ar);
+
/* 10.4 firmware supports BT-Coex without reloading firmware
 * via pdev param. To support Bluetooth coexistence pdev param,
 * WMI_COEX_GPIO_SUPPORT of extended resource config should be
 * enabled always.
 */
+
+   /* we can still enable BTCOEX if firmware has the support
+* eventhough btceox_support value is
+* ATH10K_DT_BTCOEX_NOT_FOUND
+*/
+
if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map) &&
test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features))
+ar->running_fw->fw_file.fw_features) &&
+   ar->btcoex_support != ATH10K_DT_BTCOEX_NOT_SUPPORTED)
val |= WMI_10_4_COEX_GPIO_SUPPORT;
 
status = ath10k_mac_ext_resource_config(ar, val);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index b7067cc..66824c73 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -658,6 +658,12 @@ enum ath10k_tx_pause_reason {
ATH10K_TX_PAUSE_MAX,
 };
 
+enum ath10k_dt_btcoex_support_flag {
+   ATH10K_DT_BTCOEX_NOT_FOUND,
+   ATH10K_DT_BTCOEX_SUPPORTED,
+   ATH10K_DT_BTCOEX_NOT_SUPPORTED,
+};
+
 struct ath10k_fw_file {
const struct firmware *firmware;
 
@@ -926,6 +932,9 @@ struct ath10k {
u32 reg_ack_cts_timeout_orig;
} fw_coverage;
 
+   enum ath10k_dt_btcoex_support_flag btcoex_support;
+   int btcoex_gpio_pin;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
 };
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index ea30fbe..e0e316c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2149,6 +2149,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
if (strtobool(buf, ) != 0)
return -EINVAL;
 
+   if (ar->btcoex_support == ATH10K_DT_BTCOEX_NOT_SUPPORTED)
+   return -EOPNOTSUPP;
+
mutex_lock(>conf_mutex);
ret = ath10k_mac_set_btcoex(ar, val);
if (!ret)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6b0f1ea..e021951 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ 

[PATCH 3/4] dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt

2016-11-08 Thread c_traja
From: Tamizh chelvam 

There two things done in this patch.

1) 'btcoex_support' flag for BTCOEX feature support by the hardware.
2) 'wlan_btcoex_gpio' is used to fill wlan priority pin number for
   BTCOEX priority feature support.

Signed-off-by: Tamizh chelvam 
---
 .../bindings/net/wireless/qcom,ath10k.txt  |4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 74d7f0a..08150e2d 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -46,6 +46,10 @@ Optional properties:
 hw versions.
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
+- btcoex_support  : should contain eithr "0" or "1" to indicate btcoex
+   support by the hardware.
+- btcoex_gpio_pin :  btcoex gpio pin number for the device which
+supports BTCOEX.
 
 Example (to supply the calibration data alone):
 
-- 
1.7.9.5



[PATCH 1/4] ath10k: Add support to enable or disable btcoex via nl80211

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch add support to enable or disable btcoex via nl80211.
The firmware support this feature since 10.2.4.54 on 2G-only board,
dual band or 5G boards don't support this. WMI service
WMI_SERVICE_COEX_GPIO is used to identify the firmware support of this
feature.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/debug.c |   37 ++--
 drivers/net/wireless/ath/ath10k/mac.c   |   58 +++
 drivers/net/wireless/ath/ath10k/mac.h   |1 +
 3 files changed, 62 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 82a4c67..ea30fbe 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -26,6 +26,7 @@
 #include "debug.h"
 #include "hif.h"
 #include "wmi-ops.h"
+#include "mac.h"
 
 /* ms */
 #define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000
@@ -2138,7 +2139,6 @@ static ssize_t ath10k_write_btcoex(struct file *file,
size_t buf_size;
int ret;
bool val;
-   u32 pdev_param;
 
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, ubuf, buf_size))
@@ -2150,40 +2150,9 @@ static ssize_t ath10k_write_btcoex(struct file *file,
return -EINVAL;
 
mutex_lock(>conf_mutex);
-
-   if (ar->state != ATH10K_STATE_ON &&
-   ar->state != ATH10K_STATE_RESTARTED) {
-   ret = -ENETDOWN;
-   goto exit;
-   }
-
-   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val)) {
+   ret = ath10k_mac_set_btcoex(ar, val);
+   if (!ret)
ret = count;
-   goto exit;
-   }
-
-   pdev_param = ar->wmi.pdev_param->enable_btcoex;
-   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
-ar->running_fw->fw_file.fw_features)) {
-   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
-   if (ret) {
-   ath10k_warn(ar, "failed to enable btcoex: %d\n", ret);
-   ret = count;
-   goto exit;
-   }
-   } else {
-   ath10k_info(ar, "restarting firmware due to btcoex change");
-   queue_work(ar->workqueue, >restart_work);
-   }
-
-   if (val)
-   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-   else
-   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
-
-   ret = count;
-
-exit:
mutex_unlock(>conf_mutex);
 
return ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index a1a9ba1..f276391 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7447,6 +7447,63 @@ struct ath10k_mac_change_chanctx_arg {
return 0;
 }
 
+static inline void ath10k_mac_update_btcoex_flag(struct ath10k *ar, bool val)
+{
+   if (val)
+   set_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+   else
+   clear_bit(ATH10K_FLAG_BTCOEX, >dev_flags);
+}
+
+int ath10k_mac_set_btcoex(struct ath10k *ar, bool val)
+{
+   u32 pdev_param;
+   int ret;
+
+   lockdep_assert_held(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED)
+   return -ENETDOWN;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags) ^ val))
+   return 0;
+
+   pdev_param = ar->wmi.pdev_param->enable_btcoex;
+   if (test_bit(ATH10K_FW_FEATURE_BTCOEX_PARAM,
+ar->running_fw->fw_file.fw_features)) {
+   ret = ath10k_wmi_pdev_set_param(ar, pdev_param, val);
+
+   if (ret) {
+   ath10k_warn(ar,
+   "failed to modify btcoex state: %d\n", ret);
+   return ret;
+   }
+   ath10k_mac_update_btcoex_flag(ar, val);
+   } else {
+   ath10k_info(ar, "restarting firmware due to btcoex change");
+   ath10k_mac_update_btcoex_flag(ar, val);
+   queue_work(ar->workqueue, >restart_work);
+   }
+
+   return 0;
+}
+
+static int ath10k_mac_op_set_btcoex(struct ieee80211_hw *hw, bool enabled)
+{
+   int ret;
+   struct ath10k *ar = hw->priv;
+
+   if (!test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map))
+   return -EOPNOTSUPP;
+
+   mutex_lock(>conf_mutex);
+   ret = ath10k_mac_set_btcoex(ar, enabled);
+   mutex_unlock(>conf_mutex);
+
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7488,6 +7545,7 @@ struct ath10k_mac_change_chanctx_arg {
.assign_vif_chanctx = ath10k_mac_op_assign_vif_chanctx,
.unassign_vif_chanctx   = 

[PATCH 2/4] ath10k: Add support to update btcoex priority value via nl80211

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch adds support to update btcoex priority value via nl80211.
Here driver will be exposing the supported frame format for this
feature via btcoex_support_flags which is a member of
wiphy structure. 10.4 based firmware support this feature.
WMI service WMI_SERVICE_BTCOEX is used to identify the firmware support
of this feature. BTCOEX needs to enable to modify this value.

This patch has dependency of
"cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX"
patch.

Signed-off-by: Tamizh chelvam 
---
 drivers/net/wireless/ath/ath10k/mac.c |   76 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h |   19 
 drivers/net/wireless/ath/ath10k/wmi.c |   19 
 drivers/net/wireless/ath/ath10k/wmi.h |   18 +++
 4 files changed, 132 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index f276391..6b0f1ea 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -7504,6 +7504,69 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
return ret;
 }
 
+u32
+ath10k_mac_get_btcoex_prio(struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio = 0;
+
+   if (btcoex_priority->wlan_be_preferred)
+   btcoex_prio |= WIPHY_WLAN_BE_PREFERRED;
+
+   if (btcoex_priority->wlan_bk_preferred)
+   btcoex_prio |= WIPHY_WLAN_BK_PREFERRED;
+
+   if (btcoex_priority->wlan_vi_preferred)
+   btcoex_prio |= WIPHY_WLAN_VI_PREFERRED;
+
+   if (btcoex_priority->wlan_vo_preferred)
+   btcoex_prio |= WIPHY_WLAN_VO_PREFERRED;
+
+   if (btcoex_priority->wlan_beacon_preferred)
+   btcoex_prio |= WIPHY_WLAN_BEACON_PREFERRED;
+
+   if (btcoex_priority->wlan_mgmt_preferred)
+   btcoex_prio |= WIPHY_WLAN_MGMT_PREFERRED;
+
+   return btcoex_prio;
+}
+
+static int ath10k_mac_op_set_btcoex_priority(struct ieee80211_hw *hw,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   u32 btcoex_prio;
+   struct ath10k *ar = hw->priv;
+   int ret;
+
+   if (!(test_bit(ATH10K_FLAG_BTCOEX, >dev_flags))) {
+   ret = -EINVAL;
+   goto exit;
+   }
+
+   mutex_lock(>conf_mutex);
+
+   if (ar->state != ATH10K_STATE_ON &&
+   ar->state != ATH10K_STATE_RESTARTED) {
+   ret = -ENETDOWN;
+   goto exit;
+   }
+
+   btcoex_prio = ath10k_mac_get_btcoex_prio(btcoex_priority);
+
+   if (btcoex_prio > 0x3f)
+   return -E2BIG;
+
+   ret = ath10k_wmi_set_coex_param(ar, btcoex_prio);
+
+   if (ret) {
+   ath10k_warn(ar, "failed to set btcoex priority: %d\n", ret);
+   goto exit;
+   }
+
+exit:
+   mutex_unlock(>conf_mutex);
+   return ret;
+}
+
 static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue  = ath10k_mac_op_wake_tx_queue,
@@ -7546,6 +7609,7 @@ static int ath10k_mac_op_set_btcoex(struct ieee80211_hw 
*hw, bool enabled)
.unassign_vif_chanctx   = ath10k_mac_op_unassign_vif_chanctx,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.set_btcoex = ath10k_mac_op_set_btcoex,
+   .set_btcoex_priority= ath10k_mac_op_set_btcoex_priority,
 
CFG80211_TESTMODE_CMD(ath10k_tm_cmd)
 
@@ -8136,6 +8200,18 @@ int ath10k_mac_register(struct ath10k *ar)
 */
ar->hw->offchannel_tx_hw_queue = IEEE80211_MAX_QUEUES - 1;
 
+   if (test_bit(WMI_SERVICE_BTCOEX, ar->wmi.svc_map)) {
+   ar->hw->wiphy->btcoex_support_flags =
+   WIPHY_WLAN_BE_PREFERRED |
+   WIPHY_WLAN_BK_PREFERRED |
+   WIPHY_WLAN_VI_PREFERRED |
+   WIPHY_WLAN_VO_PREFERRED |
+   WIPHY_WLAN_BEACON_PREFERRED |
+   WIPHY_WLAN_MGMT_PREFERRED;
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "btcoex supported mask :%u\n",
+  ar->hw->wiphy->btcoex_support_flags);
+   }
+
switch (ar->running_fw->fw_file.wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->hw->wiphy->iface_combinations = ath10k_if_comb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index c9a8bb1..90c8390 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -197,6 +197,8 @@ struct wmi_ops {
(struct ath10k *ar,
 enum wmi_bss_survey_req_type type);
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
+   struct sk_buff 

[PATCH 0/4] ath10k: Add support for BTCOEX feature.

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch set add support to enable/disable BTCOEX via nl80211,
also support to update BTCOEX priority value for 10.4 based firmware.
Document the dt entry in qcom,ath10k.txt and reads btcoex support
flag and btcoex gpio pin detail from dt.

Tamizh chelvam (4):
  ath10k: Add support to enable or disable btcoex via nl80211
  ath10k: Add support to update btcoex priority value via nl80211
  dt: bindings: add new dt entry for BTCOEX feature in qcom,ath10k.txt
  ath10k: Add support to read btcoex related data from DT

 .../bindings/net/wireless/qcom,ath10k.txt  |4 +
 drivers/net/wireless/ath/ath10k/core.c |   44 ++-
 drivers/net/wireless/ath/ath10k/core.h |9 ++
 drivers/net/wireless/ath/ath10k/debug.c|   40 +-
 drivers/net/wireless/ath/ath10k/mac.c  |  138 +++-
 drivers/net/wireless/ath/ath10k/mac.h  |1 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h  |   19 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |   20 +++
 drivers/net/wireless/ath/ath10k/wmi.h  |   20 +++
 9 files changed, 259 insertions(+), 36 deletions(-)

-- 
1.7.9.5



[PATCH 2/4] cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This change enables user to set high priority for driver supported wlan
frames when BTCOEX enabled. The drivers that expose such capability make
use of this priority table to decide to whom the radio should be shared
(either bluetooth or WLAN). When the high priority frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise the frame type for which it supports
BTCOEX priority configuration through btcoex_support_flags.
This will be useful when wlan needs to transfer packet to avoid
connection lost or packet drop issue when BT is active on long time.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   65 +++
 include/uapi/linux/nl80211.h |   37 
 net/wireless/nl80211.c   |  101 ++
 net/wireless/rdev-ops.h  |   13 ++
 net/wireless/trace.h |   43 ++
 5 files changed, 259 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 919ed1d..d52d76b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2434,6 +2434,27 @@ struct cfg80211_nan_func {
 };
 
 /**
+ * struct cfg80211_btcoex_priority - BTCOEX support frame type
+ *
+ * This structure defines the driver supporting frame types for BTCOEX
+ *
+ * @wlan_be_preferred: best effort frames preferred over bt traffic
+ * @wlan_bk_preferred: background frames preferred over bt traffic
+ * @wlan_vi_preferred: video frames preferred over bt traffic
+ * @wlan_vo_preferred: voice frames preferred over bt traffic
+ * @wlan_beacon_preferred: beacon preferred over bt traffic
+ * @wlan_mgmt_preferred: management frames preferred ovet bt traffic
+ */
+struct cfg80211_btcoex_priority {
+   bool wlan_be_preferred;
+   bool wlan_bk_preferred;
+   bool wlan_vi_preferred;
+   bool wlan_vo_preferred;
+   bool wlan_beacon_preferred;
+   bool wlan_mgmt_preferred;
+};
+
+/**
  * struct cfg80211_ops - backend description for wireless configuration
  *
  * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2737,6 +2758,11 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  * @set_btcoex: Use this callback to call driver API when user wants to
  * enable/disable btcoex.
+ * @set_btcoex_priority: Use this callback to set wlan high
+ * priority frames over bluetooth. Driver supported wlan frames
+ * for the BTCOEX is exposed by btcoex_support_flags.
+ * When BTCOEX enabled, the high priority wlan frames will have
+ * more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3014,6 +3040,8 @@ struct cfg80211_ops {
   struct cfg80211_nan_conf *conf,
   u32 changes);
int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
+   int (*set_btcoex_priority)(struct wiphy *wiphy,
+   struct cfg80211_btcoex_priority *btcoex_priority);
 };
 
 /*
@@ -3253,6 +3281,38 @@ struct wiphy_wowlan_support {
 };
 
 /**
+ * wiphy_btcoex_support_flags
+ * This enum has the driver supported frame types for BTCOEX.
+ * @WIPHY_WLAN_BE_PREFERRED - Supports Best Effort frame for BTCOEX
+ * @WIPHY_WLAN_BK_PREFERRED - supports Background frame for BTCOEX
+ * @WIPHY_WLAN_VI_PREFERRED - supports Video frame for BTCOEX
+ * @WIPHY_WLAN_VO_PREFERRED - supports Voice frame for BTCOEX
+ * @WIPHY_WLAN_BEACON_PREFERRED - supports Beacon frame for BTCOEX
+ * @WIPHY_WLAN_MGMT_PREFERRED - supports Management frames for BTCOEX.
+ */
+
+enum wiphy_btcoex_support_flags {
+   WIPHY_WLAN_BE_PREFERRED = BIT(0),
+   WIPHY_WLAN_BK_PREFERRED = BIT(1),
+   WIPHY_WLAN_VI_PREFERRED = BIT(2),
+   WIPHY_WLAN_VO_PREFERRED = BIT(3),
+   WIPHY_WLAN_BEACON_PREFERRED = BIT(4),
+   WIPHY_WLAN_MGMT_PREFERRED   = BIT(5),
+};
+
+/**
+ * enum wiphy_btcoex_priority - BTCOEX priority level
+ * This enum defines priority level for BTCOEX
+ * WIPHY_WLAN_PREFERRED_LOW - low priority frames over BT traffic
+ * WIPHY_WLAN_PREFERRED_HIGH - high priority frames over BT traffic
+ */
+
+enum wiphy_btcoex_priority {
+   WIPHY_WLAN_PREFERRED_LOW = false,
+   WIPHY_WLAN_PREFERRED_HIGH = true,
+};
+
+/**
  * struct wiphy_coalesce_support - coalesce support data
  * @n_rules: maximum number of coalesce rules
  * @max_delay: maximum supported coalescing delay in msecs
@@ -3430,6 +3490,10 @@ struct wiphy_iftype_ext_capab {
  * used since access to it is necessarily racy, use the parameter passed
  * to the suspend() operation instead.
  *
+ * @btcoex_support_flags: This will have the driver supported
+ * frame types for BTCOEX. This value filled by using
+ * %enum wiphy_btcoex_support_flags while driver
+ * 

[PATCH 4/4] mac80211: Add support to update btcoex priority value

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver callback drv_set_btcoex_priority
to pass the priority value to driver.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|7 +++
 net/mac80211/cfg.c|9 +
 net/mac80211/driver-ops.h |   12 
 3 files changed, 28 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e7db763..3c61015 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3456,6 +3456,11 @@ enum ieee80211_reconfig_type {
  *
  * @set_btcoex_: set_btcoex: Called when BTCOEX is enabled/disabled, use
  * this callback to enable or disable btcoex.
+ * @set_btcoex_priority: Use this callback to set wlan high
+ * priority frames over bluetooth. Driver supported wlan frames
+ * for the BTCOEX is exposed by btcoex_support_flags.
+ * When BTCOEX enabled, the high priority wlan frames will have
+ * more priority than BT.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3709,6 +3714,8 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
u8 instance_id);
int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
+   int (*set_btcoex_priority)(struct ieee80211_hw *hw,
+   struct cfg80211_btcoex_priority *btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a687056..d75cf97 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3569,6 +3569,14 @@ static int ieee80211_set_btcoex(struct wiphy *wiphy, 
bool enabled)
return drv_set_btcoex(local, enabled);
 }
 
+static int ieee80211_set_btcoex_priority(struct wiphy *wiphy,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex_priority(local, btcoex_priority);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3660,4 +3668,5 @@ static int ieee80211_set_btcoex(struct wiphy *wiphy, bool 
enabled)
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_btcoex = ieee80211_set_btcoex,
+   .set_btcoex_priority = ieee80211_set_btcoex_priority,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 16d9c98..75ac3ed 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1262,4 +1262,16 @@ static inline int drv_set_btcoex(struct ieee80211_local 
*local,
return ret;
 }
 
+static inline int drv_set_btcoex_priority(struct ieee80211_local *local,
+   struct cfg80211_btcoex_priority *btcoex_priority)
+{
+   int ret = -EOPNOTSUPP;
+
+   if (local->ops->set_btcoex_priority)
+   ret = local->ops->set_btcoex_priority(>hw,
+ btcoex_priority);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
-- 
1.7.9.5



[PATCH 1/4] cfg80211: Add support to enable or disable btcoex

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch adds support to enable or disable btcoex by
adding NL80211_ATTR_WIPHY_BTCOEX_ENABLE attribute in
NL80211_CMD_SET_WIPHY command. By default BTCOEX disabled in driver.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |3 +++
 include/uapi/linux/nl80211.h |6 ++
 net/wireless/nl80211.c   |   18 ++
 net/wireless/rdev-ops.h  |   11 +++
 net/wireless/trace.h |5 +
 5 files changed, 43 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9390365..919ed1d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2735,6 +2735,8 @@ struct cfg80211_nan_func {
  * @nan_change_conf: changes NAN configuration. The changed parameters must
  * be specified in @changes (using  cfg80211_nan_conf_changes);
  * All other parameters must be ignored.
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3011,6 +3013,7 @@ struct cfg80211_ops {
   struct wireless_dev *wdev,
   struct cfg80211_nan_conf *conf,
   u32 changes);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1362d24..c47fe6c8 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1937,6 +1937,10 @@ enum nl80211_commands {
  * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
  * See  nl80211_nan_match_attributes.
  *
+ * @NL80211_ATTR_WIPHY_BTCOEX_ENABLE: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_WIPHY it contains
+ * either 0 for disable or 1 for enable btcoex.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2336,6 +2340,8 @@ enum nl80211_attrs {
NL80211_ATTR_NAN_FUNC,
NL80211_ATTR_NAN_MATCH,
 
+   NL80211_ATTR_WIPHY_BTCOEX_ENABLE,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 46cd489..5b77a41 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -414,6 +414,7 @@ enum nl80211_multicast_groups {
[NL80211_ATTR_NAN_MASTER_PREF] = { .type = NLA_U8 },
[NL80211_ATTR_NAN_DUAL] = { .type = NLA_U8 },
[NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED },
+   [NL80211_ATTR_WIPHY_BTCOEX_ENABLE] = { .type = NLA_U8 },
 };
 
 /* policy for the key attributes */
@@ -2356,6 +2357,23 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
return result;
}
 
+   if (info->attrs[NL80211_ATTR_WIPHY_BTCOEX_ENABLE]) {
+   u8 val;
+
+   if (!rdev->ops->set_btcoex)
+   return -ENOTSUPP;
+
+   val = nla_get_u8(info->attrs[NL80211_ATTR_WIPHY_BTCOEX_ENABLE]);
+
+   if (val > 1)
+   return -EINVAL;
+
+   result = rdev_set_btcoex(rdev, val);
+
+   if (result)
+   return result;
+   }
+
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
u32 tx_ant, rx_ant;
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 11cf83c..2e547c3 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1129,4 +1129,15 @@ static inline int rdev_set_qos_map(struct 
cfg80211_registered_device *rdev,
trace_rdev_return_int(>wiphy, ret);
return ret;
 }
+
+static inline int
+rdev_set_btcoex(struct cfg80211_registered_device *rdev, bool enabled)
+{
+   int ret;
+
+   trace_rdev_set_btcoex(>wiphy, enabled);
+   ret = rdev->ops->set_btcoex(>wiphy, enabled);
+   trace_rdev_return_int(>wiphy, ret);
+   return ret;
+}
 #endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index a3d0a91b..c9c6579 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3026,6 +3026,11 @@
  WIPHY_PR_ARG, __entry->n_rules)
 );
 
+DEFINE_EVENT(wiphy_enabled_evt, rdev_set_btcoex,
+   TP_PROTO(struct wiphy *wiphy, bool enabled),
+   TP_ARGS(wiphy, enabled)
+);
+
 DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
TP_ARGS(wiphy, wdev)
-- 
1.7.9.5



[PATCH 3/4] mac80211: Add support to enable or disable btcoex

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex
This API will pass user space value to driver to
enable or disabe btcoex.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|4 
 net/mac80211/cfg.c|8 
 net/mac80211/driver-ops.h |   14 ++
 net/mac80211/trace.h  |   14 ++
 4 files changed, 40 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b9b24ab..e7db763 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3453,6 +3453,9 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ *
+ * @set_btcoex_: set_btcoex: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3705,6 +3708,7 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index eb68add..a687056 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3562,6 +3562,13 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL(ieee80211_nan_func_match);
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3652,4 +3659,5 @@ void ieee80211_nan_func_match(struct ieee80211_vif *vif,
.nan_change_conf = ieee80211_nan_change_conf,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..16d9c98 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,18 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(>hw, enabled);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 92a47af..760dfb6 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,20 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled),
+   TP_ARGS(local, enabled),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   ),
+   TP_printk(LOCAL_PR_FMT " enabled:%d", LOCAL_PR_ARG, __entry->enabled)
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCH 0/4] cfg80211: mac80211: BTCOEX feature support

2016-11-08 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable btcoex
and modifying btcoex priority value via nl80211.

Tamizh chelvam (4):
  cfg80211: Add support to enable or disable btcoex
  cfg80211: Add new NL80211_CMD_SET_BTCOEX_PRIORITY to support BTCOEX
  mac80211: Add support to enable or disable btcoex
  mac80211: Add support to update btcoex priority value

 include/net/cfg80211.h   |   68 
 include/net/mac80211.h   |   11 
 include/uapi/linux/nl80211.h |   43 +++
 net/mac80211/cfg.c   |   17 ++
 net/mac80211/driver-ops.h|   26 +
 net/mac80211/trace.h |   14 +
 net/wireless/nl80211.c   |  119 ++
 net/wireless/rdev-ops.h  |   24 +
 net/wireless/trace.h |   48 +
 9 files changed, 370 insertions(+)

-- 
1.7.9.5



RE: [PATCH v2 01/12] mwifiex: check tx_hw_pending before downloading sleep confirm

2016-11-08 Thread Xinming Hu
Hi

> -Original Message-
> From: Brian Norris [mailto:briannor...@chromium.org]
> Sent: 2016年11月4日 0:12
> To: Xinming Hu
> Cc: Linux Wireless; Kalle Valo; Dmitry Torokhov; Amitkumar Karwar; Cathy Luo;
> Shengzhen Li; Xinming Hu; Wei-Ning Huang
> Subject: Re: [PATCH v2 01/12] mwifiex: check tx_hw_pending before
> downloading sleep confirm
> 
> + Wei-Ning
> 
> On Tue, Nov 01, 2016 at 08:08:17PM +0800, Xinming Hu wrote:
> > From: Shengzhen Li 
> >
> > We may get SLEEP event from firmware even if TXDone interrupt for last
> > Tx packet is still pending. In this case, we may end up accessing PCIe
> > memory for handling TXDone after power save handshake is completed.
> > This causes kernel crash with external abort.
> >
> > This patch will only allow downloading sleep confirm when no tx done
> > interrupt is pending in the hardware.
> >
> > ---
> > v2: address format issues(Brain)
> > ---
> 
> Nit: typically, it's best if the changelog is placed after the Sign-offs, so 
> that the
> first "---" line denotes the beginning of text that can be discarded. 
> (Typically
> the changelog doesn't go into the final git commit, and it also happens that
> git-am discards everything between the first "---" line and the actual patch
> content.)
> 

Ok, we will address this in updated version.

> > Signed-off-by: Cathy Luo 
> > Signed-off-by: Shengzhen Li 
> > Signed-off-by: Xinming Hu 
> > Signed-off-by: Amitkumar Karwar 
> > ---
> >  drivers/net/wireless/marvell/mwifiex/cmdevt.c | 5 +++--
> >  drivers/net/wireless/marvell/mwifiex/init.c   | 1 +
> >  drivers/net/wireless/marvell/mwifiex/main.h   | 1 +
> >  drivers/net/wireless/marvell/mwifiex/pcie.c   | 5 +
> >  4 files changed, 10 insertions(+), 2 deletions(-)
> 
> Overall, I think this change is good, and it tests out fine for me so far. Do 
> we
> have the same problem for other interfaces too? e.g., SDIO?
> It seems to me that the root problem is generic (i.e., don't try to SLEEP 
> while
> processing TX traffic) but the symptom just happened to be fatal on a
> particular PCIe controller.
> 

For SDIO interface, command 53 write return indicate tx complete on the bus, no 
any pending packets in hardware then.
So, SDIO interface don't have the same issue as PCIE. 

> Brian
> 
> > diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > index 5347728..25a7475 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> > @@ -1118,13 +1118,14 @@ mwifiex_cancel_pending_ioctl(struct
> > mwifiex_adapter *adapter)  void  mwifiex_check_ps_cond(struct
> > mwifiex_adapter *adapter)  {
> > -   if (!adapter->cmd_sent &&
> > +   if (!adapter->cmd_sent && !atomic_read(>tx_hw_pending) &&
> > !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter))
> > mwifiex_dnld_sleep_confirm_cmd(adapter);
> > else
> > mwifiex_dbg(adapter, CMD,
> > -   "cmd: Delay Sleep Confirm (%s%s%s)\n",
> > +   "cmd: Delay Sleep Confirm (%s%s%s%s)\n",
> > (adapter->cmd_sent) ? "D" : "",
> > +   atomic_read(>tx_hw_pending) ? "T" : "",
> > (adapter->curr_cmd) ? "C" : "",
> > (IS_CARD_RX_RCVD(adapter)) ? "R" : "");  } diff 
> > --git
> > a/drivers/net/wireless/marvell/mwifiex/init.c
> > b/drivers/net/wireless/marvell/mwifiex/init.c
> > index 82839d9..b36cb3f 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/init.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/init.c
> > @@ -270,6 +270,7 @@ static void mwifiex_init_adapter(struct
> mwifiex_adapter *adapter)
> > adapter->adhoc_11n_enabled = false;
> >
> > mwifiex_wmm_init(adapter);
> > +   atomic_set(>tx_hw_pending, 0);
> >
> > sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *)
> > adapter->sleep_cfm->data;
> > diff --git a/drivers/net/wireless/marvell/mwifiex/main.h
> > b/drivers/net/wireless/marvell/mwifiex/main.h
> > index d61fe3a..7f67f23 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/main.h
> > +++ b/drivers/net/wireless/marvell/mwifiex/main.h
> > @@ -857,6 +857,7 @@ struct mwifiex_adapter {
> > atomic_t rx_pending;
> > atomic_t tx_pending;
> > atomic_t cmd_pending;
> > +   atomic_t tx_hw_pending;
> > struct workqueue_struct *workqueue;
> > struct work_struct main_work;
> > struct workqueue_struct *rx_workqueue; diff --git
> > a/drivers/net/wireless/marvell/mwifiex/pcie.c
> > b/drivers/net/wireless/marvell/mwifiex/pcie.c
> > index 063c707..4aa5d91 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> > @@ -516,6 +516,7 @@ static int mwifiex_pcie_enable_host_int(struct
> mwifiex_adapter *adapter)
> > }
> > }
> >
> > +