Re: WARNING at net/mac80211/sta_info.c:1057 (__sta_info_destroy_part2())

2019-10-20 Thread Tomislav Požega
> -11 is -EAGAIN which would mean that the HTC credits have run out some
>  reason for the WMI command:
> 
> if (ep->tx_credits < credits) {
> ath10k_dbg(ar, ATH10K_DBG_HTC,
> "htc insufficient credits ep %d required %d available %d\n",
> eid, credits, ep->tx_credits);
> spin_unlock_bh(>tx_lock);
> ret = -EAGAIN;
> goto err_pull;
> }
> 
> Credits can run out, for example, if there's a lot of WMI command/event
> activity and are not returned during the 3s wait, firmware crashed or
> problems with the PCI bus.

Hi

Can this occur if the target memory is not properly allocated?


[PATCH] ath: rename regulatory rules

2019-10-10 Thread Tomislav Požega
Regulatory rule defines in regd.c are used not only by ath9k but also
ath10k driver (haven't test other drivers) and thus should be
renamed from ATH9K* to ATH*.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/regd.c |   50 +++---
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index e25bfdf..20f4f8e 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -33,33 +33,33 @@
  */
 
 /* Only these channels all allow active scan on all world regulatory domains */
-#define ATH9K_2GHZ_CH01_11 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
+#define ATH_2GHZ_CH01_11   REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
 
 /* We enable active scan on these a case by case basis by regulatory domain */
-#define ATH9K_2GHZ_CH12_13 REG_RULE(2467-10, 2472+10, 40, 0, 20,\
+#define ATH_2GHZ_CH12_13   REG_RULE(2467-10, 2472+10, 40, 0, 20,\
 NL80211_RRF_NO_IR)
-#define ATH9K_2GHZ_CH14REG_RULE(2484-10, 2484+10, 40, 0, 20,\
+#define ATH_2GHZ_CH14  REG_RULE(2484-10, 2484+10, 40, 0, 20,\
 NL80211_RRF_NO_IR | \
 NL80211_RRF_NO_OFDM)
 
 /* We allow IBSS on these on a case by case basis by regulatory domain */
-#define ATH9K_5GHZ_5150_5350   REG_RULE(5150-10, 5350+10, 80, 0, 30,\
+#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\
 NL80211_RRF_NO_IR)
-#define ATH9K_5GHZ_5470_5850   REG_RULE(5470-10, 5850+10, 80, 0, 30,\
+#define ATH_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\
 NL80211_RRF_NO_IR)
-#define ATH9K_5GHZ_5725_5850   REG_RULE(5725-10, 5850+10, 80, 0, 30,\
+#define ATH_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 80, 0, 30,\
 NL80211_RRF_NO_IR)
 
-#define ATH9K_2GHZ_ALL ATH9K_2GHZ_CH01_11, \
-   ATH9K_2GHZ_CH12_13, \
-   ATH9K_2GHZ_CH14
+#define ATH_2GHZ_ALL   ATH_2GHZ_CH01_11, \
+   ATH_2GHZ_CH12_13, \
+   ATH_2GHZ_CH14
 
-#define ATH9K_5GHZ_ALL ATH9K_5GHZ_5150_5350, \
-   ATH9K_5GHZ_5470_5850
+#define ATH_5GHZ_ALL   ATH_5GHZ_5150_5350, \
+   ATH_5GHZ_5470_5850
 
 /* This one skips what we call "mid band" */
-#define ATH9K_5GHZ_NO_MIDBAND  ATH9K_5GHZ_5150_5350, \
-   ATH9K_5GHZ_5725_5850
+#define ATH_5GHZ_NO_MIDBANDATH_5GHZ_5150_5350, \
+   ATH_5GHZ_5725_5850
 
 /* Can be used for:
  * 0x60, 0x61, 0x62 */
@@ -67,8 +67,8 @@
.n_reg_rules = 5,
.alpha2 =  "99",
.reg_rules = {
-   ATH9K_2GHZ_ALL,
-   ATH9K_5GHZ_ALL,
+   ATH_2GHZ_ALL,
+   ATH_5GHZ_ALL,
}
 };
 
@@ -77,9 +77,9 @@
.n_reg_rules = 4,
.alpha2 =  "99",
.reg_rules = {
-   ATH9K_2GHZ_CH01_11,
-   ATH9K_2GHZ_CH12_13,
-   ATH9K_5GHZ_NO_MIDBAND,
+   ATH_2GHZ_CH01_11,
+   ATH_2GHZ_CH12_13,
+   ATH_5GHZ_NO_MIDBAND,
}
 };
 
@@ -88,8 +88,8 @@
.n_reg_rules = 3,
.alpha2 =  "99",
.reg_rules = {
-   ATH9K_2GHZ_CH01_11,
-   ATH9K_5GHZ_NO_MIDBAND,
+   ATH_2GHZ_CH01_11,
+   ATH_5GHZ_NO_MIDBAND,
}
 };
 
@@ -98,8 +98,8 @@
.n_reg_rules = 3,
.alpha2 =  "99",
.reg_rules = {
-   ATH9K_2GHZ_CH01_11,
-   ATH9K_5GHZ_ALL,
+   ATH_2GHZ_CH01_11,
+   ATH_5GHZ_ALL,
}
 };
 
@@ -108,9 +108,9 @@
.n_reg_rules = 4,
.alpha2 =  "99",
.reg_rules = {
-   ATH9K_2GHZ_CH01_11,
-   ATH9K_2GHZ_CH12_13,
-   ATH9K_5GHZ_ALL,
+   ATH_2GHZ_CH01_11,
+   ATH_2GHZ_CH12_13,
+   ATH_5GHZ_ALL,
}
 };
 
-- 
1.7.0.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 4/5] ath10k: change sw version print format to hex

2019-09-23 Thread Tomislav Požega
Software version within WMI event ready message was displayed
in a not very useful decimal format. Change this info to be shown
in a hexadecimal format instead.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/ath10k/wmi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 2d43adf..59d2d2a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5650,7 +5650,7 @@ int ath10k_wmi_event_ready(struct ath10k *ar, struct 
sk_buff *skb)
}
 
ath10k_dbg(ar, ATH10K_DBG_WMI,
-  "wmi event ready sw_version %u abi_version %u mac_addr %pM 
status %d\n",
+  "wmi event ready sw_version 0x%08x abi_version %u mac_addr 
%pM status %d\n",
   __le32_to_cpu(arg.sw_version),
   __le32_to_cpu(arg.abi_version),
   arg.mac_addr,
-- 
1.7.0.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 5/5] ath10k: pull_svc_rdy code-style fix

2019-09-23 Thread Tomislav Požega
Drop unneeded lines by moving skb data in both main and 10x WMI
pull service ready event operations.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/ath10k/wmi.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 59d2d2a..8ab178c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5345,13 +5345,12 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
 ath10k_wmi_main_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb,
   struct wmi_svc_rdy_ev_arg *arg)
 {
-   struct wmi_service_ready_event *ev;
+   struct wmi_service_ready_event *ev = (void *)skb->data;
size_t i, n;
 
if (skb->len < sizeof(*ev))
return -EPROTO;
 
-   ev = (void *)skb->data;
skb_pull(skb, sizeof(*ev));
arg->min_tx_power = ev->hw_min_tx_power;
arg->max_tx_power = ev->hw_max_tx_power;
@@ -5387,13 +5386,12 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
 ath10k_wmi_10x_op_pull_svc_rdy_ev(struct ath10k *ar, struct sk_buff *skb,
  struct wmi_svc_rdy_ev_arg *arg)
 {
-   struct wmi_10x_service_ready_event *ev;
+   struct wmi_10x_service_ready_event *ev = (void *)skb->data;
int i, n;
 
if (skb->len < sizeof(*ev))
return -EPROTO;
 
-   ev = (void *)skb->data;
skb_pull(skb, sizeof(*ev));
arg->min_tx_power = ev->hw_min_tx_power;
arg->max_tx_power = ev->hw_max_tx_power;
-- 
1.7.0.4


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/5] ath10k: add 2ghz channel arguments to service ready structure

2019-09-23 Thread Tomislav Požega
Add lowest/highest 2ghz channel arguments for use within WMI service
ready structure.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/ath10k/core.h|2 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |2 ++
 drivers/net/wireless/ath/ath10k/wmi.c |6 ++
 drivers/net/wireless/ath/ath10k/wmi.h |2 ++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index c96d1a1..2a0a008 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -967,6 +967,8 @@ struct ath10k {
u32 num_rf_chains;
u32 max_spatial_stream;
/* protected by conf_mutex */
+   u32 low_2ghz_chan;
+   u32 high_2ghz_chan;
u32 low_5ghz_chan;
u32 high_5ghz_chan;
bool ani_enabled;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 363fd0b..bda52ca 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1207,6 +1207,8 @@ static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct 
ath10k *ar,
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
arg->eeprom_rd = reg->eeprom_rd;
+   arg->low_2ghz_chan = reg->low_2ghz_chan;
+   arg->high_2ghz_chan = reg->high_2ghz_chan;
arg->low_5ghz_chan = reg->low_5ghz_chan;
arg->high_5ghz_chan = reg->high_5ghz_chan;
arg->num_mem_reqs = ev->num_mem_reqs;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 1ec609d..3ef6ee3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5362,6 +5362,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
+   arg->low_2ghz_chan = ev->hal_reg_capabilities.low_2ghz_chan;
+   arg->high_2ghz_chan = ev->hal_reg_capabilities.high_2ghz_chan;
arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
arg->num_mem_reqs = ev->num_mem_reqs;
@@ -5400,6 +5402,8 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
arg->eeprom_rd = ev->hal_reg_capabilities.eeprom_rd;
+   arg->low_2ghz_chan = ev->hal_reg_capabilities.low_2ghz_chan;
+   arg->high_2ghz_chan = ev->hal_reg_capabilities.high_2ghz_chan;
arg->low_5ghz_chan = ev->hal_reg_capabilities.low_5ghz_chan;
arg->high_5ghz_chan = ev->hal_reg_capabilities.high_5ghz_chan;
arg->num_mem_reqs = ev->num_mem_reqs;
@@ -5454,6 +5458,8 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
ar->phy_capability = __le32_to_cpu(arg.phy_capab);
ar->num_rf_chains = __le32_to_cpu(arg.num_rf_chains);
ar->hw_eeprom_rd = __le32_to_cpu(arg.eeprom_rd);
+   ar->low_2ghz_chan = __le32_to_cpu(arg.low_2ghz_chan);
+   ar->high_2ghz_chan = __le32_to_cpu(arg.high_2ghz_chan);
ar->low_5ghz_chan = __le32_to_cpu(arg.low_5ghz_chan);
ar->high_5ghz_chan = __le32_to_cpu(arg.high_5ghz_chan);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index bdeebc5..9ccaeb7 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6870,6 +6870,8 @@ struct wmi_svc_rdy_ev_arg {
__le32 num_rf_chains;
__le32 eeprom_rd;
__le32 num_mem_reqs;
+   __le32 low_2ghz_chan;
+   __le32 high_2ghz_chan;
__le32 low_5ghz_chan;
__le32 high_5ghz_chan;
const __le32 *service_map;
-- 
1.7.0.4



[PATCH 3/5] ath10k: print supported MCS rates within service ready event

2019-09-23 Thread Tomislav Požega
Add vht_supp_mcs argument to service ready structure and print
supported MCS rates in WMI service ready debug message.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/ath10k/core.h|1 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |1 +
 drivers/net/wireless/ath/ath10k/wmi.c |6 +-
 drivers/net/wireless/ath/ath10k/wmi.h |1 +
 4 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 2a0a008..153c4a2 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -964,6 +964,7 @@ struct ath10k {
u32 hw_eeprom_rd;
u32 ht_cap_info;
u32 vht_cap_info;
+   u32 vht_supp_mcs;
u32 num_rf_chains;
u32 max_spatial_stream;
/* protected by conf_mutex */
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index bda52ca..2432a74 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -1201,6 +1201,7 @@ static int ath10k_wmi_tlv_op_pull_svc_rdy_ev(struct 
ath10k *ar,
arg->max_tx_power = ev->hw_max_tx_power;
arg->ht_cap = ev->ht_cap_info;
arg->vht_cap = ev->vht_cap_info;
+   arg->vht_supp_mcs = ev->vht_supp_mcs;
arg->sw_ver0 = ev->abi.abi_ver0;
arg->sw_ver1 = ev->abi.abi_ver1;
arg->fw_build = ev->fw_build_vers;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index b7b8072..2d43adf 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5357,6 +5357,7 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->max_tx_power = ev->hw_max_tx_power;
arg->ht_cap = ev->ht_cap_info;
arg->vht_cap = ev->vht_cap_info;
+   arg->vht_supp_mcs = ev->vht_supp_mcs;
arg->sw_ver0 = ev->sw_version;
arg->sw_ver1 = ev->sw_version_1;
arg->phy_capab = ev->phy_capability;
@@ -5398,6 +5399,7 @@ static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, 
u32 req_id,
arg->max_tx_power = ev->hw_max_tx_power;
arg->ht_cap = ev->ht_cap_info;
arg->vht_cap = ev->vht_cap_info;
+   arg->vht_supp_mcs = ev->vht_supp_mcs;
arg->sw_ver0 = ev->sw_version;
arg->phy_capab = ev->phy_capability;
arg->num_rf_chains = ev->num_rf_chains;
@@ -5449,6 +5451,7 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
ar->hw_max_tx_power = __le32_to_cpu(arg.max_tx_power);
ar->ht_cap_info = __le32_to_cpu(arg.ht_cap);
ar->vht_cap_info = __le32_to_cpu(arg.vht_cap);
+   ar->vht_supp_mcs = __le32_to_cpu(arg.vht_supp_mcs);
ar->fw_version_major =
(__le32_to_cpu(arg.sw_ver0) & 0xff00) >> 24;
ar->fw_version_minor = (__le32_to_cpu(arg.sw_ver0) & 0x00ff);
@@ -5563,11 +5566,12 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
 
 skip_mem_alloc:
ath10k_dbg(ar, ATH10K_DBG_WMI,
-  "wmi event service ready min_tx_power 0x%08x max_tx_power 
0x%08x ht_cap 0x%08x vht_cap 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x fw_build 
0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x low_2ghz_chan %d 
high_2ghz_chan %d low_5ghz_chan %d high_5ghz_chan %d num_mem_reqs 0x%08x\n",
+  "wmi event service ready min_tx_power 0x%08x max_tx_power 
0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_mcs 0x%08x sw_ver0 0x%08x sw_ver1 
0x%08x fw_build 0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x 
low_2ghz_chan %d high_2ghz_chan %d low_5ghz_chan %d high_5ghz_chan %d 
num_mem_reqs 0x%08x\n",
   __le32_to_cpu(arg.min_tx_power),
   __le32_to_cpu(arg.max_tx_power),
   __le32_to_cpu(arg.ht_cap),
   __le32_to_cpu(arg.vht_cap),
+  __le32_to_cpu(arg.vht_supp_mcs),
   __le32_to_cpu(arg.sw_ver0),
   __le32_to_cpu(arg.sw_ver1),
   __le32_to_cpu(arg.fw_build),
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 9ccaeb7..d9d53e5 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -6863,6 +6863,7 @@ struct wmi_svc_rdy_ev_arg {
__le32 max_tx_power;
__le32 ht_cap;
__le32 vht_cap;
+   __le32 vht_supp_mcs;
__le32 sw_ver0;
__le32 sw_ver1;
__le32 fw_build;
-- 
1.7.0.4



[PATCH 2/5] ath10k: print service ready returned channel range

2019-09-23 Thread Tomislav Požega
Displays lowest/highest supported channels for both 2ghz and 5ghz
bands as they're fetched within WMI service ready event.
These are shown in a frequency format.

Signed-off-by: Tomislav Požega 
---
 drivers/net/wireless/ath/ath10k/wmi.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 3ef6ee3..b7b8072 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -5563,7 +5563,7 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
 
 skip_mem_alloc:
ath10k_dbg(ar, ATH10K_DBG_WMI,
-  "wmi event service ready min_tx_power 0x%08x max_tx_power 
0x%08x ht_cap 0x%08x vht_cap 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x fw_build 
0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x num_mem_reqs 
0x%08x\n",
+  "wmi event service ready min_tx_power 0x%08x max_tx_power 
0x%08x ht_cap 0x%08x vht_cap 0x%08x sw_ver0 0x%08x sw_ver1 0x%08x fw_build 
0x%08x phy_capab 0x%08x num_rf_chains 0x%08x eeprom_rd 0x%08x low_2ghz_chan %d 
high_2ghz_chan %d low_5ghz_chan %d high_5ghz_chan %d num_mem_reqs 0x%08x\n",
   __le32_to_cpu(arg.min_tx_power),
   __le32_to_cpu(arg.max_tx_power),
   __le32_to_cpu(arg.ht_cap),
@@ -5574,6 +5574,10 @@ static void ath10k_wmi_event_service_ready_work(struct 
work_struct *work)
   __le32_to_cpu(arg.phy_capab),
   __le32_to_cpu(arg.num_rf_chains),
   __le32_to_cpu(arg.eeprom_rd),
+  __le32_to_cpu(arg.low_2ghz_chan),
+  __le32_to_cpu(arg.high_2ghz_chan),
+  __le32_to_cpu(arg.low_5ghz_chan),
+  __le32_to_cpu(arg.high_5ghz_chan),
   __le32_to_cpu(arg.num_mem_reqs));
 
dev_kfree_skb(skb);
-- 
1.7.0.4