[PATCH] mac80211: release channel on auth failure

2015-06-02 Thread Michal Kazior
There were a few rare cases when upon
authentication failure channel wasn't released.
This could cause stale pointers to remain in
chanctx assigned_vifs after interface removal and
trigger general protection fault later.

This could be triggered, e.g. on ath10k with the
following steps:

 1. start an AP
 2. create 2 extra vifs on ath10k host
 3. connect vif1 to the AP
 4. connect vif2 to the AP
(auth fails because ath10k firmware isn't able
 to maintain 2 peers with colliding AP mac
 addresses across vifs and consequently
 refuses sta_info_insert() in
 ieee80211_prep_connection())
 5. remove the 2 extra vifs
 6. goto step 2; at step 3 kernel was crashing:

 general protection fault:  [#1] SMP DEBUG_PAGEALLOC
 Modules linked in: ath10k_pci ath10k_core ath
 ...
 Call Trace:
  [] ieee80211_check_combinations+0x22b/0x290
  [] ? ieee80211_check_concurrent_iface+0x125/0x220
  [] ? netpoll_poll_disable+0x84/0x100
  [] ieee80211_check_concurrent_iface+0x133/0x220
  [] ieee80211_open+0x3e/0x80
  [] __dev_open+0xb6/0x130
  [] __dev_change_flags+0xa1/0x170
 ...
 RIP  [] ieee80211_chanctx_radar_detect+0xa0/0x170

 (gdb) l * ieee80211_chanctx_radar_detect+0xa0
 0x81a23140 is in ieee80211_chanctx_radar_detect 
(/devel/src/linux/net/mac80211/util.c:3182).
 3177 */
 3178WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER 
&&
 3179!list_empty(&ctx->assigned_vifs));
 3180
 3181list_for_each_entry(sdata, &ctx->assigned_vifs, 
assigned_chanctx_list)
 3182if (sdata->radar_required)
 3183radar_detect |= 
BIT(sdata->vif.bss_conf.chandef.width);
 3184
 3185return radar_detect;

Signed-off-by: Michal Kazior 
---
 net/mac80211/mlme.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 387fe70ab126..e7ef6f15b687 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4589,6 +4589,9 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data 
*sdata,
eth_zero_addr(ifmgd->bssid);
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
ifmgd->auth_data = NULL;
+   mutex_lock(&sdata->local->mtx);
+   ieee80211_vif_release_channel(sdata);
+   mutex_unlock(&sdata->local->mtx);
  err_free:
kfree(auth_data);
return err;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] mac80211: convert HW flags to unsigned long bitmap

2015-06-02 Thread Joe Perches
On Tue, 2015-06-02 at 21:39 +0200, Johannes Berg wrote:
> From: Johannes Berg 
> 
> As we're running out of hardware capability flags pretty quickly,
> convert them to use the regular test_bit() style unsigned long
> bitmaps.

I think this is nice, thanks.

> diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
[]
> @@ -1369,9 +1369,9 @@ static void adm8211_configure_filter(struct 
> ieee80211_hw *dev,
[]
> - dev->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
> + ieee80211_hw_set(dev, RX_INCLUDES_FCS);
[]
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
[]
> @@ -1889,35 +1889,38 @@ struct ieee80211_txq {
[]
>  enum ieee80211_hw_flags {
> - IEEE80211_HW_HAS_RATE_CONTROL   = 1<<0,
> - IEEE80211_HW_RX_INCLUDES_FCS= 1<<1,
[]
> + IEEE80211_HW_HAS_RATE_CONTROL,
> + IEEE80211_HW_RX_INCLUDES_FCS,

It may be nicer to use specified bit numbers here.

It may make compatibility easier and maybe it should be
written down that new entries are only to be added at
the bottom of the enum and not inserted in the middle.

[]

> +static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
> +enum ieee80211_hw_flags flg)
> +{
> + return test_bit(flg, hw->flags);
> +}
> +#define ieee80211_hw_check(hw, flg)  _ieee80211_hw_check(hw, 
> IEEE80211_HW_##flg)
> +
> +static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
> +  enum ieee80211_hw_flags flg)
> +{
> + return __set_bit(flg, hw->flags);
> +}

This is similar to the broadcom tg3 driver, but a little different.

The mechanism in tg3 compared to ieee80211_hw is
tg3_flagieee80211_hw_check
tg3_flag_setieee80211_hw_set
tg3_flag_clear  ?

Would a ieee80211_hw_clear be useful?
Would it be clearer without the _check?

>  static ssize_t hwflags_read(struct file *file, char __user *user_buf,
>   size_t count, loff_t *ppos)
>  {
[]
> + for (i = 0; i < NUM_IEEE80211_HW_FLAGS; i++) {
> + if (test_bit(i, local->hw.flags))

Maybe use the ieee80211_hw_check() function?


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 14/17] mwifiex: advertise PS ON by default support to cfg80211

2015-06-02 Thread Avinash Patil
This would enable driver to enter powersave as soon as connected.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index f14cad7..b15e4c7 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -3685,7 +3685,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter 
*adapter)
WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
WIPHY_FLAG_AP_UAPSD |
WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
-   WIPHY_FLAG_HAS_CHANNEL_SWITCH;
+   WIPHY_FLAG_HAS_CHANNEL_SWITCH |
+   WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 17/17] mwifiex: do not decrease tx_pending for AMSDU packet once more

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

Negative adapter->tx_pending is observed while running data traffic,
because tx_pending is decreased once more for AMSDU packet.

since tx_pending have been decreased for all the source MSDU packets,
we don't need to update once more for AMSDU packet.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Avinash Patil 
---
 drivers/net/wireless/mwifiex/txrx.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/txrx.c 
b/drivers/net/wireless/mwifiex/txrx.c
index c4c7d8d..5ed9b79 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -319,11 +319,11 @@ int mwifiex_write_data_complete(struct mwifiex_adapter 
*adapter,
priv->stats.tx_errors++;
}
 
-   if (tx_info->flags & MWIFIEX_BUF_FLAG_BRIDGED_PKT) {
+   if (tx_info->flags & MWIFIEX_BUF_FLAG_BRIDGED_PKT)
atomic_dec_return(&adapter->pending_bridged_pkts);
-   if (tx_info->flags & MWIFIEX_BUF_FLAG_AGGR_PKT)
-   goto done;
-   }
+
+   if (tx_info->flags & MWIFIEX_BUF_FLAG_AGGR_PKT)
+   goto done;
 
if (aggr)
/* For skb_aggr, do not wake up tx queue */
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 15/17] mwifiex: update AP WMM settings from BSS_START event

2015-06-02 Thread Avinash Patil
This was missing and would cause issue in WMM handling.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/uap_event.c | 63 
 1 file changed, 63 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/uap_event.c 
b/drivers/net/wireless/mwifiex/uap_event.c
index 06ce3fe..fee05f5 100644
--- a/drivers/net/wireless/mwifiex/uap_event.c
+++ b/drivers/net/wireless/mwifiex/uap_event.c
@@ -21,8 +21,70 @@
 #include "main.h"
 #include "11n.h"
 
+#define MWIFIEX_BSS_START_EVT_FIX_SIZE12
 
+static int mwifiex_check_uap_capabilties(struct mwifiex_private *priv,
+struct sk_buff *event)
+{
+   int evt_len;
+   u8 *curr;
+   u16 tlv_len;
+   struct mwifiex_ie_types_data *tlv_hdr;
+   struct ieee_types_wmm_parameter *wmm_param_ie = NULL;
+   int mask = IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK;
+
+   priv->wmm_enabled = false;
+   skb_pull(event, MWIFIEX_BSS_START_EVT_FIX_SIZE);
+   evt_len = event->len;
+   curr = event->data;
+
+   mwifiex_dbg_dump(priv->adapter, EVT_D, "uap capabilties:",
+event->data, event->len);
+
+   while ((evt_len >= sizeof(tlv_hdr->header))) {
+   tlv_hdr = (struct mwifiex_ie_types_data *)curr;
+   tlv_len = le16_to_cpu(tlv_hdr->header.len);
+
+   if (evt_len < tlv_len + sizeof(tlv_hdr->header))
+   break;
+
+   switch (le16_to_cpu(tlv_hdr->header.type)) {
+   case WLAN_EID_HT_CAPABILITY:
+   priv->ap_11n_enabled = true;
+   break;
+
+   case WLAN_EID_VHT_CAPABILITY:
+   priv->ap_11ac_enabled = true;
+   break;
 
+   case WLAN_EID_VENDOR_SPECIFIC:
+   /* Point the regular IEEE IE 2 bytes into the Marvell IE
+* and setup the IEEE IE type and length byte fields
+*/
+   wmm_param_ie = (void *)(curr + 2);
+   wmm_param_ie->vend_hdr.len = (u8)tlv_len;
+   wmm_param_ie->vend_hdr.element_id =
+   WLAN_EID_VENDOR_SPECIFIC;
+   mwifiex_dbg(priv->adapter, EVENT,
+   "info: check uap capabilities:\t"
+   "wmm parameter set count: %d\n",
+   wmm_param_ie->qos_info_bitmap & mask);
+
+   mwifiex_wmm_setup_ac_downgrade(priv);
+   priv->wmm_enabled = true;
+   mwifiex_wmm_setup_queue_priorities(priv, wmm_param_ie);
+   break;
+
+   default:
+   break;
+   }
+
+   curr += (tlv_len + sizeof(tlv_hdr->header));
+   evt_len -= (tlv_len + sizeof(tlv_hdr->header));
+   }
+
+   return 0;
+}
 
 /*
  * This function handles AP interface specific events generated by firmware.
@@ -134,6 +196,7 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
   ETH_ALEN);
if (priv->hist_data)
mwifiex_hist_data_reset(priv);
+   mwifiex_check_uap_capabilties(priv, adapter->event_skb);
break;
case EVENT_UAP_MIC_COUNTERMEASURES:
/* For future development */
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 16/17] mwifiex: using right tid for addressing ra_list

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

This patch fixes issue with the accessing correct ra_list by
downgrading corresponding tid number.

Alternatively, ra lists are created in mwifiex_wmm_add_buf_txqueue
using downgraded tid number.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Avinash Patil 
---
 drivers/net/wireless/mwifiex/11n.c   | 11 ---
 drivers/net/wireless/mwifiex/11n_rxreorder.c |  5 -
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11n.c 
b/drivers/net/wireless/mwifiex/11n.c
index 8422986..4d8ef49 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -156,7 +156,7 @@ int mwifiex_ret_11n_delba(struct mwifiex_private *priv,
 int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
  struct host_cmd_ds_command *resp)
 {
-   int tid;
+   int tid, tid_down;
struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &resp->params.add_ba_rsp;
struct mwifiex_tx_ba_stream_tbl *tx_ba_tbl;
struct mwifiex_ra_list_tbl *ra_list;
@@ -167,7 +167,9 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
 
tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
   >> BLOCKACKPARAM_TID_POS;
-   ra_list = mwifiex_wmm_get_ralist_node(priv, tid, add_ba_rsp->
+
+   tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
+   ra_list = mwifiex_wmm_get_ralist_node(priv, tid_down, add_ba_rsp->
peer_mac_addr);
if (le16_to_cpu(add_ba_rsp->status_code) != BA_RESULT_SUCCESS) {
if (ra_list) {
@@ -530,13 +532,16 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, 
u8 *ra, int tid,
struct mwifiex_tx_ba_stream_tbl *new_node;
struct mwifiex_ra_list_tbl *ra_list;
unsigned long flags;
+   int tid_down;
 
if (!mwifiex_get_ba_tbl(priv, tid, ra)) {
new_node = kzalloc(sizeof(struct mwifiex_tx_ba_stream_tbl),
   GFP_ATOMIC);
if (!new_node)
return;
-   ra_list = mwifiex_wmm_get_ralist_node(priv, tid, ra);
+
+   tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
+   ra_list = mwifiex_wmm_get_ralist_node(priv, tid_down, ra);
if (ra_list) {
ra_list->ba_status = ba_status;
ra_list->amsdu_in_ampdu = false;
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c 
b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 39d7a95..64401a7 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -663,6 +663,7 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, 
u8 *peer_mac,
struct mwifiex_ra_list_tbl *ra_list;
u8 cleanup_rx_reorder_tbl;
unsigned long flags;
+   int tid_down;
 
if (type == TYPE_DELBA_RECEIVE)
cleanup_rx_reorder_tbl = (initiator) ? true : false;
@@ -688,7 +689,9 @@ mwifiex_del_ba_tbl(struct mwifiex_private *priv, int tid, 
u8 *peer_mac,
"event: TID, RA not found in table\n");
return;
}
-   ra_list = mwifiex_wmm_get_ralist_node(priv, tid, peer_mac);
+
+   tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
+   ra_list = mwifiex_wmm_get_ralist_node(priv, tid_down, peer_mac);
if (ra_list) {
ra_list->amsdu_in_ampdu = false;
ra_list->ba_status = BA_SETUP_NONE;
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 13/17] mwifiex: drop block-ack action frames

2015-06-02 Thread Avinash Patil
We often see ADDBA request packets coming to driver because driver
has registered for action frame subtype. We dont process BA action
frames in host; drop such frames.

Signed-off-by: Avinash Patil 
Signed-off-by: Xinmin Hu 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/util.c | 43 +
 1 file changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/util.c 
b/drivers/net/wireless/mwifiex/util.c
index 2e3dc07..790e619 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -329,7 +329,7 @@ mwifiex_parse_mgmt_packet(struct mwifiex_private *priv, u8 
*payload, u16 len,
  struct rxpd *rx_pd)
 {
u16 stype;
-   u8 category, action_code;
+   u8 category, action_code, *addr2;
struct ieee80211_hdr *ieee_hdr = (void *)payload;
 
stype = (le16_to_cpu(ieee_hdr->frame_control) & IEEE80211_FCTL_STYPE);
@@ -337,21 +337,35 @@ mwifiex_parse_mgmt_packet(struct mwifiex_private *priv, 
u8 *payload, u16 len,
switch (stype) {
case IEEE80211_STYPE_ACTION:
category = *(payload + sizeof(struct ieee80211_hdr));
-   action_code = *(payload + sizeof(struct ieee80211_hdr) + 1);
-   if (category == WLAN_CATEGORY_PUBLIC &&
-   action_code == WLAN_PUB_ACTION_TDLS_DISCOVER_RES) {
+   switch (category) {
+   case WLAN_CATEGORY_PUBLIC:
+   action_code = *(payload + sizeof(struct ieee80211_hdr)
+   + 1);
+   if (action_code == WLAN_PUB_ACTION_TDLS_DISCOVER_RES) {
+   addr2 = ieee_hdr->addr2;
+   mwifiex_dbg(priv->adapter, INFO,
+   "TDLS discovery response %pM nf=%d, 
snr=%d\n",
+   addr2, rx_pd->nf, rx_pd->snr);
+   mwifiex_auto_tdls_update_peer_signal(priv,
+addr2,
+rx_pd->snr,
+rx_pd->nf);
+   }
+   break;
+   case WLAN_CATEGORY_BACK:
+   /*we dont indicate BACK action frames to cfg80211*/
+   mwifiex_dbg(priv->adapter, INFO,
+   "drop BACK action frames");
+   return -1;
+   default:
mwifiex_dbg(priv->adapter, INFO,
-   "TDLS discovery response %pM nf=%d, 
snr=%d\n",
-   ieee_hdr->addr2, rx_pd->nf, rx_pd->snr);
-   mwifiex_auto_tdls_update_peer_signal(priv,
-ieee_hdr->addr2,
-rx_pd->snr,
-rx_pd->nf);
+   "unknown public action frame category %d\n",
+   category);
}
-   break;
default:
mwifiex_dbg(priv->adapter, INFO,
-   "unknown mgmt frame subtype %#x\n", stype);
+   "unknown mgmt frame subtype %#x\n", stype);
+   return 0;
}
 
return 0;
@@ -387,8 +401,9 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 
ieee_hdr = (void *)skb->data;
if (ieee80211_is_mgmt(ieee_hdr->frame_control)) {
-   mwifiex_parse_mgmt_packet(priv, (u8 *)ieee_hdr,
- pkt_len, rx_pd);
+   if (mwifiex_parse_mgmt_packet(priv, (u8 *)ieee_hdr,
+ pkt_len, rx_pd))
+   return -1;
}
/* Remove address4 */
memmove(skb->data + sizeof(struct ieee80211_hdr_3addr),
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 07/17] mwifiex: add cfg80211 get_channel handler

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

This patch add cfg80211 get_channel handler for mwifiex.
The handler will be used to report current channel to upper
layer utility.

Signed-off-by: Xinming Hu 
Signed-off-by: Cathy Luo 
Signed-off-by: Avinash Patil 
---
 drivers/net/wireless/mwifiex/11h.c  |  2 +-
 drivers/net/wireless/mwifiex/cfg80211.c | 58 -
 drivers/net/wireless/mwifiex/main.h |  5 ++-
 drivers/net/wireless/mwifiex/uap_cmd.c  |  5 ++-
 4 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11h.c 
b/drivers/net/wireless/mwifiex/11h.c
index bb2ffd9..71a1b58 100644
--- a/drivers/net/wireless/mwifiex/11h.c
+++ b/drivers/net/wireless/mwifiex/11h.c
@@ -305,7 +305,7 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct 
*work)
return;
}
 
-   mwifiex_uap_set_channel(bss_cfg, priv->dfs_chandef);
+   mwifiex_uap_set_channel(priv, bss_cfg, priv->dfs_chandef);
 
if (mwifiex_config_start_uap(priv, bss_cfg)) {
mwifiex_dbg(priv->adapter, ERROR,
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index fb93e13..ddeb919 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -67,6 +67,22 @@ u8 mwifiex_chan_type_to_sec_chan_offset(enum 
nl80211_channel_type chan_type)
}
 }
 
+/* This function maps IEEE HT secondary channel type to NL80211 channel type
+ */
+u8 mwifiex_sec_chan_offset_to_chan_type(u8 second_chan_offset)
+{
+   switch (second_chan_offset) {
+   case IEEE80211_HT_PARAM_CHA_SEC_NONE:
+   return NL80211_CHAN_HT20;
+   case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+   return NL80211_CHAN_HT40PLUS;
+   case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+   return NL80211_CHAN_HT40MINUS;
+   default:
+   return NL80211_CHAN_HT20;
+   }
+}
+
 /*
  * This function checks whether WEP is set.
  */
@@ -1785,7 +1801,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
return -EINVAL;
}
 
-   mwifiex_uap_set_channel(bss_cfg, params->chandef);
+   mwifiex_uap_set_channel(priv, bss_cfg, params->chandef);
mwifiex_set_uap_rates(bss_cfg, params);
 
if (mwifiex_set_secure_params(priv, bss_cfg, params)) {
@@ -3373,6 +3389,45 @@ mwifiex_cfg80211_channel_switch(struct wiphy *wiphy, 
struct net_device *dev,
return 0;
 }
 
+static int mwifiex_cfg80211_get_channel(struct wiphy *wiphy,
+   struct wireless_dev *wdev,
+   struct cfg80211_chan_def *chandef)
+{
+   struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
+   struct mwifiex_bssdescriptor *curr_bss;
+   struct ieee80211_channel *chan;
+   u8 second_chan_offset;
+   enum nl80211_channel_type chan_type;
+   enum ieee80211_band band;
+   int freq;
+   int ret = -ENODATA;
+
+   if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP &&
+   cfg80211_chandef_valid(&priv->bss_chandef)) {
+   *chandef = priv->bss_chandef;
+   ret = 0;
+   } else if (priv->media_connected) {
+   curr_bss = &priv->curr_bss_params.bss_descriptor;
+   band = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
+   freq = ieee80211_channel_to_frequency(curr_bss->channel, band);
+   chan = ieee80211_get_channel(wiphy, freq);
+
+   if (curr_bss->bcn_ht_oper) {
+   second_chan_offset = curr_bss->bcn_ht_oper->ht_param &
+   IEEE80211_HT_PARAM_CHA_SEC_OFFSET;
+   chan_type = mwifiex_sec_chan_offset_to_chan_type
+   (second_chan_offset);
+   cfg80211_chandef_create(chandef, chan, chan_type);
+   } else {
+   cfg80211_chandef_create(chandef, chan,
+   NL80211_CHAN_NO_HT);
+   }
+   ret = 0;
+   }
+
+   return ret;
+}
+
 static int
 mwifiex_cfg80211_start_radar_detection(struct wiphy *wiphy,
   struct net_device *dev,
@@ -3478,6 +3533,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
.tdls_oper = mwifiex_cfg80211_tdls_oper,
.add_station = mwifiex_cfg80211_add_station,
.change_station = mwifiex_cfg80211_change_station,
+   .get_channel = mwifiex_cfg80211_get_channel,
.start_radar_detection = mwifiex_cfg80211_start_radar_detection,
.channel_switch = mwifiex_cfg80211_channel_switch,
 };
diff --git a/drivers/net/wireless/mwifiex/main.h 
b/drivers/net/wireless/mwifiex/main.h
index 3ac18c6..88d3779 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -642,6 +642,7 @@ struct mwifiex_private {
   

[PATCHv5 11/17] mwifiex: parse power constraint IE from Tail

2015-06-02 Thread Avinash Patil
This patch adds support to parse power constraint IEs from
Tail buffer. This power constraint is then set to FW during
bss_config download.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c |  3 +++
 drivers/net/wireless/mwifiex/fw.h   |  6 ++
 drivers/net/wireless/mwifiex/ioctl.h|  1 +
 drivers/net/wireless/mwifiex/main.h |  3 +++
 drivers/net/wireless/mwifiex/uap_cmd.c  | 27 +++
 5 files changed, 40 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index 5274502..f14cad7 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1867,6 +1867,9 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
 
mwifiex_set_wmm_params(priv, bss_cfg, params);
 
+   if (mwifiex_is_11h_active(priv))
+   mwifiex_set_tpc_params(priv, bss_cfg, params);
+
if (mwifiex_is_11h_active(priv) &&
!cfg80211_chandef_dfs_required(wiphy, ¶ms->chandef,
   priv->bss_mode)) {
diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index bcf08c9..72f161e 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -128,6 +128,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 
 #define TLV_TYPE_UAP_SSID  0x
 #define TLV_TYPE_UAP_RATES 0x0001
+#define TLV_TYPE_PWR_CONSTRAINT0x0020
 
 #define PROPRIETARY_TLV_BASE_ID 0x0100
 #define TLV_TYPE_KEY_MATERIAL   (PROPRIETARY_TLV_BASE_ID + 0)
@@ -1780,6 +1781,11 @@ struct host_cmd_tlv_ageout_timer {
__le32 sta_ao_timer;
 } __packed;
 
+struct host_cmd_tlv_power_constraint {
+   struct mwifiex_ie_types_header header;
+   u8 constraint;
+} __packed;
+
 struct host_cmd_ds_version_ext {
u8 version_str_sel;
char version_str[128];
diff --git a/drivers/net/wireless/mwifiex/ioctl.h 
b/drivers/net/wireless/mwifiex/ioctl.h
index 6f11a25..4f0174c 100644
--- a/drivers/net/wireless/mwifiex/ioctl.h
+++ b/drivers/net/wireless/mwifiex/ioctl.h
@@ -113,6 +113,7 @@ struct mwifiex_uap_bss_param {
u32 sta_ao_timer;
u32 ps_sta_ao_timer;
u8 qos_info;
+   u8 power_constraint;
struct mwifiex_types_wmm_info wmm_info;
 };
 
diff --git a/drivers/net/wireless/mwifiex/main.h 
b/drivers/net/wireless/mwifiex/main.h
index 837e610..d92c527 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1149,6 +1149,9 @@ void mwifiex_set_ht_params(struct mwifiex_private *priv,
 void mwifiex_set_vht_params(struct mwifiex_private *priv,
struct mwifiex_uap_bss_param *bss_cfg,
struct cfg80211_ap_settings *params);
+void mwifiex_set_tpc_params(struct mwifiex_private *priv,
+   struct mwifiex_uap_bss_param *bss_cfg,
+   struct cfg80211_ap_settings *params);
 void mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
   struct cfg80211_ap_settings *params);
 void mwifiex_set_vht_width(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c 
b/drivers/net/wireless/mwifiex/uap_cmd.c
index 9510f1e..a62b43e 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -222,6 +222,23 @@ void mwifiex_set_vht_params(struct mwifiex_private *priv,
return;
 }
 
+/* This function updates 11ac related parameters from IE
+ * and sets them into bss_config structure.
+ */
+void mwifiex_set_tpc_params(struct mwifiex_private *priv,
+   struct mwifiex_uap_bss_param *bss_cfg,
+   struct cfg80211_ap_settings *params)
+{
+   const u8 *tpc_ie;
+
+   tpc_ie = cfg80211_find_ie(WLAN_EID_TPC_REQUEST, params->beacon.tail,
+ params->beacon.tail_len);
+   if (tpc_ie)
+   bss_cfg->power_constraint = *(tpc_ie + 2);
+   else
+   bss_cfg->power_constraint = 0;
+}
+
 /* Enable VHT only when cfg80211_ap_settings has VHT IE.
  * Otherwise disable VHT.
  */
@@ -466,6 +483,7 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 
*param_size)
struct host_cmd_tlv_auth_type *auth_type;
struct host_cmd_tlv_rates *tlv_rates;
struct host_cmd_tlv_ageout_timer *ao_timer, *ps_ao_timer;
+   struct host_cmd_tlv_power_constraint *pwr_ct;
struct mwifiex_ie_types_htcap *htcap;
struct mwifiex_ie_types_wmmcap *wmm_cap;
struct mwifiex_uap_bss_param *bss_cfg = cmd_buf;
@@ -644,6 +662,15 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 
*param_size)
tlv += sizeof(*ao_timer);
}
 
+   if (bss_cfg->power_constraint) {
+   pwr_ct = (void *)tlv;
+   

[PATCHv5 09/17] mwifiex: add sta_list firmware command

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

This patch add sta_list firmware command, which can be used
to get power status and rssi for the stations associated to
mwifiex micro AP.

Signed-off-by: Xinming Hu 
Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cmdevt.c  |  1 +
 drivers/net/wireless/mwifiex/fw.h  | 14 ++
 drivers/net/wireless/mwifiex/sta_cmdresp.c | 24 
 drivers/net/wireless/mwifiex/uap_cmd.c |  1 +
 4 files changed, 40 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/cmdevt.c 
b/drivers/net/wireless/mwifiex/cmdevt.c
index b5033d1..a51feac 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -575,6 +575,7 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 
cmd_no,
case HostCmd_CMD_UAP_BSS_STOP:
case HostCmd_CMD_UAP_STA_DEAUTH:
case HOST_CMD_APCMD_SYS_RESET:
+   case HOST_CMD_APCMD_STA_LIST:
ret = mwifiex_uap_prepare_cmd(priv, cmd_no, cmd_action,
  cmd_oid, data_buf,
  cmd_ptr);
diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index b6bbf9a..bcf08c9 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -334,6 +334,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define HostCmd_CMD_UAP_SYS_CONFIG0x00b0
 #define HostCmd_CMD_UAP_BSS_START 0x00b1
 #define HostCmd_CMD_UAP_BSS_STOP  0x00b2
+#define HOST_CMD_APCMD_STA_LIST   0x00b3
 #define HostCmd_CMD_UAP_STA_DEAUTH0x00b5
 #define HostCmd_CMD_11N_CFG   0x00cd
 #define HostCmd_CMD_11N_ADDBA_REQ 0x00ce
@@ -1465,6 +1466,18 @@ struct host_cmd_ds_sta_deauth {
__le16 reason;
 } __packed;
 
+struct mwifiex_ie_types_sta_info {
+   struct mwifiex_ie_types_header header;
+   u8 mac[ETH_ALEN];
+   u8 power_mfg_status;
+   s8 rssi;
+};
+
+struct host_cmd_ds_sta_list {
+   u16 sta_count;
+   u8 tlv[0];
+} __packed;
+
 struct mwifiex_ie_types_pwr_capability {
struct mwifiex_ie_types_header header;
s8 min_pwr;
@@ -1994,6 +2007,7 @@ struct host_cmd_ds_command {
struct host_cmd_ds_802_11_subsc_evt subsc_evt;
struct host_cmd_ds_sys_config uap_sys_config;
struct host_cmd_ds_sta_deauth sta_deauth;
+   struct host_cmd_ds_sta_list sta_list;
struct host_cmd_11ac_vht_cfg vht_cfg;
struct host_cmd_ds_coalesce_cfg coalesce_cfg;
struct host_cmd_ds_tdls_oper tdls_oper;
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c 
b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index f20a09e..b645884 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -958,6 +958,27 @@ static int mwifiex_ret_subsc_evt(struct mwifiex_private 
*priv,
return 0;
 }
 
+static int mwifiex_ret_uap_sta_list(struct mwifiex_private *priv,
+   struct host_cmd_ds_command *resp)
+{
+   struct host_cmd_ds_sta_list *sta_list =
+   &resp->params.sta_list;
+   struct mwifiex_ie_types_sta_info *sta_info = (void *)&sta_list->tlv;
+   int i;
+   struct mwifiex_sta_node *sta_node;
+
+   for (i = 0; i < sta_list->sta_count; i++) {
+   sta_node = mwifiex_get_sta_entry(priv, sta_info->mac);
+   if (unlikely(!sta_node))
+   continue;
+
+   sta_node->stats.rssi = sta_info->rssi;
+   sta_info++;
+   }
+
+   return 0;
+}
+
 /* This function handles the command response of set_cfg_data */
 static int mwifiex_ret_cfg_data(struct mwifiex_private *priv,
struct host_cmd_ds_command *resp)
@@ -1148,6 +1169,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private 
*priv, u16 cmdresp_no,
break;
case HostCmd_CMD_UAP_SYS_CONFIG:
break;
+   case HOST_CMD_APCMD_STA_LIST:
+   ret = mwifiex_ret_uap_sta_list(priv, resp);
+   break;
case HostCmd_CMD_UAP_BSS_START:
adapter->tx_lock_flag = false;
adapter->pps_uapsd_mode = false;
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c 
b/drivers/net/wireless/mwifiex/uap_cmd.c
index 68fbdf6..9510f1e 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -755,6 +755,7 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, 
u16 cmd_no,
case HostCmd_CMD_UAP_BSS_START:
case HostCmd_CMD_UAP_BSS_STOP:
case HOST_CMD_APCMD_SYS_RESET:
+   case HOST_CMD_APCMD_STA_LIST:
cmd->command = cpu_to_le16(cmd_no);

[PATCHv5 12/17] mwifiex: support downloading IEs from tail

2015-06-02 Thread Avinash Patil
Earlier only RSN, WPA and channel switch IEs from tail buffer would
be downloaded to FW.
This patch adds support for downloading more IEs from tail buffer.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/ie.c | 102 ++
 1 file changed, 60 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/ie.c 
b/drivers/net/wireless/mwifiex/ie.c
index f3b6ed2..0ba8945 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -320,63 +320,81 @@ done:
 /* This function parses  head and tail IEs, from cfg80211_beacon_data and sets
  * these IE to FW.
  */
-static int mwifiex_uap_set_head_tail_ies(struct mwifiex_private *priv,
-struct cfg80211_beacon_data *info)
+static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
+ struct cfg80211_beacon_data *info)
 {
struct mwifiex_ie *gen_ie;
-   struct ieee_types_header *rsn_ie = NULL, *wpa_ie = NULL;
-   struct ieee_types_header *chsw_ie = NULL;
+   struct ieee_types_header *hdr;
+   struct ieee80211_vendor_ie *vendorhdr;
u16 gen_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
-   const u8 *vendor_ie;
+   int left_len, parsed_len = 0;
+
+   if (!info->tail || !info->tail_len)
+   return 0;
 
gen_ie = kzalloc(sizeof(*gen_ie), GFP_KERNEL);
if (!gen_ie)
return -ENOMEM;
-   gen_ie->ie_index = cpu_to_le16(gen_idx);
-   gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON |
-   MGMT_MASK_PROBE_RESP |
-   MGMT_MASK_ASSOC_RESP);
 
-   if (info->tail && info->tail_len) {
-   rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
- info->tail, info->tail_len);
-   if (rsn_ie) {
-   memcpy(gen_ie->ie_buffer, rsn_ie, rsn_ie->len + 2);
-   ie_len = rsn_ie->len + 2;
-   gen_ie->ie_length = cpu_to_le16(ie_len);
+   left_len = info->tail_len;
+
+   /* Many IEs are generated in FW by parsing bss configuration.
+* Let's not add them here; else we may end up duplicating these IEs
+*/
+   while (left_len > sizeof(struct ieee_types_header)) {
+   hdr = (void *)(info->tail + parsed_len);
+   switch (hdr->element_id) {
+   case WLAN_EID_SSID:
+   case WLAN_EID_SUPP_RATES:
+   case WLAN_EID_COUNTRY:
+   case WLAN_EID_PWR_CONSTRAINT:
+   case WLAN_EID_EXT_SUPP_RATES:
+   case WLAN_EID_HT_CAPABILITY:
+   case WLAN_EID_HT_OPERATION:
+   case WLAN_EID_VHT_CAPABILITY:
+   case WLAN_EID_VHT_OPERATION:
+   case WLAN_EID_VENDOR_SPECIFIC:
+   break;
+   default:
+   memcpy(gen_ie->ie_buffer + ie_len, hdr,
+  hdr->len + sizeof(struct ieee_types_header));
+   ie_len += hdr->len + sizeof(struct ieee_types_header);
+   break;
}
+   left_len -= hdr->len + sizeof(struct ieee_types_header);
+   parsed_len += hdr->len + sizeof(struct ieee_types_header);
+   }
 
-   vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
+   /* parse only WPA vendor IE from tail, WMM IE is configured by
+* bss_config command
+*/
+   vendorhdr = (void *)cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
WLAN_OUI_TYPE_MICROSOFT_WPA,
-   info->tail,
-   info->tail_len);
-   if (vendor_ie) {
-   wpa_ie = (struct ieee_types_header *)vendor_ie;
-   memcpy(gen_ie->ie_buffer + ie_len,
-  wpa_ie, wpa_ie->len + 2);
-   ie_len += wpa_ie->len + 2;
-   gen_ie->ie_length = cpu_to_le16(ie_len);
-   }
+   info->tail, info->tail_len);
+   if (vendorhdr) {
+   memcpy(gen_ie->ie_buffer + ie_len, vendorhdr,
+  vendorhdr->len + sizeof(struct ieee_types_header));
+   ie_len += vendorhdr->len + sizeof(struct ieee_types_header);
+   }
 
-   chsw_ie = (void *)cfg80211_find_ie(WLAN_EID_CHANNEL_SWITCH,
-  info->tail, info->tail_len);
-   if (chsw_ie) {
-   memcpy(gen_ie->ie_buffer + ie_len,
-  chsw_ie, chsw_ie->len + 2);
-   ie_len += chsw_ie->len + 2;
-   ge

[PATCHv5 10/17] mwifiex: dump station support in uap mode

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

This patch extend cfg80211 dump_station handler, support for
dump stations associated to mwifiex micro AP.

Signed-off-by: Xinming Hu 
Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c | 51 +
 1 file changed, 46 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index ddeb919..5274502 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1229,6 +1229,7 @@ mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 
tx_htinfo,
  */
 static int
 mwifiex_dump_station_info(struct mwifiex_private *priv,
+ struct mwifiex_sta_node *node,
  struct station_info *sinfo)
 {
u32 rate;
@@ -1238,6 +1239,30 @@ mwifiex_dump_station_info(struct mwifiex_private *priv,
BIT(NL80211_STA_INFO_TX_BITRATE) |
BIT(NL80211_STA_INFO_SIGNAL) | 
BIT(NL80211_STA_INFO_SIGNAL_AVG);
 
+   if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) {
+   if (!node)
+   return -ENOENT;
+
+   sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME) |
+   BIT(NL80211_STA_INFO_TX_FAILED);
+   sinfo->inactive_time =
+   jiffies_to_msecs(jiffies - node->stats.last_rx);
+
+   sinfo->signal = node->stats.rssi;
+   sinfo->signal_avg = node->stats.rssi;
+   sinfo->rx_bytes = node->stats.rx_bytes;
+   sinfo->tx_bytes = node->stats.tx_bytes;
+   sinfo->rx_packets = node->stats.rx_packets;
+   sinfo->tx_packets = node->stats.tx_packets;
+   sinfo->tx_failed = node->stats.tx_failed;
+
+   mwifiex_parse_htinfo(priv, node->stats.last_tx_htinfo,
+&sinfo->txrate);
+   sinfo->txrate.legacy = node->stats.last_tx_rate * 5;
+
+   return 0;
+   }
+
/* Get signal information from the firmware */
if (mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
 HostCmd_ACT_GEN_GET, 0, NULL, true)) {
@@ -1304,7 +1329,7 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct 
net_device *dev,
if (memcmp(mac, priv->cfg_bssid, ETH_ALEN))
return -ENOENT;
 
-   return mwifiex_dump_station_info(priv, sinfo);
+   return mwifiex_dump_station_info(priv, NULL, sinfo);
 }
 
 /*
@@ -1315,13 +1340,29 @@ mwifiex_cfg80211_dump_station(struct wiphy *wiphy, 
struct net_device *dev,
  int idx, u8 *mac, struct station_info *sinfo)
 {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
+   static struct mwifiex_sta_node *node;
 
-   if (!priv->media_connected || idx)
-   return -ENOENT;
+   if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
+   priv->media_connected && idx == 0) {
+   ether_addr_copy(mac, priv->cfg_bssid);
+   return mwifiex_dump_station_info(priv, NULL, sinfo);
+   } else if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) {
+   mwifiex_send_cmd(priv, HOST_CMD_APCMD_STA_LIST,
+HostCmd_ACT_GEN_GET, 0, NULL, true);
+
+   if (node && (&node->list == &priv->sta_list)) {
+   node = NULL;
+   return -ENOENT;
+   }
 
-   memcpy(mac, priv->cfg_bssid, ETH_ALEN);
+   node = list_prepare_entry(node, &priv->sta_list, list);
+   list_for_each_entry_continue(node, &priv->sta_list, list) {
+   ether_addr_copy(mac, node->mac_addr);
+   return mwifiex_dump_station_info(priv, node, sinfo);
+   }
+   }
 
-   return mwifiex_dump_station_info(priv, sinfo);
+   return -ENOENT;
 }
 
 static int
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 06/17] mwifiex: disable CAC upon radar detection event

2015-06-02 Thread Avinash Patil
This patch adds support to disable ongoing CAC in FW upon
detecting radar during CAC period.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/11h.c  | 30 ++
 drivers/net/wireless/mwifiex/main.h |  2 ++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11h.c 
b/drivers/net/wireless/mwifiex/11h.c
index 65cd461..bb2ffd9 100644
--- a/drivers/net/wireless/mwifiex/11h.c
+++ b/drivers/net/wireless/mwifiex/11h.c
@@ -161,19 +161,38 @@ int mwifiex_cmd_issue_chan_report_request(struct 
mwifiex_private *priv,
cr_req->chan_desc.chan_width = radar_params->chandef->width;
cr_req->msec_dwell_time = cpu_to_le32(radar_params->cac_time_ms);
 
-   mwifiex_dbg(priv->adapter, MSG,
-   "11h: issuing DFS Radar check for channel=%d\n",
-   radar_params->chandef->chan->hw_value);
+   if (radar_params->cac_time_ms)
+   mwifiex_dbg(priv->adapter, MSG,
+   "11h: issuing DFS Radar check for channel=%d\n",
+   radar_params->chandef->chan->hw_value);
+   else
+   mwifiex_dbg(priv->adapter, MSG, "cancelling CAC\n");
 
return 0;
 }
 
+int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
+struct cfg80211_chan_def *chandef)
+{
+   struct mwifiex_radar_params radar_params;
+
+   memset(&radar_params, 0, sizeof(struct mwifiex_radar_params));
+   radar_params.chandef = chandef;
+   radar_params.cac_time_ms = 0;
+
+   return mwifiex_send_cmd(priv, HostCmd_CMD_CHAN_REPORT_REQUEST,
+   HostCmd_ACT_GEN_SET, 0, &radar_params, true);
+}
+
 /* This function is to abort ongoing CAC upon stopping AP operations
  * or during unload.
  */
 void mwifiex_abort_cac(struct mwifiex_private *priv)
 {
if (priv->wdev.cac_started) {
+   if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
+   mwifiex_dbg(priv->adapter, ERROR,
+   "failed to stop CAC in FW\n");
mwifiex_dbg(priv->adapter, MSG,
"Aborting delayed work for CAC.\n");
cancel_delayed_work_sync(&priv->dfs_cac_work);
@@ -245,6 +264,9 @@ int mwifiex_11h_handle_radar_detected(struct 
mwifiex_private *priv,
if (le32_to_cpu(rdr_event->passed)) {
mwifiex_dbg(priv->adapter, MSG,
"radar detected; indicating kernel\n");
+   if (mwifiex_stop_radar_detection(priv, &priv->dfs_chandef))
+   mwifiex_dbg(priv->adapter, ERROR,
+   "Failed to stop CAC in FW\n");
cfg80211_radar_event(priv->adapter->wiphy, &priv->dfs_chandef,
 GFP_KERNEL);
mwifiex_dbg(priv->adapter, MSG, "regdomain: %d\n",
@@ -252,7 +274,7 @@ int mwifiex_11h_handle_radar_detected(struct 
mwifiex_private *priv,
mwifiex_dbg(priv->adapter, MSG, "radar detection type: %d\n",
rdr_event->det_type);
} else {
-   mwifiex_dbg(priv->adapter, ERROR,
+   mwifiex_dbg(priv->adapter, MSG,
"false radar detection event!\n");
}
 
diff --git a/drivers/net/wireless/mwifiex/main.h 
b/drivers/net/wireless/mwifiex/main.h
index 5a6c1c7..3ac18c6 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -1473,6 +1473,8 @@ mwifiex_clone_skb_for_tx_status(struct mwifiex_private 
*priv,
 void mwifiex_dfs_cac_work_queue(struct work_struct *work);
 void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work);
 void mwifiex_abort_cac(struct mwifiex_private *priv);
+int mwifiex_stop_radar_detection(struct mwifiex_private *priv,
+struct cfg80211_chan_def *chandef);
 int mwifiex_11h_handle_radar_detected(struct mwifiex_private *priv,
  struct sk_buff *skb);
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 05/17] mwifiex: reset 11h active flag when chandef does not require dfs

2015-06-02 Thread Avinash Patil
This patch fixes an issue where we were still setting 11h_active
flag to true for channel defs where DFS is not required.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index d47799a..fb93e13 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1820,7 +1820,7 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,
"Failed to disable 11h extensions!!");
return -1;
}
-   priv->state_11h.is_11h_active = true;
+   priv->state_11h.is_11h_active = false;
}
 
if (mwifiex_config_start_uap(priv, bss_cfg)) {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 04/17] mwifiex: enable 11d after bss reset

2015-06-02 Thread Avinash Patil
BSS reset would reset all state information in FW.
Issue 11d config command after reset to enabled 11d in FW.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/uap_cmd.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c 
b/drivers/net/wireless/mwifiex/uap_cmd.c
index 0a3297e..56a4768 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -806,6 +806,8 @@ void mwifiex_uap_set_channel(struct mwifiex_uap_bss_param 
*bss_cfg,
 int mwifiex_config_start_uap(struct mwifiex_private *priv,
 struct mwifiex_uap_bss_param *bss_cfg)
 {
+   enum state_11d_t state_11d;
+
if (mwifiex_del_mgmt_ies(priv))
mwifiex_dbg(priv->adapter, ERROR,
"Failed to delete mgmt IEs!\n");
@@ -830,6 +832,16 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv,
return -1;
}
 
+   /* Send cmd to FW to enable 11D function */
+   state_11d = ENABLE_11D;
+   if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
+HostCmd_ACT_GEN_SET, DOT11D_I,
+&state_11d, true)) {
+   mwifiex_dbg(priv->adapter, ERROR,
+   "11D: failed to enable 11D\n");
+   return -1;
+   }
+
if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_START,
 HostCmd_ACT_GEN_SET, 0, NULL, false)) {
mwifiex_dbg(priv->adapter, ERROR,
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 08/17] mwifiex: maintain station statistic in uap mode

2015-06-02 Thread Avinash Patil
From: Xinming Hu 

This patch maintain statistic information for the stations associated
to the mwifiex micro AP, include tx/rx bytes/packets, signal strength,
tx bitrate.

Signed-off-by: Xinming Hu 
Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/fw.h   |  7 ++-
 drivers/net/wireless/mwifiex/main.h | 13 +
 drivers/net/wireless/mwifiex/txrx.c | 13 +++--
 drivers/net/wireless/mwifiex/uap_txrx.c | 18 +-
 drivers/net/wireless/mwifiex/util.c | 13 +
 5 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index 45822a8..b6bbf9a 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -632,7 +632,12 @@ struct uap_rxpd {
__le16 rx_pkt_type;
__le16 seq_num;
u8 priority;
-   u8 reserved1;
+   u8 rx_rate;
+   s8 snr;
+   s8 nf;
+   u8 ht_info;
+   u8 reserved[3];
+   u8 flags;
 };
 
 struct mwifiex_fw_chan_stats {
diff --git a/drivers/net/wireless/mwifiex/main.h 
b/drivers/net/wireless/mwifiex/main.h
index 88d3779..837e610 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -741,6 +741,18 @@ struct mwifiex_tdls_capab {
struct ieee80211_vht_operation vhtoper;
 };
 
+struct mwifiex_station_stats {
+   u64 last_rx;
+   s8 rssi;
+   u64 rx_bytes;
+   u64 tx_bytes;
+   u32 rx_packets;
+   u32 tx_packets;
+   u32 tx_failed;
+   u8 last_tx_rate;
+   u8 last_tx_htinfo;
+};
+
 /* This is AP/TDLS specific structure which stores information
  * about associated/peer STA
  */
@@ -755,6 +767,7 @@ struct mwifiex_sta_node {
u16 max_amsdu;
u8 tdls_status;
struct mwifiex_tdls_capab tdls_cap;
+   struct mwifiex_station_stats stats;
 };
 
 struct mwifiex_auto_tdls_peer {
diff --git a/drivers/net/wireless/mwifiex/txrx.c 
b/drivers/net/wireless/mwifiex/txrx.c
index 28dcc84..c4c7d8d 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -88,13 +88,22 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct 
sk_buff *skb,
struct mwifiex_adapter *adapter = priv->adapter;
u8 *head_ptr;
struct txpd *local_tx_pd = NULL;
+   struct mwifiex_sta_node *dest_node;
+   struct ethhdr *hdr = (void *)skb->data;
 
hroom = (adapter->iface_type == MWIFIEX_USB) ? 0 : INTF_HEADER_LEN;
 
-   if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
+   if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) {
+   dest_node = mwifiex_get_sta_entry(priv, hdr->h_dest);
+   if (dest_node) {
+   dest_node->stats.tx_bytes += skb->len;
+   dest_node->stats.tx_packets++;
+   }
+
head_ptr = mwifiex_process_uap_txpd(priv, skb);
-   else
+   } else {
head_ptr = mwifiex_process_sta_txpd(priv, skb);
+   }
 
if ((adapter->data_sent || adapter->tx_lock_flag) && head_ptr) {
skb_queue_tail(&adapter->tx_data_q, skb);
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c 
b/drivers/net/wireless/mwifiex/uap_txrx.c
index 61c52fd..8766741 100644
--- a/drivers/net/wireless/mwifiex/uap_txrx.c
+++ b/drivers/net/wireless/mwifiex/uap_txrx.c
@@ -97,6 +97,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct 
mwifiex_private *priv,
struct mwifiex_txinfo *tx_info;
int hdr_chop;
struct ethhdr *p_ethhdr;
+   struct mwifiex_sta_node *src_node;
 
uap_rx_pd = (struct uap_rxpd *)(skb->data);
rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset);
@@ -180,6 +181,15 @@ static void mwifiex_uap_queue_bridged_pkt(struct 
mwifiex_private *priv,
tx_info->bss_type = priv->bss_type;
tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT;
 
+   src_node = mwifiex_get_sta_entry(priv, rx_pkt_hdr->eth803_hdr.h_source);
+   if (src_node) {
+   src_node->stats.last_rx = jiffies;
+   src_node->stats.rx_bytes += skb->len;
+   src_node->stats.rx_packets++;
+   src_node->stats.last_tx_rate = uap_rx_pd->rx_rate;
+   src_node->stats.last_tx_htinfo = uap_rx_pd->ht_info;
+   }
+
if (is_unicast_ether_addr(rx_pkt_hdr->eth803_hdr.h_dest)) {
/* Update bridge packet statistics as the
 * packet is not going to kernel/upper layer.
@@ -275,6 +285,8 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private 
*priv,
rx_pkt_type = le16_to_cpu(uap_rx_pd->rx_pkt_type);
rx_pkt_hdr = (void *)uap_rx_pd + le16_to_cpu(uap_rx_pd->rx_pkt_offset);
 
+   ether_addr_copy(ta, rx_pkt_hdr->eth803_hdr.h_source);
+
if ((le16_to_cpu(uap_rx_pd->rx_pkt_offset) +
 le16_to_cpu(uap_rx_pd->rx_pkt_length)) > (u16) skb->len) {
mwifi

[PATCHv5 00/17] mwifiex patches

2015-06-02 Thread Avinash Patil
This patch series mainly adds enhancements for mwifiex AP. 
With this series, we support verbose information in station dump command
also information about AP link.
Another important enhancement is related to parsing IEs from tail of beacondata.
Few issues seen during DFS testing are also fixed in this series.
 
v2:
 - rebase 
v3, v4:
 - Address review comments by Bjørn & Joe. 
v5:
 - Removed reviewed-by as suggested by Joe and Julian
 ---
Avinash Patil (11):
  mwifiex: verbose logging for association failure messages
  mwifiex: correct bss_type assignment
  mwifiex: support AP reset after bss_stop
  mwifiex: enable 11d after bss reset
  mwifiex: reset 11h active flag when chandef does not require dfs
  mwifiex: disable CAC upon radar detection event
  mwifiex: parse power constraint IE from Tail
  mwifiex: support downloading IEs from tail
  mwifiex: drop block-ack action frames
  mwifiex: advertise PS ON by default support to cfg80211
  mwifiex: update AP WMM settings from BSS_START event

Xinming Hu (6):
  mwifiex: add cfg80211 get_channel handler
  mwifiex: maintain station statistic in uap mode
  mwifiex: add sta_list firmware command
  mwifiex: dump station support in uap mode
  mwifiex: using right tid for addressing ra_list
  mwifiex: do not decrease tx_pending for AMSDU packet once more

 drivers/net/wireless/mwifiex/11h.c   |  32 +--
 drivers/net/wireless/mwifiex/11n.c   |  11 ++-
 drivers/net/wireless/mwifiex/11n_rxreorder.c |   5 +-
 drivers/net/wireless/mwifiex/cfg80211.c  | 130 ---
 drivers/net/wireless/mwifiex/cmdevt.c|   2 +
 drivers/net/wireless/mwifiex/fw.h|  43 -
 drivers/net/wireless/mwifiex/ie.c| 102 -
 drivers/net/wireless/mwifiex/ioctl.h |   1 +
 drivers/net/wireless/mwifiex/join.c  |  30 ++-
 drivers/net/wireless/mwifiex/main.h  |  23 -
 drivers/net/wireless/mwifiex/sta_cmdresp.c   |  26 ++
 drivers/net/wireless/mwifiex/txrx.c  |  21 +++--
 drivers/net/wireless/mwifiex/uap_cmd.c   |  55 +++-
 drivers/net/wireless/mwifiex/uap_event.c |  63 +
 drivers/net/wireless/mwifiex/uap_txrx.c  |  18 +++-
 drivers/net/wireless/mwifiex/util.c  |  56 +---
 16 files changed, 525 insertions(+), 93 deletions(-)

-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 01/17] mwifiex: verbose logging for association failure messages

2015-06-02 Thread Avinash Patil
This patch adds more detailed information about association failures
 - reason and states.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/fw.h   | 15 +--
 drivers/net/wireless/mwifiex/join.c | 30 +++---
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index c404390..cf386bc 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -419,8 +419,12 @@ enum P2P_MODES {
 #define HS_CFG_COND_MAC_EVENT  0x0004
 #define HS_CFG_COND_MULTICAST_DATA 0x0008
 
-#define MWIFIEX_TIMEOUT_FOR_AP_RESP0xfffc
-#define MWIFIEX_STATUS_CODE_AUTH_TIMEOUT   2
+#define CONNECT_ERR_AUTH_ERR_STA_FAILURE   0xFFFB
+#define CONNECT_ERR_ASSOC_ERR_TIMEOUT  0xFFFC
+#define CONNECT_ERR_ASSOC_ERR_AUTH_REFUSED 0xFFFD
+#define CONNECT_ERR_AUTH_MSG_UNHANDLED 0xFFFE
+#define CONNECT_ERR_STA_FAILURE0x
+
 
 #define CMD_F_HOSTCMD   (1 << 0)
 #define CMD_F_CANCELED  (1 << 1)
@@ -1151,6 +1155,13 @@ enum SNMP_MIB_INDEX {
DOT11H_I = 10,
 };
 
+enum mwifiex_assocmd_failurepoint {
+   MWIFIEX_ASSOC_CMD_SUCCESS = 0,
+   MWIFIEX_ASSOC_CMD_FAILURE_ASSOC,
+   MWIFIEX_ASSOC_CMD_FAILURE_AUTH,
+   MWIFIEX_ASSOC_CMD_FAILURE_JOIN
+};
+
 #define MAX_SNMP_BUF_SIZE   128
 
 struct host_cmd_ds_802_11_snmp_mib {
diff --git a/drivers/net/wireless/mwifiex/join.c 
b/drivers/net/wireless/mwifiex/join.c
index 6208ef1..e233b04 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -556,6 +556,23 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private 
*priv,
return 0;
 }
 
+static const char *assoc_failure_reason_to_str(u16 cap_info)
+{
+   switch (cap_info) {
+   case CONNECT_ERR_AUTH_ERR_STA_FAILURE:
+   return "CONNECT_ERR_AUTH_ERR_STA_FAILURE";
+   case CONNECT_ERR_AUTH_MSG_UNHANDLED:
+   return "CONNECT_ERR_AUTH_MSG_UNHANDLED";
+   case CONNECT_ERR_ASSOC_ERR_TIMEOUT:
+   return "CONNECT_ERR_ASSOC_ERR_TIMEOUT";
+   case CONNECT_ERR_ASSOC_ERR_AUTH_REFUSED:
+   return "CONNECT_ERR_ASSOC_ERR_AUTH_REFUSED";
+   case CONNECT_ERR_STA_FAILURE:
+   return "CONNECT_ERR_STA_FAILURE";
+   }
+
+   return "Unknown connect failure";
+}
 /*
  * Association firmware command response handler
  *
@@ -656,11 +673,18 @@ int mwifiex_ret_802_11_associate(struct mwifiex_private 
*priv,
status_code, cap_info,
le16_to_cpu(assoc_rsp->a_id));
 
-   if (cap_info == MWIFIEX_TIMEOUT_FOR_AP_RESP) {
-   if (status_code == MWIFIEX_STATUS_CODE_AUTH_TIMEOUT)
+   mwifiex_dbg(priv->adapter, ERROR, "assoc failure: reason %s\n",
+   assoc_failure_reason_to_str(cap_info));
+   if (cap_info == CONNECT_ERR_ASSOC_ERR_TIMEOUT) {
+   if (status_code == MWIFIEX_ASSOC_CMD_FAILURE_AUTH) {
ret = WLAN_STATUS_AUTH_TIMEOUT;
-   else
+   mwifiex_dbg(priv->adapter, ERROR,
+   "ASSOC_RESP: AUTH timeout\n");
+   } else {
ret = WLAN_STATUS_UNSPECIFIED_FAILURE;
+   mwifiex_dbg(priv->adapter, ERROR,
+   "ASSOC_RESP: UNSPECIFIED 
failure\n");
+   }
} else {
ret = status_code;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 03/17] mwifiex: support AP reset after bss_stop

2015-06-02 Thread Avinash Patil
This would enable clearing of FW bss data structures when AP
operations are stopped.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c|  7 +++
 drivers/net/wireless/mwifiex/cmdevt.c  |  1 +
 drivers/net/wireless/mwifiex/fw.h  |  1 +
 drivers/net/wireless/mwifiex/sta_cmdresp.c |  2 ++
 drivers/net/wireless/mwifiex/uap_cmd.c | 10 --
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index 3a14d3a..d47799a 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1725,6 +1725,13 @@ static int mwifiex_cfg80211_stop_ap(struct wiphy *wiphy, 
struct net_device *dev)
return -1;
}
 
+   if (mwifiex_send_cmd(priv, HOST_CMD_APCMD_SYS_RESET,
+HostCmd_ACT_GEN_SET, 0, NULL, true)) {
+   mwifiex_dbg(priv->adapter, ERROR,
+   "Failed to reset BSS\n");
+   return -1;
+   }
+
return 0;
 }
 
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c 
b/drivers/net/wireless/mwifiex/cmdevt.c
index a1de83f..b5033d1 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -574,6 +574,7 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 
cmd_no,
case HostCmd_CMD_UAP_BSS_START:
case HostCmd_CMD_UAP_BSS_STOP:
case HostCmd_CMD_UAP_STA_DEAUTH:
+   case HOST_CMD_APCMD_SYS_RESET:
ret = mwifiex_uap_prepare_cmd(priv, cmd_no, cmd_action,
  cmd_oid, data_buf,
  cmd_ptr);
diff --git a/drivers/net/wireless/mwifiex/fw.h 
b/drivers/net/wireless/mwifiex/fw.h
index cf386bc..45822a8 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -330,6 +330,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define HostCmd_CMD_RSSI_INFO 0x00a4
 #define HostCmd_CMD_FUNC_INIT 0x00a9
 #define HostCmd_CMD_FUNC_SHUTDOWN 0x00aa
+#define HOST_CMD_APCMD_SYS_RESET  0x00af
 #define HostCmd_CMD_UAP_SYS_CONFIG0x00b0
 #define HostCmd_CMD_UAP_BSS_START 0x00b1
 #define HostCmd_CMD_UAP_BSS_STOP  0x00b2
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c 
b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index aa5b9a3..f20a09e 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -1159,6 +1159,8 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private 
*priv, u16 cmdresp_no,
break;
case HostCmd_CMD_UAP_STA_DEAUTH:
break;
+   case HOST_CMD_APCMD_SYS_RESET:
+   break;
case HostCmd_CMD_MEF_CFG:
break;
case HostCmd_CMD_COALESCE_CFG:
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c 
b/drivers/net/wireless/mwifiex/uap_cmd.c
index a4ae283..0a3297e 100644
--- a/drivers/net/wireless/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/mwifiex/uap_cmd.c
@@ -754,6 +754,7 @@ int mwifiex_uap_prepare_cmd(struct mwifiex_private *priv, 
u16 cmd_no,
break;
case HostCmd_CMD_UAP_BSS_START:
case HostCmd_CMD_UAP_BSS_STOP:
+   case HOST_CMD_APCMD_SYS_RESET:
cmd->command = cpu_to_le16(cmd_no);
cmd->size = cpu_to_le16(S_DS_GEN);
break;
@@ -811,8 +812,13 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv,
 
if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_STOP,
 HostCmd_ACT_GEN_SET, 0, NULL, true)) {
-   mwifiex_dbg(priv->adapter, ERROR,
-   "Failed to stop the BSS\n");
+   mwifiex_dbg(priv->adapter, ERROR, "Failed to stop the BSS\n");
+   return -1;
+   }
+
+   if (mwifiex_send_cmd(priv, HOST_CMD_APCMD_SYS_RESET,
+HostCmd_ACT_GEN_SET, 0, NULL, true)) {
+   mwifiex_dbg(priv->adapter, ERROR, "Failed to reset BSS\n");
return -1;
}
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv5 02/17] mwifiex: correct bss_type assignment

2015-06-02 Thread Avinash Patil
Correct bss_type assignment in add_virtual_interface.
This would ensure correct operation in multiple station scenarios.

Signed-off-by: Avinash Patil 
Signed-off-by: Cathy Luo 
---
 drivers/net/wireless/mwifiex/cfg80211.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/cfg80211.c 
b/drivers/net/wireless/mwifiex/cfg80211.c
index 4eeceda..3a14d3a 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2518,7 +2518,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II;
priv->bss_priority = 0;
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
-   priv->bss_num = 0;
+   priv->bss_num = adapter->curr_iface_comb.sta_intf;
 
break;
case NL80211_IFTYPE_AP:
@@ -2544,7 +2544,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
priv->bss_priority = 0;
priv->bss_role = MWIFIEX_BSS_ROLE_UAP;
priv->bss_started = 0;
-   priv->bss_num = 0;
+   priv->bss_num = adapter->curr_iface_comb.uap_intf;
priv->bss_mode = type;
 
break;
@@ -2580,7 +2580,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct 
wiphy *wiphy,
priv->bss_priority = MWIFIEX_BSS_ROLE_STA;
priv->bss_role = MWIFIEX_BSS_ROLE_STA;
priv->bss_started = 0;
-   priv->bss_num = 0;
+   priv->bss_num = adapter->curr_iface_comb.p2p_intf;
 
if (mwifiex_cfg80211_init_p2p_client(priv)) {
memset(&priv->wdev, 0, sizeof(priv->wdev));
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-02 Thread Michal Kazior
On 2 June 2015 at 20:21, Liu CF/TW  wrote:
> On Tue, Jun 2, 2015 at 12:17 AM, Michal Kazior  
> wrote:
>> On 1 June 2015 at 21:44, David Liu  wrote:
>> [...]
>>> --- a/drivers/net/wireless/ath/ath10k/core.h
>>> +++ b/drivers/net/wireless/ath/ath10k/core.h
>>> @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
>>> u8 tid;
>>> u16 freq;
>>> bool is_offchan;
>>> +   bool nohwcrypt;
>>> struct ath10k_htt_txbuf *txbuf;
>>> u32 txbuf_paddr;
>>> } __packed htt;
>>> @@ -349,6 +350,7 @@ struct ath10k_vif {
>>> } u;
>>>
>>> bool use_cts_prot;
>>> +   bool nohwcrypt;
>>
>> So this is a bit confusing. This is used only for tx policy only,
>> right? It should be named accordingly then. The other nohwcrypt in
>> skb_cb pretty much implies Tx already.
>>
>
> No, it's also for Rx.
> In this patch, in mac.c, if arvif->nohwcrypt is set, ath10k_send_key()
> won't install the actual key to hardware, but a clear key is
> installed. This makes all matching STA's encrypted frame passthrough
> HW and mac80211 can take care of decryption later in host.
> (in patch V2 I will take care of the IEEE80211_HW_SW_CRYPTO_CONTROL setting)

Ah, you're right. I've missed that somehow.


>> [...]
>>> @@ -484,6 +491,12 @@ enum ath10k_dev_flags {
>>>  * waiters should immediately cancel instead of waiting for a time 
>>> out.
>>>  */
>>> ATH10K_FLAG_CRASH_FLUSH,
>>> +
>>> +   /* Use Raw mode for Tx and Rx */
>>> +   ATH10K_RAW_MODE,
>>> +
>>> +   /* Disable HW crypto engine */
>>> +   ATH10K_HW_CRYPTO_DISABLED,
>>
>> You're missing the _FLAG prefix. Also this isn't documented well
>> enough. RAW_MODE implies sw crypto rx, no? Perhaps a more fine grained
>> approach would be better:
>
> Thanks. Will fix.
>
> Raw mode doesn't imply SW crypto only.
> Indeed Raw mode is the only way to get sw crypto support, but it also
> supports HW crypto.
> I just tested both HW/SW crypto cases working fine in raw mode.
>
> So my plan for the new cryptmode parameter has 3 values:
>
>0Use HW crypto engine only. This uses native WiFi mode Tx/Rx encap
>
>1Use SW crypto engine only. This uses raw mode Tx/Rx encap
>
>2Supports both SW & HW crypto engine. This uses raw mode Tx/Rx 
> encap.
>
> Once this patch is in, I guess people would only use cryptmode=0 or 1.
> For cryptmode=2, I have subsequent changes to allow per BSS based
> control of HW/SW crypto selection.
> Plan is to make make arvif->nohwcrypt configurable via debugfs or
> nl80211 (subject to review feedback)
>
>>
>>  ATH10K_FLAG_RAW_TX,
>>  ATH10K_FLAG_RAW_RX,
>>  ATH10K_FLAG_SW_TX_CRYPTO,
>>  ATH10K_FLAG_SW_RX_CRYPTO,
>>
>> Obviously not all combinations are valid/doable but I think this will
>> make the code look more obvious.
>>
>
> That would be too many flags and too complex.
> I'd suggest keep the proposed ATH10K_RAW_MODE and ATH10K_HW_CRYPTO_DISABLED.
> Let's make Tx/Rx HW crypto always both enabled or both disabled AFA
> driver is concerned.

Okay. This suggestion was based on my incorrect interpretation of your
patch wrt arvif->nohwcrypt.


>>> diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
>>> b/drivers/net/wireless/ath/ath10k/hw.h
>>> index 85cca29..37fd2f83 100644
>>> --- a/drivers/net/wireless/ath/ath10k/hw.h
>>> +++ b/drivers/net/wireless/ath/ath10k/hw.h
>>> @@ -296,7 +296,7 @@ enum ath10k_hw_rate_cck {
>>>  #define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
>>>  #define TARGET_10X_VOW_CONFIG  0
>>>  #define TARGET_10X_NUM_MSDU_DESC   (1024 + 400)
>>> -#define TARGET_10X_MAX_FRAG_ENTRIES0
>>> +#define TARGET_10X_MAX_FRAG_ENTRIES10
>>
>> This is probably enough at "2" (ath10k doesn't send more than 2 tx
>> fragments now). I assume fw crashes with raw tx if this isn't fixed,
>> correct?
>>
>> Sidenote: I guess TARGET_MAX_FRAG_ENTRIES could be fixed as well. It
>> might make sense for QCA61X4 hw2.1 which still uses the old Rx
>> indication event and might be able to do raw txrx + swcrypto. But I'm
>> a bit reluctant to change this without any testing.
>>
>
> Sure. I change it to 10 because the document I got from QCA says so.
> Since this is a global setting, I will remove this and keep it =0 for
> now so it doesn't affect existing HW based datapath.

Sure. I recall 10.x on QCA988X isn't really picky on this value.
QCA61X4 with wmi-tlv on the other hand needs an adequate value for
this configuration parameter or it'll crash horribly.


> Per QCA, the main issue not changing this would be SW crypto then
> won't be able to handle large Rx AMSDU.
> When HW is not doing Rx decryption, the whole AMSDU needs to be DMA to
> host for SW based decryption & AMSDU subframe deaggregation.

Hmm.. From what I know this setting refers to the max number of Tx
fragments that can be submitted via HTT TX_FRM command eventually to
HW MAC, not Rx fragments.


Micha

New USB ID 2001:3c25

2015-06-02 Thread Larry Finger

Scott,

I see that you added the USB ID in the subject for the DWA-130 device in commit 
ea345c145ff23197eab34d0c4d0c8a93d7bea8c6.


Is there any reason that the new ID should not have been sent to Stable as well, 
or was that an oversight?


Thanks,

Larry
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] mac80211: convert HW flags to unsigned long bitmap

2015-06-02 Thread Julian Calaby
Hi Johannes,

Minor nit:

On Wed, Jun 3, 2015 at 5:39 AM, Johannes Berg  wrote:
> From: Johannes Berg 
>
> As we're running out of hardware capability flags pretty quickly,
> convert them to use the regular test_bit() style unsigned long
> bitmaps.
>
> This introduces a number of helper functions/macros to set and to
> test the bits, along with new debugfs code.
>
> Signed-off-by: Johannes Berg 
> ---
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index e09a32cb139f..dc56734d0154 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -2050,6 +2053,20 @@ struct ieee80211_hw {
> int txq_ac_max_pending;
>  };
>
> +static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
> +  enum ieee80211_hw_flags flg)
> +{
> +   return test_bit(flg, hw->flags);
> +}
> +#define ieee80211_hw_check(hw, flg)_ieee80211_hw_check(hw, 
> IEEE80211_HW_##flg)
> +
> +static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
> +enum ieee80211_hw_flags flg)
> +{
> +   return __set_bit(flg, hw->flags);
> +}
> +#define ieee80211_hw_set(hw, flg)  _ieee80211_hw_set(hw, 
> IEEE80211_HW_##flg)
> +

Why not add a ieee80211_hw_clear() function? Yes, it'd only be used in
3 places, but it'd look neater.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature

2015-06-02 Thread Li, Yanbo


> -Original Message-
> From: Jakub Kiciński [mailto:moorr...@wp.pl]
> Sent: Tuesday, June 02, 2015 2:39 AM
> To: Li, Yanbo
> Cc: Valo, Kalle; dreamfly...@gmail.com; ath...@lists.infradead.org; linux-
> wirel...@vger.kernel.org
> Subject: Re: [PATCH v2] ath10k: Debugfs entry to enable/disable
> WLAN&Blutooth Coexist feature
> 
> On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
> > As some radio have no connection with BT modules, enable the
> > WLAN/Bluetooth
> > coexist(BTC) feature will has some side effect if the radio's GPIO
> > connect with any other HW modules. Add the control switcher
> > "btc_feature" at debugfs and set the feature as disable by default to avoid
> such case.
> >
> > To enable this feature, execute:
> > echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> > To disable:
> > echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> >
> > Signed-off-by: Yanbo Li 
> 
> IMHO common API for disabling/enabling btcoex is something we would all
> benefit from and easy enough to implement properly.  Burying it in driver-
> specific debugfs is less than appropriate.
> 
> I seem to recall there were plans to discuss btcoex at one of the linux-
> wireless summits.  If the consensus was to leave it in debugfs then I
> apologize for the noise ;)

Thanks for your comments, agree with a general BTcoex interface will be good 
for lots of wlan chip/driver. 
It worth to be consider to implement such framework in future.

BR /Yanbo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ray_cs: Change 1 to true for bool type variable.

2015-06-02 Thread Kalle Valo

> The variable translate is bool type. So assigning true instead of 1.
> 
> Signed-off-by: Shailendra Verma 

Thanks, applied to wireless-drivers-next.git.

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [1/6] mwifiex: fix SDIO firmware dump problem

2015-06-02 Thread Kalle Valo

> It's been observed that firmware doesn't go back to normal
> state when all firmware memories are dumped. As a result,
> further commands are blocked. This happens due to missing
> driver change of writing READ DONE to control register for
> SDIO interface.
> 
> This patch adds a missing change to fix the problem.
> 
> Signed-off-by: Amitkumar Karwar 
> Signed-off-by: Cathy Luo 

Thanks, 6 patches applied to wireless-drivers-next.git:

e065ddb89175 mwifiex: fix SDIO firmware dump problem
0769b27739ee mwifiex: fix a possible double free issue
38b130e22e40 mwifiex: dump driver information for PCIe interface
9cc0dbf04367 mwifiex: minor changes in debug messages
fc697159ad4c mwifiex: use generic name 'device dump'
57670ee882d4 mwifiex: device dump support via devcoredump framework

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] mac80211: convert HW flags to unsigned long bitmap

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

As we're running out of hardware capability flags pretty quickly,
convert them to use the regular test_bit() style unsigned long
bitmaps.

This introduces a number of helper functions/macros to set and to
test the bits, along with new debugfs code.

Signed-off-by: Johannes Berg 
---
 drivers/net/wireless/adm8211.c |  8 +-
 drivers/net/wireless/at76c50x-usb.c|  4 +-
 drivers/net/wireless/ath/ar5523/ar5523.c   |  6 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 24 +++---
 drivers/net/wireless/ath/ath5k/base.c  | 12 +--
 drivers/net/wireless/ath/ath9k/htc_drv_init.c  | 20 ++---
 drivers/net/wireless/ath/ath9k/init.c  | 24 +++---
 drivers/net/wireless/ath/carl9170/fw.c |  2 +-
 drivers/net/wireless/ath/carl9170/main.c   | 20 ++---
 drivers/net/wireless/ath/wcn36xx/main.c| 12 +--
 drivers/net/wireless/b43/main.c|  4 +-
 drivers/net/wireless/b43legacy/main.c  |  5 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |  7 +-
 drivers/net/wireless/cw1200/main.c | 16 ++--
 drivers/net/wireless/iwlegacy/3945-mac.c   |  6 +-
 drivers/net/wireless/iwlegacy/4965-mac.c   | 12 +--
 drivers/net/wireless/iwlwifi/dvm/mac80211.c| 24 +++---
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c|  4 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c| 30 +++
 drivers/net/wireless/libertas_tf/main.c|  2 +-
 drivers/net/wireless/mac80211_hwsim.c  | 26 +++---
 drivers/net/wireless/mwl8k.c   |  9 +-
 drivers/net/wireless/p54/main.c| 12 +--
 drivers/net/wireless/rsi/rsi_91x_mac80211.c|  7 +-
 drivers/net/wireless/rt2x00/rt2400pci.c|  8 +-
 drivers/net/wireless/rt2x00/rt2500pci.c|  8 +-
 drivers/net/wireless/rt2x00/rt2500usb.c|  9 +-
 drivers/net/wireless/rt2x00/rt2800lib.c| 16 ++--
 drivers/net/wireless/rt2x00/rt61pci.c  |  9 +-
 drivers/net/wireless/rt2x00/rt73usb.c  |  9 +-
 drivers/net/wireless/rtl818x/rtl8180/dev.c |  9 +-
 drivers/net/wireless/rtl818x/rtl8187/dev.c |  6 +-
 drivers/net/wireless/rtlwifi/base.c| 22 +++--
 drivers/net/wireless/ti/wl1251/main.c  |  3 +-
 drivers/net/wireless/ti/wlcore/main.c  | 26 +++---
 drivers/net/wireless/zd1211rw/zd_mac.c |  8 +-
 drivers/staging/vt6655/device_main.c   |  8 +-
 drivers/staging/vt6656/main_usb.c  |  8 +-
 include/net/mac80211.h | 77 ++---
 net/mac80211/agg-tx.c  |  4 +-
 net/mac80211/cfg.c | 10 +--
 net/mac80211/debugfs.c | 96 --
 net/mac80211/driver-ops.h  |  2 +-
 net/mac80211/iface.c   | 10 +--
 net/mac80211/key.c |  4 +-
 net/mac80211/main.c| 14 ++--
 net/mac80211/mlme.c| 63 +++---
 net/mac80211/offchannel.c  |  2 +-
 net/mac80211/pm.c  |  4 +-
 net/mac80211/rate.c|  6 +-
 net/mac80211/rc80211_minstrel_ht.c |  2 +-
 net/mac80211/rx.c  | 26 +++---
 net/mac80211/scan.c| 10 +--
 net/mac80211/sta_info.c| 14 ++--
 net/mac80211/status.c  | 13 ++-
 net/mac80211/tdls.c|  2 +-
 net/mac80211/tx.c  | 34 
 net/mac80211/util.c|  6 +-
 58 files changed, 433 insertions(+), 411 deletions(-)

diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 413528295d72..ad6ead9a8acb 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1369,9 +1369,9 @@ static void adm8211_configure_filter(struct ieee80211_hw 
*dev,
ADM8211_CSR_READ(NAR);
 
if (priv->nar & ADM8211_NAR_PR)
-   dev->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
+   ieee80211_hw_set(dev, RX_INCLUDES_FCS);
else
-   dev->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS;
+   __clear_bit(IEEE80211_HW_RX_INCLUDES_FCS, dev->flags);
 
if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
adm8211_set_bssid(dev, bcast);
@@ -1857,8 +1857,8 @@ static int adm8211_probe(struct pci_dev *pdev,
SET_IEEE80211_PERM_ADDR(dev, perm_addr);
 
dev->extra_tx_headroom = sizeof(struct adm8211_tx_hdr);
-   /* dev->flags = IEEE80211_HW_RX_INCLUDES_FCS in promisc mode */
-   dev->flags = IEEE80211_HW_SIGNAL_UNSPEC;
+   /* dev->flags = RX_INCLUD

[PATCH 4/4] mt7601u: set promiscous mode based on FIF_OTHER_BSS

2015-06-02 Thread Jakub Kicinski
From: Jakub Kicinski 

Most drivers use FIF_OTHER_BSS to set promiscous mode.  Let us
follow their lead even though it doesn't match exactly the HW
filter flags.

Signed-off-by: Jakub Kicinski 
---
 drivers/net/wireless/mediatek/mt7601u/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/mediatek/mt7601u/main.c 
b/drivers/net/wireless/mediatek/mt7601u/main.c
index ced82abb414f..169384b48b27 100644
--- a/drivers/net/wireless/mediatek/mt7601u/main.c
+++ b/drivers/net/wireless/mediatek/mt7601u/main.c
@@ -119,6 +119,7 @@ mt76_configure_filter(struct ieee80211_hw *hw, unsigned int 
changed_flags,
 
dev->rxfilter &= ~MT_RX_FILTR_CFG_OTHER_BSS;
 
+   MT76_FILTER(OTHER_BSS, MT_RX_FILTR_CFG_PROMISC);
MT76_FILTER(FCSFAIL, MT_RX_FILTR_CFG_CRC_ERR);
MT76_FILTER(PLCPFAIL, MT_RX_FILTR_CFG_PHY_ERR);
MT76_FILTER(CONTROL, MT_RX_FILTR_CFG_ACK |
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] mt7601u: unify paged and non-paged RX dma paths

2015-06-02 Thread Jakub Kicinski
From: Jakub Kicinski 

Signed-off-by: Jakub Kicinski 
---
 drivers/net/wireless/mediatek/mt7601u/dma.c | 62 ++---
 1 file changed, 12 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c 
b/drivers/net/wireless/mediatek/mt7601u/dma.c
index 9c9e1288644b..16df67b2e62c 100644
--- a/drivers/net/wireless/mediatek/mt7601u/dma.c
+++ b/drivers/net/wireless/mediatek/mt7601u/dma.c
@@ -34,56 +34,28 @@ static unsigned int ieee80211_get_hdrlen_from_buf(const u8 
*data, unsigned len)
 
 static struct sk_buff *
 mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi,
-   u8 *data, u32 seg_len)
+   void *data, u32 seg_len, u32 truesize, struct page *p)
 {
struct sk_buff *skb;
u32 true_len;
+   int hdr_len, copy, frag;
 
-   if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD))
-   seg_len -= 2;
-
-   skb = alloc_skb(seg_len, GFP_ATOMIC);
-   if (!skb)
-   return NULL;
-
-   if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD)) {
-   int hdr_len = ieee80211_get_hdrlen_from_buf(data, seg_len);
-
-   memcpy(skb_put(skb, hdr_len), data, hdr_len);
-   data += hdr_len + 2;
-   seg_len -= hdr_len;
-   }
-
-   memcpy(skb_put(skb, seg_len), data, seg_len);
-
-   true_len = mt76_mac_process_rx(dev, skb, skb->data, rxwi);
-   skb_trim(skb, true_len);
-
-   return skb;
-}
-
-static struct sk_buff *
-mt7601u_rx_skb_from_seg_paged(struct mt7601u_dev *dev,
- struct mt7601u_rxwi *rxwi, void *data,
- u32 seg_len, u32 truesize, struct page *p)
-{
-   unsigned int hdr_len = ieee80211_get_hdrlen_from_buf(data, seg_len);
-   unsigned int true_len, copy, frag;
-   struct sk_buff *skb;
-
-   skb = alloc_skb(128, GFP_ATOMIC);
+   skb = alloc_skb(p ? 128 : seg_len, GFP_ATOMIC);
if (!skb)
return NULL;
 
true_len = mt76_mac_process_rx(dev, skb, data, rxwi);
 
+   hdr_len = ieee80211_get_hdrlen_from_buf(data, true_len);
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD)) {
memcpy(skb_put(skb, hdr_len), data, hdr_len);
+
data += hdr_len + 2;
true_len -= hdr_len;
hdr_len = 0;
}
 
+   /* If not doing paged RX allocated skb will always have enough space */
copy = (true_len <= skb_tailroom(skb)) ? true_len : hdr_len + 8;
frag = true_len - copy;
 
@@ -100,7 +72,7 @@ mt7601u_rx_skb_from_seg_paged(struct mt7601u_dev *dev,
 }
 
 static void mt7601u_rx_process_seg(struct mt7601u_dev *dev, u8 *data,
-  u32 seg_len, struct page *p, bool paged)
+  u32 seg_len, struct page *p)
 {
struct sk_buff *skb;
struct mt7601u_rxwi *rxwi;
@@ -126,11 +98,7 @@ static void mt7601u_rx_process_seg(struct mt7601u_dev *dev, 
u8 *data,
 
trace_mt_rx(dev, rxwi, fce_info);
 
-   if (paged)
-   skb = mt7601u_rx_skb_from_seg_paged(dev, rxwi, data, seg_len,
-   truesize, p);
-   else
-   skb = mt7601u_rx_skb_from_seg(dev, rxwi, data, seg_len);
+   skb = mt7601u_rx_skb_from_seg(dev, rxwi, data, seg_len, truesize, p);
if (!skb)
return;
 
@@ -158,23 +126,17 @@ mt7601u_rx_process_entry(struct mt7601u_dev *dev, struct 
mt7601u_dma_buf_rx *e)
u32 seg_len, data_len = e->urb->actual_length;
u8 *data = page_address(e->p);
struct page *new_p = NULL;
-   bool paged = true;
int cnt = 0;
 
if (!test_bit(MT7601U_STATE_INITIALIZED, &dev->state))
return;
 
/* Copy if there is very little data in the buffer. */
-   if (data_len < 512) {
-   paged = false;
-   } else {
+   if (data_len > 512)
new_p = dev_alloc_pages(MT_RX_ORDER);
-   if (!new_p)
-   paged = false;
-   }
 
while ((seg_len = mt7601u_rx_next_seg_len(data, data_len))) {
-   mt7601u_rx_process_seg(dev, data, seg_len, e->p, paged);
+   mt7601u_rx_process_seg(dev, data, seg_len, new_p ? e->p : NULL);
 
data_len -= seg_len;
data += seg_len;
@@ -182,9 +144,9 @@ mt7601u_rx_process_entry(struct mt7601u_dev *dev, struct 
mt7601u_dma_buf_rx *e)
}
 
if (cnt > 1)
-   trace_mt_rx_dma_aggr(dev, cnt, paged);
+   trace_mt_rx_dma_aggr(dev, cnt, !!new_p);
 
-   if (paged) {
+   if (new_p) {
/* we have one extra ref from the allocator */
__free_pages(e->p, MT_RX_ORDER);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.

[PATCH 3/4] mt7601u: don't cleanup device second time after .resume()

2015-06-02 Thread Jakub Kicinski
From: Jakub Kicinski 

Make sure .disconnect() doesn't cleanup the device if
.resume() failed.  This may happen when device is removed
during suspend.

Signed-off-by: Jakub Kicinski 
---
 drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++
 drivers/net/wireless/mediatek/mt7601u/usb.c  | 9 -
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c 
b/drivers/net/wireless/mediatek/mt7601u/init.c
index 1fc86e865c8c..45eb0796a2e5 100644
--- a/drivers/net/wireless/mediatek/mt7601u/init.c
+++ b/drivers/net/wireless/mediatek/mt7601u/init.c
@@ -427,6 +427,9 @@ err:
 
 void mt7601u_cleanup(struct mt7601u_dev *dev)
 {
+   if (!test_and_clear_bit(MT7601U_STATE_INITIALIZED, &dev->state))
+   return;
+
mt7601u_stop_hardware(dev);
mt7601u_dma_cleanup(dev);
mt7601u_mcu_cmd_deinit(dev);
diff --git a/drivers/net/wireless/mediatek/mt7601u/usb.c 
b/drivers/net/wireless/mediatek/mt7601u/usb.c
index 99e2b3997bfa..54dba4001865 100644
--- a/drivers/net/wireless/mediatek/mt7601u/usb.c
+++ b/drivers/net/wireless/mediatek/mt7601u/usb.c
@@ -338,8 +338,15 @@ static int mt7601u_suspend(struct usb_interface *usb_intf, 
pm_message_t state)
 static int mt7601u_resume(struct usb_interface *usb_intf)
 {
struct mt7601u_dev *dev = usb_get_intfdata(usb_intf);
+   int ret;
+
+   ret = mt7601u_init_hardware(dev);
+   if (ret)
+   return ret;
+
+   set_bit(MT7601U_STATE_INITIALIZED, &dev->state);
 
-   return mt7601u_init_hardware(dev);
+   return 0;
 }
 
 MODULE_DEVICE_TABLE(usb, mt7601u_device_table);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] mt7601u: watch out for invalid-length frames

2015-06-02 Thread Jakub Kicinski
From: Jakub Kicinski 

Users of older Ralink devices report that received frames
sometimes have zero length.  Watch out for that.

Signed-off-by: Jakub Kicinski 
---
 drivers/net/wireless/mediatek/mt7601u/dma.c | 14 --
 drivers/net/wireless/mediatek/mt7601u/mac.c |  8 ++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/dma.c 
b/drivers/net/wireless/mediatek/mt7601u/dma.c
index 16df67b2e62c..7217da4f1543 100644
--- a/drivers/net/wireless/mediatek/mt7601u/dma.c
+++ b/drivers/net/wireless/mediatek/mt7601u/dma.c
@@ -37,16 +37,20 @@ mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct 
mt7601u_rxwi *rxwi,
void *data, u32 seg_len, u32 truesize, struct page *p)
 {
struct sk_buff *skb;
-   u32 true_len;
-   int hdr_len, copy, frag;
+   u32 true_len, hdr_len = 0, copy, frag;
 
skb = alloc_skb(p ? 128 : seg_len, GFP_ATOMIC);
if (!skb)
return NULL;
 
true_len = mt76_mac_process_rx(dev, skb, data, rxwi);
+   if (!true_len || true_len > seg_len)
+   goto bad_frame;
 
hdr_len = ieee80211_get_hdrlen_from_buf(data, true_len);
+   if (!hdr_len)
+   goto bad_frame;
+
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD)) {
memcpy(skb_put(skb, hdr_len), data, hdr_len);
 
@@ -69,6 +73,12 @@ mt7601u_rx_skb_from_seg(struct mt7601u_dev *dev, struct 
mt7601u_rxwi *rxwi,
}
 
return skb;
+
+bad_frame:
+   dev_err_ratelimited(dev->dev, "Error: incorrect frame len:%u hdr:%u\n",
+   true_len, hdr_len);
+   dev_kfree_skb(skb);
+   return NULL;
 }
 
 static void mt7601u_rx_process_seg(struct mt7601u_dev *dev, u8 *data,
diff --git a/drivers/net/wireless/mediatek/mt7601u/mac.c 
b/drivers/net/wireless/mediatek/mt7601u/mac.c
index c161bcc6a7fa..7514bce1ac91 100644
--- a/drivers/net/wireless/mediatek/mt7601u/mac.c
+++ b/drivers/net/wireless/mediatek/mt7601u/mac.c
@@ -450,10 +450,14 @@ u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct 
sk_buff *skb,
 {
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct mt7601u_rxwi *rxwi = rxi;
-   u32 ctl = le32_to_cpu(rxwi->ctl);
+   u32 len, ctl = le32_to_cpu(rxwi->ctl);
u16 rate = le16_to_cpu(rxwi->rate);
int rssi;
 
+   len = MT76_GET(MT_RXWI_CTL_MPDU_LEN, ctl);
+   if (len < 10)
+   return 0;
+
if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_DECRYPT)) {
status->flag |= RX_FLAG_DECRYPTED;
status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
@@ -474,7 +478,7 @@ u32 mt76_mac_process_rx(struct mt7601u_dev *dev, struct 
sk_buff *skb,
dev->avg_rssi = (dev->avg_rssi * 15) / 16 + (rssi << 8);
spin_unlock_bh(&dev->con_mon_lock);
 
-   return MT76_GET(MT_RXWI_CTL_MPDU_LEN, ctl);
+   return len;
 }
 
 static enum mt76_cipher_type
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] mac80211: Minstrel HT: Handle all SMPS states of the peer STA.

2015-06-02 Thread Krishna Chaitanya
On Wed, Jun 3, 2015 at 12:07 AM, Chaitanya T K  wrote:
> From: Chaitanya Tata 
>
> In case of Dynamic SMPS enable RTS/CTS for all rates.
> In case of Static SMPS mark the Nss > 1 rates as not supported.
>
> Signed-off-by: Chaitanya T K 
> ---
> V2: Fix the Indent and Sign off missing.
> ---
>  net/mac80211/rc80211_minstrel_ht.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/rc80211_minstrel_ht.c 
> b/net/mac80211/rc80211_minstrel_ht.c
> index 7430a1d..0889c22 100644
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -1176,9 +1176,16 @@ minstrel_ht_update_caps(void *priv, struct 
> ieee80211_supported_band *sband,
>
> nss = minstrel_mcs_groups[i].streams;
>
> -   /* Mark MCS > 7 as unsupported if STA is in static SMPS mode 
> */
> -   if (sta->smps_mode == IEEE80211_SMPS_STATIC && nss > 1)
> -   continue;
> +   /* Handle STA's SMPS State, if Nss > 1.
> +   * a. Use RTS_CTS, if STA is in Dynamic SMPS Mode
> +   * b. Mark Nss > 1 as unsupported, if STA is in static SMPS 
> mode
> +   */
> +   if (nss > 1) {
> +   if (sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
> +   gflags |= IEEE80211_TX_RC_USE_RTS_CTS;

Just noticed that the minstrel_mcs_groups is a const struct, so this wont work.

So may be we can move this check to set_rate we can populate rate_table
and also have access to "sta" info?

> +   else if (sta->smps_mode == IEEE80211_SMPS_STATIC)
> +   continue;
> +   }
>
> /* HT rate */
> if (gflags & IEEE80211_TX_RC_MCS) {
> --
> 1.9.1
>



-- 
Thanks,
Regards,
Chaitanya T K.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: remove obsolete sentence from documentation

2015-06-02 Thread Jakub Kicinski
From: Jakub Kicinski 

FIF_PROMISC_IN_BSS was removed in commit df1404650ccb
("mac80211: remove support for IFF_PROMISC").

Signed-off-by: Jakub Kicinski 
---
 include/net/mac80211.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2f8b7decace0..e117119927ec 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2591,8 +2591,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct 
sk_buff *skb);
  *
  * @FIF_OTHER_BSS: pass frames destined to other BSSes
  *
- * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only
- * those addressed to this station.
+ * @FIF_PSPOLL: pass PS Poll frames
  *
  * @FIF_PROBE_REQ: pass probe request frames
  */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] mac80211: Minstrel HT: Handle all SMPS states of the peer STA.

2015-06-02 Thread Chaitanya T K
From: Chaitanya Tata 

In case of Dynamic SMPS enable RTS/CTS for all rates.
In case of Static SMPS mark the Nss > 1 rates as not supported.

Signed-off-by: Chaitanya T K 
---
V2: Fix the Indent and Sign off missing.
---
 net/mac80211/rc80211_minstrel_ht.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c 
b/net/mac80211/rc80211_minstrel_ht.c
index 7430a1d..0889c22 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1176,9 +1176,16 @@ minstrel_ht_update_caps(void *priv, struct 
ieee80211_supported_band *sband,
 
nss = minstrel_mcs_groups[i].streams;
 
-   /* Mark MCS > 7 as unsupported if STA is in static SMPS mode */
-   if (sta->smps_mode == IEEE80211_SMPS_STATIC && nss > 1)
-   continue;
+   /* Handle STA's SMPS State, if Nss > 1.
+   * a. Use RTS_CTS, if STA is in Dynamic SMPS Mode
+   * b. Mark Nss > 1 as unsupported, if STA is in static SMPS mode
+   */
+   if (nss > 1) {
+   if (sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
+   gflags |= IEEE80211_TX_RC_USE_RTS_CTS;
+   else if (sta->smps_mode == IEEE80211_SMPS_STATIC)
+   continue;
+   }
 
/* HT rate */
if (gflags & IEEE80211_TX_RC_MCS) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: rename single hw-scan flag to follow naming convention

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

The naming convention is to always have the flags prefixed with
IEEE80211_HW_ so they're 'namespaced', make this flag follow it.

Signed-off-by: Johannes Berg 
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +-
 include/net/mac80211.h  | 4 ++--
 net/mac80211/scan.c | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 84555170b6f7..6b45b96ac238 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -450,7 +450,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
!iwlwifi_mod_params.sw_crypto)
hw->flags |= IEEE80211_HW_MFP_CAPABLE;
 
-   hw->flags |= IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS;
+   hw->flags |= IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS;
hw->wiphy->features |=
NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 68a3cc9796d2..e09a32cb139f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1885,7 +1885,7 @@ struct ieee80211_txq {
  * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
  * or tailroom of TX skbs without copying them first.
  *
- * @IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS: The HW supports scanning on all 
bands
+ * @IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS: The HW supports scanning on all 
bands
  * in one command, mac80211 doesn't have to run separate scans per band.
  */
 enum ieee80211_hw_flags {
@@ -1917,7 +1917,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_SUPPORTS_HT_CCK_RATES  = 1<<27,
IEEE80211_HW_CHANCTX_STA_CSA= 1<<28,
IEEE80211_HW_SUPPORTS_CLONED_SKBS   = 1<<29,
-   IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS   = 1<<30,
+   IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS   = 1<<30,
 };
 
 /**
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 7bb6a9383f58..3eb121d2aa45 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -257,7 +257,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local 
*local)
if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
return false;
 
-   if (local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) {
+   if (local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) {
for (i = 0; i < req->n_channels; i++) {
local->hw_scan_req->req.channels[i] = req->channels[i];
bands_used |= BIT(req->channels[i]->band);
@@ -326,7 +326,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw 
*hw, bool aborted)
return;
 
if (hw_scan && !aborted &&
-   !(local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) &&
+   !(local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) &&
ieee80211_prep_hw_scan(local)) {
int rc;
 
@@ -520,7 +520,7 @@ static int __ieee80211_start_scan(struct 
ieee80211_sub_if_data *sdata,
 
local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
 
-   if (local->hw.flags & IEEE80211_SINGLE_HW_SCAN_ON_ALL_BANDS) {
+   if (local->hw.flags & IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS) {
int i, n_bands = 0;
u8 bands_counted = 0;
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] minstrel_ht: Use RTS_CTS when STA is in DYNAMIC SMPS mode for frames sent using Nss>1.

2015-06-02 Thread Krishna Chaitanya
On Tue, Jun 2, 2015 at 3:10 AM, Johannes Berg  wrote:
> On Tue, 2015-06-02 at 03:03 +0530, Krishna Chaitanya wrote:
>
>> > This patch is *ancient*, before we actually used patchwork properly ...
>> Ok, so you want me to send a V2 with the indentation fixed?
>> (or) shall i wait for Felix's review before sending V2?
>
> It seems unlikely that anyone would want to review a patch over 15
> months later :)

 Please drop this patch, i have sent a new one in sync with HEAD.

-- 
Thanks,
Regards,
Chaitanya T K.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: remove short slot/short preamble incapable flags

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

There are no drivers setting IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE
or IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE, so any code using the
two flags is dead; it's also exceedingly unlikely that any new driver
could ever need to set these flags.

The wcn36xx code is almost certainly broken, but this preserves the
previous behaviour.

Signed-off-by: Johannes Berg 
---
 drivers/net/wireless/ath/wcn36xx/smd.c |  4 +---
 include/net/mac80211.h | 17 ++---
 net/mac80211/debugfs.c |  7 ---
 net/mac80211/mesh_plink.c  |  4 +---
 net/mac80211/mlme.c|  6 ++
 net/mac80211/tdls.c| 17 +
 6 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c 
b/drivers/net/wireless/ath/wcn36xx/smd.c
index dbd894428be6..c9263e1c75d4 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -216,9 +216,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
memcpy(&sta_params->bssid, vif->addr, ETH_ALEN);
 
sta_params->encrypt_type = priv_vif->encrypt_type;
-   sta_params->short_preamble_supported =
-   !(WCN36XX_FLAGS(wcn) &
- IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE);
+   sta_params->short_preamble_supported = true;
 
sta_params->rifs_mode = 0;
sta_params->rmf = 0;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7466c55bfc0b..68a3cc9796d2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -446,12 +446,8 @@ struct ieee80211_event {
  * @ibss_creator: indicates if a new IBSS network is being created
  * @aid: association ID number, valid only when @assoc is true
  * @use_cts_prot: use CTS protection
- * @use_short_preamble: use 802.11b short preamble;
- * if the hardware cannot handle this it must set the
- * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag
- * @use_short_slot: use short slot time (only relevant for ERP);
- * if the hardware cannot handle this it must set the
- * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag
+ * @use_short_preamble: use 802.11b short preamble
+ * @use_short_slot: use short slot time (only relevant for ERP)
  * @dtim_period: num of beacons before the next DTIM, for beaconing,
  * valid in station mode only if after the driver was notified
  * with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
@@ -1784,13 +1780,6 @@ struct ieee80211_txq {
  * multicast frames when there are power saving stations so that
  * the driver can fetch them with ieee80211_get_buffered_bc().
  *
- * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
- * Hardware is not capable of short slot operation on the 2.4 GHz band.
- *
- * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
- * Hardware is not capable of receiving frames with short preamble on
- * the 2.4 GHz band.
- *
  * @IEEE80211_HW_SIGNAL_UNSPEC:
  * Hardware can provide signal values but we don't know its units. We
  * expect values between 0 and @max_signal.
@@ -1903,8 +1892,6 @@ enum ieee80211_hw_flags {
IEEE80211_HW_HAS_RATE_CONTROL   = 1<<0,
IEEE80211_HW_RX_INCLUDES_FCS= 1<<1,
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING= 1<<2,
-   IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE  = 1<<3,
-   IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE  = 1<<4,
IEEE80211_HW_SIGNAL_UNSPEC  = 1<<5,
IEEE80211_HW_SIGNAL_DBM = 1<<6,
IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC = 1<<7,
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index b17206db49b4..1b94d2704c27 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -1,4 +1,3 @@
-
 /*
  * mac80211 debugfs for wireless PHYs
  *
@@ -112,12 +111,6 @@ static ssize_t hwflags_read(struct file *file, char __user 
*user_buf,
if (local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING)
sf += scnprintf(buf + sf, mxln - sf,
"HOST_BCAST_PS_BUFFERING\n");
-   if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)
-   sf += scnprintf(buf + sf, mxln - sf,
-   "2GHZ_SHORT_SLOT_INCAPABLE\n");
-   if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)
-   sf += scnprintf(buf + sf, mxln - sf,
-   "2GHZ_SHORT_PREAMBLE_INCAPABLE\n");
if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
sf += scnprintf(buf + sf, mxln - sf, "SIGNAL_UNSPEC\n");
if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index ac843fc88745..72a127e8a1b6 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -106,9 +106,7 @@ static u32 mesh_s

[PATCH] mac80211: Minstrel HT: Handle all SMPS states of the peer STA.

2015-06-02 Thread Chaitanya T K
From: Chaitanya Tata 

In case of Dynamic SMPS enable RTS/CTS for all rates.
In case of Static SMPS mark the Nss > 1 rates as not supported.
---
 net/mac80211/rc80211_minstrel_ht.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c 
b/net/mac80211/rc80211_minstrel_ht.c
index 7430a1d..fdc08d0 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1176,9 +1176,16 @@ minstrel_ht_update_caps(void *priv, struct 
ieee80211_supported_band *sband,
 
nss = minstrel_mcs_groups[i].streams;
 
-   /* Mark MCS > 7 as unsupported if STA is in static SMPS mode */
-   if (sta->smps_mode == IEEE80211_SMPS_STATIC && nss > 1)
-   continue;
+   /* Handle STA's SMPS State, if Nss > 1.
+   * a. Use RTS_CTS, if STA is in Dynamic SMPS Mode
+   * b. Mark Nss > 1 as unsupported, if STA is in static SMPS mode
+   */
+   if (nss > 1) {
+   if (sta->smps_mode == IEEE80211_SMPS_DYNAMIC)
+  gflags |= IEEE80211_TX_RC_USE_RTS_CTS;
+   else if (sta->smps_mode == IEEE80211_SMPS_STATIC)
+   continue;
+   }
 
/* HT rate */
if (gflags & IEEE80211_TX_RC_MCS) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-02 Thread Liu CF/TW
On Tue, Jun 2, 2015 at 12:17 AM, Michal Kazior  wrote:
> On 1 June 2015 at 21:44, David Liu  wrote:
> [...]
>> --- a/drivers/net/wireless/ath/ath10k/core.h
>> +++ b/drivers/net/wireless/ath/ath10k/core.h
>> @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
>> u8 tid;
>> u16 freq;
>> bool is_offchan;
>> +   bool nohwcrypt;
>> struct ath10k_htt_txbuf *txbuf;
>> u32 txbuf_paddr;
>> } __packed htt;
>> @@ -349,6 +350,7 @@ struct ath10k_vif {
>> } u;
>>
>> bool use_cts_prot;
>> +   bool nohwcrypt;
>
> So this is a bit confusing. This is used only for tx policy only,
> right? It should be named accordingly then. The other nohwcrypt in
> skb_cb pretty much implies Tx already.
>

No, it's also for Rx.
In this patch, in mac.c, if arvif->nohwcrypt is set, ath10k_send_key()
won't install the actual key to hardware, but a clear key is
installed. This makes all matching STA's encrypted frame passthrough
HW and mac80211 can take care of decryption later in host.
(in patch V2 I will take care of the IEEE80211_HW_SW_CRYPTO_CONTROL setting)

>
> [...]
>> @@ -484,6 +491,12 @@ enum ath10k_dev_flags {
>>  * waiters should immediately cancel instead of waiting for a time 
>> out.
>>  */
>> ATH10K_FLAG_CRASH_FLUSH,
>> +
>> +   /* Use Raw mode for Tx and Rx */
>> +   ATH10K_RAW_MODE,
>> +
>> +   /* Disable HW crypto engine */
>> +   ATH10K_HW_CRYPTO_DISABLED,
>
> You're missing the _FLAG prefix. Also this isn't documented well
> enough. RAW_MODE implies sw crypto rx, no? Perhaps a more fine grained
> approach would be better:

Thanks. Will fix.

Raw mode doesn't imply SW crypto only.
Indeed Raw mode is the only way to get sw crypto support, but it also
supports HW crypto.
I just tested both HW/SW crypto cases working fine in raw mode.

So my plan for the new cryptmode parameter has 3 values:

   0Use HW crypto engine only. This uses native WiFi mode Tx/Rx encap

   1Use SW crypto engine only. This uses raw mode Tx/Rx encap

   2Supports both SW & HW crypto engine. This uses raw mode Tx/Rx encap.

Once this patch is in, I guess people would only use cryptmode=0 or 1.
For cryptmode=2, I have subsequent changes to allow per BSS based
control of HW/SW crypto selection.
Plan is to make make arvif->nohwcrypt configurable via debugfs or
nl80211 (subject to review feedback)

>
>  ATH10K_FLAG_RAW_TX,
>  ATH10K_FLAG_RAW_RX,
>  ATH10K_FLAG_SW_TX_CRYPTO,
>  ATH10K_FLAG_SW_RX_CRYPTO,
>
> Obviously not all combinations are valid/doable but I think this will
> make the code look more obvious.
>

That would be too many flags and too complex.
I'd suggest keep the proposed ATH10K_RAW_MODE and ATH10K_HW_CRYPTO_DISABLED.
Let's make Tx/Rx HW crypto always both enabled or both disabled AFA
driver is concerned.
Ben's CT 10.1 FW is a special use case and would fit into cryptmode=0
where his FW internally does the magic to disable HW Rx which is
independent to the driver.
Once Ben's FW is ready for raw mode, driver then can switch to use
cryptmode=1 or 2.

>
>>  };
>>
>>  enum ath10k_cal_mode {
>> @@ -492,6 +505,15 @@ enum ath10k_cal_mode {
>> ATH10K_CAL_MODE_DT,
>>  };
>>
>> +enum ath10k_crypt_mode {
>> +   /* Use HW crypto engine only */
>> +   ATH10K_CRYPT_MODE_HW,
>> +   /* HW SW crypto engine only (ie. HW crypto engine disabled) */
>> +   ATH10K_CRYPT_MODE_SW,
>> +   /* Both SW & HW crypto engine supported */
>> +   ATH10K_CRYPT_MODE_HW_SW,
>
> I don't think this is clear enough (and the comments don't help at all):
>
>  ATH10K_CRYPT_MODE_HW,
>  ATH10K_CRYPT_MODE_SW,
>  ATH10K_CRYPT_MODE_SW_RX_HW_TX,
>
> It would also be nice to have some sort of indication in driver
> logs/dmesg (without any debug_masks) as to what crypto mode driver
> uses so that if someone reports a bug we can quickly see their base
> configuration. Having it completely configurable during runtime is a
> bit of a pain in this regard though.. but most people will likely just
> set cryptmode in modprobe.conf or something. Thoughts?

I will add a log line to print the cryptmode param value.

>
>
>> +};
>> +
>>  static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
>>  {
>> switch (mode) {
>> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
>> b/drivers/net/wireless/ath/ath10k/htt_rx.c
>> index 89eb16b..a7df05d 100644
>> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
>> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
>> @@ -1018,8 +1018,7 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k 
>> *ar,
>>
>> /* In most cases this will be true for sniffed frames. It makes sense
>>  * to deliver them as-is without stripping the crypto param. This 
>> would
>> -* also make sense for software based decryption (which is not
>> -* implemented in ath10k).
>> +* also make sense for software based decryption.
>
> I g

Cannot disable transmission retry

2015-06-02 Thread Hodaszi, Robert
Hello,

On kernel 3.13, I was able to disable the transmission retries on the
wlan0 interface with 'iwconfig wlan0 retry 0'. Now I updated my kernel
to 3.16, and it returns with 'Invalid argument' error.

The cause is this commit:

cfg80211: add sanity check for retry limit in wext-compat
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=f5aa0d21dd5ada040ff42b4d40357285e4ace441


--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -370,7 +370,7 @@ static int cfg80211_wext_siwretry(struct net_device
*dev,
u8 oshort = wdev->wiphy->retry_short;
int err;

- if (retry->disabled ||
+ if (retry->disabled || retry->value < 1 || retry->value > 255 ||
(retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
return -EINVAL;



I'm wondering, is the 'retry->value < 1' is necessary? I would write
'retry->value < 0' instead, to make possible to disable the retries.
Should I send a patch?

Thanks!

Robert Hodaszi


[PATCH v3 1/2] wireless-regdb: Add 60GHz regulatory rules for Japan (JP)

2015-06-02 Thread Vladimir Kondratiev
Source is ARIB STD-T74, available at:
http://www.arib.or.jp/english/html/overview/doc/1-STD-T74v1_1.pdf

Signed-off-by: Vladimir Kondratiev 
---
 db.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/db.txt b/db.txt
index 37b6c39..af3aaca 100644
--- a/db.txt
+++ b/db.txt
@@ -590,6 +590,9 @@ country JP: DFS-JP
(5170 - 5250 @ 80), (20), AUTO-BW
(5250 - 5330 @ 80), (20), DFS, AUTO-BW
(5490 - 5710 @ 160), (23), DFS
+   # 60 GHz band channels 2-4 at 10mW,
+   # ref: http://www.arib.or.jp/english/html/overview/doc/1-STD-T74v1_1.pdf
+   (59000 - 66000 @ 2160), (10 mW)
 
 country KE: DFS-JP
(2402 - 2482 @ 40), (20)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/2] 60 GHz rules update

2015-06-02 Thread Vladimir Kondratiev
Update for the 60 GHz rules for 2 countries - Japan and Russia.

Rebase and re-sending to the right maintainer, thus mark as "v3"
to avoid mis-interpretation

Vladimir Kondratiev (2):
  wireless-regdb: Add 60GHz regulatory rules for Japan (JP)
  wireless-regdb: Add 60GHz regulatory rules for Russia (RU)

 db.txt | 5 +
 1 file changed, 5 insertions(+)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/2] wireless-regdb: Add 60GHz regulatory rules for Russia (RU)

2015-06-02 Thread Vladimir Kondratiev
Source is document named
Changes to NLA 124_Order №129_22042015.pdf

Signed-off-by: Vladimir Kondratiev 
---
 db.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/db.txt b/db.txt
index af3aaca..809cd3c 100644
--- a/db.txt
+++ b/db.txt
@@ -998,6 +998,8 @@ country RU: DFS-ETSI
(5250 - 5330 @ 40), (20), DFS
(5650 - 5730 @ 40), (30), DFS
(5735 - 5835 @ 40), (30)
+   # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order 
№129_22042015.pdf
+   (57000 - 66000 @ 2160), (40)
 
 country RW: DFS-FCC
(2402 - 2482 @ 40), (20)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [wireless-regdb] [PATCH] wireless-regdb: Add 60GHz regulatory rules for Russia (RU)

2015-06-02 Thread Seth Forshee
On Tue, Jun 02, 2015 at 05:04:09PM +0300, Vladimir Kondratiev wrote:
> Source is document named
> Changes to NLA 124_Order №129_22042015.pdf
> 
> Signed-off-by: Vladimir Kondratiev 
> ---
>  db.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/db.txt b/db.txt
> index f361030..79dac92 100644
> --- a/db.txt
> +++ b/db.txt
> @@ -978,6 +978,8 @@ country RU: DFS-ETSI
>   (5250 - 5330 @ 80), (20), DFS
>   (5650 - 5730 @ 80), (30), DFS
>   (5735 - 5835 @ 80), (30)
> + # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order 
> №129_22042015.pdf
> + (57000 - 66000 @ 2160), (40)

It looks like your tree is out of date and missing:

  aa1d66d wireless-regdb: Disable VHT80 where 40/80 MHz on 5 GHz is not allowed

I see that you directed the patch at John, so I'm guessing that you're
still using his tree. I took over maintainership of the database in
December, and you should be using this repo for new work:

  git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

Thanks,
Seth
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] wireless-regdb: Add 60GHz regulatory rules for Russia (RU)

2015-06-02 Thread Vladimir Kondratiev
Source is document named
Changes to NLA 124_Order №129_22042015.pdf

Signed-off-by: Vladimir Kondratiev 
---
 db.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/db.txt b/db.txt
index f361030..79dac92 100644
--- a/db.txt
+++ b/db.txt
@@ -978,6 +978,8 @@ country RU: DFS-ETSI
(5250 - 5330 @ 80), (20), DFS
(5650 - 5730 @ 80), (30), DFS
(5735 - 5835 @ 80), (30)
+   # 60 GHz band channels 1-4, ref: Changes to NLA 124_Order 
№129_22042015.pdf
+   (57000 - 66000 @ 2160), (40)
 
 country RW: DFS-FCC
(2402 - 2482 @ 40), (20)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCHv4 00/17] mwifiex patches

2015-06-02 Thread Avinash Patil

> -Original Message-
> From: Kalle Valo [mailto:kv...@codeaurora.org]
> Sent: Tuesday, June 02, 2015 7:10 PM
> To: Avinash Patil
> Cc: linux-wireless@vger.kernel.org; Amitkumar Karwar; Cathy Luo; Xinming Hu
> Subject: Re: [PATCHv4 00/17] mwifiex patches
> 
> Avinash Patil  writes:
> 
> > This patch series mainly adds enhancements for mwifiex AP.
> > With this series, we support verbose information in station dump
> > command also information about AP link.
> > Another important enhancement is related to parsing IEs from tail of
> beacondata.
> > Few issues seen during DFS testing are also fixed in this series.
> 
> When you send a new version of a patch or patchset, please add a changelog so
> that people don't have to guess what has changed since previous version. For
> example, this cover letter is a good place to add it. You can find lots of
> examples from the mailing list archives.

Thanks, Kalle.

I will soon send v5 with change logs as suggested by you.
 
> --
> Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHv4 00/17] mwifiex patches

2015-06-02 Thread Kalle Valo
Avinash Patil  writes:

> This patch series mainly adds enhancements for mwifiex AP. 
> With this series, we support verbose information in station dump command
> also information about AP link.
> Another important enhancement is related to parsing IEs from tail of 
> beacondata.
> Few issues seen during DFS testing are also fixed in this series.

When you send a new version of a patch or patchset, please add a
changelog so that people don't have to guess what has changed since
previous version. For example, this cover letter is a good place to add
it. You can find lots of examples from the mailing list archives.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature

2015-06-02 Thread Kalle Valo
Jakub Kiciński  writes:

> On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
>> As some radio have no connection with BT modules, enable the WLAN/Bluetooth
>> coexist(BTC) feature will has some side effect if the radio's GPIO connect
>> with any other HW modules. Add the control switcher "btc_feature" at
>> debugfs and set the feature as disable by default to avoid such case.
>>
>> To enable this feature, execute:
>> echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
>> To disable:
>> echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
>> 
>> Signed-off-by: Yanbo Li 
>
> IMHO common API for disabling/enabling btcoex is something we would all
> benefit from and easy enough to implement properly.  Burying it in
> driver-specific debugfs is less than appropriate.
>
> I seem to recall there were plans to discuss btcoex at one of the
> linux-wireless summits.  If the consensus was to leave it in debugfs
> then I apologize for the noise ;)

I agree. I don't recall anymore the discussion in the summit but I think
that adding btcoex support to nl80211 would be the right thing to do.
It's a common setting for many drivers. But before we have that, ath10k
still has to use debugfs.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] mac80211: copy nl80211 mgmt TX SKB for status

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

When we return the TX status for an nl80211 mgmt TX SKB, we
should also return the original frame with the status to
allow userspace to match up the submission (it could also
use the cookie but both ways are permissible.)

As TX SKBs could be encrypted, at least in the case of ANQP
while associated with the AP, copy the original SKB, store
it with an ACK frame ID and restructure the status path to
use that to return status with the original SKB. Otherwise,
userspace (in particular wpa_supplicant) will get confused.

Reported-by: Matti Gottlieb 
Signed-off-by: Johannes Berg 
---
 net/mac80211/cfg.c|  39 --
 net/mac80211/status.c | 109 +++---
 2 files changed, 104 insertions(+), 44 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 02f48c848ef5..5ba528f13300 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2,7 +2,7 @@
  * mac80211 configuration hooks for cfg80211
  *
  * Copyright 2006-2010 Johannes Berg 
- * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright 2013-2015  Intel Mobile Communications GmbH
  *
  * This file is GPLv2 as found in COPYING.
  */
@@ -3290,7 +3290,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 {
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
struct ieee80211_local *local = sdata->local;
-   struct sk_buff *skb;
+   struct sk_buff *skb, *ack_skb;
struct sta_info *sta;
const struct ieee80211_mgmt *mgmt = (void *)params->buf;
bool need_offchan = false;
@@ -3428,8 +3428,41 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 
skb->dev = sdata->dev;
 
+   if (!params->dont_wait_for_ack) {
+   unsigned long spin_flags;
+   int id;
+
+   /* make a copy to preserve the original cookie (in case the
+* driver decides to reallocate the skb) and the frame contents
+* in case of encryption.
+*/
+   ack_skb = skb_copy(skb, GFP_KERNEL);
+   if (!ack_skb) {
+   ret = -ENOMEM;
+   kfree_skb(skb);
+   goto out_unlock;
+   }
+
+   spin_lock_irqsave(&local->ack_status_lock, spin_flags);
+   id = idr_alloc(&local->ack_status_frames, ack_skb,
+  1, 0x1, GFP_ATOMIC);
+   spin_unlock_irqrestore(&local->ack_status_lock, spin_flags);
+
+   if (id < 0) {
+   ret = -ENOMEM;
+   kfree_skb(ack_skb);
+   kfree_skb(skb);
+   goto out_unlock;
+   }
+
+   IEEE80211_SKB_CB(skb)->ack_frame_id = id;
+   } else {
+   /* for cookie below */
+   ack_skb = skb;
+   }
+
if (!need_offchan) {
-   *cookie = (unsigned long) skb;
+   *cookie = (unsigned long)ack_skb;
ieee80211_tx_skb(sdata, skb);
ret = 0;
goto out_unlock;
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 461594966b65..56b73e012757 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -429,6 +429,66 @@ static void ieee80211_tdls_td_tx_handle(struct 
ieee80211_local *local,
}
 }
 
+static struct ieee80211_sub_if_data *
+ieee80211_sdata_from_skb(struct ieee80211_local *local, struct sk_buff *skb)
+{
+   struct ieee80211_sub_if_data *sdata;
+
+   if (skb->dev) {
+   list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+   if (!sdata->dev)
+   continue;
+
+   if (skb->dev == sdata->dev)
+   return sdata;
+   }
+
+   return NULL;
+   }
+
+   return rcu_dereference(local->p2p_sdata);
+}
+
+static void ieee80211_report_ack_skb(struct ieee80211_local *local,
+struct ieee80211_tx_info *info,
+bool acked, bool dropped)
+{
+   struct sk_buff *skb;
+   unsigned long flags;
+
+   spin_lock_irqsave(&local->ack_status_lock, flags);
+   skb = idr_find(&local->ack_status_frames, info->ack_frame_id);
+   if (skb)
+   idr_remove(&local->ack_status_frames, info->ack_frame_id);
+   spin_unlock_irqrestore(&local->ack_status_lock, flags);
+
+   if (!skb)
+   return;
+
+   if (dropped) {
+   dev_kfree_skb_any(skb);
+   return;
+   }
+
+   if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
+   struct ieee80211_sub_if_data *sdata;
+
+   rcu_read_lock();
+   sdata = ieee80211_sdata_from_skb(local, skb);
+   if (sdata)
+   cfg8021

[PATCH 2/2] mac80211: stop using pointers as userspace cookies

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

Even if the pointers are really only accessible to root and used
pretty much only by wpa_supplicant, this is still not great; even
for debugging it'd be easier to have something that's easier to
read and guaranteed to never get reused.

With the recent change to make mac80211 create an ack_skb for the
mgmt-tx path this becomes possible, only the client probe method
needs to also allocate an ack_skb, and we can store the cookie in
that skb.

Signed-off-by: Johannes Berg 
---
 include/net/mac80211.h |   3 ++
 net/mac80211/cfg.c | 115 +++--
 net/mac80211/status.c  |  27 ++--
 3 files changed, 90 insertions(+), 55 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 39e864b35083..7466c55bfc0b 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -875,6 +875,9 @@ struct ieee80211_tx_info {
/* 4 bytes free */
} control;
struct {
+   u64 cookie;
+   } ack;
+   struct {
struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
s32 ack_signal;
u8 ampdu_ack_len;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5ba528f13300..1a17d3208d8f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2546,6 +2546,19 @@ static bool ieee80211_coalesce_started_roc(struct 
ieee80211_local *local,
return true;
 }
 
+static u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local)
+{
+   lockdep_assert_held(&local->mtx);
+
+   local->roc_cookie_counter++;
+
+   /* wow, you wrapped 64 bits ... more likely a bug */
+   if (WARN_ON(local->roc_cookie_counter == 0))
+   local->roc_cookie_counter++;
+
+   return local->roc_cookie_counter;
+}
+
 static int ieee80211_start_roc_work(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_channel *channel,
@@ -2583,7 +2596,6 @@ static int ieee80211_start_roc_work(struct 
ieee80211_local *local,
roc->req_duration = duration;
roc->frame = txskb;
roc->type = type;
-   roc->mgmt_tx_cookie = (unsigned long)txskb;
roc->sdata = sdata;
INIT_DELAYED_WORK(&roc->work, ieee80211_sw_roc_work);
INIT_LIST_HEAD(&roc->dependents);
@@ -2593,17 +2605,10 @@ static int ieee80211_start_roc_work(struct 
ieee80211_local *local,
 * or the SKB (for mgmt TX)
 */
if (!txskb) {
-   /* local->mtx protects this */
-   local->roc_cookie_counter++;
-   roc->cookie = local->roc_cookie_counter;
-   /* wow, you wrapped 64 bits ... more likely a bug */
-   if (WARN_ON(roc->cookie == 0)) {
-   roc->cookie = 1;
-   local->roc_cookie_counter++;
-   }
+   roc->cookie = ieee80211_mgmt_tx_cookie(local);
*cookie = roc->cookie;
} else {
-   *cookie = (unsigned long)txskb;
+   roc->mgmt_tx_cookie = *cookie;
}
 
/* if there's one pending or we're scanning, queue this one */
@@ -3284,6 +3289,36 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct 
net_device *dev,
return err;
 }
 
+static struct sk_buff *ieee80211_make_ack_skb(struct ieee80211_local *local,
+ struct sk_buff *skb, u64 *cookie,
+ gfp_t gfp)
+{
+   unsigned long spin_flags;
+   struct sk_buff *ack_skb;
+   int id;
+
+   ack_skb = skb_copy(skb, gfp);
+   if (!ack_skb)
+   return ERR_PTR(-ENOMEM);
+
+   spin_lock_irqsave(&local->ack_status_lock, spin_flags);
+   id = idr_alloc(&local->ack_status_frames, ack_skb,
+  1, 0x1, GFP_ATOMIC);
+   spin_unlock_irqrestore(&local->ack_status_lock, spin_flags);
+
+   if (id < 0) {
+   kfree_skb(ack_skb);
+   return ERR_PTR(-ENOMEM);
+   }
+
+   IEEE80211_SKB_CB(skb)->ack_frame_id = id;
+
+   *cookie = ieee80211_mgmt_tx_cookie(local);
+   IEEE80211_SKB_CB(ack_skb)->ack.cookie = *cookie;
+
+   return ack_skb;
+}
+
 static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 struct cfg80211_mgmt_tx_params *params,
 u64 *cookie)
@@ -3429,40 +3464,22 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, 
struct wireless_dev *wdev,
skb->dev = sdata->dev;
 
if (!params->dont_wait_for_ack) {
-   unsigned long spin_flags;
-   int id;
-
-   /* make a copy to preserve the original cookie (in case the
-* driver decides to reallocate the skb) and the frame contents
+   /* make a copy to 

[PATCH] staging: wilc1000: Modification in code to use ARRAY_SIZE macro

2015-06-02 Thread Dhere, Chaitanya (C.)
From: Chaitanya Dhere 

In this patch, ARRAY_SIZE() macro is used to determine the
size. This change was detected with the help of coccinelle
tool.

Signed-off-by: Chaitanya Dhere 
---
 drivers/staging/wilc1000/linux_wlan.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index b033eb8..592b8ae 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1737,7 +1737,7 @@ static int linux_wlan_read_mac_addr(void *vp)
mm_segment_t old_fs;
loff_t pos = 0;
int index;
-   int array_size = sizeof(path_string) / sizeof(path_string[0]);
+   int array_size = ARRAY_SIZE(path_string);
 
/* change to KERNEL_DS address limit */
old_fs = get_fs();
-- 
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ath10k: Debugfs entry to enable/disable WLAN&Blutooth Coexist feature

2015-06-02 Thread Jakub Kiciński
On Thu, 28 May 2015 12:19:05 -0700, Yanbo Li wrote:
> As some radio have no connection with BT modules, enable the WLAN/Bluetooth
> coexist(BTC) feature will has some side effect if the radio's GPIO connect
> with any other HW modules. Add the control switcher "btc_feature" at
> debugfs and set the feature as disable by default to avoid such case.
>
> To enable this feature, execute:
> echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> To disable:
> echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> 
> Signed-off-by: Yanbo Li 

IMHO common API for disabling/enabling btcoex is something we would all
benefit from and easy enough to implement properly.  Burying it in
driver-specific debugfs is less than appropriate.

I seem to recall there were plans to discuss btcoex at one of the
linux-wireless summits.  If the consensus was to leave it in debugfs
then I apologize for the noise ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211: move TX PN to public part of key struct

2015-06-02 Thread Johannes Berg
From: Johannes Berg 

For drivers supporting TSO or similar features, but that still have
PN assignment in software, there's a need to have some memory to
store the current PN value. As mac80211 already stores this and it's
somewhat complicated to add a per-driver area to the key struct (due
to the dynamic sizing thereof) it makes sense to just move the TX PN
to the keyconf, i.e. the public part of the key struct.

As TKIP is more complicated and we won't able to offload it in this
way right now (fast-xmit is skipped for TKIP unless the HW does it
all, and our hardware needs MMIC calculation in software) I've not
moved that for now - it's possible but requires exposing a lot of
the internal TKIP state.

As an bonus side effect, we can remove a lot of code by assuming the
keyseq struct has a certain layout - with BUILD_BUG_ON to verify it.

This might also improve performance, since now TX and RX no longer
share a cacheline.

Reviewed-by: Emmanuel Grumbach 
Signed-off-by: Johannes Berg 
---
 include/net/mac80211.h |  4 +++
 net/mac80211/cfg.c | 59 ++
 net/mac80211/debugfs_key.c | 17 +-
 net/mac80211/key.c | 80 +-
 net/mac80211/key.h |  4 ---
 net/mac80211/tx.c  | 10 +-
 net/mac80211/wpa.c | 10 +++---
 7 files changed, 42 insertions(+), 142 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 887fe95b9805..39e864b35083 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1479,6 +1479,9 @@ enum ieee80211_key_flags {
  * wants to be given when a frame is transmitted and needs to be
  * encrypted in hardware.
  * @cipher: The key's cipher suite selector.
+ * @tx_pn: PN used for TX on non-TKIP keys, may be used by the driver
+ * as well if it needs to do software PN assignment by itself
+ * (e.g. due to TSO)
  * @flags: key flags, see &enum ieee80211_key_flags.
  * @keyidx: the key index (0-3)
  * @keylen: key material length
@@ -1491,6 +1494,7 @@ enum ieee80211_key_flags {
  * @iv_len: The IV length for this key type
  */
 struct ieee80211_key_conf {
+   atomic64_t tx_pn;
u32 cipher;
u8 icv_len;
u8 iv_len;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bb9f83640b46..02f48c848ef5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -361,66 +361,25 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct 
net_device *dev,
break;
case WLAN_CIPHER_SUITE_CCMP:
case WLAN_CIPHER_SUITE_CCMP_256:
-   if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
-   !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
-   drv_get_key_seq(sdata->local, key, &kseq);
-   memcpy(seq, kseq.ccmp.pn, 6);
-   } else {
-   pn64 = atomic64_read(&key->u.ccmp.tx_pn);
-   seq[0] = pn64;
-   seq[1] = pn64 >> 8;
-   seq[2] = pn64 >> 16;
-   seq[3] = pn64 >> 24;
-   seq[4] = pn64 >> 32;
-   seq[5] = pn64 >> 40;
-   }
-   params.seq = seq;
-   params.seq_len = 6;
-   break;
case WLAN_CIPHER_SUITE_AES_CMAC:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
-   if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
-   !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
-   drv_get_key_seq(sdata->local, key, &kseq);
-   memcpy(seq, kseq.aes_cmac.pn, 6);
-   } else {
-   pn64 = atomic64_read(&key->u.aes_cmac.tx_pn);
-   seq[0] = pn64;
-   seq[1] = pn64 >> 8;
-   seq[2] = pn64 >> 16;
-   seq[3] = pn64 >> 24;
-   seq[4] = pn64 >> 32;
-   seq[5] = pn64 >> 40;
-   }
-   params.seq = seq;
-   params.seq_len = 6;
-   break;
+   BUILD_BUG_ON(offsetof(typeof(kseq), ccmp) !=
+offsetof(typeof(kseq), aes_cmac));
case WLAN_CIPHER_SUITE_BIP_GMAC_128:
case WLAN_CIPHER_SUITE_BIP_GMAC_256:
-   if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
-   !(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
-   drv_get_key_seq(sdata->local, key, &kseq);
-   memcpy(seq, kseq.aes_gmac.pn, 6);
-   } else {
-   pn64 = atomic64_read(&key->u.aes_gmac.tx_pn);
-   seq[0] = pn64;
-   seq[1] = pn64 >> 8;
-   seq[2] = pn64 >> 16;
-   seq[3] = pn64 >> 24;
-   seq[4] = pn64 >> 32;
-   seq[5] = pn64 >> 40;
- 

Re: [PATCH 7/7] mac80211: Switch to new AEAD interface

2015-06-02 Thread Jouni Malinen
On Mon, Jun 01, 2015 at 05:36:58PM +0200, Stephan Mueller wrote:
> Am Montag, 1. Juni 2015, 16:35:26 schrieb Johannes Berg:
> >IOW, I think something like this would make sense:
> 
> That looks definitely cleaner :-)

Indeed.. That AAD length-in-the-buffer design came from the over ten
year old code that was optimized to cover the CCM construction with the
same buffer and that was not cleaned up when this was converted to use
cryptoapi couple of years ago.

> Though, my main concern was just to ensure that the aad length value is not 
> zero.

It won't be in IEEE 802.11 use cases. The exact length depends on the
IEEE 802.11 frame type, but AAD is constructed in a way that it is
normally a bit over 20 octets while allowing CCM to fit the related
operations into two AES blocks.
 
-- 
Jouni MalinenPGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: wilc1000: fix warning while printing

2015-06-02 Thread Sudip Mukherjee
On Tue, Jun 02, 2015 at 10:58:40AM +0200, Konrad Zapalowicz wrote:
> On 06/02, Sudip Mukherjee wrote:
> > On Tue, Jun 02, 2015 at 10:29:17AM +0200, Konrad Zapalowicz wrote:
> > > On 06/02, Sudip Mukherjee wrote:
> > > > size_t should print using %zu, but here it was using %d and hence we
> > > > were getting warning while printing.
> > > > 
> > > > Signed-off-by: Sudip Mukherjee 
> > > > ---
> > > > 
> > > > I think it will be easy to remove the other warnings if all the typedefs
> > > > are removed first.
> > > > 
> > > >  drivers/staging/wilc1000/wilc_spi.c   | 2 +-
> > > >  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
> > > >  2 files changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> > > > b/drivers/staging/wilc1000/wilc_spi.c
> > > > index d0e7610..6d854fd 100644
> > > > --- a/drivers/staging/wilc1000/wilc_spi.c
> > > > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > > > @@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t 
> > > > adr, uint8_t *b, uint32_t sz,
> > > >  #undef NUM_DUMMY_BYTES
> > > >  
> > > > if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
> > > > -   PRINT_ER("[wilc spi]: spi buffer size too small (%d) 
> > > > (%d)\n",
> > > > +   PRINT_ER("[wilc spi]: spi buffer size too small (%d) 
> > > > (%lu)\n",
> > > 
> > > Hi, it seems that the above line should use %zu too. Am I correct or I'm
> > > missing something?
> > oops. my mistake. %lu is correct but i missed mentioning the warning
> > about long unsigned int in the commit message.
> 
> Why %lu here and %zu in other places? I mean that it is the same size_t
> or I'm missing something?
no, this is unsigned long int.
The warning here was:
drivers/staging/wilc1000/wilc_spi.c:407:3: warning: format ‘%d’ expects 
argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat]

so size_t used %zu and unsigned long int should use %lu

regards
sudip
> 
>  - konrad
> 
> > regards
> > sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/4] staging: wilc1000: Fix some compile time warnings

2015-06-02 Thread kholmanskikh . s . s
On Tue, Jun 02, 2015 at 01:55:20PM +0900, Greg KH wrote:
> On Mon, Jun 01, 2015 at 09:56:18PM +0300, Stanislav Kholmanskikh wrote:
> > Signed-off-by: Stanislav Kholmanskikh 
> > ---
> > Changes since V1:
> > 
> > Split the V1 series into more logically unrelated patches
> > and updated patch descriptions accordingly.
> 
> This series doesn't apply on my tree due to other changes from someone
> else that I just took.  Can you rebase it and resend?

Sure. Done.

I cut off the first two patches, because they are redundant now.

Thanks.

> 
> thanks,
> 
> greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: wilc1000: fix warning while printing

2015-06-02 Thread Konrad Zapalowicz
On 06/02, Sudip Mukherjee wrote:
> On Tue, Jun 02, 2015 at 10:29:17AM +0200, Konrad Zapalowicz wrote:
> > On 06/02, Sudip Mukherjee wrote:
> > > size_t should print using %zu, but here it was using %d and hence we
> > > were getting warning while printing.
> > > 
> > > Signed-off-by: Sudip Mukherjee 
> > > ---
> > > 
> > > I think it will be easy to remove the other warnings if all the typedefs
> > > are removed first.
> > > 
> > >  drivers/staging/wilc1000/wilc_spi.c   | 2 +-
> > >  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
> > >  2 files changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> > > b/drivers/staging/wilc1000/wilc_spi.c
> > > index d0e7610..6d854fd 100644
> > > --- a/drivers/staging/wilc1000/wilc_spi.c
> > > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > > @@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t 
> > > adr, uint8_t *b, uint32_t sz,
> > >  #undef NUM_DUMMY_BYTES
> > >  
> > >   if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
> > > - PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%d)\n",
> > > + PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%lu)\n",
> > 
> > Hi, it seems that the above line should use %zu too. Am I correct or I'm
> > missing something?
> oops. my mistake. %lu is correct but i missed mentioning the warning
> about long unsigned int in the commit message.

Why %lu here and %zu in other places? I mean that it is the same size_t
or I'm missing something?

 - konrad

> regards
> sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] staging: wilc1000: fix warning while printing

2015-06-02 Thread Sudip Mukherjee
size_t should print using %zu and unsigned long int should use %lu
but here it was using %d and hence we were getting warning while
printing.

Signed-off-by: Sudip Mukherjee 
---

v2: missed mentioning unsigned long int in commit message.

 drivers/staging/wilc1000/wilc_spi.c   | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index d0e7610..6d854fd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, 
uint8_t *b, uint32_t sz,
 #undef NUM_DUMMY_BYTES
 
if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
-   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%d)\n",
+   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%lu)\n",
 len2, (sizeof(wb) / sizeof(wb[0])));
result = N_FAIL;
return result;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e9ab2cb..6fdb0d6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -638,7 +638,7 @@ static void CfgConnectResult(tenuConnDisconnEvent 
enuConnDisconnEvent,
}
 
 
-   PRINT_D(CFG80211_DBG, "Association request info elements length 
= %d\n", pstrConnectInfo->ReqIEsLen);
+   PRINT_D(CFG80211_DBG, "Association request info elements length 
= %zu\n", pstrConnectInfo->ReqIEsLen);
 
PRINT_D(CFG80211_DBG, "Association response info elements 
length = %d\n", pstrConnectInfo->u16RespIEsLen);
 
@@ -778,7 +778,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct 
cfg80211_scan_request *r
}
 
PRINT_D(CFG80211_DBG, "Requested num of scan channel %d\n", 
request->n_channels);
-   PRINT_D(CFG80211_DBG, "Scan Request IE len =  %d\n", 
request->ie_len);
+   PRINT_D(CFG80211_DBG, "Scan Request IE len =  %zu\n", 
request->ie_len);
 
PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
 
@@ -3316,7 +3316,7 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct 
net_device *dev,
priv = wiphy_priv(wiphy);
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
 
-   PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
%d Tail length = %d\n",
+   PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
%zu Tail length = %zu\n",
settings->beacon_interval, settings->dtim_period, 
beacon->head_len, beacon->tail_len);
 
s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/2] staging: wilc1000: Cleanup to coreconfigurator

2015-06-02 Thread Stanislav Kholmanskikh
Fixed several syntax/style issues found with checkpatch.pl.

Signed-off-by: Stanislav Kholmanskikh 
---
Changes since V2:
* The first 2 patches were removed, because what they fix is already fixed now.


 drivers/staging/wilc1000/coreconfigurator.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index e3e3f20..43864dc 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -28,7 +28,7 @@
 #define INVALID 255
 #define MAC_ADDR_LEN6
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
-   BEACON_INTERVAL_LEN + 
CAP_INFO_LEN)
+BEACON_INTERVAL_LEN + CAP_INFO_LEN)
 
 /*/
 /* Function Macros   */
@@ -672,14 +672,14 @@ INLINE WILC_Uint16 get_asoc_id(u8 *data)
 WILC_Sint32 CoreConfiguratorInit(void)
 {
WILC_Sint32 s32Error = WILC_SUCCESS;
-   PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit() \n");
+   PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
 
sema_init(&SemHandleSendPkt, 1);
sema_init(&SemHandlePktResp, 0);
 
gps8ConfigPacket = (WILC_Sint8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
if (gps8ConfigPacket == NULL) {
-   PRINT_ER("failed in gps8ConfigPacket allocation \n");
+   PRINT_ER("failed in gps8ConfigPacket allocation\n");
s32Error = WILC_NO_MEM;
goto _fail_;
}
@@ -710,13 +710,13 @@ u8 *get_tim_elm(u8 *pu8msa, WILC_Uint16 u16RxLen, 
WILC_Uint16 u16TagParamOffset)
/* Search for the TIM Element Field and return if the element is found 
*/
while (u16index < (u16RxLen - FCS_LEN)) {
if (pu8msa[u16index] == ITIM) {
-   return(&pu8msa[u16index]);
+   return &pu8msa[u16index];
} else {
u16index += (IE_HDR_LEN + pu8msa[u16index + 1]);
}
}
 
-   return(0);
+   return 0;
 }
 
 /* This function gets the current channel information from
@@ -728,7 +728,7 @@ u8 get_current_channel_802_11n(u8 *pu8msa, WILC_Uint16 
u16RxLen)
index = TAG_PARAM_OFFSET;
while (index < (u16RxLen - FCS_LEN)) {
if (pu8msa[index] == IDSPARMS)
-   return (pu8msa[index + 2]);
+   return pu8msa[index + 2];
else
/* Increment index by length information and header */
index += pu8msa[index + 1] + IE_HDR_LEN;
@@ -750,7 +750,7 @@ u8 get_current_channel(u8 *pu8msa, WILC_Uint16 u16RxLen)
 #else /* FIVE_GHZ_BAND */
/* Extract current channel information from */
/* the beacon/probe response frame  */
-   return (get_current_channel_802_11n(pu8msa, u16RxLen));
+   return get_current_channel_802_11n(pu8msa, u16RxLen);
 #endif /* FIVE_GHZ_BAND */
 #else
return 0;
@@ -1444,7 +1444,7 @@ void ProcessAdrWid(WILC_Char *pcPacket, WILC_Sint32 
*ps32PktLen,
 void ProcessBinWid(WILC_Char *pcPacket, WILC_Sint32 *ps32PktLen,
   tstrWID *pstrWID, u8 *pu8val, WILC_Sint32 s32ValueSize)
 {
-   /* WILC_ERROR("processing Binary WIDs is not supported \n"); */
+   /* WILC_ERROR("processing Binary WIDs is not supported\n"); */
 
WILC_Uint16 u16MsgLen = 0;
WILC_Uint16 idx= 0;
@@ -1583,7 +1583,7 @@ WILC_Sint32 further_process_response(u8 *resp,
WILC_memcpy(pstrWIDresult->ps8WidVal, cfg_str, 
cfg_len); /* mostafa: no need currently for the extra NULL byte */
pstrWIDresult->s32ValueSize = cfg_len;
} else {
-   PRINT_ER("allocated WID buffer length is smaller than 
the received WID Length \n");
+   PRINT_ER("allocated WID buffer length is smaller than 
the received WID Length\n");
retval = -2;
}
 
@@ -2027,7 +2027,7 @@ WILC_Sint32 ConfigProvideResponse(WILC_Char 
*pcRespBuffer, WILC_Sint32 s32RespLe
} else {
WILC_memcpy(gstrConfigPktInfo.pcRespBuffer, 
pcRespBuffer, gstrConfigPktInfo.s32MaxRespBuffLen);
gstrConfigPktInfo.s32BytesRead = 
gstrConfigPktInfo.s32MaxRespBuffLen;
-   PRINT_ER("BusProvideResponse() Response greater than 
the prepared Buffer Size \n");
+   PRINT_ER("BusProvideResponse() Response greater than 
the prepared Buffer Size\n");
}
 
up(&SemHandlePktResp);
@@ -2076,7 +2076,7 @@ WILC_Sint32 ConfigPktReceived(u8 *pu8RxPacket, 
WILC_Sint32 s32RxPacketLen)
break;
 
default:
-

[PATCH v3 2/2] staging: wilc1000: Align enum members in coreconfigurator

2015-06-02 Thread Stanislav Kholmanskikh
Aligned enum members to follow a common style per enum.

Signed-off-by: Stanislav Kholmanskikh 
---
 drivers/staging/wilc1000/coreconfigurator.c | 29 +++---
 drivers/staging/wilc1000/coreconfigurator.h | 62 ++---
 2 files changed, 46 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 43864dc..c55ed9d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -40,11 +40,12 @@
 /*/
 
 /* Basic Frame Type Codes (2-bit) */
-typedef enum {FRAME_TYPE_CONTROL = 0x04,
- FRAME_TYPE_DATA= 0x08,
- FRAME_TYPE_MANAGEMENT= 0x00,
- FRAME_TYPE_RESERVED  = 0x0C,
- FRAME_TYPE_FORCE_32BIT  = 0x
+typedef enum {
+   FRAME_TYPE_CONTROL = 0x04,
+   FRAME_TYPE_DATA= 0x08,
+   FRAME_TYPE_MANAGEMENT  = 0x00,
+   FRAME_TYPE_RESERVED= 0x0C,
+   FRAME_TYPE_FORCE_32BIT = 0x
 } tenuBasicFrmType;
 
 /* Frame Type and Subtype Codes (6-bit) */
@@ -188,7 +189,7 @@ static tstrWID gastrWIDs[] = {
{WID_QOS_ENABLE,WID_CHAR},
{WID_11I_MODE,  WID_CHAR},
{WID_CURRENT_TX_RATE,   WID_CHAR},
-   {WID_LINKSPEED,   WID_CHAR},
+   {WID_LINKSPEED, WID_CHAR},
{WID_RTS_THRESHOLD, WID_SHORT},
{WID_FRAG_THRESHOLD,WID_SHORT},
{WID_SSID,  WID_STR},
@@ -223,14 +224,14 @@ static tstrWID gastrWIDs[] = {
{WID_MEMORY_ACCESS_32BIT,   WID_INT},
{WID_MEMORY_ACCESS_16BIT,   WID_SHORT},
{WID_MEMORY_ACCESS_8BIT,WID_CHAR},
-   {WID_SITE_SURVEY_RESULTS,   WID_STR},
-   {WID_PMKID_INFO,WID_STR},
-   {WID_ASSOC_RES_INFO,WID_STR},
-   {WID_MANUFACTURER,  WID_STR}, /* 4 Wids 
added for the CAPI tool*/
-   {WID_MODEL_NAME,WID_STR},
-   {WID_MODEL_NUM, WID_STR},
-   {WID_DEVICE_NAME,   WID_STR},
-   {WID_SSID_PROBE_REQ, WID_STR},
+   {WID_SITE_SURVEY_RESULTS,   WID_STR},
+   {WID_PMKID_INFO,WID_STR},
+   {WID_ASSOC_RES_INFO,WID_STR},
+   {WID_MANUFACTURER,  WID_STR}, /* 4 Wids added for the CAPI 
tool*/
+   {WID_MODEL_NAME,WID_STR},
+   {WID_MODEL_NUM, WID_STR},
+   {WID_DEVICE_NAME,   WID_STR},
+   {WID_SSID_PROBE_REQ,WID_STR},
 
 #ifdef MAC_802_11N
{WID_11N_ENABLE,WID_CHAR},
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 73cdbef..b8e5241 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -19,9 +19,9 @@
 /*/
 /* Number of WID Options Supported */
 #define NUM_BASIC_SWITCHES  45
-#define NUM_FHSS_SWITCHES0
+#define NUM_FHSS_SWITCHES   0
 
-#define NUM_RSSI   5
+#define NUM_RSSI5
 
 #ifdef MAC_802_11N
 #define NUM_11N_BASIC_SWITCHES  25
@@ -51,14 +51,14 @@ extern WILC_Uint16 g_num_total_switches;
 
 #define MAX_PACKET_BUFF_SIZE 1596
 
-#define MAX_STRING_LEN 256
-#define MAX_SURVEY_RESULT_FRAG_SIZE MAX_STRING_LEN
-#define SURVEY_RESULT_LENGTH   44
-#define MAX_ASSOC_RESP_FRAME_SIZE MAX_STRING_LEN
+#define MAX_STRING_LEN   256
+#define MAX_SURVEY_RESULT_FRAG_SIZE  MAX_STRING_LEN
+#define SURVEY_RESULT_LENGTH 44
+#define MAX_ASSOC_RESP_FRAME_SIZEMAX_STRING_LEN
 
-#define STATUS_MSG_LEN 12
-#define MAC_CONNECTED  1
-#define MAC_DISCONNECTED   0
+#define STATUS_MSG_LEN   12
+#define MAC_CONNECTED1
+#define MAC_DISCONNECTED 0
 
 
 
@@ -327,10 +327,10 @@ typedef enum {
WID_SUPP_PASSWORD  = 0x3011,
WID_SITE_SURVEY_RESULTS= 0x3012,
WID_RX_POWER_LEVEL = 0x3013,
-   WID_MANUFACTURER   = 0x3026, /*Added for 
CAPI tool */
-   WID_MODEL_NAME = 0x3027,
 /*Added for CAPI tool */
-   WID_MODEL_NUM  = 0x3028, /*Added for 
CAPI tool */
-   WID_DEVICE_NAME= 0x3029,
 /*Added for CAPI tool */
+   WID_MANUFACTURER   = 0x3026,/*Added for CAPI tool */
+   WID_MODEL_NAME = 0x3027,/*Added for CAPI

[PATCH] ath9k: fix DMA stop sequence for AR9003+

2015-06-02 Thread Felix Fietkau
AR93xx and newer needs to stop rx before tx to avoid getting the DMA
engine or MAC into a stuck state.
This should reduce/fix the occurence of "Failed to stop Tx DMA" logspam.

Cc: sta...@vger.kernel.org
Signed-off-by: Felix Fietkau 
---
 drivers/net/wireless/ath/ath9k/main.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index d285e3a..cfd45cb 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -216,11 +216,13 @@ static bool ath_prepare_reset(struct ath_softc *sc)
ath_stop_ani(sc);
ath9k_hw_disable_interrupts(ah);
 
-   if (!ath_drain_all_txq(sc))
-   ret = false;
-
-   if (!ath_stoprecv(sc))
-   ret = false;
+   if (AR_SREV_9300_20_OR_LATER(ah)) {
+   ret &= ath_stoprecv(sc);
+   ret &= ath_drain_all_txq(sc);
+   } else {
+   ret &= ath_drain_all_txq(sc);
+   ret &= ath_stoprecv(sc);
+   }
 
return ret;
 }
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: wilc1000: fix warning while printing

2015-06-02 Thread Sudip Mukherjee
On Tue, Jun 02, 2015 at 10:29:17AM +0200, Konrad Zapalowicz wrote:
> On 06/02, Sudip Mukherjee wrote:
> > size_t should print using %zu, but here it was using %d and hence we
> > were getting warning while printing.
> > 
> > Signed-off-by: Sudip Mukherjee 
> > ---
> > 
> > I think it will be easy to remove the other warnings if all the typedefs
> > are removed first.
> > 
> >  drivers/staging/wilc1000/wilc_spi.c   | 2 +-
> >  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> > b/drivers/staging/wilc1000/wilc_spi.c
> > index d0e7610..6d854fd 100644
> > --- a/drivers/staging/wilc1000/wilc_spi.c
> > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > @@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, 
> > uint8_t *b, uint32_t sz,
> >  #undef NUM_DUMMY_BYTES
> >  
> > if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
> > -   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%d)\n",
> > +   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%lu)\n",
> 
> Hi, it seems that the above line should use %zu too. Am I correct or I'm
> missing something?
oops. my mistake. %lu is correct but i missed mentioning the warning
about long unsigned int in the commit message.

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: wilc1000: fix warning while printing

2015-06-02 Thread Konrad Zapalowicz
On 06/02, Sudip Mukherjee wrote:
> size_t should print using %zu, but here it was using %d and hence we
> were getting warning while printing.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
> 
> I think it will be easy to remove the other warnings if all the typedefs
> are removed first.
> 
>  drivers/staging/wilc1000/wilc_spi.c   | 2 +-
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> b/drivers/staging/wilc1000/wilc_spi.c
> index d0e7610..6d854fd 100644
> --- a/drivers/staging/wilc1000/wilc_spi.c
> +++ b/drivers/staging/wilc1000/wilc_spi.c
> @@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, 
> uint8_t *b, uint32_t sz,
>  #undef NUM_DUMMY_BYTES
>  
>   if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
> - PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%d)\n",
> + PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%lu)\n",

Hi, it seems that the above line should use %zu too. Am I correct or I'm
missing something?

 - konrad

>len2, (sizeof(wb) / sizeof(wb[0])));
>   result = N_FAIL;
>   return result;
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index e9ab2cb..6fdb0d6 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -638,7 +638,7 @@ static void CfgConnectResult(tenuConnDisconnEvent 
> enuConnDisconnEvent,
>   }
>  
>  
> - PRINT_D(CFG80211_DBG, "Association request info elements length 
> = %d\n", pstrConnectInfo->ReqIEsLen);
> + PRINT_D(CFG80211_DBG, "Association request info elements length 
> = %zu\n", pstrConnectInfo->ReqIEsLen);
>  
>   PRINT_D(CFG80211_DBG, "Association response info elements 
> length = %d\n", pstrConnectInfo->u16RespIEsLen);
>  
> @@ -778,7 +778,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct 
> cfg80211_scan_request *r
>   }
>  
>   PRINT_D(CFG80211_DBG, "Requested num of scan channel %d\n", 
> request->n_channels);
> - PRINT_D(CFG80211_DBG, "Scan Request IE len =  %d\n", 
> request->ie_len);
> + PRINT_D(CFG80211_DBG, "Scan Request IE len =  %zu\n", 
> request->ie_len);
>  
>   PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
>  
> @@ -3316,7 +3316,7 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, 
> struct net_device *dev,
>   priv = wiphy_priv(wiphy);
>   PRINT_D(HOSTAPD_DBG, "Starting ap\n");
>  
> - PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
> %d Tail length = %d\n",
> + PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
> %zu Tail length = %zu\n",
>   settings->beacon_interval, settings->dtim_period, 
> beacon->head_len, beacon->tail_len);
>  
>   s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef);
> -- 
> 1.8.1.2
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] staging: wilc1000: fix warning while printing

2015-06-02 Thread Sudip Mukherjee
size_t should print using %zu, but here it was using %d and hence we
were getting warning while printing.

Signed-off-by: Sudip Mukherjee 
---

I think it will be easy to remove the other warnings if all the typedefs
are removed first.

 drivers/staging/wilc1000/wilc_spi.c   | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index d0e7610..6d854fd 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -404,7 +404,7 @@ static int spi_cmd_complete(uint8_t cmd, uint32_t adr, 
uint8_t *b, uint32_t sz,
 #undef NUM_DUMMY_BYTES
 
if (len2 > (sizeof(wb) / sizeof(wb[0]))) {
-   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%d)\n",
+   PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%lu)\n",
 len2, (sizeof(wb) / sizeof(wb[0])));
result = N_FAIL;
return result;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index e9ab2cb..6fdb0d6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -638,7 +638,7 @@ static void CfgConnectResult(tenuConnDisconnEvent 
enuConnDisconnEvent,
}
 
 
-   PRINT_D(CFG80211_DBG, "Association request info elements length 
= %d\n", pstrConnectInfo->ReqIEsLen);
+   PRINT_D(CFG80211_DBG, "Association request info elements length 
= %zu\n", pstrConnectInfo->ReqIEsLen);
 
PRINT_D(CFG80211_DBG, "Association response info elements 
length = %d\n", pstrConnectInfo->u16RespIEsLen);
 
@@ -778,7 +778,7 @@ static int WILC_WFI_CfgScan(struct wiphy *wiphy, struct 
cfg80211_scan_request *r
}
 
PRINT_D(CFG80211_DBG, "Requested num of scan channel %d\n", 
request->n_channels);
-   PRINT_D(CFG80211_DBG, "Scan Request IE len =  %d\n", 
request->ie_len);
+   PRINT_D(CFG80211_DBG, "Scan Request IE len =  %zu\n", 
request->ie_len);
 
PRINT_D(CFG80211_DBG, "Number of SSIDs %d\n", request->n_ssids);
 
@@ -3316,7 +3316,7 @@ static int WILC_WFI_start_ap(struct wiphy *wiphy, struct 
net_device *dev,
priv = wiphy_priv(wiphy);
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
 
-   PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
%d Tail length = %d\n",
+   PRINT_D(HOSTAPD_DBG, "Interval = %d \n DTIM period = %d\n Head length = 
%zu Tail length = %zu\n",
settings->beacon_interval, settings->dtim_period, 
beacon->head_len, beacon->tail_len);
 
s32Error = WILC_WFI_CfgSetChannel(wiphy, &settings->chandef);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: iwlwifi/iwlmvm dies on resume when rfkill is set

2015-06-02 Thread Coelho, Luciano
On Mon, 2015-06-01 at 23:30 +, Grumbach, Emmanuel wrote:
> On Mon, 2015-06-01 at 15:51 -0700, Andy Lutomirski wrote:
> > If I switch my laptop into airplane mode (hardware switch) and then
> > suspend and resume, my wireless is dead on resume and it spews all
> > over the kernel log (see below).  I can rescue it by switching
> > airplane mode off and then suspending and resuming again.
> > 
> 
> This one is tracked here:
> https://bugzilla.kernel.org/show_bug.cgi?id=98591
> 
> 
> > This problem has existed on all kernel versions I've tried, although I
> > haven't tried a 4.0 kernel yet.
> > 
> 
> This is a tricky HW timing issues which (as you can imagine) we can't
> reproduce internally.
> You seem to have a LENOVO whereas the submitted of the bugzilla above
> has some other OEM.
> We are currently checking with our System people (who know the HW) how
> we should address that.

Right, I'm investigating this.  The problem seems to be a quick toggle
of the rfkill interrupt that may be caused by the way we reset the
device when resuming.  I have involved our System and HW people and I'll
let you know how it is going as soon as I have more info.

Thanks for reporting!

--
Luca.
N�r��yb�X��ǧv�^�)޺{.n�+{��*ޕ�,�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

Re: debian: crda package depends on iw?

2015-06-02 Thread Luca Coelho

On Fri, 2015-05-29 at 14:47 +0100, Ben Hutchings wrote:
> On Fri, 2015-05-29 at 16:24 +0300, Luca Coelho wrote:
> > Hi Ben,
> > 
> > I just noticed that the crda package depends on the iw package in Debian
> > (I'm using jessie):
> > 
> > luca@weizen:~$ apt-cache show crda
> > Package: crda
> > Version: 3.13-1
> > Installed-Size: 293
> > Maintainer: Ben Hutchings 
> > Architecture: amd64
> > Depends: libc6 (>= 2.7), libnl-3-200 (>= 3.2.7), libnl-genl-3-200 (>= 
> > 3.2.7), libssl1.0.0 (>= 1.0.0), wireless-regdb, iw (>= 3.2-1~)
> > Description-en: wireless Central Regulatory Domain Agent
> >  This package provides a Central Regulatory Domain Agent (CRDA) to be used 
> > by
> >  the Linux kernel cfg80211 wireless subsystem to query and apply the 
> > regulatory
> >  domain settings wireless devices may operate within for a given location.
> >  .
> >  CRDA queries operational frequency regulations stored within the regulatory
> >  database provided by the wireless-regdb package.
> > Description-md5: bacfc9c20ed2cf2120d3c95c8e749666
> > Multi-Arch: foreign
> > Homepage: http://wireless.kernel.org/en/developers/Regulatory/CRDA
> > Tag: role::program
> > Section: net
> > Priority: optional
> > Filename: pool/main/c/crda/crda_3.13-1_amd64.deb
> > Size: 59958
> > MD5sum: 6eacfbb62c7647ee3bba653ee5adfe70
> > SHA1: 0f02aebc61f68b87189c867369dbd5df74f4e5ca
> > SHA256: 52d114e826944a492d68b3e4e77aed0f9c28f6a7c3d5c587027eb283f2cc
> > 
> > Is there a specific reason for this or is it just accidental?
> 
> setregdomain is a script that runs iw.

Ah, okay, thanks for clarifying! I wasn't expecting this dependency.

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ath10k: remove unused variable 'id' in ath10k_pci_tx_pipe_cleanup()

2015-06-02 Thread Raja Mani
mete_data is extracted from ce descriptor and stored in variable 'id'.
later, id is not used anywhere in the same function.

Fixes: d84a512dca23 ("ath10k: remove transfer_id from
ath10k_hif_cb::tx_completion")

Signed-off-by: Raja Mani 
---

V2 changes:
  - added original commit msg detail in commit log which 
introduced this unused variable.

 drivers/net/wireless/ath/ath10k/pci.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 969a123..bbc349a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1275,7 +1275,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
struct ath10k_ce_ring *ce_ring;
struct ce_desc *ce_desc;
struct sk_buff *skb;
-   unsigned int id;
int i;
 
ar = pci_pipe->hif_ce_state;
@@ -1299,8 +1298,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
continue;
 
ce_ring->per_transfer_context[i] = NULL;
-   id = MS(__le16_to_cpu(ce_desc[i].flags),
-   CE_DESC_FLAGS_META_DATA);
 
ar_pci->msg_callbacks_current.tx_completion(ar, skb);
}
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: remove unused variable 'id' in ath10k_pci_tx_pipe_cleanup()

2015-06-02 Thread Michal Kazior
On 2 June 2015 at 09:14, Raja Mani  wrote:
> mete_data is extracted from ce descriptor and stored in variable 'id'.
> later, id is not used anywhere in the same function.
>
> Signed-off-by: Raja Mani 
> ---
>  drivers/net/wireless/ath/ath10k/pci.c |3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
> b/drivers/net/wireless/ath/ath10k/pci.c
> index 969a123..bbc349a 100644
> --- a/drivers/net/wireless/ath/ath10k/pci.c
> +++ b/drivers/net/wireless/ath/ath10k/pci.c
> @@ -1275,7 +1275,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
> ath10k_pci_pipe *pci_pipe)
> struct ath10k_ce_ring *ce_ring;
> struct ce_desc *ce_desc;
> struct sk_buff *skb;
> -   unsigned int id;
> int i;
>
> ar = pci_pipe->hif_ce_state;
> @@ -1299,8 +1298,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
> ath10k_pci_pipe *pci_pipe)
> continue;
>
> ce_ring->per_transfer_context[i] = NULL;
> -   id = MS(__le16_to_cpu(ce_desc[i].flags),
> -   CE_DESC_FLAGS_META_DATA);
>
> ar_pci->msg_callbacks_current.tx_completion(ar, skb);

Good catch. I forgot to remove this. I guess one could say this qualifies as:

 Fixes: d84a512dca23 ("ath10k: remove transfer_id from
ath10k_hif_cb::tx_completion")


Michał
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] ath10k: add cryptmode param to support sw crypto and raw tx injection.

2015-06-02 Thread Michal Kazior
On 1 June 2015 at 21:44, David Liu  wrote:
[...]
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -91,6 +91,7 @@ struct ath10k_skb_cb {
> u8 tid;
> u16 freq;
> bool is_offchan;
> +   bool nohwcrypt;
> struct ath10k_htt_txbuf *txbuf;
> u32 txbuf_paddr;
> } __packed htt;
> @@ -349,6 +350,7 @@ struct ath10k_vif {
> } u;
>
> bool use_cts_prot;
> +   bool nohwcrypt;

So this is a bit confusing. This is used only for tx policy only,
right? It should be named accordingly then. The other nohwcrypt in
skb_cb pretty much implies Tx already.


[...]
> @@ -484,6 +491,12 @@ enum ath10k_dev_flags {
>  * waiters should immediately cancel instead of waiting for a time 
> out.
>  */
> ATH10K_FLAG_CRASH_FLUSH,
> +
> +   /* Use Raw mode for Tx and Rx */
> +   ATH10K_RAW_MODE,
> +
> +   /* Disable HW crypto engine */
> +   ATH10K_HW_CRYPTO_DISABLED,

You're missing the _FLAG prefix. Also this isn't documented well
enough. RAW_MODE implies sw crypto rx, no? Perhaps a more fine grained
approach would be better:

 ATH10K_FLAG_RAW_TX,
 ATH10K_FLAG_RAW_RX,
 ATH10K_FLAG_SW_TX_CRYPTO,
 ATH10K_FLAG_SW_RX_CRYPTO,

Obviously not all combinations are valid/doable but I think this will
make the code look more obvious.


>  };
>
>  enum ath10k_cal_mode {
> @@ -492,6 +505,15 @@ enum ath10k_cal_mode {
> ATH10K_CAL_MODE_DT,
>  };
>
> +enum ath10k_crypt_mode {
> +   /* Use HW crypto engine only */
> +   ATH10K_CRYPT_MODE_HW,
> +   /* HW SW crypto engine only (ie. HW crypto engine disabled) */
> +   ATH10K_CRYPT_MODE_SW,
> +   /* Both SW & HW crypto engine supported */
> +   ATH10K_CRYPT_MODE_HW_SW,

I don't think this is clear enough (and the comments don't help at all):

 ATH10K_CRYPT_MODE_HW,
 ATH10K_CRYPT_MODE_SW,
 ATH10K_CRYPT_MODE_SW_RX_HW_TX,

It would also be nice to have some sort of indication in driver
logs/dmesg (without any debug_masks) as to what crypto mode driver
uses so that if someone reports a bug we can quickly see their base
configuration. Having it completely configurable during runtime is a
bit of a pain in this regard though.. but most people will likely just
set cryptmode in modprobe.conf or something. Thoughts?


> +};
> +
>  static inline const char *ath10k_cal_mode_str(enum ath10k_cal_mode mode)
>  {
> switch (mode) {
> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
> b/drivers/net/wireless/ath/ath10k/htt_rx.c
> index 89eb16b..a7df05d 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -1018,8 +1018,7 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k 
> *ar,
>
> /* In most cases this will be true for sniffed frames. It makes sense
>  * to deliver them as-is without stripping the crypto param. This 
> would
> -* also make sense for software based decryption (which is not
> -* implemented in ath10k).
> +* also make sense for software based decryption.

I guess you should update the comment even more. The "would" doesn't
fit anymore. Instead: "This is necessary for software crypto too. "

Nonetheless kudos for taking care to update comments.


[...]
> diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
> b/drivers/net/wireless/ath/ath10k/hw.h
> index 85cca29..37fd2f83 100644
> --- a/drivers/net/wireless/ath/ath10k/hw.h
> +++ b/drivers/net/wireless/ath/ath10k/hw.h
> @@ -296,7 +296,7 @@ enum ath10k_hw_rate_cck {
>  #define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
>  #define TARGET_10X_VOW_CONFIG  0
>  #define TARGET_10X_NUM_MSDU_DESC   (1024 + 400)
> -#define TARGET_10X_MAX_FRAG_ENTRIES0
> +#define TARGET_10X_MAX_FRAG_ENTRIES10

This is probably enough at "2" (ath10k doesn't send more than 2 tx
fragments now). I assume fw crashes with raw tx if this isn't fixed,
correct?

Sidenote: I guess TARGET_MAX_FRAG_ENTRIES could be fixed as well. It
might make sense for QCA61X4 hw2.1 which still uses the old Rx
indication event and might be able to do raw txrx + swcrypto. But I'm
a bit reluctant to change this without any testing.


[...]
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
> b/drivers/net/wireless/ath/ath10k/wmi.c
> index 77220b0..1202150 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -508,7 +508,7 @@ static struct wmi_vdev_param_map wmi_10x_vdev_param_map = 
> {
> .txbf = WMI_VDEV_PARAM_UNSUPPORTED,
> .packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED,
> .drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED,
> -   .tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
> +   .tx_encap_type = WMI_10X_VDEV_PARAM_TX_ENCAP_TYPE,

Hmm..

Technically this isn't correct because 10.1 doesn't support this vdev
parameter. Practically this

[PATCH] ath10k: remove unused variable 'id' in ath10k_pci_tx_pipe_cleanup()

2015-06-02 Thread Raja Mani
mete_data is extracted from ce descriptor and stored in variable 'id'.
later, id is not used anywhere in the same function.

Signed-off-by: Raja Mani 
---
 drivers/net/wireless/ath/ath10k/pci.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 969a123..bbc349a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1275,7 +1275,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
struct ath10k_ce_ring *ce_ring;
struct ce_desc *ce_desc;
struct sk_buff *skb;
-   unsigned int id;
int i;
 
ar = pci_pipe->hif_ce_state;
@@ -1299,8 +1298,6 @@ static void ath10k_pci_tx_pipe_cleanup(struct 
ath10k_pci_pipe *pci_pipe)
continue;
 
ce_ring->per_transfer_context[i] = NULL;
-   id = MS(__le16_to_cpu(ce_desc[i].flags),
-   CE_DESC_FLAGS_META_DATA);
 
ar_pci->msg_callbacks_current.tx_completion(ar, skb);
}
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html