[ath9k-devel] [PATCH 5/5] ath10k: copy ieee80211_supported_band for each instance

2013-04-24 Thread Kalle Valo
If we run multiple instances of ath10k the supported band structures were shared
with all instances. This is wrong and would cause corruption. Fix it by making
a private copy for each instance.

I didn't copy the rate structure ath10k_rates as ath9k also doesn't copy it.
Most likely nothing modifies that structure, but that needs to be verified.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/core.h |4 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   63 
 2 files changed, 43 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 42d9e72..c50ef59 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -322,6 +322,10 @@ struct ath10k {
int vdev_id;
} scan;
 
+   struct {
+   struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+   } mac;
+
/* should never be NULL; needed for regular htt rx */
struct ieee80211_channel __rcu *rx_channel;
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 8f58dda..20fba5d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2429,7 +2429,7 @@ static const struct ieee80211_ops ath10k_ops = {
.max_power  = 30, \
 }
 
-static struct ieee80211_channel ath10k_2ghz_channels[] = {
+static const struct ieee80211_channel ath10k_2ghz_channels[] = {
CHAN2G(1, 2412, 0),
CHAN2G(2, 2417, 0),
CHAN2G(3, 2422, 0),
@@ -2446,7 +2446,7 @@ static struct ieee80211_channel ath10k_2ghz_channels[] = {
CHAN2G(14, 2484, 0),
 };
 
-static struct ieee80211_channel ath10k_5ghz_channels[] = {
+static const struct ieee80211_channel ath10k_5ghz_channels[] = {
CHAN5G(36, 5180, 14),
CHAN5G(40, 5200, 15),
CHAN5G(44, 5220, 16),
@@ -2495,22 +2495,6 @@ static struct ieee80211_rate ath10k_rates[] = {
 #define ath10k_g_rates (ath10k_rates + 0)
 #define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates))
 
-static struct ieee80211_supported_band ath10k_band_2ghz = {
-   .n_channels = ARRAY_SIZE(ath10k_2ghz_channels),
-   .channels = ath10k_2ghz_channels,
-   .n_bitrates = ath10k_g_rates_size,
-   .bitrates = ath10k_g_rates,
-   /* .ht_cap depends on FW capabilities */
-};
-
-static struct ieee80211_supported_band ath10k_band_5ghz = {
-   .n_channels = ARRAY_SIZE(ath10k_5ghz_channels),
-   .channels = ath10k_5ghz_channels,
-   .n_bitrates = ath10k_a_rates_size,
-   .bitrates = ath10k_a_rates,
-   /* .ht_cap depends on FW capabilities */
-};
-
 struct ath10k *ath10k_mac_create(void)
 {
struct ieee80211_hw *hw;
@@ -2652,7 +2636,9 @@ struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, 
u32 vdev_id)
 int ath10k_mac_register(struct ath10k *ar)
 {
struct ath_common *common = ath10k_common(ar);
+   struct ieee80211_supported_band *band;
struct ieee80211_sta_ht_cap ht_cap;
+   void *channels;
int ret;
 
SET_IEEE80211_PERM_ADDR(ar-hw, ar-mac_addr);
@@ -2660,14 +2646,40 @@ int ath10k_mac_register(struct ath10k *ar)
SET_IEEE80211_DEV(ar-hw, ar-dev);
 
ht_cap = ath10k_get_ht_cap(ar);
-   ath10k_band_2ghz.ht_cap = ht_cap;
-   ath10k_band_5ghz.ht_cap = ht_cap;
 
-   if (ar-phy_capability  WHAL_WLAN_11G_CAPABILITY)
-   ar-hw-wiphy-bands[IEEE80211_BAND_2GHZ] = ath10k_band_2ghz;
+   if (ar-phy_capability  WHAL_WLAN_11G_CAPABILITY) {
+   channels = kmemdup(ath10k_2ghz_channels,
+  sizeof(ath10k_2ghz_channels),
+  GFP_KERNEL);
+   if (!channels)
+   return -ENOMEM;
+
+   band = ar-mac.sbands[IEEE80211_BAND_2GHZ];
+   band-n_channels = ARRAY_SIZE(ath10k_2ghz_channels);
+   band-channels = channels;
+   band-n_bitrates = ath10k_g_rates_size;
+   band-bitrates = ath10k_g_rates;
+   band-ht_cap = ht_cap;
+   ar-hw-wiphy-bands[IEEE80211_BAND_2GHZ] = band;
+   }
 
-   if (ar-phy_capability  WHAL_WLAN_11A_CAPABILITY)
-   ar-hw-wiphy-bands[IEEE80211_BAND_5GHZ] = ath10k_band_5ghz;
+
+
+   if (ar-phy_capability  WHAL_WLAN_11A_CAPABILITY) {
+   channels = kmemdup(ath10k_5ghz_channels,
+  sizeof(ath10k_5ghz_channels),
+  GFP_KERNEL);
+   if (!channels)
+   return -ENOMEM;
+
+   band = ar-mac.sbands[IEEE80211_BAND_2GHZ];
+   band-n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
+   band-channels = channels;
+   band-n_bitrates = ath10k_a_rates_size;
+   band-bitrates = ath10k_a_rates;
+   band-ht_cap = ht_cap;
+  

[ath9k-devel] [PATCH 1/5] ath10k: make rx_legacy_rate_idx variable const

2013-04-24 Thread Kalle Valo
It's not modified in any way.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/txrx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 6a66dc2..239eff5 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -120,7 +120,7 @@ void ath10k_txrx_tx_completed(struct htt_struct *htt,
ath10k_txrx_tx_unref(htt, txdesc);
 }
 
-static u8 rx_legacy_rate_idx[] = {
+static const u8 rx_legacy_rate_idx[] = {
3,  /* 0x00  - 11Mbps  */
2,  /* 0x01  - 5.5Mbps */
1,  /* 0x02  - 2Mbps   */

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


[ath9k-devel] [PATCH 2/5] ath10k: make host_ce_config_wlan static variable const

2013-04-24 Thread Kalle Valo
Nothing modifies it.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.c  |8 
 drivers/net/wireless/ath/ath10k/ce.h  |2 +-
 drivers/net/wireless/ath/ath10k/pci.c |8 
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index d5351a3..d3aa515 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -703,7 +703,7 @@ void ath10k_ce_recv_cb_register(struct ce_state *ce_state,
 static int ath10k_ce_init_src_ring(struct ath10k *ar,
   unsigned int ce_id,
   struct ce_state *ce_state,
-  struct ce_attr *attr)
+  const struct ce_attr *attr)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ce_ring_state *src_ring;
@@ -795,7 +795,7 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,
 static int ath10k_ce_init_dest_ring(struct ath10k *ar,
unsigned int ce_id,
struct ce_state *ce_state,
-   struct ce_attr *attr)
+   const struct ce_attr *attr)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ce_ring_state *dest_ring;
@@ -877,7 +877,7 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
 
 static struct ce_state *ath10k_ce_init_state(struct ath10k *ar,
  unsigned int ce_id,
- struct ce_attr *attr)
+ const struct ce_attr *attr)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ce_state *ce_state = NULL;
@@ -916,7 +916,7 @@ static struct ce_state *ath10k_ce_init_state(struct ath10k 
*ar,
  */
 struct ce_state *ath10k_ce_init(struct ath10k *ar,
unsigned int ce_id,
-   struct ce_attr *attr)
+   const struct ce_attr *attr)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ce_state *ce_state;
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index 084b997..01879eb 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -275,7 +275,7 @@ int ath10k_ce_completed_send_next(struct ce_state *ce_state,
 /* Initialize an instance of a CE */
 struct ce_state *ath10k_ce_init(struct ath10k *ar,
unsigned int ce_id,
-   struct ce_attr *attr);
+   const struct ce_attr *attr);
 
 /*==CE Engine Shutdown===*/
 /*
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 0d1523b..22a5451 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -52,7 +52,7 @@ static int ath10k_pci_post_recv_buffers(struct ath10k *ar);
 static int ath10k_pci_post_recv_buffers_pipe(struct hif_ce_pipe_info 
*pipe_info,
 int num);
 
-static struct ce_attr host_ce_config_wlan[] = {
+static const struct ce_attr host_ce_config_wlan[] = {
/* host-target HTC control and raw streams */
{ /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL,},
/* could be moved to share CE3 */
@@ -770,7 +770,7 @@ static void ath10k_pci_start_ce(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct ce_state *ce_diag = ar_pci-ce_diag;
-   struct ce_attr *attr;
+   const struct ce_attr *attr;
struct hif_ce_pipe_info *pipe_info;
struct hif_ce_completion_state *compl;
int i, pipe_num, completions;
@@ -1075,7 +1075,7 @@ static int ath10k_pci_post_recv_buffers(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct hif_ce_pipe_info *pipe_info;
-   struct ce_attr *attr;
+   const struct ce_attr *attr;
int pipe_num, ret = 0;
 
for (pipe_num = 0; pipe_num  ar_pci-ce_count; pipe_num++) {
@@ -1622,7 +1622,7 @@ static void ath10k_pci_ce_init(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct hif_ce_pipe_info *pipe_info;
-   struct ce_attr *attr;
+   const struct ce_attr *attr;
int pipe_num;
 
for (pipe_num = 0; pipe_num  ar_pci-ce_count; pipe_num++) {

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


[ath9k-devel] [PATCH 3/5] ath10k: make target_ce_config_wlan and target_service_to_ce_map_wlan const

2013-04-24 Thread Kalle Valo
Nothing modifies them.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/pci.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 22a5451..7a35234 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -74,7 +74,7 @@ static const struct ce_attr host_ce_config_wlan[] = {
 };
 
 /* Target firmware's Copy Engine configuration. */
-static struct ce_pipe_config target_ce_config_wlan[] = {
+static const struct ce_pipe_config target_ce_config_wlan[] = {
/* host-target HTC control and raw streams */
{ /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0,},
/* target-host HTT + HTC control */
@@ -1358,7 +1358,7 @@ static void ath10k_pci_bmi_recv_data(struct ce_state 
*ce_state,
  * This table is derived from the CE_PCI TABLE, above.
  * It is passed to the Target at startup for use by firmware.
  */
-static struct service_to_pipe target_service_to_ce_map_wlan[] = {
+static const struct service_to_pipe target_service_to_ce_map_wlan[] = {
{
 ATH10K_HTC_SVC_ID_WMI_DATA_VO,
 PIPEDIR_OUT,   /* out = UL = host - target */

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


[ath9k-devel] [PATCH 0/5] ath10k: making static variables const

2013-04-24 Thread Kalle Valo
Did some review of static variables and noticed that
we had quite a few variables which were not const.

Please review carefully, I might have missed something.

---

Kalle Valo (5):
  ath10k: make rx_legacy_rate_idx variable const
  ath10k: make host_ce_config_wlan static variable const
  ath10k: make target_ce_config_wlan and target_service_to_ce_map_wlan const
  ath10k: make iee80211 iface combination structures static
  ath10k: copy ieee80211_supported_band for each instance


 drivers/net/wireless/ath/ath10k/ce.c   |8 ++--
 drivers/net/wireless/ath/ath10k/ce.h   |2 -
 drivers/net/wireless/ath/ath10k/core.h |4 ++
 drivers/net/wireless/ath/ath10k/mac.c  |   67 
 drivers/net/wireless/ath/ath10k/pci.c  |   12 +++---
 drivers/net/wireless/ath/ath10k/txrx.c |2 -
 6 files changed, 57 insertions(+), 38 deletions(-)

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


[ath9k-devel] [PATCH 4/5] ath10k: make iee80211 iface combination structures static

2013-04-24 Thread Kalle Valo
Nothing modifies them.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/mac.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 60855fb..8f58dda 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2531,7 +2531,7 @@ void ath10k_mac_destroy(struct ath10k *ar)
ieee80211_free_hw(ar-hw);
 }
 
-static struct ieee80211_iface_limit ath10k_if_limits[] = {
+static const struct ieee80211_iface_limit ath10k_if_limits[] = {
{
.max= 8,
.types  = BIT(NL80211_IFTYPE_STATION)
@@ -2541,7 +2541,7 @@ static struct ieee80211_iface_limit ath10k_if_limits[] = {
}
 };
 
-static struct ieee80211_iface_combination ath10k_if_comb = {
+static const struct ieee80211_iface_combination ath10k_if_comb = {
.limits = ath10k_if_limits,
.n_limits = ARRAY_SIZE(ath10k_if_limits),
.max_interfaces = 8,

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


[ath9k-devel] [PATCH] ath10k: kill static int max_delay

2013-04-24 Thread Janusz Dziedzic
Kill static variable max_delay.
Move this to struct ath10k_pci.

Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |5 ++---
 drivers/net/wireless/ath/ath10k/pci.h |2 ++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 0d1523b..9ee678a 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -445,7 +445,6 @@ void ath10k_do_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;
 
@@ -475,8 +474,8 @@ void ath10k_do_pci_wake(struct ath10k *ar)
curr_delay += 5;
}
 
-   if (tot_delay  max_delay)
-   max_delay = tot_delay;
+   if (tot_delay  ar_pci-max_delay)
+   ar_pci-max_delay = tot_delay;
 }
 
 void ath10k_do_pci_sleep(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index 188593e..70d3b12 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -222,6 +222,8 @@ struct ath10k_pci {
 
bool hw_v1_workaround;
spinlock_t hw_v1_workaround_lock;
+
+   int max_delay;
 };
 
 static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *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 v2 2/3] ath10k: Merge debug levels

2013-04-24 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

BMI, BOOT with CORE and RX with HTT.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/bmi.c   |  8 
 drivers/net/wireless/ath/ath10k/core.c  |  4 ++--
 drivers/net/wireless/ath/ath10k/debug.h | 19 ---
 drivers/net/wireless/ath/ath10k/txrx.c  |  2 +-
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.c 
b/drivers/net/wireless/ath/ath10k/bmi.c
index 85bf366..512f54f 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -27,7 +27,7 @@ int ath10k_bmi_done(struct ath10k *ar)
int ret;
 
if (ar-bmi.done_sent) {
-   ath10k_dbg(ATH10K_DBG_BMI, %s skipped\n, __func__);
+   ath10k_dbg(ATH10K_DBG_CORE, %s skipped\n, __func__);
return 0;
}
 
@@ -91,7 +91,7 @@ int ath10k_bmi_read_memory(struct ath10k *ar,
return -EBUSY;
}
 
-   ath10k_dbg(ATH10K_DBG_BMI,
+   ath10k_dbg(ATH10K_DBG_CORE,
   %s: (device: 0x%p, address: 0x%x, length: %d)\n,
   __func__, ar, address, length);
 
@@ -130,7 +130,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar,
return -EBUSY;
}
 
-   ath10k_dbg(ATH10K_DBG_BMI,
+   ath10k_dbg(ATH10K_DBG_CORE,
   %s: (device: 0x%p, address: 0x%x, length: %d)\n,
   __func__, ar, address, length);
 
@@ -176,7 +176,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 
*param)
return -EBUSY;
}
 
-   ath10k_dbg(ATH10K_DBG_BMI,
+   ath10k_dbg(ATH10K_DBG_CORE,
   %s: (device: 0x%p, address: 0x%x, param: %d)\n,
   __func__, ar, address, *param);
 
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 07102b8..e2379ff 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -266,7 +266,7 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
/* Determine where in Target RAM to write Board Data */
ath10k_bmi_read32(ar, hi_board_ext_data, board_ext_address);
 
-   ath10k_dbg(ATH10K_DBG_BOOT,
+   ath10k_dbg(ATH10K_DBG_CORE,
   ath10k: Board extended Data download addr: 0x%x\n,
   board_ext_address);
 
@@ -347,7 +347,7 @@ static int ath10k_init_download_firmware(struct ath10k *ar)
 
/* Transfer One Time Programmable data */
address = ar-hw_params.patch_load_addr;
-   ath10k_dbg(ATH10K_DBG_BOOT,
+   ath10k_dbg(ATH10K_DBG_CORE,
   Using 0x%x for the remainder of init\n, address);
 
status = ath10k_init_transfer_bin_file(ar, ATH10K_FILE_OTP,
diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 3ae598a..8c0a499 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -23,17 +23,14 @@
 
 enum ath10k_debug_mask {
ATH10K_DBG_PCI  = 0x0001,
-   ATH10K_DBG_BMI  = 0x0002,
-   ATH10K_DBG_WMI  = 0x0004,
-   ATH10K_DBG_HTC  = 0x0008,
-   ATH10K_DBG_HTT  = 0x0010,
-   ATH10K_DBG_MAC  = 0x0020,
-   ATH10K_DBG_CORE = 0x0040,
-   ATH10K_DBG_BOOT = 0x0080,
-   ATH10K_DBG_PCI_DUMP = 0x0100,
-   ATH10K_DBG_HTT_DUMP = 0x0200,
-   ATH10K_DBG_RX   = 0x0400,
-   ATH10K_DBG_BEACON   = 0x0800,
+   ATH10K_DBG_WMI  = 0x0002,
+   ATH10K_DBG_HTC  = 0x0004,
+   ATH10K_DBG_HTT  = 0x0008,
+   ATH10K_DBG_MAC  = 0x0010,
+   ATH10K_DBG_CORE = 0x0020,
+   ATH10K_DBG_PCI_DUMP = 0x0040,
+   ATH10K_DBG_HTT_DUMP = 0x0080,
+   ATH10K_DBG_BEACON   = 0x0100,
ATH10K_DBG_ANY  = 0x,
 };
 
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 6a66dc2..0e8f86d 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -269,7 +269,7 @@ void ath10k_process_rx(struct ath10k *ar, struct 
htt_rx_info *info)
status-freq = ch-center_freq;
rcu_read_unlock();
 
-   ath10k_dbg(ATH10K_DBG_RX,
+   ath10k_dbg(ATH10K_DBG_HTT,
   rx skb %p len %u %s%s%s%s%s %srate_idx %u vht_nss %u freq 
%u band %u\n,
   info-skb,
   info-skb-len,
-- 
1.8.2.1

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


[ath9k-devel] [PATCH v2 1/3] ath10k: WMI API updates

2013-04-24 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

To sync with new FW ver .614

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/hw.h  |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c |  1 +
 drivers/net/wireless/ath/ath10k/wmi.h | 12 
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 82465a8..c8f7e52 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -24,7 +24,7 @@
 #define SUPPORTED_FW_MAJOR 1
 #define SUPPORTED_FW_MINOR 0
 #define SUPPORTED_FW_RELEASE   0
-#define SUPPORTED_FW_BUILD 548
+#define SUPPORTED_FW_BUILD 614
 
 /* AR9888 1.0 definitions */
 #define AR9888_HW_1_0_VERSION  0x402c
@@ -50,6 +50,7 @@
 #define TARGET_AST_SKID_LIMIT  16
 #define TARGET_NUM_PEERS   16
 #define TARGET_NUM_OFFLOAD_PEERS   0
+#define TARGET_NUM_OFFLOAD_REORDER_BUFS 0
 #define TARGET_NUM_PEER_KEYS   2
 #define TARGET_NUM_TIDS(2 * (TARGET_NUM_PEERS + TARGET_NUM_VDEV))
 #define TARGET_TX_CHAIN_MASK   0x7
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 3de4bb2..98c6f1a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1236,6 +1236,7 @@ int ath10k_wmi_cmd_init(struct ath10k *ar)
/* reserve an additional peer for each VDEV */
__cpu_to_le32(TARGET_NUM_PEERS + TARGET_NUM_VDEV),
__cpu_to_le32(TARGET_NUM_OFFLOAD_PEERS),
+   __cpu_to_le32(TARGET_NUM_OFFLOAD_REORDER_BUFS),
__cpu_to_le32(TARGET_NUM_PEER_KEYS),
__cpu_to_le32(TARGET_NUM_TIDS),
__cpu_to_le32(TARGET_AST_SKID_LIMIT),
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 2bb8f0a..3a9f4ad 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -378,6 +378,8 @@ enum wmi_cmd_id {
WMI_DBGLOG_CFG_CMDID,
WMI_PDEV_QVIT_CMDID,
WMI_PDEV_FTM_INTG_CMDID,
+   WMI_VDEV_SET_KEEPALIVE_CMDID,
+   WMI_VDEV_GET_KEEPALIVE_CMDID,
WMI_PDEV_UTF_CMDID,
 };
 
@@ -440,6 +442,8 @@ enum wmi_event_id {
WMI_PDEV_QVIT_EVENTID,
WMI_WLAN_PROFILE_DATA_EVENTID,
WMI_PDEV_FTM_INTG_EVENTID,
+   WMI_WLAN_FREQ_AVOID_EVENTID,
+   WMI_VDEV_GET_KEEPALIVE_EVENTID,
WMI_PDEV_UTF_EVENTID,
 };
 
@@ -748,6 +752,9 @@ struct wmi_resource_config {
 */
__le32 num_offload_peers;
 
+   /* For target-based RX reordering */
+   __le32 num_offload_reorder_bufs;
+
/* number of keys per peer */
__le32 num_peer_keys;
 
@@ -1054,6 +1061,9 @@ struct wmi_start_scan_cmd {
__le32 probe_delay;
/* Scan control flags */
__le32 scan_ctrl_flags;
+
+   /* Burst duration time in msecs */
+   __le32 burst_duration;
/*
 * TLV (tag length value )  paramerters follow the scan_cmd structure.
 * TLV can contain channel list, bssid list, ssid list and
@@ -2038,6 +2048,8 @@ enum wmi_vdev_param {
WMI_VDEV_PARAM_MCAST_INDICATE,
/* Tx DHCP packet indicate Enable/Disable */
WMI_VDEV_PARAM_DHCP_INDICATE,
+   /* Enable host inspection of Tx unicast packet to unknown destination */
+   WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
 
/* The minimum amount of time AP begins to consider STA inactive */
WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
-- 
1.8.2.1

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


[ath9k-devel] [PATCH v2 3/3] ath10k: Initialize CW mode

2013-04-24 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Set the channel width mode to static by default.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index dd9430a..ce899a6 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1492,6 +1492,9 @@ static void ath10k_tx(struct ieee80211_hw *hw,
ath10k_tx_htt(ar, skb);
 }
 
+/*
+ * Initialize various parameters with default vaules.
+ */
 static int ath10k_start(struct ieee80211_hw *hw)
 {
struct ath10k *ar = hw-priv;
@@ -1501,6 +1504,10 @@ static int ath10k_start(struct ieee80211_hw *hw)
if (ret)
ath10k_warn(could not enable WMI_PDEV_PARAM_PMF_QOS (%d)\n, 
ret);
 
+   ret = ath10k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_DYNAMIC_BW, 0);
+   if (ret)
+   ath10k_warn(could not init WMI_PDEV_PARAM_DYNAMIC_BW (%d)\n, 
ret);
+
return 0;
 }
 
-- 
1.8.2.1

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


[ath9k-devel] [PATCH 1/2] ath10k: clear pending_tx[] upon tx completion

2013-04-24 Thread Michal Kazior
We validate the pending_tx[] upon tx completion so
it makes sense to clear the items.

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

diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index ea99d06..cfe3b52 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -93,6 +93,7 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct 
sk_buff *txdesc)
 
 exit:
spin_lock_bh(htt-tx_lock);
+   htt-pending_tx[ATH10K_SKB_CB(txdesc)-htt.msdu_id] = NULL;
ath10k_htt_tx_free_msdu_id(htt, ATH10K_SKB_CB(txdesc)-htt.msdu_id);
if (bitmap_empty(htt-used_msdu_ids, HTT_MAX_NUM_PENDING_TX))
wake_up(htt-empty_tx_wq);
-- 
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: htt fixes

2013-04-24 Thread Michal Kazior
This one addresses a rare memory leak when FW
hangs leaving some HTT tx transactions unfinished.

Michal Kazior (2):
  ath10k: clear pending_tx[] upon tx completion
  ath10k: cleanup htt pending tx

 drivers/net/wireless/ath/ath10k/htt_tx.c |   28 
 drivers/net/wireless/ath/ath10k/txrx.c   |1 +
 2 files changed, 29 insertions(+)

-- 
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 1/3] ath10k: WMI API updates

2013-04-24 Thread Markowski Bartosz
On 24/04/13 08:53, Sujith Manoharan wrote:
 From: Sujith Manoharan c_man...@qca.qualcomm.com

 To sync with new FW ver .614

 Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
 ---
   drivers/net/wireless/ath/ath10k/hw.h  |  3 ++-
   drivers/net/wireless/ath/ath10k/wmi.c |  1 +
   drivers/net/wireless/ath/ath10k/wmi.h | 12 
   3 files changed, 15 insertions(+), 1 deletion(-)


Thanks!

I have checked this also.
ACK from me for this firmware step up.

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


Re: [ath9k-devel] [PATCH 4/5] ath10k: make iee80211 iface combination structures static

2013-04-24 Thread Michal Kazior
On 24/04/13 08:37, Kalle Valo wrote:
 Nothing modifies them.

I think the title should be s/static/const/


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


[ath9k-devel] [RFC 0/2] ath10k: fix qos workaround

2013-04-24 Thread Michal Kazior
From what I've observed so far is frames in
monitor mode (non promiscuous) are corrupted. They
have the QoS Control stripped, with LLC header
finding itself in the QoS Control. Wireshark shows
such packets as A-MSDU corrupted frames. I tried
restoring the QoS Control but it didn't fix that.

I think we'll need to make a copy of skb, work on
that copy and keep the original skbuff pointer as
a cookie to use with mac80211 functions
(tx_status, free_txskb). I'm hoping this won't
degrade tx performance (well, we already do a
memmove()).

Yuck. Any comments?


Michal Kazior (2):
  ath10k: make more space in ath10k_skb_cb
  ath10k: copy skb during tx

 drivers/net/wireless/ath/ath10k/core.h |   32 
 drivers/net/wireless/ath/ath10k/mac.c  |   21 +++--
 drivers/net/wireless/ath/ath10k/txrx.c |8 +---
 3 files changed, 44 insertions(+), 17 deletions(-)

-- 
1.7.9.5

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


[ath9k-devel] [RFC 1/2] ath10k: make more space in ath10k_skb_cb

2013-04-24 Thread Michal Kazior
Some fields are used only for the original payload
skbuff, and other are used for htt tx descriptor
skbuff. If we split them and make a union we get a
lot of extra room.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h |   31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 42d9e72..d5ad574 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -52,24 +52,31 @@ struct ath10k_skb_cb {
bool is_mapped;
bool is_aborted;
 
-   struct {
-   u8 vdev_id;
-   u16 msdu_id;
-   u8 tid;
-   bool is_offchan;
-   bool is_conf;
-   bool discard;
-   bool no_ack;
-   u8 refcount;
-   struct sk_buff *txfrag;
-   struct sk_buff *msdu;
+   union {
+   struct {
+   u8 vdev_id;
+   u8 tid;
+   bool is_offchan;
+
+   /* 19 bytes left */
+   } __packed;
+
+   struct {
+   u16 msdu_id;
+   bool is_conf;
+   bool discard;
+   bool no_ack;
+   u8 refcount;
+   struct sk_buff *txfrag;
+   struct sk_buff *msdu;
+   } __packed;
} __packed htt;
 
struct {
u8 credits_used;
} __packed htc;
 
-   /* 4 bytes left on 64bit arch */
+   /* 7 bytes left on 64bit arch */
 } __packed;
 
 static inline struct ath10k_skb_cb *ATH10K_SKB_CB(struct sk_buff *skb)
-- 
1.7.9.5

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


[ath9k-devel] [RFC 2/2] ath10k: copy skb during tx

2013-04-24 Thread Michal Kazior
HW is unable to overwrite Qos Control field from
Qos Data Frames. We must strip the QoS Control
provided by mac80211 before we can submit a frame
to the FW.

Since we modified a frame and never restored it
this could cause some issues. It definietely ended
up showing corrupted frames from a monitor
interface.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/core.h |1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   21 +++--
 drivers/net/wireless/ath/ath10k/txrx.c |8 +---
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index d5ad574..911f367 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -57,6 +57,7 @@ struct ath10k_skb_cb {
u8 vdev_id;
u8 tid;
bool is_offchan;
+   struct sk_buff *orig_skb;
 
/* 19 bytes left */
} __packed;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 60855fb..60fe808 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1275,7 +1275,8 @@ static void ath10k_tx_htt(struct ath10k *ar, struct 
sk_buff *skb)
 
if (ret) {
ath10k_warn(tx failed (%d). dropping packet.\n, ret);
-   ieee80211_free_txskb(ar-hw, skb);
+   ieee80211_free_txskb(ar-hw, ATH10K_SKB_CB(skb)-htt.orig_skb);
+   kfree_skb(skb);
}
 }
 
@@ -1288,7 +1289,8 @@ void ath10k_offchan_tx_purge(struct ath10k *ar)
if (!skb)
break;
 
-   ieee80211_free_txskb(ar-hw, skb);
+   ieee80211_free_txskb(ar-hw, ATH10K_SKB_CB(skb)-htt.orig_skb);
+   kfree_skb(skb);
}
 }
 
@@ -1472,6 +1474,7 @@ static void ath10k_tx(struct ieee80211_hw *hw,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-data;
struct ath10k *ar = hw-priv;
struct ath10k_vif *arvif = NULL;
+   struct sk_buff *orig_skb;
u32 vdev_id = 0;
u8 tid;
 
@@ -1494,6 +1497,19 @@ static void ath10k_tx(struct ieee80211_hw *hw,
tid = qc[0]  IEEE80211_QOS_CTL_TID_MASK;
}
 
+   /* In most cases (most APs support QoS these days) we need to strip QoS
+* Control field (HW quirk). This in turn may confuse mac80211 and
+* userspace. Simply saving and restoring QoS Control is not enough
+* since after this tx callback is done the frame may be pushed to
+* monitor interfaces. The userspace then sees corrupted frames. */
+   orig_skb = skb;
+   skb = skb_copy(orig_skb, GFP_ATOMIC);
+   if (!skb) {
+   ath10k_warn(could not copy skb, dropping\n);
+   ieee80211_free_txskb(hw, orig_skb);
+   return;
+   }
+
ath10k_tx_h_qos_workaround(hw, control, skb);
ath10k_tx_h_update_wep_key(skb);
ath10k_tx_h_add_p2p_noa_ie(ar, skb);
@@ -1502,6 +1518,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;
+   ATH10K_SKB_CB(skb)-htt.orig_skb = orig_skb;
 
if (info-flags  IEEE80211_TX_CTL_TX_OFFCHAN) {
spin_lock_bh(ar-data_lock);
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c 
b/drivers/net/wireless/ath/ath10k/txrx.c
index 6a66dc2..9c130f4 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -50,6 +50,7 @@ void ath10k_txrx_tx_unref(struct htt_struct *htt, struct 
sk_buff *txdesc)
struct ieee80211_tx_info *info;
struct sk_buff *txfrag = ATH10K_SKB_CB(txdesc)-htt.txfrag;
struct sk_buff *msdu = ATH10K_SKB_CB(txdesc)-htt.msdu;
+   struct sk_buff *orig_skb = ATH10K_SKB_CB(msdu)-htt.orig_skb;
int ret;
 
if (ATH10K_SKB_CB(txdesc)-htt.refcount == 0)
@@ -76,7 +77,7 @@ void ath10k_txrx_tx_unref(struct htt_struct *htt, struct 
sk_buff *txdesc)
memset(info-status, 0, sizeof(info-status));
 
if (ATH10K_SKB_CB(txdesc)-htt.discard) {
-   ieee80211_free_txskb(htt-ar-hw, msdu);
+   ieee80211_free_txskb(htt-ar-hw, orig_skb);
goto exit;
}
 
@@ -86,7 +87,7 @@ void ath10k_txrx_tx_unref(struct htt_struct *htt, struct 
sk_buff *txdesc)
if (ATH10K_SKB_CB(txdesc)-htt.no_ack)
info-flags = ~IEEE80211_TX_STAT_ACK;
 
-   ieee80211_tx_status(htt-ar-hw, msdu);
+   ieee80211_tx_status(htt-ar-hw, orig_skb);
/* we do not own the msdu anymore */
 
 exit:
@@ -96,7 +97,8 @@ exit:
wake_up(htt-empty_tx_wq);
spin_unlock_bh(htt-tx_lock);
 
-   dev_kfree_skb_any(txdesc);
+   

[ath9k-devel] [PATCH 3/3] ath10k: don't support llc/snap decap explicitly for amsdu rx

2013-04-24 Thread Michal Kazior
We don't really know how to un-decap those frames
for A-MSDU traffic, yet.

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

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 645304b..2c0d4ee 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -570,7 +570,8 @@ static int ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
RX_MPDU_START_INFO0_ENCRYPT_TYPE);
 
/* FIXME: No idea what assumptions are safe here. Need logs */
-   if (fmt == RX_MSDU_DECAP_RAW  skb-next) {
+   if ((fmt == RX_MSDU_DECAP_RAW  skb-next) ||
+   (fmt == RX_MSDU_DECAP_8023_SNAP_LLC)) {
ath10k_htt_rx_free_msdu_chain(skb-next);
skb-next = NULL;
return -ENOTSUPP;
-- 
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/3] ath10k: fix native wifi decap mode amsdu rx

2013-04-24 Thread Michal Kazior
We did not really support nwifi decap mode
correctly.

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

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index f572fba..645304b 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -570,7 +570,7 @@ static int ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
RX_MPDU_START_INFO0_ENCRYPT_TYPE);
 
/* FIXME: No idea what assumptions are safe here. Need logs */
-   if (fmt  RX_MSDU_DECAP_ETHERNET2_DIX  skb-next) {
+   if (fmt == RX_MSDU_DECAP_RAW  skb-next) {
ath10k_htt_rx_free_msdu_chain(skb-next);
skb-next = NULL;
return -ENOTSUPP;
@@ -632,6 +632,18 @@ static int ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
memcpy(skb_put(amsdu, decap_len), decap_hdr, decap_len);
}
 
+   if (fmt == RX_MSDU_DECAP_NATIVE_WIFI) {
+   /* Native Wifi decap inserts regular 802.11 header
+* in place of A-MSDU subframe header. */
+   hdr = (struct ieee80211_hdr *)skb-data;
+   skb_pull(skb, ieee80211_hdrlen(hdr-frame_control));
+
+   /* A-MSDU subframe header length */
+   decap_len += 6 + 6 + 2;
+
+   memcpy(skb_put(amsdu, decap_len), decap_hdr, decap_len);
+   }
+
if (fmt == RX_MSDU_DECAP_RAW)
skb_trim(skb, skb-len - 4); /* remove FCS */
 
-- 
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/3] ath10k: cleanup amsdu rx

2013-04-24 Thread Michal Kazior
Clarify documentation, refactor the code to make
it possible to support other decap modes more
easily.

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

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 3fa0c1a..f572fba 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -595,41 +595,41 @@ static int ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
 
first = skb;
while (skb) {
-   int llclen = 0;
+   void *decap_hdr;
+   int decap_len = 0;
 
rxd = (void *)skb-data - sizeof(*rxd);
fmt = MS(__le32_to_cpu(rxd-msdu_start.info1),
RX_MSDU_START_INFO1_DECAP_FORMAT);
-   hdr = (void *)rxd-rx_hdr_status;
+   decap_hdr = (void *)rxd-rx_hdr_status;
+
+   if (skb == first) {
+   /* We receive linked A-MSDU subframe skbuffs. The
+* first one contains the original 802.11 header (and
+* possible crypto param) in the RX descriptor. The
+* A-MSDU subframe header follows that. Each part is
+* aligned to 4 byte boundary. */
+
+   hdr = (void *)amsdu-data;
+   decap_hdr += 
roundup(ieee80211_hdrlen(hdr-frame_control), 4);
+   decap_hdr += 
roundup(ath10k_htt_rx_crypto_param_len(enctype), 4);
+   }
 
if (fmt == RX_MSDU_DECAP_ETHERNET2_DIX) {
-   void *llc = (void *)skb-data - RX_HTT_HDR_STATUS_LEN;
-
-   /* We get rid of the addr[6] + addr[6] + ethertype[2]
-* as we don't need that at all.
-* For 8023/llc/snap we keep the original header
-* (addr[6] + addr[6] + len[2] + llc info) in msdu
-* since it is integral part of an A-MSDU subframe. */
+   /* Ethernet2 decap inserts ethernet header in place of
+* A-MSDU subframe header. */
skb_pull(skb, 6 + 6 + 2);
 
-   /* Regular LLC/SNAP has 8 bytes.
-* However when A-MSDU takes place FW decaps complete
-* LLC headers along with addr[6], addr[6], len[2].
-* This makes sense only for eth2/dix decap format.
-* FIXME: if we get different type of LLC this will fail
-*as not all LLCs have the 8 byte info */
-   llclen += 8;
-
-   /* addr[6] + addr[6] + len[2] */
-   llclen += 6 + 6 + 2;
-
-   if (skb == first) {
-   struct ieee80211_hdr *hdr = (void *)amsdu-data;
-   llc += 
roundup(ieee80211_hdrlen(hdr-frame_control), 4);
-   llc += 
roundup(ath10k_htt_rx_crypto_param_len(enctype), 4);
-   }
+   /* A-MSDU subframe header length */
+   decap_len += 6 + 6 + 2;
+
+   /* Ethernet2 decap also strips the LLC/SNAP so we need
+* to re-insert it. The LLC/SNAP follows A-MSDU
+* subframe header. */
+   /* FIXME: Not all LLCs are 8 bytes long */
+   decap_len += 8;
 
-   memcpy(skb_put(amsdu, llclen), llc, llclen);
+   memcpy(skb_put(amsdu, decap_len), decap_hdr, decap_len);
}
 
if (fmt == RX_MSDU_DECAP_RAW)
@@ -639,8 +639,8 @@ static int ath10k_htt_rx_amsdu(struct ath10k_htt *htt,
 
/* A-MSDU subframes are padded to 4bytes
 * but relative to first subframe, not the whole MPDU */
-   if (skb-next  ((llclen + skb-len)  3)) {
-   int padlen = 4 - ((llclen + skb-len)  3);
+   if (skb-next  ((decap_len + skb-len)  3)) {
+   int padlen = 4 - ((decap_len + skb-len)  3);
memset(skb_put(amsdu, padlen), 0, padlen);
}
 
-- 
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/2] ath10k: avoid null dereference on vif

2013-04-24 Thread Michal Kazior
The vif isn't really guaranteed to be non-NULL.

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6291935..6fbbb24 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1202,11 +1202,13 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff 
*skb)
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info-control.vif;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
-   struct ath10k *ar = arvif-ar;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-data;
struct ieee80211_key_conf *key = info-control.hw_key;
int ret;
 
+   if (!vif)
+   return;
+
/* TODO AP mode should be implemented */
if (vif-type != NL80211_IFTYPE_STATION)
return;
@@ -1226,7 +1228,7 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff 
*skb)
 
ath10k_dbg(ATH10K_DBG_MAC, new wep keyidx will be %d\n, key-keyidx);
 
-   ret = ath10k_wmi_vdev_set_param(ar, arvif-vdev_id,
+   ret = ath10k_wmi_vdev_set_param(arvif-ar, arvif-vdev_id,
WMI_VDEV_PARAM_DEF_KEYID,
key-keyidx);
if (ret) {
@@ -1244,6 +1246,9 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, 
struct sk_buff *skb)
struct ieee80211_vif *vif = info-control.vif;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 
+   if (!vif)
+   return;
+
/* This is case only for P2P_GO */
if (arvif-vdev_type != WMI_VDEV_TYPE_AP ||
arvif-vdev_subtype != WMI_VDEV_SUBTYPE_P2P_GO)
diff --git a/drivers/net/wireless/ath/ath10k/mac.h 
b/drivers/net/wireless/ath/ath10k/mac.h
index 272ba74..077b798 100644
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ b/drivers/net/wireless/ath/ath10k/mac.h
@@ -42,6 +42,9 @@ static inline void ath10k_tx_h_seq_no(struct sk_buff *skb)
struct ieee80211_vif *vif = info-control.vif;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 
+   if (!vif)
+   return;
+
if (info-flags   IEEE80211_TX_CTL_ASSIGN_SEQ) {
if (arvif-tx_seq_no == 0)
arvif-tx_seq_no = 0x1000;
-- 
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: monitor mode fixes

2013-04-24 Thread Michal Kazior
This cleans up some warnings during runtime.

Michal Kazior (2):
  ath10k: avoid null dereference on vif
  ath10k: don't advertise we want monitor vif

 drivers/net/wireless/ath/ath10k/mac.c |   10 +++---
 drivers/net/wireless/ath/ath10k/mac.h |3 +++
 2 files changed, 10 insertions(+), 3 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 2/2] ath10k: don't advertise we want monitor vif

2013-04-24 Thread Michal Kazior
We were triggering warnings in our code and
mac80211. We could fix the monitor state machine
in ath10k but it doesn't make much sense. We don't
benefit from having the monitor vif create in the
first place so just drop it.

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6fbbb24..15e3779 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2683,7 +2683,6 @@ int ath10k_mac_register(struct ath10k *ar)
IEEE80211_HW_REPORTS_TX_ACK_STATUS |
IEEE80211_HW_HAS_RATE_CONTROL |
IEEE80211_HW_SUPPORTS_STATIC_SMPS |
-   IEEE80211_HW_WANT_MONITOR_VIF |
IEEE80211_HW_AP_LINK_PS;
 
if (ar-ht_cap_info  WMI_HT_CAP_DYNAMIC_SMPS)
-- 
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/6] ath10k: pci cleanup

2013-04-24 Thread Michal Kazior
This gets rid of the ugly device/target resetting
retries. It also tries to simplify pci probing
logic.

Michal Kazior (6):
  ath10k: fix pci_set_drvpriv ordering
  ath10k: refactor pci interrupt functions
  ath10k: remove pci probe retrying
  ath10k: remove ath10k_pci_configure()
  ath10k: remove ath10k_pci_probe_device()
  ath10k: simplify pci target reset

 drivers/net/wireless/ath/ath10k/pci.c |  452 ++---
 1 file changed, 186 insertions(+), 266 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/6] ath10k: fix pci_set_drvpriv ordering

2013-04-24 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 0d1523b..5819c21 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2082,7 +2082,6 @@ err_stalled:
ath10k_pci_nointrs(ar);
 err_intr:
pci_disable_msi(ar_pci-pdev);
-   pci_set_drvdata(ar_pci-pdev, NULL);
 
return ret;
 }
@@ -2093,7 +2092,6 @@ static void ath10k_pci_teardown(struct ath10k *ar)
 
ath10k_pci_nointrs(ar);
pci_disable_msi(ar_pci-pdev);
-   pci_set_drvdata(ar_pci-pdev, NULL);
 }
 
 static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
@@ -2336,7 +2334,6 @@ retry:
return 0;
 
 err_tgtstate:
-   pci_set_drvdata(pdev, NULL);
ath10k_pci_device_reset(ar_pci);
 err_iomap:
pci_iounmap(pdev, mem);
@@ -2347,6 +2344,7 @@ err_region:
 err_device:
pci_disable_device(pdev);
 err_ar:
+   pci_set_drvdata(pdev, NULL);
ath10k_core_destroy(ar);
 err_ar_pci:
/* call HIF PCI free here */
-- 
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/6] ath10k: remove pci probe retrying

2013-04-24 Thread Michal Kazior
This is an ugly hack. It is better to simply reset
the target and wait until it wakes up. If that is
not enough the platform may be broken.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index df13454..78f7c72 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2153,23 +2153,52 @@ static void ath10k_pci_dump_features(struct ath10k_pci 
*ar_pci)
}
 }
 
+static int ath10k_pci_bring_up(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   u32 fw_indicator;
+
+   /*
+* Bring the target up cleanly.
+*
+* The target may be in an undefined state with an AUX-powered Target
+* and a Host in WoW mode. If the Host crashes, loses power, or is
+* restarted (without unloading the driver) then the Target is left
+* (aux) powered and running. On a subsequent driver load, the Target
+* is in an unexpected state. We try to catch that here in order to
+* reset the Target and retry the probe.
+*/
+   ath10k_pci_device_reset(ar_pci);
+
+   iowrite32(PCIE_SOC_WAKE_V_MASK,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   ath10k_pci_wait_for_target_to_awake(ar);
+
+   fw_indicator = ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS);
+   iowrite32(PCIE_SOC_WAKE_RESET,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   if (fw_indicator  FW_IND_INITIALIZED)
+   return -EIO;
+
+   return 0;
+}
+
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
void __iomem *mem;
-   int ret;
+   int ret = 0;
u32 hif_type;
-   int probe_again = 0;
struct ath10k *ar;
struct ath10k_pci *ar_pci;
-   u32 fw_indicator;
u32 lcr_val;
-   int retries = 3;
u32 target_type;
 
ath10k_dbg(ATH10K_DBG_PCI, %s\n, __func__);
-retry:
-   ret = 0;
 
ar_pci = kzalloc(sizeof(*ar_pci), GFP_KERNEL);
if (ar_pci == NULL)
@@ -2280,42 +2309,12 @@ retry:
 
ar_pci-cacheline_sz = dma_get_cache_alignment();
 
-   /*
-* Verify that the Target was started cleanly.
-*
-* The case where this is most likely is with an AUX-powered
-* Target and a Host in WoW mode. If the Host crashes,
-* loses power, or is restarted (without unloading the driver)
-* then the Target is left (aux) powered and running.  On a
-* subsequent driver load, the Target is in an unexpected state.
-* We try to catch that here in order to reset the Target and
-* retry the probe.
-*/
-   iowrite32(PCIE_SOC_WAKE_V_MASK,
- mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-   ath10k_pci_wait_for_target_to_awake(ar);
-
-   fw_indicator = ioread32(mem + FW_INDICATOR_ADDRESS);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   if (fw_indicator  FW_IND_INITIALIZED) {
-   probe_again++;
-   ath10k_err(target is in an unknown state. 
-  resetting (attempt %d).\n, probe_again);
-   /* ath10k_pci_device_reset, below, will reset the target */
-   ret = -EIO;
-   goto err_tgtstate;
+   ret = ath10k_pci_bring_up(ar);
+   if (ret) {
+   ath10k_err(could not bring up target\n);
+   goto err_iomap;
}
 
-   /*
-* retries are meant for early hw setup;
-* beyond this point it makes no sense to retry
-*/
-   retries = 0;
-
ret = ath10k_pci_configure(ar);
if (ret)
goto err_iomap;
@@ -2328,8 +2327,6 @@ retry:
 
return 0;
 
-err_tgtstate:
-   ath10k_pci_device_reset(ar_pci);
 err_iomap:
pci_iounmap(pdev, mem);
 err_master:
@@ -2345,13 +2342,6 @@ err_ar_pci:
/* call HIF PCI free here */
kfree(ar_pci);
 
-   /*
-* FIXME: for some reason qca_main loops probe
-* ATH_PCI_PROBE_RETRY_MAX times, do we need that in ath10k?
-*/
-   if (ret  retries--)
-   goto retry;
-
return ret;
 }
 
@@ -2374,7 +2364,6 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
 
ath10k_core_unregister(ar);
ath10k_pci_stop_intr(ar);
-   ath10k_pci_device_reset(ar_pci);
 
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, ar_pci-mem);
-- 
1.7.9.5

___
ath9k-devel mailing list

[ath9k-devel] [PATCH 2/6] ath10k: refactor pci interrupt functions

2013-04-24 Thread Michal Kazior
This patch splits the interrupt registering
function into separate functions. Hopefully this
is more readable and maintanable.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 5819c21..df13454 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1861,47 +1861,99 @@ static void ath10k_pci_tasklet(unsigned long data)
}
 }
 
-static void ath10k_pci_nointrs(struct ath10k *ar)
+static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
 {
-   int i;
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   int ret;
+   int i;
 
-   if (ar_pci-num_msi_intrs  0) {
-   /* MSI interrupt(s) */
-   for (i = 0; i  ar_pci-num_msi_intrs; i++)
+   ret = pci_enable_msi_block(ar_pci-pdev, num);
+   if (ret)
+   return ret;
+
+   ar_pci-num_msi_intrs = num;
+   ret = request_irq(ar_pci-pdev-irq + MSI_ASSIGN_FW,
+ ath10k_pci_msi_fw_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret)
+   return ret;
+
+   for (i = MSI_ASSIGN_CE_INITIAL; i = MSI_ASSIGN_CE_MAX; i++) {
+   ret = request_irq(ar_pci-pdev-irq + i,
+ ath10k_pci_per_engine_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret) {
+   ath10k_warn(request_irq(%d) failed %d\n,
+   ar_pci-pdev-irq + i, ret);
+
+   for (; i = MSI_ASSIGN_CE_INITIAL; i--)
+   free_irq(ar_pci-pdev-irq, ar);
+
+   pci_disable_msi(ar_pci-pdev);
+   return ret;
+   }
+   }
+
+   ret = request_irq(ar_pci-pdev-irq,
+ ath10k_pci_interrupt_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret) {
+   for (i = MSI_ASSIGN_CE_INITIAL; i = MSI_ASSIGN_CE_MAX; i++)
free_irq(ar_pci-pdev-irq + i, ar);
-   ar_pci-num_msi_intrs = 0;
-   } else
-   /* Legacy PCI line interrupt */
-   free_irq(ar_pci-pdev-irq, ar);
+
+   pci_disable_msi(ar_pci-pdev);
+   return ret;
+   }
+
+   return 0;
 }
 
-static int ath10k_pci_reset_target(struct ath10k *ar)
+static int ath10k_pci_start_intr_msi(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   int wait_limit = 300; /* 3 sec */
+   int ret;
 
-   while (wait_limit-- 
-  !(ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS) 
-FW_IND_INITIALIZED)) {
+   ret = pci_enable_msi(ar_pci-pdev);
+   if (ret  0)
+   return ret;
 
-   if (ar_pci-num_msi_intrs == 0)
-   /* Fix potential race by repeating CORE_BASE writes */
-   iowrite32(PCIE_INTR_FIRMWARE_MASK |
- PCIE_INTR_CE_MASK_ALL,
- ar_pci-mem + (SOC_CORE_BASE_ADDRESS |
-PCIE_INTR_ENABLE_ADDRESS));
-   mdelay(10);
+   ret = request_irq(ar_pci-pdev-irq,
+ ath10k_pci_interrupt_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret  0) {
+   pci_disable_msi(ar_pci-pdev);
+   return ret;
}
 
-   if (wait_limit  0) {
-   ath10k_err(Target stalled\n);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-   return -EIO;
-   }
+   return 0;
+}
+
+static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 
+   /*
+* Make sure to wake the Target before enabling Legacy
+* Interrupt.
+*/
+   iowrite32(PCIE_SOC_WAKE_V_MASK,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   ath10k_pci_wait_for_target_to_awake(ar);
+
+   /*
+* A potential race occurs here: The CORE_BASE write
+* depends on target correctly decoding AXI address but
+* host won't know when target writes BAR to CORE_CTRL.
+* This write might get lost if target has NOT written BAR.
+* For now, fix the race by repeating the write in below
+* synchronization checking.
+*/
+   iowrite32(PCIE_INTR_FIRMWARE_MASK |
+ PCIE_INTR_CE_MASK_ALL,
+ ar_pci-mem + (SOC_CORE_BASE_ADDRESS |
+

[ath9k-devel] [PATCH 5/6] ath10k: remove ath10k_pci_probe_device()

2013-04-24 Thread Michal Kazior
No need to have probing logic scattered all over
the place.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index b97d497..05bb324 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1664,47 +1664,6 @@ static void ath10k_pci_ce_init(struct ath10k *ar)
   ath10k_pci_bmi_recv_data);
 }
 
-/*
- * Called from PCI layer whenever a new PCI device is probed.
- * Initializes per-device HIF state.
- */
-static int ath10k_pci_probe_device(struct ath10k *ar)
-{
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   int ret;
-
-   atomic_set(ar_pci-keep_awake_count, 0);
-   ar_pci-fw_indicator_address = FW_INDICATOR_ADDRESS;
-
-   if (ath10k_target_ps)
-   ath10k_dbg(ATH10K_DBG_PCI, on-chip power save enabled\n);
-   else {
-   /* Force AWAKE forever */
-   ath10k_dbg(ATH10K_DBG_PCI, on-chip power save disabled\n);
-   ath10k_do_pci_wake(ar);
-   }
-
-   ath10k_pci_ce_init(ar);
-
-   ret = ath10k_pci_init_config(ar);
-   if (ret) {
-   ath10k_pci_ce_deinit(ar);
-   goto ce_deinit;
-   }
-
-   ret = ath10k_pci_wake_target_cpu(ar);
-   if (ret) {
-   ath10k_err(Unable to wakeup target CPU\n);
-   goto ce_deinit;
-   }
-
-   return 0;
-
-ce_deinit:
-   ath10k_pci_ce_deinit(ar);
-   return ret;
-}
-
 static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
@@ -2216,6 +2175,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
}
 
ar_pci-ar = ar;
+   ar_pci-fw_indicator_address = FW_INDICATOR_ADDRESS;
+   atomic_set(ar_pci-keep_awake_count, 0);
+
pci_set_drvdata(pdev, ar);
 
/*
@@ -2300,20 +2262,36 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
if (ret)
goto err_intr;
 
-   if (ath10k_pci_probe_device(ar)) {
-   ath10k_err(failed to probe target\n);
-   ret = -EIO;
-   goto err_intr;
+   if (ath10k_target_ps)
+   ath10k_dbg(ATH10K_DBG_PCI, on-chip power save enabled\n);
+   else {
+   /* Force AWAKE forever */
+   ath10k_dbg(ATH10K_DBG_PCI, on-chip power save disabled\n);
+   ath10k_do_pci_wake(ar);
+   }
+
+   ath10k_pci_ce_init(ar);
+
+   ret = ath10k_pci_init_config(ar);
+   if (ret)
+   goto err_ce;
+
+   ret = ath10k_pci_wake_target_cpu(ar);
+   if (ret) {
+   ath10k_err(could not wake up target CPU (%d)\n, ret);
+   goto err_ce;
}
 
ret = ath10k_core_register(ar);
if (ret) {
ath10k_err(could not register driver core (%d)\n, ret);
-   goto err_intr;
+   goto err_ce;
}
 
return 0;
 
+err_ce:
+   ath10k_pci_ce_deinit(ar);
 err_intr:
ath10k_pci_stop_intr(ar);
 err_iomap:
-- 
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/6] ath10k: remove ath10k_pci_configure()

2013-04-24 Thread Michal Kazior
This moves the contents of the function directly
into the pci probing function. Doesn't make sense
to have probe logic scattered so much around.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 78f7c72..b97d497 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2064,31 +2064,6 @@ static int ath10k_pci_reset_target(struct ath10k *ar)
return 0;
 }
 
-static int ath10k_pci_configure(struct ath10k *ar)
-{
-   int ret = 0;
-
-   ret = ath10k_pci_start_intr(ar);
-   if (ret) {
-   ath10k_err(could not start interrupt handling (%d)\n, ret);
-   return ret;
-   }
-
-   ret = ath10k_pci_reset_target(ar);
-   if (ret) {
-   ath10k_pci_stop_intr(ar);
-   return ret;
-   }
-
-   if (ath10k_pci_probe_device(ar)) {
-   ath10k_err(Target probe failed\n);
-   ath10k_pci_stop_intr(ar);
-   return -EIO;
-   }
-
-   return 0;
-}
-
 static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 {
struct ath10k *ar = ar_pci-ar;
@@ -2315,18 +2290,32 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
goto err_iomap;
}
 
-   ret = ath10k_pci_configure(ar);
-   if (ret)
+   ret = ath10k_pci_start_intr(ar);
+   if (ret) {
+   ath10k_err(could not start interrupt handling (%d)\n, ret);
goto err_iomap;
+   }
+
+   ret = ath10k_pci_reset_target(ar);
+   if (ret)
+   goto err_intr;
+
+   if (ath10k_pci_probe_device(ar)) {
+   ath10k_err(failed to probe target\n);
+   ret = -EIO;
+   goto err_intr;
+   }
 
ret = ath10k_core_register(ar);
if (ret) {
-   ath10k_pci_stop_intr(ar);
-   goto err_iomap;
+   ath10k_err(could not register driver core (%d)\n, ret);
+   goto err_intr;
}
 
return 0;
 
+err_intr:
+   ath10k_pci_stop_intr(ar);
 err_iomap:
pci_iounmap(pdev, mem);
 err_master:
-- 
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/6] ath10k: simplify pci target reset

2013-04-24 Thread Michal Kazior
We already have a function that resets the target
and waits until it has awoken.

We can also change the ordering and combine device
reset with target reset altogether.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 05bb324..3b722c4 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2087,40 +2087,6 @@ static void ath10k_pci_dump_features(struct ath10k_pci 
*ar_pci)
}
 }
 
-static int ath10k_pci_bring_up(struct ath10k *ar)
-{
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   u32 fw_indicator;
-
-   /*
-* Bring the target up cleanly.
-*
-* The target may be in an undefined state with an AUX-powered Target
-* and a Host in WoW mode. If the Host crashes, loses power, or is
-* restarted (without unloading the driver) then the Target is left
-* (aux) powered and running. On a subsequent driver load, the Target
-* is in an unexpected state. We try to catch that here in order to
-* reset the Target and retry the probe.
-*/
-   ath10k_pci_device_reset(ar_pci);
-
-   iowrite32(PCIE_SOC_WAKE_V_MASK,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   ath10k_pci_wait_for_target_to_awake(ar);
-
-   fw_indicator = ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   if (fw_indicator  FW_IND_INITIALIZED)
-   return -EIO;
-
-   return 0;
-}
-
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
@@ -2246,18 +2212,24 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 
ar_pci-cacheline_sz = dma_get_cache_alignment();
 
-   ret = ath10k_pci_bring_up(ar);
-   if (ret) {
-   ath10k_err(could not bring up target\n);
-   goto err_iomap;
-   }
-
ret = ath10k_pci_start_intr(ar);
if (ret) {
ath10k_err(could not start interrupt handling (%d)\n, ret);
goto err_iomap;
}
 
+   /*
+* Bring the target up cleanly.
+*
+* The target may be in an undefined state with an AUX-powered Target
+* and a Host in WoW mode. If the Host crashes, loses power, or is
+* restarted (without unloading the driver) then the Target is left
+* (aux) powered and running. On a subsequent driver load, the Target
+* is in an unexpected state. We try to catch that here in order to
+* reset the Target and retry the probe.
+*/
+   ath10k_pci_device_reset(ar_pci);
+
ret = ath10k_pci_reset_target(ar);
if (ret)
goto err_intr;
-- 
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 4/5] ath10k: make iee80211 iface combination structures static

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

 On 24/04/13 08:37, Kalle Valo wrote:
 Nothing modifies them.

 I think the title should be s/static/const/

Yup, I fixed that in my branch.

Thanks for review.

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


Re: [ath9k-devel] [PATCH] ath10k: kill ar9888def.h file

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

 Move ar9888 definitions to hw.h file.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@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 v2 0/6] ath10k: cleanups

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

 Rebased on the tip of master branch.

 Michal Kazior (6):
   ath10k: rename htt_struct
   ath10k: fix code style
   ath10k: fix code style of handling errors
   ath10k: fix code style a little
   ath10k: cleanup tx/rx mode handling
   ath10k: cleanup hw init-related code

Thanks, applied. Patch 6 had conflicts, please check.

BTW, 3-way merge didn't work:

Applying: ath10k: cleanup hw init-related code
fatal: sha1 information is lacking or useless
(drivers/net/wireless/ath/ath10k/hw.h).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0006 ath10k: cleanup hw init-related code

Are you sure you don't have any custom patches as parent of the patchset
you are submitting? Or do you submit patches somehow differently?

The thing is that I really would like the patches have proper sha1
information. It makes my life so much easier.

-- 
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: cleanup - respin

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

 Couple of updated patches.

 Bartosz Markowski (3):
   ath10k: remove excessive CONFIG_PM_SLEEP checks
   ath10k: kill PCIE_LOCAL_REG_READ/WRITE macros
   ath10k: update supported firmware tag to .599

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 cleanups

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

 Bartosz Markowski (3):
   ath10k: update FIXME comments
   ath10k: rename WAR_CE_SRC_RING_WRITE_IDX_SET
   ath10k: replace TARGET_READ/WRITE macros with inline funcitons

Thanks, applied.

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


Re: [ath9k-devel] [RFC 0/2] ath10k: fix qos workaround

2013-04-24 Thread Sujith Manoharan
Michal Kazior wrote:
 From what I've observed so far is frames in
 monitor mode (non promiscuous) are corrupted. They
 have the QoS Control stripped, with LLC header
 finding itself in the QoS Control. Wireshark shows
 such packets as A-MSDU corrupted frames. I tried
 restoring the QoS Control but it didn't fix that.

I don't understand. Why should pure monitor mode care about
the TX path ?

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


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

2013-04-24 Thread Michal Kazior
On 24/04/13 12:35, Kalle Valo wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 Rebased on the tip of master branch.

 Michal Kazior (6):
ath10k: rename htt_struct
ath10k: fix code style
ath10k: fix code style of handling errors
ath10k: fix code style a little
ath10k: cleanup tx/rx mode handling
ath10k: cleanup hw init-related code

 Thanks, applied. Patch 6 had conflicts, please check.

Patch 6 is incomplete. I'll send a follow up patch to fix it.


 BTW, 3-way merge didn't work:

 Applying: ath10k: cleanup hw init-related code
 fatal: sha1 information is lacking or useless
 (drivers/net/wireless/ath/ath10k/hw.h).
 Repository lacks necessary blobs to fall back on 3-way merge.
 Cannot fall back to three-way merge.
 Patch failed at 0006 ath10k: cleanup hw init-related code

 Are you sure you don't have any custom patches as parent of the patchset
 you are submitting? Or do you submit patches somehow differently?

I try to send patchsets rebased upon github master branch. Some 
patchsets have subtle dependencies between each other and I didn't 
rebase those (since there would be conflicts anyways). I'll rebase 
everything from now on.


-- 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/7] ath10k: more cleanup

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

 Bartosz Markowski (7):
   ath10k: Print more elgant HW name/version
   ath10k: shift ath10k_generic_iter structure to mac header
   ath10k: kill HIF_TYPE_AR9888
   ath10k: shift REG_DUMP_COUNT_AR9888 to pci block
   ath10k: move DIAG_TRANSFER_LIMIT to pci block
   ath10k: remove leftover prototypes
   ath10k: rename ath10k_pci_wait_for_target_to_awake

Thanks, applied. Patch 4 had conflicts but git took care of that.

But there's a new warning now:

drivers/net/wireless/ath/ath10k/pci.c: In function 'ath10k_pci_probe':
drivers/net/wireless/ath/ath10k/pci.c:2150:6: warning: unused variable 
'hif_type' [-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 0/7] ath10k: more cleanup

2013-04-24 Thread Markowski Bartosz
On 24/04/13 13:03, Kalle Valo wrote:
 Bartosz Markowski bartosz.markow...@tieto.com writes:

 Bartosz Markowski (7):
ath10k: Print more elgant HW name/version
ath10k: shift ath10k_generic_iter structure to mac header
ath10k: kill HIF_TYPE_AR9888
ath10k: shift REG_DUMP_COUNT_AR9888 to pci block
ath10k: move DIAG_TRANSFER_LIMIT to pci block
ath10k: remove leftover prototypes
ath10k: rename ath10k_pci_wait_for_target_to_awake
 Thanks, applied. Patch 4 had conflicts but git took care of that.

 But there's a new warning now:

 drivers/net/wireless/ath/ath10k/pci.c: In function 'ath10k_pci_probe':
 drivers/net/wireless/ath/ath10k/pci.c:2150:6: warning: unused variable 
 'hif_type' [-Wunused-variable]


oops, sorry. I will fix it.

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


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

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

 On 24/04/13 12:35, Kalle Valo wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 Rebased on the tip of master branch.

 Michal Kazior (6):
ath10k: rename htt_struct
ath10k: fix code style
ath10k: fix code style of handling errors
ath10k: fix code style a little
ath10k: cleanup tx/rx mode handling
ath10k: cleanup hw init-related code

 Thanks, applied. Patch 6 had conflicts, please check.

 Patch 6 is incomplete. I'll send a follow up patch to fix it.

Our emails crossed. I already pushed a patch to fix my error. Sorry
about that.

 BTW, 3-way merge didn't work:

 Applying: ath10k: cleanup hw init-related code
 fatal: sha1 information is lacking or useless
 (drivers/net/wireless/ath/ath10k/hw.h).
 Repository lacks necessary blobs to fall back on 3-way merge.
 Cannot fall back to three-way merge.
 Patch failed at 0006 ath10k: cleanup hw init-related code

 Are you sure you don't have any custom patches as parent of the patchset
 you are submitting? Or do you submit patches somehow differently?

 I try to send patchsets rebased upon github master branch. Some
 patchsets have subtle dependencies between each other and I didn't
 rebase those (since there would be conflicts anyways). I'll rebase
 everything from now on.

Yeah, even if you know patches conflict it's still a lot easier for me
to handle the conflicts with 3-way merge than have useless sha1
informwation. 3-way merge is so good.

Of course in some cases depending on uncommitted patches is justified,
but even when it would be better to plan beforehand. For example, we
could freeze the tree, or something like that, just to avoid conflicts.

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


[ath9k-devel] [PATCH] ath10k: fix compilation warning

2013-04-24 Thread Bartosz Markowski
In function ‘ath10k_pci_probe’:
/wireless-testing/drivers/net/wireless/ath/ath10k/pci.c:2150:
warning: unused variable ‘hif_type’

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index c803a56..b6a7a8b 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2147,7 +2147,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 {
void __iomem *mem;
int ret;
-   u32 hif_type;
int probe_again = 0;
struct ath10k *ar;
struct ath10k_pci *ar_pci;
-- 
1.7.10

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


Re: [ath9k-devel] [PATCH 0/5] ath10k: making static variables const

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

 Did some review of static variables and noticed that
 we had quite a few variables which were not const.

 Please review carefully, I might have missed something.

 ---

 Kalle Valo (5):
   ath10k: make rx_legacy_rate_idx variable const
   ath10k: make host_ce_config_wlan static variable const
   ath10k: make target_ce_config_wlan and target_service_to_ce_map_wlan 
 const
   ath10k: make iee80211 iface combination structures static
   ath10k: copy ieee80211_supported_band for each instance

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: kill static int max_delay

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

 Kill static variable max_delay.
 Move this to struct ath10k_pci.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
 ---
  drivers/net/wireless/ath/ath10k/pci.c |5 ++---
  drivers/net/wireless/ath/ath10k/pci.h |2 ++
  2 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
 b/drivers/net/wireless/ath/ath10k/pci.c
 index 0d1523b..9ee678a 100644
 --- a/drivers/net/wireless/ath/ath10k/pci.c
 +++ b/drivers/net/wireless/ath/ath10k/pci.c
 @@ -445,7 +445,6 @@ void ath10k_do_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;
  
 @@ -475,8 +474,8 @@ void ath10k_do_pci_wake(struct ath10k *ar)
   curr_delay += 5;
   }
  
 - if (tot_delay  max_delay)
 - max_delay = tot_delay;
 + if (tot_delay  ar_pci-max_delay)
 + ar_pci-max_delay = tot_delay;
  }

But do we use this max_delay value for anything sensible? The way I see
it we only store values but don't do anything with it. Unless I'm
missing something, of course.

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


Re: [ath9k-devel] [PATCH 0/6] ath10k: pci cleanup

2013-04-24 Thread Michal Kazior
On 24/04/13 12:19, Kazior Michal wrote:
 This gets rid of the ugly device/target resetting
 retries. It also tries to simplify pci probing
 logic.

Please do not apply this yet. CUS223 2.0 doesn't seem to like this patchset.


-- 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/2] ath10k: htt fixes

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

 This one addresses a rare memory leak when FW
 hangs leaving some HTT tx transactions unfinished.

 Michal Kazior (2):
   ath10k: clear pending_tx[] upon tx completion
   ath10k: cleanup htt pending tx

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: kill static int max_delay

2013-04-24 Thread Janusz.Dziedzic
-Original Message-
From: Kalle Valo [mailto:kv...@qca.qualcomm.com]
Sent: 24 kwietnia 2013 13:21
To: Dziedzic Janusz
Cc: ath9k-devel@lists.ath9k.org
Subject: Re: [ath9k-devel] [PATCH] ath10k: kill static int max_delay

Janusz Dziedzic janusz.dzied...@tieto.com writes:

 Kill static variable max_delay.
 Move this to struct ath10k_pci.

 Signed-off-by: Janusz Dziedzic janusz.dzied...@tieto.com
 ---
  drivers/net/wireless/ath/ath10k/pci.c |5 ++---
  drivers/net/wireless/ath/ath10k/pci.h |2 ++
  2 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/drivers/net/wireless/ath/ath10k/pci.c
 b/drivers/net/wireless/ath/ath10k/pci.c
 index 0d1523b..9ee678a 100644
 --- a/drivers/net/wireless/ath/ath10k/pci.c
 +++ b/drivers/net/wireless/ath/ath10k/pci.c
 @@ -445,7 +445,6 @@ void ath10k_do_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;

 @@ -475,8 +474,8 @@ void ath10k_do_pci_wake(struct ath10k *ar)
  curr_delay += 5;
  }

 -if (tot_delay  max_delay)
 -max_delay = tot_delay;
 +if (tot_delay  ar_pci-max_delay)
 +ar_pci-max_delay = tot_delay;
  }

But do we use this max_delay value for anything sensible? The way I see it we
only store values but don't do anything with it. Unless I'm missing something,
of course.

Seems you right, we don't use this variable. So I think we can remove this.

BR
Janusz

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


Re: [ath9k-devel] [PATCH 2/2] ath10k: don't advertise we want monitor vif

2013-04-24 Thread Sujith Manoharan
Michal Kazior wrote:
 We were triggering warnings in our code and
 mac80211. We could fix the monitor state machine
 in ath10k but it doesn't make much sense. We don't
 benefit from having the monitor vif create in the
 first place so just drop it.

What warnings ?

I think this flag is required, mac80211 uses it to notify
the driver to create an explicit monitor interface.

For example:

* Create a monitor interface

* Add a station interface
  (Now, mac80211 deletes the first monitor interface in the driver,
   but it is maintained internally in the stack).

* Delete the station interface.
  (mac80211 recreates the first monitor interface now, because
   the WANT_MONITOR_FLAG is set).

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


[ath9k-devel] [PATCH] ath10k: fix supported band setup

2013-04-24 Thread Michal Kazior
This fixes a crash and a possible memleak.

Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
This was introduced just recently.

 drivers/net/wireless/ath/ath10k/mac.c |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ded1ea9..7d985be 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2658,16 +2658,19 @@ int ath10k_mac_register(struct ath10k *ar)
ar-hw-wiphy-bands[IEEE80211_BAND_2GHZ] = band;
}
 
-
-
if (ar-phy_capability  WHAL_WLAN_11A_CAPABILITY) {
channels = kmemdup(ath10k_5ghz_channels,
   sizeof(ath10k_5ghz_channels),
   GFP_KERNEL);
-   if (!channels)
+   if (!channels) {
+   if (ar-phy_capability  WHAL_WLAN_11G_CAPABILITY) {
+   band = ar-mac.sbands[IEEE80211_BAND_2GHZ];
+   kfree(band-channels);
+   }
return -ENOMEM;
+   }
 
-   band = ar-mac.sbands[IEEE80211_BAND_2GHZ];
+   band = ar-mac.sbands[IEEE80211_BAND_5GHZ];
band-n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
band-channels = channels;
band-n_bitrates = ath10k_a_rates_size;
-- 
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] ath10k: kill static int max_delay

2013-04-24 Thread Janusz Dziedzic
Kill not used max_delay variable

Signed-off-by: Janusz Dziedzic janusz.dzie...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 40ca6d3..861da39 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -431,7 +431,6 @@ void ath10k_do_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;
 
@@ -460,9 +459,6 @@ void ath10k_do_pci_wake(struct ath10k *ar)
if (curr_delay  50)
curr_delay += 5;
}
-
-   if (tot_delay  max_delay)
-   max_delay = tot_delay;
 }
 
 void ath10k_do_pci_sleep(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 v2 1/3] ath10k: WMI API updates

2013-04-24 Thread Sujith Manoharan
Sujith Manoharan wrote:
 From: Sujith Manoharan c_man...@qca.qualcomm.com
 
 To sync with new FW ver .614

A rebased patch below.
(Also, 
http://msujith.org/patches/wl/Apr-24-2013/0005-ath10k-WMI-API-updates.patch).

Sujith

[PATCH] ath10k: WMI API updates

To sync with new FW ver .614

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/hw.h  |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c |  1 +
 drivers/net/wireless/ath/ath10k/wmi.h | 12 
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 2e6fed9..453cc6c 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -26,7 +26,7 @@
 #define SUPPORTED_FW_MAJOR 1
 #define SUPPORTED_FW_MINOR 0
 #define SUPPORTED_FW_RELEASE   0
-#define SUPPORTED_FW_BUILD 599
+#define SUPPORTED_FW_BUILD 614
 
 /* AR9888 1.0 definitions */
 #define AR9888_HW_1_0_VERSION  0x402c
@@ -70,6 +70,7 @@ enum ath10k_mcast2ucast_mode {
 #define TARGET_AST_SKID_LIMIT  16
 #define TARGET_NUM_PEERS   16
 #define TARGET_NUM_OFFLOAD_PEERS   0
+#define TARGET_NUM_OFFLOAD_REORDER_BUFS 0
 #define TARGET_NUM_PEER_KEYS   2
 #define TARGET_NUM_TIDS(2 * 
((TARGET_NUM_PEERS) + (TARGET_NUM_VDEVS)))
 #define TARGET_TX_CHAIN_MASK   (BIT(0) | BIT(1) | BIT(2))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index b6048c1..0a853f2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1235,6 +1235,7 @@ int ath10k_wmi_cmd_init(struct ath10k *ar)
.num_vdevs = __cpu_to_le32(TARGET_NUM_VDEVS),
.num_peers = __cpu_to_le32(TARGET_NUM_PEERS + TARGET_NUM_VDEVS),
.num_offload_peers = __cpu_to_le32(TARGET_NUM_OFFLOAD_PEERS),
+   .num_offload_reorder_bufs = 
__cpu_to_le32(TARGET_NUM_OFFLOAD_REORDER_BUFS),
.num_peer_keys = __cpu_to_le32(TARGET_NUM_PEER_KEYS),
.num_tids = __cpu_to_le32(TARGET_NUM_TIDS),
.ast_skid_limit = __cpu_to_le32(TARGET_AST_SKID_LIMIT),
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h 
b/drivers/net/wireless/ath/ath10k/wmi.h
index 50f94a37..4f0dd7e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -378,6 +378,8 @@ enum wmi_cmd_id {
WMI_DBGLOG_CFG_CMDID,
WMI_PDEV_QVIT_CMDID,
WMI_PDEV_FTM_INTG_CMDID,
+   WMI_VDEV_SET_KEEPALIVE_CMDID,
+   WMI_VDEV_GET_KEEPALIVE_CMDID,
WMI_PDEV_UTF_CMDID,
 };
 
@@ -440,6 +442,8 @@ enum wmi_event_id {
WMI_PDEV_QVIT_EVENTID,
WMI_WLAN_PROFILE_DATA_EVENTID,
WMI_PDEV_FTM_INTG_EVENTID,
+   WMI_WLAN_FREQ_AVOID_EVENTID,
+   WMI_VDEV_GET_KEEPALIVE_EVENTID,
WMI_PDEV_UTF_EVENTID,
 };
 
@@ -748,6 +752,9 @@ struct wmi_resource_config {
 */
__le32 num_offload_peers;
 
+   /* For target-based RX reordering */
+   __le32 num_offload_reorder_bufs;
+
/* number of keys per peer */
__le32 num_peer_keys;
 
@@ -1056,6 +1063,9 @@ struct wmi_start_scan_cmd {
__le32 probe_delay;
/* Scan control flags */
__le32 scan_ctrl_flags;
+
+   /* Burst duration time in msecs */
+   __le32 burst_duration;
/*
 * TLV (tag length value )  paramerters follow the scan_cmd structure.
 * TLV can contain channel list, bssid list, ssid list and
@@ -2040,6 +2050,8 @@ enum wmi_vdev_param {
WMI_VDEV_PARAM_MCAST_INDICATE,
/* Tx DHCP packet indicate Enable/Disable */
WMI_VDEV_PARAM_DHCP_INDICATE,
+   /* Enable host inspection of Tx unicast packet to unknown destination */
+   WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
 
/* The minimum amount of time AP begins to consider STA inactive */
WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
-- 
1.8.2.1

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


Re: [ath9k-devel] [PATCH 2/2] ath10k: don't advertise we want monitor vif

2013-04-24 Thread Michal Kazior
On 24/04/13 13:36, Sujith Manoharan wrote:
 Michal Kazior wrote:
 We were triggering warnings in our code and
 mac80211. We could fix the monitor state machine
 in ath10k but it doesn't make much sense. We don't
 benefit from having the monitor vif create in the
 first place so just drop it.
 
 What warnings ?

Commands:

; ifconfig wlan1 up
; iw wlan1 connect -w dd-wrt-open
wlan1 (phy #20): connected to 68:7f:74:0a:ca:80
; iw wlan1 interface add mon type monitor
; ifconfig mon up
; ifconfig wlan1 down


Dmesg:

[ 1989.477975] ath10k: Only one monitor interface allowed
[ 1989.478016] ath10k: ath10k_htc_notify_tx_completion: ep 2 skb 
880220e480c0
[ 1989.481481] [ cut here ]
[ 1989.486963] WARNING: at net/mac80211/iface.c:386 
ieee80211_add_virtual_monitor+0xe4/0x154 [mac80211]()
[ 1989.489749] Hardware name: Latitude E6420
[ 1989.494853] Modules linked in: ath10k_pci(O) ath10k_core(O) ath3k ipt_REJECT 
nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack xt_comment xt_tcpudp 
iptable_filter ip_tables x_tables bnep rfcomm ext2 btusb bluetooth 
snd_hda_codec_hdmi arc4 snd_hda_codec_idt snd_hda_intel snd_hda_codec snd_hwdep 
acpi_cpufreq iwldvm snd_pcm_oss snd_mixer_oss coretemp mac80211 joydev snd_pcm 
kvm_intel snd_seq_midi iwlwifi ath snd_rawmidi kvm cfg80211 snd_seq_midi_event 
snd_seq ppdev ehci_pci dell_wmi snd_timer snd_seq_device snd sparse_keymap 
ehci_hcd microcode soundcore usbcore psmouse serio_raw rfkill dell_laptop 
dcdbas usb_common lpc_ich mfd_core snd_page_alloc parport_pc evdev mperf 
battery ac processor lp parport loop ext4 mbcache jbd2 crc16 sha256_generic 
dm_crypt dm_mod sr_mod sd_mod crc_t10dif cdrom i915 drm_kms_helper drm 
i2c_algo_bit crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd 
lrw aes_x86_64 xts gf128mul ahci libahci sdhci_pci e1000e wmi libata sdhci ptp 
button i2c
_core mmc_core scsi_mod thermal video pps_core thermal_sys [last unloaded: 
ath10k_core]
[ 1989.529489] Pid: 13722, comm: ifconfig Tainted: GW  O 
3.9.0-rc6-wl-ath10k+ #27
[ 1989.535284] Call Trace:
[ 1989.540865]  [810439f4] warn_slowpath_common+0x7e/0x98
[ 1989.546691]  [81043a23] warn_slowpath_null+0x15/0x17
[ 1989.552393]  [a066f364] ieee80211_add_virtual_monitor+0xe4/0x154 
[mac80211]
[ 1989.558234]  [a066fa70] ieee80211_do_stop+0x545/0x554 [mac80211]
[ 1989.564011]  [a066fa94] ieee80211_stop+0x15/0x19 [mac80211]
[ 1989.569579]  [8130e4a7] __dev_close_many+0x97/0xbf
[ 1989.575240]  [8130e512] __dev_close+0x43/0x62
[ 1989.580956]  [81313d6b] __dev_change_flags+0xa6/0x129
[ 1989.586554]  [81313e5d] dev_change_flags+0x19/0x4f
[ 1989.592177]  [8136e3ab] devinet_ioctl+0x28d/0x58b
[ 1989.597712]  [8136eda0] inet_ioctl+0x87/0xa2
[ 1989.603262]  [812fc18c] sock_do_ioctl+0x22/0x41
[ 1989.608740]  [812fc619] sock_ioctl+0x20e/0x21c
[ 1989.614138]  [8113bb77] do_vfs_ioctl+0x465/0x4a6
[ 1989.619686]  [81143c55] ? fcheck_files+0xa9/0xe7
[ 1989.625088]  [8113bc11] sys_ioctl+0x59/0x80
[ 1989.630644]  [81206cae] ? trace_hardirqs_on_thunk+0x3a/0x3f
[ 1989.636089]  [813f4269] system_call_fastpath+0x16/0x1b
[ 1989.641483] ---[ end trace 549c97fd542fd00f ]---


 I think this flag is required, mac80211 uses it to notify
 the driver to create an explicit monitor interface.

Depending on how we want to make it work.

The flag is only useful if we want to know if there are monitor interfaces 
active only.

Right now we can create the monitor vdev in two ways:
 * config() callback and CONF_CHANGE_MONITOR
 * add_interface() callback with TYPE_MONITOR

Really depends on what we want to support.

I just tested the following:

; iw wlan1 interface add mon type monitor
; ifconfig mon up
; tcpdump -ni mon 
; ifconfig wlan1 up
; iw wlan1 connect -w dd-wrt-open
wlan1 (phy #20): connected to 68:7f:74:0a:ca:80

Right after association FW dumps.

However if I first associate and then start monitor - no dumps.

FW dump also happens if I try to do packet injection in
real monitor mode.

Considering how stable monitor mode is perhaps we should start
monitor vdev only when there's the monitor vif present? (right now
we can start it without the vdev). If so then we drop this patch.
And we probably also should forbid packet injection, at least until
FW gets this sorted out.


-- 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 v2 0/6] ath10k: pci cleanup

2013-04-24 Thread Michal Kazior
This gets rid of the ugly device/target resetting
retries. It also tries to simplify pci probing
logic.

v2: fixes MSI-X and legacy interrupts
adds/changes a few prints

Michal Kazior (6):
  ath10k: fix pci_set_drvpriv ordering
  ath10k: refactor pci interrupt functions
  ath10k: remove pci probe retrying
  ath10k: remove ath10k_pci_configure()
  ath10k: remove ath10k_pci_probe_device()
  ath10k: simplify pci target reset

 drivers/net/wireless/ath/ath10k/pci.c |  451 ++---
 1 file changed, 185 insertions(+), 266 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/6] ath10k: fix pci_set_drvpriv ordering

2013-04-24 Thread Michal Kazior
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/pci.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 40ca6d3..20e6371 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2066,7 +2066,6 @@ err_stalled:
ath10k_pci_nointrs(ar);
 err_intr:
pci_disable_msi(ar_pci-pdev);
-   pci_set_drvdata(ar_pci-pdev, NULL);
 
return ret;
 }
@@ -2077,7 +2076,6 @@ static void ath10k_pci_teardown(struct ath10k *ar)
 
ath10k_pci_nointrs(ar);
pci_disable_msi(ar_pci-pdev);
-   pci_set_drvdata(ar_pci-pdev, NULL);
 }
 
 static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
@@ -2315,7 +2313,6 @@ retry:
return 0;
 
 err_tgtstate:
-   pci_set_drvdata(pdev, NULL);
ath10k_pci_device_reset(ar_pci);
 err_iomap:
pci_iounmap(pdev, mem);
@@ -2326,6 +2323,7 @@ err_region:
 err_device:
pci_disable_device(pdev);
 err_ar:
+   pci_set_drvdata(pdev, NULL);
ath10k_core_destroy(ar);
 err_ar_pci:
/* call HIF PCI free here */
-- 
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/6] ath10k: refactor pci interrupt functions

2013-04-24 Thread Michal Kazior
This patch splits the interrupt registering
function into separate functions. Hopefully this
is more readable and maintanable.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 20e6371..f71267c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1845,59 +1845,109 @@ static void ath10k_pci_tasklet(unsigned long data)
}
 }
 
-static void ath10k_pci_nointrs(struct ath10k *ar)
+static int ath10k_pci_start_intr_msix(struct ath10k *ar, int num)
 {
-   int i;
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   int ret;
+   int i;
 
-   if (ar_pci-num_msi_intrs  0) {
-   /* MSI interrupt(s) */
-   for (i = 0; i  ar_pci-num_msi_intrs; i++)
-   free_irq(ar_pci-pdev-irq + i, ar);
-   ar_pci-num_msi_intrs = 0;
-   } else
-   /* Legacy PCI line interrupt */
-   free_irq(ar_pci-pdev-irq, ar);
+   ret = pci_enable_msi_block(ar_pci-pdev, num);
+   if (ret)
+   return ret;
+
+   ret = request_irq(ar_pci-pdev-irq + MSI_ASSIGN_FW,
+ ath10k_pci_msi_fw_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret)
+   return ret;
+
+   for (i = MSI_ASSIGN_CE_INITIAL; i = MSI_ASSIGN_CE_MAX; i++) {
+   ret = request_irq(ar_pci-pdev-irq + i,
+ ath10k_pci_per_engine_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret) {
+   ath10k_warn(request_irq(%d) failed %d\n,
+   ar_pci-pdev-irq + i, ret);
+
+   for (; i = MSI_ASSIGN_CE_INITIAL; i--)
+   free_irq(ar_pci-pdev-irq, ar);
+
+   pci_disable_msi(ar_pci-pdev);
+   return ret;
+   }
+   }
+
+   ath10k_info(MSI-X interrupt handling (%d intrs)\n, num);
+   return 0;
 }
 
-static int ath10k_pci_reset_target(struct ath10k *ar)
+static int ath10k_pci_start_intr_msi(struct ath10k *ar)
 {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   int wait_limit = 300; /* 3 sec */
+   int ret;
 
-   while (wait_limit-- 
-  !(ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS) 
-FW_IND_INITIALIZED)) {
+   ret = pci_enable_msi(ar_pci-pdev);
+   if (ret  0)
+   return ret;
 
-   if (ar_pci-num_msi_intrs == 0)
-   /* Fix potential race by repeating CORE_BASE writes */
-   iowrite32(PCIE_INTR_FIRMWARE_MASK |
- PCIE_INTR_CE_MASK_ALL,
- ar_pci-mem + (SOC_CORE_BASE_ADDRESS |
-PCIE_INTR_ENABLE_ADDRESS));
-   mdelay(10);
+   ret = request_irq(ar_pci-pdev-irq,
+ ath10k_pci_interrupt_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret  0) {
+   pci_disable_msi(ar_pci-pdev);
+   return ret;
}
 
-   if (wait_limit  0) {
-   ath10k_err(Target stalled\n);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-   return -EIO;
-   }
+   ath10k_info(MSI interrupt handling\n);
+   return 0;
+}
+
+static int ath10k_pci_start_intr_legacy(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   int ret;
+
+   ret = request_irq(ar_pci-pdev-irq,
+ ath10k_pci_interrupt_handler,
+ IRQF_SHARED, ath10k_pci, ar);
+   if (ret  0)
+   return ret;
 
+   /*
+* Make sure to wake the Target before enabling Legacy
+* Interrupt.
+*/
+   iowrite32(PCIE_SOC_WAKE_V_MASK,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   ath10k_pci_wait(ar);
+
+   /*
+* A potential race occurs here: The CORE_BASE write
+* depends on target correctly decoding AXI address but
+* host won't know when target writes BAR to CORE_CTRL.
+* This write might get lost if target has NOT written BAR.
+* For now, fix the race by repeating the write in below
+* synchronization checking.
+*/
+   iowrite32(PCIE_INTR_FIRMWARE_MASK |
+ PCIE_INTR_CE_MASK_ALL,
+ ar_pci-mem + (SOC_CORE_BASE_ADDRESS |
+PCIE_INTR_ENABLE_ADDRESS));
iowrite32(PCIE_SOC_WAKE_RESET,
 

[ath9k-devel] [PATCH v2 3/6] ath10k: remove pci probe retrying

2013-04-24 Thread Michal Kazior
This is an ugly hack. It is better to simply reset
the target and wait until it wakes up. If that is
not enough the platform may be broken.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index f71267c..0938942 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2133,23 +2133,52 @@ static void ath10k_pci_dump_features(struct ath10k_pci 
*ar_pci)
}
 }
 
+static int ath10k_pci_bring_up(struct ath10k *ar)
+{
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   u32 fw_indicator;
+
+   /*
+* Bring the target up cleanly.
+*
+* The target may be in an undefined state with an AUX-powered Target
+* and a Host in WoW mode. If the Host crashes, loses power, or is
+* restarted (without unloading the driver) then the Target is left
+* (aux) powered and running. On a subsequent driver load, the Target
+* is in an unexpected state. We try to catch that here in order to
+* reset the Target and retry the probe.
+*/
+   ath10k_pci_device_reset(ar_pci);
+
+   iowrite32(PCIE_SOC_WAKE_V_MASK,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   ath10k_pci_wait(ar);
+
+   fw_indicator = ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS);
+   iowrite32(PCIE_SOC_WAKE_RESET,
+ ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
+ PCIE_SOC_WAKE_ADDRESS);
+
+   if (fw_indicator  FW_IND_INITIALIZED)
+   return -EIO;
+
+   return 0;
+}
+
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
void __iomem *mem;
-   int ret;
+   int ret = 0;
u32 hif_type;
-   int probe_again = 0;
struct ath10k *ar;
struct ath10k_pci *ar_pci;
-   u32 fw_indicator;
u32 lcr_val;
-   int retries = 3;
u32 target_type;
 
ath10k_dbg(ATH10K_DBG_PCI, %s\n, __func__);
-retry:
-   ret = 0;
 
ar_pci = kzalloc(sizeof(*ar_pci), GFP_KERNEL);
if (ar_pci == NULL)
@@ -2257,42 +2286,12 @@ retry:
 
ar_pci-cacheline_sz = dma_get_cache_alignment();
 
-   /*
-* Verify that the Target was started cleanly.
-*
-* The case where this is most likely is with an AUX-powered
-* Target and a Host in WoW mode. If the Host crashes,
-* loses power, or is restarted (without unloading the driver)
-* then the Target is left (aux) powered and running.  On a
-* subsequent driver load, the Target is in an unexpected state.
-* We try to catch that here in order to reset the Target and
-* retry the probe.
-*/
-   iowrite32(PCIE_SOC_WAKE_V_MASK,
- mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-   ath10k_pci_wait(ar);
-
-   fw_indicator = ioread32(mem + FW_INDICATOR_ADDRESS);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   if (fw_indicator  FW_IND_INITIALIZED) {
-   probe_again++;
-   ath10k_err(target is in an unknown state. 
-  resetting (attempt %d).\n, probe_again);
-   /* ath10k_pci_device_reset, below, will reset the target */
-   ret = -EIO;
-   goto err_tgtstate;
+   ret = ath10k_pci_bring_up(ar);
+   if (ret) {
+   ath10k_err(could not bring up target\n);
+   goto err_iomap;
}
 
-   /*
-* retries are meant for early hw setup;
-* beyond this point it makes no sense to retry
-*/
-   retries = 0;
-
ret = ath10k_pci_configure(ar);
if (ret)
goto err_iomap;
@@ -2305,8 +2304,6 @@ retry:
 
return 0;
 
-err_tgtstate:
-   ath10k_pci_device_reset(ar_pci);
 err_iomap:
pci_iounmap(pdev, mem);
 err_master:
@@ -2322,12 +2319,6 @@ err_ar_pci:
/* call HIF PCI free here */
kfree(ar_pci);
 
-   /*
-* FIXME: Get rid of this hack as soon as HW is mature enough.
-*/
-   if (ret  retries--)
-   goto retry;
-
return ret;
 }
 
@@ -2350,7 +2341,6 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
 
ath10k_core_unregister(ar);
ath10k_pci_stop_intr(ar);
-   ath10k_pci_device_reset(ar_pci);
 
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, ar_pci-mem);
-- 
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 6/6] ath10k: simplify pci target reset

2013-04-24 Thread Michal Kazior
We already have a function that resets the target
and waits until it has awoken.

We can also change the ordering and combine device
reset with target reset altogether.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 4413f6b..bcf19e3 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2067,40 +2067,6 @@ static void ath10k_pci_dump_features(struct ath10k_pci 
*ar_pci)
}
 }
 
-static int ath10k_pci_bring_up(struct ath10k *ar)
-{
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   u32 fw_indicator;
-
-   /*
-* Bring the target up cleanly.
-*
-* The target may be in an undefined state with an AUX-powered Target
-* and a Host in WoW mode. If the Host crashes, loses power, or is
-* restarted (without unloading the driver) then the Target is left
-* (aux) powered and running. On a subsequent driver load, the Target
-* is in an unexpected state. We try to catch that here in order to
-* reset the Target and retry the probe.
-*/
-   ath10k_pci_device_reset(ar_pci);
-
-   iowrite32(PCIE_SOC_WAKE_V_MASK,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   ath10k_pci_wait(ar);
-
-   fw_indicator = ioread32(ar_pci-mem + FW_INDICATOR_ADDRESS);
-   iowrite32(PCIE_SOC_WAKE_RESET,
- ar_pci-mem + PCIE_LOCAL_BASE_ADDRESS +
- PCIE_SOC_WAKE_ADDRESS);
-
-   if (fw_indicator  FW_IND_INITIALIZED)
-   return -EIO;
-
-   return 0;
-}
-
 static int ath10k_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pci_dev)
 {
@@ -2223,18 +2189,24 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
 
ar_pci-cacheline_sz = dma_get_cache_alignment();
 
-   ret = ath10k_pci_bring_up(ar);
-   if (ret) {
-   ath10k_err(could not bring up target\n);
-   goto err_iomap;
-   }
-
ret = ath10k_pci_start_intr(ar);
if (ret) {
ath10k_err(could not start interrupt handling (%d)\n, ret);
goto err_iomap;
}
 
+   /*
+* Bring the target up cleanly.
+*
+* The target may be in an undefined state with an AUX-powered Target
+* and a Host in WoW mode. If the Host crashes, loses power, or is
+* restarted (without unloading the driver) then the Target is left
+* (aux) powered and running. On a subsequent driver load, the Target
+* is in an unexpected state. We try to catch that here in order to
+* reset the Target and retry the probe.
+*/
+   ath10k_pci_device_reset(ar_pci);
+
ret = ath10k_pci_reset_target(ar);
if (ret)
goto err_intr;
-- 
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/5] ath10k: checkpatch fixes 20130424

2013-04-24 Thread Kalle Valo
Few checkpatch fixes.

---

Kalle Valo (5):
  ath10k: cosmetic checkpatch fixes to bmi.h, hw.h and txrx.h
  ath10k: shorten lines in ath10k_debug_read_target_stats()
  ath10k: fix checkpatch warnings from bmi.c, debug.c, htc.h and pci.h
  ath10k: fix checkpatch warnings in ce.h, core.c, htc.c, htt_tx.c and 
txrx.c
  ath10k: fix some checkpatch warnings in htt_rx.c and ce.c


 drivers/net/wireless/ath/ath10k/bmi.c|7 +-
 drivers/net/wireless/ath/ath10k/bmi.h|2 -
 drivers/net/wireless/ath/ath10k/ce.c |   32 +---
 drivers/net/wireless/ath/ath10k/ce.h |4 +
 drivers/net/wireless/ath/ath10k/core.c   |   12 ++-
 drivers/net/wireless/ath/ath10k/debug.c  |   15 +++-
 drivers/net/wireless/ath/ath10k/debug.h  |  117 --
 drivers/net/wireless/ath/ath10k/htc.c|   45 ++--
 drivers/net/wireless/ath/ath10k/htc.h|   27 ---
 drivers/net/wireless/ath/ath10k/htt_rx.c |   27 +--
 drivers/net/wireless/ath/ath10k/htt_tx.c |   46 +++-
 drivers/net/wireless/ath/ath10k/hw.h |7 +-
 drivers/net/wireless/ath/ath10k/pci.h|   25 --
 drivers/net/wireless/ath/ath10k/txrx.c   |3 +
 drivers/net/wireless/ath/ath10k/txrx.h   |6 +-
 drivers/net/wireless/ath/ath10k/wmi.h|2 -
 16 files changed, 215 insertions(+), 162 deletions(-)

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


[ath9k-devel] [PATCH 1/5] ath10k: cosmetic checkpatch fixes to bmi.h, hw.h and txrx.h

2013-04-24 Thread Kalle Valo
Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/bmi.h  |2 +-
 drivers/net/wireless/ath/ath10k/hw.h   |7 +++
 drivers/net/wireless/ath/ath10k/txrx.h |6 --
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index f431589..d94cbfe 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -206,7 +206,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
 })
 
 #define ath10k_bmi_write32(ar, item, val)  \
-   ({  \
+   ({  \
int ret;\
u32 address;\
__le32 v = __cpu_to_le32(val);  \
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 2e6fed9..646386a 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -71,7 +71,7 @@ enum ath10k_mcast2ucast_mode {
 #define TARGET_NUM_PEERS   16
 #define TARGET_NUM_OFFLOAD_PEERS   0
 #define TARGET_NUM_PEER_KEYS   2
-#define TARGET_NUM_TIDS(2 * 
((TARGET_NUM_PEERS) + (TARGET_NUM_VDEVS)))
+#define TARGET_NUM_TIDS(2 * ((TARGET_NUM_PEERS) + 
(TARGET_NUM_VDEVS)))
 #define TARGET_TX_CHAIN_MASK   (BIT(0) | BIT(1) | BIT(2))
 #define TARGET_RX_CHAIN_MASK   (BIT(0) | BIT(1) | BIT(2))
 #define TARGET_RX_TIMEOUT_LO_PRI   100
@@ -223,7 +223,7 @@ enum ath10k_mcast2ucast_mode {
 #define SCRATCH_3_ADDRESS  0x0030
 
 /* Firmware indications to the Host via SCRATCH_3 register. */
-#define FW_INDICATOR_ADDRESS   (SOC_CORE_BASE_ADDRESS + 
SCRATCH_3_ADDRESS)
+#define FW_INDICATOR_ADDRESS   (SOC_CORE_BASE_ADDRESS + SCRATCH_3_ADDRESS)
 #define FW_IND_EVENT_PENDING   1
 #define FW_IND_INITIALIZED 2
 
@@ -303,7 +303,6 @@ enum ath10k_mcast2ucast_mode {
 #define MY_TARGET_BOARD_DATA_SZAR9888_BOARD_DATA_SZ
 #define MY_TARGET_BOARD_EXT_DATA_SZAR9888_BOARD_EXT_DATA_SZ
 
-#define RTC_STATE_V_GET(x) \
-   (((x)  RTC_STATE_V_MASK)  RTC_STATE_V_LSB)
+#define RTC_STATE_V_GET(x) (((x)  RTC_STATE_V_MASK)  RTC_STATE_V_LSB)
 
 #endif /* _HW_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/txrx.h 
b/drivers/net/wireless/ath/ath10k/txrx.h
index 8d08c4f..72afb20 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.h
+++ b/drivers/net/wireless/ath/ath10k/txrx.h
@@ -26,8 +26,10 @@ void ath10k_process_rx(struct ath10k *ar, struct htt_rx_info 
*info);
 
 struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
 const u8 *addr);
-int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id, const u8 
*addr);
-int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id, const u8 
*addr);
+int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id,
+const u8 *addr);
+int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id,
+const u8 *addr);
 
 void ath10k_peer_map_event(struct ath10k_htt *htt,
   struct htt_peer_map_event *ev);

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


[ath9k-devel] [PATCH 2/5] ath10k: shorten lines in ath10k_debug_read_target_stats()

2013-04-24 Thread Kalle Valo
This makes checkpatch a happy boy. No functional changes.

Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/debug.h |  117 +--
 drivers/net/wireless/ath/ath10k/wmi.h   |2 -
 2 files changed, 65 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 3ae598a..960e07a 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -57,66 +57,74 @@ static inline void ath10k_debug_read_target_stats(struct 
ath10k *ar,
  struct wmi_stats_event *ev)
 {
u8 *tmp = ev-data;
-   struct ath10k_target_stats *fw_stats;
+   struct ath10k_target_stats *stats;
int num_pdev_stats, num_vdev_stats, num_peer_stats;
+   struct wmi_pdev_stats *ps;
int i;
 
mutex_lock(ar-conf_mutex);
 
-   fw_stats = ar-debug.target_stats;
+   stats = ar-debug.target_stats;
 
num_pdev_stats = __le32_to_cpu(ev-num_pdev_stats); /* 0 or 1 */
num_vdev_stats = __le32_to_cpu(ev-num_vdev_stats); /* 0 or max vdevs */
num_peer_stats = __le32_to_cpu(ev-num_peer_stats); /* 0 or max peers */
 
if (num_pdev_stats) {
-   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);
-   fw_stats-rx_frame_count = 
__le32_to_cpu(pdev_stats-rx_frame_count);
-   fw_stats-rx_clear_count = 
__le32_to_cpu(pdev_stats-rx_clear_count);
-   fw_stats-cycle_count = __le32_to_cpu(pdev_stats-cycle_count);
-   fw_stats-phy_err_count = 
__le32_to_cpu(pdev_stats-phy_err_count);
-   fw_stats-chan_tx_power = 
__le32_to_cpu(pdev_stats-chan_tx_pwr);
-
-   fw_stats-comp_queued = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.comp_queued);
-   fw_stats-comp_delivered = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.comp_delivered);
-   fw_stats-msdu_enqued = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.msdu_enqued);
-   fw_stats-mpdu_enqued = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.mpdu_enqued);
-   fw_stats-wmm_drop = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.wmm_drop);
-   fw_stats-local_enqued = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.local_enqued);
-   fw_stats-local_freed = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.local_freed);
-   fw_stats-hw_queued = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.hw_queued);
-   fw_stats-hw_reaped = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.hw_reaped);
-   fw_stats-underrun = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.underrun);
-   fw_stats-tx_abort = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.tx_abort);
-   fw_stats-mpdus_requed = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.mpdus_requed);
-   fw_stats-tx_ko = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.tx_ko);
-   fw_stats-data_rc = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.data_rc);
-   fw_stats-self_triggers = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.self_triggers);
-   fw_stats-sw_retry_failure = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.sw_retry_failure);
-   fw_stats-illgl_rate_phy_err = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.illgl_rate_phy_err);
-   fw_stats-pdev_cont_xretry = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.pdev_cont_xretry);
-   fw_stats-pdev_tx_timeout = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.pdev_tx_timeout);
-   fw_stats-pdev_resets = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.pdev_resets);
-   fw_stats-phy_underrun = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.phy_underrun);
-   fw_stats-txop_ovf = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.tx.txop_ovf);
-
-   fw_stats-mid_ppdu_route_change = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.mid_ppdu_route_change);
-   fw_stats-status_rcvd = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.status_rcvd);
-   fw_stats-r0_frags = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.r0_frags);
-   fw_stats-r1_frags = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.r1_frags);
-   fw_stats-r2_frags = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.r2_frags);
-   fw_stats-r3_frags = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.r3_frags);
-   fw_stats-htt_msdus = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.htt_msdus);
-   fw_stats-htt_mpdus = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.htt_mpdus);
-   fw_stats-loc_msdus = 
__le32_to_cpu(pdev_stats-wal_pdev_stats.rx.loc_msdus);
-   fw_stats-loc_mpdus = 

[ath9k-devel] [PATCH 3/5] ath10k: fix checkpatch warnings from bmi.c, debug.c, htc.h and pci.h

2013-04-24 Thread Kalle Valo
Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/bmi.c   |7 ---
 drivers/net/wireless/ath/ath10k/debug.c |   15 ++-
 drivers/net/wireless/ath/ath10k/htc.h   |   27 ++-
 drivers/net/wireless/ath/ath10k/pci.h   |   25 -
 4 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.c 
b/drivers/net/wireless/ath/ath10k/bmi.c
index 85bf366..5dc4b14 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -68,7 +68,7 @@ int ath10k_bmi_get_target_info(struct ath10k *ar,
 
if (resplen  sizeof(resp.get_target_info)) {
ath10k_warn(invalid get_target_info response length (%d)\n,
-   resplen);
+   resplen);
return -EIO;
}
 
@@ -102,7 +102,8 @@ int ath10k_bmi_read_memory(struct ath10k *ar,
cmd.read_mem.addr = __cpu_to_le32(address);
cmd.read_mem.len  = __cpu_to_le32(rxlen);
 
-   ret = ath10k_hif_exchange_bmi_msg(ar, cmd, cmdlen, resp, 
rxlen);
+   ret = ath10k_hif_exchange_bmi_msg(ar, cmd, cmdlen,
+ resp, rxlen);
if (ret) {
ath10k_warn(unable to read from the device\n);
return ret;
@@ -192,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 
*param)
 
if (resplen  sizeof(resp.execute)) {
ath10k_warn(invalid execute response length (%d)\n,
-   resplen);
+   resplen);
return ret;
}
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 7e6b7034..3357917 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -236,9 +236,11 @@ static ssize_t ath10k_read_fw_stats(struct file *file, 
char __user *user_buf,
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
 Sched self tiggers, fw_stats-self_triggers);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
-Dropped due to SW retries, 
fw_stats-sw_retry_failure);
+Dropped due to SW retries,
+fw_stats-sw_retry_failure);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
-Illegal rate phy errors, 
fw_stats-illgl_rate_phy_err);
+Illegal rate phy errors,
+fw_stats-illgl_rate_phy_err);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
 Pdev continous xretry, fw_stats-pdev_cont_xretry);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
@@ -257,7 +259,8 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char 
__user *user_buf,
 =);
 
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
-Mid PPDU route change, 
fw_stats-mid_ppdu_route_change);
+Mid PPDU route change,
+fw_stats-mid_ppdu_route_change);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
 Tot. number of statuses, fw_stats-status_rcvd);
len += scnprintf(buf + len, buf_len - len, %30s %10d\n,
@@ -293,11 +296,13 @@ static ssize_t ath10k_read_fw_stats(struct file *file, 
char __user *user_buf,
 
for (i = 0; i  fw_stats-peers; i++) {
len += scnprintf(buf + len, buf_len - len, %30s %pM\n,
-Peer MAC address, 
fw_stats-peer_stat[i].peer_macaddr);
+Peer MAC address,
+fw_stats-peer_stat[i].peer_macaddr);
len += scnprintf(buf + len, buf_len - len, %30s %u\n,
 Peer RSSI, fw_stats-peer_stat[i].peer_rssi);
len += scnprintf(buf + len, buf_len - len, %30s %u\n,
-Peer TX rate, 
fw_stats-peer_stat[i].peer_tx_rate);
+Peer TX rate,
+fw_stats-peer_stat[i].peer_tx_rate);
len += scnprintf(buf + len, buf_len - len, \n);
}
 
diff --git a/drivers/net/wireless/ath/ath10k/htc.h 
b/drivers/net/wireless/ath/ath10k/htc.h
index a9619e6..3d03019 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -234,23 +234,23 @@ enum ath10k_htc_svc_gid {
 
 enum ath10k_htc_svc_id {
/* NOTE: service ID of 0x is reserved and should never be used */
-   ATH10K_HTC_SVC_ID_RESERVED  = 0x,
-   ATH10K_HTC_SVC_ID_UNUSED= ATH10K_HTC_SVC_ID_RESERVED,
+   ATH10K_HTC_SVC_ID_RESERVED  = 

[ath9k-devel] [PATCH 4/5] ath10k: fix checkpatch warnings in ce.h, core.c, htc.c, htt_tx.c and txrx.c

2013-04-24 Thread Kalle Valo
Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.h |4 +--
 drivers/net/wireless/ath/ath10k/core.c   |   12 +---
 drivers/net/wireless/ath/ath10k/htc.c|   45 -
 drivers/net/wireless/ath/ath10k/htt_tx.c |   46 +-
 drivers/net/wireless/ath/ath10k/txrx.c   |3 +-
 5 files changed, 62 insertions(+), 48 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index 110532f..4558630 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -193,7 +193,7 @@ int ath10k_ce_send(struct ce_state *ce_state,
 
 void ath10k_ce_send_cb_register(struct ce_state *ce_state,
void (*send_cb) (struct ce_state *ce_state,
-void 
*per_transfer_send_context,
+void *transfer_context,
 u32 buffer,
 unsigned int nbytes,
 unsigned int transfer_id),
@@ -240,7 +240,7 @@ int ath10k_ce_recv_buf_enqueue(struct ce_state *ce_state,
 
 void ath10k_ce_recv_cb_register(struct ce_state *ce_state,
void (*recv_cb) (struct ce_state *ce_state,
-void 
*per_transfer_recv_context,
+void *transfer_context,
 u32 buffer,
 unsigned int nbytes,
 unsigned int transfer_id,
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4ff500c..ed2c94f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -132,7 +132,8 @@ static int ath10k_init_configure_target(struct ath10k *ar)
int ret;
 
/* tell target which HTC version it is used*/
-   ret = ath10k_bmi_write32(ar, hi_app_host_interest, 
HTC_PROTOCOL_VERSION);
+   ret = ath10k_bmi_write32(ar, hi_app_host_interest,
+HTC_PROTOCOL_VERSION);
if (ret) {
ath10k_err(settings HTC version failed\n);
return ret;
@@ -285,7 +286,8 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
}
 
/*
-* Record the fact that extended board Data IS 
initialized
+* Record the fact that extended board Data IS
+* initialized
 */
ath10k_bmi_write32(ar, hi_board_ext_data_config,
   (board_ext_data_size  16) | 1);
@@ -602,7 +604,8 @@ void ath10k_core_unregister(struct ath10k *ar)
 }
 EXPORT_SYMBOL(ath10k_core_unregister);
 
-int ath10k_core_target_suspend(struct ath10k *ar) {
+int ath10k_core_target_suspend(struct ath10k *ar)
+{
int ret;
 
ath10k_dbg(ATH10K_DBG_CORE, %s: called, __func__);
@@ -613,7 +616,8 @@ int ath10k_core_target_suspend(struct ath10k *ar) {
 }
 EXPORT_SYMBOL(ath10k_core_target_suspend);
 
-int ath10k_core_target_resume(struct ath10k *ar) {
+int ath10k_core_target_resume(struct ath10k *ar)
+{
 
int ret;
 
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index f2a9e63..56a06b0 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -132,7 +132,8 @@ static bool ath10k_htc_ep_need_credit_update(struct 
ath10k_htc_ep *ep)
if (ep-tx_credits = ep-tx_credits_per_max_message)
return false;
 
-   ath10k_dbg(ATH10K_DBG_HTC, HTC: endpoint %d needs credit update\n, 
ep-eid);
+   ath10k_dbg(ATH10K_DBG_HTC, HTC: endpoint %d needs credit update\n,
+  ep-eid);
return true;
 }
 
@@ -249,7 +250,8 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
 
/* shouldn't happen, but print a warning just in case */
if (credits_required = 1  (8*sizeof(skb_cb-htc.credits_used)))
-   ath10k_warn(credits_required value overflow (%d)\n, 
credits_required);
+   ath10k_warn(credits_required value overflow (%d)\n,
+   credits_required);
 
skb_cb-htc.credits_used = credits_required;
return skb;
@@ -524,7 +526,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k 
*ar,
 
if (payload_len + sizeof(*hdr)  ATH10K_HTC_MAX_LEN) {
ath10k_warn(HTC rx frame too long, len: %zu\n,
-  payload_len + sizeof(*hdr));
+   payload_len + sizeof(*hdr));
ath10k_dbg_dump(ATH10K_DBG_HTC, htc 

[ath9k-devel] [PATCH 5/5] ath10k: fix some checkpatch warnings in htt_rx.c and ce.c

2013-04-24 Thread Kalle Valo
Signed-off-by: Kalle Valo kv...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/ce.c |   32 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c |   27 +
 2 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 969f24d..454025e 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -552,7 +552,8 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, 
unsigned int ce_id)
buf, nbytes,
id, flags) == 0) {
spin_unlock_bh(ar_pci-ce_lock);
-   ce_state-recv_cb(ce_state, transfer_context, buf, 
nbytes, id, flags);
+   ce_state-recv_cb(ce_state, transfer_context, buf,
+ nbytes, id, flags);
spin_lock_bh(ar_pci-ce_lock);
}
}
@@ -568,7 +569,8 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, 
unsigned int ce_id)
nbytes,
id) == 0) {
spin_unlock_bh(ar_pci-ce_lock);
-   ce_state-send_cb(ce_state, transfer_context, buf, 
nbytes, id);
+   ce_state-send_cb(ce_state, transfer_context,
+ buf, nbytes, id);
spin_lock_bh(ar_pci-ce_lock);
}
}
@@ -626,7 +628,8 @@ static void ath10k_ce_per_engine_handler_adjust(struct 
ce_state *ce_state,
 
ath10k_pci_wake(ar);
 
-   if ((!disable_copy_compl_intr)  (ce_state-send_cb || 
ce_state-recv_cb))
+   if ((!disable_copy_compl_intr) 
+   (ce_state-send_cb || ce_state-recv_cb))
CE_COPY_COMPLETE_INTR_ENABLE(ar, ctrl_addr);
else
CE_COPY_COMPLETE_INTR_DISABLE(ar, ctrl_addr);
@@ -845,7 +848,8 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
}
 
ath10k_pci_wake(ar);
-   CE_DEST_RING_BASE_ADDR_SET(ar, ctrl_addr, 
dest_ring-base_addr_ce_space);
+   CE_DEST_RING_BASE_ADDR_SET(ar, ctrl_addr,
+  dest_ring-base_addr_ce_space);
CE_DEST_RING_SZ_SET(ar, ctrl_addr, nentries);
CE_DEST_RING_BYTE_SWAP_SET(ar, ctrl_addr, 0);
CE_DEST_RING_LOWMARK_SET(ar, ctrl_addr, 0);
@@ -943,21 +947,21 @@ void ath10k_ce_deinit(struct ce_state *ce_state)
if (ce_state-src_ring) {
kfree(ce_state-src_ring-shadow_base_unaligned);
pci_free_consistent(ar_pci-pdev,
-  (ce_state-src_ring-nentries *
-   sizeof(struct ce_desc) +
-   CE_DESC_RING_ALIGN),
-  ce_state-src_ring-base_addr_owner_space,
-  ce_state-src_ring-base_addr_ce_space);
+   (ce_state-src_ring-nentries *
+sizeof(struct ce_desc) +
+CE_DESC_RING_ALIGN),
+   ce_state-src_ring-base_addr_owner_space,
+   ce_state-src_ring-base_addr_ce_space);
kfree(ce_state-src_ring);
}
 
if (ce_state-dest_ring) {
pci_free_consistent(ar_pci-pdev,
-  (ce_state-dest_ring-nentries *
-   sizeof(struct ce_desc) +
-   CE_DESC_RING_ALIGN),
-  ce_state-dest_ring-base_addr_owner_space,
-  ce_state-dest_ring-base_addr_ce_space);
+   (ce_state-dest_ring-nentries *
+sizeof(struct ce_desc) +
+CE_DESC_RING_ALIGN),
+   ce_state-dest_ring-base_addr_owner_space,
+   ce_state-dest_ring-base_addr_ce_space);
kfree(ce_state-dest_ring);
}
kfree(ce_state);
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 8c018ab..e88b031 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -126,7 +126,9 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt 
*htt, int num)
}
 
if (!IS_ALIGNED((unsigned long)skb-data, HTT_RX_DESC_ALIGN))
-   skb_pull(skb, PTR_ALIGN(skb-data, HTT_RX_DESC_ALIGN) - 
skb-data);
+   skb_pull(skb,
+PTR_ALIGN(skb-data, HTT_RX_DESC_ALIGN) -
+ 

[ath9k-devel] [PATCH 0/2] ath10k: killing things..

2013-04-24 Thread Bartosz Markowski
Bartosz Markowski (2):
  ath10k: kill pci_write32_v1_workaround function
  ath10k: kill TARGET_TYPE_AR9888

 drivers/net/wireless/ath/ath10k/bmi.h  |8 +++
 drivers/net/wireless/ath/ath10k/core.c |   28 +--
 drivers/net/wireless/ath/ath10k/core.h |   12 +++---
 drivers/net/wireless/ath/ath10k/hw.h   |2 --
 drivers/net/wireless/ath/ath10k/pci.c  |   21 ++
 drivers/net/wireless/ath/ath10k/pci.h  |   38 ++--
 6 files changed, 36 insertions(+), 73 deletions(-)

-- 
1.7.10

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


[ath9k-devel] [PATCH 1/2] ath10k: kill pci_write32_v1_workaround function

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index e05a7e0..add59ea 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -268,26 +268,6 @@ static inline void ath10k_pci_reg_write32(void __iomem 
*mem, u32 addr, u32 val)
 /* Wait up to this many Ms for a Diagnostic Access CE operation to complete */
 #define DIAG_ACCESS_CE_TIMEOUT_MS 10
 
-static inline void pci_write32_v1_workaround(struct ath10k *ar, u32 offset, 
u32 value)
-{
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
-   void __iomem *addr = ar_pci-mem;
-
-   if (ar_pci-hw_v1_workaround) {
-   unsigned long irq_flags;
-
-   spin_lock_irqsave(ar_pci-hw_v1_workaround_lock, irq_flags);
-
-   ioread32(addr+offset+4); /* 3rd read prior to write */
-   ioread32(addr+offset+4); /* 2nd read prior to write */
-   ioread32(addr+offset+4); /* 1st read prior to write */
-   iowrite32(value, addr+offset);
-
-   spin_unlock_irqrestore(ar_pci-hw_v1_workaround_lock, 
irq_flags);
-   } else
-   iowrite32(value, addr+offset);
-}
-
 /*
  * This API allows the Host to access Target registers directly
  * and relatively efficiently over PCIe.
@@ -318,7 +298,23 @@ static inline void pci_write32_v1_workaround(struct ath10k 
*ar, u32 offset, u32
  *   multiple code paths may issue BEGIN/END on a single targid.
  */
 static inline void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 
value) {
-   pci_write32_v1_workaround(ar, offset, value);
+
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+   void __iomem *addr = ar_pci-mem;
+
+   if (ar_pci-hw_v1_workaround) {
+   unsigned long irq_flags;
+
+   spin_lock_irqsave(ar_pci-hw_v1_workaround_lock, irq_flags);
+
+   ioread32(addr+offset+4); /* 3rd read prior to write */
+   ioread32(addr+offset+4); /* 2nd read prior to write */
+   ioread32(addr+offset+4); /* 1st read prior to write */
+   iowrite32(value, addr+offset);
+
+   spin_unlock_irqrestore(ar_pci-hw_v1_workaround_lock, 
irq_flags);
+   } else
+   iowrite32(value, addr+offset);
 }
 
 static inline u32 ath10k_pci_read32(struct ath10k *ar, u32 offset) {
-- 
1.7.10

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


[ath9k-devel] [PATCH 2/2] ath10k: kill TARGET_TYPE_AR9888

2013-04-24 Thread Bartosz Markowski
Get rid of target_type variable also. At the moment ath10k
does not support anything else then QCA988x HW.

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.h  |8 +++-
 drivers/net/wireless/ath/ath10k/core.c |   28 ++--
 drivers/net/wireless/ath/ath10k/core.h |   12 +++-
 drivers/net/wireless/ath/ath10k/hw.h   |2 --
 drivers/net/wireless/ath/ath10k/pci.c  |   21 +++--
 5 files changed, 19 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index f431589..49261d7 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -198,8 +198,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 addr;   \
__le32 tmp; \
\
-   addr = host_interest_item_address(ar-target_type,  \
- HI_ITEM(item));   \
+   addr = host_interest_item_address(HI_ITEM(item));   \
ret = ath10k_bmi_read_memory(ar, addr, (u8 *) tmp, 4); \
*val = __le32_to_cpu(tmp);  \
ret;\
@@ -211,10 +210,9 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 address;\
__le32 v = __cpu_to_le32(val);  \
\
-   address = host_interest_item_address(ar-target_type,   \
-HI_ITEM(item));\
+   address = host_interest_item_address(HI_ITEM(item));\
ret = ath10k_bmi_write_memory(ar, address,  \
-(u8 *) v, sizeof(v)); \
+ (u8 *) v, sizeof(v));\
ret;\
})
 
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4ff500c..186b216 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -191,7 +191,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
const struct firmware *fw_entry;
u32 fw_entry_size;
u8 *temp_eeprom = NULL, *fw_buf = NULL;
-   u32 board_data_size;
 
switch (file) {
default:
@@ -240,7 +239,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
 
if (file == ATH10K_FILE_BOARD_DATA  fw_entry-data) {
u32 board_ext_address;
-   int32_t board_ext_data_size;
 
temp_eeprom = kmalloc(fw_entry_size, GFP_ATOMIC);
if (!temp_eeprom) {
@@ -251,16 +249,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
 
memcpy(temp_eeprom, fw_buf, fw_entry_size);
 
-   switch (ar-target_type) {
-   default:
-   board_ext_data_size = 0;
-   break;
-   case TARGET_TYPE_AR9888:
-   board_data_size =  AR9888_BOARD_DATA_SZ;
-   board_ext_data_size = AR9888_BOARD_EXT_DATA_SZ;
-   break;
-   }
-
/* Determine where in Target RAM to write Board Data */
ath10k_bmi_read32(ar, hi_board_ext_data, board_ext_address);
 
@@ -272,12 +260,10 @@ static int ath10k_init_transfer_bin_file(struct ath10k 
*ar,
 * Check whether the target has allocated memory for extended
 * board data and file contains extended board data
 */
-   if (board_ext_address  (fw_entry_size == (board_data_size +
-   board_ext_data_size))) {
+   if (board_ext_address  (fw_entry_size == 
(AR9888_BOARD_DATA_SZ + AR9888_BOARD_EXT_DATA_SZ))) {
status = ath10k_bmi_write_memory(ar, board_ext_address,
-(u8 *)(((unsigned 
long)temp_eeprom) +
-board_data_size),
-board_ext_data_size);
+(u8 *)(((unsigned 
long)temp_eeprom) + AR9888_BOARD_DATA_SZ),
+
AR9888_BOARD_EXT_DATA_SZ);
 
if (status != 0) {
ath10k_err(ath10k: BMI operation failed\n);
@@ -288,9 +274,9 @@ static 

Re: [ath9k-devel] [RFC 0/2] ath10k: fix qos workaround

2013-04-24 Thread Michal Kazior
On 24/04/13 12:53, Sujith Manoharan wrote:
 Michal Kazior wrote:
 From what I've observed so far is frames in
 monitor mode (non promiscuous) are corrupted. They
 have the QoS Control stripped, with LLC header
 finding itself in the QoS Control. Wireshark shows
 such packets as A-MSDU corrupted frames. I tried
 restoring the QoS Control but it didn't fix that.

 I don't understand. Why should pure monitor mode care about
 the TX path ?

This is not concerned with the pure (I hope we don't have a 
misunderstanding here) monitor mode.

You can create monitor vif when associated and you might want to listen 
to the traffic *without* going into the promiscuous mode (no monitor 
vdev is created). It simply passes raw 802.11 frames that pass through 
mac80211 (both tx and rx) on other interfaces (i.e. associated station 
interface).


-- 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 v2 0/7] killing things - respin

2013-04-24 Thread Bartosz Markowski
Just to avoid many merge conflicts I'm re-sending prev 2 patches
in the same sack.

Bartosz Markowski (7):
  ath10k: kill pci_write32_v1_workaround function
  ath10k: kill TARGET_TYPE_AR9888
  ath10k: replace AR9888 occurrences with QCA988x
  ath10k: kill obsolete defines in hw.h
  ath10k: remove odd line break
  ath10k: change FW folder name from AR9888 - QCA988X
  ath10k: add new PCI 'feature' to track QCA988x_1.0 hacks

 drivers/net/wireless/ath/ath10k/bmi.h   |   12 +++--
 drivers/net/wireless/ath/ath10k/core.c  |   56 +---
 drivers/net/wireless/ath/ath10k/core.h  |   12 ++---
 drivers/net/wireless/ath/ath10k/htt.h   |2 +-
 drivers/net/wireless/ath/ath10k/hw.h|   38 +++-
 drivers/net/wireless/ath/ath10k/pci.c   |   63 ---
 drivers/net/wireless/ath/ath10k/pci.h   |   46 +--
 drivers/net/wireless/ath/ath10k/targaddrs.h |6 +--
 8 files changed, 98 insertions(+), 137 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: kill TARGET_TYPE_AR9888

2013-04-24 Thread Bartosz Markowski
Get rid of target_type variable also. At the moment ath10k
does not support anything else then QCA988x HW.

Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.h  |8 +++-
 drivers/net/wireless/ath/ath10k/core.c |   28 ++--
 drivers/net/wireless/ath/ath10k/core.h |   12 +++-
 drivers/net/wireless/ath/ath10k/hw.h   |2 --
 drivers/net/wireless/ath/ath10k/pci.c  |   21 +++--
 5 files changed, 19 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index f431589..49261d7 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -198,8 +198,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 addr;   \
__le32 tmp; \
\
-   addr = host_interest_item_address(ar-target_type,  \
- HI_ITEM(item));   \
+   addr = host_interest_item_address(HI_ITEM(item));   \
ret = ath10k_bmi_read_memory(ar, addr, (u8 *) tmp, 4); \
*val = __le32_to_cpu(tmp);  \
ret;\
@@ -211,10 +210,9 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
u32 address;\
__le32 v = __cpu_to_le32(val);  \
\
-   address = host_interest_item_address(ar-target_type,   \
-HI_ITEM(item));\
+   address = host_interest_item_address(HI_ITEM(item));\
ret = ath10k_bmi_write_memory(ar, address,  \
-(u8 *) v, sizeof(v)); \
+ (u8 *) v, sizeof(v));\
ret;\
})
 
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4ff500c..186b216 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -191,7 +191,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
const struct firmware *fw_entry;
u32 fw_entry_size;
u8 *temp_eeprom = NULL, *fw_buf = NULL;
-   u32 board_data_size;
 
switch (file) {
default:
@@ -240,7 +239,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
 
if (file == ATH10K_FILE_BOARD_DATA  fw_entry-data) {
u32 board_ext_address;
-   int32_t board_ext_data_size;
 
temp_eeprom = kmalloc(fw_entry_size, GFP_ATOMIC);
if (!temp_eeprom) {
@@ -251,16 +249,6 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
 
memcpy(temp_eeprom, fw_buf, fw_entry_size);
 
-   switch (ar-target_type) {
-   default:
-   board_ext_data_size = 0;
-   break;
-   case TARGET_TYPE_AR9888:
-   board_data_size =  AR9888_BOARD_DATA_SZ;
-   board_ext_data_size = AR9888_BOARD_EXT_DATA_SZ;
-   break;
-   }
-
/* Determine where in Target RAM to write Board Data */
ath10k_bmi_read32(ar, hi_board_ext_data, board_ext_address);
 
@@ -272,12 +260,10 @@ static int ath10k_init_transfer_bin_file(struct ath10k 
*ar,
 * Check whether the target has allocated memory for extended
 * board data and file contains extended board data
 */
-   if (board_ext_address  (fw_entry_size == (board_data_size +
-   board_ext_data_size))) {
+   if (board_ext_address  (fw_entry_size == 
(AR9888_BOARD_DATA_SZ + AR9888_BOARD_EXT_DATA_SZ))) {
status = ath10k_bmi_write_memory(ar, board_ext_address,
-(u8 *)(((unsigned 
long)temp_eeprom) +
-board_data_size),
-board_ext_data_size);
+(u8 *)(((unsigned 
long)temp_eeprom) + AR9888_BOARD_DATA_SZ),
+
AR9888_BOARD_EXT_DATA_SZ);
 
if (status != 0) {
ath10k_err(ath10k: BMI operation failed\n);
@@ -288,9 +274,9 @@ static 

[ath9k-devel] [PATCH v2 4/7] ath10k: kill obsolete defines in hw.h

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

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 6c2a0cd..ddb9b58 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -298,9 +298,6 @@ enum ath10k_mcast2ucast_mode {
 #define WINDOW_READ_ADDR_ADDRESS   MISSING
 #define WINDOW_WRITE_ADDR_ADDRESS  MISSING
 
-#define MY_TARGET_BOARD_DATA_SZQCA988X_BOARD_DATA_SZ
-#define MY_TARGET_BOARD_EXT_DATA_SZQCA988X_BOARD_EXT_DATA_SZ
-
 #define RTC_STATE_V_GET(x) \
(((x)  RTC_STATE_V_MASK)  RTC_STATE_V_LSB)
 
-- 
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: replace AR9888 occurrences with QCA988x

2013-04-24 Thread Bartosz Markowski
Signed-off-by: Bartosz Markowski bartosz.markow...@tieto.com
---
 drivers/net/wireless/ath/ath10k/bmi.h   |4 +--
 drivers/net/wireless/ath/ath10k/core.c  |   38 +--
 drivers/net/wireless/ath/ath10k/core.h  |2 +-
 drivers/net/wireless/ath/ath10k/htt.h   |2 +-
 drivers/net/wireless/ath/ath10k/hw.h|   32 +++---
 drivers/net/wireless/ath/ath10k/pci.c   |   36 -
 drivers/net/wireless/ath/ath10k/pci.h   |2 +-
 drivers/net/wireless/ath/ath10k/targaddrs.h |6 ++---
 8 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.h 
b/drivers/net/wireless/ath/ath10k/bmi.h
index 49261d7..ac8daef 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -27,8 +27,8 @@
  * to read memory, write memory, execute code, and to define an
  * application entry PC.
  *
- * It is used to download an application to AR9K, to provide
- * patches to code that is already resident on AR9K, and generally
+ * It is used to download an application to QCA988x, to provide
+ * patches to code that is already resident on QCA988x, and generally
  * to examine and modify state.  The Host has an opportunity to use
  * BMI only once during bootup.  Once the Host issues a BMI_DONE
  * command, this opportunity ends.
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 186b216..b1b836e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -45,25 +45,25 @@ enum ath10k_file {
 
 static const struct ath10k_hw_params ath10k_hw_params_list[] = {
{
-   .id = AR9888_HW_1_0_VERSION,
+   .id = QCA988X_HW_1_0_VERSION,
.name = qca988x hw1.0,
-   .patch_load_addr = AR9888_HW_1_0_PATCH_LOAD_ADDR,
+   .patch_load_addr = QCA988X_HW_1_0_PATCH_LOAD_ADDR,
.fw = {
-   .dir = AR9888_HW_1_0_FW_DIR,
-   .fw = AR9888_HW_1_0_FW_FILE,
-   .otp = AR9888_HW_1_0_OTP_FILE,
-   .board = AR9888_HW_1_0_BOARD_DATA_FILE,
+   .dir = QCA988X_HW_1_0_FW_DIR,
+   .fw = QCA988X_HW_1_0_FW_FILE,
+   .otp = QCA988X_HW_1_0_OTP_FILE,
+   .board = QCA988X_HW_1_0_BOARD_DATA_FILE,
},
},
{
-   .id = AR9888_HW_2_0_VERSION,
+   .id = QCA988X_HW_2_0_VERSION,
.name = qca988x hw2.0,
-   .patch_load_addr = AR9888_HW_2_0_PATCH_LOAD_ADDR,
+   .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.fw = {
-   .dir = AR9888_HW_2_0_FW_DIR,
-   .fw = AR9888_HW_2_0_FW_FILE,
-   .otp = AR9888_HW_2_0_OTP_FILE,
-   .board = AR9888_HW_2_0_BOARD_DATA_FILE,
+   .dir = QCA988X_HW_2_0_FW_DIR,
+   .fw = QCA988X_HW_2_0_FW_FILE,
+   .otp = QCA988X_HW_2_0_OTP_FILE,
+   .board = QCA988X_HW_2_0_BOARD_DATA_FILE,
},
},
 };
@@ -260,10 +260,10 @@ static int ath10k_init_transfer_bin_file(struct ath10k 
*ar,
 * Check whether the target has allocated memory for extended
 * board data and file contains extended board data
 */
-   if (board_ext_address  (fw_entry_size == 
(AR9888_BOARD_DATA_SZ + AR9888_BOARD_EXT_DATA_SZ))) {
+   if (board_ext_address  (fw_entry_size == 
(QCA988X_BOARD_DATA_SZ + QCA988X_BOARD_EXT_DATA_SZ))) {
status = ath10k_bmi_write_memory(ar, board_ext_address,
-(u8 *)(((unsigned 
long)temp_eeprom) + AR9888_BOARD_DATA_SZ),
-
AR9888_BOARD_EXT_DATA_SZ);
+(u8 *)(((unsigned 
long)temp_eeprom) + QCA988X_BOARD_DATA_SZ),
+
QCA988X_BOARD_EXT_DATA_SZ);
 
if (status != 0) {
ath10k_err(ath10k: BMI operation failed\n);
@@ -274,9 +274,9 @@ static int ath10k_init_transfer_bin_file(struct ath10k *ar,
 * Record the fact that extended board Data IS 
initialized
 */
ath10k_bmi_write32(ar, hi_board_ext_data_config,
-  (AR9888_BOARD_EXT_DATA_SZ  16) | 
1);
+  (QCA988X_BOARD_EXT_DATA_SZ  16) | 
1);
 
-   fw_entry_size = AR9888_BOARD_DATA_SZ;
+   fw_entry_size = QCA988X_BOARD_DATA_SZ;
}
}
 
@@ -354,7 +354,7 @@ static int 

[ath9k-devel] [PATCH v2 5/7] ath10k: remove odd line break

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

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index ddb9b58..2a624ea 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -298,7 +298,6 @@ enum ath10k_mcast2ucast_mode {
 #define WINDOW_READ_ADDR_ADDRESS   MISSING
 #define WINDOW_WRITE_ADDR_ADDRESS  MISSING
 
-#define RTC_STATE_V_GET(x) \
-   (((x)  RTC_STATE_V_MASK)  RTC_STATE_V_LSB)
+#define RTC_STATE_V_GET(x) (((x)  RTC_STATE_V_MASK)  RTC_STATE_V_LSB)
 
 #endif /* _HW_H_ */
-- 
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: change FW folder name from AR9888 - QCA988X

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

diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 2a624ea..c9159d3 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -28,7 +28,7 @@
 
 /* QCA988X 1.0 definitions */
 #define QCA988X_HW_1_0_VERSION 0x402c
-#define QCA988X_HW_1_0_FW_DIR  ath10k/AR9888/hw1.0
+#define QCA988X_HW_1_0_FW_DIR  ath10k/QCA988X/hw1.0
 #define QCA988X_HW_1_0_FW_FILE firmware.bin
 #define QCA988X_HW_1_0_OTP_FILEotp.bin
 #define QCA988X_HW_1_0_BOARD_DATA_FILE board.bin
@@ -36,7 +36,7 @@
 
 /* QCA988X 2.0 definitions */
 #define QCA988X_HW_2_0_VERSION 0x4100016c
-#define QCA988X_HW_2_0_FW_DIR  ath10k/AR9888/hw2.0
+#define QCA988X_HW_2_0_FW_DIR  ath10k/QCA988X/hw2.0
 #define QCA988X_HW_2_0_FW_FILE firmware.bin
 #define QCA988X_HW_2_0_OTP_FILEotp.bin
 #define QCA988X_HW_2_0_BOARD_DATA_FILE board.bin
-- 
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: add new PCI 'feature' to track QCA988x_1.0 hacks

2013-04-24 Thread Bartosz Markowski
This is to remove excessive bool variable from ar_pci struct
and to not check directly device version, again.

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

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 580d307..46143f6 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2134,6 +2134,9 @@ static void ath10k_pci_dump_features(struct ath10k_pci 
*ar_pci)
case ATH10K_PCI_FEATURE_MSI_X:
ath10k_dbg(ATH10K_DBG_PCI, device supports MSI-X\n);
break;
+   case ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND:
+   ath10k_dbg(ATH10K_DBG_PCI, QCA988X_1.0 workaround 
enabled\n);
+   break;
}
}
 }
@@ -2164,6 +2167,7 @@ retry:
 
switch (pci_dev-device) {
case QCA988X_1_0_DEVICE_ID:
+   set_bit(ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND, ar_pci-features);
break;
case QCA988X_2_0_DEVICE_ID:
set_bit(ATH10K_PCI_FEATURE_MSI_X, ar_pci-features);
@@ -2185,10 +2189,8 @@ retry:
}
 
/* Enable QCA988X_1.0 HW workarounds */
-   if (pci_dev-device == QCA988X_1_0_DEVICE_ID) {
-   ar_pci-hw_v1_workaround = true;
+   if (test_bit(ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND, ar_pci-features))
spin_lock_init(ar_pci-hw_v1_workaround_lock);
-   }
 
ar_pci-ar = ar;
pci_set_drvdata(pdev, ar);
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index ae266f2..d4a6764 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -151,7 +151,8 @@ struct service_to_pipe {
 };
 
 enum ath10k_pci_features {
-   ATH10K_PCI_FEATURE_MSI_X = 0,
+   ATH10K_PCI_FEATURE_MSI_X= 0,
+   ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND= 1,
 
/* keep last */
ATH10K_PCI_FEATURE_COUNT
@@ -228,7 +229,6 @@ struct ath10k_pci {
/* Map CE id to ce_state */
struct ce_state *ce_id_to_state[CE_COUNT_MAX];
 
-   bool hw_v1_workaround;
spinlock_t hw_v1_workaround_lock;
 };
 
@@ -302,7 +302,7 @@ static inline void ath10k_pci_write32(struct ath10k *ar, 
u32 offset, u32 value)
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
void __iomem *addr = ar_pci-mem;
 
-   if (ar_pci-hw_v1_workaround) {
+   if (test_bit(ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND, ar_pci-features)) {
unsigned long irq_flags;
 
spin_lock_irqsave(ar_pci-hw_v1_workaround_lock, irq_flags);
@@ -335,7 +335,7 @@ static inline void 
ath10k_set_source_ring_write_index(struct ath10k *ar,
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
void __iomem *indicator_addr;
 
-   if (!ar_pci-hw_v1_workaround) {
+   if (!test_bit(ATH10K_PCI_FEATURE_HW_1_0_WARKAROUND, ar_pci-features)) {
CE_SRC_RING_WRITE_IDX_SET(ar, ctrl_addr, write_index);
return;
}
-- 
1.7.10

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


Re: [ath9k-devel] [PATCH 0/2] ath10k: killing things..

2013-04-24 Thread Markowski Bartosz
On 24/04/13 14:34, Markowski Bartosz wrote:
 Bartosz Markowski (2):
ath10k: kill pci_write32_v1_workaround function
ath10k: kill TARGET_TYPE_AR9888

   drivers/net/wireless/ath/ath10k/bmi.h  |8 +++
   drivers/net/wireless/ath/ath10k/core.c |   28 +--
   drivers/net/wireless/ath/ath10k/core.h |   12 +++---
   drivers/net/wireless/ath/ath10k/hw.h   |2 --
   drivers/net/wireless/ath/ath10k/pci.c  |   21 ++
   drivers/net/wireless/ath/ath10k/pci.h  |   38 
 ++--
   6 files changed, 36 insertions(+), 73 deletions(-)

I have resent this in v2 (with few more patches).
Please drop this patch set.

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


[ath9k-devel] [PATCH] ath10k: fix comments style in rx_desc.h file

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

diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h 
b/drivers/net/wireless/ath/ath10k/rx_desc.h
index e3df696..f203614 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -58,152 +58,152 @@ struct rx_attention {
 } __packed;
 
 /*
-first_mpdu
-   Indicates the first MSDU of the PPDU.  If both first_mpdu
-   and last_mpdu are set in the MSDU then this is a not an
-   A-MPDU frame but a stand alone MPDU.  Interior MPDU in an
-   A-MPDU shall have both first_mpdu and last_mpdu bits set to
-   0.  The PPDU start status will only be valid when this bit
-   is set.
-
-last_mpdu
-   Indicates the last MSDU of the last MPDU of the PPDU.  The
-   PPDU end status will only be valid when this bit is set.
-
-mcast_bcast
-   Multicast / broadcast indicator.  Only set when the MAC
-   address 1 bit 0 is set indicating mcast/bcast and the BSSID
-   matches one of the 4 BSSID registers. Only set when
-   first_msdu is set.
-
-peer_idx_invalid
-   Indicates no matching entries within the the max search
-   count.  Only set when first_msdu is set.
-
-peer_idx_timeout
-   Indicates an unsuccessful search for the peer index due to
-   timeout.  Only set when first_msdu is set.
-
-power_mgmt
-   Power management bit set in the 802.11 header.  Only set
-   when first_msdu is set.
-
-non_qos
-   Set if packet is not a non-QoS data frame.  Only set when
-   first_msdu is set.
-
-null_data
-   Set if frame type indicates either null data or QoS null
-   data format.  Only set when first_msdu is set.
-
-mgmt_type
-   Set if packet is a management packet.  Only set when
-   first_msdu is set.
-
-ctrl_type
-   Set if packet is a control packet.  Only set when first_msdu
-   is set.
-
-more_data
-   Set if more bit in frame control is set.  Only set when
-   first_msdu is set.
-
-eosp
-   Set if the EOSP (end of service period) bit in the QoS
-   control field is set.  Only set when first_msdu is set.
-
-u_apsd_trigger
-   Set if packet is U-APSD trigger.  Key table will have bits
-   per TID to indicate U-APSD trigger.
-
-fragment
-   Indicates that this is an 802.11 fragment frame.  This is
-   set when either the more_frag bit is set in the frame
-   control or the fragment number is not zero.  Only set when
-   first_msdu is set.
-
-order
-   Set if the order bit in the frame control is set.  Only set
-   when first_msdu is set.
-
-classification
-   Indicates that this status has a corresponding MSDU that
-   requires FW processing.  The OLE will have classification
-   ring mask registers which will indicate the ring(s) for
-   packets and descriptors which need FW attention.
-
-overflow_err
-   PCU Receive FIFO does not have enough space to store the
-   full receive packet.  Enough space is reserved in the
-   receive FIFO for the status is written.  This MPDU remaining
-   packets in the PPDU will be filtered and no Ack response
-   will be transmitted.
-
-msdu_length_err
-   Indicates that the MSDU length from the 802.3 encapsulated
-   length field extends beyond the MPDU boundary.
-
-tcp_udp_chksum_fail
-   Indicates that the computed checksum (tcp_udp_chksum) did
-   not match the checksum in the TCP/UDP header.
-
-ip_chksum_fail
-   Indicates that the computed checksum did not match the
-   checksum in the IP header.
-
-sa_idx_invalid
-   Indicates no matching entry was found in the address search
-   table for the source MAC address.
-
-da_idx_invalid
-   Indicates no matching entry was found in the address search
-   table for the destination MAC address.
-
-sa_idx_timeout
-   Indicates an unsuccessful search for the source MAC address
-   due to the expiring of the search timer.
-
-da_idx_timeout
-   Indicates an unsuccessful search for the destination MAC
-   address due to the expiring of the search timer.
-
-encrypt_required
-   Indicates that this data type frame is not encrypted even if
-   the policy for this MPDU requires encryption as indicated in
-   the peer table key type.
-
-directed
-   

Re: [ath9k-devel] [PATCH 2/2] ath10k: don't advertise we want monitor vif

2013-04-24 Thread Sujith Manoharan
Michal Kazior wrote:
 [ 1989.477975] ath10k: Only one monitor interface allowed
 [ 1989.478016] ath10k: ath10k_htc_notify_tx_completion: ep 2 skb 
 880220e480c0
 [ 1989.481481] [ cut here ]
 [ 1989.486963] WARNING: at net/mac80211/iface.c:386 
 ieee80211_add_virtual_monitor+0xe4/0x154 [mac80211]()

This is because of the limitation we enforce in the driver - that
only one monitor interface can be allowed. This should really be fixed
in the firmware since the limitation is quite artificial.

 ; iw wlan1 interface add mon type monitor
 ; ifconfig mon up
 ; tcpdump -ni mon 
 ; ifconfig wlan1 up
 ; iw wlan1 connect -w dd-wrt-open
 wlan1 (phy #20): connected to 68:7f:74:0a:ca:80
 
 Right after association FW dumps.

I don't get a crash FW crash when I do this.
(Using a test firmware with the QoS fix).

 However if I first associate and then start monitor - no dumps.

Yes, no crash in this case too.

 FW dump also happens if I try to do packet injection in
 real monitor mode.

I see this crash, but let's not workaround it. I'll take a look
and see what's wrong.

I am not even sure if packet injection is supported currently with
the firmware.

 Considering how stable monitor mode is perhaps we should start
 monitor vdev only when there's the monitor vif present? (right now
 we can start it without the vdev). If so then we drop this patch.
 And we probably also should forbid packet injection, at least until
 FW gets this sorted out.

Well, the requirement is that we *need* a VDEV for monitor mode and
this is precisely this flag is for. So I don't quite see how removing it
fixes anything ?

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


[ath9k-devel] Where is done the distintion between AP and mesh/adhoc on ath9k?

2013-04-24 Thread Francisco Cuesta
Hello,

I was wondering where I might find on the ath9k drivers the functions
which let the device distinguish between AP mode and mesh/adhoc one.
Could someone enlighten me a bit?

Thanks in advance,

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


Re: [ath9k-devel] Where is done the distintion between AP and mesh/adhoc on ath9k?

2013-04-24 Thread Johannes Berg
zOn Wed, 2013-04-24 at 21:05 +0200, Francisco Cuesta wrote:
 Hello,
 
 I was wondering where I might find on the ath9k drivers the functions
 which let the device distinguish between AP mode and mesh/adhoc one.
 Could someone enlighten me a bit?

git grep NL80211_IFTYPE_

johannes

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