[ath9k-devel] [PATCH] ath10k: Use IBSS SSID provided by mac80211.

2013-04-28 Thread Marek Puzyniak
IBSS ssid is provided by mac80211, use it in vdev start.

Signed-off-by: Marek Puzyniak 
---
 drivers/net/wireless/ath/ath10k/mac.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 5b433ee..2469295 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -396,9 +396,8 @@ static int ath10k_vdev_start(struct ath10k_vif *arvif)
arg.ssid_len = arvif->u.ap.ssid_len;
arg.hidden_ssid = arvif->u.ap.hidden_ssid;
} else if (arvif->vdev_type == WMI_VDEV_TYPE_IBSS) {
-   /* TODO: IBSS ssid and ssid_len is needed from mac80211
-* small patch in mac80211 is needed
-*/
+   arg.ssid = arvif->vif->bss_conf.ssid;
+   arg.ssid_len = arvif->vif->bss_conf.ssid_len;
}
 
ret = ath10k_wmi_vdev_start(ar, &arg);
@@ -1823,7 +1822,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw 
*hw,
   arvif->dtim_period, arvif->vdev_id);
}
 
-   if (changed & BSS_CHANGED_SSID) {
+   if (changed & BSS_CHANGED_SSID &&
+   vif->type == NL80211_IFTYPE_AP) {
arvif->u.ap.ssid_len = info->ssid_len;
if (info->ssid_len)
memcpy(arvif->u.ap.ssid, info->ssid, info->ssid_len);
-- 
1.7.0.4

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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Felix Fietkau
On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
> Collect statistics about recived duplicate and STBC packets.
> This information should help see if STBC is actually working.
> 
> Tested on ar9285;
> 
> Signed-off-by: Oleksij Rempel 
I thought about this patch some more, and I'm wondering what's the point
in doing this? These statistics are going to be completely useless for
most people and they'll waste some memory/cpu cycles, especially on
small-cache devices. I think it's much more useful to simply pass the
information to mac80211 via rx flags and get them added to the radiotap
header.
I'd like to keep the number of 'poor man's debug hacks' in the driver to
a minimum, and there are some other things that I think should be
removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
sampling hack, and pretty much anything else that can be just as easily
accessed from mac80211 through regular interfaces.

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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Oleksij Rempel
Am 28.04.2013 14:51, schrieb Felix Fietkau:
> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
>> Collect statistics about recived duplicate and STBC packets.
>> This information should help see if STBC is actually working.
>>
>> Tested on ar9285;
>>
>> Signed-off-by: Oleksij Rempel 
> I thought about this patch some more, and I'm wondering what's the point
> in doing this? These statistics are going to be completely useless for
> most people and they'll waste some memory/cpu cycles, especially on
> small-cache devices. I think it's much more useful to simply pass the
> information to mac80211 via rx flags and get them added to the radiotap
> header.

Sure.

> I'd like to keep the number of 'poor man's debug hacks' in the driver to
> a minimum,

well, i'll prefer it to call with my name: lazy man's hack ;)

> and there are some other things that I think should be
> removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
> sampling hack, and pretty much anything else that can be just as easily
> accessed from mac80211 through regular interfaces.

I think there is more things to do in ath9k. Create the list and we can 
talk about it. For example one of it: I needed some time to understand 
how some parts of code relate to the hardware. Especially Rx and Tx 
descriptors. Some comments in header will help... I can add some of them 
(may be it will help other beginners), but i afraid that i spend time 
but my patches wont be included.
-- 
Regards,
Oleksij
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Ben Greear
On 04/28/2013 05:51 AM, Felix Fietkau wrote:
> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
>> Collect statistics about recived duplicate and STBC packets.
>> This information should help see if STBC is actually working.
>>
>> Tested on ar9285;
>>
>> Signed-off-by: Oleksij Rempel 
> I thought about this patch some more, and I'm wondering what's the point
> in doing this? These statistics are going to be completely useless for
> most people and they'll waste some memory/cpu cycles, especially on
> small-cache devices. I think it's much more useful to simply pass the
> information to mac80211 via rx flags and get them added to the radiotap
> header.
> I'd like to keep the number of 'poor man's debug hacks' in the driver to
> a minimum, and there are some other things that I think should be
> removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
> sampling hack, and pretty much anything else that can be just as easily
> accessed from mac80211 through regular interfaces.

Does that mean we can just put the stats in mac80211, or do we have
to be running a sniffer to gather the stats?

Thanks,
Ben

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


-- 
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com


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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Oleksij Rempel
Am 28.04.2013 16:13, schrieb Oleksij Rempel:
> Am 28.04.2013 14:51, schrieb Felix Fietkau:
>> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
>>> Collect statistics about recived duplicate and STBC packets.
>>> This information should help see if STBC is actually working.
>>>
>>> Tested on ar9285;
>>>
>>> Signed-off-by: Oleksij Rempel 
>> I thought about this patch some more, and I'm wondering what's the point
>> in doing this? These statistics are going to be completely useless for
>> most people and they'll waste some memory/cpu cycles, especially on
>> small-cache devices. I think it's much more useful to simply pass the
>> information to mac80211 via rx flags and get them added to the radiotap
>> header.
>
> Sure.
>

I see Wojciech Dubowik sanded some patches, for at least one year, to 
make exactly what Felix suggested. Are there any reason why this patches 
was not accepted?
Wojciech if you alive and have some time, can you update them?
-- 
Regards,
Oleksij
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] 3.9.0-rc8+ (hacked) splat.

2013-04-28 Thread Ben Greear
On 04/27/2013 01:58 AM, Felix Fietkau wrote:
> On 2013-04-27 1:46 AM, Ben Greear wrote:
>> Was running around 200 stations against a VAP on this system, and
>> then changed the channel from 1 to 36 (by restarting hostapd with new
>> config).
>>
>> Looks like null-pointer de-ref...  Anyone seen anything similar?
> I've never seen this one. Please use gdb to figure out the source code
> line that the NULL pointer deref happens in.
> As for the 'keycache entry 228 out of range' stuff, I'm going to send a
> patch for that now.

Thanks.

I'm away from the office for a bit, but will build a debugging kernel
and crank on this early next week.

Thanks,
Ben

>
> - Felix
>


-- 
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com


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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Felix Fietkau
On 2013-04-28 4:54 PM, Ben Greear wrote:
> On 04/28/2013 05:51 AM, Felix Fietkau wrote:
>> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
>>> Collect statistics about recived duplicate and STBC packets.
>>> This information should help see if STBC is actually working.
>>>
>>> Tested on ar9285;
>>>
>>> Signed-off-by: Oleksij Rempel 
>> I thought about this patch some more, and I'm wondering what's the point
>> in doing this? These statistics are going to be completely useless for
>> most people and they'll waste some memory/cpu cycles, especially on
>> small-cache devices. I think it's much more useful to simply pass the
>> information to mac80211 via rx flags and get them added to the radiotap
>> header.
>> I'd like to keep the number of 'poor man's debug hacks' in the driver to
>> a minimum, and there are some other things that I think should be
>> removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
>> sampling hack, and pretty much anything else that can be just as easily
>> accessed from mac80211 through regular interfaces.
> 
> Does that mean we can just put the stats in mac80211, or do we have
> to be running a sniffer to gather the stats?
Right now you'd have to use a sniffer, but if you really care about
getting specific stats it might make sense to write a kernel module that
attaches to a monitor interface and gathers them (maybe even with
support for gathering arbitrary stats by attaching bpf filters).

The problem I have with the current stats is they're just an arbitrary
collection of random stuff that is probably useless for 99% of all
users. In many cases the way the stats are collected also makes the data
completely meaningless (e.g. because the source/destination address is
not taken into account).

Why care about the number of packets on the air that were sent with a
specific rate flag? Why care about the number of beacons on the air
(with no filter on a set of APs or anything)? Or what about the number
of fragments received? To me it just looks like an incoherent set of
useless facts.

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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Ben Greear
On 04/28/2013 08:08 AM, Felix Fietkau wrote:
> On 2013-04-28 4:54 PM, Ben Greear wrote:
>> On 04/28/2013 05:51 AM, Felix Fietkau wrote:
>>> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
 Collect statistics about recived duplicate and STBC packets.
 This information should help see if STBC is actually working.

 Tested on ar9285;

 Signed-off-by: Oleksij Rempel 
>>> I thought about this patch some more, and I'm wondering what's the point
>>> in doing this? These statistics are going to be completely useless for
>>> most people and they'll waste some memory/cpu cycles, especially on
>>> small-cache devices. I think it's much more useful to simply pass the
>>> information to mac80211 via rx flags and get them added to the radiotap
>>> header.
>>> I'd like to keep the number of 'poor man's debug hacks' in the driver to
>>> a minimum, and there are some other things that I think should be
>>> removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
>>> sampling hack, and pretty much anything else that can be just as easily
>>> accessed from mac80211 through regular interfaces.
>>
>> Does that mean we can just put the stats in mac80211, or do we have
>> to be running a sniffer to gather the stats?
> Right now you'd have to use a sniffer, but if you really care about
> getting specific stats it might make sense to write a kernel module that
> attaches to a monitor interface and gathers them (maybe even with
> support for gathering arbitrary stats by attaching bpf filters).

I'd like ongoing stats w/out a monitor interface or sniffer, though
it would be fine to add it to the sniffer path as well.  Maybe we can
have compile-time flag to enable the extra and mostly useless
stats so only the 1% that cares pays the overhead.

> The problem I have with the current stats is they're just an arbitrary
> collection of random stuff that is probably useless for 99% of all
> users. In many cases the way the stats are collected also makes the data
> completely meaningless (e.g. because the source/destination address is
> not taken into account).
>
> Why care about the number of packets on the air that were sent with a
> specific rate flag? Why care about the number of beacons on the air
> (with no filter on a set of APs or anything)? Or what about the number
> of fragments received? To me it just looks like an incoherent set of
> useless facts.

I think having lots of stats allows for the possibility of seeing a pattern
that might otherwise be missed, and when testing in an isolated environment,
you don't have to care about who is sending what being reported..you already
know.

One thing I'd like to do, for instance, is to figure out how to get some
average MPDU lengths calculated in hopes that would correlate with decreased
performance in cases were we have lots of stations

Thanks,
Ben

>
> - Felix
>


-- 
Ben Greear 
Candela Technologies Inc  http://www.candelatech.com


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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Felix Fietkau
On 2013-04-28 5:15 PM, Ben Greear wrote:
> On 04/28/2013 08:08 AM, Felix Fietkau wrote:
>> On 2013-04-28 4:54 PM, Ben Greear wrote:
>>> On 04/28/2013 05:51 AM, Felix Fietkau wrote:
 On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
> Collect statistics about recived duplicate and STBC packets.
> This information should help see if STBC is actually working.
>
> Tested on ar9285;
>
> Signed-off-by: Oleksij Rempel 
 I thought about this patch some more, and I'm wondering what's the point
 in doing this? These statistics are going to be completely useless for
 most people and they'll waste some memory/cpu cycles, especially on
 small-cache devices. I think it's much more useful to simply pass the
 information to mac80211 via rx flags and get them added to the radiotap
 header.
 I'd like to keep the number of 'poor man's debug hacks' in the driver to
 a minimum, and there are some other things that I think should be
 removed: rx_frags and rx_beacons in struct ath_rx_stats, the tx/rx MAC
 sampling hack, and pretty much anything else that can be just as easily
 accessed from mac80211 through regular interfaces.
>>>
>>> Does that mean we can just put the stats in mac80211, or do we have
>>> to be running a sniffer to gather the stats?
>> Right now you'd have to use a sniffer, but if you really care about
>> getting specific stats it might make sense to write a kernel module that
>> attaches to a monitor interface and gathers them (maybe even with
>> support for gathering arbitrary stats by attaching bpf filters).
> 
> I'd like ongoing stats w/out a monitor interface or sniffer, though
> it would be fine to add it to the sniffer path as well.  Maybe we can
> have compile-time flag to enable the extra and mostly useless
> stats so only the 1% that cares pays the overhead.
I'd like to have proper justification for stats added to the code and
kick out stuff not worth keeping. It's not just about runtime overhead,
but keeping the number of lines of code down is important for
maintenance as well. Adding extra compile time flags just makes the
maintenance part worse.

>> The problem I have with the current stats is they're just an arbitrary
>> collection of random stuff that is probably useless for 99% of all
>> users. In many cases the way the stats are collected also makes the data
>> completely meaningless (e.g. because the source/destination address is
>> not taken into account).
>>
>> Why care about the number of packets on the air that were sent with a
>> specific rate flag? Why care about the number of beacons on the air
>> (with no filter on a set of APs or anything)? Or what about the number
>> of fragments received? To me it just looks like an incoherent set of
>> useless facts.
> 
> I think having lots of stats allows for the possibility of seeing a pattern
> that might otherwise be missed, and when testing in an isolated environment,
> you don't have to care about who is sending what being reported..you already
> know.
The stats I pointed out seem mostly useless for that purpose. When
testing in an isolated environment you might as well run a capture on a
monitor mode interface and do some more sophisticated analysis afterwards.

> One thing I'd like to do, for instance, is to figure out how to get some
> average MPDU lengths calculated in hopes that would correlate with decreased
> performance in cases were we have lots of stations
Please don't throw hooks for such stacks all over the ath9k or mac80211
data path. Making a module for analyzing such stuff on a monitor mode
interface might be a bit more work than spraying hacks onto the code,
but at least it doesn't push the maintenance/performance overhead burden
onto everybody else.

Something like a BPF based statistics gathering module would be useful
for more people as well - I'd probably help with the code myself as
well. I made a proof of concept of such a module several years ago. It
was based on madwifi back then, but the code is mostly generic. You can
find it here:
http://git.openwrt.org/?p=packages.git;a=tree;f=net/wprobe/src

When implemented properly, such am module would even make things a lot
easier for you by letting you add new stats at runtime without changing
kernel code or reloading modules.

So let's stop wasting time on keeping lots of tiny useless hacks around
and instead build something more useful. :)

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


[ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 6b83d29..0ec7986 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -534,10 +534,6 @@ int ath10k_core_register(struct ath10k *ar)
if (status)
goto err;
 
-   status = ath10k_init_uart(ar);
-   if (status)
-   goto err;
-
htc_ops.target_send_suspend_complete = ath10k_send_suspend_complete;
 
ar->htc = ath10k_htc_create(ar, &htc_ops);
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.c   |  1 -
 drivers/net/wireless/ath/ath10k/core.h   | 20 +++
 drivers/net/wireless/ath/ath10k/htt_tx.c |  1 -
 drivers/net/wireless/ath/ath10k/mac.c| 20 +--
 drivers/net/wireless/ath/ath10k/mac.h| 61 
 drivers/net/wireless/ath/ath10k/txrx.c   |  1 -
 drivers/net/wireless/ath/ath10k/wmi.c|  1 -
 7 files changed, 38 insertions(+), 67 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/mac.h

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 0ec7986..ec652b9 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -19,7 +19,6 @@
 #include 
 
 #include "core.h"
-#include "mac.h"
 #include "htc.h"
 #include "hif.h"
 #include "wmi.h"
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 225089d..c040418 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -374,4 +374,24 @@ void ath10k_core_unregister(struct ath10k *ar);
 int ath10k_core_target_suspend(struct ath10k *ar);
 int ath10k_core_target_resume(struct ath10k *ar);
 
+struct ath10k_generic_iter {
+   struct ath10k *ar;
+   int ret;
+};
+
+struct ath10k *ath10k_mac_create(void);
+void ath10k_mac_destroy(struct ath10k *ar);
+int ath10k_mac_register(struct ath10k *ar);
+void ath10k_mac_unregister(struct ath10k *ar);
+struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id);
+void ath10k_reset_scan(unsigned long ptr);
+void ath10k_offchan_tx_purge(struct ath10k *ar);
+void ath10k_offchan_tx_work(struct work_struct *work);
+void ath10k_tx_h_seq_no(struct sk_buff *skb);
+
+static inline struct ath10k_vif *ath10k_vif_to_arvif(struct ieee80211_vif *vif)
+{
+   return (struct ath10k_vif *)vif->drv_priv;
+}
+
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index edbe4f4..677f527 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -17,7 +17,6 @@
 
 #include 
 #include "htt.h"
-#include "mac.h"
 #include "txrx.h"
 #include "debug.h"
 
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 4a11878..8e8987e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -15,8 +15,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "mac.h"
-
 #include 
 #include 
 
@@ -218,6 +216,24 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif,
 /* General utilities */
 /*/
 
+void ath10k_tx_h_seq_no(struct sk_buff *skb)
+{
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+   struct ieee80211_vif *vif = info->control.vif;
+   struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
+
+   if (info->flags  & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+   if (arvif->tx_seq_no == 0)
+   arvif->tx_seq_no = 0x1000;
+
+   if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+   arvif->tx_seq_no += 0x10;
+   hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+   hdr->seq_ctrl |= cpu_to_le16(arvif->tx_seq_no);
+   }
+}
+
 static inline enum wmi_phy_mode chan_to_phymode(struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type)
 {
diff --git a/drivers/net/wireless/ath/ath10k/mac.h 
b/drivers/net/wireless/ath/ath10k/mac.h
deleted file mode 100644
index 58eed18..000
--- a/drivers/net/wireless/ath/ath10k/mac.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2005-2011 Atheros Communications Inc.
- * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _MAC_H_
-#define _MAC_H_
-
-#include 
-#include "core.h"
-
-struct ath10k_generic_iter {
-   struct ath10k *ar;
-   int ret;
-};
-
-struct ath10k *ath10k_mac_create(void);
-void ath10k_mac_destroy(struct ath10k *ar);
-int ath10k_ma

[ath9k-devel] [PATCH 04/20] ath10k: Remove "ar" inside WMI structure

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.h | 2 --
 drivers/net/wireless/ath/ath10k/wmi.c  | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index c040418..18f8eca 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -115,8 +115,6 @@ struct ath10k_bmi {
 };
 
 struct ath10k_wmi {
-   struct ath10k *ar;
-
enum ath10k_htc_ep_id eid;
struct completion service_ready;
struct completion unified_ready;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 8017a59..a837b3f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1079,7 +1079,6 @@ static void ath10k_wmi_process_rx(void *ptr, struct 
sk_buff *skb)
 /* WMI Initialization functions */
 int ath10k_wmi_attach(struct ath10k *ar)
 {
-   ar->wmi.ar = ar;
init_completion(&ar->wmi.service_ready);
init_completion(&ar->wmi.unified_ready);
init_waitqueue_head(&ar->wmi.wq);
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 03/20] ath10k: Rename HIF callback post_init as init

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/hif.h | 10 +-
 drivers/net/wireless/ath/ath10k/htc.c |  2 +-
 drivers/net/wireless/ath/ath10k/pci.c |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/hif.h 
b/drivers/net/wireless/ath/ath10k/hif.h
index 23e7c99..a5e6422 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -66,8 +66,8 @@ struct ath10k_hif_ops {
 */
void (*send_complete_check)(struct ath10k *ar, u8 pipe_id, int force);
 
-   void (*post_init)(struct ath10k *ar,
- struct ath10k_hif_cb *callbacks);
+   void (*init)(struct ath10k *ar,
+struct ath10k_hif_cb *callbacks);
 
u16 (*get_free_queue_number)(struct ath10k *ar, u8 pipe_id);
 };
@@ -122,10 +122,10 @@ static inline void ath10k_hif_send_complete_check(struct 
ath10k *ar,
ar->hif.ops->send_complete_check(ar, pipe_id, force);
 }
 
-static inline void ath10k_hif_post_init(struct ath10k *ar,
-   struct ath10k_hif_cb *callbacks)
+static inline void ath10k_hif_init(struct ath10k *ar,
+  struct ath10k_hif_cb *callbacks)
 {
-   ar->hif.ops->post_init(ar, callbacks);
+   ar->hif.ops->init(ar, callbacks);
 }
 
 static inline u16 ath10k_hif_get_free_queue_number(struct ath10k *ar,
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 56a06b0..647bd69 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -1001,7 +1001,7 @@ struct ath10k_htc *ath10k_htc_create(struct ath10k *ar,
/* Get HIF default pipe for HTC message exchange */
ep = &htc->endpoint[ATH10K_HTC_EP_0];
 
-   ath10k_hif_post_init(ar, &htc_callbacks);
+   ath10k_hif_init(ar, &htc_callbacks);
ath10k_hif_get_default_pipe(ar, &ep->ul_pipe_id, &ep->dl_pipe_id);
 
init_completion(&htc->ctl_resp);
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 31881f9..a7d321c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1673,7 +1673,7 @@ static const struct ath10k_hif_ops ath10k_pci_hif_ops = {
.map_service_to_pipe= ath10k_pci_hif_map_service_to_pipe,
.get_default_pipe   = ath10k_pci_hif_get_default_pipe,
.send_complete_check= ath10k_pci_hif_send_complete_check,
-   .post_init  = ath10k_pci_hif_post_init,
+   .init   = ath10k_pci_hif_post_init,
.get_free_queue_number  = ath10k_pci_hif_get_free_queue_number,
 };
 
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 05/20] ath10k: Remove "htc" inside HTT struct

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.c   | 2 +-
 drivers/net/wireless/ath/ath10k/htt.c| 5 ++---
 drivers/net/wireless/ath/ath10k/htt.h| 4 +---
 drivers/net/wireless/ath/ath10k/htt_tx.c | 8 
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index ec652b9..fa9ba4e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -555,7 +555,7 @@ int ath10k_core_register(struct ath10k *ar)
if (status)
goto err_wmi_detach;
 
-   ar->htt = ath10k_htt_attach(ar, ar->htc);
+   ar->htt = ath10k_htt_attach(ar);
if (!ar->htt) {
status = -ENOMEM;
goto err_wmi_detach;
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 036e2b8..c253db8 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -57,7 +57,7 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
/* connect to control service */
conn_req.service_id = ATH10K_HTC_SVC_ID_HTT_DATA_MSG;
 
-   status = ath10k_htc_connect_service(htt->htc, &conn_req, &conn_resp);
+   status = ath10k_htc_connect_service(htt->ar->htc, &conn_req, 
&conn_resp);
 
if (status)
return status;
@@ -67,7 +67,7 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
return 0;
 }
 
-struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc *htc)
+struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
 {
struct ath10k_htt *htt;
 
@@ -76,7 +76,6 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, 
struct ath10k_htc *htc)
return NULL;
 
htt->ar = ar;
-   htt->htc = htc;
htt->cfg.max_throughput_mbps = 800;
 
/*
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 2f353d5..58f0d03 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1103,8 +1103,6 @@ struct htt_rx_info {
 
 struct ath10k_htt {
struct ath10k *ar;
-   struct ath10k_htc *htc;
-
enum ath10k_htc_ep_id eid;
 
struct {
@@ -1259,7 +1257,7 @@ struct htt_rx_desc {
 
 /* FIXME: add htt_tx_desc_init() */
 
-struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar, struct ath10k_htc 
*htc);
+struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar);
 int ath10k_htt_attach_target(struct ath10k_htt *htt);
 void ath10k_htt_detach(struct ath10k_htt *htt);
 
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 677f527..62575b7 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -130,7 +130,7 @@ int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt)
 
ATH10K_SKB_CB(skb)->htt.is_conf = true;
 
-   ret = ath10k_htc_send(htt->htc, htt->eid, skb);
+   ret = ath10k_htc_send(htt->ar->htc, htt->eid, skb);
if (ret) {
dev_kfree_skb_any(skb);
return ret;
@@ -217,7 +217,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt)
 
ATH10K_SKB_CB(skb)->htt.is_conf = true;
 
-   ret = ath10k_htc_send(htt->htc, htt->eid, skb);
+   ret = ath10k_htc_send(htt->ar->htc, htt->eid, skb);
if (ret) {
dev_kfree_skb_any(skb);
return ret;
@@ -277,7 +277,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct 
sk_buff *msdu)
skb_cb->htt.refcount = 2;
skb_cb->htt.msdu = msdu;
 
-   res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
+   res = ath10k_htc_send(htt->ar->htc, htt->eid, txdesc);
if (res)
goto err;
 
@@ -412,7 +412,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
skb_cb->htt.txfrag = txfrag;
skb_cb->htt.msdu = msdu;
 
-   res = ath10k_htc_send(htt->htc, htt->eid, txdesc);
+   res = ath10k_htc_send(htt->ar->htc, htt->eid, txdesc);
if (res)
goto err;
 
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 06/20] ath10k: Move debug routines to debug.c

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/debug.c | 119 ++
 drivers/net/wireless/ath/ath10k/debug.h | 124 ++--
 2 files changed, 124 insertions(+), 119 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 3357917..946185c 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -99,6 +99,13 @@ EXPORT_SYMBOL(ath10k_warn);
 
 #ifdef CONFIG_ATH10K_DEBUGFS
 
+void ath10k_debug_read_service_map(struct ath10k *ar,
+  void *service_map,
+  size_t map_size)
+{
+   memcpy(ar->debug.wmi_service_bitmap, service_map, map_size);
+}
+
 static ssize_t ath10k_read_wmi_services(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
@@ -147,6 +154,118 @@ static const struct file_operations fops_wmi_services = {
.llseek = default_llseek,
 };
 
+void ath10k_debug_read_target_stats(struct ath10k *ar,
+   struct wmi_stats_event *ev)
+{
+   u8 *tmp = ev->data;
+   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);
+
+   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) {
+   ps = (struct wmi_pdev_stats *)tmp;
+
+   stats->ch_noise_floor = __le32_to_cpu(ps->chan_nf);
+   stats->tx_frame_count = __le32_to_cpu(ps->tx_frame_count);
+   stats->rx_frame_count = __le32_to_cpu(ps->rx_frame_count);
+   stats->rx_clear_count = __le32_to_cpu(ps->rx_clear_count);
+   stats->cycle_count = __le32_to_cpu(ps->cycle_count);
+   stats->phy_err_count = __le32_to_cpu(ps->phy_err_count);
+   stats->chan_tx_power = __le32_to_cpu(ps->chan_tx_pwr);
+
+   stats->comp_queued = __le32_to_cpu(ps->wal.tx.comp_queued);
+   stats->comp_delivered =
+   __le32_to_cpu(ps->wal.tx.comp_delivered);
+   stats->msdu_enqued = __le32_to_cpu(ps->wal.tx.msdu_enqued);
+   stats->mpdu_enqued = __le32_to_cpu(ps->wal.tx.mpdu_enqued);
+   stats->wmm_drop = __le32_to_cpu(ps->wal.tx.wmm_drop);
+   stats->local_enqued = __le32_to_cpu(ps->wal.tx.local_enqued);
+   stats->local_freed = __le32_to_cpu(ps->wal.tx.local_freed);
+   stats->hw_queued = __le32_to_cpu(ps->wal.tx.hw_queued);
+   stats->hw_reaped = __le32_to_cpu(ps->wal.tx.hw_reaped);
+   stats->underrun = __le32_to_cpu(ps->wal.tx.underrun);
+   stats->tx_abort = __le32_to_cpu(ps->wal.tx.tx_abort);
+   stats->mpdus_requed = __le32_to_cpu(ps->wal.tx.mpdus_requed);
+   stats->tx_ko = __le32_to_cpu(ps->wal.tx.tx_ko);
+   stats->data_rc = __le32_to_cpu(ps->wal.tx.data_rc);
+   stats->self_triggers = __le32_to_cpu(ps->wal.tx.self_triggers);
+   stats->sw_retry_failure =
+   __le32_to_cpu(ps->wal.tx.sw_retry_failure);
+   stats->illgl_rate_phy_err =
+   __le32_to_cpu(ps->wal.tx.illgl_rate_phy_err);
+   stats->pdev_cont_xretry =
+   __le32_to_cpu(ps->wal.tx.pdev_cont_xretry);
+   stats->pdev_tx_timeout =
+   __le32_to_cpu(ps->wal.tx.pdev_tx_timeout);
+   stats->pdev_resets = __le32_to_cpu(ps->wal.tx.pdev_resets);
+   stats->phy_underrun = __le32_to_cpu(ps->wal.tx.phy_underrun);
+   stats->txop_ovf = __le32_to_cpu(ps->wal.tx.txop_ovf);
+
+   stats->mid_ppdu_route_change =
+   __le32_to_cpu(ps->wal.rx.mid_ppdu_route_change);
+   stats->status_rcvd = __le32_to_cpu(ps->wal.rx.status_rcvd);
+   stats->r0_frags = __le32_to_cpu(ps->wal.rx.r0_frags);
+   stats->r1_frags = __le32_to_cpu(ps->wal.rx.r1_frags);
+   stats->r2_frags = __le32_to_cpu(ps->wal.rx.r2_frags);
+   stats->r3_frags = __le32_to_cpu(ps->wal.rx.r3_frags);
+   stats->htt_msdus = __le32_to_cpu(ps->wal.rx.htt_msdus);
+   stats->htt_mpdus = __le32_to_cpu(ps->wal.rx.htt_mpdus);
+   stats->loc_msdus = __le32_to_cpu(ps->wal.rx.loc_msdus);
+   stats->loc_mpdus = __le32_to_cpu(ps->wal.rx.loc_mpdus);
+   stats->oversize_amsdu =
+   __le32_to_cpu(ps->wal.rx.oversiz

[ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c| 13 ++---
 drivers/net/wireless/ath/ath10k/htc.h|  9 -
 drivers/net/wireless/ath/ath10k/htt.c| 11 ---
 drivers/net/wireless/ath/ath10k/htt.h|  4 ++--
 drivers/net/wireless/ath/ath10k/htt_rx.c |  4 ++--
 drivers/net/wireless/ath/ath10k/htt_tx.c |  4 ++--
 drivers/net/wireless/ath/ath10k/wmi.c|  8 ++--
 7 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 647bd69..b303c35 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -29,7 +29,7 @@ static inline void ath10k_htc_stop_queue(struct ath10k_htc_ep 
*ep)
return;
 
if (ep->ep_ops.stop_queue)
-   ep->ep_ops.stop_queue(ep->ep_ops.context);
+   ep->ep_ops.stop_queue(ep->htc->ar);
 
ath10k_dbg(ATH10K_DBG_HTC, "ep %d stop\n", ep->eid);
ep->tx_queue_stopped = true;
@@ -41,7 +41,7 @@ static inline void ath10k_htc_wake_queue(struct ath10k_htc_ep 
*ep)
return;
 
if (ep->ep_ops.wake_queue)
-   ep->ep_ops.wake_queue(ep->ep_ops.context);
+   ep->ep_ops.wake_queue(ep->htc->ar);
 
ath10k_dbg(ATH10K_DBG_HTC, "ep %d wake\n", ep->eid);
ep->tx_queue_stopped = false;
@@ -74,7 +74,7 @@ static inline void ath10k_htc_send_complete_check(struct 
ath10k_htc_ep *ep,
ath10k_hif_send_complete_check(ep->htc->ar, ep->ul_pipe_id, force);
 }
 
-static void ath10k_htc_control_tx_complete(void *context, struct sk_buff *skb)
+static void ath10k_htc_control_tx_complete(struct ath10k *ar, struct sk_buff 
*skb)
 {
kfree_skb(skb);
 }
@@ -121,7 +121,7 @@ static void ath10k_htc_notify_tx_completion(struct 
ath10k_htc_ep *ep,
return;
}
 
-   ep->ep_ops.ep_tx_complete(ep->ep_ops.context, skb);
+   ep->ep_ops.ep_tx_complete(ep->htc->ar, skb);
 }
 
 /* assumes tx_lock is held */
@@ -606,7 +606,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k 
*ar,
 
ath10k_dbg(ATH10K_DBG_HTC, "htc rx completion ep %d skb %p\n",
   eid, skb);
-   ep->ep_ops.ep_rx_complete(ep->ep_ops.context, skb);
+   ep->ep_ops.ep_rx_complete(ar, skb);
 
/* skb is now owned by the rx completion handler */
skb = NULL;
@@ -616,7 +616,7 @@ out:
return status;
 }
 
-static void ath10k_htc_control_rx_complete(void *context, struct sk_buff *skb)
+static void ath10k_htc_control_rx_complete(struct ath10k *ar, struct sk_buff 
*skb)
 {
/* TODO, can't receive HTC control messages yet */
ath10k_dbg(ATH10K_DBG_HTC, "Invalid call to %s\n", __func__);
@@ -740,7 +740,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
/* setup our pseudo HTC control endpoint connection */
memset(&conn_req, 0, sizeof(conn_req));
memset(&conn_resp, 0, sizeof(conn_resp));
-   conn_req.ep_ops.context = htc;
conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete;
conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete;
conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h 
b/drivers/net/wireless/ath/ath10k/htc.h
index 3d03019..cf97bde 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -274,11 +274,10 @@ struct ath10k_htc_ops {
 };
 
 struct ath10k_htc_ep_ops {
-   void *context;
-   void (*ep_tx_complete)(void *context, struct sk_buff *);
-   void (*ep_rx_complete)(void *context, struct sk_buff *);
-   void (*stop_queue)(void *context);
-   void (*wake_queue)(void *context);
+   void (*ep_tx_complete)(struct ath10k *, struct sk_buff *);
+   void (*ep_rx_complete)(struct ath10k *, struct sk_buff *);
+   void (*stop_queue)(struct ath10k *);
+   void (*wake_queue)(struct ath10k *);
 };
 
 /* service connection information */
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index c253db8..5ad552d 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -21,16 +21,14 @@
 #include "core.h"
 #include "debug.h"
 
-static void ath10k_htt_stop_queue(void *context)
+static void ath10k_htt_stop_queue(struct ath10k *ar)
 {
-   struct ath10k_htt *htt = context;
-   ieee80211_stop_queues(htt->ar->hw);
+   ieee80211_stop_queues(ar->hw);
 }
 
-static void ath10k_htt_wake_queue(void *context)
+static void ath10k_htt_wake_queue(struct ath10k *ar)
 {
-   struct ath10k_htt *htt = context;
-   ieee80211_wake_queues(htt->ar->hw);
+   ieee80211_wake_queues(ar->hw);
 }
 
 static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
@@ -42,7 +40,6 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt)
memset(&conn_req, 0, sizeof

[ath9k-devel] [PATCH 08/20] ath10k: Use lockless SKB queue routines

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

The HTC TX queue is protected by "tx_lock".

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index b303c35..c6966f9 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -209,7 +209,7 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
int remainder;
unsigned int transfer_len;
 
-   skb = skb_dequeue(&ep->tx_queue);
+   skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
return NULL;
 
@@ -240,7 +240,7 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
credits_required = 0;
else {
if (ep->tx_credits < credits_required) {
-   skb_queue_head(&ep->tx_queue, skb);
+   __skb_queue_head(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
return NULL;
}
@@ -268,7 +268,7 @@ static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc 
*htc,
if (!resources)
return NULL;
 
-   skb = skb_dequeue(&ep->tx_queue);
+   skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
return NULL;
 
@@ -325,7 +325,7 @@ int ath10k_htc_send(struct ath10k_htc *htc,
skb_push(skb, sizeof(struct ath10k_htc_hdr));
 
spin_lock_bh(&htc->tx_lock);
-   skb_queue_tail(&ep->tx_queue, skb);
+   __skb_queue_tail(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
spin_unlock_bh(&htc->tx_lock);
 
@@ -369,7 +369,7 @@ static void ath10k_htc_flush_endpoint_tx(struct ath10k_htc 
*htc,
 
spin_lock_bh(&htc->tx_lock);
for (;;) {
-   skb = skb_dequeue(&ep->tx_queue);
+   skb = __skb_dequeue(&ep->tx_queue);
if (!skb)
break;
 
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 09/20] ath10k: Optimize HTC queue handling

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Credit based flow control is enabled only for WMI service
and WMI doesn't register any handlers for queue stop/wake,
so there is no point in calling recalc_queue() for it.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index c6966f9..7169a42 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -214,8 +214,6 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
return NULL;
 
skb_cb = ATH10K_SKB_CB(skb);
-   ath10k_htc_recalc_queue(ep, -1);
-
transfer_len = skb->len;
 
if (transfer_len <= htc->target_credit_size)
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.h |  4 
 drivers/net/wireless/ath/ath10k/htc.c  | 26 --
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 18f8eca..7f27148 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -65,10 +65,6 @@ struct ath10k_skb_cb {
struct sk_buff *msdu;
} __packed htt;
 
-   struct {
-   u8 credits_used;
-   } __packed htc;
-
/* 4 bytes left on 64bit arch */
 } __packed;
 
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 7169a42..71c13f3 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -161,7 +161,8 @@ static int ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep 
*ep,
 
 static int ath10k_htc_issue_skb(struct ath10k_htc *htc,
struct ath10k_htc_ep *ep,
-   struct sk_buff *skb)
+   struct sk_buff *skb,
+   u8 credits)
 {
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
int ret;
@@ -190,7 +191,7 @@ err:
ath10k_warn("HTC issue failed: %d\n", ret);
 
spin_lock_bh(&htc->tx_lock);
-   ep->tx_credits += skb_cb->htc.credits_used;
+   ep->tx_credits += credits;
spin_unlock_bh(&htc->tx_lock);
 
skb_cb->is_aborted = true;
@@ -201,7 +202,8 @@ err:
 
 /* assumes tx_lock is held */
 static struct sk_buff *ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
-  struct ath10k_htc_ep *ep)
+  struct ath10k_htc_ep *ep,
+  u8 *credits)
 {
struct sk_buff *skb;
struct ath10k_skb_cb *skb_cb;
@@ -234,9 +236,9 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
 * EP 0 is special, it always has a credit and does not require
 * credit based flow control.
 */
-   if (ep->eid == ATH10K_HTC_EP_0)
+   if (ep->eid == ATH10K_HTC_EP_0) {
credits_required = 0;
-   else {
+   } else {
if (ep->tx_credits < credits_required) {
__skb_queue_head(&ep->tx_queue, skb);
ath10k_htc_recalc_queue(ep, 1);
@@ -246,12 +248,7 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
ep->tx_credits -= credits_required;
}
 
-   /* 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);
-
-   skb_cb->htc.credits_used = credits_required;
+   *credits = credits_required;
return skb;
 }
 
@@ -273,7 +270,6 @@ static struct sk_buff *ath10k_htc_get_skb(struct ath10k_htc 
*htc,
skb_cb = ATH10K_SKB_CB(skb);
ath10k_htc_recalc_queue(ep, -1);
 
-   skb_cb->htc.credits_used = 0;
return skb;
 }
 
@@ -284,6 +280,7 @@ static void ath10k_htc_send_work(struct work_struct *work)
struct ath10k_htc *htc = ep->htc;
struct sk_buff *skb;
int tx_resources = 0;
+   u8 credits = 0;
 
while (true) {
if (!ep->tx_credit_flow_enabled)
@@ -296,7 +293,8 @@ static void ath10k_htc_send_work(struct work_struct *work)
spin_lock_bh(&htc->tx_lock);
 
if (ep->tx_credit_flow_enabled)
-   skb = ath10k_htc_get_skb_credit_based(htc, ep);
+   skb = ath10k_htc_get_skb_credit_based(htc, ep,
+ &credits);
else
skb = ath10k_htc_get_skb(htc, ep, tx_resources);
 
@@ -305,7 +303,7 @@ static void ath10k_htc_send_work(struct work_struct *work)
if (!skb)
break; /* tx_queue empty or out of resources */
 
-   ath10k_htc_issue_skb(htc, ep, skb);
+   ath10k_htc_issue_skb(htc, ep, skb, credits);
}
 }
 
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 11/20] ath10k: Disable credit flow control for EP0

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

As the comment says, EP0 doesn't require flow control,
so disable it explicitly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 20 ++--
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 71c13f3..3641973 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -232,22 +232,13 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
ath10k_dbg(ATH10K_DBG_HTC, "%s: creds required %d got %d\n",
   __func__, credits_required, ep->tx_credits);
 
-   /*
-* EP 0 is special, it always has a credit and does not require
-* credit based flow control.
-*/
-   if (ep->eid == ATH10K_HTC_EP_0) {
-   credits_required = 0;
-   } else {
-   if (ep->tx_credits < credits_required) {
-   __skb_queue_head(&ep->tx_queue, skb);
-   ath10k_htc_recalc_queue(ep, 1);
-   return NULL;
-   }
-
-   ep->tx_credits -= credits_required;
+   if (ep->tx_credits < credits_required) {
+   __skb_queue_head(&ep->tx_queue, skb);
+   ath10k_htc_recalc_queue(ep, 1);
+   return NULL;
}
 
+   ep->tx_credits -= credits_required;
*credits = credits_required;
return skb;
 }
@@ -767,6 +758,7 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
 
/* special case for HTC pseudo control service */
if (conn_req->service_id == ATH10K_HTC_SVC_ID_RSVD_CTRL) {
+   disable_credit_flow_ctrl = true;
assigned_eid = ATH10K_HTC_EP_0;
max_msg_size = ATH10K_HTC_MAX_CTRL_MSG_LEN;
memset(&resp_msg_dummy, 0, sizeof(resp_msg_dummy));
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 12/20] ath10k: Optimize credit allocation

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

The chances of a WMI command exceeding the target credit
size is low, so use likely() and friends.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 3641973..381e0e8 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -218,9 +218,9 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
skb_cb = ATH10K_SKB_CB(skb);
transfer_len = skb->len;
 
-   if (transfer_len <= htc->target_credit_size)
+   if (likely(transfer_len <= htc->target_credit_size)) {
credits_required = 1;
-   else {
+   } else {
/* figure out how many credits this message requires */
credits_required = transfer_len / htc->target_credit_size;
remainder = transfer_len % htc->target_credit_size;
@@ -229,8 +229,8 @@ static struct sk_buff 
*ath10k_htc_get_skb_credit_based(struct ath10k_htc *htc,
credits_required++;
}
 
-   ath10k_dbg(ATH10K_DBG_HTC, "%s: creds required %d got %d\n",
-  __func__, credits_required, ep->tx_credits);
+   ath10k_dbg(ATH10K_DBG_HTC, "Credits required %d got %d\n",
+  credits_required, ep->tx_credits);
 
if (ep->tx_credits < credits_required) {
__skb_queue_head(&ep->tx_queue, skb);
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 13/20] ath10k: Remove unused variable in processing credit report

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 381e0e8..f820059 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -379,9 +379,7 @@ static void ath10k_htc_process_credit_report(struct 
ath10k_htc *htc,
 enum ath10k_htc_ep_id eid)
 {
struct ath10k_htc_ep *ep;
-   int total_credits = 0;
-   int n_reports;
-   int i;
+   int i, n_reports;
 
if (len % sizeof(*report))
ath10k_warn("Uneven credit report len %d", len);
@@ -401,13 +399,8 @@ static void ath10k_htc_process_credit_report(struct 
ath10k_htc *htc,
 
if (ep->tx_credits && !skb_queue_empty(&ep->tx_queue))
queue_work(htc->ar->workqueue, &ep->send_work);
-
-   total_credits += report->credits;
}
spin_unlock_bh(&htc->tx_lock);
-
-   ath10k_dbg(ATH10K_DBG_HTC, "report indicated %d credits total\n",
-  total_credits);
 }
 
 static int ath10k_htc_process_trailer(struct ath10k_htc *htc,
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 14/20] ath10k: Print HTC service name

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c | 54 ---
 1 file changed, 44 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index f820059..fd07d34 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -606,6 +606,36 @@ static void ath10k_htc_control_rx_complete(struct ath10k 
*ar, struct sk_buff *sk
 /* Init/Deinit */
 /***/
 
+static const char *htc_service_name(enum ath10k_htc_svc_id id)
+{
+   switch(id) {
+   case ATH10K_HTC_SVC_ID_RESERVED:
+   return "Reserved";
+   case ATH10K_HTC_SVC_ID_RSVD_CTRL:
+   return "Control";
+   case ATH10K_HTC_SVC_ID_WMI_CONTROL:
+   return "WMI";
+   case ATH10K_HTC_SVC_ID_WMI_DATA_BE:
+   return "DATA BE";
+   case ATH10K_HTC_SVC_ID_WMI_DATA_BK:
+   return "DATA BK";
+   case ATH10K_HTC_SVC_ID_WMI_DATA_VI:
+   return "DATA VI";
+   case ATH10K_HTC_SVC_ID_WMI_DATA_VO:
+   return "DATA VO";
+   case ATH10K_HTC_SVC_ID_NMI_CONTROL:
+   return "NMI Control";
+   case ATH10K_HTC_SVC_ID_NMI_DATA:
+   return "NMI Data";
+   case ATH10K_HTC_SVC_ID_HTT_DATA_MSG:
+   return "HTT Data";
+   case ATH10K_HTC_SVC_ID_TEST_RAW_STREAMS:
+   return "RAW";
+   }
+
+   return "Unknown";
+}
+
 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc)
 {
struct ath10k_htc_ep *ep;
@@ -759,8 +789,8 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
tx_alloc = ath10k_htc_get_credit_allocation(htc,

conn_req->service_id);
if (!tx_alloc)
-   ath10k_warn("Service 0x%x does not allocate target 
credits\n",
-   conn_req->service_id);
+   ath10k_warn("HTC Service %s does not allocate target 
credits\n",
+   htc_service_name(conn_req->service_id));
 
skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
if (!skb) {
@@ -818,15 +848,15 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
}
 
ath10k_dbg(ATH10K_DBG_HTC,
-  "Service 0x%x connect response from target: status: 
0x%x, assigned ep: 0x%x\n",
-  service_id, resp_msg->status, resp_msg->eid);
+  "HTC Service %s connect response: status: 0x%x, 
assigned ep: 0x%x\n",
+  htc_service_name(service_id), resp_msg->status, 
resp_msg->eid);
 
conn_resp->connect_resp_code = resp_msg->status;
 
/* check response status */
if (resp_msg->status != ATH10K_HTC_CONN_SVC_STATUS_SUCCESS) {
-   ath10k_err("Service 0x%x connect request failed with 
status: 0x%x)\n",
-  service_id, resp_msg->status);
+   ath10k_err("HTC Service %s connect request failed: 
0x%x)\n",
+  htc_service_name(service_id), 
resp_msg->status);
return -EPROTO;
}
 
@@ -875,15 +905,19 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
return status;
 
ath10k_dbg(ATH10K_DBG_HTC,
-  "HTC service: 0x%x UL pipe: %d DL pipe: %d eid: %d ready\n",
-  ep->service_id, ep->ul_pipe_id,
+  "HTC service: %s UL pipe: %d DL pipe: %d eid: %d ready\n",
+  htc_service_name(ep->service_id), ep->ul_pipe_id,
   ep->dl_pipe_id, ep->eid);
 
+   ath10k_dbg(ATH10K_DBG_HTC,
+  "EP %d UL polled: %d, DL polled: %d\n",
+  ep->eid, ep->ul_is_polled, ep->dl_is_polled);
+
if (disable_credit_flow_ctrl && ep->tx_credit_flow_enabled) {
ep->tx_credit_flow_enabled = false;
ath10k_dbg(ATH10K_DBG_HTC,
-  "HTC service: 0x%x eid: %d TX flow control 
disabled\n",
-  ep->service_id, assigned_eid);
+  "HTC service: %s eid: %d TX flow control disabled\n",
+  htc_service_name(ep->service_id), assigned_eid);
}
 
return status;
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 15/20] ath10k: Fix typo

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/ce.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 352cf43..e8d8d0c 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -244,8 +244,8 @@ static inline void 
ath10k_ce_copy_complete_intr_disable(struct ath10k *ar,
   host_ie_addr & ~HOST_IE_COPY_COMPLETE_MASK);
 }
 
-static inline void ath10k_ce_watermark_intr_diable(struct ath10k *ar,
-  u32 ce_ctrl_addr)
+static inline void ath10k_ce_watermark_intr_disable(struct ath10k *ar,
+   u32 ce_ctrl_addr)
 {
u32 host_ie_addr = ath10k_pci_read32(ar, ce_ctrl_addr + 
HOST_IE_ADDRESS);
 
@@ -845,7 +845,7 @@ static void ath10k_ce_per_engine_handler_adjust(struct 
ce_state *ce_state,
else
ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
 
-   ath10k_ce_watermark_intr_diable(ar, ctrl_addr);
+   ath10k_ce_watermark_intr_disable(ar, ctrl_addr);
 
ath10k_pci_sleep(ar);
 }
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 16/20] ath10k: Merge txrx.c with HTT

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/Makefile |   1 -
 drivers/net/wireless/ath/ath10k/htt.c| 129 +-
 drivers/net/wireless/ath/ath10k/htt.h|  16 ++
 drivers/net/wireless/ath/ath10k/htt_rx.c | 174 -
 drivers/net/wireless/ath/ath10k/htt_tx.c | 104 +++-
 drivers/net/wireless/ath/ath10k/mac.c|   1 -
 drivers/net/wireless/ath/ath10k/txrx.c   | 415 ---
 drivers/net/wireless/ath/ath10k/txrx.h   |  39 ---
 8 files changed, 419 insertions(+), 460 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath10k/txrx.c
 delete mode 100644 drivers/net/wireless/ath/ath10k/txrx.h

diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index a4179f4..36444fe 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -6,7 +6,6 @@ ath10k_core-y += mac.o \
 htt.o \
 htt_rx.o \
 htt_tx.o \
-txrx.o \
 wmi.o \
 bmi.o
 
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 5ad552d..1b92f84 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -21,6 +21,133 @@
 #include "core.h"
 #include "debug.h"
 
+/***/
+/* HTT Peer management */
+/***/
+
+struct ath10k_peer *ath10k_peer_find(struct ath10k *ar, int vdev_id,
+const u8 *addr)
+{
+   struct ath10k_peer *peer;
+
+   lockdep_assert_held(&ar->data_lock);
+
+   list_for_each_entry(peer, &ar->peers, list) {
+   if (peer->vdev_id != vdev_id)
+   continue;
+   if (memcmp(peer->addr, addr, ETH_ALEN))
+   continue;
+
+   return peer;
+   }
+
+   return NULL;
+}
+
+static struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar,
+ int peer_id)
+{
+   struct ath10k_peer *peer;
+
+   lockdep_assert_held(&ar->data_lock);
+
+   list_for_each_entry(peer, &ar->peers, list)
+   if (test_bit(peer_id, peer->peer_ids))
+   return peer;
+
+   return NULL;
+}
+
+static int ath10k_wait_for_peer_common(struct ath10k *ar, int vdev_id,
+  const u8 *addr, bool expect_mapped)
+{
+   int ret;
+
+   ret = wait_event_timeout(ar->peer_mapping_wq, ({
+   bool mapped;
+
+   spin_lock_bh(&ar->data_lock);
+   mapped = !!ath10k_peer_find(ar, vdev_id, addr);
+   spin_unlock_bh(&ar->data_lock);
+
+   mapped == expect_mapped;
+   }), 3*HZ);
+
+   if (ret <= 0)
+   return -ETIMEDOUT;
+
+   return 0;
+}
+
+int ath10k_wait_for_peer_created(struct ath10k *ar, int vdev_id, const u8 
*addr)
+{
+   return ath10k_wait_for_peer_common(ar, vdev_id, addr, true);
+}
+
+int ath10k_wait_for_peer_deleted(struct ath10k *ar, int vdev_id, const u8 
*addr)
+{
+   return ath10k_wait_for_peer_common(ar, vdev_id, addr, false);
+}
+
+void ath10k_peer_map_event(struct ath10k_htt *htt,
+  struct htt_peer_map_event *ev)
+{
+   struct ath10k *ar = htt->ar;
+   struct ath10k_peer *peer;
+
+   spin_lock_bh(&ar->data_lock);
+   peer = ath10k_peer_find(ar, ev->vdev_id, ev->addr);
+   if (!peer) {
+   peer = kzalloc(sizeof(*peer), GFP_ATOMIC);
+   if (!peer)
+   goto exit;
+
+   peer->vdev_id = ev->vdev_id;
+   memcpy(peer->addr, ev->addr, ETH_ALEN);
+   list_add(&peer->list, &ar->peers);
+   wake_up(&ar->peer_mapping_wq);
+   }
+
+   ath10k_dbg(ATH10K_DBG_HTT, "htt peer map vdev %d peer %pM id %d\n",
+  ev->vdev_id, ev->addr, ev->peer_id);
+
+   set_bit(ev->peer_id, peer->peer_ids);
+exit:
+   spin_unlock_bh(&ar->data_lock);
+}
+
+void ath10k_peer_unmap_event(struct ath10k_htt *htt,
+struct htt_peer_unmap_event *ev)
+{
+   struct ath10k *ar = htt->ar;
+   struct ath10k_peer *peer;
+
+   spin_lock_bh(&ar->data_lock);
+   peer = ath10k_peer_find_by_id(ar, ev->peer_id);
+   if (!peer) {
+   ath10k_warn("unknown peer id %d\n", ev->peer_id);
+   goto exit;
+   }
+
+   ath10k_dbg(ATH10K_DBG_HTT, "htt peer unmap vdev %d peer %pM id %d\n",
+  peer->vdev_id, peer->addr, ev->peer_id);
+
+   clear_bit(ev->peer_id, peer->peer_ids);
+
+   if (bitmap_empty(peer->peer_ids, ATH10K_MAX_NUM_PEER_IDS)) {
+   list_del(&peer->list);
+   kfree(peer);
+   wake_up(&ar->peer_mapping_wq);
+   }
+
+exit:
+   spin_unlock_bh(&ar->da

[ath9k-devel] [PATCH 17/20] ath10k: Use IS_ALIGNED macro to check alignment

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htc.c| 4 +++-
 drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c | 4 ++--
 drivers/net/wireless/ath/ath10k/pci.c| 3 ++-
 drivers/net/wireless/ath/ath10k/wmi.c| 3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index fd07d34..1e4c075 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -936,7 +936,9 @@ struct sk_buff *ath10k_htc_alloc_skb(int size)
skb_reserve(skb, sizeof(struct ath10k_htc_hdr));
 
/* FW/HTC requires 4-byte aligned streams */
-   WARN_ONCE((unsigned long)skb->data & 0x3, "unaligned skb");
+   if (!IS_ALIGNED((unsigned long)skb->data, 4))
+   ath10k_warn("Unaligned HTC tx skb\n");
+
return skb;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6e09581..cc385e7 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1159,7 +1159,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct 
sk_buff *skb)
struct htt_resp *resp = (struct htt_resp *)skb->data;
 
/* confirm alignment */
-   if unsigned long)skb->data) & 0x3) != 0)
+   if (!IS_ALIGNED((unsigned long)skb->data, 4))
ath10k_warn("unaligned htt message, expect trouble\n");
 
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX, msg_type: 0x%0X\n",
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 7a10503..881d390 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -153,7 +153,7 @@ int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt)
 * the HW expects the buffer to be an integral number of 4-byte
 * "words"
 */
-   BUILD_BUG_ON((HTT_RX_BUF_SIZE & 0x3) != 0);
+   BUILD_BUG_ON(!IS_ALIGNED(HTT_RX_BUF_SIZE, 4));
BUILD_BUG_ON((HTT_RX_BUF_SIZE & HTT_MAX_CACHE_LINE_SIZE_MASK) != 0);
 
len = sizeof(cmd->hdr) + sizeof(cmd->rx_setup.hdr)
@@ -435,7 +435,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
goto err;
}
 
-   if ((unsigned long)txdesc->data & 0x3) {
+   if (!IS_ALIGNED((unsigned long)txdesc->data, 4)) {
ath10k_warn("htt alignment check failed. dropping packet.\n");
res = -EIO;
goto err;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index a7d321c..209b310 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -120,7 +120,8 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 
address, void *data,
 * this fn
 */
if (address < DRAM_BASE_ADDRESS) {
-   if ((address & 0x3) || ((dma_addr_t)data & 0x3))
+   if (!IS_ALIGNED(address, 4) ||
+   !IS_ALIGNED((unsigned long)data, 4))
return -EIO;
 
while ((nbytes >= 4) &&  ((ret = ath10k_pci_diag_read_access(
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 577a63e..248a886 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -65,7 +65,8 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)
return NULL;
 
skb_reserve(skb, WMI_SKB_HEADROOM);
-   WARN_ONCE((unsigned long)skb->data & 0x3, "unaligned skb");
+   if (!IS_ALIGNED((unsigned long)skb->data, 4))
+   ath10k_warn("Unaligned WMI skb\n");
 
skb_put(skb, round_len);
memset(skb->data, 0, round_len);
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htt.h| 12 
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index d416a4f..bd3b0b4 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -478,18 +478,6 @@ struct htt_rx_indication {
struct htt_rx_indication_mpdu_range mpdu_ranges[0];
 } __packed;
 
-static inline struct htt_rx_indication_mpdu_range *
-   htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
-{
-   void *ptr = rx_ind;
-
-   ptr += sizeof(rx_ind->hdr)
-+ sizeof(rx_ind->ppdu)
-+ sizeof(rx_ind->prefix)
-+ roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
-   return ptr;
-}
-
 enum htt_rx_flush_mpdu_status {
HTT_RX_FLUSH_MPDU_DISCARD = 0,
HTT_RX_FLUSH_MPDU_REORDER = 1,
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index cc385e7..a310dde 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -929,6 +929,18 @@ static bool ath10k_htt_rx_has_fcs_err(struct sk_buff *skb)
return false;
 }
 
+static inline struct htt_rx_indication_mpdu_range *
+htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
+{
+   void *ptr = rx_ind;
+
+   ptr += sizeof(rx_ind->hdr)
++ sizeof(rx_ind->ppdu)
++ sizeof(rx_ind->prefix)
++ roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
+   return ptr;
+}
+
 static void ath10k_htt_rx_handler(struct ath10k_htt *htt,
  struct htt_rx_indication *rx)
 {
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

We can dispense with the lockdep assert since the refill
timer just calls the replenish routine which is held under
the ring lock.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 95ffcc2..bcb9021 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -273,6 +273,7 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt 
*htt)
return size;
 }
 
+/* RX ring lock must be held. */
 static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num)
 {
struct htt_rx_desc *rx_desc;
@@ -280,8 +281,6 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt 
*htt, int num)
dma_addr_t paddr;
int idx;
 
-   lockdep_assert_held(&htt->rx_ring.lock);
-
idx = __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr));
while (num > 0) {
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
@@ -641,10 +640,9 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
 
spin_lock_init(&htt->rx_ring.lock);
-   spin_lock_bh(&htt->rx_ring.lock);
+
htt->rx_ring.fill_cnt = 0;
ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
-   spin_unlock_bh(&htt->rx_ring.lock);
 
ath10k_dbg(ATH10K_DBG_HTT, "HTT RX ring size: %d, fill_level: %d\n",
   htt->rx_ring.size, htt->rx_ring.fill_level);
-- 
1.8.2.2

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


[ath9k-devel] [PATCH 19/20] ath10k: Simplify excessively nested HTT structure layout

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

There are various sructures inside HTT/RX_RING that contain
very few elements. Simplify these.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/htt.c|  2 +-
 drivers/net/wireless/ath/ath10k/htt.h| 48 +---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 37 
 3 files changed, 40 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 1b92f84..09acb00 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -200,7 +200,7 @@ struct ath10k_htt *ath10k_htt_attach(struct ath10k *ar)
return NULL;
 
htt->ar = ar;
-   htt->cfg.max_throughput_mbps = 800;
+   htt->max_throughput_mbps = 800;
 
/*
 * Connect to HTC service.
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index bd3b0b4..e4bac01 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1090,38 +1090,35 @@ struct htt_rx_info {
bool fcs_err;
 };
 
+#define HTT_MAX_NUM_PENDING_TX 512 /* FIXME: find proper value? */
+
 struct ath10k_htt {
struct ath10k *ar;
enum ath10k_htc_ep_id eid;
 
-   struct {
-   int max_throughput_mbps;
-   } cfg;
-
+   int max_throughput_mbps;
u8 target_version_major;
u8 target_version_minor;
struct completion target_version_received;
 
struct {
-   struct {
-   /*
-* Ring of network buffer objects - This ring is
-* used exclusively by the host SW. This ring
-* mirrors the dev_addrs_ring that is shared
-* between the host SW and the MAC HW. The host SW
-* uses this netbufs ring to locate the network
-* buffer objects whose data buffers the HW has
-* filled.
-*/
-   struct sk_buff **netbufs_ring;
-   /*
-* Ring of buffer addresses -
-* This ring holds the "physical" device address of the
-* rx buffers the host SW provides for the MAC HW to
-* fill.
-*/
-   __le32 *paddrs_ring;
-   } buf;
+   /*
+* Ring of network buffer objects - This ring is
+* used exclusively by the host SW. This ring
+* mirrors the dev_addrs_ring that is shared
+* between the host SW and the MAC HW. The host SW
+* uses this netbufs ring to locate the network
+* buffer objects whose data buffers the HW has
+* filled.
+*/
+   struct sk_buff **netbufs_ring;
+   /*
+* Ring of buffer addresses -
+* This ring holds the "physical" device address of the
+* rx buffers the host SW provides for the MAC HW to
+* fill.
+*/
+   __le32 *paddrs_ring;
 
/*
 * Base address of ring, as a "physical" device address
@@ -1168,11 +1165,6 @@ struct ath10k_htt {
 
unsigned int prefetch_len;
 
-   struct {
-   int htc_err_cnt;
-   } stats;
-
-#define HTT_MAX_NUM_PENDING_TX 512 /* FIXME: find proper value? */
spinlock_t tx_lock;
struct sk_buff *pending_tx[HTT_MAX_NUM_PENDING_TX];
DECLARE_BITMAP(used_msdu_ids, HTT_MAX_NUM_PENDING_TX);
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index a310dde..95ffcc2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -237,7 +237,7 @@ static int ath10k_htt_rx_ring_size(struct ath10k_htt *htt)
 
/* 1e6 bps/mbps / 1e3 ms per sec = 1000 */
size =
-   htt->cfg.max_throughput_mbps +
+   htt->max_throughput_mbps +
1000  /
(8 * HTT_RX_AVG_FRM_BYTES) * HTT_RX_HOST_LATENCY_MAX_MS;
 
@@ -258,7 +258,7 @@ static int ath10k_htt_rx_ring_fill_level(struct ath10k_htt 
*htt)
 
/* 1e6 bps/mbps / 1e3 ms per sec = 1000 */
size =
-   htt->cfg.max_throughput_mbps *
+   htt->max_throughput_mbps *
1000  /
(8 * HTT_RX_AVG_FRM_BYTES) * HTT_RX_HOST_LATENCY_WORST_LIKELY_MS;
 
@@ -316,8 +316,8 @@ static void ath10k_htt_rx_ring_fill_n(struct ath10k_htt 
*htt, int num)
}
 
ATH10K_SKB_CB(skb)->paddr = paddr;
-   htt->rx_ring.buf.netbufs_ring[idx] = skb;
-   htt->rx_ring.buf.paddrs_ring[idx] = __cpu_to_le32(paddr);
+   htt->rx_ring.netbufs_ring[idx

Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Oleksij Rempel
Am 28.04.2013 17:03, schrieb Oleksij Rempel:
> Am 28.04.2013 16:13, schrieb Oleksij Rempel:
>> Am 28.04.2013 14:51, schrieb Felix Fietkau:
>>> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
 Collect statistics about recived duplicate and STBC packets.
 This information should help see if STBC is actually working.

 Tested on ar9285;

 Signed-off-by: Oleksij Rempel 
>>> I thought about this patch some more, and I'm wondering what's the point
>>> in doing this? These statistics are going to be completely useless for
>>> most people and they'll waste some memory/cpu cycles, especially on
>>> small-cache devices. I think it's much more useful to simply pass the
>>> information to mac80211 via rx flags and get them added to the radiotap
>>> header.
>>
>> Sure.

Now i need some help.
Why there is no traces of  radiotap in ath9k. Some other drivers have 
them? Do it communicate in some different way or there is just no 
radiotap support in ath9k?


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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Felix Fietkau
On 2013-04-28 9:19 PM, Oleksij Rempel wrote:
> Am 28.04.2013 17:03, schrieb Oleksij Rempel:
>> Am 28.04.2013 16:13, schrieb Oleksij Rempel:
>>> Am 28.04.2013 14:51, schrieb Felix Fietkau:
 On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
> Collect statistics about recived duplicate and STBC packets.
> This information should help see if STBC is actually working.
>
> Tested on ar9285;
>
> Signed-off-by: Oleksij Rempel 
 I thought about this patch some more, and I'm wondering what's the point
 in doing this? These statistics are going to be completely useless for
 most people and they'll waste some memory/cpu cycles, especially on
 small-cache devices. I think it's much more useful to simply pass the
 information to mac80211 via rx flags and get them added to the radiotap
 header.
>>>
>>> Sure.
> 
> Now i need some help.
> Why there is no traces of  radiotap in ath9k. Some other drivers have 
> them? Do it communicate in some different way or there is just no 
> radiotap support in ath9k?
radiotap is generated in mac80211, so there's no need for the driver to
do it.

- Felix

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


Re: [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB

2013-04-28 Thread Michal Kazior
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan 
>
> Signed-off-by: Sujith Manoharan 
> ---
>   drivers/net/wireless/ath/ath10k/core.h |  4 
>   drivers/net/wireless/ath/ath10k/htc.c  | 26 --
>   2 files changed, 12 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.h 
> b/drivers/net/wireless/ath/ath10k/core.h
> index 18f8eca..7f27148 100644
> --- a/drivers/net/wireless/ath/ath10k/core.h
> +++ b/drivers/net/wireless/ath/ath10k/core.h
> @@ -65,10 +65,6 @@ struct ath10k_skb_cb {
>   struct sk_buff *msdu;
>   } __packed htt;
>
> - struct {
> - u8 credits_used;
> - } __packed htc;
> -
>   /* 4 bytes left on 64bit arch */

The comment could be updated too to reflect there's more space in the 
ath10k_skb_cb now.


-- 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 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c

2013-04-28 Thread Michal Kazior
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan 
>
> Signed-off-by: Sujith Manoharan 
> ---
>   drivers/net/wireless/ath/ath10k/htt.h| 12 
>   drivers/net/wireless/ath/ath10k/htt_rx.c | 12 
>   2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
> b/drivers/net/wireless/ath/ath10k/htt.h
> index d416a4f..bd3b0b4 100644
> --- a/drivers/net/wireless/ath/ath10k/htt.h
> +++ b/drivers/net/wireless/ath/ath10k/htt.h
> @@ -478,18 +478,6 @@ struct htt_rx_indication {
>   struct htt_rx_indication_mpdu_range mpdu_ranges[0];
>   } __packed;
>
> -static inline struct htt_rx_indication_mpdu_range *
> - htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
> -{
> - void *ptr = rx_ind;
> -
> - ptr += sizeof(rx_ind->hdr)
> -  + sizeof(rx_ind->ppdu)
> -  + sizeof(rx_ind->prefix)
> -  + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
> - return ptr;
> -}
> -

I'm not really convinced with this. The idea is the function defines how 
to access the variadic structure member position so it should stay close 
to the structure definition. This could as well be a #define but an 
inline function looks cleaner IMHO.



-- 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 10/20] ath10k: Remove "credits_used" from SKB CB

2013-04-28 Thread Sujith Manoharan
Michal Kazior wrote:
> The comment could be updated too to reflect there's more space in the 
> ath10k_skb_cb now.

Sure, I'll do that in a followup patch.

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


Re: [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c

2013-04-28 Thread Sujith Manoharan
Michal Kazior wrote:
> I'm not really convinced with this. The idea is the function defines how 
> to access the variadic structure member position so it should stay close 
> to the structure definition. This could as well be a #define but an 
> inline function looks cleaner IMHO.

Alright, we can keep it there. Kalle, please drop this patch.

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


[ath9k-devel] [PATCH] ath10k: Fix mpdu spacing to 8us

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

The FW doesn't fill the mpdu density field in the HT
capabilities received in the service_ready event and
the host driver ends up advertising 0 in its capabilities.

Fix this by hard-coding the spacing time to 8us.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/mac.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 0dfeae8..d31fa1c 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2534,6 +2534,7 @@ static struct ieee80211_sta_ht_cap 
ath10k_get_ht_cap(struct ath10k *ar)
 
ht_cap.ht_supported = 1;
ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
+   ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
@@ -2574,16 +2575,6 @@ static struct ieee80211_sta_ht_cap 
ath10k_get_ht_cap(struct ath10k *ar)
if (ar->ht_cap_info & WMI_HT_CAP_L_SIG_TXOP_PROT)
ht_cap.cap |= IEEE80211_HT_CAP_LSIG_TXOP_PROT;
 
-   if (ar->ht_cap_info & WMI_HT_CAP_MPDU_DENSITY) {
-   u32 density;
-
-   density   = ar->ht_cap_info;
-   density  &= WMI_HT_CAP_MPDU_DENSITY;
-   density >>= WMI_HT_CAP_MPDU_DENSITY_MASK_SHIFT;
-
-   ht_cap.ampdu_density = density;
-   }
-
/* max AMSDU is implicitly taken from vht_cap_info */
if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
-- 
1.8.2.2

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


[ath9k-devel] [PATCH] ath10k: Fix TXOP handling

2013-04-28 Thread Sujith Manoharan
From: Sujith Manoharan 

The channel time duration programmed in the HW is in absolute microseconds,
while mac80211 gives the txop in units of 32 microseconds. Handle this
properly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath10k/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index d31fa1c..bd91b15 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2188,7 +2188,7 @@ static int ath10k_conf_tx(struct ieee80211_hw *hw,
p->cwmin = params->cw_min;
p->cwmax = params->cw_max;
p->aifs = params->aifs;
-   p->txop = params->txop;
+   p->txop = params->txop * 32;
/* FIXME: can we pass the params->uapsd to the FW? */
/* FIXME: FW accepts wmm params per hw, not per vif */
 
-- 
1.8.2.2

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


Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach

2013-04-28 Thread Michal Kazior
On 28/04/13 17:31, Sujith Manoharan wrote:
> From: Sujith Manoharan 
>
> We can dispense with the lockdep assert since the refill
> timer just calls the replenish routine which is held under
> the ring lock.

Doesn't sound good to me.

The lockdep is there for a reason. This explicitly states the function 
must be under the htt rx lock and makes sure this is verified. This 
should not be removed.

If (which can be arguably near impossible) the initial 
ath10k_htt_rx_ring_fill_n() in htt rx attach fires of a timer and we get 
a crazy pre-emption between mod_timer() and goto we will
corrupt the htt rx ring state without the lock here.


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


Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach

2013-04-28 Thread Sujith Manoharan
Michal Kazior wrote:
> Doesn't sound good to me.
> 
> The lockdep is there for a reason. This explicitly states the function 
> must be under the htt rx lock and makes sure this is verified. This 
> should not be removed.
> 
> If (which can be arguably near impossible) the initial 
> ath10k_htt_rx_ring_fill_n() in htt rx attach fires of a timer and we get 
> a crazy pre-emption between mod_timer() and goto we will
> corrupt the htt rx ring state without the lock here.

If the system is so memory-starved that basic allocation during driver bring-up
fails, we should just bail out gracefully and not jump through hoops, hoping
that things might improve.

If this is done, the locks in attach() can be removed and the lockdep_assert()
can stay. But yes, I missed this subtle race condition so this patch can't go in
as is.

When the driver is operational, the simplest thing to do when RX overrun 
happens,
is to drop incoming packets until the situation eases (drivers like ath9k do 
this,
by re-using pre-allocated buffers). ath10k uses up the RX ring instead, until
the driver effectively stalls. I am not sure which model is better.

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


Re: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach

2013-04-28 Thread Sujith Manoharan
Sujith Manoharan wrote:
> If the system is so memory-starved that basic allocation during driver 
> bring-up
> fails, we should just bail out gracefully and not jump through hoops, hoping
> that things might improve.

...and it doesn't seem correct to proceed with init after htt_rx_attach() has
failed due to memory allocation, since subsequent allocations would probably 
fail
too.

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


Re: [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets

2013-04-28 Thread Wojciech Dubowik
On 04/28/2013 05:03 PM, Oleksij Rempel wrote:
> Am 28.04.2013 16:13, schrieb Oleksij Rempel:
>> Am 28.04.2013 14:51, schrieb Felix Fietkau:
>>> On 2013-04-27 5:25 PM, Oleksij Rempel wrote:
 Collect statistics about recived duplicate and STBC packets.
 This information should help see if STBC is actually working.

 Tested on ar9285;

 Signed-off-by: Oleksij Rempel 
>>> I thought about this patch some more, and I'm wondering what's the 
>>> point
>>> in doing this? These statistics are going to be completely useless for
>>> most people and they'll waste some memory/cpu cycles, especially on
>>> small-cache devices. I think it's much more useful to simply pass the
>>> information to mac80211 via rx flags and get them added to the radiotap
>>> header.
>>
>> Sure.
>>
>
> I see Wojciech Dubowik sanded some patches, for at least one year, to 
> make exactly what Felix suggested. Are there any reason why this 
> patches was not accepted?
> Wojciech if you alive and have some time, can you update them?
Sure. I will try to update them based on suggested radiotap field 
structure for STBC and Ness.

On the other hand as Felix already mentioned it's yet another line of 
code one needs once in a lifetime.
If one is checking whether stbc is working the easiest way is to create 
own debugging namespace
in radiotap and dump all descriptor registers there. It probably doesn't 
go mainline but you could apply
the patches when you need and they mostly rebase cleanly. At least 
that's what I do.

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