[PATCH] ath10k: Convert wow pattern from 802.3 to 802.11

2018-03-29 Thread Wen Gong
When trying to set wow wakeup patterns it fails with this command:

iw phyxx wowlan enable patterns offset xx+ IP address xx.xx.xx.xx

The reason is that the wow pattern from upper layer is in 802.3 format
for this case, it need to convert it to 802.11 format. The input
offset parameter is used for 802.3, but the actual offset firmware
need depends on rx_decap_mode, so that it needs to be recalculated.
Pattern of 802.3 packet is not same with 802.11 packet. If the
rx_decap_mode is ATH10K_HW_TXRX_NATIVE_WIFI, then firmware will
receive data packet with 802.11 format from hardware.

Convert graph:
---
802.3  |dest mac(6B)|src mac(6B)|type(2B)| body...|
 |__ |___|_  |___
|| | |
802.11 |4B|dest mac(6B)| 6B |src mac(6B)|  8B  |type(2B)|  body...  |
---

Tested with QCA6174 hw3.0 with firmware
WLAN.RM.4.4.1-00099-QCARMSWPZ-1, but this will also affect QCA9377.
This has always failed, so it's not a regression with new firmware
releases.

Signed-off-by: Wen Gong 
---
 drivers/net/wireless/ath/ath10k/wmi.h |   4 ++
 drivers/net/wireless/ath/ath10k/wow.c | 128 --
 2 files changed, 126 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index c7b30ed..389f9c7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6724,6 +6724,10 @@ struct wmi_wow_ev_arg {
 #define WOW_MIN_PATTERN_SIZE   1
 #define WOW_MAX_PATTERN_SIZE   148
 #define WOW_MAX_PKT_OFFSET 128
+#define WOW_HDR_LEN(sizeof(struct ieee80211_hdr_3addr) + \
+   sizeof(struct rfc1042_hdr))
+#define WOW_MAX_REDUCE (WOW_HDR_LEN - sizeof(struct ethhdr) - \
+   offsetof(struct ieee80211_hdr_3addr, addr1))
 
 enum wmi_tdls_state {
WMI_TDLS_DISABLE,
diff --git a/drivers/net/wireless/ath/ath10k/wow.c 
b/drivers/net/wireless/ath/ath10k/wow.c
index c4cbccb..9b56a41 100644
--- a/drivers/net/wireless/ath/ath10k/wow.c
+++ b/drivers/net/wireless/ath/ath10k/wow.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2015-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -76,6 +77,98 @@ static int ath10k_wow_cleanup(struct ath10k *ar)
return 0;
 }
 
+static void ath10k_wow_convert_8023_to_80211
+   (struct cfg80211_pkt_pattern *new,
+   const struct cfg80211_pkt_pattern *old)
+{
+   u8 hdr_8023_pattern[ETH_HLEN] = {};
+   u8 hdr_8023_bit_mask[ETH_HLEN] = {};
+   u8 hdr_80211_pattern[WOW_HDR_LEN] = {};
+   u8 hdr_80211_bit_mask[WOW_HDR_LEN] = {};
+
+   int total_len = old->pkt_offset + old->pattern_len;
+   int hdr_80211_end_offset;
+
+   struct ieee80211_hdr_3addr *new_hdr_pattern =
+   (struct ieee80211_hdr_3addr *)hdr_80211_pattern;
+   struct ieee80211_hdr_3addr *new_hdr_mask =
+   (struct ieee80211_hdr_3addr *)hdr_80211_bit_mask;
+   struct ethhdr *old_hdr_pattern = (struct ethhdr *)hdr_8023_pattern;
+   struct ethhdr *old_hdr_mask = (struct ethhdr *)hdr_8023_bit_mask;
+   int hdr_len = sizeof(*new_hdr_pattern);
+
+   struct rfc1042_hdr *new_rfc_pattern =
+   (struct rfc1042_hdr *)(hdr_80211_pattern + hdr_len);
+   struct rfc1042_hdr *new_rfc_mask =
+   (struct rfc1042_hdr *)(hdr_80211_bit_mask + hdr_len);
+   int rfc_len = sizeof(*new_rfc_pattern);
+
+   memcpy(hdr_8023_pattern + old->pkt_offset,
+  old->pattern, ETH_HLEN - old->pkt_offset);
+   memcpy(hdr_8023_bit_mask + old->pkt_offset,
+  old->mask, ETH_HLEN - old->pkt_offset);
+
+   /* Copy destination address */
+   memcpy(new_hdr_pattern->addr1, old_hdr_pattern->h_dest, ETH_ALEN);
+   memcpy(new_hdr_mask->addr1, old_hdr_mask->h_dest, ETH_ALEN);
+
+   /* Copy source address */
+   memcpy(new_hdr_pattern->addr3, old_hdr_pattern->h_source, ETH_ALEN);
+   memcpy(new_hdr_mask->addr3, old_hdr_mask->h_source, ETH_ALEN);
+
+   /* Copy logic link type */
+   memcpy(_rfc_pattern->snap_type,
+  _hdr_pattern->h_proto,
+  sizeof(old_hdr_pattern->h_proto));
+   memcpy(_rfc_mask->snap_type,
+  _hdr_mask->h_proto,
+  sizeof(old_hdr_mask->h_proto));
+
+   /* Caculate new pkt_offset */
+   if (old->pkt_offset < ETH_ALEN)
+   new->pkt_offset = old->pkt_offset +
+   offsetof(struct ieee80211_hdr_3addr, addr1);
+   else if (old->pkt_offset < offsetof(struct ethhdr, h_proto))
+ 

[PATCH 1/2] ath10k: Add WMI_SERVICE_AVAILABLE_EVENT support

2018-03-29 Thread Carl Huang
Add WMI_SERVICE_AVAILABLE_EVENT to extend WMI_SERVICE_READY_EVENT,
the 128bit service map in WMI_SERVICE_READY_EVENT is not enough
for firmware to notice new WLAN service to host driver. Hereby,
for thoese new WLAN service, firmware will notice host driver by
WMI_SERVICE_AVAILABLE_EVENT.

Signed-off-by: Alan Liu 
Signed-off-by: Carl Huang 
---
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  24 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  38 
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 346 +-
 drivers/net/wireless/ath/ath10k/wmi.c |  21 +-
 drivers/net/wireless/ath/ath10k/wmi.h |   9 +-
 5 files changed, 431 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 14093cf..86d083d 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -24,6 +24,7 @@ struct sk_buff;
 struct wmi_ops {
void (*rx)(struct ath10k *ar, struct sk_buff *skb);
void (*map_svc)(const __le32 *in, unsigned long *out, size_t len);
+   void (*map_svc_ext)(const __le32 *in, unsigned long *out, size_t len);
 
int (*pull_scan)(struct ath10k *ar, struct sk_buff *skb,
 struct wmi_scan_ev_arg *arg);
@@ -53,6 +54,9 @@ struct wmi_ops {
  struct wmi_wow_ev_arg *arg);
int (*pull_echo_ev)(struct ath10k *ar, struct sk_buff *skb,
struct wmi_echo_ev_arg *arg);
+   int (*pull_svc_avail)(struct ath10k *ar, struct sk_buff *skb,
+ struct wmi_svc_avail_ev_arg *arg);
+
enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar);
 
struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt);
@@ -223,6 +227,17 @@ ath10k_wmi_map_svc(struct ath10k *ar, const __le32 *in, 
unsigned long *out,
 }
 
 static inline int
+ath10k_wmi_map_svc_ext(struct ath10k *ar, const __le32 *in, unsigned long *out,
+  size_t len)
+{
+   if (!ar->wmi.ops->map_svc_ext)
+   return -EOPNOTSUPP;
+
+   ar->wmi.ops->map_svc_ext(in, out, len);
+   return 0;
+}
+
+static inline int
 ath10k_wmi_pull_scan(struct ath10k *ar, struct sk_buff *skb,
 struct wmi_scan_ev_arg *arg)
 {
@@ -323,6 +338,15 @@ ath10k_wmi_pull_rdy(struct ath10k *ar, struct sk_buff *skb,
 }
 
 static inline int
+ath10k_wmi_pull_svc_avail(struct ath10k *ar, struct sk_buff *skb,
+ struct wmi_svc_avail_ev_arg *arg)
+{
+   if (!ar->wmi.ops->pull_svc_avail)
+   return -EOPNOTSUPP;
+   return ar->wmi.ops->pull_svc_avail(ar, skb, arg);
+}
+
+static inline int
 ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb,
 struct ath10k_fw_stats *stats)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index ae77a00..cb0d130 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -537,6 +537,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct 
sk_buff *skb)
case WMI_TLV_READY_EVENTID:
ath10k_wmi_event_ready(ar, skb);
break;
+   case WMI_TLV_SERVICE_AVAILABLE_EVENTID:
+   ath10k_wmi_event_service_available(ar, skb);
+   break;
case WMI_TLV_OFFLOAD_BCN_TX_STATUS_EVENTID:
ath10k_wmi_tlv_event_bcn_tx_status(ar, skb);
break;
@@ -1054,6 +1057,39 @@ static int ath10k_wmi_tlv_op_pull_rdy_ev(struct ath10k 
*ar,
return 0;
 }
 
+static int ath10k_wmi_tlv_svc_avail_parse(struct ath10k *ar, u16 tag, u16 len,
+ const void *ptr, void *data)
+{
+   struct wmi_svc_avail_ev_arg *arg = data;
+
+   switch (tag) {
+   case WMI_TLV_TAG_STRUCT_SERVICE_AVAILABLE_EVENT:
+   arg->service_map_ext_len = *(__le32 *)ptr;
+   arg->service_map_ext = ptr + sizeof(__le32);
+   return 0;
+   default:
+   break;
+   }
+   return -EPROTO;
+}
+
+static int ath10k_wmi_tlv_op_pull_svc_avail(struct ath10k *ar,
+   struct sk_buff *skb,
+   struct wmi_svc_avail_ev_arg *arg)
+{
+   int ret;
+
+   ret = ath10k_wmi_tlv_iter(ar, skb->data, skb->len,
+ ath10k_wmi_tlv_svc_avail_parse, arg);
+
+   if (ret) {
+   ath10k_warn(ar, "failed to parse svc_avail tlv: %d\n", ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 static void ath10k_wmi_tlv_pull_vdev_stats(const struct wmi_tlv_vdev_stats 
*src,
   struct ath10k_fw_stats_vdev *dst)
 {
@@ -3654,6 +3690,7 @@ static struct wmi_vdev_param_map wmi_tlv_vdev_param_map = 
{
 static 

[PATCH 0/2] ath10k: support MAC address randomization in scan

2018-03-29 Thread Carl Huang
The feature MAC address randomization depends on the firmware
capability, if the firmware indicates WMI_SERVICE_SPOOF_MAC_SUPPORT
service the host driver will report it to upper layer. The service
bit is above the 128 bit limit so a new service check macro is needed.

Carl Huang (2):
  ath10k: Add WMI_SERVICE_AVAILABLE_EVENT support
  ath10k: support MAC address randomization in scan

 drivers/net/wireless/ath/ath10k/mac.c |  17 ++
 drivers/net/wireless/ath/ath10k/wmi-ops.h |  46 
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  63 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 357 +-
 drivers/net/wireless/ath/ath10k/wmi.c |  26 ++-
 drivers/net/wireless/ath/ath10k/wmi.h |  18 +-
 6 files changed, 520 insertions(+), 7 deletions(-)

-- 
2.7.4



[PATCH 2/2] ath10k: support MAC address randomization in scan

2018-03-29 Thread Carl Huang
The ath10k reports the random_mac_addr capability to upper layer
based on the service bit firmware reported. Driver sets the
spoofed flag in scan_ctrl_flag to firmware if upper layer has
enabled this feature in scan request.

Test with QCA6174 hw3.0 and firmware-6.bin_WLAN.RM.4.4.1-00102-QCARMSWP-1,
but QCA9377 is also affected.

Signed-off-by: Carl Huang 
---
 drivers/net/wireless/ath/ath10k/mac.c | 17 +
 drivers/net/wireless/ath/ath10k/wmi-ops.h | 22 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 25 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 11 +++
 drivers/net/wireless/ath/ath10k/wmi.c |  5 +
 drivers/net/wireless/ath/ath10k/wmi.h |  9 +
 6 files changed, 89 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ebb3f1b..c5cd5e5 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -5699,6 +5699,12 @@ static int ath10k_hw_scan(struct ieee80211_hw *hw,
arg.scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE;
}
 
+   if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
+   arg.scan_ctrl_flags |=  WMI_SCAN_ADD_SPOOFED_MAC_IN_PROBE_REQ;
+   ether_addr_copy(arg.mac_addr.addr, req->mac_addr);
+   ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask);
+   }
+
if (req->n_channels) {
arg.n_channels = req->n_channels;
for (i = 0; i < arg.n_channels; i++)
@@ -8397,6 +8403,17 @@ int ath10k_mac_register(struct ath10k *ar)
goto err_dfs_detector_exit;
}
 
+   if (test_bit(WMI_SERVICE_SPOOF_MAC_SUPPORT, ar->wmi.svc_map)) {
+   ret = ath10k_wmi_scan_prob_req_oui(ar, ar->mac_addr);
+   if (ret) {
+   ath10k_err(ar, "failed to set prob req oui: %i\n", ret);
+   goto err_dfs_detector_exit;
+   }
+
+   ar->hw->wiphy->features |=
+   NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
+   }
+
ar->hw->wiphy->cipher_suites = cipher_suites;
 
/* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h 
b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 86d083d..cf17d91 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -118,6 +118,8 @@ struct wmi_ops {
 u32 value);
struct sk_buff *(*gen_scan_chan_list)(struct ath10k *ar,
  const struct 
wmi_scan_chan_list_arg *arg);
+   struct sk_buff *(*gen_scan_prob_req_oui)(struct ath10k *ar,
+u32 prob_req_oui);
struct sk_buff *(*gen_beacon_dma)(struct ath10k *ar, u32 vdev_id,
  const void *bcn, size_t bcn_len,
  u32 bcn_paddr, bool dtim_zero,
@@ -892,6 +894,26 @@ ath10k_wmi_scan_chan_list(struct ath10k *ar,
 }
 
 static inline int
+ath10k_wmi_scan_prob_req_oui(struct ath10k *ar, const u8 mac_addr[ETH_ALEN])
+{
+   struct sk_buff *skb;
+   u32 prob_req_oui;
+
+   prob_req_oui = (((u32)mac_addr[0]) << 16) |
+  (((u32)mac_addr[1]) << 8) | mac_addr[2];
+
+   if (!ar->wmi.ops->gen_scan_prob_req_oui)
+   return -EOPNOTSUPP;
+
+   skb = ar->wmi.ops->gen_scan_prob_req_oui(ar, prob_req_oui);
+   if (IS_ERR(skb))
+   return PTR_ERR(skb);
+
+   return ath10k_wmi_cmd_send(ar, skb,
+   ar->wmi.cmd->scan_prob_req_oui_cmdid);
+}
+
+static inline int
 ath10k_wmi_peer_assoc(struct ath10k *ar,
  const struct wmi_peer_assoc_complete_arg *arg)
 {
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index cb0d130..20e3fd4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1573,6 +1573,8 @@ ath10k_wmi_tlv_op_gen_start_scan(struct ath10k *ar,
cmd->num_bssids = __cpu_to_le32(arg->n_bssids);
cmd->ie_len = __cpu_to_le32(arg->ie_len);
cmd->num_probes = __cpu_to_le32(3);
+   ether_addr_copy(cmd->mac_addr.addr, arg->mac_addr.addr);
+   ether_addr_copy(cmd->mac_mask.addr, arg->mac_mask.addr);
 
/* FIXME: There are some scan flag inconsistencies across firmwares,
 * e.g. WMI-TLV inverts the logic behind the following flag.
@@ -2420,6 +2422,27 @@ ath10k_wmi_tlv_op_gen_scan_chan_list(struct ath10k *ar,
 }
 
 static struct sk_buff *
+ath10k_wmi_tlv_op_gen_scan_prob_req_oui(struct ath10k *ar, u32 prob_req_oui)
+{
+   struct wmi_scan_prob_req_oui_cmd *cmd;
+   struct wmi_tlv *tlv;
+   struct sk_buff *skb;
+
+   skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + 

[PATCH net-next] cfg80211: fix possible memory leak in regdb_query_country()

2018-03-29 Thread Wei Yongjun
'wmm_ptrs' is malloced in regdb_query_country() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Signed-off-by: Wei Yongjun 
---
 net/wireless/reg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 16c7e4e..ac3e12c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1026,6 +1026,7 @@ static int regdb_query_country(const struct fwdb_header 
*db,
 
if (!tmp_rd) {
kfree(regdom);
+   kfree(wmm_ptrs);
return -ENOMEM;
}
regdom = tmp_rd;





Re: Passing uninitialised local variable

2018-03-29 Thread Arend van Spriel

On 3/28/2018 1:20 PM, Himanshu Jha wrote:

Hello everyone,


You added everyone, but me :-(

Not really a problem, but it would help if the driver name was mentioned 
in the subject.



I recently found that a local variable in passed uninitialised to the
function at

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:2950

 u32 var;
 err = brcmf_fil_iovar_int_get(ifp, "dtim_assoc", );
 if (err) {
 brcmf_err("wl dtim_assoc failed (%d)\n", err);
 goto update_bss_info_out;
 }
 dtim_period = (u8)var;


Now, the brcmf_fil_iovar_int_get() is defined as:

s32
brcmf_fil_iovar_int_get(struct brcmf_if *ifp, char *name, u32 *data)
{
 __le32 data_le = cpu_to_le32(*data);
 s32 err;

 err = brcmf_fil_iovar_data_get(ifp, name, _le, sizeof(data_le));
 if (err == 0)
 *data = le32_to_cpu(data_le);
 return err;
}

We can cleary see that 'var' in used uninitialised in the very first line
which is an undefined behavior.


Why undefined? We copy some stack data and we do transfer that to the 
device. However in this case the device does nothing with it and it is 
simply overwritten by the response.



So, what could be a possible fix for the above ?

I'm not sure initialising 'var' to 0 would be the correct solution.


Coverity flagged this and probably still does. For this particular 
instance setting var to '0' is fine. However, there are quite a few 
other places. For some instances the data contains a selector value for 
obtaining info from the device, which is what we copy in 
brcmf_fil_iovar_int_get(). So maybe it would be best to have a separate 
function for those, eg. brcmf_fil_iovar_int_selget() or so.


Regards,
Arend


Re: pull-request: wireless-drivers-next 2018-03-29

2018-03-29 Thread David Miller
From: Kalle Valo 
Date: Thu, 29 Mar 2018 16:21:44 +0300

> here's a pull request to net-next for 4.17. If the merge window starts
> on Sunday this will be the last pull request. Do note that I pulled
> wireless-drivers into wireless-drivers-next as iwlwifi needed some
> patches.
> 
> Please let me know if you have any problems.

Pulled, thank you!


Re: pull-request: mac80211-next 2018-03-29

2018-03-29 Thread David Miller
From: Johannes Berg 
Date: Thu, 29 Mar 2018 15:10:02 +0200

> Last update for -next, I guess, but I wanted to get the ETSI adaptivity
> requirements code and the eapol-over-nl80211 thing out - both have been
> around for a while. A number of other smaller things are also there, of
> course.
> 
> Please pull and let me know if there's any problem.

Pulled, thanks Johannes.


Re: [PATCH] wcn36xx: allocate skbs with GFP_KERNEL during init

2018-03-29 Thread Daniel Mack
On Monday, March 19, 2018 07:30 AM, Daniel Mack wrote:
> GFP_ATOMIC should only be used when the allocation is done from atomic
> context. Introduce a new flag to wcn36xx_dxe_fill_skb() and use GFP_KERNEL
> when pre-allocating buffers during init.
> 
> This doesn't fix an issue that was observed in the wild, but it reduces
> the chance of failed allocations under memory pressure.
> 
> Signed-off-by: Daniel Mack 

Any opinion about this one?


Thanks,
Daniel

> ---
>  drivers/net/wireless/ath/wcn36xx/dxe.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c 
> b/drivers/net/wireless/ath/wcn36xx/dxe.c
> index 5672154948c3..3e180828fbfa 100644
> --- a/drivers/net/wireless/ath/wcn36xx/dxe.c
> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
> @@ -275,12 +275,14 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx 
> *wcn, u16 wcn_ch)
>   return 0;
>  }
>  
> -static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl 
> *ctl)
> +static int wcn36xx_dxe_fill_skb(struct device *dev,
> + struct wcn36xx_dxe_ctl *ctl,
> + gfp_t gfp)
>  {
>   struct wcn36xx_dxe_desc *dxe = ctl->desc;
>   struct sk_buff *skb;
>  
> - skb = alloc_skb(WCN36XX_PKT_SIZE, GFP_ATOMIC);
> + skb = alloc_skb(WCN36XX_PKT_SIZE, gfp);
>   if (skb == NULL)
>   return -ENOMEM;
>  
> @@ -307,7 +309,7 @@ static int wcn36xx_dxe_ch_alloc_skb(struct wcn36xx *wcn,
>   cur_ctl = wcn_ch->head_blk_ctl;
>  
>   for (i = 0; i < wcn_ch->desc_num; i++) {
> - wcn36xx_dxe_fill_skb(wcn->dev, cur_ctl);
> + wcn36xx_dxe_fill_skb(wcn->dev, cur_ctl, GFP_KERNEL);
>   cur_ctl = cur_ctl->next;
>   }
>  
> @@ -533,7 +535,7 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
>   while (!(dxe->ctrl & WCN36XX_DXE_CTRL_VALID_MASK)) {
>   skb = ctl->skb;
>   dma_addr = dxe->dst_addr_l;
> - ret = wcn36xx_dxe_fill_skb(wcn->dev, ctl);
> + ret = wcn36xx_dxe_fill_skb(wcn->dev, ctl, GFP_ATOMIC);
>   if (0 == ret) {
>   /* new skb allocation ok. Use the new one and queue
>* the old one to network system.
> 



License info

2018-03-29 Thread Larry Finger

Kalle,

What is your position regarding license information? Should the standard GPL-V2 
boiler plate be replaced with "SPDX-License-Identifier: GPL-2.0" in wireless files?


Thanks,

Larry


Re: [PATCH net-next 0/5] Introduce net_rwsem to protect net_namespace_list

2018-03-29 Thread David Miller
From: Kirill Tkhai 
Date: Thu, 29 Mar 2018 19:20:23 +0300

> The series introduces fine grained rw_semaphore, which will be used
> instead of rtnl_lock() to protect net_namespace_list.
> 
> This improves scalability and allows to do non-exclusive sleepable
> iteration for_each_net(), which is enough for most cases.
> 
> scripts/get_maintainer.pl gives enormous list of people, and I add
> all to CC.
> 
> Note, that this patch is independent of "Close race between
> {un, }register_netdevice_notifier and pernet_operations":
> https://patchwork.ozlabs.org/project/netdev/list/?series=36495
> 
> Signed-off-by: Kirill Tkhai 

Great stuff!

Series applied, thanks!


[PATCH] ath10k: fix spelling mistake: "tiggers" -> "triggers"

2018-03-29 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in message text

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/ath/ath10k/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 9649bb752bbd..2f991f79a90f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -7719,7 +7719,7 @@ ath10k_wmi_fw_pdev_tx_stats_fill(const struct 
ath10k_fw_stats_pdev *pdev,
len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
 "HW rate", pdev->data_rc);
len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
-"Sched self tiggers", pdev->self_triggers);
+"Sched self triggers", pdev->self_triggers);
len += scnprintf(buf + len, buf_len - len, "%30s %10d\n",
 "Dropped due to SW retries",
 pdev->sw_retry_failure);
-- 
2.15.1



[PATCH] ath6kl: fix spelling mistake: "chache" -> "cache"

2018-03-29 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in message text

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/ath/ath6kl/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c 
b/drivers/net/wireless/ath/ath6kl/debug.c
index 0f965e9f38a4..4e94b22eaada 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -645,7 +645,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char 
__user *user_buf,
len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
 "CRC Err", tgt_stats->rx_crc_err);
len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
-"Key chache miss", tgt_stats->rx_key_cache_miss);
+"Key cache miss", tgt_stats->rx_key_cache_miss);
len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
 "Decrypt Err", tgt_stats->rx_decrypt_err);
len += scnprintf(buf + len, buf_len - len, "%20s %10llu\n",
-- 
2.15.1



Re: [PATCH 1/2] NFC: pn533: Use kmalloc-ed memory for USB transfer buffers

2018-03-29 Thread Hans de Goede

Samuel,

Can I get an ack for these please?

Anything I need to do to get these picked up / merged?

Regards,

Hans


On 19-03-18 17:40, Hans de Goede wrote:

Commit 8b55d7581fc5 ("NFC: pn533: use constant off-stack buffer for sending
acks"), fixed the ack case of using on stack mem for the transfer_buffer,
by making the ack buffer "static const", which is an unusual solution for
this and I wonder if this is not a problem wrt buffer alignment. It also
misses fixing the same problem for the cmd buffer in the
pn533_acr122_poweron_rdr() function.

This commit introduces an out_buf which gets kmalloc-ed on probe and
then memcpy-s the ack / cmd buffer into that buffer before submitting
the out urb. Fixing the use of on stack memory for the cmd buffer and
moving the ack code-path over to more conventional ways.

While at it this commit also changes the kmalloc of the in_buf to
devm_kmalloc, to avoid the need to introduce a new goto in the error-
handling of the kmalloc of the introduced out_buf.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514134
Fixes: 8b55d7581fc5 ("NFC: pn533: use constant off-stack buffer ...")
Cc: Michał Mirosław 
Signed-off-by: Hans de Goede 
---
  drivers/nfc/pn533/usb.c | 22 +++---
  1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
index e153e8b64bb8..c9398712ba31 100644
--- a/drivers/nfc/pn533/usb.c
+++ b/drivers/nfc/pn533/usb.c
@@ -42,6 +42,9 @@
  #define ACS_VENDOR_ID 0x072f
  #define ACR122U_PRODUCT_ID 0x2200
  
+/* Large enough to hold an ack or the power-on CCID command */

+#define OUT_BUF_LEN 16
+
  static const struct usb_device_id pn533_usb_table[] = {
{ USB_DEVICE(PN533_VENDOR_ID, PN533_PRODUCT_ID),
  .driver_info = PN533_DEVICE_STD },
@@ -61,6 +64,7 @@ struct pn533_usb_phy {
  
  	struct urb *out_urb;

struct urb *in_urb;
+   u8 *out_buf;
  
  	struct pn533 *priv;

  };
@@ -152,7 +156,8 @@ static int pn533_usb_send_ack(struct pn533 *dev, gfp_t 
flags)
/* spec 7.1.1.3:  Preamble, SoPC (2), ACK Code (2), Postamble */
int rc;
  
-	phy->out_urb->transfer_buffer = (u8 *)ack;

+   memcpy(phy->out_buf, ack, sizeof(ack));
+   phy->out_urb->transfer_buffer = phy->out_buf;
phy->out_urb->transfer_buffer_length = sizeof(ack);
rc = usb_submit_urb(phy->out_urb, flags);
  
@@ -373,8 +378,8 @@ static void pn533_acr122_poweron_rdr_resp(struct urb *urb)

  static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy)
  {
/* Power on th reader (CCID cmd) */
-   u8 cmd[10] = {PN533_ACR122_PC_TO_RDR_ICCPOWERON,
- 0, 0, 0, 0, 0, 0, 3, 0, 0};
+   static const u8 cmd[10] = { PN533_ACR122_PC_TO_RDR_ICCPOWERON,
+   0, 0, 0, 0, 0, 0, 3, 0, 0 };
int rc;
void *cntx;
struct pn533_acr122_poweron_rdr_arg arg;
@@ -387,7 +392,8 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy 
*phy)
phy->in_urb->complete = pn533_acr122_poweron_rdr_resp;
phy->in_urb->context = 
  
-	phy->out_urb->transfer_buffer = cmd;

+   memcpy(phy->out_buf, cmd, sizeof(cmd));
+   phy->out_urb->transfer_buffer = phy->out_buf;
phy->out_urb->transfer_buffer_length = sizeof(cmd);
  
  	print_hex_dump_debug("ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1,

@@ -463,10 +469,14 @@ static int pn533_usb_probe(struct usb_interface 
*interface,
if (!phy)
return -ENOMEM;
  
-	in_buf = kzalloc(in_buf_len, GFP_KERNEL);

+   in_buf = devm_kzalloc(>dev, in_buf_len, GFP_KERNEL);
if (!in_buf)
return -ENOMEM;
  
+	phy->out_buf = devm_kzalloc(>dev, OUT_BUF_LEN, GFP_KERNEL);

+   if (!phy->out_buf)
+   return -ENOMEM;
+
phy->udev = usb_get_dev(interface_to_usbdev(interface));
phy->interface = interface;
  
@@ -555,7 +565,6 @@ static int pn533_usb_probe(struct usb_interface *interface,

usb_free_urb(phy->in_urb);
usb_free_urb(phy->out_urb);
usb_put_dev(phy->udev);
-   kfree(in_buf);
  
  	return rc;

  }
@@ -574,7 +583,6 @@ static void pn533_usb_disconnect(struct usb_interface 
*interface)
usb_kill_urb(phy->in_urb);
usb_kill_urb(phy->out_urb);
  
-	kfree(phy->in_urb->transfer_buffer);

usb_free_urb(phy->in_urb);
usb_free_urb(phy->out_urb);
  



[PATCH net-next 0/5] Introduce net_rwsem to protect net_namespace_list

2018-03-29 Thread Kirill Tkhai
The series introduces fine grained rw_semaphore, which will be used
instead of rtnl_lock() to protect net_namespace_list.

This improves scalability and allows to do non-exclusive sleepable
iteration for_each_net(), which is enough for most cases.

scripts/get_maintainer.pl gives enormous list of people, and I add
all to CC.

Note, that this patch is independent of "Close race between
{un, }register_netdevice_notifier and pernet_operations":
https://patchwork.ozlabs.org/project/netdev/list/?series=36495

Signed-off-by: Kirill Tkhai 
---

Kirill Tkhai (5):
  net: Introduce net_rwsem to protect net_namespace_list
  net: Don't take rtnl_lock() in wireless_nlevent_flush()
  security: Remove rtnl_lock() in selinux_xfrm_notify_policyload()
  ovs: Remove rtnl_lock() from ovs_exit_net()
  net: Remove rtnl_lock() in nf_ct_iterate_destroy()


 drivers/infiniband/core/roce_gid_mgmt.c |2 ++
 include/linux/rtnetlink.h   |1 +
 include/net/net_namespace.h |1 +
 net/core/dev.c  |5 +
 net/core/fib_notifier.c |2 ++
 net/core/net_namespace.c|   18 +-
 net/core/rtnetlink.c|5 +
 net/netfilter/nf_conntrack_core.c   |4 ++--
 net/openvswitch/datapath.c  |4 ++--
 net/wireless/wext-core.c|6 ++
 security/selinux/include/xfrm.h |4 ++--
 11 files changed, 37 insertions(+), 15 deletions(-)

--
Signed-off-by: Kirill Tkhai 


[PATCH net-next 4/5] ovs: Remove rtnl_lock() from ovs_exit_net()

2018-03-29 Thread Kirill Tkhai
Here we iterate for_each_net() and removes
vport from alive net to the exiting net.

ovs_net::dps are protected by ovs_mutex(),
and the others, who change it (ovs_dp_cmd_new(),
__dp_destroy()) also take it.
The same with datapath::ports list.

So, we remove rtnl_lock() here.

Signed-off-by: Kirill Tkhai 
---
 net/openvswitch/datapath.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 9746ee30a99b..015e24e08909 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -2363,12 +2363,10 @@ static void __net_exit ovs_exit_net(struct net *dnet)
list_for_each_entry_safe(dp, dp_next, _net->dps, list_node)
__dp_destroy(dp);
 
-   rtnl_lock();
down_read(_rwsem);
for_each_net(net)
list_vports_from_net(net, dnet, );
up_read(_rwsem);
-   rtnl_unlock();
 
/* Detach all vports from given namespace. */
list_for_each_entry_safe(vport, vport_next, , detach_list) {



[PATCH net-next 5/5] net: Remove rtnl_lock() in nf_ct_iterate_destroy()

2018-03-29 Thread Kirill Tkhai
rtnl_lock() doesn't protect net::ct::count,
and it's not needed for__nf_ct_unconfirmed_destroy()
and for nf_queue_nf_hook_drop().

Signed-off-by: Kirill Tkhai 
---
 net/netfilter/nf_conntrack_core.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c 
b/net/netfilter/nf_conntrack_core.c
index 370f9b7f051b..41ff04ee2554 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1763,7 +1763,6 @@ nf_ct_iterate_destroy(int (*iter)(struct nf_conn *i, void 
*data), void *data)
 {
struct net *net;
 
-   rtnl_lock();
down_read(_rwsem);
for_each_net(net) {
if (atomic_read(>ct.count) == 0)
@@ -1772,7 +1771,6 @@ nf_ct_iterate_destroy(int (*iter)(struct nf_conn *i, void 
*data), void *data)
nf_queue_nf_hook_drop(net);
}
up_read(_rwsem);
-   rtnl_unlock();
 
/* Need to wait for netns cleanup worker to finish, if its
 * running -- it might have deleted a net namespace from



[PATCH net-next 3/5] security: Remove rtnl_lock() in selinux_xfrm_notify_policyload()

2018-03-29 Thread Kirill Tkhai
rt_genid_bump_all() consists of ipv4 and ipv6 part.
ipv4 part is incrementing of net::ipv4::rt_genid,
and I see many places, where it's read without rtnl_lock().

ipv6 part calls __fib6_clean_all(), and it's also
called without rtnl_lock() in other places.

So, rtnl_lock() here was used to iterate net_namespace_list only,
and we can remove it.

Signed-off-by: Kirill Tkhai 
---
 security/selinux/include/xfrm.h |2 --
 1 file changed, 2 deletions(-)

diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h
index 31d66431be1e..a0b465316292 100644
--- a/security/selinux/include/xfrm.h
+++ b/security/selinux/include/xfrm.h
@@ -47,12 +47,10 @@ static inline void selinux_xfrm_notify_policyload(void)
 {
struct net *net;
 
-   rtnl_lock();
down_read(_rwsem);
for_each_net(net)
rt_genid_bump_all(net);
up_read(_rwsem);
-   rtnl_unlock();
 }
 #else
 static inline int selinux_xfrm_enabled(void)



[PATCH net-next 2/5] net: Don't take rtnl_lock() in wireless_nlevent_flush()

2018-03-29 Thread Kirill Tkhai
This function iterates over net_namespace_list and flushes
the queue for every of them. What does this rtnl_lock()
protects?! Since we may add skbs to net::wext_nlevents
without rtnl_lock(), it does not protects us about queuers.

It guarantees, two threads can't flush the queue in parallel,
that can change the order, but since skb can be queued
in any order, it doesn't matter, how many threads do this
in parallel. In case of several threads, this will be even
faster.

So, we can remove rtnl_lock() here, as it was used for
iteration over net_namespace_list only.

Signed-off-by: Kirill Tkhai 
---
 net/wireless/wext-core.c |4 
 1 file changed, 4 deletions(-)

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index 544d7b62d7ca..5e677dac2a0c 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -347,8 +347,6 @@ void wireless_nlevent_flush(void)
struct sk_buff *skb;
struct net *net;
 
-   ASSERT_RTNL();
-
down_read(_rwsem);
for_each_net(net) {
while ((skb = skb_dequeue(>wext_nlevents)))
@@ -412,9 +410,7 @@ subsys_initcall(wireless_nlevent_init);
 /* Process events generated by the wireless layer or the driver. */
 static void wireless_nlevent_process(struct work_struct *work)
 {
-   rtnl_lock();
wireless_nlevent_flush();
-   rtnl_unlock();
 }
 
 static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);



[PATCH net-next 1/5] net: Introduce net_rwsem to protect net_namespace_list

2018-03-29 Thread Kirill Tkhai
rtnl_lock() is used everywhere, and contention is very high.
When someone wants to iterate over alive net namespaces,
he/she has no a possibility to do that without exclusive lock.
But the exclusive rtnl_lock() in such places is overkill,
and it just increases the contention. Yes, there is already
for_each_net_rcu() in kernel, but it requires rcu_read_lock(),
and this can't be sleepable. Also, sometimes it may be need
really prevent net_namespace_list growth, so for_each_net_rcu()
is not fit there.

This patch introduces new rw_semaphore, which will be used
instead of rtnl_mutex to protect net_namespace_list. It is
sleepable and allows not-exclusive iterations over net
namespaces list. It allows to stop using rtnl_lock()
in several places (what is made in next patches) and makes
less the time, we keep rtnl_mutex. Here we just add new lock,
while the explanation of we can remove rtnl_lock() there are
in next patches.

Fine grained locks generally are better, then one big lock,
so let's do that with net_namespace_list, while the situation
allows that.

Signed-off-by: Kirill Tkhai 
---
 drivers/infiniband/core/roce_gid_mgmt.c |2 ++
 include/linux/rtnetlink.h   |1 +
 include/net/net_namespace.h |1 +
 net/core/dev.c  |5 +
 net/core/fib_notifier.c |2 ++
 net/core/net_namespace.c|   18 +-
 net/core/rtnetlink.c|5 +
 net/netfilter/nf_conntrack_core.c   |2 ++
 net/openvswitch/datapath.c  |2 ++
 net/wireless/wext-core.c|2 ++
 security/selinux/include/xfrm.h |2 ++
 11 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/core/roce_gid_mgmt.c 
b/drivers/infiniband/core/roce_gid_mgmt.c
index 5a52ec77940a..cc2966380c0c 100644
--- a/drivers/infiniband/core/roce_gid_mgmt.c
+++ b/drivers/infiniband/core/roce_gid_mgmt.c
@@ -403,10 +403,12 @@ static void enum_all_gids_of_dev_cb(struct ib_device 
*ib_dev,
 * our feet
 */
rtnl_lock();
+   down_read(_rwsem);
for_each_net(net)
for_each_netdev(net, ndev)
if (is_eth_port_of_netdev(ib_dev, port, rdma_ndev, 
ndev))
add_netdev_ips(ib_dev, port, rdma_ndev, ndev);
+   up_read(_rwsem);
rtnl_unlock();
 }
 
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index c7d1e4689325..5225832bd6ff 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -37,6 +37,7 @@ extern int rtnl_lock_killable(void);
 
 extern wait_queue_head_t netdev_unregistering_wq;
 extern struct rw_semaphore pernet_ops_rwsem;
+extern struct rw_semaphore net_rwsem;
 
 #ifdef CONFIG_PROVE_LOCKING
 extern bool lockdep_rtnl_is_held(void);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 1ab4f920f109..47e35cce3b64 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -291,6 +291,7 @@ static inline struct net *read_pnet(const possible_net_t 
*pnet)
 #endif
 }
 
+/* Protected by net_rwsem */
 #define for_each_net(VAR)  \
list_for_each_entry(VAR, _namespace_list, list)
 
diff --git a/net/core/dev.c b/net/core/dev.c
index e13807b5c84d..eca5458b2753 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1629,6 +1629,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
goto unlock;
if (dev_boot_phase)
goto unlock;
+   down_read(_rwsem);
for_each_net(net) {
for_each_netdev(net, dev) {
err = call_netdevice_notifier(nb, NETDEV_REGISTER, dev);
@@ -1642,6 +1643,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
call_netdevice_notifier(nb, NETDEV_UP, dev);
}
}
+   up_read(_rwsem);
 
 unlock:
rtnl_unlock();
@@ -1664,6 +1666,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
}
 
 outroll:
+   up_read(_rwsem);
raw_notifier_chain_unregister(_chain, nb);
goto unlock;
 }
@@ -1694,6 +1697,7 @@ int unregister_netdevice_notifier(struct notifier_block 
*nb)
if (err)
goto unlock;
 
+   down_read(_rwsem);
for_each_net(net) {
for_each_netdev(net, dev) {
if (dev->flags & IFF_UP) {
@@ -1704,6 +1708,7 @@ int unregister_netdevice_notifier(struct notifier_block 
*nb)
call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev);
}
}
+   up_read(_rwsem);
 unlock:
rtnl_unlock();
return err;
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index 0c048bdeb016..614b985c92a4 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -33,6 +33,7 @@ static unsigned int fib_seq_sum(void)
struct net *net;
 

[PATCH] cw1200: fix spelling mistake: "Mailformed" -> "Malformed"

2018-03-29 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in wiphy_warn warning message text

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/st/cw1200/txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/st/cw1200/txrx.c 
b/drivers/net/wireless/st/cw1200/txrx.c
index e9050b41157a..f7b1b0062db3 100644
--- a/drivers/net/wireless/st/cw1200/txrx.c
+++ b/drivers/net/wireless/st/cw1200/txrx.c
@@ -1069,7 +1069,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
}
 
if (skb->len < sizeof(struct ieee80211_pspoll)) {
-   wiphy_warn(priv->hw->wiphy, "Mailformed SDU rx'ed. Size is 
lesser than IEEE header.\n");
+   wiphy_warn(priv->hw->wiphy, "Malformed SDU rx'ed. Size is 
lesser than IEEE header.\n");
goto drop;
}
 
-- 
2.15.1



[v2 RESEND 2/4] rsi: move descriptor preparation to core

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

Descriptors preparation is moved to core instead of HAL to
avoid synchronization issues in sending TX frames

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 11 +
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 43 +
 drivers/net/wireless/rsi/rsi_hal.h  |  2 ++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c 
b/drivers/net/wireless/rsi/rsi_91x_core.c
index 5dafd2e..f5d1756 100644
--- a/drivers/net/wireless/rsi/rsi_91x_core.c
+++ b/drivers/net/wireless/rsi/rsi_91x_core.c
@@ -413,6 +413,11 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
(ieee80211_is_qos_nullfunc(wh->frame_control))) {
q_num = MGMT_SOFT_Q;
skb->priority = q_num;
+
+   if (rsi_prepare_mgmt_desc(common, skb)) {
+   rsi_dbg(ERR_ZONE, "Failed to prepare desc\n");
+   goto xmit_fail;
+   }
} else {
if (ieee80211_is_data_qos(wh->frame_control)) {
tid = (skb->data[24] & IEEE80211_QOS_TID);
@@ -433,6 +438,8 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
if (!rsta)
goto xmit_fail;
tx_params->sta_id = rsta->sta_id;
+   } else {
+   tx_params->sta_id = 0;
}
 
if (rsta) {
@@ -443,6 +450,10 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
  tid, 0);
}
}
+   if (rsi_prepare_data_desc(common, skb)) {
+   rsi_dbg(ERR_ZONE, "Failed to prepare data desc\n");
+   goto xmit_fail;
+   }
}
 
if ((q_num < MGMT_SOFT_Q) &&
diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index ce6a86d..43d7d6c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -45,7 +45,7 @@ int rsi_send_pkt_to_bus(struct rsi_common *common, struct 
sk_buff *skb)
return status;
 }
 
-static int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff 
*skb)
+int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
struct ieee80211_hdr *wh = NULL;
@@ -113,17 +113,6 @@ static int rsi_prepare_mgmt_desc(struct rsi_common 
*common, struct sk_buff *skb)
if (conf_is_ht40(conf))
mgmt_desc->bbp_info = cpu_to_le16(FULL40M_ENABLE);
 
-   if (ieee80211_is_probe_req(wh->frame_control)) {
-   if (!bss->assoc) {
-   rsi_dbg(INFO_ZONE,
-   "%s: blocking mgmt queue\n", __func__);
-   mgmt_desc->misc_flags = RSI_DESC_REQUIRE_CFM_TO_HOST;
-   xtend_desc->confirm_frame_type = PROBEREQ_CONFIRM;
-   common->mgmt_q_block = true;
-   rsi_dbg(INFO_ZONE, "Mgmt queue blocked\n");
-   }
-   }
-
if (ieee80211_is_probe_resp(wh->frame_control)) {
mgmt_desc->misc_flags |= (RSI_ADD_DELTA_TSF_VAP_ID |
  RSI_FETCH_RETRY_CNT_FRM_HST);
@@ -149,7 +138,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
 }
 
 /* This function prepares descriptor for given data packet */
-static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff 
*skb)
+int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
struct ieee80211_vif *vif;
@@ -301,10 +290,6 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
(!bss->assoc))
goto err;
 
-   status = rsi_prepare_data_desc(common, skb);
-   if (status)
-   goto err;
-
status = rsi_send_pkt_to_bus(common, skb);
if (status)
rsi_dbg(ERR_ZONE, "%s: Failed to write pkt\n", __func__);
@@ -327,12 +312,18 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
  struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
+   struct ieee80211_bss_conf *bss;
+   struct ieee80211_hdr *wh;
struct ieee80211_tx_info *info;
struct skb_info *tx_params;
+   struct rsi_mgmt_desc *mgmt_desc;
+   struct rsi_xtended_desc *xtend_desc;
int status = -E2BIG;
+   u8 header_size;
 
info = IEEE80211_SKB_CB(skb);
tx_params = (struct skb_info *)info->driver_data;
+   header_size = 

[v2 RESEND 4/4] rsi: roaming enhancements

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

To support roaming below changes are done:
* Station notify frame is send to firmware after sending assoc
  request. This will avoid dropping of first EAPOL frame due to
  delay in creation of station control block in firmware.
* Data queues are unblocked after sending station notify in open
  mode, after configuring key in WEP mode, and after receiving
  EAPOL4 confirm in WPA mode.
* Initial EAPOL frames priority is chaged to MGMT, rekey EAPOL
  frames priority changed to VO.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
v2: Removed code of dropping data frames with wrong BSSID in driver,
mac80211 takes care of this (Kalle)
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 16 +++
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 18 
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 18 +---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 32 +
 drivers/net/wireless/rsi/rsi_main.h |  1 +
 drivers/net/wireless/rsi/rsi_mgmt.h | 10 -
 6 files changed, 78 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c 
b/drivers/net/wireless/rsi/rsi_91x_core.c
index f5d1756..3ca468b9 100644
--- a/drivers/net/wireless/rsi/rsi_91x_core.c
+++ b/drivers/net/wireless/rsi/rsi_91x_core.c
@@ -411,6 +411,18 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
if ((ieee80211_is_mgmt(wh->frame_control)) ||
(ieee80211_is_ctl(wh->frame_control)) ||
(ieee80211_is_qos_nullfunc(wh->frame_control))) {
+   if (ieee80211_is_assoc_req(wh->frame_control) ||
+   ieee80211_is_reassoc_req(wh->frame_control)) {
+   struct ieee80211_bss_conf *bss = >bss_conf;
+
+   common->eapol4_confirm = false;
+   rsi_hal_send_sta_notify_frame(common,
+ RSI_IFTYPE_STATION,
+ STA_CONNECTED, bss->bssid,
+ bss->qos, bss->aid, 0,
+ vif);
+   }
+
q_num = MGMT_SOFT_Q;
skb->priority = q_num;
 
@@ -450,6 +462,10 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
  tid, 0);
}
}
+   if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+   q_num = MGMT_SOFT_Q;
+   skb->priority = q_num;
+   }
if (rsi_prepare_data_desc(common, skb)) {
rsi_dbg(ERR_ZONE, "Failed to prepare data desc\n");
goto xmit_fail;
diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 43d7d6c..b7c5403 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -232,6 +232,18 @@ int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
data_desc->misc_flags |= RSI_FETCH_RETRY_CNT_FRM_HST;
 #define EAPOL_RETRY_CNT 15
xtend_desc->retry_cnt = EAPOL_RETRY_CNT;
+
+   if (common->eapol4_confirm)
+   skb->priority = VO_Q;
+   else
+   rsi_set_len_qno(_desc->len_qno,
+   (skb->len - FRAME_DESC_SZ),
+   RSI_WIFI_MGMT_Q);
+   if ((skb->len - header_size) == EAPOL4_PACKET_LEN) {
+   data_desc->misc_flags |=
+   RSI_DESC_REQUIRE_CFM_TO_HOST;
+   xtend_desc->confirm_frame_type = EAPOL4_CONFIRM;
+   }
}
 
data_desc->mac_flags = cpu_to_le16(seq_num & 0xfff);
@@ -271,8 +283,11 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
struct rsi_hw *adapter = common->priv;
struct ieee80211_vif *vif;
struct ieee80211_tx_info *info;
+   struct skb_info *tx_params;
struct ieee80211_bss_conf *bss;
+   struct ieee80211_hdr *wh;
int status = -EINVAL;
+   u8 header_size;
 
if (!skb)
return 0;
@@ -284,6 +299,9 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
goto err;
vif = info->control.vif;
bss = >bss_conf;
+   tx_params = (struct skb_info *)info->driver_data;
+   header_size = tx_params->internal_hdr_size;
+   wh = (struct ieee80211_hdr *)>data[header_size];
 
if (((vif->type == NL80211_IFTYPE_STATION) ||
 (vif->type == NL80211_IFTYPE_P2P_CLIENT)) &&
diff --git 

[v2 RESEND 1/4] rsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

All descriptor structures are in rsi_mgmt.h except this
extended descriptor structure. Hence moving it to rsi_mgmt.h
and also renaming to rsi_xtend_desc.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_hal.c | 12 ++--
 drivers/net/wireless/rsi/rsi_main.h|  6 --
 drivers/net/wireless/rsi/rsi_mgmt.h|  6 ++
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index de608ae..ce6a86d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -55,7 +55,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
struct rsi_mgmt_desc *mgmt_desc;
struct skb_info *tx_params;
struct ieee80211_bss_conf *bss = NULL;
-   struct xtended_desc *xtend_desc = NULL;
+   struct rsi_xtended_desc *xtend_desc = NULL;
u8 header_size;
u32 dword_align_bytes = 0;
 
@@ -69,7 +69,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
vif = tx_params->vif;
 
/* Update header size */
-   header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
+   header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE,
"%s: Failed to add extended descriptor\n",
@@ -92,7 +92,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
wh = (struct ieee80211_hdr *)>data[header_size];
 
mgmt_desc = (struct rsi_mgmt_desc *)skb->data;
-   xtend_desc = (struct xtended_desc *)>data[FRAME_DESC_SZ];
+   xtend_desc = (struct rsi_xtended_desc *)>data[FRAME_DESC_SZ];
 
rsi_set_len_qno(_desc->len_qno, (skb->len - FRAME_DESC_SZ),
RSI_WIFI_MGMT_Q);
@@ -158,7 +158,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
struct skb_info *tx_params;
struct ieee80211_bss_conf *bss;
struct rsi_data_desc *data_desc;
-   struct xtended_desc *xtend_desc;
+   struct rsi_xtended_desc *xtend_desc;
u8 ieee80211_size = MIN_802_11_HDR_LEN;
u8 header_size;
u8 vap_id = 0;
@@ -170,7 +170,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
bss = >bss_conf;
tx_params = (struct skb_info *)info->driver_data;
 
-   header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
+   header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
return -ENOSPC;
@@ -188,7 +188,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
data_desc = (struct rsi_data_desc *)skb->data;
memset(data_desc, 0, header_size);
 
-   xtend_desc = (struct xtended_desc *)>data[FRAME_DESC_SZ];
+   xtend_desc = (struct rsi_xtended_desc *)>data[FRAME_DESC_SZ];
wh = (struct ieee80211_hdr *)>data[header_size];
seq_num = IEEE80211_SEQ_TO_SN(le16_to_cpu(wh->seq_ctrl));
 
diff --git a/drivers/net/wireless/rsi/rsi_main.h 
b/drivers/net/wireless/rsi/rsi_main.h
index ef4fa32..b81cdbf 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -190,12 +190,6 @@ struct cqm_info {
u32 rssi_hyst;
 };
 
-struct xtended_desc {
-   u8 confirm_frame_type;
-   u8 retry_cnt;
-   u16 reserved;
-};
-
 enum rsi_dfs_regions {
RSI_REGION_FCC = 0,
RSI_REGION_ETSI,
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h 
b/drivers/net/wireless/rsi/rsi_mgmt.h
index cf6567a..6726e84 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -301,6 +301,12 @@ struct rsi_mac_frame {
 #define ENCAP_MGMT_PKT BIT(7)
 #define DESC_IMMEDIATE_WAKEUP  BIT(15)
 
+struct rsi_xtended_desc {
+   u8 confirm_frame_type;
+   u8 retry_cnt;
+   u16 reserved;
+};
+
 struct rsi_cmd_desc_dword0 {
__le16 len_qno;
u8 frame_type;
-- 
2.7.4



[v2 RESEND 3/4] rsi: enable 80MHz clock by default

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

80MHz clock for device should be enabled by default in
TX command frame radio capabilities.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index c21fca7..9207da0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -325,8 +325,8 @@ static int rsi_load_radio_caps(struct rsi_common *common)
radio_caps->channel_num = common->channel;
radio_caps->rf_model = RSI_RF_TYPE;
 
+   radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ;
if (common->channel_width == BW_40MHZ) {
-   radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ;
radio_caps->radio_cfg_info |= RSI_ENABLE_40MHZ;
 
if (common->fsm_state == FSM_MAC_INIT_DONE) {
-- 
2.7.4



[v2 RESEND 0/4] rsi driver enhancements

2018-03-29 Thread Amitkumar Karwar
From: Amitkumar Karwar 

This patch series includes some code rearrangement and roaming related
improvements.

Changes in v2:
v2 1/4 is same as v1 2/10
v2 2/4 is same as v1 3/10
v2 3/4 is same as v1 4/10
v2 4/4 is updated version of v1 5/10

Remaining patches in v1 need major improvements. Couple of them
requires splitting the patch into multiple patches. So they will be
submitted separately.

Resending as v1->v2 change info was missed in v2 4/4

Prameela Rani Garnepudi (4):
  rsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h
  rsi: move descriptor preparation to core
  rsi: enable 80MHz clock by default
  rsi: roaming enhancements

 drivers/net/wireless/rsi/rsi_91x_core.c | 27 +++
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 73 ++---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 18 +--
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 34 --
 drivers/net/wireless/rsi/rsi_hal.h  |  2 +
 drivers/net/wireless/rsi/rsi_main.h |  7 +--
 drivers/net/wireless/rsi/rsi_mgmt.h | 16 ++-
 7 files changed, 126 insertions(+), 51 deletions(-)

-- 
2.7.4



Re: nested structs parsing

2018-03-29 Thread Johannes Berg
Hi,

> The original patchset for nested structs was supporting it only 
> when not inlined. This should be fixed on this patchset:
> 
>   https://lkml.org/lkml/2018/2/19/387
> 
> Do you have those patches on your tree?

No, looks like I don't have those yet. I'll wait for those then.

> With regards to duplicated warnings, that use to happen if the same header
> is included several times (with is a common pratice at the net subsystem).

Yeah, doesn't really matter anyway. I think I have to, in a sense,
because I'm getting lots of functions separately from the headers.

> Could you please merge from docs-next and see if those problems
> get solved?

No, that doesn't seem to address it fully:

net/mac80211/sta_info.h:586: warning: Function parameter or member 
'tx_stats.packets' not described in 'sta_info'
net/mac80211/sta_info.h:586: warning: Function parameter or member 
'tx_stats.bytes' not described in 'sta_info'
net/mac80211/sta_info.h:586: warning: Function parameter or member 
'tx_stats.last_rate' not described in 'sta_info'
net/mac80211/sta_info.h:586: warning: Function parameter or member 'msdu' not 
described in 'sta_info'

You can reproduce this in

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master

(merging with docs-next) and running

  make SPHINXDIRS=driver-api/80211 htmldocs

johannes


Re: nested structs parsing

2018-03-29 Thread Mauro Carvalho Chehab
Em Thu, 29 Mar 2018 11:47:07 +0200
Johannes Berg  escreveu:

> On Thu, 2018-03-29 at 11:46 +0200, Johannes Berg wrote:
> > Hi,
> > 
> > For a while I haven't looked at my documentation for 802.11, and now I
> > noticed I'm getting warnings due to the nested parsing.
> > 
> > However, something seems to be wrong? I have, for example, this (in
> > net/mac80211/sta_info.h)
> > 
> > struct sta_info {
> > ...
> > struct {
> > u64 packets[IEEE80211_NUM_ACS];
> > u64 bytes[IEEE80211_NUM_ACS];
> > struct ieee80211_tx_rate last_rate;
> > u64 msdu[IEEE80211_NUM_TIDS + 1];
> > } tx_stats;
> > };
> > 
> > but I'm getting the following warnings now, with only "@tx_stats" being
> > described in the documentation:
> > 
> > net/mac80211/sta_info.h:590: warning: Function parameter or member 
> > 'status_stats.last_ack' not described in 'sta_info'
> > net/mac80211/sta_info.h:590: warning: Function parameter or member 
> > 'status_stats.last_ack_signal' not described in 'sta_info'
> > net/mac80211/sta_info.h:590: warning: Function parameter or member 
> > 'status_stats.ack_signal_filled' not described in 'sta_info'
> > net/mac80211/sta_info.h:590: warning: Function parameter or member 'msdu' 
> > not described in 'sta_info'
> > 
> > I can understand the first three of those, but not the last one? Why is
> > the last one not qualified?
> > 
> > If I change it to this:
> > 
> > struct {
> > u64 packets[IEEE80211_NUM_ACS];
> > u64 bytes[IEEE80211_NUM_ACS];
> > /**
> >  * @last_rate: last TX rate
> >  */
> > struct ieee80211_tx_rate last_rate;
> > /**
> >  * @msdu: # of MSDUs per TID
> >  */
> > u64 msdu[IEEE80211_NUM_TIDS + 1];
> > } tx_stats;
> > 
> > I still get a warning on "tx_stats.last_rate", but not on "msdu", which
> > is sort of obvious from the warning text, but also rather unexpected.
> > 
> > Normally I'd say that the "msdu" warning is originally wrong
> > 
> > However, I'd also argue that if I'm using inline declarations, I
> > shouldn't have to write it like this:
> > 
> > struct {
> > u64 packets[IEEE80211_NUM_ACS];
> > u64 bytes[IEEE80211_NUM_ACS];
> > /**
> >  * @tx_stats.last_rate: last TX rate
> >  */
> > struct ieee80211_tx_rate last_rate;
> > ...
> > } tx_stats;  
> 
> Whoops, sent a fraction of a second too early - this actually causes a
> warning too (no idea why four times):
> 
> net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format: 
>  * @tx_stats.last_rate: last TX rate
> net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format: 
>  * @tx_stats.last_rate: last TX rate
> net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format: 
>  * @tx_stats.last_rate: last TX rate
> net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format: 
>  * @tx_stats.last_rate: last TX rate

The original patchset for nested structs was supporting it only 
when not inlined. This should be fixed on this patchset:

https://lkml.org/lkml/2018/2/19/387

Do you have those patches on your tree?

With regards to duplicated warnings, that use to happen if the same header
is included several times (with is a common pratice at the net subsystem).

I also submitted some patches to linux-next addressing it.

Could you please merge from docs-next and see if those problems
get solved?

It is located at:

git://git.lwn.net/linux.git docs-next

Thanks,
Mauro


[v2 4/4] rsi: roaming enhancements

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

To support roaming below changes are done:
* Station notify frame is send to firmware after sending assoc
  request. This will avoid dropping of first EAPOL frame due to
  delay in creation of station control block in firmware.
* Data queues are unblocked after sending station notify in open
  mode, after configuring key in WEP mode, and after receiving
  EAPOL4 confirm in WPA mode.
* Initial EAPOL frames priority is chaged to MGMT, rekey EAPOL
  frames priority changed to VO.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 16 +++
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 18 
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 18 +---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 32 +
 drivers/net/wireless/rsi/rsi_main.h |  1 +
 drivers/net/wireless/rsi/rsi_mgmt.h | 10 -
 6 files changed, 78 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c 
b/drivers/net/wireless/rsi/rsi_91x_core.c
index f5d1756..3ca468b9 100644
--- a/drivers/net/wireless/rsi/rsi_91x_core.c
+++ b/drivers/net/wireless/rsi/rsi_91x_core.c
@@ -411,6 +411,18 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
if ((ieee80211_is_mgmt(wh->frame_control)) ||
(ieee80211_is_ctl(wh->frame_control)) ||
(ieee80211_is_qos_nullfunc(wh->frame_control))) {
+   if (ieee80211_is_assoc_req(wh->frame_control) ||
+   ieee80211_is_reassoc_req(wh->frame_control)) {
+   struct ieee80211_bss_conf *bss = >bss_conf;
+
+   common->eapol4_confirm = false;
+   rsi_hal_send_sta_notify_frame(common,
+ RSI_IFTYPE_STATION,
+ STA_CONNECTED, bss->bssid,
+ bss->qos, bss->aid, 0,
+ vif);
+   }
+
q_num = MGMT_SOFT_Q;
skb->priority = q_num;
 
@@ -450,6 +462,10 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
  tid, 0);
}
}
+   if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+   q_num = MGMT_SOFT_Q;
+   skb->priority = q_num;
+   }
if (rsi_prepare_data_desc(common, skb)) {
rsi_dbg(ERR_ZONE, "Failed to prepare data desc\n");
goto xmit_fail;
diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 43d7d6c..b7c5403 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -232,6 +232,18 @@ int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
data_desc->misc_flags |= RSI_FETCH_RETRY_CNT_FRM_HST;
 #define EAPOL_RETRY_CNT 15
xtend_desc->retry_cnt = EAPOL_RETRY_CNT;
+
+   if (common->eapol4_confirm)
+   skb->priority = VO_Q;
+   else
+   rsi_set_len_qno(_desc->len_qno,
+   (skb->len - FRAME_DESC_SZ),
+   RSI_WIFI_MGMT_Q);
+   if ((skb->len - header_size) == EAPOL4_PACKET_LEN) {
+   data_desc->misc_flags |=
+   RSI_DESC_REQUIRE_CFM_TO_HOST;
+   xtend_desc->confirm_frame_type = EAPOL4_CONFIRM;
+   }
}
 
data_desc->mac_flags = cpu_to_le16(seq_num & 0xfff);
@@ -271,8 +283,11 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
struct rsi_hw *adapter = common->priv;
struct ieee80211_vif *vif;
struct ieee80211_tx_info *info;
+   struct skb_info *tx_params;
struct ieee80211_bss_conf *bss;
+   struct ieee80211_hdr *wh;
int status = -EINVAL;
+   u8 header_size;
 
if (!skb)
return 0;
@@ -284,6 +299,9 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
goto err;
vif = info->control.vif;
bss = >bss_conf;
+   tx_params = (struct skb_info *)info->driver_data;
+   header_size = tx_params->internal_hdr_size;
+   wh = (struct ieee80211_hdr *)>data[header_size];
 
if (((vif->type == NL80211_IFTYPE_STATION) ||
 (vif->type == NL80211_IFTYPE_P2P_CLIENT)) &&
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c 
b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 32f5cb4..5edc3a9 100644
--- 

[v2 2/4] rsi: move descriptor preparation to core

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

Descriptors preparation is moved to core instead of HAL to
avoid synchronization issues in sending TX frames

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 11 +
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 43 +
 drivers/net/wireless/rsi/rsi_hal.h  |  2 ++
 3 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c 
b/drivers/net/wireless/rsi/rsi_91x_core.c
index 5dafd2e..f5d1756 100644
--- a/drivers/net/wireless/rsi/rsi_91x_core.c
+++ b/drivers/net/wireless/rsi/rsi_91x_core.c
@@ -413,6 +413,11 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
(ieee80211_is_qos_nullfunc(wh->frame_control))) {
q_num = MGMT_SOFT_Q;
skb->priority = q_num;
+
+   if (rsi_prepare_mgmt_desc(common, skb)) {
+   rsi_dbg(ERR_ZONE, "Failed to prepare desc\n");
+   goto xmit_fail;
+   }
} else {
if (ieee80211_is_data_qos(wh->frame_control)) {
tid = (skb->data[24] & IEEE80211_QOS_TID);
@@ -433,6 +438,8 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
if (!rsta)
goto xmit_fail;
tx_params->sta_id = rsta->sta_id;
+   } else {
+   tx_params->sta_id = 0;
}
 
if (rsta) {
@@ -443,6 +450,10 @@ void rsi_core_xmit(struct rsi_common *common, struct 
sk_buff *skb)
  tid, 0);
}
}
+   if (rsi_prepare_data_desc(common, skb)) {
+   rsi_dbg(ERR_ZONE, "Failed to prepare data desc\n");
+   goto xmit_fail;
+   }
}
 
if ((q_num < MGMT_SOFT_Q) &&
diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index ce6a86d..43d7d6c 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -45,7 +45,7 @@ int rsi_send_pkt_to_bus(struct rsi_common *common, struct 
sk_buff *skb)
return status;
 }
 
-static int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff 
*skb)
+int rsi_prepare_mgmt_desc(struct rsi_common *common, struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
struct ieee80211_hdr *wh = NULL;
@@ -113,17 +113,6 @@ static int rsi_prepare_mgmt_desc(struct rsi_common 
*common, struct sk_buff *skb)
if (conf_is_ht40(conf))
mgmt_desc->bbp_info = cpu_to_le16(FULL40M_ENABLE);
 
-   if (ieee80211_is_probe_req(wh->frame_control)) {
-   if (!bss->assoc) {
-   rsi_dbg(INFO_ZONE,
-   "%s: blocking mgmt queue\n", __func__);
-   mgmt_desc->misc_flags = RSI_DESC_REQUIRE_CFM_TO_HOST;
-   xtend_desc->confirm_frame_type = PROBEREQ_CONFIRM;
-   common->mgmt_q_block = true;
-   rsi_dbg(INFO_ZONE, "Mgmt queue blocked\n");
-   }
-   }
-
if (ieee80211_is_probe_resp(wh->frame_control)) {
mgmt_desc->misc_flags |= (RSI_ADD_DELTA_TSF_VAP_ID |
  RSI_FETCH_RETRY_CNT_FRM_HST);
@@ -149,7 +138,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
 }
 
 /* This function prepares descriptor for given data packet */
-static int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff 
*skb)
+int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
struct ieee80211_vif *vif;
@@ -301,10 +290,6 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
(!bss->assoc))
goto err;
 
-   status = rsi_prepare_data_desc(common, skb);
-   if (status)
-   goto err;
-
status = rsi_send_pkt_to_bus(common, skb);
if (status)
rsi_dbg(ERR_ZONE, "%s: Failed to write pkt\n", __func__);
@@ -327,12 +312,18 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
  struct sk_buff *skb)
 {
struct rsi_hw *adapter = common->priv;
+   struct ieee80211_bss_conf *bss;
+   struct ieee80211_hdr *wh;
struct ieee80211_tx_info *info;
struct skb_info *tx_params;
+   struct rsi_mgmt_desc *mgmt_desc;
+   struct rsi_xtended_desc *xtend_desc;
int status = -E2BIG;
+   u8 header_size;
 
info = IEEE80211_SKB_CB(skb);
tx_params = (struct skb_info *)info->driver_data;
+   header_size = 

[v2 3/4] rsi: enable 80MHz clock by default

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

80MHz clock for device should be enabled by default in
TX command frame radio capabilities.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c 
b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index c21fca7..9207da0 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -325,8 +325,8 @@ static int rsi_load_radio_caps(struct rsi_common *common)
radio_caps->channel_num = common->channel;
radio_caps->rf_model = RSI_RF_TYPE;
 
+   radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ;
if (common->channel_width == BW_40MHZ) {
-   radio_caps->radio_cfg_info = RSI_LMAC_CLOCK_80MHZ;
radio_caps->radio_cfg_info |= RSI_ENABLE_40MHZ;
 
if (common->fsm_state == FSM_MAC_INIT_DONE) {
-- 
2.7.4



[v2 0/4] rsi driver enhancements

2018-03-29 Thread Amitkumar Karwar
From: Amitkumar Karwar 

This patch series includes some code rearrangement and roaming related
improvements.

Changes in v2:
v2 1/4 is same as v1 2/10
v2 2/4 is same as v1 3/10
v2 3/4 is same as v1 4/10
v2 4/4 is updated version of v1 5/10

Remaining patches in v1 need major improvements. Couple of them
requires splitting the patch into multiple patches. So they will be
submitted separately.

Prameela Rani Garnepudi (4):
  rsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h
  rsi: move descriptor preparation to core
  rsi: enable 80MHz clock by default
  rsi: roaming enhancements

 drivers/net/wireless/rsi/rsi_91x_core.c | 27 +++
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 73 ++---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 18 +--
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 34 --
 drivers/net/wireless/rsi/rsi_hal.h  |  2 +
 drivers/net/wireless/rsi/rsi_main.h |  7 +--
 drivers/net/wireless/rsi/rsi_mgmt.h | 16 ++-
 7 files changed, 126 insertions(+), 51 deletions(-)

-- 
2.7.4



[v2 1/4] rsi: move xtend_desc structure from rsi_main.h to rsi_mgmt.h

2018-03-29 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

All descriptor structures are in rsi_mgmt.h except this
extended descriptor structure. Hence moving it to rsi_mgmt.h
and also renaming to rsi_xtend_desc.

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/rsi/rsi_91x_hal.c | 12 ++--
 drivers/net/wireless/rsi/rsi_main.h|  6 --
 drivers/net/wireless/rsi/rsi_mgmt.h|  6 ++
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index de608ae..ce6a86d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -55,7 +55,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
struct rsi_mgmt_desc *mgmt_desc;
struct skb_info *tx_params;
struct ieee80211_bss_conf *bss = NULL;
-   struct xtended_desc *xtend_desc = NULL;
+   struct rsi_xtended_desc *xtend_desc = NULL;
u8 header_size;
u32 dword_align_bytes = 0;
 
@@ -69,7 +69,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
vif = tx_params->vif;
 
/* Update header size */
-   header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
+   header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE,
"%s: Failed to add extended descriptor\n",
@@ -92,7 +92,7 @@ static int rsi_prepare_mgmt_desc(struct rsi_common *common, 
struct sk_buff *skb)
wh = (struct ieee80211_hdr *)>data[header_size];
 
mgmt_desc = (struct rsi_mgmt_desc *)skb->data;
-   xtend_desc = (struct xtended_desc *)>data[FRAME_DESC_SZ];
+   xtend_desc = (struct rsi_xtended_desc *)>data[FRAME_DESC_SZ];
 
rsi_set_len_qno(_desc->len_qno, (skb->len - FRAME_DESC_SZ),
RSI_WIFI_MGMT_Q);
@@ -158,7 +158,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
struct skb_info *tx_params;
struct ieee80211_bss_conf *bss;
struct rsi_data_desc *data_desc;
-   struct xtended_desc *xtend_desc;
+   struct rsi_xtended_desc *xtend_desc;
u8 ieee80211_size = MIN_802_11_HDR_LEN;
u8 header_size;
u8 vap_id = 0;
@@ -170,7 +170,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
bss = >bss_conf;
tx_params = (struct skb_info *)info->driver_data;
 
-   header_size = FRAME_DESC_SZ + sizeof(struct xtended_desc);
+   header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
if (header_size > skb_headroom(skb)) {
rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
return -ENOSPC;
@@ -188,7 +188,7 @@ static int rsi_prepare_data_desc(struct rsi_common *common, 
struct sk_buff *skb)
data_desc = (struct rsi_data_desc *)skb->data;
memset(data_desc, 0, header_size);
 
-   xtend_desc = (struct xtended_desc *)>data[FRAME_DESC_SZ];
+   xtend_desc = (struct rsi_xtended_desc *)>data[FRAME_DESC_SZ];
wh = (struct ieee80211_hdr *)>data[header_size];
seq_num = IEEE80211_SEQ_TO_SN(le16_to_cpu(wh->seq_ctrl));
 
diff --git a/drivers/net/wireless/rsi/rsi_main.h 
b/drivers/net/wireless/rsi/rsi_main.h
index ef4fa32..b81cdbf 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -190,12 +190,6 @@ struct cqm_info {
u32 rssi_hyst;
 };
 
-struct xtended_desc {
-   u8 confirm_frame_type;
-   u8 retry_cnt;
-   u16 reserved;
-};
-
 enum rsi_dfs_regions {
RSI_REGION_FCC = 0,
RSI_REGION_ETSI,
diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h 
b/drivers/net/wireless/rsi/rsi_mgmt.h
index cf6567a..6726e84 100644
--- a/drivers/net/wireless/rsi/rsi_mgmt.h
+++ b/drivers/net/wireless/rsi/rsi_mgmt.h
@@ -301,6 +301,12 @@ struct rsi_mac_frame {
 #define ENCAP_MGMT_PKT BIT(7)
 #define DESC_IMMEDIATE_WAKEUP  BIT(15)
 
+struct rsi_xtended_desc {
+   u8 confirm_frame_type;
+   u8 retry_cnt;
+   u16 reserved;
+};
+
 struct rsi_cmd_desc_dword0 {
__le16 len_qno;
u8 frame_type;
-- 
2.7.4



pull-request: wireless-drivers-next 2018-03-29

2018-03-29 Thread Kalle Valo
Hi Dave,

here's a pull request to net-next for 4.17. If the merge window starts
on Sunday this will be the last pull request. Do note that I pulled
wireless-drivers into wireless-drivers-next as iwlwifi needed some
patches.

Please let me know if you have any problems.

Kalle

The following changes since commit 996bfed118748c128ad4b6c05c09fd2f5fdfa1b4:

  Merge tag 'wireless-drivers-next-for-davem-2018-03-24' of 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next 
(2018-03-25 21:27:38 -0400)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
tags/wireless-drivers-next-for-davem-2018-03-29

for you to fetch changes up to 14c99949a3398a655c47b262ca8e2e83edfae7fd:

  Merge ath-next from 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git (2018-03-29 
15:55:28 +0300)


wireless-drivers-next patches for 4.17

Smaller new features to various drivers but nothing really out of
ordinary.

Major changes:

ath10k

* enable chip temperature measurement for QCA6174/QCA9377

* add firmware memory dump for QCA9984

* enable buffer STA on TDLS link for QCA6174

* support different beacon internals in multiple interface scenario
  for QCA988X/QCA99X0/QCA9984/QCA4019

iwlwifi

* support for new PCI IDs for the 9000 family

* support for a new firmware API version

* support for advanced dwell and Optimized Connectivity Experience
  (OCE) in scanning

btrsi

* fix kconfig dependencies

wil6210

* support multiple virtual interfaces


Amitkumar Karwar (2):
  rsi: fix error path handling in SDIO probe
  rsi: fix kernel panic observed on 64bit machine

Andrei Otcheretianski (2):
  iwlwifi: mvm: Increase session protection time after CS
  iwlwifi: mvm: Move unused phy's to a default channel

Anilkumar Kolli (2):
  ath10k: add memory dump support QCA9984
  ath10k: advertize beacon_int_min_gcd

Arend Van Spriel (12):
  brcmfmac: do not convert linux error to firmware error string
  brcmfmac: use brcmf_chip_name() to store name in revinfo
  brcmfmac: use brcmf_chip_name() for consistency
  brcmfmac: allocate struct brcmf_pub instance using wiphy_new()
  brcmfmac: use wiphy debugfs dir entry
  brcmfmac: derive firmware filenames from basename mapping
  brcmfmac: pass struct in brcmf_fw_get_firmwares()
  brcmfmac: introduce brcmf_fw_alloc_request() function
  brcmfmac: add extension to .get_fwname() callbacks
  brcmfmac: get rid of brcmf_fw_map_chip_to_name()
  brcmfmac: get rid of brcmf_fw_get_full_name()
  brcmfmac: add kerneldoc for struct brcmf_bus::msgbuf

Arnd Bergmann (1):
  Bluetooth: btrsi: rework dependencies

Avraham Stern (3):
  iwlwifi: mvm: clear tx queue id when unreserving aggregation queue
  iwlwifi: mvm: make sure internal station has a valid id
  iwlwifi: mvm: fix array out of bounds reference

Ayala Beker (1):
  iwlwifi: fw api: support the new scan request FW API version

Beni Lev (1):
  iwlwifi: mvm: Correctly set IGTK for AP

Carl Huang (1):
  ath10k: fix use-after-free in ath10k_wmi_cmd_send_nowait

Christian Lamparter (1):
  ath10k: fix recent bandwidth conversion bug

Colin Ian King (4):
  wil6210: fix spelling mistake: "preperation"-> "preparation"
  ath5k: remove duplicated re-assignment to pointer 'tq'
  rsi: remove redundant duplicate assignment of buffer_size
  rtlwifi: rtl8821ae: fix spelling mistake: "Aboslute" -> "Absolute"

Daniel Mack (1):
  wcn36xx: dequeue all pending indicator messages

Emmanuel Grumbach (2):
  iwlwifi: mvm: set the correct tid when we flush the MCAST sta
  iwlwifi: bump the max API version for 9000 and 22000 devices

Ganapathi Bhat (1):
  mwifiex: remove warnings in mwifiex_cmd_append_11n_tlv()

Govind Singh (1):
  ath10k: fix log message for hif power on failure

Haim Dreyfuss (1):
  iwlwifi: api: Add geographic profile information to MCC_UPDATE_CMD

Ignacio Nunez Hernanz (1):
  ath10k: make ath10k report discarded packets to mac80211

Ilan Peer (1):
  iwlwifi: mvm: Allow iwl_mvm_mac_mgd_prepare_tx() when associated

Joe Perches (2):
  wireless: Use octal not symbolic permissions
  ath: Remove unnecessary ath_bcast_mac and use eth_broadcast_addr

Johannes Berg (1):
  iwlwifi: mvm: fix error checking for multi/broadcast sta

Kalle Valo (7):
  Merge tag 'iwlwifi-for-kalle-2018-03-16' of 
git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
  Merge tag 'iwlwifi-for-kalle-2018-03-19' of 
git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
  Merge ath-next from git://git.kernel.org/.../kvalo/ath.git
  Merge git://git.kernel.org/.../kvalo/wireless-drivers.git
  Merge tag 'iwlwifi-next-for-kalle-2018-03-28' of 
git://git.kernel.org/.../iwlwifi/iwlwifi-next
  ath10k: refactor 

pull-request: mac80211-next 2018-03-29

2018-03-29 Thread Johannes Berg
Hi Dave,

Last update for -next, I guess, but I wanted to get the ETSI adaptivity
requirements code and the eapol-over-nl80211 thing out - both have been
around for a while. A number of other smaller things are also there, of
course.

Please pull and let me know if there's any problem.

Thanks,
johannes



The following changes since commit 0466080c751ec2de9efae3ac6305225cc4326047:

  Merge branch 'dsa-mv88e6xxx-some-fixes' (2018-03-20 12:29:58 -0400)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
tags/mac80211-next-for-davem-2018-03-29

for you to fetch changes up to c470bdc1aaf36669e04ba65faf1092b2d1c6cabe:

  mac80211: don't WARN on bad WMM parameters from buggy APs (2018-03-29 
15:02:38 +0200)


We have a fair number of patches, but many of them are from the
first bullet here:
 * EAPoL-over-nl80211 from Denis - this will let us fix
   some long-standing issues with bridging, races with
   encryption and more
 * DFS offload support from the qtnfmac folks
 * regulatory database changes for the new ETSI adaptivity
   requirements
 * various other fixes and small enhancements


Benjamin Beichler (1):
  mac80211_hwsim: fix use-after-free bug in hwsim_exit_net

Denis Kenzior (11):
  cfg80211: Support all iftypes in autodisconnect_wk
  nl80211: Add SOCKET_OWNER support to JOIN_IBSS
  nl80211: Add SOCKET_OWNER support to JOIN_MESH
  nl80211: Add SOCKET_OWNER support to START_AP
  nl80211: Add CMD_CONTROL_PORT_FRAME API
  nl80211: Implement TX of control port frames
  nl80211: Add CONTROL_PORT_OVER_NL80211 attribute
  nl80211: Add control_port_over_nl80211 for ibss
  nl80211: Add control_port_over_nl80211 to mesh_setup
  mac80211: Add support for tx_control_port
  mac80211: Send control port frames over nl80211

Dmitry Lebed (4):
  cfg80211/nl80211: add CAC_STARTED event
  cfg80211/nl80211: add DFS offload flag
  cfg80211: fix CAC_STARTED event handling
  cfg80211: enable use of non-cleared DFS channels for DFS offload

Emmanuel Grumbach (1):
  mac80211: don't WARN on bad WMM parameters from buggy APs

Haim Dreyfuss (3):
  cfg80211: read wmm rules from regulatory database
  mac80211: limit wmm params to comply with ETSI requirements
  cfg80211: Add API to allow querying regdb for wmm_rule

Johannes Berg (4):
  mac80211_hwsim: fix secondary MAC address assignment
  cfg80211: don't require RTNL held for regdomain reads
  mac80211: remove shadowing duplicated variable
  Merge branch 'eapol-over-nl80211' into mac80211-next

Manikanta Pubbisetty (1):
  mac80211: allow AP_VLAN operation on crypto controlled devices

Pradeep Kumar Chitrapu (1):
  mac80211: notify driver for change in multicast rates

Tosoni (1):
  mac80211: inform wireless layer when frame RSSI is invalid

tami...@codeaurora.org (3):
  cfg80211: fix data type of sta_opmode_info parameter
  mac80211: Use proper smps_mode enum in sta opmode event
  mac80211: Use proper chan_width enum in sta opmode event

 drivers/net/wireless/mac80211_hwsim.c |  10 +-
 include/net/cfg80211.h|  76 -
 include/net/mac80211.h|   3 +
 include/net/regulatory.h  |  28 +
 include/uapi/linux/nl80211.h  |  46 +++-
 net/mac80211/cfg.c|  12 ++
 net/mac80211/ht.c |  15 +++
 net/mac80211/ibss.c   |   3 +-
 net/mac80211/ieee80211_i.h|  12 ++
 net/mac80211/iface.c  |   2 +
 net/mac80211/key.c|   8 +-
 net/mac80211/main.c   |  10 +-
 net/mac80211/mesh.c   |   3 +-
 net/mac80211/mlme.c   | 168 ++-
 net/mac80211/rx.c |  45 ++--
 net/mac80211/scan.c   |   4 +-
 net/mac80211/tx.c |  46 
 net/mac80211/util.c   |  47 +++-
 net/mac80211/vht.c|  32 +-
 net/wireless/ap.c |   1 +
 net/wireless/chan.c   |   9 +-
 net/wireless/core.h   |  12 +-
 net/wireless/ibss.c   |  27 +
 net/wireless/mesh.c   |  16 +--
 net/wireless/mlme.c   |   9 +-
 net/wireless/nl80211.c| 205 +++--
 net/wireless/rdev-ops.h   |  15 +++
 net/wireless/reg.c| 206 --
 net/wireless/sme.c|  43 +--
 net/wireless/trace.h  |  47 
 30 files changed, 979 insertions(+), 181 deletions(-)


Re: [PATCH v7 00/11] EAPoL over NL80211

2018-03-29 Thread Johannes Berg
Alright, I've applied all of this.

johannes


RE: wil6210: low level sector API

2018-03-29 Thread Dedy Lansky
From: linux-wireless-ow...@vger.kernel.org 
[mailto:linux-wireless-ow...@vger.kernel.org] On Behalf Of David Dean
Sent: Monday, March 26, 2018 9:38 PM

> My question is how I can disable TXSS. One way I found in the wmi.h is 
> setting the number of sectors of TXSS to 0 or 1 > by using 
> wmi_prio_tx_sectors_num_cmd so that the TXSS will only use 1 sector.
> However, when I called this cmd, I got this error:
> wil6210 :03:00.0 wlp3s0: wil6210_irq_misc: Firmware error detected, 
> assert codes FW 0x1038, UCODE 0x
> wil6210 :03:00.0 wlp3s0: wil_fw_core_dump: fw core dumped, size 823296 
> bytes
> wil6210 :03:00.0 wlp3s0: wil_notify_fw_error: Notify about firmware error
> So I am wondering whether the firmware does not support these kinds of wmi 
> commands. Does anyone have any experience on this? Thank you.

Indeed this error indicates that FW doesn't support these WMI commands.
We are working on releasing new FW version with support for these commands.

Thanks,
 Dedy.



Re: [PATCH] nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS

2018-03-29 Thread Arend van Spriel

+ Jithu, Eylon

On 3/29/2018 1:16 PM, Johannes Berg wrote:

Hi Arend,


Picking up a somewhat old thread as I did not see a follow-up on this
patch. I got queried about it over here by our FILS team. So what is
needed for this patch to pass the bar?


That's indeed a bit old :-)


+ * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
+ * username, erp sequence number and rrk) are updated
+ * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated


These are new here, but you don't know if they were actually supported:


+   if (wiphy_ext_feature_isset(>wiphy,
+   NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&


here.


The description of the FILS_SK_OFFLOAD currently says:

   * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS
shared key
   *  authentication with %NL80211_CMD_CONNECT.

Are you suggesting a new flag to cover the new update attributes?


[snip]


Again, how do you know the driver will actually look at
UPDATE_AUTH_TYPE?


If they don't they are broken, right? And if they are broken, the
connection will drop and regular connect will happen anyway, no?

We could add a new flag to signal driver will handle the extra
parameters in UPDATE_CONNECT_PARAMS, but it is not clear why it would be
needed. Seems to me user-space has all the info needed with the existing
flag(s).


Agree, and we don't even have any drivers that are setting the
FILS_SK_OFFLOAD flag anyway, so we can still redefine its semantics to
some extent.


There is some implied behavior about the UPDATE_AUTH_TYPE. The 
FILS_SK_OFFLOAD only seems to cover NL80211_AUTHTYPE_FILS_SK. So to me 
it seems that changing the auth type really means the driver should give 
up on roaming and let user-space handle it.



So yeah, I'd argue that what the patch needed was somebody taking a
critical look at my review ;-)

And perhaps fixing the weird flags thing I pointed out.


Yup. That made sense.

Also there is a DOC section about FILS shared key authentication 
offload" so I suppose that should be extended as well.


Regards,
Arend



Re: [PATCH] nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS

2018-03-29 Thread Johannes Berg
Hi Arend,

> Picking up a somewhat old thread as I did not see a follow-up on this 
> patch. I got queried about it over here by our FILS team. So what is 
> needed for this patch to pass the bar?

That's indeed a bit old :-)

> > > + * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters 
> > > (realm,
> > > + *   username, erp sequence number and rrk) are updated
> > > + * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated
> > 
> > These are new here, but you don't know if they were actually supported:
> > 
> > > + if (wiphy_ext_feature_isset(>wiphy,
> > > + NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&
> > 
> > here.
> 
> The description of the FILS_SK_OFFLOAD currently says:
> 
>   * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS 
> shared key
>   *  authentication with %NL80211_CMD_CONNECT.
> 
> Are you suggesting a new flag to cover the new update attributes?

[snip]

> > Again, how do you know the driver will actually look at
> > UPDATE_AUTH_TYPE?
> 
> If they don't they are broken, right? And if they are broken, the 
> connection will drop and regular connect will happen anyway, no?
> 
> We could add a new flag to signal driver will handle the extra 
> parameters in UPDATE_CONNECT_PARAMS, but it is not clear why it would be 
> needed. Seems to me user-space has all the info needed with the existing 
> flag(s).

Agree, and we don't even have any drivers that are setting the
FILS_SK_OFFLOAD flag anyway, so we can still redefine its semantics to
some extent.

So yeah, I'd argue that what the patch needed was somebody taking a
critical look at my review ;-)

And perhaps fixing the weird flags thing I pointed out.

johannes


Re: [PATCH] nl80211: Update ERP info using NL80211_CMD_UPDATE_CONNECT_PARAMS

2018-03-29 Thread Arend van Spriel

Hi Johannes,

Picking up a somewhat old thread as I did not see a follow-up on this 
patch. I got queried about it over here by our FILS team. So what is 
needed for this patch to pass the bar?


On 12/11/2017 12:12 PM, Johannes Berg wrote:

On Wed, 2017-10-25 at 14:50 +0530, Vidyullatha Kanchanapally wrote:


+ * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
+ * username, erp sequence number and rrk) are updated
+ * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated


These are new here, but you don't know if they were actually supported:


+   if (wiphy_ext_feature_isset(>wiphy,
+   NL80211_EXT_FEATURE_FILS_SK_OFFLOAD) &&


here.


The description of the FILS_SK_OFFLOAD currently says:

 * @NL80211_EXT_FEATURE_FILS_SK_OFFLOAD: Driver SME supports FILS 
shared key

 *  authentication with %NL80211_CMD_CONNECT.

Are you suggesting a new flag to cover the new update attributes?

Drivers reporting FILS_SK_OFFLOAD *and* WIPHY_FLAG_SUPPORTS_FW_ROAM 
really need this info to have any luck roaming.



+   info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] &&
+   info->attrs[NL80211_ATTR_FILS_ERP_REALM] &&
+   info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] &&
+   info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {

[...]

+   } else if (info->attrs[NL80211_ATTR_FILS_ERP_USERNAME] ||
+  info->attrs[NL80211_ATTR_FILS_ERP_REALM] ||
+  info->attrs[NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] ||
+  info->attrs[NL80211_ATTR_FILS_ERP_RRK]) {
+   return -EINVAL;
+   }


This logic is also really odd, why not

if (attrs) {
if (not flag)
return -EINVAL;
/* use attrs etc. */
}


+
+   if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
+   u32 auth_type =
+   nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
+   if (!nl80211_valid_auth_type(rdev, auth_type,
+NL80211_CMD_CONNECT))
+   return -EINVAL;
+   connect.auth_type = auth_type;
+   changed |= UPDATE_AUTH_TYPE;
+   }


Again, how do you know the driver will actually look at
UPDATE_AUTH_TYPE?


If they don't they are broken, right? And if they are broken, the 
connection will drop and regular connect will happen anyway, no?


We could add a new flag to signal driver will handle the extra 
parameters in UPDATE_CONNECT_PARAMS, but it is not clear why it would be 
needed. Seems to me user-space has all the info needed with the existing 
flag(s).


Regards,
Arend


[PATCHv3] ath10k: Add tx ack signal support for management frames

2018-03-29 Thread Venkateswara Naralasetty
This patch add support to get RSSI from acknowledgment
frames for transmitted management frames.

hardware_used: QCA4019, QCA9984.
firmware version: 10.4-3.5.3-00052.

Signed-off-by: Venkateswara Naralasetty 
---
v2:
 * renamed HTT_MGMT_TX_CMPL_INFO_ACK_RSSI to HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASK
 * removed WMI_SERVICE_TDLS_WIDER_BANDWIDTH, which has already added recently.

v3:
 * Addressed warnings.
 * removed WMI_SERVICE which has already added recently
---
 drivers/net/wireless/ath/ath10k/core.h   |  2 ++
 drivers/net/wireless/ath/ath10k/htt.h| 10 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c | 10 ++
 drivers/net/wireless/ath/ath10k/txrx.c   |  8 
 drivers/net/wireless/ath/ath10k/wmi.h|  7 +++
 5 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 73712c8..692aa29 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -52,6 +52,8 @@
 /* Antenna noise floor */
 #define ATH10K_DEFAULT_NOISE_FLOOR -95
 
+#define ATH10K_INVALID_RSSI 128
+
 #define ATH10K_MAX_NUM_MGMT_PENDING 128
 
 /* number of failed packets (20 packets with 16 sw reties each) */
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 8cc2a8b..e5dbb0b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -533,12 +534,18 @@ struct htt_ver_resp {
u8 rsvd0;
 } __packed;
 
+#define HTT_MGMT_TX_CMPL_FLAG_ACK_RSSI BIT(0)
+
+#define HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASKGENMASK(7, 0)
+
 struct htt_mgmt_tx_completion {
u8 rsvd0;
u8 rsvd1;
-   u8 rsvd2;
+   u8 flags;
__le32 desc_id;
__le32 status;
+   __le32 ppdu_id;
+   __le32 info;
 } __packed;
 
 #define HTT_RX_INDICATION_INFO0_EXT_TID_MASK  (0x1F)
@@ -1648,6 +1655,7 @@ struct htt_resp {
 struct htt_tx_done {
u16 msdu_id;
u16 status;
+   u8 ack_rssi;
 };
 
 enum htt_tx_compl_state {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 64996ab..351ab93 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -25,6 +25,7 @@
 #include "mac.h"
 
 #include 
+#include 
 
 /* when under memory pressure rx ring refill may fail and needs a retry */
 #define HTT_RX_RING_REFILL_RETRY_MS 50
@@ -2713,12 +2714,21 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, 
struct sk_buff *skb)
case HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION: {
struct htt_tx_done tx_done = {};
int status = __le32_to_cpu(resp->mgmt_tx_completion.status);
+   int info = __le32_to_cpu(resp->mgmt_tx_completion.info);
 
tx_done.msdu_id = 
__le32_to_cpu(resp->mgmt_tx_completion.desc_id);
 
switch (status) {
case HTT_MGMT_TX_STATUS_OK:
tx_done.status = HTT_TX_COMPL_STATE_ACK;
+   if (test_bit(WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS,
+ar->wmi.svc_map) &&
+   (resp->mgmt_tx_completion.flags &
+HTT_MGMT_TX_CMPL_FLAG_ACK_RSSI)) {
+   tx_done.ack_rssi =
+   FIELD_GET(HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASK,
+ info);
+   }
break;
case HTT_MGMT_TX_STATUS_RETRY:
tx_done.status = HTT_TX_COMPL_STATE_NOACK;
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 70e23bb..cda164f 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -119,6 +120,13 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
info->flags &= ~IEEE80211_TX_STAT_ACK;
}
 
+   if (tx_done->status == HTT_TX_COMPL_STATE_ACK &&
+   tx_done->ack_rssi != ATH10K_INVALID_RSSI) {
+   info->status.ack_signal = ATH10K_DEFAULT_NOISE_FLOOR +
+   tx_done->ack_rssi;
+ 

nested structs parsing

2018-03-29 Thread Johannes Berg
Hi,

For a while I haven't looked at my documentation for 802.11, and now I
noticed I'm getting warnings due to the nested parsing.

However, something seems to be wrong? I have, for example, this (in
net/mac80211/sta_info.h)

struct sta_info {
...
struct {
u64 packets[IEEE80211_NUM_ACS];
u64 bytes[IEEE80211_NUM_ACS];
struct ieee80211_tx_rate last_rate;
u64 msdu[IEEE80211_NUM_TIDS + 1];
} tx_stats;
};

but I'm getting the following warnings now, with only "@tx_stats" being
described in the documentation:

net/mac80211/sta_info.h:590: warning: Function parameter or member 
'status_stats.last_ack' not described in 'sta_info'
net/mac80211/sta_info.h:590: warning: Function parameter or member 
'status_stats.last_ack_signal' not described in 'sta_info'
net/mac80211/sta_info.h:590: warning: Function parameter or member 
'status_stats.ack_signal_filled' not described in 'sta_info'
net/mac80211/sta_info.h:590: warning: Function parameter or member 'msdu' not 
described in 'sta_info'

I can understand the first three of those, but not the last one? Why is
the last one not qualified?

If I change it to this:

struct {
u64 packets[IEEE80211_NUM_ACS];
u64 bytes[IEEE80211_NUM_ACS];
/**
 * @last_rate: last TX rate
 */
struct ieee80211_tx_rate last_rate;
/**
 * @msdu: # of MSDUs per TID
 */
u64 msdu[IEEE80211_NUM_TIDS + 1];
} tx_stats;

I still get a warning on "tx_stats.last_rate", but not on "msdu", which
is sort of obvious from the warning text, but also rather unexpected.

Normally I'd say that the "msdu" warning is originally wrong

However, I'd also argue that if I'm using inline declarations, I
shouldn't have to write it like this:

struct {
u64 packets[IEEE80211_NUM_ACS];
u64 bytes[IEEE80211_NUM_ACS];
/**
 * @tx_stats.last_rate: last TX rate
 */
struct ieee80211_tx_rate last_rate;
...
} tx_stats;

since the comment is contained in the scope of tx_stats already, but
that seems to be what I'd have to do today?

At least fixing one of these to make it consistent would be good :-)

Thanks,
johannes


Re: nested structs parsing

2018-03-29 Thread Johannes Berg
On Thu, 2018-03-29 at 11:46 +0200, Johannes Berg wrote:
> Hi,
> 
> For a while I haven't looked at my documentation for 802.11, and now I
> noticed I'm getting warnings due to the nested parsing.
> 
> However, something seems to be wrong? I have, for example, this (in
> net/mac80211/sta_info.h)
> 
> struct sta_info {
>   ...
> struct {
> u64 packets[IEEE80211_NUM_ACS];
> u64 bytes[IEEE80211_NUM_ACS];
> struct ieee80211_tx_rate last_rate;
> u64 msdu[IEEE80211_NUM_TIDS + 1];
> } tx_stats;
> };
> 
> but I'm getting the following warnings now, with only "@tx_stats" being
> described in the documentation:
> 
> net/mac80211/sta_info.h:590: warning: Function parameter or member 
> 'status_stats.last_ack' not described in 'sta_info'
> net/mac80211/sta_info.h:590: warning: Function parameter or member 
> 'status_stats.last_ack_signal' not described in 'sta_info'
> net/mac80211/sta_info.h:590: warning: Function parameter or member 
> 'status_stats.ack_signal_filled' not described in 'sta_info'
> net/mac80211/sta_info.h:590: warning: Function parameter or member 'msdu' not 
> described in 'sta_info'
> 
> I can understand the first three of those, but not the last one? Why is
> the last one not qualified?
> 
> If I change it to this:
> 
> struct {
> u64 packets[IEEE80211_NUM_ACS];
> u64 bytes[IEEE80211_NUM_ACS];
> /**
>  * @last_rate: last TX rate
>  */
> struct ieee80211_tx_rate last_rate;
> /**
>  * @msdu: # of MSDUs per TID
>  */
> u64 msdu[IEEE80211_NUM_TIDS + 1];
> } tx_stats;
> 
> I still get a warning on "tx_stats.last_rate", but not on "msdu", which
> is sort of obvious from the warning text, but also rather unexpected.
> 
> Normally I'd say that the "msdu" warning is originally wrong
> 
> However, I'd also argue that if I'm using inline declarations, I
> shouldn't have to write it like this:
> 
> struct {
> u64 packets[IEEE80211_NUM_ACS];
> u64 bytes[IEEE80211_NUM_ACS];
> /**
>  * @tx_stats.last_rate: last TX rate
>  */
> struct ieee80211_tx_rate last_rate;
>   ...
>   } tx_stats;

Whoops, sent a fraction of a second too early - this actually causes a
warning too (no idea why four times):

net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format:   
   * @tx_stats.last_rate: last TX rate
net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format:   
   * @tx_stats.last_rate: last TX rate
net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format:   
   * @tx_stats.last_rate: last TX rate
net/mac80211/sta_info.h:560: warning: Incorrect use of kernel-doc format:   
   * @tx_stats.last_rate: last TX rate

johannes


Re: ath: Remove unnecessary ath_bcast_mac and use eth_broadcast_addr

2018-03-29 Thread Kalle Valo
Joe Perches  wrote:

> Remove the static array and use the generic routine to set the
> Ethernet broadcast address.
> 
> Signed-off-by: Joe Perches 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

a72c92629108 ath: Remove unnecessary ath_bcast_mac and use eth_broadcast_addr

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

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



Re: ath10k: fix vdev stats for 10.4 firmware

2018-03-29 Thread Kalle Valo
Rajkumar Manoharan  wrote:

> Currently vdev stats displayed in fw_stats are applicable
> only for TLV based firmware and fix it for 10.4 firmware
> as of now. The vdev stats in 10.4 firmware is split into two
> parts (vdev_stats, vdev_stats_extended). The actual stats
> are captured only in extended vdev stats. In order to enable
> vdev stats, appropriate feature bit will be set on extended
> resource config. As FTM related counters are available only on
> newer 10.4 based firmware, these counters will be displayed
> only on valid data.
> 
> Signed-off-by: Rajkumar Manoharan 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

1b3fdb50f881 ath10k: fix vdev stats for 10.4 firmware

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

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



Re: ath10k: fix recent bandwidth conversion bug

2018-03-29 Thread Kalle Valo
ako...@codeaurora.org wrote:

> The commit "cfg80211: make RATE_INFO_BW_20 the default" changed
> the index of RATE_INFO_BW_20, but the updates to ath10k missed
> the special bandwidth calculation case in
> ath10k_update_per_peer_tx_stats().
> 
> This will fix below warning,
> 
>  WARNING: CPU: 0 PID: 609 at net/wireless/util.c:1254
>  cfg80211_calculate_bitrate+0x174/0x220
>  invalid rate bw=1, mcs=9, nss=2
> 
>  (unwind_backtrace) from
>  (cfg80211_calculate_bitrate+0x174/0x220)
>  (cfg80211_calculate_bitrate) from
>  (nl80211_put_sta_rate+0x44/0x1dc)from
>  (nl80211_put_sta_rate) from
>  (nl80211_send_station+0x388/0xaf0)
>  (nl80211_get_station+0xa8/0xec)
>  [ end trace da8257d6a850e91a ]
> 
> Fixes: 842be75c77cb ("cfg80211: make RATE_INFO_BW_20 the default")
> Signed-off-by: Christian Lamparter 
> Signed-off-by: Anilkumar Kolli 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

91493e8e10f0 ath10k: fix recent bandwidth conversion bug

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

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



Re: ath10k: Advertize beacon_int_min_gcd

2018-03-29 Thread Kalle Valo
ako...@codeaurora.org wrote:

> This patch fixes regression caused by 0c317a02ca98
> ("cfg80211: support virtual interfaces with different beacon intervals"),
> with this change cfg80211 expects the driver to advertize
> 'beacon_int_min_gcd' to support different beacon intervals in multivap
> scenario. This support is added for, QCA988X/QCA99X0/QCA9984/QCA4019.
> 
> Verifed AP + mesh bring up on QCA9984 with beacon interval 100msec and
> 1000msec respectively.
> Frimware: firmware-5.bin_10.4-3.5.3-00053
> 
> Fixes: 0c317a02ca98 ("cfg80211: support virtual interfaces with different 
> beacon intervals")
> Signed-off-by: Anilkumar Kolli 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

8ebee73b574a ath10k: advertize beacon_int_min_gcd

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

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



Re: [v7,2/5] ath10k: Enable TDLS peer buffer STA feature

2018-03-29 Thread Kalle Valo
yint...@qti.qualcomm.com wrote:

> Enable TDLS peer buffer STA feature.
> QCA6174 firmware(version: WLAN.RM.4.4) support TDLS peer buffer STA,
> it reports this capability through wmi service map in wmi service ready
> event. Set related parameter in TDLS WMI command to enable this feature.
> 
> Signed-off-by: Yingying Tang 
> Signed-off-by: Kalle Valo 

4 patches applied to ath-next branch of ath.git, thanks.

802ca335496e ath10k: enable TDLS peer buffer STA feature
4c9f8d114660 ath10k: enable TDLS peer inactivity detection
c3816c9ee12c ath10k: avoid to set WEP key for TDLS peer
9cdd00575029 ath10k: fix TDLS peer TX data failure issue on encryped AP

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

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



Re: [PATCH v3 2/3] mac80211: limit wmm params to comply with ETSI requirements

2018-03-29 Thread Johannes Berg
On Thu, 2018-03-29 at 10:55 +0200, Arend van Spriel wrote:
> 
> > No, the regulations say you have to use a long content window, hence
> 
> Guess you mean "contention window" :-p

Heh, yes.

> > limiting both min and max at the lower end (hence max_t).
> 
> Do you have any reference to the new ETSI requirements. I would like to 
> know their motivation for putting requirements on WMM parameters.

It's for LAA - i.e. LTE on 5 GHz.

http://www.etsi.org/deliver/etsi_en/301800_301899/301893/02.01.01_60/en_301893v020101p.pdf

See Table 7 and Table 8 and references to it.

johannes


Re: [PATCH v3 2/3] mac80211: limit wmm params to comply with ETSI requirements

2018-03-29 Thread Arend van Spriel

On 3/29/2018 10:35 AM, Johannes Berg wrote:

On Wed, 2018-03-28 at 10:29 -0700, Peter Oh wrote:

+   if (sdata->vif.type == NL80211_IFTYPE_AP)
+   wmm_ac = >wmm_rule->ap[ac];
+   else
+   wmm_ac = >wmm_rule->client[ac];
+   qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min);
+   qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max);


not min_t() for cw_max?


No, the regulations say you have to use a long content window, hence


Guess you mean "contention window" :-p


limiting both min and max at the lower end (hence max_t).


Do you have any reference to the new ETSI requirements. I would like to 
know their motivation for putting requirements on WMM parameters.


Regards,
Arend


Re: [v2] wcn36xx: dequeue all pending indicator messages

2018-03-29 Thread Kalle Valo
Daniel Mack  wrote:

> In case wcn36xx_smd_rsp_process() is called more than once before
> hal_ind_work was dispatched, the messages will end up in hal_ind_queue,
> but wcn36xx_ind_smd_work() will only look at the first message in that
> list.
> 
> Fix this by dequeing the messages from the list in a loop, and only stop
> when it's empty.
> 
> This issue was found during a review of the driver. In my tests, that
> race never actually occured.
> 
> Signed-off-by: Daniel Mack 
> Reviewed-by: Bjorn Andersson 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

f276ba06e8b2 wcn36xx: dequeue all pending indicator messages

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

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



Re: wcn36xx: Fix firmware crash due to corrupted buffer address

2018-03-29 Thread Kalle Valo
Ramon Fried  wrote:

> wcn36xx_start_tx function retrieves the buffer descriptor from the
> channel control queue to start filling tx buffer information. However,
> nothing prevents this same buffer to be concurrently accessed in a
> concurent tx call, leading to potential buffer coruption and firmware
> crash (observed during iperf test). The channel control queue should
> only be accessed and updated with the channel lock.
> 
> Fix this issue by using a local buffer descriptor which will be copied
> in the thread-safe wcn36xx_dxe_tx_frame.
> 
> Note that buffer descriptor size is few bytes so the introduced copy
> overhead is insignificant. Moreover, this allows to keep the locked
> section minimal.
> 
> Signed-off-by: Loic Poulain 
> Signed-off-by: Ramon Fried 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

e5f9908155c9 wcn36xx: Fix firmware crash due to corrupted buffer address

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

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



Re: wcn36xx: turn off probe response offloading

2018-03-29 Thread Kalle Valo
Ramon Fried  wrote:

> It appears that the WCN36xx firmware doesn't actually respond to
> probe requests. Until it's resolved, switch the probe response
> responsibility to the 802.11 layer to allow creation of
> hidden SSID AP's.
> 
> Signed-off-by: Ramon Fried 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

ee35eecb0822 wcn36xx: turn off probe response offloading

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

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



Re: [1/2] ath10k: refactor ath10k_pci_dump_memory() in preparation for QCA9984 support

2018-03-29 Thread Kalle Valo
Kalle Valo  wrote:

> As QCA9984 needs two region types refactor the code to make it easier add the
> new types. No functional changes.
> 
> Signed-off-by: Kalle Valo 

2 patches applied to ath-next branch of ath.git, thanks.

10c228843081 ath10k: refactor ath10k_pci_dump_memory() in preparation for 
QCA9984 support
219cc084c670 ath10k: add memory dump support QCA9984

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

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



Re: ath10k: Suppress "Unknown eventid: 36925" warnings

2018-03-29 Thread Kalle Valo
Sathishkumar Muruganandam  wrote:

> FW has Smart Logging feature enabled by default for detecting failures
> and processing FATAL_CONDITION_EVENTID (36925 - 0x903D) back to host.
> 
> Since ath10k doesn't implement the Smart Logging and FATAL CONDITION
> EVENT processing yet, suppressing the unknown event ID warning by moving
> this under ATH10K_DBG_WMI.
> 
> Simulated the same issue by having associated STA powered off when
> ping flood was running from AP backbone. This triggerd STA KICKOUT
> in AP followed by FATAL CONDITION event 36925.
> 
> Issue was reproduced and verified in below DUT
> 
> AP mode of OpenWRT QCA9984 running 6.0.8 with FW ver 10.4-3.5.3-00053
> 
> Signed-off-by: Sathishkumar Muruganandam 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

606204bb863f ath10k: suppress "Unknown eventid: 36925" warnings

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

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



Re: [PATCH v3 2/3] mac80211: limit wmm params to comply with ETSI requirements

2018-03-29 Thread Johannes Berg
On Wed, 2018-03-28 at 13:24 +0300, Luca Coelho wrote:
> 
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -135,12 +135,12 @@ static void restore_regulatory_settings(bool 
> reset_user);
>  
>  static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
>  {
> - return rtnl_dereference(cfg80211_regdomain);
> + return rcu_dereference_rtnl(cfg80211_regdomain);
>  }
>  
>  const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy)
>  {
> - return rtnl_dereference(wiphy->regd);
> + return rcu_dereference_rtnl(wiphy->regd);
>  }
>  
>  static const char *reg_dfs_region_str(enum nl80211_dfs_regions dfs_region)

This should've stayed a separate commit, I'll take that from our tree.

johannes


Re: [1/2] ath10k: enable QCA6174/QCA9377 to read the chip temperature

2018-03-29 Thread Kalle Valo
ryan...@codeaurora.org wrote:

> The firmware of QCA6174/QCA9377 already support the feature, just enable
> it to be able to handle the get_temperature command and process the event.
> 
> You can read the temperature by using the hwmon interface,
> 
> cat /sys/class/ieee80211/phy*/device/hwmon/hwmon2/temp1_input
> 
> Verified with the following hardware and software combination,
> QCA6174, only firmware-4.bin doesn't support this, otherwise all support.
> QCA9377, all the firmwares upstreamed support this command
> 
> Signed-off-by: Ryan Hsu 
> Signed-off-by: Kalle Valo 

2 patches applied to ath-next branch of ath.git, thanks.

e98199a8c27f ath10k: enable QCA6174/QCA9377 to read the chip temperature
e3814bec380f ath10k: add FW API 6 firmware image for QCA9377

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

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



Re: [PATCHv2] Revert "ath10k: send (re)assoc peer command when NSS changed"

2018-03-29 Thread Kalle Valo
Karthikeyan Periyasamy  wrote:

> This reverts commit 55884c045d31a29cf69db8332d1064a1b61dd159.
> 
> When Ath10k is in AP mode and an unassociated STA sends a VHT action frame
> (Operating Mode Notification for the NSS change) periodically to AP this 
> causes
> ath10k to call ath10k_station_assoc() which sends WMI_PEER_ASSOC_CMDID during
> NSS update. Over the time (with a certain client it can happen within 15 mins
> when there are over 500 of these VHT action frames) continuous calls of
> WMI_PEER_ASSOC_CMDID cause firmware to assert due to resource exhaust.
> 
> To my knowledge setting WMI_PEER_NSS peer param itself enough to handle NSS
> updates and no need to call ath10k_station_assoc(). So revert the original
> commit from 2014 as it's unclear why the change was really needed.
> Now the firmware assert doesn't happen anymore.
> 
> Issue observed in QCA9984 platform with firmware version:10.4-3.5.3-00053.
> This Change tested in QCA9984 with firmware version: 10.4-3.5.3-00053 and
> QCA988x platform with firmware version: 10.2.4-1.0-00036.
> 
> Firmware Assert log:
> 
> ath10k_pci 0002:01:00.0: firmware crashed! (guid 
> e61f1274-9acd-4c5b-bcca-e032ea6e723c)
> ath10k_pci 0002:01:00.0: qca9984/qca9994 hw1.0 target 0x0100 chip_id 
> 0x sub 168c:cafe
> ath10k_pci 0002:01:00.0: kconfig debug 1 debugfs 1 tracing 0 dfs 1 testmode 1
> ath10k_pci 0002:01:00.0: firmware ver 10.4-3.5.3-00053 api 5 features 
> no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast crc32 4c56a386
> ath10k_pci 0002:01:00.0: board_file api 2 bmi_id 0:4 crc32 c2271344
> ath10k_pci 0002:01:00.0: htt-ver 2.2 wmi-op 6 htt-op 4 cal otp max-sta 512 
> raw 0 hwcrypto 1
> ath10k_pci 0002:01:00.0: firmware register dump:
> ath10k_pci 0002:01:00.0: [00]: 0x000A 0x15B3 0x00981E5F 0x00975B31
> ath10k_pci 0002:01:00.0: [04]: 0x00981E5F 0x00060530 0x0011 0x00446C60
> ath10k_pci 0002:01:00.0: [08]: 0x0042F1FC 0x00458080 0x0017 0x
> ath10k_pci 0002:01:00.0: [12]: 0x0009 0x 0x00973ABC 0x00973AD2
> ath10k_pci 0002:01:00.0: [16]: 0x00973AB0 0x00960E62 0x009606CA 0x
> ath10k_pci 0002:01:00.0: [20]: 0x40981E5F 0x004066DC 0x0040 0x00981E34
> ath10k_pci 0002:01:00.0: [24]: 0x80983B48 0x0040673C 0x00C0 0xC0981E5F
> ath10k_pci 0002:01:00.0: [28]: 0x80993DEB 0x0040676C 0x00431AB8 0x0045D0C4
> ath10k_pci 0002:01:00.0: [32]: 0x80993E5C 0x004067AC 0x004303C0 0x0045D0C4
> ath10k_pci 0002:01:00.0: [36]: 0x80994AAB 0x004067DC 0x 0x0045D0C4
> ath10k_pci 0002:01:00.0: [40]: 0x809971A0 0x0040681C 0x004303C0 0x00441B00
> ath10k_pci 0002:01:00.0: [44]: 0x80991904 0x0040688C 0x004303C0 0x0045D0C4
> ath10k_pci 0002:01:00.0: [48]: 0x80963AD3 0x00406A7C 0x004303C0 0x009918FC
> ath10k_pci 0002:01:00.0: [52]: 0x80960E80 0x00406A9C 0x001F 0x0040
> ath10k_pci 0002:01:00.0: [56]: 0x80960E51 0x00406ACC 0x0040 0x
> ath10k_pci 0002:01:00.0: Copy Engine register dump:
> ath10k_pci 0002:01:00.0: index: addr: sr_wr_idx: sr_r_idx: dst_wr_idx: 
> dst_r_idx:
> ath10k_pci 0002:01:00.0: [00]: 0x0004a000 15 15 3 3
> ath10k_pci 0002:01:00.0: [01]: 0x0004a400 17 17 212 213
> ath10k_pci 0002:01:00.0: [02]: 0x0004a800 21 21 20 21
> ath10k_pci 0002:01:00.0: [03]: 0x0004ac00 25 25 27 25
> ath10k_pci 0002:01:00.0: [04]: 0x0004b000 515 515 144 104
> ath10k_pci 0002:01:00.0: [05]: 0x0004b400 28 28 155 156
> ath10k_pci 0002:01:00.0: [06]: 0x0004b800 12 12 12 12
> ath10k_pci 0002:01:00.0: [07]: 0x0004bc00 1 1 1 1
> ath10k_pci 0002:01:00.0: [08]: 0x0004c000 0 0 127 0
> ath10k_pci 0002:01:00.0: [09]: 0x0004c400 1 1 1 1
> ath10k_pci 0002:01:00.0: [10]: 0x0004c800 0 0 0 0
> ath10k_pci 0002:01:00.0: [11]: 0x0004cc00 0 0 0 0
> ath10k_pci 0002:01:00.0: CE[1] write_index 212 sw_index 213 hw_index 0 
> nentries_mask 0x01ff
> ath10k_pci 0002:01:00.0: CE[2] write_index 20 sw_index 21 hw_index 0 
> nentries_mask 0x007f
> ath10k_pci 0002:01:00.0: CE[5] write_index 155 sw_index 156 hw_index 0 
> nentries_mask 0x01ff
> ath10k_pci 0002:01:00.0: DMA addr: nbytes: meta data: byte swap: gather:
> ath10k_pci 0002:01:00.0: [455]: 0x580c0042 0 0 0 0
> ath10k_pci 0002:01:00.0: [456]: 0x594a0010 0 0 0 1
> ath10k_pci 0002:01:00.0: [457]: 0x580c0042 0 0 0 0
> ath10k_pci 0002:01:00.0: [458]: 0x594a0038 0 0 0 1
> ath10k_pci 0002:01:00.0: [459]: 0x580c0a42 0 0 0 0
> ath10k_pci 0002:01:00.0: [460]: 0x594a0060 0 0 0 1
> ath10k_pci 0002:01:00.0: [461]: 0x580c0c42 0 0 0 0
> ath10k_pci 0002:01:00.0: [462]: 0x594a0010 0 0 0 1
> ath10k_pci 0002:01:00.0: [463]: 0x580c0c42 0 0 0 0
> ath10k_pci 0002:01:00.0: [464]: 0x594a0038 0 0 0 1
> ath10k_pci 0002:01:00.0: [465]: 0x580c0a42 0 0 0 0
> ath10k_pci 0002:01:00.0: [466]: 0x594a0060 0 0 0 1
> ath10k_pci 0002:01:00.0: [467]: 0x580c0042 0 0 0 0
> ath10k_pci 0002:01:00.0: [468]: 0x594a0010 0 0 0 1
> ath10k_pci 0002:01:00.0: [469]: 0x580c1c42 0 0 0 0
> ath10k_pci 0002:01:00.0: [470]: 0x594a0010 0 0 0 1
> ath10k_pci 0002:01:00.0: [471]: 0x580c1c42 0 0 0 0
> 

Re: [v2] ath9k: fix DFS detector synchronization

2018-03-29 Thread Kalle Valo
Timothy Redaelli  wrote:

> some userspace programs (e.g. hostapd) need to set the regulatory domain
> before selecting the operating channel. Synchronize DFS detector regardless of
> the value of ah->curchan, to avoid situations where wireless scan can't be 
> done
> on some 5GHz sub-bands, because dfs_region is constantly UNSET.
> 
> Acked-by: Felix Fietkau 
> Signed-off-by: Timothy Redaelli 
> Signed-off-by: Kalle Valo 

Patch applied to ath-next branch of ath.git, thanks.

4415d58c47e5 ath9k: fix DFS detector synchronization

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

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



Re: pull-request: iwlwifi-next 2018-03-28

2018-03-29 Thread Kalle Valo
Luca Coelho  writes:

> This is a batch of patches intended for v4.17.  Nothing major here,
> just the usual continued development, bugfixes, new FW APIs and some
> minor features.  More details about the contents in the tag
> description.
>
> The commit messages you commented on have been fixed, as you can see in
> v2 of those patches that I sent to the list.
>
> I have sent this out before and kbuildbot reported success.
>
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit 6b7d5c0745905b71127d0c1ae6eeddc09bbdaad8:
>
>   Merge 
> git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
> (2018-03-28 11:57:34 +0300)
>
> are available in the Git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
> tags/iwlwifi-next-for-kalle-2018-03-28
>
> for you to fetch changes up to 378c8931342f99c5a6fce21e38ef46ac39395464:
>
>   iwlwifi: wrt: add fw force restart via triggers (2018-03-28 22:43:40 +0300)
>
> 
> iwlwifi patches for 4.14
>
> * Fix a UBSAN warning;
> * Improvement in the net-stack/driver log syncing
> * An RCU lock fix in the new rate-scaling code;
> * Support for new PCI IDs for the 9000 family;
> * Support for a new API version;
> * Initial work for supporting the new ETSI rules;
> * Support for advanced dwell in scanning;
> * Support for OCE in scanning;
> * Some debugging improvements;
> * Other small improvements and cleanups here and there.
>
> 

Pulled, thanks.

-- 
Kalle Valo


Re: [PATCH v3 2/3] mac80211: limit wmm params to comply with ETSI requirements

2018-03-29 Thread Johannes Berg
On Wed, 2018-03-28 at 10:29 -0700, Peter Oh wrote:
> > +   if (sdata->vif.type == NL80211_IFTYPE_AP)
> > +   wmm_ac = >wmm_rule->ap[ac];
> > +   else
> > +   wmm_ac = >wmm_rule->client[ac];
> > +   qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min);
> > +   qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max);
> 
> not min_t() for cw_max?

No, the regulations say you have to use a long content window, hence
limiting both min and max at the lower end (hence max_t).

johannes


Re: [PATCH v2] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Kalle Valo
(really adding Bjorn)

Ramon Fried  writes:

> (adding Bjorn Andersson)
>
>
> On 3/29/2018 10:15 AM, Kalle Valo wrote:
>> (adding devicetree list)
>>
>> Ramon Fried  writes:
>>
>>> wcn3610 can only operate on 2.4GHz band due to RF limitation.
>>> If wcn36xx digital block is associated with an external IRIS
>>> RF module, retrieve the id and disable 5GHz band in case of
>>> wcn3610 id.
>>>
>>> Signed-off-by: Ramon Fried 
>>> ---
>>> v2: fixed wrong assignment, which is logically introduces the 
>>> same behaviour, but for correctness.
>>>
>>>  drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
>>>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
>>> b/drivers/net/wireless/ath/wcn36xx/main.c
>>> index ab5be6d2c691..833531a68c95 100644
>>> --- a/drivers/net/wireless/ath/wcn36xx/main.c
>>> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
>>> @@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
>>> BIT(NL80211_IFTYPE_MESH_POINT);
>>>  
>>> wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
>>> -   if (wcn->rf_id != RF_IRIS_WCN3620)
>>> +   if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
>>> wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
>>>  
>>> wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
>>> @@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct 
>>> wcn36xx *wcn,
>>> if (iris_node) {
>>> if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
>>> wcn->rf_id = RF_IRIS_WCN3620;
>>> +   else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
>>> +   wcn->rf_id = RF_IRIS_WCN3610;
>>> of_node_put(iris_node);
>>> }
>> Should we document qcom,wcn3610 just like wcn3620 is:
>>
>> Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt:
>> "qcom,wcn3620",
>
> IMHO the mentioned bindings is related to the PIL (peripheral image
> loaded) which is just the firmware part and has
> nothing to do with wifi frontend(IRIS).

Should we then have a bindings document for wcn36xx or is it ok to use
compatible strings like this without any docs? I'm not very familiar
with the devicetree stuff.

-- 
Kalle Valo


Re: [PATCH v2] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Loic Poulain
Hi Ramon,

On 29 March 2018 at 09:32, Ramon Fried  wrote:

>> Should we document qcom,wcn3610 just like wcn3620 is:
>>
>> Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt: 
>>"qcom,wcn3620",
> IMHO the mentioned bindings is related to the PIL (peripheral image loaded) 
> which is just the firmware part and has
> nothing to do with wifi frontend(IRIS).
>

It seems that the RF is a subnode of the PIL node:

"= SUBNODES
A required subnode of the WCNSS PIL is used to describe the attached rf module
and its resource dependencies. It is described by the following properties:"

So we should add qcom,wcn3610 to the exiting list of 'compatible' rf modules.

Regards,
Loic


Re: [PATCH v2] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Ramon Fried
(adding Bjorn Andersson)


On 3/29/2018 10:15 AM, Kalle Valo wrote:
> (adding devicetree list)
>
> Ramon Fried  writes:
>
>> wcn3610 can only operate on 2.4GHz band due to RF limitation.
>> If wcn36xx digital block is associated with an external IRIS
>> RF module, retrieve the id and disable 5GHz band in case of
>> wcn3610 id.
>>
>> Signed-off-by: Ramon Fried 
>> ---
>> v2: fixed wrong assignment, which is logically introduces the 
>>  same behaviour, but for correctness.
>>
>>  drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
>>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
>> b/drivers/net/wireless/ath/wcn36xx/main.c
>> index ab5be6d2c691..833531a68c95 100644
>> --- a/drivers/net/wireless/ath/wcn36xx/main.c
>> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
>> @@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
>>  BIT(NL80211_IFTYPE_MESH_POINT);
>>  
>>  wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
>> -if (wcn->rf_id != RF_IRIS_WCN3620)
>> +if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
>>  wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
>>  
>>  wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
>> @@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct 
>> wcn36xx *wcn,
>>  if (iris_node) {
>>  if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
>>  wcn->rf_id = RF_IRIS_WCN3620;
>> +else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
>> +wcn->rf_id = RF_IRIS_WCN3610;
>>  of_node_put(iris_node);
>>  }
> Should we document qcom,wcn3610 just like wcn3620 is:
>
> Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt:  
>   "qcom,wcn3620",
IMHO the mentioned bindings is related to the PIL (peripheral image loaded) 
which is just the firmware part and has
nothing to do with wifi frontend(IRIS).



Re: [PATCH 07/14] iwlwifi: mvm: add support for oce

2018-03-29 Thread Kalle Valo
Luciano Coelho  writes:

> On Wed, 2018-03-28 at 19:20 +0300, Kalle Valo wrote:
>> Luca Coelho  writes:
>> 
>> > From: "Zamir, Roee" 
>> > 
>> > Get capabilities from the fw, expose them with nl80211, and enable
>> > them
>> > in UMAC scan if the relevant nl80211 flags are set by the
>> > userspace.
>> > 
>> > Signed-off-by: Roee Zamir 
>> > Signed-off-by: Luca Coelho 
>> 
>> OCE is?
>
> OCE is Optimized Connectivity Experience.  It's WFA's version of
> 802.11ai (FILS).  I'll clarify in the commit message.

Great, thanks. And thanks for improving the other commit logs as well,
much more understandable now.

-- 
Kalle Valo


Re: [PATCH v2] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Kalle Valo
(adding devicetree list)

Ramon Fried  writes:

> wcn3610 can only operate on 2.4GHz band due to RF limitation.
> If wcn36xx digital block is associated with an external IRIS
> RF module, retrieve the id and disable 5GHz band in case of
> wcn3610 id.
>
> Signed-off-by: Ramon Fried 
> ---
> v2: fixed wrong assignment, which is logically introduces the 
>   same behaviour, but for correctness.
>
>  drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
> b/drivers/net/wireless/ath/wcn36xx/main.c
> index ab5be6d2c691..833531a68c95 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
>   BIT(NL80211_IFTYPE_MESH_POINT);
>  
>   wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
> - if (wcn->rf_id != RF_IRIS_WCN3620)
> + if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
>   wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
>  
>   wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
> @@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct 
> wcn36xx *wcn,
>   if (iris_node) {
>   if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
>   wcn->rf_id = RF_IRIS_WCN3620;
> + else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
> + wcn->rf_id = RF_IRIS_WCN3610;
>   of_node_put(iris_node);
>   }

Should we document qcom,wcn3610 just like wcn3620 is:

Documentation/devicetree/bindings/remoteproc/qcom,wcnss-pil.txt:
"qcom,wcn3620",

-- 
Kalle Valo


Re: [PATCH] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Ramon Fried


On 3/29/2018 9:58 AM, Rafał Miłecki wrote:
> On 03/29/2018 08:20 AM, Ramon Fried wrote:
>> wcn3610 can only operate on 2.4GHz band due to RF limitation.
>> If wcn36xx digital block is associated with an external IRIS
>> RF module, retrieve the id and disable 5GHz band in case of
>> wcn3610 id.
>>
>> Signed-off-by: Ramon Fried 
>> ---
>>  drivers/net/wireless/ath/wcn36xx/main.c    | 4 +++-
>>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
>> b/drivers/net/wireless/ath/wcn36xx/main.c
>> index ab5be6d2c691..833531a68c95 100644
>> --- a/drivers/net/wireless/ath/wcn36xx/main.c
>> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
>> @@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
>>  BIT(NL80211_IFTYPE_MESH_POINT);
>>
>>  wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
>> -    if (wcn->rf_id != RF_IRIS_WCN3620)
>> +    if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
>>  wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
>>
>>  wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
>> @@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct 
>> wcn36xx *wcn,
>>  if (iris_node) {
>>  if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
>>  wcn->rf_id = RF_IRIS_WCN3620;
>> +    else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
>> +    wcn->rf_id = RF_IRIS_WCN3620;
>
> RF_IRIS_WCN3610 ?
You're correct. I also noticed just now.
Sent v2. Thanks.
>
> ___
> wcn36xx mailing list
> wcn3...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/wcn36xx



Re: [PATCH] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Rafał Miłecki

On 03/29/2018 08:20 AM, Ramon Fried wrote:

wcn3610 can only operate on 2.4GHz band due to RF limitation.
If wcn36xx digital block is associated with an external IRIS
RF module, retrieve the id and disable 5GHz band in case of
wcn3610 id.

Signed-off-by: Ramon Fried 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index ab5be6d2c691..833531a68c95 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
BIT(NL80211_IFTYPE_MESH_POINT);

wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
-   if (wcn->rf_id != RF_IRIS_WCN3620)
+   if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;

wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
@@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct wcn36xx 
*wcn,
if (iris_node) {
if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
wcn->rf_id = RF_IRIS_WCN3620;
+   else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
+   wcn->rf_id = RF_IRIS_WCN3620;


RF_IRIS_WCN3610 ?


[PATCH v2] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Ramon Fried
wcn3610 can only operate on 2.4GHz band due to RF limitation.
If wcn36xx digital block is associated with an external IRIS
RF module, retrieve the id and disable 5GHz band in case of
wcn3610 id.

Signed-off-by: Ramon Fried 
---
v2: fixed wrong assignment, which is logically introduces the 
same behaviour, but for correctness.

 drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index ab5be6d2c691..833531a68c95 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
BIT(NL80211_IFTYPE_MESH_POINT);
 
wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
-   if (wcn->rf_id != RF_IRIS_WCN3620)
+   if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
 
wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
@@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct wcn36xx 
*wcn,
if (iris_node) {
if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
wcn->rf_id = RF_IRIS_WCN3620;
+   else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
+   wcn->rf_id = RF_IRIS_WCN3610;
of_node_put(iris_node);
}
 
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 81017e6703b4..bc4d1a10d90e 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -95,6 +95,7 @@ enum wcn36xx_ampdu_state {
 #define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
 
 #define RF_UNKNOWN 0x
+#define RF_IRIS_WCN36100x3610
 #define RF_IRIS_WCN36200x3620
 
 static inline void buff_to_be(u32 *buf, size_t len)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH] wcn36xx: Disable 5GHz for wcn3610

2018-03-29 Thread Ramon Fried
wcn3610 can only operate on 2.4GHz band due to RF limitation.
If wcn36xx digital block is associated with an external IRIS
RF module, retrieve the id and disable 5GHz band in case of
wcn3610 id.

Signed-off-by: Ramon Fried 
---
 drivers/net/wireless/ath/wcn36xx/main.c| 4 +++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c 
b/drivers/net/wireless/ath/wcn36xx/main.c
index ab5be6d2c691..833531a68c95 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1146,7 +1146,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
BIT(NL80211_IFTYPE_MESH_POINT);
 
wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = _band_2ghz;
-   if (wcn->rf_id != RF_IRIS_WCN3620)
+   if (wcn->rf_id != RF_IRIS_WCN3610 && wcn->rf_id != RF_IRIS_WCN3620)
wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = _band_5ghz;
 
wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
@@ -1248,6 +1248,8 @@ static int wcn36xx_platform_get_resources(struct wcn36xx 
*wcn,
if (iris_node) {
if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
wcn->rf_id = RF_IRIS_WCN3620;
+   else if (of_device_is_compatible(iris_node, "qcom,wcn3610"))
+   wcn->rf_id = RF_IRIS_WCN3620;
of_node_put(iris_node);
}
 
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h 
b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 81017e6703b4..bc4d1a10d90e 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -95,6 +95,7 @@ enum wcn36xx_ampdu_state {
 #define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
 
 #define RF_UNKNOWN 0x
+#define RF_IRIS_WCN36100x3610
 #define RF_IRIS_WCN36200x3620
 
 static inline void buff_to_be(u32 *buf, size_t len)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project