Re: [ath9k-devel] [PATCH 3/7] ath10k: remove excessive ifdef checks

2013-04-18 Thread Markowski Bartosz
On 18/04/13 03:52, Sujith Manoharan wrote:
 Bartosz Markowski wrote:
 No need to check CONFIG_PM_SLEEP everywhere, the PCI suspend
 hooks is the only place we need to check it.
 The PM_SLEEP wrappers are required for OpenWrt.

 Sujith
Everywhere? The PCI suspend/resume callbacks are still wrapped up.

-Bartosz
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/7] ath10k: rename struct wmi_struct - struct ath10k_wmi

2013-04-18 Thread Markowski Bartosz
On 18/04/13 07:23, Michal Kazior wrote:
 On 17/04/13 19:45, Bartosz Markowski wrote:
 Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
 ---
drivers/net/wireless/ath/ath10k/wmi.c |   28 ++--
1 file changed, 14 insertions(+), 14 deletions(-)
 This is something I've actually done in one of my patches I posted
 yesterday morning.

Sorry Michal, I had to miss it.

Please drop this patch then.

-Bartosz
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 3/7] ath10k: remove excessive ifdef checks

2013-04-18 Thread Sujith Manoharan
Markowski Bartosz wrote:
 Everywhere? The PCI suspend/resume callbacks are still wrapped up.

Sorry, I didn't even look at the patch. ;)

Sujith
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/3] ath10k: kill WARN_ON in ce.c

2013-04-18 Thread Janusz Dziedzic
Kill WARN_ON in ce.c, use ath10k_warn() instead.

Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/ce.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 3fd4fce..27b27de 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -82,7 +82,9 @@ static int ath10k_ce_send_nolock(struct ce_state *ce_state,
u32 desc_flags = 0;
int ret = 0;
 
-   WARN_ON(nbytes  ce_state-src_sz_max);
+   if (nbytes  ce_state-src_sz_max)
+   ath10k_warn(%s: send more we can (nbytes: %d, max: %d)\n,
+   __func__, nbytes, ce_state-src_sz_max);
 
TARGET_ACCESS_BEGIN(ar);
 
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 3/3] ath10k: kill MAX_SSID_LEN define

2013-04-18 Thread Janusz Dziedzic
Use IEEE80211_MAX_SSID_LEN instead.

Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 193ac31..402cddb 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -34,7 +34,6 @@
 #define SM(_v, _f) (((_v)  _f##_LSB)  _f##_MASK)
 #define WO(_f)  ((_f##_OFFSET)  2)
 
-#define MAX_SSID_LEN 32
 #define ATH10K_SCAN_ID 0
 #define WMI_READY_TIMEOUT (5 * HZ)
 #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ)
@@ -216,7 +215,7 @@ struct ath10k_vif {
u8 tim_bitmap[16];
u8 tim_len;
u32 ssid_len;
-   u8 ssid[MAX_SSID_LEN];
+   u8 ssid[IEEE80211_MAX_SSID_LEN];
bool hidden_ssid;
/* P2P_IE with NoA attribute for P2P_GO case */
u32 noa_len;
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32 function

2013-04-18 Thread Janusz Dziedzic
Add ath10k_bmi_read32/ath10k_bmi_write32 functions
and use them in core layer when read32/write32.

Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.h  |   10 ++
 drivers/net/wireless/ath/ath10k/core.c |   24 
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index e2bd70b..2035d5d 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -191,6 +191,16 @@ int ath10k_bmi_read_memory(struct ath10k *ar, u32 address,
   void *buffer, u32 length);
 int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
const void *buffer, u32 length);
+static inline int ath10k_bmi_read32(struct ath10k *ar, u32 address,
+   void *buffer)
+{
+   return ath10k_bmi_read_memory(ar, address, buffer, sizeof(u32));
+}
+static inline int ath10k_bmi_write32(struct ath10k *ar, u32 address,
+void *buffer)
+{
+   return ath10k_bmi_write_memory(ar, address, buffer, sizeof(u32));
+}
 int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param);
 int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address);
 int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 213c851..0934a29 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -150,7 +150,7 @@ static int ath10k_init_configure_target(struct ath10k *ar)
param_target = __cpu_to_le32(HTC_PROTOCOL_VERSION);
host_addr = host_interest_item_address(ar-target_type,
   HI_ITEM(hi_app_host_interest));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_write32(ar, host_addr, (u8 *)param_target);
if (ret) {
ath10k_err(settings HTC version failed\n);
return ret;
@@ -159,7 +159,7 @@ static int ath10k_init_configure_target(struct ath10k *ar)
/* set the firmware mode to STA/IBSS/AP */
host_addr = host_interest_item_address(ar-target_type,
   HI_ITEM(hi_option_flag));
-   ret = ath10k_bmi_read_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_read32(ar, host_addr, (u8 *)param_target);
param_host = __le32_to_cpu(param_target);
if (ret) {
ath10k_err(setting firmware mode (1/2) failed\n);
@@ -182,7 +182,7 @@ static int ath10k_init_configure_target(struct ath10k *ar)
param_target = __cpu_to_le32(param_host);
host_addr = host_interest_item_address(ar-target_type,
   HI_ITEM(hi_option_flag));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_write32(ar, host_addr, (u8 *)param_target);
if (ret) {
ath10k_err(setting firmware mode (2/2) failed\n);
return ret;
@@ -192,7 +192,7 @@ static int ath10k_init_configure_target(struct ath10k *ar)
/* We do all byte-swapping on the host */
host_addr = host_interest_item_address(ar-target_type,
   HI_ITEM(hi_be));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_write32(ar, host_addr, (u8 *)param_target);
if (ret) {
ath10k_err(setting host CPU BE mode failed\n);
return ret;
@@ -202,7 +202,7 @@ static int ath10k_init_configure_target(struct ath10k *ar)
param_target = __cpu_to_le32(0);
host_addr = host_interest_item_address(ar-target_type,
   HI_ITEM(hi_fw_swap));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_write32(ar, host_addr, (u8 *)param_target);
 
if (ret) {
ath10k_err(setting FW data/desc swap flags failed\n);
@@ -296,7 +296,7 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
/* Determine where in Target RAM to write Board Data */
host_addr = host_interest_item_address(ar-target_type,
   
HI_ITEM(hi_board_ext_data));
-   ath10k_bmi_read_memory(ar, host_addr, (u8 *)param_target, 4);
+   ath10k_bmi_read32(ar, host_addr, (u8 *)param_target);
board_ext_address = __le32_to_cpu(param_target);
 
ath10k_dbg(ATH10K_DBG_BOOT,
@@ -327,7 +327,7 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
param_target = __cpu_to_le32((board_ext_data_size  
16) | 1);

Re: [ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32 function

2013-04-18 Thread Michal Kazior
On 18/04/13 10:08, Janusz Dziedzic wrote:
 Add ath10k_bmi_read32/ath10k_bmi_write32 functions
 and use them in core layer when read32/write32.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
 ---
   drivers/net/wireless/ath/ath10k/bmi.h  |   10 ++
   drivers/net/wireless/ath/ath10k/core.c |   24 
   2 files changed, 22 insertions(+), 12 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
 b/drivers/net/wireless/ath/ath10k/bmi.h
 index e2bd70b..2035d5d 100644
 --- a/drivers/net/wireless/ath/ath10k/bmi.h
 +++ b/drivers/net/wireless/ath/ath10k/bmi.h
 @@ -191,6 +191,16 @@ int ath10k_bmi_read_memory(struct ath10k *ar, u32 
 address,
  void *buffer, u32 length);
   int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
   const void *buffer, u32 length);
 +static inline int ath10k_bmi_read32(struct ath10k *ar, u32 address,
 + void *buffer)
 +{
 + return ath10k_bmi_read_memory(ar, address, buffer, sizeof(u32));
 +}
 +static inline int ath10k_bmi_write32(struct ath10k *ar, u32 address,
 +  void *buffer)
 +{
 + return ath10k_bmi_write_memory(ar, address, buffer, sizeof(u32));
 +}

I think these functions should do endianess converions so it is not 
necessary at call sites anymore.

Also the buffer could be a u32* instead of a void* implicitly stating 
what the functions are meant to do.


-- Pozdrawiam / Best regards, Michal Kazior.
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups

2013-04-18 Thread Michal Kazior
Michal Kazior (7):
  ath10k: fix code style
  ath10k: use if() instead of ternary operator
  ath10k: remove unnecessary void cast
  ath10k: kill WARN_ONs in htt_rx.c
  ath10k: use macros instead of if() for value range limiting
  ath10k: use ath10k_warn() instead of WARN()
  ath10k: remove old function prototype

 drivers/net/wireless/ath/ath10k/bmi.c|   18 +-
 drivers/net/wireless/ath/ath10k/core.h   |1 -
 drivers/net/wireless/ath/ath10k/htc.c|9 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |   21 ++---
 drivers/net/wireless/ath/ath10k/mac.c|   10 --
 drivers/net/wireless/ath/ath10k/wmi.c|3 ++-
 6 files changed, 34 insertions(+), 28 deletions(-)

-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 1/7] ath10k: fix code style

2013-04-18 Thread Michal Kazior
This fixes funky error handling.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.c 
b/drivers/net/wireless/ath/ath10k/bmi.c
index b0149b7..0b3b509 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -282,14 +282,14 @@ int ath10k_bmi_fast_download(struct ath10k *ar,
if (unaligned_bytes)
ret = ath10k_bmi_lz_data(ar, last_work, 4);
 
-   if (ret == 0) {
-   /*
-* Close compressed stream and open a new (fake) one.
-* This serves mainly to flush Target caches.
-*/
-   ret = ath10k_bmi_lz_stream_start(ar, 0x00);
-   if (ret)
-   return ret;
-   }
+   if (ret != 0)
+   return ret;
+
+   /*
+* Close compressed stream and open a new (fake) one.
+* This serves mainly to flush Target caches.
+*/
+   ret = ath10k_bmi_lz_stream_start(ar, 0x00);
+
return ret;
 }
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/7] ath10k: use if() instead of ternary operator

2013-04-18 Thread Michal Kazior
Improves readability.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 89b9dab..854d728 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -149,9 +149,10 @@ static int ath10k_htc_prepare_tx_skb(struct htc_endpoint 
*ep,
 
spin_lock_bh(ep-target-htc_tx_lock);
hdr-seq_no = ep-seq_no++;
-   hdr-flags |= ath10k_htc_ep_need_credit_update(ep)
-   ? HTC_FLAG_NEED_CREDIT_UPDATE
-   : 0;
+
+   if (ath10k_htc_ep_need_credit_update(ep))
+   hdr-flags |= HTC_FLAG_NEED_CREDIT_UPDATE;
+
spin_unlock_bh(ep-target-htc_tx_lock);
 
return 0;
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 4/7] ath10k: kill WARN_ONs in htt_rx.c

2013-04-18 Thread Michal Kazior
We should not use WARN_ON in this place as it may
spam the kernel logs easily. Instead use simple
prints.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |   21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6fe273d..7c90a2c 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -219,7 +219,7 @@ static inline struct sk_buff 
*ath10k_htt_rx_netbuf_pop(struct htt_struct *htt)
spin_lock_bh(htt-rx_ring.lock);
 
if (ath10k_htt_rx_ring_elems(htt) == 0)
-   WARN_ON(1);
+   ath10k_warn(htt rx ring is empty!\n);
 
idx = htt-rx_ring.sw_rd_idx.msdu_payld;
msdu = htt-rx_ring.buf.netbufs_ring[idx];
@@ -243,7 +243,7 @@ static int ath10k_htt_rx_amsdu_pop(struct htt_struct *htt,
struct htt_rx_desc *rx_desc;
 
if (ath10k_htt_rx_ring_elems(htt) == 0)
-   WARN_ON(1);
+   ath10k_warn(htt rx ring is empty!\n);
 
if (htt-rx_confused) {
ath10k_warn(%s: htt failure: cannot rx\n, __func__);
@@ -277,11 +277,12 @@ static int ath10k_htt_rx_amsdu_pop(struct htt_struct *htt,
 * To prevent the case that we handle a stale Rx descriptor,
 * just assert for now until we have a way to recover.
 */
-   if (WARN_ON(!(__le32_to_cpu(rx_desc-attention.flags)
-RX_ATTENTION_FLAGS_MSDU_DONE))) {
+   if (!(__le32_to_cpu(rx_desc-attention.flags)
+RX_ATTENTION_FLAGS_MSDU_DONE)) {
if (*head_msdu == msdu)
*head_msdu = NULL;
dev_kfree_skb_any(msdu);
+   ath10k_err(htt rx stopped. cannot recover\n);
htt-rx_confused = true;
break;
}
@@ -405,7 +406,11 @@ int ath10k_htt_rx_attach(struct htt_struct *htt)
struct timer_list *timer = htt-rx_ring.refill_retry_timer;
 
htt-rx_ring.size = ath10k_htt_rx_ring_size(htt);
-   WARN_ON(!is_power_of_2(htt-rx_ring.size));
+   if (!is_power_of_2(htt-rx_ring.size)) {
+   ath10k_warn(htt rx ring size is not power of 2\n);
+   return -EINVAL;
+   }
+
htt-rx_ring.size_mask = htt-rx_ring.size - 1;
 
/*
@@ -928,7 +933,8 @@ more:
/* remove crypto trailer; we use rx desc for mic failure */
trim += ath10k_htt_rx_crypto_tail_len(info.encrypt_type);
 
-   if (WARN_ON(trim  info.skb-len)) {
+   if (trim  info.skb-len) {
+   ath10k_warn(htt rx fragment: trailer longer than the frame 
itself? drop\n);
dev_kfree_skb_any(info.skb);
goto end;
}
@@ -953,7 +959,8 @@ void ath10k_htt_t2h_msg_handler(void *context, struct 
sk_buff *skb)
struct htt_resp *resp = (struct htt_resp *)skb-data;
 
/* confirm alignment */
-   WARN_ON_ONCEunsigned long)skb-data)  0x3) != 0);
+   if unsigned long)skb-data)  0x3) != 0)
+   ath10k_warn(unaligned htt message, expect trouble\n);
 
ath10k_dbg(ATH10K_DBG_HTT, HTT RX, msg_type: 0x%0X\n, 
resp-hdr.msg_type);
switch (resp-hdr.msg_type) {
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 5/7] ath10k: use macros instead of if() for value range limiting

2013-04-18 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 1c9c048..3499858 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2296,8 +2296,7 @@ static void ath10k_set_rts_iter(void *data, u8 *mac, 
struct ieee80211_vif *vif)
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
u32 rts = ar_iter-ar-hw-wiphy-rts_threshold;
 
-   if (rts  ATH10K_RTS_MAX)
-   rts = ATH10K_RTS_MAX;
+   rts = min_t(u32, rts, ATH10K_RTS_MAX);
 
ar_iter-ret = ath10k_wmi_vdev_set_param(ar_iter-ar, arvif-vdev_id,
 WMI_VDEV_PARAM_RTS_THRESHOLD,
@@ -2333,10 +2332,9 @@ static void ath10k_set_frag_iter(void *data, u8 *mac, 
struct ieee80211_vif *vif)
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
u32 frag = ar_iter-ar-hw-wiphy-frag_threshold;
 
-   if (frag  ATH10K_FRAGMT_THRESHOLD_MAX)
-   frag = ATH10K_FRAGMT_THRESHOLD_MAX;
-   else if (frag  ATH10K_FRAGMT_THRESHOLD_MIN)
-   frag = ATH10K_FRAGMT_THRESHOLD_MIN;
+   frag = clamp_t(u32, frag,
+  ATH10K_FRAGMT_THRESHOLD_MIN,
+  ATH10K_FRAGMT_THRESHOLD_MAX);
 
ar_iter-ret = ath10k_wmi_vdev_set_param(ar_iter-ar, arvif-vdev_id,
 
WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 6/7] ath10k: use ath10k_warn() instead of WARN()

2013-04-18 Thread Michal Kazior
Avoid spamming kernel logs.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/wmi.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ae30be3..d19d2cc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -36,7 +36,8 @@ void ath10k_wmi_flush_tx(struct ath10k *ar)
if (ret == 0)
ret = -ETIMEDOUT;
 
-   WARN(ret  0, %s failed %d\n, __func__, ret);
+   if (ret  0)
+   ath10k_warn(wmi flush failed (%d)\n, ret);
 }
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32 function

2013-04-18 Thread Janusz.Dziedzic
-Original Message-
From: ath9k-devel-boun...@lists.ath9k.org [mailto:ath9k-devel-
boun...@lists.ath9k.org] On Behalf Of Michal Kazior
Sent: 18 kwietnia 2013 10:17
To: ath9k-devel@lists.ath9k.org
Subject: Re: [ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32
function

On 18/04/13 10:08, Janusz Dziedzic wrote:
 Add ath10k_bmi_read32/ath10k_bmi_write32 functions and use them in
 core layer when read32/write32.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
 ---
   drivers/net/wireless/ath/ath10k/bmi.h  |   10 ++
   drivers/net/wireless/ath/ath10k/core.c |   24 
   2 files changed, 22 insertions(+), 12 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/bmi.h
 b/drivers/net/wireless/ath/ath10k/bmi.h
 index e2bd70b..2035d5d 100644
 --- a/drivers/net/wireless/ath/ath10k/bmi.h
 +++ b/drivers/net/wireless/ath/ath10k/bmi.h
 @@ -191,6 +191,16 @@ int ath10k_bmi_read_memory(struct ath10k *ar,
u32 address,
 void *buffer, u32 length);
   int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
  const void *buffer, u32 length);
 +static inline int ath10k_bmi_read32(struct ath10k *ar, u32 address,
 +void *buffer)
 +{
 +return ath10k_bmi_read_memory(ar, address, buffer, sizeof(u32)); }
 +static inline int ath10k_bmi_write32(struct ath10k *ar, u32 address,
 + void *buffer)
 +{
 +return ath10k_bmi_write_memory(ar, address, buffer, sizeof(u32)); }

I think these functions should do endianess converions so it is not necessary
at call sites anymore.

Also the buffer could be a u32* instead of a void* implicitly stating what the
functions are meant to do.

OK, I will also change parameters list here and will move 
host_interest_item_address() to bmi layer.
So, seems more work required here.

BR
Janusz

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath10k: cleanup ath10k_bmi_fast_download()

2013-04-18 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.c |   17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.c 
b/drivers/net/wireless/ath/ath10k/bmi.c
index 0b3b509..85bf366 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -261,26 +261,25 @@ int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 
address)
 int ath10k_bmi_fast_download(struct ath10k *ar,
 u32 address, const void *buffer, u32 length)
 {
+   u8 trailer[4] = {};
+   u32 head_len = rounddown(length, 4);
+   u32 trailer_len = length - head_len;
int ret;
-   u32 last_work = 0;
-   u32 last_work_offset = length  ~0x3;
-   u32 unaligned_bytes = length  0x3;
 
ret = ath10k_bmi_lz_stream_start(ar, address);
if (ret)
return ret;
 
/* copy the last word into a zero padded buffer */
-   if (unaligned_bytes)
-   memcpy(last_work, buffer + last_work_offset, unaligned_bytes);
-
-   ret = ath10k_bmi_lz_data(ar, buffer, last_work_offset);
+   if (trailer_len  0)
+   memcpy(trailer, buffer + head_len, trailer_len);
 
+   ret = ath10k_bmi_lz_data(ar, buffer, head_len);
if (ret)
return ret;
 
-   if (unaligned_bytes)
-   ret = ath10k_bmi_lz_data(ar, last_work, 4);
+   if (trailer_len  0)
+   ret = ath10k_bmi_lz_data(ar, trailer, 4);
 
if (ret != 0)
return ret;
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 0/2] ath10k: locking cleanup

2013-04-18 Thread Michal Kazior
This patchset kills vdev_mtx and scan.lock and
uses conf_mutex and data_lock respectively.

This simplifies and unifies locking in ath10k.

Michal Kazior (2):
  ath10k: kill vdev_mtx and use conf_mutex
  ath10k: refactor scan locking

 drivers/net/wireless/ath/ath10k/core.c |2 -
 drivers/net/wireless/ath/ath10k/core.h |2 -
 drivers/net/wireless/ath/ath10k/mac.c  |  111 +---
 drivers/net/wireless/ath/ath10k/wmi.c  |   10 +--
 4 files changed, 50 insertions(+), 75 deletions(-)

-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/2] ath10k: don't defer mgmt_rx frames

2013-04-18 Thread Kalle Valo
Janusz Dziedzic janusz.dzied...@tieto.com writes:

 Don't defer mgmt_rx frames. Pass them
 immediately to mac80211 layer. Also
 this will prevent mixing context we will
 call ieee80211_rx()/ieee80211_tx_status().
 Now this will be called from tasklet.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com

Thanks, both applied. Patch 1 had conflicts, I also did a minor change
to that patch. Please check.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 It's not a good to have too many mutexes. The
 patch simplifies locking of debufs to use
 conf_mutex.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

[...]

 @@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)
   return -ENOMEM;
  
   init_completion(ar-debug.event_stats_compl);
 - mutex_init(ar-debug.debug_mtx);
 + mutex_init(ar-conf_mutex);

Can this be right? We already initialise conf_mutex in core.c.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex

2013-04-18 Thread Michal Kazior
On 18/04/13 11:44, Kalle Valo wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 It's not a good to have too many mutexes. The
 patch simplifies locking of debufs to use
 conf_mutex.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

 [...]

 @@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)
  return -ENOMEM;

  init_completion(ar-debug.event_stats_compl);
 -mutex_init(ar-debug.debug_mtx);
 +mutex_init(ar-conf_mutex);

 Can this be right? We already initialise conf_mutex in core.c.

Good catch, thanks! The mutex_init() is already initialized elsewhere. 
No need to re-initialize it here.


-- Pozdrawiam / Best regards, Michal Kazior.
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 0/5] ath10k: cleanups

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Michal Kazior (5):
   ath10k: replace debug_mtx with conf_mutex
   ath10k: change wmi structure access
   ath10k: fix coding style
   ath10k: use ath10k_warn() instead of ath10k_info()
   ath10k: fix function prototype argument name

When you resend can you also rebase the patches, please? Quite a lot of
conflicts in wmi.c

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath10k: improve FW QoS workaround

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 This fixes two things:

  * recently broken AP mode,
  * a scenario when mac80211 requests us to send a
non-QoS Data.

 The latter is done by upgrading non-QoS Data frame
 to QoS Data (we modify the frame_control). This
 is the only way we can work around this FW issue
 for now.

 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

Thanks, applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath10k: fix double-prefixed functions

2013-04-18 Thread Kalle Valo
Bartosz Markowski bartosz.markow...@tieto.com writes:

 A few functions have been double-prefixed 'ath10k_ath10k_'.

 Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com

Ouch, apparently I was sloppy when reviewing patches :)

Thanks, applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 0/3] ath10k: pci memleak fix

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 By looking at the code I spotted a possible
 memleak. I haven't observed it yet but it seems it
 could happen. This patchset addresses it.

 Patch #1 just removes code that is effectively
 a no-op. Patch #2 would touch the dead code.

 Michal Kazior (3):
   ath10k: drop dead code
   ath10k: make htc cancellation a generic thing
   ath10k: reorder pci shutdown sequences

Skipping this as there's v2.

(This is just for my own bookkeping :)

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 0/5] ath10k: cleanups

2013-04-18 Thread Michal Kazior
Rebased on top of latest master branch
 (https://github.com/kvalo/ath10k)

Patch #1 updated.


Michal Kazior (5):
  ath10k: replace debug_mtx with conf_mutex
  ath10k: change wmi structure access
  ath10k: fix coding style
  ath10k: use ath10k_warn() instead of ath10k_info()
  ath10k: fix function prototype argument name

 drivers/net/wireless/ath/ath10k/core.h  |   19 --
 drivers/net/wireless/ath/ath10k/debug.c |9 ++-
 drivers/net/wireless/ath/ath10k/debug.h |4 +-
 drivers/net/wireless/ath/ath10k/htc.h   |5 +-
 drivers/net/wireless/ath/ath10k/mac.c   |   10 +--
 drivers/net/wireless/ath/ath10k/txrx.c  |   16 ++---
 drivers/net/wireless/ath/ath10k/wmi.c   |  105 +++
 7 files changed, 75 insertions(+), 93 deletions(-)

-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex

2013-04-18 Thread Michal Kazior
It's not a good to have too many mutexes. The
patch simplifies locking of debufs to use
conf_mutex.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
v2: removed unnecessary mutex_init()

 drivers/net/wireless/ath/ath10k/core.h  |1 -
 drivers/net/wireless/ath/ath10k/debug.c |9 -
 drivers/net/wireless/ath/ath10k/debug.h |4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 193ac31..4577987 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -240,7 +240,6 @@ struct ath10k_debug {
u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
 
struct completion event_stats_compl;
-   struct mutex debug_mtx;
 };
 
 struct ath10k {
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 8f5b506..7e6b7034 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -113,7 +113,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
if (!buf)
return -ENOMEM;
 
-   mutex_lock(ar-debug.debug_mtx);
+   mutex_lock(ar-conf_mutex);
 
if (len  buf_len)
len = buf_len;
@@ -134,7 +134,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 
ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-   mutex_unlock(ar-debug.debug_mtx);
+   mutex_unlock(ar-conf_mutex);
 
kfree(buf);
return ret_cnt;
@@ -176,7 +176,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char 
__user *user_buf,
return -ETIMEDOUT;
}
 
-   mutex_lock(ar-debug.debug_mtx);
+   mutex_lock(ar-conf_mutex);
 
len += scnprintf(buf + len, buf_len - len, \n);
len += scnprintf(buf + len, buf_len - len, %30s\n,
@@ -306,7 +306,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char 
__user *user_buf,
 
ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-   mutex_unlock(ar-debug.debug_mtx);
+   mutex_unlock(ar-conf_mutex);
 
kfree(buf);
return ret_cnt;
@@ -328,7 +328,6 @@ int ath10k_debug_create(struct ath10k *ar)
return -ENOMEM;
 
init_completion(ar-debug.event_stats_compl);
-   mutex_init(ar-debug.debug_mtx);
 
debugfs_create_file(fw_stats, S_IRUSR, ar-debug.debugfs_phy, ar,
fops_fw_stats);
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index dc4847b..b57a258 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -61,7 +61,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
int num_pdev_stats, num_vdev_stats, num_peer_stats;
int i;
 
-   mutex_lock(ar-debug.debug_mtx);
+   mutex_lock(ar-conf_mutex);
 
fw_stats = ar-debug.target_stats;
 
@@ -149,7 +149,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
}
}
 
-   mutex_unlock(ar-debug.debug_mtx);
+   mutex_unlock(ar-conf_mutex);
complete(ar-debug.event_stats_compl);
 
 }
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 3/5] ath10k: fix coding style

2013-04-18 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c  |8 +---
 drivers/net/wireless/ath/ath10k/txrx.c |   16 +---
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 94b5334..c6802b1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1235,10 +1235,12 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff 
*skb)
ret = ath10k_wmi_vdev_set_param(ar, arvif-vdev_id,
WMI_VDEV_PARAM_DEF_KEYID,
key-keyidx);
-   if (!ret)
-   arvif-def_wep_key_index = key-keyidx;
-   else
+   if (ret) {
ath10k_warn(could not update wep keyidx (%d)\n, ret);
+   return;
+   }
+
+   arvif-def_wep_key_index = key-keyidx;
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 205a9b8..6392f11 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -31,14 +31,16 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, 
struct sk_buff *skb)
 * offchan_tx_completed for a different skb. Prevent this by using
 * offchan_tx_skb. */
spin_lock_bh(ar-data_lock);
-   if (ar-offchan_tx_skb == skb) {
-   complete(ar-offchan_tx_completed);
-   ar-offchan_tx_skb = NULL; /* just for sanity */
-
-   ath10k_dbg(ATH10K_DBG_HTT, completed offchannel skb %p\n, 
skb);
+   if (ar-offchan_tx_skb != skb) {
+   ath10k_warn(completed old offchannel frame\n);
+   goto out;
}
-   else
-   ath10k_warn(completed late offchannel skb %p\n, skb);
+
+   complete(ar-offchan_tx_completed);
+   ar-offchan_tx_skb = NULL; /* just for sanity */
+
+   ath10k_dbg(ATH10K_DBG_HTT, completed offchannel skb %p\n, skb);
+out:
spin_unlock_bh(ar-data_lock);
 }
 
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 2/5] ath10k: change wmi structure access

2013-04-18 Thread Michal Kazior
WMI structure shouldn't be a magic void pointer.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h |   18 +-
 drivers/net/wireless/ath/ath10k/htc.h  |3 +-
 drivers/net/wireless/ath/ath10k/wmi.c  |  105 +++-
 3 files changed, 53 insertions(+), 73 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 4577987..4781310 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -23,6 +23,7 @@
 #include linux/types.h
 #include linux/pci.h
 
+#include htc.h
 #include hw.h
 #include targaddrs.h
 #include regtable.h
@@ -114,6 +115,19 @@ struct ath10k_bmi {
bool done_sent;
 };
 
+struct ath10k_wmi {
+   struct ath10k *ar;
+
+   enum htc_endpoint_id eid;
+   struct completion service_ready;
+   struct completion unified_ready;
+   atomic_t pending_tx_count;
+   wait_queue_head_t wq;
+
+   struct sk_buff_head wmi_event_list;
+   struct work_struct wmi_event_work;
+};
+
 struct ath10k_peer_stat {
u8 peer_macaddr[ETH_ALEN];
u32 peer_rssi;
@@ -271,9 +285,7 @@ struct ath10k {
const struct ath10k_hif_ops *ops;
} hif;
 
-   struct {
-   void *wmi;
-   } modules;
+   struct ath10k_wmi wmi;
 
 #if defined(CONFIG_PM_SLEEP)
wait_queue_head_t event_queue;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h 
b/drivers/net/wireless/ath/ath10k/htc.h
index 9bf3997..4ad8ca2 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -21,8 +21,9 @@
 #include linux/kernel.h
 #include linux/list.h
 #include linux/bug.h
-#include core.h
+#include linux/skbuff.h
 
+struct ath10k;
 
 #define MAKE_SERVICE_ID(group, index) \
(int)(((int)(group)  8) | (int)(index))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 4b44957..4fe22b2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -23,28 +23,14 @@
 #include wmi.h
 #include mac.h
 
-struct wmi_struct {
-   struct ath10k *ar;
-
-   enum htc_endpoint_id eid;
-   struct completion service_ready;
-   struct completion unified_ready;
-   atomic_t pending_tx_count;
-   wait_queue_head_t wq;
-
-   struct sk_buff_head wmi_event_list;
-   struct work_struct wmi_event_work;
-};
-
 void ath10k_wmi_flush_tx(struct ath10k *ar)
 {
-   struct wmi_struct *wmi = ar-modules.wmi;
int ret;
 
-   ret = wait_event_timeout(wmi-wq,
-atomic_read(wmi-pending_tx_count) == 0,
+   ret = wait_event_timeout(ar-wmi.wq,
+atomic_read(ar-wmi.pending_tx_count) == 0,
 5*HZ);
-   if (atomic_read(wmi-pending_tx_count) == 0)
+   if (atomic_read(ar-wmi.pending_tx_count) == 0)
return;
 
if (ret == 0)
@@ -55,18 +41,16 @@ void ath10k_wmi_flush_tx(struct ath10k *ar)
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
-   struct wmi_struct *wmi = ar-modules.wmi;
int ret;
-   ret = wait_for_completion_timeout(wmi-service_ready,
+   ret = wait_for_completion_timeout(ar-wmi.service_ready,
  WMI_SERVICE_READY_TIMEOUT_HZ);
return ret;
 }
 
 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
 {
-   struct wmi_struct *wmi = ar-modules.wmi;
int ret;
-   ret = wait_for_completion_timeout(wmi-unified_ready,
+   ret = wait_for_completion_timeout(ar-wmi.unified_ready,
  WMI_UNIFIED_READY_TIMEOUT_HZ);
return ret;
 }
@@ -92,12 +76,12 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)
 static void ath10k_wmi_htc_tx_complete(struct sk_buff *skb)
 {
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-   struct wmi_struct *wmi = skb_cb-htc.priv;
+   struct ath10k *ar = skb_cb-htc.priv;
 
dev_kfree_skb(skb);
 
-   if (atomic_sub_return(1, wmi-pending_tx_count) == 0)
-   wake_up(wmi-wq);
+   if (atomic_sub_return(1, ar-wmi.pending_tx_count) == 0)
+   wake_up(ar-wmi.wq);
 }
 
 /* WMI command API */
@@ -105,7 +89,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct 
sk_buff *skb,
   enum wmi_cmd_id cmd_id)
 {
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-   struct wmi_struct *wmi = ar-modules.wmi;
struct wmi_cmd_hdr *cmd_hdr;
int status;
 
@@ -117,25 +100,25 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct 
sk_buff *skb,
cmd_hdr = (struct wmi_cmd_hdr *)skb-data;
cmd_hdr-cmd_id = __cpu_to_le16(cmd_id);
 
-   if (atomic_add_return(1, wmi-pending_tx_count) 
+   if (atomic_add_return(1, ar-wmi.pending_tx_count) 

[ath9k-devel] [PATCH v2 4/5] ath10k: use ath10k_warn() instead of ath10k_info()

2013-04-18 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index c6802b1..e5ef1d2 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1330,7 +1330,7 @@ void ath10k_ath10k_offchan_tx_work(struct work_struct 
*work)
spin_unlock_bh(ar-data_lock);
 
if (peer)
-   ath10k_info(peer %pM on vdev %d already present\n,
+   ath10k_dbg(ATH10K_DBG_MAC, peer %pM on vdev %d already 
present\n,
peer_addr, vdev_id);
 
if (!peer) {
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 5/5] ath10k: fix function prototype argument name

2013-04-18 Thread Michal Kazior
This argument is used to specify how much data we
want to pack up into a skbuff, no just headroom.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.h 
b/drivers/net/wireless/ath/ath10k/htc.h
index 4ad8ca2..2c231db 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -112,6 +112,6 @@ int ath10k_htc_send(struct htc_target *target, enum 
htc_endpoint_id eid,
struct sk_buff *packet);
 void ath10k_htc_stop(struct htc_target *target);
 void ath10k_htc_destroy(struct htc_target *target);
-struct sk_buff *ath10k_htc_alloc_skb(int extra_headroom);
+struct sk_buff *ath10k_htc_alloc_skb(int size);
 
 #endif
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2 0/5] ath10k: pci memleak fix

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 The v2 fixes patch 2, and introduces new patches 4
 and 5. There were two possible memleaks.

 Michal Kazior (5):
   ath10k: drop dead code
   ath10k: make HTC cancellation a generic thing
   ath10k: fix HTC tx flushing
   ath10k: reorder pci shutdown sequences
   ath10k: fix memory leak during PCI teardown

Thanks, all five applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] WiFi Failure with AR9280

2013-04-18 Thread Pannirselvam Kanagaratnam

  
  
Hello,

Upon analyzing the Protocol Analyzer I shared my finding with the
CPU chipset support. They said it is an errata on their CPU. It
reads as follows:

**

PCI Express Packets may be transmitted with excess data on x1 link
Description: An internal error in the PCI Express controller may
cause 8 bytes of packet header or data
payload to be duplicated on transmit. Depending on the location of
the duplicate bytes, this
may cause a malformed packet error or CRC error detected in the link
partner.

Impact: A PCI Express link partner may see excess correctable errors
or malformed packets in x1
links.

Note that any PCI Express specification-compliant recipient at the
ultimate end of the
transaction may only recognize the erroneous packet as a Bad TLP and
flag the error as
correctable due to the LCRC error. It should respond with a NAK and
then wait for the device
to re-try the packet. The ultimate recipient should not recognize
the erroneous packet as a
Malformed TLP, since before reaching the transaction layer the Bad
TLP should have been
discarded by the ultimate recipients link layer.

**

I have noticed that although the error occurs, the AR9287, AR9380
and AR9382 are able to handle this. However, the AR9280 link fails.
Is there something that can be done on the driver level to manage
this? 

You may take a look at the analyzer logs at:


http://www.yousendit.com/download/UVJqaUNITWNtUUZBSXNUQw

You will need the Analyzer software to read it:
ftp://ftp.agilent.com/cos/outbound/PCIe_Gen2/Analyzer/6.13%20for%20Gen1%20anlyzer/

The record in question is # 3957101. It is Completion with Data for
the Memory Read request by the EP at record #3957098. This packet
was NAK by the EP and so there was a replay of this packet. The
reason for NAK was that some extra bytes were inserted and
transmitted by RC.

Regards,

Pannir

On 15/4/2013 10:31 AM, Adrian Chadd
  wrote:


  well, those radm errors and local bus errors are actually pcie errors.

So look at PCIe errors with your bus analyser. :)



adrian

On 14 April 2013 19:07, Pannirselvam Kanagaratnam pan...@xsmail.com wrote:

  
I have now tried 4 different chipsets on my board (AR9280, AR9287,
AR9380 and AR9382). Only AR9280 is failing. Debugfs interrupt stats is
as follows when using the AR9280:

SYNC_CAUSE stats:
  Sync-All: 48
   RTC-IRQ:  0
   MAC-IRQ:  0
EEPROM-Illegal-Access:  0
   APB-Timeout:  0
 PCI-Mode-Conflict:  0
   HOST1-Fatal:  0
HOST1-Perr:  0
TRCV-FIFO-Perr:  0
   RADM-CPL-EP:  0
   RADM-CPL-DLLP-Abort: 11
RADM-CPL-TLP-Abort:  0
 RADM-CPL-ECRC-Err:  0
  RADM-CPL-Timeout:  2
 Local-Bus-Timeout: 35
 PM-Access:  0
 MAC-Awake:  0
MAC-Asleep:  0
  MAC-Sleep-Access:  0

I have managed to get access to an Agilent Protocol Exerciser  Analyzer
(E2960A). Any tips on what I should be zooming into?

Regards,

Pannir

On 27/3/2013 11:27 AM, Pannirselvam Kanagaratnam wrote:


  On 25/3/2013 12:39 AM, Felix Fietkau wrote:

  
On 2013-03-24 5:26 PM, Pannirselvam Kanagaratnam wrote:


  Hello,

My WiFi connection drops while running the AR9280 on a Freescale
MPC8315E platform in AP mode with hostapd. I get the following error
within 15 seconds and the WiFi connection drops. However, I do not
observe any issues when using the AR9382. Can you let me know what
could
be causing this and if there is a workaround for this. I am using
Compat-Wireless-3.5.4.1.


I suggest updating to a more recent version of compat-wireless - 3.5.4.1
is quite old.
If a similar failure still occurs there, make sure you turn on
CONFIG_KALLSYMS so that the trace is not just a long list of meaningless
numbers.

- Felix


  
  Here are my logs with Compat 3.9-rc2 and CONFIG_KALLSYMS enabled.

ath: phy0: Failed to stop TX DMA, queues=0x004!
ath: phy0: DMA failed to stop in 10 ms AR_CR=0x0024
AR_DIAG_SW=0x4220 DMADBG_7=0x62c0
ath: phy0: Could not stop RX, we could be confusing the DMA engine
when we start RX up
[ cut here ]
Badness at
/build/compat-wireless-3.9-rc2-2-su/drivers/net/wireless/ath/ath9k/recv.c:487
NIP: c9b72eec LR: c9b72ee0 CTR: c01bc900
REGS: c6c63e30 TRAP: 0700   Not tainted  (2.6.35)
MSR: 00029032 EE,ME,CE,IR,DR  CR: 22002022  XER: 2000
TASK = c7859360[930] 'phy0' THREAD: c6c62000
GPR00: 0001 c6c63ee0 c7859360 004c 

Re: [ath9k-devel] [PATCH 0/6] various cleanup patches

2013-04-18 Thread Kalle Valo
Bartosz Markowski bartosz.markow...@tieto.com writes:

 Bartosz Markowski (6):
   ath10k: remove obsolete function prototype
   ath10k: fix typo in ath10k Kconfig
   ath10k: use if statement instead of cond. operator
   ath10k: remove pointless goto label
   ath10k: rename PCI target PS contol functions
   ath10k: remove fw event chain for target dump notification

Thanks, all six applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2 0/5] ath10k: pci memleak fix

2013-04-18 Thread Kalle Valo
Kalle Valo kv...@qca.qualcomm.com writes:

 Michal Kazior michal.kaz...@tieto.com writes:

 The v2 fixes patch 2, and introduces new patches 4
 and 5. There were two possible memleaks.

 Michal Kazior (5):
   ath10k: drop dead code
   ath10k: make HTC cancellation a generic thing
   ath10k: fix HTC tx flushing
   ath10k: reorder pci shutdown sequences
   ath10k: fix memory leak during PCI teardown

 Thanks, all five applied.

I'm not sure, but I suspect this set added a new warning:

drivers/net/wireless/ath/ath10k/htc.c:341:24: warning: unused variable skb_cb 
[-Wunused-variable]

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 2/7] ath10k: move suspend/resume exports to core.c file

2013-04-18 Thread Kalle Valo
Bartosz Markowski bartosz.markow...@tieto.com writes:

 --- a/drivers/net/wireless/ath/ath10k/core.c
 +++ b/drivers/net/wireless/ath/ath10k/core.c
 @@ -663,6 +663,31 @@ void ath10k_core_unregister(struct ath10k *ar)
  }
  EXPORT_SYMBOL(ath10k_core_unregister);
  
 +#if defined(CONFIG_PM_SLEEP)
 +int ath10k_pdev_suspend_target(struct ath10k *ar) {
 + int ret;
 +
 + ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
 +
 + ret = ath10k_wmi_pdev_suspend_target(ar);
 +
 + return ret;
 +}
 +EXPORT_SYMBOL(ath10k_pdev_suspend_target);
 +
 +int ath10k_pdev_resume_target(struct ath10k *ar) {
 +
 + int ret;
 +
 + ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
 +
 + ret = ath10k_wmi_pdev_resume_target(ar);
 +
 + return ret;
 +}
 +EXPORT_SYMBOL(ath10k_pdev_resume_target);

Please rename them to ath10k_core_suspend() and _resume() or something
like that.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 4/7] ath10k: reindent ath10k_pci_suspend

2013-04-18 Thread Kalle Valo
Bartosz Markowski bartosz.markow...@tieto.com writes:

 Also throw an error to PCI if WMI suspend command fails.

 Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com

Separate patches for reindent and the new error, please.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 5/7] ath10k: fix pointer casts in debug code

2013-04-18 Thread Kalle Valo
Bartosz Markowski bartosz.markow...@tieto.com writes:

 Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
 ---
  drivers/net/wireless/ath/ath10k/core.h  |2 --
  drivers/net/wireless/ath/ath10k/debug.h |6 +++---
  2 files changed, 3 insertions(+), 5 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/core.h 
 b/drivers/net/wireless/ath/ath10k/core.h
 index 00cf53a..c585a67 100644
 --- a/drivers/net/wireless/ath/ath10k/core.h
 +++ b/drivers/net/wireless/ath/ath10k/core.h
 @@ -276,10 +276,8 @@ struct ath10k {
   void *wmi;
   } modules;
  
 -#if defined(CONFIG_PM_SLEEP)
   wait_queue_head_t event_queue;
   bool is_target_paused;
 -#endif

I think this is leftovers from a previous patch.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 1/3] ath10k: kill CE_SEND_CB/CE_RECV_CB

2013-04-18 Thread Kalle Valo
Janusz Dziedzic janusz.dzied...@tieto.com writes:

 kill typedefs
 CE_SEND_CB/CE_RECV_CB

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com

Thanks, all three patches applied. Patch 2 had conflicts, please check I
didn't break anything.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Michal Kazior (7):
   ath10k: fix code style
   ath10k: use if() instead of ternary operator
   ath10k: remove unnecessary void cast
   ath10k: kill WARN_ONs in htt_rx.c
   ath10k: use macros instead of if() for value range limiting
   ath10k: use ath10k_warn() instead of WARN()
   ath10k: remove old function prototype

Thanks, all seven applied.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2 0/5] ath10k: pci memleak fix

2013-04-18 Thread Michal Kazior
On 18/04/13 12:29, Kalle Valo wrote:
 Kalle Valo kv...@qca.qualcomm.com writes:

 Michal Kazior michal.kaz...@tieto.com writes:

 The v2 fixes patch 2, and introduces new patches 4
 and 5. There were two possible memleaks.

 Michal Kazior (5):
ath10k: drop dead code
ath10k: make HTC cancellation a generic thing
ath10k: fix HTC tx flushing
ath10k: reorder pci shutdown sequences
ath10k: fix memory leak during PCI teardown

 Thanks, all five applied.

 I'm not sure, but I suspect this set added a new warning:

 drivers/net/wireless/ath/ath10k/htc.c:341:24: warning: unused variable skb_cb 
 [-Wunused-variable]

Yes. My apologies. I must've missed that somehow. It was introduced by 
patch #2.


-- Pozdrawiam / Best regards, Michal Kazior.
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32 function

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 On 18/04/13 10:08, Janusz Dziedzic wrote:
 Add ath10k_bmi_read32/ath10k_bmi_write32 functions
 and use them in core layer when read32/write32.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
 ---
   drivers/net/wireless/ath/ath10k/bmi.h  |   10 ++
   drivers/net/wireless/ath/ath10k/core.c |   24 
   2 files changed, 22 insertions(+), 12 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
 b/drivers/net/wireless/ath/ath10k/bmi.h
 index e2bd70b..2035d5d 100644
 --- a/drivers/net/wireless/ath/ath10k/bmi.h
 +++ b/drivers/net/wireless/ath/ath10k/bmi.h
 @@ -191,6 +191,16 @@ int ath10k_bmi_read_memory(struct ath10k *ar, u32 
 address,
 void *buffer, u32 length);
   int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
  const void *buffer, u32 length);
 +static inline int ath10k_bmi_read32(struct ath10k *ar, u32 address,
 +void *buffer)
 +{
 +return ath10k_bmi_read_memory(ar, address, buffer, sizeof(u32));
 +}
 +static inline int ath10k_bmi_write32(struct ath10k *ar, u32 address,
 + void *buffer)
 +{
 +return ath10k_bmi_write_memory(ar, address, buffer, sizeof(u32));
 +}

 I think these functions should do endianess converions so it is not 
 necessary at call sites anymore.

 Also the buffer could be a u32* instead of a void* implicitly stating 
 what the functions are meant to do.

Yeah, the idea is that the wrappers simplify writing to registers
instead of duplicating the same code in every register access.

I think we can just follow what ath6kl does:

#define ath6kl_bmi_write_hi32(ar, item, val)\
({  \
u32 addr;   \
__le32 v;   \
\
addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item));  \
v = cpu_to_le32(val);   \
ath6kl_bmi_write(ar, addr, (u8 *) v, sizeof(v));   \
})

#define ath6kl_bmi_read_hi32(ar, item, val) \
({  \
u32 addr, *check_type = val;\
__le32 tmp; \
int ret;\
\
(void) (check_type == val); \
addr = ath6kl_get_hi_item_addr(ar, HI_ITEM(item));  \
ret = ath6kl_bmi_read(ar, addr, (u8 *) tmp, 4);\
*val = le32_to_cpu(tmp);\
ret;\
})

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2 0/5] ath10k: pci memleak fix

2013-04-18 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 On 18/04/13 12:29, Kalle Valo wrote:
 Kalle Valo kv...@qca.qualcomm.com writes:

 Michal Kazior michal.kaz...@tieto.com writes:

 The v2 fixes patch 2, and introduces new patches 4
 and 5. There were two possible memleaks.

 Michal Kazior (5):
ath10k: drop dead code
ath10k: make HTC cancellation a generic thing
ath10k: fix HTC tx flushing
ath10k: reorder pci shutdown sequences
ath10k: fix memory leak during PCI teardown

 Thanks, all five applied.

 I'm not sure, but I suspect this set added a new warning:

 drivers/net/wireless/ath/ath10k/htc.c:341:24: warning: unused variable 
 skb_cb [-Wunused-variable]

 Yes. My apologies. I must've missed that somehow. It was introduced by
 patch #2.

No worries. Can you send a followup patch to fix that, please?

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath10k: fix unused variable warning

2013-04-18 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 2857a80..9b58c2a 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -337,7 +337,6 @@ static int ath10k_htc_tx_completion_handler(struct ath10k 
*ar,
 {
struct ath10k_htc *htc = ar-htc;
struct ath10k_htc_ep *ep = htc-endpoint[eid];
-   struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
bool stopping;
 
ath10k_htc_notify_tx_completion(ep, skb);
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 0/7] various fixes

2013-04-18 Thread Bartosz Markowski
Fix since V1:
* rename core suspend/resume functions
* split reindentation and new error path
* remove all excessive CONFIG_PM_SLEEP in one patch.

Bartosz Markowski (7):
  ath10k: move suspend/resume exports to core.c file
  ath10k: remove excessive ifdef checks
  ath10k: fix pointer casts in debug code
  ath10k: shift extern variable where it belongs
  ath10k: remove unnecessary NULL check
  ath10k: reindent ath10k_pci_suspend
  ath10k: return error if suspend command fails

 drivers/net/wireless/ath/ath10k/core.c  |   23 +
 drivers/net/wireless/ath/ath10k/core.h  |5 +--
 drivers/net/wireless/ath/ath10k/debug.h |6 ++--
 drivers/net/wireless/ath/ath10k/hif.h   |2 --
 drivers/net/wireless/ath/ath10k/htc.c   |3 +-
 drivers/net/wireless/ath/ath10k/pci.c   |   54 ---
 drivers/net/wireless/ath/ath10k/pci.h   |2 ++
 drivers/net/wireless/ath/ath10k/wmi.c   |9 --
 8 files changed, 60 insertions(+), 44 deletions(-)

-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 2/7] ath10k: remove excessive ifdef checks

2013-04-18 Thread Bartosz Markowski
No need to check CONFIG_PM_SLEEP everywhere, the PCI suspend
hooks is the only place we need to check it.

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.c |2 --
 drivers/net/wireless/ath/ath10k/core.h |2 --
 drivers/net/wireless/ath/ath10k/wmi.c  |2 --
 3 files changed, 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index e4bdec4..c91e602 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -663,7 +663,6 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
-#if defined(CONFIG_PM_SLEEP)
 int ath10k_core_target_suspend(struct ath10k *ar) {
int ret;
 
@@ -686,7 +685,6 @@ int ath10k_core_target_resume(struct ath10k *ar) {
return ret;
 }
 EXPORT_SYMBOL(ath10k_core_target_resume);
-#endif
 
 MODULE_AUTHOR(Qualcomm Atheros);
 MODULE_DESCRIPTION(Core module for AR9888 PCIe devices.);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 00cf53a..c585a67 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -276,10 +276,8 @@ struct ath10k {
void *wmi;
} modules;
 
-#if defined(CONFIG_PM_SLEEP)
wait_queue_head_t event_queue;
bool is_target_paused;
-#endif
 
struct ath10k_bmi bmi;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 45cbb60..e0b6291 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1217,7 +1217,6 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar, const 
struct wmi_channel_arg
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_CHANNEL_CMDID);
 }
 
-#if defined(CONFIG_PM_SLEEP)
 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
 {
struct wmi_pdev_suspend_cmd *cmd;
@@ -1245,7 +1244,6 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
 }
-#endif /* CONFIG_PM_SLEEP */
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
  u32 value)
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 1/7] ath10k: move suspend/resume exports to core.c file

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.c |   25 +
 drivers/net/wireless/ath/ath10k/core.h |3 +++
 drivers/net/wireless/ath/ath10k/pci.c  |6 +++---
 drivers/net/wireless/ath/ath10k/wmi.c  |7 ---
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 213c851..e4bdec4 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -663,6 +663,31 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
+#if defined(CONFIG_PM_SLEEP)
+int ath10k_core_target_suspend(struct ath10k *ar) {
+   int ret;
+
+   ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
+
+   ret = ath10k_wmi_pdev_suspend_target(ar);
+
+   return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_suspend);
+
+int ath10k_core_target_resume(struct ath10k *ar) {
+
+   int ret;
+
+   ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
+
+   ret = ath10k_wmi_pdev_resume_target(ar);
+
+   return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_resume);
+#endif
+
 MODULE_AUTHOR(Qualcomm Atheros);
 MODULE_DESCRIPTION(Core module for AR9888 PCIe devices.);
 MODULE_LICENSE(Dual BSD/GPL);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 193ac31..00cf53a 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -370,5 +370,8 @@ void ath10k_core_destroy(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar);
 void ath10k_core_unregister(struct ath10k *ar);
 
+int ath10k_pdev_suspend_target(struct ath10k *ar);
+int ath10k_pdev_resume_target(struct ath10k *ar);
+
 void ath10k_remain_on_channel_reset(unsigned long ptr);
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index ce77f9f..2f141fea 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2420,7 +2420,7 @@ static int ath10k_pci_suspend(struct device *device)
if (!ar_pci)
return -ENODEV;
 
-   if (!ath10k_wmi_pdev_suspend_target(ar)) {
+   if (!ath10k_pdev_suspend_target(ar)) {
left = wait_event_interruptible_timeout(ar-event_queue,
ar-is_target_paused == true,
1 * HZ);
@@ -2490,9 +2490,9 @@ static int ath10k_pci_resume(struct device *device)
pci_write_config_dword(pdev, 0x40, val  0x00ff);
}
 
-   ret = ath10k_wmi_pdev_resume_target(ar);
+   ret = ath10k_pdev_resume_target(ar);
if (ret)
-   ath10k_warn(ath10k_wmi_pdev_resume_target: %d\n, ret);
+   ath10k_warn(target resume failed: %d\n, ret);
 
return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 4b44957..45cbb60 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1230,19 +1230,13 @@ int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
cmd = (void *)skb-data;
cmd-suspend_opt = WMI_PDEV_SUSPEND;
 
-   ath10k_dbg(ATH10K_DBG_WMI, %s: called, __func__);
-
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SUSPEND_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_suspend_target);
-
 
 int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 {
struct sk_buff *skb;
 
-   ath10k_dbg(ATH10K_DBG_WMI, %s: called, __func__);
-
skb = ath10k_wmi_alloc_skb(0);
if (skb == NULL) {
ath10k_warn(%s: ath10k_wmi_alloc_skb() failed\n, __func__);
@@ -1251,7 +1245,6 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_resume_target);
 #endif /* CONFIG_PM_SLEEP */
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 3/7] ath10k: fix pointer casts in debug code

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/debug.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index dc4847b..681e400 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -70,7 +70,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
num_peer_stats = __le32_to_cpu(ev-num_peer_stats); /* 0 or max peers */
 
if (num_pdev_stats) {
-   struct wmi_pdev_stats *pdev_stats = (void *)tmp;
+   struct wmi_pdev_stats *pdev_stats = (struct wmi_pdev_stats 
*)tmp;
 
fw_stats-ch_noise_floor = __le32_to_cpu(pdev_stats-chan_nf);
fw_stats-tx_frame_count = 
__le32_to_cpu(pdev_stats-tx_frame_count);
@@ -127,7 +127,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
struct wmi_vdev_stats *vdev_stats;
 
for (i = 0; i  num_vdev_stats; i++) {
-   vdev_stats = (void *)tmp;
+   vdev_stats = (struct wmi_vdev_stats *)tmp;
tmp += sizeof(struct wmi_vdev_stats);
}
}
@@ -138,7 +138,7 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
fw_stats-peers = num_peer_stats;
 
for (i = 0; i  num_peer_stats; i++) {
-   peer_stats = (void *)tmp;
+   peer_stats = (struct wmi_peer_stats *)tmp;
 
WMI_MAC_ADDR_TO_CHAR_ARRAY(peer_stats-peer_macaddr,
   
fw_stats-peer_stat[i].peer_macaddr);
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 5/7] ath10k: remove unnecessary NULL check

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index ff4b1bf..299b9e6 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -622,8 +622,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k 
*ar,
/* skb is now owned by the rx completion handler */
skb = NULL;
 out:
-   if (skb != NULL)
-   kfree_skb(skb);
+   kfree_skb(skb);
 
return status;
 }
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 4/7] ath10k: shift extern variable where it belongs

2013-04-18 Thread Bartosz Markowski
ath10k_target_ps is PCI specific

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/hif.h |2 --
 drivers/net/wireless/ath/ath10k/pci.h |2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hif.h 
b/drivers/net/wireless/ath/ath10k/hif.h
index e9e202e..66f1d1f 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -21,8 +21,6 @@
 #include linux/kernel.h
 #include core.h
 
-extern unsigned int ath10k_target_ps;
-
 #define HIF_TYPE_AR9888  1
 
 /* FW dump area */
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index d6ffd84..708c087 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -351,6 +351,8 @@ void ath10k_pci_target_ps_control(struct ath10k *ar,
  bool sleep_ok,
  bool wait_for_it);
 
+extern unsigned int ath10k_target_ps;
+
 static inline void TARGET_ACCESS_BEGIN(struct ath10k *ar)
 {
if (ath10k_target_ps)
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 6/7] ath10k: reindent ath10k_pci_suspend

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |   50 +
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 2f141fea..3e841dd 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2420,33 +2420,35 @@ static int ath10k_pci_suspend(struct device *device)
if (!ar_pci)
return -ENODEV;
 
-   if (!ath10k_pdev_suspend_target(ar)) {
-   left = wait_event_interruptible_timeout(ar-event_queue,
-   ar-is_target_paused == true,
-   1 * HZ);
-
-   if (!left) {
-   ath10k_warn(failed to receive target pasused
-   event [left=%d]\n, left);
-   return -EIO;
-   }
-   /*
-* reset is_target_paused and host can check that in next time,
-* or it will always be TRUE and host just skip the waiting
-* condition, it causes target assert due to host already
-* suspend
-*/
-   ar-is_target_paused = false;
+   if (ath10k_pdev_suspend_target(ar))
+   return 0;
 
-   pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, val);
+   left = wait_event_interruptible_timeout(ar-event_queue,
+   ar-is_target_paused == true,
+   1 * HZ);
 
-   if ((val  0x00ff) != 0x3) {
-   pci_save_state(pdev);
-   pci_disable_device(pdev);
-   pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL,
-  (val  0xff00) | 0x03);
-   }
+   if (!left) {
+   ath10k_warn(failed to receive target pasused
+event [left=%d]\n, left);
+   return -EIO;
}
+   /*
+* reset is_target_paused and host can check that in next time,
+* or it will always be TRUE and host just skip the waiting
+* condition, it causes target assert due to host already
+* suspend
+*/
+   ar-is_target_paused = false;
+
+   pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, val);
+
+   if ((val  0x00ff) != 0x3) {
+   pci_save_state(pdev);
+   pci_disable_device(pdev);
+   pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL,
+  (val  0xff00) | 0x03);
+   }
+
return 0;
 }
 
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 7/7] ath10k: return error if suspend command fails

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 3e841dd..22b533b 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2421,7 +2421,7 @@ static int ath10k_pci_suspend(struct device *device)
return -ENODEV;
 
if (ath10k_pdev_suspend_target(ar))
-   return 0;
+   return -EIO;
 
left = wait_event_interruptible_timeout(ar-event_queue,
ar-is_target_paused == true,
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH v2 1/7] ath10k: move suspend/resume exports to core.c file

2013-04-18 Thread Markowski Bartosz
On 18/04/13 13:03, Markowski Bartosz wrote:
 Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
 ---
   drivers/net/wireless/ath/ath10k/core.c |   25 +
   drivers/net/wireless/ath/ath10k/core.h |3 +++
   drivers/net/wireless/ath/ath10k/pci.c  |6 +++---
   drivers/net/wireless/ath/ath10k/wmi.c  |7 ---
   4 files changed, 31 insertions(+), 10 deletions(-)

bah, I forgot about the prototypes. Drop this one, I will send a v3 for 
this patch only.
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v3] ath10k: move suspend/resume exports to core.c file

2013-04-18 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.c |   25 +
 drivers/net/wireless/ath/ath10k/core.h |3 +++
 drivers/net/wireless/ath/ath10k/pci.c  |6 +++---
 drivers/net/wireless/ath/ath10k/wmi.c  |7 ---
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 8cbdc04..0e6fd15 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -657,6 +657,31 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
+#if defined(CONFIG_PM_SLEEP)
+int ath10k_core_target_suspend(struct ath10k *ar) {
+   int ret;
+
+   ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
+
+   ret = ath10k_wmi_pdev_suspend_target(ar);
+
+   return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_suspend);
+
+int ath10k_core_target_resume(struct ath10k *ar) {
+
+   int ret;
+
+   ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
+
+   ret = ath10k_wmi_pdev_resume_target(ar);
+
+   return ret;
+}
+EXPORT_SYMBOL(ath10k_core_target_resume);
+#endif
+
 MODULE_AUTHOR(Qualcomm Atheros);
 MODULE_DESCRIPTION(Core module for AR9888 PCIe devices.);
 MODULE_LICENSE(Dual BSD/GPL);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index f47b2a0..60958ba 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -369,4 +369,7 @@ void ath10k_core_destroy(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar);
 void ath10k_core_unregister(struct ath10k *ar);
 
+int ath10k_core_target_suspend(struct ath10k *ar);
+int ath10k_core_target_resume(struct ath10k *ar);
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index e4024ef..89d00d7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2431,7 +2431,7 @@ static int ath10k_pci_suspend(struct device *device)
if (!ar_pci)
return -ENODEV;
 
-   if (!ath10k_wmi_pdev_suspend_target(ar)) {
+   if (!ath10k_core_target_suspend(ar)) {
left = wait_event_interruptible_timeout(ar-event_queue,
ar-is_target_paused == true,
1 * HZ);
@@ -2501,9 +2501,9 @@ static int ath10k_pci_resume(struct device *device)
pci_write_config_dword(pdev, 0x40, val  0x00ff);
}
 
-   ret = ath10k_wmi_pdev_resume_target(ar);
+   ret = ath10k_core_target_resume(ar);
if (ret)
-   ath10k_warn(ath10k_wmi_pdev_resume_target: %d\n, ret);
+   ath10k_warn(target resume failed: %d\n, ret);
 
return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 1a5dda6..7bf4e15 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1231,19 +1231,13 @@ int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
cmd = (void *)skb-data;
cmd-suspend_opt = WMI_PDEV_SUSPEND;
 
-   ath10k_dbg(ATH10K_DBG_WMI, %s: called, __func__);
-
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SUSPEND_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_suspend_target);
-
 
 int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 {
struct sk_buff *skb;
 
-   ath10k_dbg(ATH10K_DBG_WMI, %s: called, __func__);
-
skb = ath10k_wmi_alloc_skb(0);
if (skb == NULL) {
ath10k_warn(%s: ath10k_wmi_alloc_skb() failed\n, __func__);
@@ -1252,7 +1246,6 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 
return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
 }
-EXPORT_SYMBOL(ath10k_wmi_pdev_resume_target);
 #endif /* CONFIG_PM_SLEEP */
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 2/3] ath10k: merge htc-priv.h into htc.h

2013-04-18 Thread Michal Kazior
The file was already slated for removal for quite
some time now.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc-priv.h |  268 
 drivers/net/wireless/ath/ath10k/htc.c  |2 +-
 drivers/net/wireless/ath/ath10k/htc.h  |  252 ++
 3 files changed, 253 insertions(+), 269 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/htc-priv.h

diff --git a/drivers/net/wireless/ath/ath10k/htc-priv.h 
b/drivers/net/wireless/ath/ath10k/htc-priv.h
deleted file mode 100644
index 444e685..000
--- a/drivers/net/wireless/ath/ath10k/htc-priv.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _HTC_PRIV_H
-#define _HTC_PRIV_H
-
-#include linux/semaphore.h
-#include linux/timer.h
-
-#include htc.h
-#include hif.h
-
-/*
- * HTC - host-target control protocol
- *
- * tx packets are generally htc_hdrpayload
- * rx packets are more complex: htc_hdrpayloadtrailer
- *
- * The payload + trailer length is stored in len.
- * To get payload-only length one needs to payload - trailer_len.
- *
- * Trailer contains (possibly) multiple htc_record.
- * Each record is a id-len-value.
- *
- * HTC header flags, control_byte0, control_byte1
- * have different meaning depending whether its tx
- * or rx.
- *
- * Alignment: htc_hdr, payload and trailer are
- * 4-byte aligned.
- */
-
-enum ath10k_htc_tx_flags {
-   ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE = 0x01,
-   ATH10K_HTC_FLAG_SEND_BUNDLE= 0x02
-};
-
-enum ath10k_htc_rx_flags {
-   ATH10K_HTC_FLAG_TRAILER_PRESENT = 0x02,
-   ATH10K_HTC_FLAG_BUNDLE_MASK = 0xF0
-};
-
-struct ath10k_htc_hdr {
-   u8 eid; /* @enum ath10k_htc_ep_id */
-   u8 flags; /* @enum ath10k_htc_tx_flags, ath10k_htc_rx_flags */
-   __le16 len;
-   union {
-   u8 trailer_len; /* for rx */
-   u8 control_byte0;
-   } __packed;
-   union {
-   u8 seq_no; /* for tx */
-   u8 control_byte1;
-   } __packed;
-   u8 pad0;
-   u8 pad1;
-} __packed __aligned(4);
-
-enum ath10k_ath10k_htc_msg_id {
-   ATH10K_HTC_MSG_READY_ID= 1,
-   ATH10K_HTC_MSG_CONNECT_SERVICE_ID  = 2,
-   ATH10K_HTC_MSG_CONNECT_SERVICE_RESP_ID = 3,
-   ATH10K_HTC_MSG_SETUP_COMPLETE_ID   = 4,
-   ATH10K_HTC_MSG_SETUP_COMPLETE_EX_ID= 5,
-   ATH10K_HTC_MSG_SEND_SUSPEND_COMPLETE   = 6
-};
-
-enum ath10k_htc_version {
-   ATH10K_HTC_VERSION_2P0 = 0x00, /* 2.0 */
-   ATH10K_HTC_VERSION_2P1 = 0x01, /* 2.1 */
-};
-
-enum ath10k_htc_conn_flags {
-   ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH= 0x0,
-   ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_ONE_HALF  = 0x1,
-   ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS = 0x2,
-   ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_UNITY = 0x3,
-#define ATH10K_HTC_CONN_FLAGS_THRESHOLD_LEVEL_MASK 0x3
-   ATH10K_HTC_CONN_FLAGS_REDUCE_CREDIT_DRIBBLE= 1  2,
-   ATH10K_HTC_CONN_FLAGS_DISABLE_CREDIT_FLOW_CTRL = 1  3
-#define ATH10K_HTC_CONN_FLAGS_RECV_ALLOC_MASK 0xFF00
-#define ATH10K_HTC_CONN_FLAGS_RECV_ALLOC_LSB  8
-};
-
-enum ath10k_htc_conn_svc_status {
-   ATH10K_HTC_CONN_SVC_STATUS_SUCCESS  = 0,
-   ATH10K_HTC_CONN_SVC_STATUS_NOT_FOUND= 1,
-   ATH10K_HTC_CONN_SVC_STATUS_FAILED   = 2,
-   ATH10K_HTC_CONN_SVC_STATUS_NO_RESOURCES = 3,
-   ATH10K_HTC_CONN_SVC_STATUS_NO_MORE_EP   = 4
-};
-
-struct ath10k_ath10k_htc_msg_hdr {
-   __le16 message_id; /* @enum htc_message_id */
-} __packed;
-
-struct ath10k_htc_unknown {
-   u8 pad0;
-   u8 pad1;
-} __packed;
-
-struct ath10k_htc_ready {
-   __le16 credit_count;
-   __le16 credit_size;
-   u8 max_endpoints;
-   u8 pad0;
-} __packed;
-
-struct ath10k_htc_ready_extended {
-   struct ath10k_htc_ready base;
-   u8 htc_version; /* @enum ath10k_htc_version */
-   u8 max_msgs_per_htc_bundle;
-   u8 pad0;
-   u8 pad1;
-} __packed;
-
-struct ath10k_htc_conn_svc {
-   __le16 service_id;
-   __le16 flags; /* @enum ath10k_htc_conn_flags */
-   u8 pad0;
-   u8 

[ath9k-devel] [PATCH 0/3] ath10k: htc cleanup

2013-04-18 Thread Michal Kazior
Patch #1 is quite big, but I wanted to avoid
sending like 15 patches. I can send an unsquashed
patchset if need be.

If my understanding is correct we should also
rename htt and wmi structures and add ath10k_
prefix to them. If not, then we should probably
drop this most of this patchset and add the prefix
only to some selected structs.

Michal Kazior (3):
  ath10k: add ath10k_ prefix to htc structs, defs, enums
  ath10k: merge htc-priv.h into htc.h
  ath10k: rename htc_tx_lock

 drivers/net/wireless/ath/ath10k/core.c |   33 +-
 drivers/net/wireless/ath/ath10k/core.h |4 +-
 drivers/net/wireless/ath/ath10k/htc-priv.h |  271 ---
 drivers/net/wireless/ath/ath10k/htc.c  |  490 ++--
 drivers/net/wireless/ath/ath10k/htc.h  |  354 +---
 drivers/net/wireless/ath/ath10k/htt.c  |   30 +-
 drivers/net/wireless/ath/ath10k/htt.h  |7 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c   |8 +-
 drivers/net/wireless/ath/ath10k/pci.c  |   50 +--
 drivers/net/wireless/ath/ath10k/wmi.c  |   22 +-
 10 files changed, 622 insertions(+), 647 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/htc-priv.h

-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 3/3] ath10k: rename htc_tx_lock

2013-04-18 Thread Michal Kazior
We can call it just tx_lock.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.c |   40 -
 drivers/net/wireless/ath/ath10k/htc.h |2 +-
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index e76d434..2857a80 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -124,7 +124,7 @@ static void ath10k_htc_notify_tx_completion(struct 
ath10k_htc_ep *ep,
ep-ep_ops.ep_tx_complete(ep-ep_ops.context, skb);
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static bool ath10k_htc_ep_need_credit_update(struct ath10k_htc_ep *ep)
 {
if (!ep-tx_credit_flow_enabled)
@@ -147,13 +147,13 @@ static int ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep 
*ep,
hdr-eid = ep-eid;
hdr-len = __cpu_to_le16(skb-len - sizeof(*hdr));
 
-   spin_lock_bh(ep-htc-htc_tx_lock);
+   spin_lock_bh(ep-htc-tx_lock);
hdr-seq_no = ep-seq_no++;
 
if (ath10k_htc_ep_need_credit_update(ep))
hdr-flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
-   spin_unlock_bh(ep-htc-htc_tx_lock);
+   spin_unlock_bh(ep-htc-tx_lock);
 
return 0;
 }
@@ -188,9 +188,9 @@ static int ath10k_htc_issue_skb(struct ath10k_htc *htc,
 err:
ath10k_warn(HTC issue failed: %d\n, ret);
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
ep-tx_credits += skb_cb-htc.credits_used;
-   spin_unlock_bh(htc-htc_tx_lock);
+   spin_unlock_bh(htc-tx_lock);
 
skb_cb-is_aborted = true;
ath10k_htc_notify_tx_completion(ep, skb);
@@ -198,7 +198,7 @@ err:
return ret;
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
   struct ath10k_htc_ep *ep)
 {
@@ -255,7 +255,7 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
return skb;
 }
 
-/* assumes htc_tx_lock is held */
+/* assumes tx_lock is held */
 static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc *htc,
  struct ath10k_htc_ep *ep,
  int resources)
@@ -293,14 +293,14 @@ static void ath10k_htc_send_work(struct work_struct *work)
if (ep-ul_is_polled)
ath10k_htc_send_complete_check(ep, 0);
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
 
if (ep-tx_credit_flow_enabled)
skb = ath10k_htc_get_skb_credit_based(htc, ep);
else
skb = ath10k_htc_get_skb(htc, ep, tx_resources);
 
-   spin_unlock_bh(htc-htc_tx_lock);
+   spin_unlock_bh(htc-tx_lock);
 
if (!skb)
break; /* tx_queue empty or out of resources */
@@ -322,10 +322,10 @@ int ath10k_htc_send(struct ath10k_htc *htc,
 
skb_push(skb, sizeof(struct ath10k_htc_hdr));
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
skb_queue_tail(ep-tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
-   spin_unlock_bh(htc-htc_tx_lock);
+   spin_unlock_bh(htc-tx_lock);
 
queue_work(htc-ar-workqueue, ep-send_work);
return 0;
@@ -343,9 +343,9 @@ static int ath10k_htc_tx_completion_handler(struct ath10k 
*ar,
ath10k_htc_notify_tx_completion(ep, skb);
/* the skb now belongs to the completion handler */
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
stopping = htc-stopping;
-   spin_unlock_bh(htc-htc_tx_lock);
+   spin_unlock_bh(htc-tx_lock);
 
if (!ep-tx_credit_flow_enabled  !stopping)
/*
@@ -366,7 +366,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc 
*htc,
struct sk_buff *skb;
struct ath10k_skb_cb *skb_cb;
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
for (;;) {
skb = skb_dequeue(ep-tx_queue);
if (!skb)
@@ -376,7 +376,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc 
*htc,
skb_cb-is_aborted = true;
ath10k_htc_notify_tx_completion(ep, skb);
}
-   spin_unlock_bh(htc-htc_tx_lock);
+   spin_unlock_bh(htc-tx_lock);
 
cancel_work_sync(ep-send_work);
 }
@@ -400,7 +400,7 @@ static void ath10k_htc_process_credit_report(struct 
ath10k_htc *htc,
 
n_reports = len / sizeof(*report);
 
-   spin_lock_bh(htc-htc_tx_lock);
+   spin_lock_bh(htc-tx_lock);
for (i = 0; i  n_reports; i++, report++) {
if (report-eid = ATH10K_HTC_EP_COUNT)
break;
@@ -416,7 +416,7 @@ static void 

[ath9k-devel] [PATCH] ath10k: simplify FW binary names

2013-04-18 Thread Bartosz Markowski
If we have a folder tree to store the fw files, there's no
need to keep the names so complicated.

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/hw.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index ed5157b..d0ca76d 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -29,17 +29,17 @@
 /* AR9888 1.0 definitions */
 #define AR9888_HW_1_0_VERSION  0x402c
 #define AR9888_HW_1_0_FW_DIR   ath10k/AR9888/hw1.0
-#define AR9888_HW_1_0_FW_FILE  athwlan_AR9888v1.bin
+#define AR9888_HW_1_0_FW_FILE  firmware.bin
 #define AR9888_HW_1_0_OTP_FILE otp.bin
-#define AR9888_HW_1_0_BOARD_DATA_FILE  fakeBoardData_AR6004.bin
+#define AR9888_HW_1_0_BOARD_DATA_FILE  board.bin
 #define AR9888_HW_1_0_PATCH_LOAD_ADDR  0x1234
 
 /* AR9888 2.0 definitions */
 #define AR9888_HW_2_0_VERSION  0x4100016c
 #define AR9888_HW_2_0_FW_DIR   ath10k/AR9888/hw2.0
-#define AR9888_HW_2_0_FW_FILE  athwlan_AR9888v2.bin
+#define AR9888_HW_2_0_FW_FILE  firmware.bin
 #define AR9888_HW_2_0_OTP_FILE otp.bin
-#define AR9888_HW_2_0_BOARD_DATA_FILE  fakeBoardData_AR9888v2.bin
+#define AR9888_HW_2_0_BOARD_DATA_FILE  board.bin
 #define AR9888_HW_2_0_PATCH_LOAD_ADDR  0x1234
 
 #define TARGET_NUM_VDEV16
-- 
1.7.10

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH] ath10k: add bmi_read32/bmi_write32 functions

2013-04-18 Thread Janusz Dziedzic
Add ath10k_bmi_read32/ath10k_bmi_write32 functions
and use them in core layer when read32/write32.

Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.h  |   27 +++
 drivers/net/wireless/ath/ath10k/core.c |   79 +---
 2 files changed, 49 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index e2bd70b..f431589 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -191,6 +191,33 @@ int ath10k_bmi_read_memory(struct ath10k *ar, u32 address,
   void *buffer, u32 length);
 int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
const void *buffer, u32 length);
+
+#define ath10k_bmi_read32(ar, item, val)   \
+   ({  \
+   int ret;\
+   u32 addr;   \
+   __le32 tmp; \
+   \
+   addr = host_interest_item_address(ar-target_type,  \
+ HI_ITEM(item));   \
+   ret = ath10k_bmi_read_memory(ar, addr, (u8 *) tmp, 4); \
+   *val = __le32_to_cpu(tmp);  \
+   ret;\
+})
+
+#define ath10k_bmi_write32(ar, item, val)  \
+   ({  \
+   int ret;\
+   u32 address;\
+   __le32 v = __cpu_to_le32(val);  \
+   \
+   address = host_interest_item_address(ar-target_type,   \
+HI_ITEM(item));\
+   ret = ath10k_bmi_write_memory(ar, address,  \
+(u8 *) v, sizeof(v)); \
+   ret;\
+   })
+
 int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param);
 int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address);
 int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 8cbdc04..8921bd2 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -136,26 +136,19 @@ conn_fail:
 
 static int ath10k_init_configure_target(struct ath10k *ar)
 {
-   __le32 param_target;
u32 param_host;
int ret;
-   u32 host_addr;
 
/* tell target which HTC version it is used*/
-   param_target = __cpu_to_le32(HTC_PROTOCOL_VERSION);
-   host_addr = host_interest_item_address(ar-target_type,
-  HI_ITEM(hi_app_host_interest));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   param_host = HTC_PROTOCOL_VERSION;
+   ret = ath10k_bmi_write32(ar, hi_app_host_interest, param_host);
if (ret) {
ath10k_err(settings HTC version failed\n);
return ret;
}
 
/* set the firmware mode to STA/IBSS/AP */
-   host_addr = host_interest_item_address(ar-target_type,
-  HI_ITEM(hi_option_flag));
-   ret = ath10k_bmi_read_memory(ar, host_addr, (u8 *)param_target, 4);
-   param_host = __le32_to_cpu(param_target);
+   ret = ath10k_bmi_read32(ar, hi_option_flag, param_host);
if (ret) {
ath10k_err(setting firmware mode (1/2) failed\n);
return ret;
@@ -174,30 +167,23 @@ static int ath10k_init_configure_target(struct ath10k *ar)
/* fwsubmode */
param_host |= (0  HI_OPTION_FW_SUBMODE_SHIFT);
 
-   param_target = __cpu_to_le32(param_host);
-   host_addr = host_interest_item_address(ar-target_type,
-  HI_ITEM(hi_option_flag));
-   ret = ath10k_bmi_write_memory(ar, host_addr, (u8 *)param_target, 4);
+   ret = ath10k_bmi_write32(ar, hi_option_flag, param_host);
if (ret) {
ath10k_err(setting firmware mode (2/2) failed\n);
return ret;
}
 
-   param_target = __cpu_to_le32(0);
+   param_host = 0;
/* We do all byte-swapping on the host */
-   host_addr = host_interest_item_address(ar-target_type,
-  

[ath9k-devel] [PATCH] ath10k: split ath10k_pci_target_ps_control

2013-04-18 Thread Bartosz Markowski
Divide the target_ps_control into 2 logical pieces:
- ath10k_pci_wake
- ath10k_pci_sleep

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |  117 -
 drivers/net/wireless/ath/ath10k/pci.h |   18 +
 2 files changed, 60 insertions(+), 75 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index e4024ef..fedf321 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -442,6 +442,63 @@ static void ath10k_pci_wait_for_target_to_awake(struct 
ath10k *ar)
ath10k_warn(Unable to wakeup target\n);
 }
 
+void ath10k_pci_wake(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   void __iomem *pci_addr = ar_pci-mem;
+   static int max_delay;
+   int tot_delay = 0;
+   int curr_delay = 5;
+
+   if (!ath10k_target_ps)
+   return;
+
+   if (atomic_read(ar_pci-keep_awake_count) == 0) {
+   /* Force AWAKE */
+   iowrite32(PCIE_SOC_WAKE_V_MASK_T(ar),
+ pci_addr + PCIE_LOCAL_BASE_ADDRESS_T(ar) + 
PCIE_SOC_WAKE_ADDRESS_T(ar));
+   }
+   atomic_inc(ar_pci-keep_awake_count);
+
+   if (ar_pci-verified_awake)
+   return;
+
+   for (;;) {
+   if (ath10k_pci_target_is_awake(ar)) {
+   ar_pci-verified_awake = true;
+   break;
+   }
+
+   if (tot_delay  PCIE_WAKE_TIMEOUT)
+   ath10k_warn(keep_awake_count %d\n, 
atomic_read(ar_pci-keep_awake_count));
+
+   udelay(curr_delay);
+   tot_delay += curr_delay;
+
+   if (curr_delay  50)
+   curr_delay += 5;
+   }
+
+   if (tot_delay  max_delay)
+   max_delay = tot_delay;
+}
+
+void ath10k_pci_sleep(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   void __iomem *pci_addr = ar_pci-mem;
+
+   if (!ath10k_target_ps)
+   return;
+
+   if (atomic_dec_and_test(ar_pci-keep_awake_count)) {
+   /* Allow sleep */
+   ar_pci-verified_awake = false;
+   iowrite32(PCIE_SOC_WAKE_RESET_T(ar),
+ pci_addr + PCIE_LOCAL_BASE_ADDRESS_T(ar) + 
PCIE_SOC_WAKE_ADDRESS_T(ar));
+   }
+}
+
 /*
  * FIXME: Handle OOM properly.
  */
@@ -1631,7 +1688,7 @@ static int ath10k_pci_probe_device(struct ath10k *ar)
else {
/* Force AWAKE forever */
ath10k_dbg(ATH10K_DBG_PCI, on-chip power save disabled\n);
-   ath10k_pci_target_ps_control(ar, false, true);
+   ath10k_pci_wake(ar);
}
 
ath10k_pci_ce_init(ar);
@@ -1655,64 +1712,6 @@ ce_deinit:
return ret;
 }
 
-void ath10k_pci_target_ps_control(struct ath10k *ar, bool sleep_ok,
- bool wait_for_it)
-{
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   void __iomem *pci_addr = ar_pci-mem;
-   static int max_delay;
-
-   if (sleep_ok) {
-   if (atomic_dec_and_test(ar_pci-keep_awake_count)) {
-   /* Allow sleep */
-   ar_pci-verified_awake = false;
-   iowrite32(PCIE_SOC_WAKE_RESET_T(ar),
- pci_addr + PCIE_LOCAL_BASE_ADDRESS_T(ar) +
- PCIE_SOC_WAKE_ADDRESS_T(ar));
-   }
-   } else {
-   if (atomic_read(ar_pci-keep_awake_count) == 0) {
-   /* Force AWAKE */
-   iowrite32(PCIE_SOC_WAKE_V_MASK_T(ar),
- pci_addr + PCIE_LOCAL_BASE_ADDRESS_T(ar) +
- PCIE_SOC_WAKE_ADDRESS_T(ar));
-   }
-   atomic_inc(ar_pci-keep_awake_count);
-
-   if (wait_for_it  !ar_pci-verified_awake) {
-   int tot_delay = 0;
-   int curr_delay = 5;
-
-   for (;;) {
-   if (ath10k_pci_target_is_awake(ar)) {
-   ar_pci-verified_awake = true;
-   break;
-   }
-
-   if (tot_delay  PCIE_WAKE_TIMEOUT) {
-   ath10k_warn
-   (keep_awake_count %d 
-PCIE_SOC_WAKE_ADDRESS = %x\n,
-atomic_read(ar_pci-
-   keep_awake_count),
-ioread32(pci_addr +
-  PCIE_LOCAL_BASE_ADDRESS_T(ar) +
-  PCIE_SOC_WAKE_ADDRESS_T(ar)));
-   

[ath9k-devel] [PATCH] ath10k: fix QoS tx

2013-04-18 Thread Michal Kazior
Since we have a silly FW workaround we must
extract the tid *before* we apply the workaround.
Otherwise we cut out QoS Control field containing
the tid so it can't be accessed later on from
inside the tx frame.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
I broke QoS in one of my earlier tx patches some time ago.

 drivers/net/wireless/ath/ath10k/core.h   |3 ++-
 drivers/net/wireless/ath/ath10k/htt_tx.c |8 +---
 drivers/net/wireless/ath/ath10k/mac.c|   12 
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 97a79db..de82c80 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -55,6 +55,7 @@ struct ath10k_skb_cb {
 
struct {
u8 vdev_id;
+   u8 tid;
u16 msdu_id;
bool is_offchan;
bool is_conf;
@@ -69,7 +70,7 @@ struct ath10k_skb_cb {
u8 credits_used;
} __packed htc;
 
-   /* 5 bytes left on 64bit arch */
+   /* 4 bytes left on 64bit arch */
 } __packed;
 
 static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 2186056..5b3cad1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -343,13 +343,7 @@ int ath10k_htt_tx(struct htt_struct *htt, struct sk_buff 
*msdu)
cmd = (struct htt_cmd *)txdesc-data;
memset(cmd, 0, desc_len);
 
-   tid = HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
-
-   if (ieee80211_is_data_qos(hdr-frame_control) 
-   is_unicast_ether_addr(ieee80211_get_DA(hdr))) {
-   u8 *qc = ieee80211_get_qos_ctl(hdr);
-   tid = qc[0]  IEEE80211_QOS_CTL_TID_MASK;
-   }
+   tid = ATH10K_SKB_CB(msdu)-htt.tid;
 
ath10k_dbg(ATH10K_DBG_HTT, htt data tx using tid %hhu\n, tid);
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 4ca10bd..60855fb 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1469,9 +1469,11 @@ static void ath10k_tx(struct ieee80211_hw *hw,
  struct sk_buff *skb)
 {
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-data;
struct ath10k *ar = hw-priv;
struct ath10k_vif *arvif = NULL;
u32 vdev_id = 0;
+   u8 tid;
 
if (info-control.vif) {
arvif = ath10k_vif_to_arvif(info-control.vif);
@@ -1483,6 +1485,15 @@ static void ath10k_tx(struct ieee80211_hw *hw,
if (info-flags  IEEE80211_TX_CTL_NO_CCK_RATE)
ath10k_dbg(ATH10K_DBG_MAC, IEEE80211_TX_CTL_NO_CCK_RATE\n);
 
+   /* we must calculate tid before we apply qos workaround
+* as we'd lose the qos control field */
+   tid = HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
+   if (ieee80211_is_data_qos(hdr-frame_control) 
+   is_unicast_ether_addr(ieee80211_get_DA(hdr))) {
+   u8 *qc = ieee80211_get_qos_ctl(hdr);
+   tid = qc[0]  IEEE80211_QOS_CTL_TID_MASK;
+   }
+
ath10k_tx_h_qos_workaround(hw, control, skb);
ath10k_tx_h_update_wep_key(skb);
ath10k_tx_h_add_p2p_noa_ie(ar, skb);
@@ -1490,6 +1501,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
 
memset(ATH10K_SKB_CB(skb), 0, sizeof(*ATH10K_SKB_CB(skb)));
ATH10K_SKB_CB(skb)-htt.vdev_id = vdev_id;
+   ATH10K_SKB_CB(skb)-htt.tid = tid;
 
if (info-flags  IEEE80211_TX_CTL_TX_OFFCHAN) {
spin_lock_bh(ar-data_lock);
-- 
1.7.9.5

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] AR9287 ; 2-wire coexistence expected behavior

2013-04-18 Thread Adrian Chadd
On 18 April 2013 03:34, sandeep suresh sandeep.sur...@yahoo.co.in wrote:
 Hello Mr.Adrian,
 Yes I also fixed the weights as being reflected in the regdump register.
 Let me also try with other options for MODE register.

Ok.

 Please clarify my understanding below on rx_clear for WLAN: rx_clear is TRUE
 when any one of the following conditions are TRUE:
 a) WLAN is transmitting.
 b) WLAN is receiving.
 c) air medium is clear as per CCA assessment based on signal strength.

 What is the meaning of  but not a wifi signal in your reply below?

c). If there's some strong signal in the air that exceeds the CCA
threshold but isn't a decodable wifi signal, rx_clear is cleared.




Adrian
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel