Re: [ath9k-devel] UNDERRUN / PHY ERR in /sys/kernel/debug/ath9k/phy0/recv

2011-01-20 Thread Bernhard Walle
Hi again,

Am 11.01.2011 17:24, schrieb Bernhard Walle:
> 
> can somebody explain what
> 
>> [...]
>>PHY ERR :  96196
>> [...]
>>   UNDERRUN :  96196
>> [...]
> 
> in /sys/kernel/debug/ath9k/phy0/recv actually means. Is that normal, or
> a hardware problem, or a driver problem?
> 
> Thanks for any pointers!

Does that really nobody know? Anyone else seeing that problem?


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


Re: [ath9k-devel] UNDERRUN / PHY ERR in /sys/kernel/debug/ath9k/phy0/recv

2011-01-20 Thread Mohammed Shafi
On Thu, Jan 20, 2011 at 3:23 PM, Bernhard Walle  wrote:
> Hi again,
>
> Am 11.01.2011 17:24, schrieb Bernhard Walle:
>>
>> can somebody explain what
>>
>>> [...]
>>>            PHY ERR :      96196
>>> [...]
>>>           UNDERRUN :      96196
>>> [...]
>>
>> in /sys/kernel/debug/ath9k/phy0/recv actually means. Is that normal, or
>> a hardware problem, or a driver problem?
>>
>> Thanks for any pointers!
>
> Does that really nobody know? Anyone else seeing that problem?

Hi I had seen PHY_ERR but not of this much frequency.
have not seen UNDERRUN errors like this
what card are you using ? and kernel /compat wireless

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


Re: [ath9k-devel] UNDERRUN / PHY ERR in /sys/kernel/debug/ath9k/phy0/recv

2011-01-20 Thread Bernhard Walle
Hello,

Am 20.01.2011 11:07, schrieb Mohammed Shafi:
> On Thu, Jan 20, 2011 at 3:23 PM, Bernhard Walle  wrote:
>> Am 11.01.2011 17:24, schrieb Bernhard Walle:
>>>
>>> can somebody explain what
>>>
 [...]
PHY ERR :  96196
 [...]
   UNDERRUN :  96196
 [...]
>>>
>>> in /sys/kernel/debug/ath9k/phy0/recv actually means. Is that normal, or
>>> a hardware problem, or a driver problem?
>>>
>>> Thanks for any pointers!
>>
>> Does that really nobody know? Anyone else seeing that problem?
> 
> Hi I had seen PHY_ERR but not of this much frequency.
> have not seen UNDERRUN errors like this
> what card are you using ? and kernel /compat wireless

I'm using a SparkLAN WPEA-111N with 2.6.37 vanilla driver/kernel. I'm
seeing that error only on the AP side, not the STA side.


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


Re: [ath9k-devel] UNDERRUN / PHY ERR in /sys/kernel/debug/ath9k/phy0/recv

2011-01-20 Thread Mohammed Shafi
On Thu, Jan 20, 2011 at 3:43 PM, Bernhard Walle  wrote:
> Hello,
>
> Am 20.01.2011 11:07, schrieb Mohammed Shafi:
>> On Thu, Jan 20, 2011 at 3:23 PM, Bernhard Walle  wrote:
>>> Am 11.01.2011 17:24, schrieb Bernhard Walle:

 can somebody explain what

> [...]
>            PHY ERR :      96196
> [...]
>           UNDERRUN :      96196
> [...]

 in /sys/kernel/debug/ath9k/phy0/recv actually means. Is that normal, or
 a hardware problem, or a driver problem?

 Thanks for any pointers!
>>>
>>> Does that really nobody know? Anyone else seeing that problem?
>>
>> Hi I had seen PHY_ERR but not of this much frequency.
>> have not seen UNDERRUN errors like this
>> what card are you using ? and kernel /compat wireless
>
> I'm using a SparkLAN WPEA-111N with 2.6.37 vanilla driver/kernel. I'm
> seeing that error only on the AP side, not the STA side.

Ok, I referred to station(AR9280) and yours also same i think.
Have not tested it in AP.


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


Re: [ath9k-devel] ath9k_htc in master mode / 0cf3:9271 Atheros Communications AR9271 802.11n / USB TP-Link TL-WN722N / detachable antenna - RSMA

2011-01-20 Thread Mohammed Shafi
On Wed, Jan 19, 2011 at 6:30 AM, Jorge Luis  wrote:
> Senthilkumar Balasubramanian  gmail.com> writes:
>
>>
>> On Mon, Dec 27, 2010 at 9:58 AM, Mohammed Shafi  gmail.com>
> wrote:
>> > 2010/12/27 . .m.  hotmail.com>:
>> >> My first post, please feel free to criticize.
>> >> I have bought mentioned USB stick, I saw some note about HOST AP mode for
>> >> win,
>> >> but I sadly found I am not able to run master (AP) mode under linux
>> >> (compat-wireless 2010-12-14)
>> >
>> > AP mode is yet to be supported in htc. Please refer to this
>> > http://www.spinics.net/lists/linux-wireless/msg52239.html
>> >
>>
>> Sujith's patches can be used to test basic AP mode functionality. We
>> are working on addressing the buffering mode cleanly and the new set
>> of patches should be available by first week of January 2011. Let me
>> know if you are interested in doing some verification.
>>
>> >> I did some wifi driver development some time ago - and I would love to 
>> >> help
>> >> develop
>> >> access point code for this USB
>> >> please point me in the right direction.
>> >> thanks a lot
>> >> best regards
>> >> mulisak
>> >>
>> >>
>> >> ___
>> >> ath9k-devel mailing list
>> >> ath9k-devel  lists.ath9k.org
>> >> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>> >>
>> >>
>> > ___
>> > ath9k-devel mailing list
>> > ath9k-devel  lists.ath9k.org
>> > https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>> >
>>
>
>
> Hello,
> I own a TL-WN722N, applied the patch (1/2) and
> I'm able to associate to the device in AP mode with hostapd.
>
> I can even authenticate in WPA2 mode,
> which I can't do with a ralink rt2870 based device
> that is supposed to work properly in AP mode
> The traffic throughput also seems fine.
>
> Can you explain what are the limitations of not having the
> buffering mode working?
>
> For what I can understand, that only affects clients with
> power saving enabled.
> Is this correct?

Yes correct, developers are working to bring that in firmware to make
it perfect.

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


Re: [ath9k-devel] [PATCH] ath9k: Try more than one queue when scheduling new aggregate.

2011-01-20 Thread Felix Fietkau
On 2011-01-19 2:30 AM, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Try all xmit queues until the hardware buffers are full.
Acked-by: Felix Fietkau 
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] Why 2 beacon_interval variables?

2011-01-20 Thread Björn Smedman
On Wed, Jan 19, 2011 at 12:58 PM, Steve Brown  wrote:
> Thanks for the reference. The beacon_interval in that commit looks
> redundant to me too. It turned up while I was testing some code for
> beacons at different intervals. It's simpler if there is just
> beacon_interval.

How far along are you on that code for beacons at different intervals?
That would be really nice to have.

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


Re: [ath9k-devel] Why 2 beacon_interval variables?

2011-01-20 Thread Steve Brown
On Thu, 2011-01-20 at 18:16 +0100, Björn Smedman wrote:
> On Wed, Jan 19, 2011 at 12:58 PM, Steve Brown  wrote:
> > Thanks for the reference. The beacon_interval in that commit looks
> > redundant to me too. It turned up while I was testing some code for
> > beacons at different intervals. It's simpler if there is just
> > beacon_interval.
> 
> How far along are you on that code for beacons at different intervals?
> That would be really nice to have.
> 
> /Björn

I've got a bridged AP and MP running. The AP beacon interval is 100 and
the MP is 1000. If I'm unable to break it over the next few days, I'll
clean it up and post an RFC.

Steve


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


[ath9k-devel] Should we remove all the virtual wiphy code from ath9k?

2011-01-20 Thread Ben Greear
Seems I saw a note a long time ago about virtual wiphy being
removed sometime soon.  Should we go ahead and remove it?

It doesn't seem useful to me (virtual interfaces appear to
work much better), and it would likely simplify the code
a bit to have it gone.

Thanks,
Ben

-- 
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] Should we remove all the virtual wiphy code from ath9k?

2011-01-20 Thread Jouni Malinen
On Thu, 2011-01-20 at 10:27 -0800, Ben Greear wrote:
> Seems I saw a note a long time ago about virtual wiphy being
> removed sometime soon.  Should we go ahead and remove it?
> 
> It doesn't seem useful to me (virtual interfaces appear to
> work much better), and it would likely simplify the code
> a bit to have it gone.

I think some people were using virtual wiphy to work around some issues
with vifs, but that is not really useful from the view point of fixing
any issues with vifs that may remain.. As far as the support for
multiple channel operations is concerned, that will hopefully be added
to vifs at some point and the experimental code I added for virtual
wiphys is really very much in the experimental side.

Even though I have been somewhat against removing this before vifs get
multi-channel support, I think I would be fine with getting rid of the
current virtual wiphy implementation now with the justification being
that it will help addressing other fixes and improvements.

- Jouni


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


Re: [ath9k-devel] Should we remove all the virtual wiphy code from ath9k?

2011-01-20 Thread Luis R. Rodriguez
On Thu, Jan 20, 2011 at 10:27:01AM -0800, Ben Greear wrote:
> Seems I saw a note a long time ago about virtual wiphy being
> removed sometime soon.  Should we go ahead and remove it?
> 
> It doesn't seem useful to me (virtual interfaces appear to
> work much better), and it would likely simplify the code
> a bit to have it gone.

As much as I love the funcitonality it complicates the driver,
and I would welcome the rm -rf of it given that experimenters
can simply use older kernels now with the virtual wiphy.
Jouni, thoughts?

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


Re: [ath9k-devel] ath9k_htc in master mode / 0cf3:9271 Atheros Communications AR9271 802.11n / USB TP-Link TL-WN722N / detachable antenna - RSMA

2011-01-20 Thread C Anthony Risinger
On Thu, Jan 20, 2011 at 5:12 AM, Mohammed Shafi
 wrote:
> On Wed, Jan 19, 2011 at 6:30 AM, Jorge Luis  wrote:
>> Senthilkumar Balasubramanian  gmail.com> writes:
>>> On Mon, Dec 27, 2010 at 9:58 AM, Mohammed Shafi  gmail.com>
>> wrote:
>>> >
>>> > AP mode is yet to be supported in htc. Please refer to this
>>> > http://www.spinics.net/lists/linux-wireless/msg52239.html
>>>
>>> Sujith's patches can be used to test basic AP mode functionality. We
>>> are working on addressing the buffering mode cleanly and the new set
>>> of patches should be available by first week of January 2011. Let me
>>> know if you are interested in doing some verification.
>>
>> Can you explain what are the limitations of not having the
>> buffering mode working?
>>
>> For what I can understand, that only affects clients with
>> power saving enabled.
>> Is this correct?
>
> Yes correct, developers are working to bring that in firmware to make
> it perfect.

i have the same USB device (TL-WN722N) as well.  i'd like to try the
simpler patches in my home network... what are the consequences of not
properly handling power save mode?  i have multiple android phones
that i'm guessing make use of this feature; does it simply translate
to dropped/missed packets, or something more?

thanks,

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


Re: [ath9k-devel] ath9k_htc in master mode / 0cf3:9271 Atheros Communications AR9271 802.11n / USB TP-Link TL-WN722N / detachable antenna - RSMA

2011-01-20 Thread Jorge Luis
On 20 Jan 2011 20:14, "C Anthony Risinger"  wrote:
>
> On Thu, Jan 20, 2011 at 5:12 AM, Mohammed Shafi
>  wrote:
> > On Wed, Jan 19, 2011 at 6:30 AM, Jorge Luis  wrote:
> >> Senthilkumar Balasubramanian  gmail.com>
writes:
> >>> On Mon, Dec 27, 2010 at 9:58 AM, Mohammed Shafi 
gmail.com>
> >> wrote:
> >>> >
> >>> > AP mode is yet to be supported in htc. Please refer to this
> >>> > http://www.spinics.net/lists/linux-wireless/msg52239.html
> >>>
> >>> Sujith's patches can be used to test basic AP mode functionality. We
> >>> are working on addressing the buffering mode cleanly and the new set
> >>> of patches should be available by first week of January 2011. Let me
> >>> know if you are interested in doing some verification.
> >>
> >> Can you explain what are the limitations of not having the
> >> buffering mode working?
> >>
> >> For what I can understand, that only affects clients with
> >> power saving enabled.
> >> Is this correct?
> >
> > Yes correct, developers are working to bring that in firmware to make
> > it perfect.
>
> i have the same USB device (TL-WN722N) as well.  i'd like to try the
> simpler patches in my home network... what are the consequences of not
> properly handling power save mode?  i have multiple android phones
> that i'm guessing make use of this feature; does it simply translate
> to dropped/missed packets, or something more?
>
> thanks,
>
> C Anthony

Hi,
I have been testing it with an HTC desire and the device disconnect and
reconects every 10 seconds unless there is an active data connection.
It's not usable
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] UNDERRUN / PHY ERR in /sys/kernel/debug/ath9k/phy0/recv

2011-01-20 Thread Luis R. Rodriguez
On Tue, Jan 11, 2011 at 8:24 AM, Bernhard Walle  wrote:
> Hello ath9k experts,
>
> can somebody explain what
>
>> [...]
>>            PHY ERR :      96196
>> [...]
>>           UNDERRUN :      96196
>> [...]
>
> in /sys/kernel/debug/ath9k/phy0/recv actually means. Is that normal, or
> a hardware problem, or a driver problem?

Kyungwan has explained to me:

We have 3 types of underrun, fifo_underrun, tx_data_underrun_err and
tx_dlmtr_underrun_err. All 3 underruns happen because there is not
enough data for transmission. But when happens and how to handle are
slightly different for each type.

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


[ath9k-devel] [RFC/WIP 00/33] ath9k_htc AP mode

2011-01-20 Thread Sujith
This series is the preliminary work for enabling AP mode for ath9k_htc.

A firmware update is needed, place look at:
http://wireless.kernel.org/en/users/Drivers/ath9k_htc#AP_Mode

Known issues:

* Beacon misses under heavy TX load
  ( hopefully, a fix would be sent out soon).

This has not been tested rigorously, so consider this series as
experimental code.

Sujith

Sujith Manoharan (33):
  ath9k_htc: Allow upto two simultaneous interfaces
  ath9k_htc: Unify target capability updation
  ath9k_htc: Fix error handling in add_interface
  ath9k_htc: Remove OP_PREAMBLE_SHORT
  ath9k_htc: Remove OP_PROTECT_ENABLE
  ath9k_htc: Remove OP_ASSOCIATED variable
  ath9k_htc: Set the BSSID mask for multiple interfaces
  ath9k_htc: Make sequence number calculation per-VIF
  ath9k_htc: Use VIF from the packet's control data
  ath9k_htc: Protect ampdu_action with a mutex
  ath9k_htc: Fix WMI and beacon header
  ath9k_htc: Maintain individual counters for interfaces
  ath9k_htc: Allow AP interface to be created
  ath9k_htc: Calculate and set the HW opmode
  ath9k_htc: Add ANI for AP mode
  ath9k_htc: Disable powersave if an AP interface is present
  ath9k_htc: Configure beacon timers in AP mode
  ath9k_htc: Add beacon slots
  ath9k_htc: Fix TBTT calculation for IBSS mode
  ath9k_htc: Add TSF adjust capability
  ath9k_htc: Configure the beacon queue
  ath9k_htc: Handle buffered frames in AP mode
  ath9k_htc: Enable AP mode
  ath9k_htc: Fix beacon miss under heavy load
  ath9k_htc: Queue WMI events
  ath9k_htc: Handle BSSID/AID for multiple interfaces
  ath9k_htc: Move debug code to a separate file
  ath9k_htc: Add RX error statistics
  ath9k_htc: Fix RX length check
  ath9k_htc: Fix host RX initialization
  ath9k_htc: Remove unused WMI commands
  ath9k_htc: Use SKB's private area for TX parameters
  ath9k_htc: Drain packets on station removal

 drivers/net/wireless/ath/ath9k/Makefile |2 +
 drivers/net/wireless/ath/ath9k/hif_usb.c|   51 ++-
 drivers/net/wireless/ath/ath9k/htc.h|  133 -
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |  432 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c  |  310 +++
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |   14 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |  649 +++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |  127 +++--
 drivers/net/wireless/ath/ath9k/htc_hst.c|   23 +-
 drivers/net/wireless/ath/ath9k/htc_hst.h|7 +-
 drivers/net/wireless/ath/ath9k/wmi.c|   89 ++--
 drivers/net/wireless/ath/ath9k/wmi.h|   18 +-
 12 files changed, 1329 insertions(+), 526 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_debug.c

-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 01/33] ath9k_htc: Allow upto two simultaneous interfaces

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Multiple interfaces can be configured if a slot is free
on the target. Monitor mode also requires a slot.

The maximum number of stations that can be handled in
the firmware is 8, manage the station slots accordingly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |7 +
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  148 +
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |   29 -
 3 files changed, 130 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 6354986..ff6bfd9 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -204,6 +204,8 @@ struct ath9k_htc_target_stats {
__be32 ht_tx_xretries;
 } __packed;
 
+#define ATH9K_HTC_MAX_VIF 2
+
 struct ath9k_htc_vif {
u8 index;
 };
@@ -358,6 +360,11 @@ struct ath9k_htc_priv {
enum htc_endpoint_id data_vi_ep;
enum htc_endpoint_id data_vo_ep;
 
+   u8 vif_slot;
+   u8 mon_vif_idx;
+   u8 sta_slot;
+   u8 vif_sta_pos[ATH9K_HTC_MAX_VIF];
+
u16 op_flags;
u16 curtxpow;
u16 txpowlimit;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f14f37d..e8e512a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -236,6 +236,13 @@ err:
return ret;
 }
 
+/*
+ * Monitor mode handling is a tad complicated because the firmware requires
+ * an interface to be created exclusively, while mac80211 doesn't associate
+ * an interface with the mode.
+ *
+ * So, for now, only one monitor interface can be configured.
+ */
 static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
 {
struct ath_common *common = ath9k_hw_common(priv->ah);
@@ -245,9 +252,10 @@ static void __ath9k_htc_remove_monitor_interface(struct 
ath9k_htc_priv *priv)
 
memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
-   hvif.index = 0; /* Should do for now */
+   hvif.index = priv->mon_vif_idx;
WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
priv->nvifs--;
+   priv->vif_slot &= ~(1 << priv->mon_vif_idx);
 }
 
 static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
@@ -255,51 +263,69 @@ static int ath9k_htc_add_monitor_interface(struct 
ath9k_htc_priv *priv)
struct ath_common *common = ath9k_hw_common(priv->ah);
struct ath9k_htc_target_vif hvif;
struct ath9k_htc_target_sta tsta;
-   int ret = 0;
+   int ret = 0, sta_idx;
u8 cmd_rsp;
 
-   if (priv->nvifs > 0)
-   return -ENOBUFS;
+   if ((priv->nvifs >= ATH9K_HTC_MAX_VIF) ||
+   (priv->nstations >= ATH9K_HTC_MAX_STA)) {
+   ret = -ENOBUFS;
+   goto err_vif;
+   }
 
-   if (priv->nstations >= ATH9K_HTC_MAX_STA)
-   return -ENOBUFS;
+   sta_idx = ffz(priv->sta_slot);
+   if ((sta_idx < 0) || (sta_idx > ATH9K_HTC_MAX_STA)) {
+   ret = -ENOBUFS;
+   goto err_vif;
+   }
 
/*
 * Add an interface.
 */
-
memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
 
hvif.opmode = cpu_to_be32(HTC_M_MONITOR);
-   priv->ah->opmode = NL80211_IFTYPE_MONITOR;
-   hvif.index = priv->nvifs;
+   hvif.index = ffz(priv->vif_slot);
 
WMI_CMD_BUF(WMI_VAP_CREATE_CMDID, &hvif);
if (ret)
-   return ret;
+   goto err_vif;
+
+   /*
+* Assign the monitor interface index as a special case here.
+* This is needed when the interface is brought down.
+*/
+   priv->mon_vif_idx = hvif.index;
+   priv->vif_slot |= (1 << hvif.index);
+
+   /*
+* Set the hardware mode to monitor only if there are no
+* other interfaces.
+*/
+   if (!priv->nvifs)
+   priv->ah->opmode = NL80211_IFTYPE_MONITOR;
 
priv->nvifs++;
 
/*
 * Associate a station with the interface for packet injection.
 */
-
memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta));
 
memcpy(&tsta.macaddr, common->macaddr, ETH_ALEN);
 
tsta.is_vif_sta = 1;
-   tsta.sta_index = priv->nstations;
+   tsta.sta_index = sta_idx;
tsta.vif_index = hvif.index;
tsta.maxampdu = 0x;
 
WMI_CMD_BUF(WMI_NODE_CREATE_CMDID, &tsta);
if (ret) {
ath_err(common, "Unable to add station entry for monitor 
mode\n");
-   goto err_vif;
+   goto err_sta;
}
 
+   priv->sta_slot |= (1 << sta_idx);
priv->nstations++;
 
/*
@@ -310,15 +336,23 @@ static int ath9k_htc_add_monitor_interface(struct 
ath9k_htc_priv *priv

[ath9k-devel] [RFC/WIP 02/33] ath9k_htc: Unify target capability updation

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Update capabilites on the target once, when
start() is called, there is no need for redundant
updation on adding an interface.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   19 +--
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index e8e512a..c960330 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -327,15 +327,6 @@ static int ath9k_htc_add_monitor_interface(struct 
ath9k_htc_priv *priv)
 
priv->sta_slot |= (1 << sta_idx);
priv->nstations++;
-
-   /*
-* Set chainmask etc. on the target.
-*/
-   ret = ath9k_htc_update_cap_target(priv);
-   if (ret)
-   ath_dbg(common, ATH_DBG_CONFIG,
-   "Failed to update capability in target\n");
-
priv->vif_sta_pos[priv->mon_vif_idx] = sta_idx;
priv->ah->is_monitoring = true;
 
@@ -1058,6 +1049,11 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
 
ath9k_host_rx_init(priv);
 
+   ret = ath9k_htc_update_cap_target(priv);
+   if (ret)
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "Failed to update capability in target\n");
+
priv->op_flags &= ~OP_INVALID;
htc_start(priv->htc);
 
@@ -1180,11 +1176,6 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
if (ret)
goto out;
 
-   ret = ath9k_htc_update_cap_target(priv);
-   if (ret)
-   ath_dbg(common, ATH_DBG_CONFIG,
-   "Failed to update capability in target\n");
-
priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index);
priv->vif = vif;
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 03/33] ath9k_htc: Fix error handling in add_interface

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Addition of a station might fail - handle this error
properly by removing the VAP on the target.
Also, bail out immediately if the max. no of interfaces
has been reached.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index c960330..b3b33ff 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1138,7 +1138,8 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
 
if (priv->nvifs >= ATH9K_HTC_MAX_VIF) {
ret = -ENOBUFS;
-   goto out;
+   mutex_unlock(&priv->mutex);
+   return ret;
}
 
ath9k_htc_ps_wakeup(priv);
@@ -1166,18 +1167,19 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
if (ret)
goto out;
 
-   priv->nvifs++;
-
/*
 * We need a node in target to tx mgmt frames
 * before association.
 */
ret = ath9k_htc_add_station(priv, vif, NULL);
-   if (ret)
+   if (ret) {
+   WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
goto out;
+   }
 
priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index);
+   priv->nvifs++;
priv->vif = vif;
 
ath_dbg(common, ATH_DBG_CONFIG,
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 04/33] ath9k_htc: Remove OP_PREAMBLE_SHORT

2011-01-20 Thread Sujith
From: Sujith Manoharan 

mac80211's BSS info can be used for this.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |   13 ++---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |9 -
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index ff6bfd9..08ab28d 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -335,13 +335,12 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv 
*priv);
 #define OP_SCANNING   BIT(1)
 #define OP_LED_ASSOCIATED BIT(2)
 #define OP_LED_ON BIT(3)
-#define OP_PREAMBLE_SHORT BIT(4)
-#define OP_PROTECT_ENABLE BIT(5)
-#define OP_ASSOCIATED BIT(6)
-#define OP_ENABLE_BEACON  BIT(7)
-#define OP_LED_DEINIT BIT(8)
-#define OP_BT_PRIORITY_DETECTEDBIT(9)
-#define OP_BT_SCAN BIT(10)
+#define OP_PROTECT_ENABLE BIT(4)
+#define OP_ASSOCIATED BIT(5)
+#define OP_ENABLE_BEACON  BIT(6)
+#define OP_LED_DEINIT BIT(7)
+#define OP_BT_PRIORITY_DETECTEDBIT(8)
+#define OP_BT_SCAN BIT(9)
 
 struct ath9k_htc_priv {
struct device *dev;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index b3b33ff..8e76589 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1521,15 +1521,6 @@ static void ath9k_htc_bss_info_changed(struct 
ieee80211_hw *hw,
ath9k_htc_beacon_config(priv, vif);
}
 
-   if (changed & BSS_CHANGED_ERP_PREAMBLE) {
-   ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n",
-   bss_conf->use_short_preamble);
-   if (bss_conf->use_short_preamble)
-   priv->op_flags |= OP_PREAMBLE_SHORT;
-   else
-   priv->op_flags &= ~OP_PREAMBLE_SHORT;
-   }
-
if (changed & BSS_CHANGED_ERP_CTS_PROT) {
ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n",
bss_conf->use_cts_prot);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 06/33] ath9k_htc: Remove OP_ASSOCIATED variable

2011-01-20 Thread Sujith
From: Sujith Manoharan 

mac80211 stores the association state in ieee80211_bss_conf.
Use this and remove the local state, which is incorrect anyway
since it is stored globally and not on a per-VIF basis.

Restarting ANI and reconfiguration of HW beacon timers when a
scan run ends requires more work. This is handled by iterating
over the active interfaces.

Finally, remove the useless check for associated status in RX
processing.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|   14 +++---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   19 
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   56 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   26 +--
 4 files changed, 74 insertions(+), 41 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 79b67a1..425c8d0 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -335,11 +335,10 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv 
*priv);
 #define OP_SCANNING   BIT(1)
 #define OP_LED_ASSOCIATED BIT(2)
 #define OP_LED_ON BIT(3)
-#define OP_ASSOCIATED BIT(4)
-#define OP_ENABLE_BEACON  BIT(5)
-#define OP_LED_DEINIT BIT(6)
-#define OP_BT_PRIORITY_DETECTEDBIT(7)
-#define OP_BT_SCAN BIT(8)
+#define OP_ENABLE_BEACON  BIT(4)
+#define OP_LED_DEINIT BIT(5)
+#define OP_BT_PRIORITY_DETECTEDBIT(6)
+#define OP_BT_SCAN BIT(7)
 
 struct ath9k_htc_priv {
struct device *dev;
@@ -370,6 +369,8 @@ struct ath9k_htc_priv {
u16 nstations;
u16 seq_no;
u32 bmiss_cnt;
+   bool rearm_ani;
+   bool reconfig_beacon;
 
struct ath9k_hw_cal_data caldata;
 
@@ -429,6 +430,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv);
 void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 struct ieee80211_vif *vif);
+void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
 void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
 
 void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
@@ -441,7 +443,7 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff *skb,
 int ath9k_htc_update_cap_target(struct ath9k_htc_priv *priv);
 void ath9k_htc_station_work(struct work_struct *work);
 void ath9k_htc_aggr_work(struct work_struct *work);
-void ath9k_ani_work(struct work_struct *work);;
+void ath9k_ani_work(struct work_struct *work);
 void ath_start_ani(struct ath9k_htc_priv *priv);
 
 int ath9k_tx_init(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 87cc65a..133f628 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -283,3 +283,22 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
return;
}
 }
+
+void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv)
+{
+   struct ath_common *common = ath9k_hw_common(priv->ah);
+   struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
+
+   switch (priv->ah->opmode) {
+   case NL80211_IFTYPE_STATION:
+   ath9k_htc_beacon_config_sta(priv, cur_conf);
+   break;
+   case NL80211_IFTYPE_ADHOC:
+   ath9k_htc_beacon_config_adhoc(priv, cur_conf);
+   break;
+   default:
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "Unsupported beaconing mode\n");
+   return;
+   }
+}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index fe6e0bb..04b1609 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -116,6 +116,34 @@ void ath9k_ps_work(struct work_struct *work)
ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
 }
 
+static void ath9k_htc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
+{
+   struct ath9k_htc_priv *priv = data;
+   struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
+
+   if (bss_conf->assoc) {
+   priv->rearm_ani = true;
+   priv->reconfig_beacon = true;
+   }
+}
+
+static void ath9k_htc_vif_reconfig(struct ath9k_htc_priv *priv)
+{
+   priv->rearm_ani = false;
+   priv->reconfig_beacon = false;
+
+   ieee80211_iterate_active_interfaces_atomic(priv->hw,
+  ath9k_htc_vif_iter, priv);
+   if (priv->rearm_ani)
+   ath_start_ani(priv);
+
+   if (priv->reconfig_beacon) {
+   ath9k_htc_ps_wakeup(priv);
+   ath9k_htc_beacon_reconfig(priv);
+   ath9k_htc_ps_restore(priv);
+   }
+}
+
 void ath9k_h

[ath9k-devel] [RFC/WIP 07/33] ath9k_htc: Set the BSSID mask for multiple interfaces

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |5 +++
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   35 +
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 425c8d0..4e646fb 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -210,6 +210,11 @@ struct ath9k_htc_vif {
u8 index;
 };
 
+struct ath9k_vif_iter_data {
+   const u8 *hw_macaddr;
+   u8 mask[ETH_ALEN];
+};
+
 #define ATH9K_HTC_MAX_STA 8
 #define ATH9K_HTC_MAX_TID 8
 
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 04b1609..6bd7e25 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -144,6 +144,39 @@ static void ath9k_htc_vif_reconfig(struct ath9k_htc_priv 
*priv)
}
 }
 
+static void ath9k_htc_bssid_iter(void *data, u8 *mac, struct ieee80211_vif 
*vif)
+{
+   struct ath9k_vif_iter_data *iter_data = data;
+   int i;
+
+   for (i = 0; i < ETH_ALEN; i++)
+   iter_data->mask[i] &= ~(iter_data->hw_macaddr[i] ^ mac[i]);
+}
+
+static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv *priv,
+struct ieee80211_vif *vif)
+{
+   struct ath_common *common = ath9k_hw_common(priv->ah);
+   struct ath9k_vif_iter_data iter_data;
+
+   /*
+* Use the hardware MAC address as reference, the hardware uses it
+* together with the BSSID mask when matching addresses.
+*/
+   iter_data.hw_macaddr = common->macaddr;
+   memset(&iter_data.mask, 0xff, ETH_ALEN);
+
+   if (vif)
+   ath9k_htc_bssid_iter(&iter_data, vif->addr, vif);
+
+   /* Get list of all active MAC addresses */
+   ieee80211_iterate_active_interfaces_atomic(priv->hw, 
ath9k_htc_bssid_iter,
+  &iter_data);
+
+   memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
+   ath_hw_setbssidmask(common);
+}
+
 void ath9k_htc_reset(struct ath9k_htc_priv *priv)
 {
struct ath_hw *ah = priv->ah;
@@ -1198,6 +1231,8 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
goto out;
}
 
+   ath9k_htc_set_bssid_mask(priv, vif);
+
priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index);
priv->nvifs++;
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 08/33] ath9k_htc: Make sequence number calculation per-VIF

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 4e646fb..87e2d41 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -208,6 +208,7 @@ struct ath9k_htc_target_stats {
 
 struct ath9k_htc_vif {
u8 index;
+   u16 seq_no;
 };
 
 struct ath9k_vif_iter_data {
@@ -372,7 +373,6 @@ struct ath9k_htc_priv {
u16 txpowlimit;
u16 nvifs;
u16 nstations;
-   u16 seq_no;
u32 bmiss_cnt;
bool rearm_ani;
bool reconfig_beacon;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 133f628..bbbdd60 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -207,9 +207,9 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 
beacon_pending)
if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
struct ieee80211_hdr *hdr =
(struct ieee80211_hdr *) beacon->data;
-   priv->seq_no += 0x10;
+   avp->seq_no += 0x10;
hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-   hdr->seq_ctrl |= cpu_to_le16(priv->seq_no);
+   hdr->seq_ctrl |= cpu_to_le16(avp->seq_no);
}
 
tx_ctl.type = ATH9K_HTC_NORMAL;
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 09/33] ath9k_htc: Use VIF from the packet's control data

2011-01-20 Thread Sujith
From: Sujith Manoharan 

There is no need to use a locally stored reference.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 6ddcf93..04d8248 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -232,6 +232,7 @@ static bool ath9k_htc_check_tx_aggr(struct ath9k_htc_priv 
*priv,
 void ath9k_tx_tasklet(unsigned long data)
 {
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data;
+   struct ieee80211_vif *vif;
struct ieee80211_sta *sta;
struct ieee80211_hdr *hdr;
struct ieee80211_tx_info *tx_info;
@@ -243,12 +244,16 @@ void ath9k_tx_tasklet(unsigned long data)
hdr = (struct ieee80211_hdr *) skb->data;
fc = hdr->frame_control;
tx_info = IEEE80211_SKB_CB(skb);
+   vif = tx_info->control.vif;
 
memset(&tx_info->status, 0, sizeof(tx_info->status));
 
+   if (!vif)
+   goto send_mac80211;
+
rcu_read_lock();
 
-   sta = ieee80211_find_sta(priv->vif, hdr->addr1);
+   sta = ieee80211_find_sta(vif, hdr->addr1);
if (!sta) {
rcu_read_unlock();
ieee80211_tx_status(priv->hw, skb);
@@ -278,6 +283,7 @@ void ath9k_tx_tasklet(unsigned long data)
 
rcu_read_unlock();
 
+   send_mac80211:
/* Send status to mac80211 */
ieee80211_tx_status(priv->hw, skb);
}
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 10/33] ath9k_htc: Protect ampdu_action with a mutex

2011-01-20 Thread Sujith
From: Sujith Manoharan 

This is required when issuing commands to the firmware.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 6bd7e25..b6c8363 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1636,6 +1636,8 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
struct ath9k_htc_sta *ista;
int ret = 0;
 
+   mutex_lock(&priv->mutex);
+
switch (action) {
case IEEE80211_AMPDU_RX_START:
break;
@@ -1660,6 +1662,8 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw,
ath_err(ath9k_hw_common(priv->ah), "Unknown AMPDU action\n");
}
 
+   mutex_unlock(&priv->mutex);
+
return ret;
 }
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 11/33] ath9k_htc: Fix WMI and beacon header

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Match the beacon header with that of the firmware.
Also, the firmware reports the TSF for an SWBA, so
store it.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h |2 +-
 drivers/net/wireless/ath/ath9k/wmi.c |7 ++-
 drivers/net/wireless/ath/ath9k/wmi.h |6 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 87e2d41..6a09ad4 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -95,8 +95,8 @@ struct tx_mgmt_hdr {
 } __packed;
 
 struct tx_beacon_header {
-   u8 len_changed;
u8 vif_index;
+   u8 len_changed;
u16 rev;
 } __packed;
 
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c 
b/drivers/net/wireless/ath/ath9k/wmi.c
index dc862f5..8ed6fe6 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -158,6 +158,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff 
*skb,
struct wmi_cmd_hdr *hdr;
u16 cmd_id;
void *wmi_event;
+   struct wmi_event_swba *swba;
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
__be32 txrate;
 #endif
@@ -172,7 +173,11 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff 
*skb,
wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr));
switch (cmd_id) {
case WMI_SWBA_EVENTID:
-   wmi->beacon_pending = *(u8 *)wmi_event;
+   swba = (struct wmi_event_swba *) wmi_event;
+
+   wmi->tsf = be64_to_cpu(swba->tsf);
+   wmi->beacon_pending = swba->beacon_pending;
+
tasklet_schedule(&wmi->drv_priv->swba_tasklet);
break;
case WMI_FATAL_EVENTID:
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h 
b/drivers/net/wireless/ath/ath9k/wmi.h
index 4208427..24f16fa 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -31,6 +31,11 @@ struct wmi_cmd_hdr {
__be16 seq_no;
 } __packed;
 
+struct wmi_event_swba {
+   __be64 tsf;
+   u8 beacon_pending;
+};
+
 enum wmi_cmd_id {
WMI_ECHO_CMDID = 0x0001,
WMI_ACCESS_MEMORY_CMDID,
@@ -100,6 +105,7 @@ struct wmi {
u32 cmd_rsp_len;
bool stopped;
 
+   u64 tsf;
u8 beacon_pending;
spinlock_t wmi_lock;
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 12/33] ath9k_htc: Maintain individual counters for interfaces

2011-01-20 Thread Sujith
From: Sujith Manoharan 

This is required for allowing only one IBSS interface to be
configured.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |   28 +
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   14 ++-
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 6a09ad4..f650439 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -206,6 +206,32 @@ struct ath9k_htc_target_stats {
 
 #define ATH9K_HTC_MAX_VIF 2
 
+#define INC_VIF(_priv, _type) do { \
+   switch (_type) {\
+   case NL80211_IFTYPE_STATION:\
+   _priv->num_sta_vif++;   \
+   break;  \
+   case NL80211_IFTYPE_ADHOC:  \
+   _priv->num_ibss_vif++;  \
+   break;  \
+   default:\
+   break;  \
+   }   \
+   } while (0)
+
+#define DEC_VIF(_priv, _type) do { \
+   switch (_type) {\
+   case NL80211_IFTYPE_STATION:\
+   _priv->num_sta_vif--;   \
+   break;  \
+   case NL80211_IFTYPE_ADHOC:  \
+   _priv->num_ibss_vif--;  \
+   break;  \
+   default:\
+   break;  \
+   }   \
+   } while (0)
+
 struct ath9k_htc_vif {
u8 index;
u16 seq_no;
@@ -367,6 +393,8 @@ struct ath9k_htc_priv {
u8 mon_vif_idx;
u8 sta_slot;
u8 vif_sta_pos[ATH9K_HTC_MAX_VIF];
+   u8 num_ibss_vif;
+   u8 num_sta_vif;
 
u16 op_flags;
u16 curtxpow;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index b6c8363..f5333dc9 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1191,9 +1191,15 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
mutex_lock(&priv->mutex);
 
if (priv->nvifs >= ATH9K_HTC_MAX_VIF) {
-   ret = -ENOBUFS;
mutex_unlock(&priv->mutex);
-   return ret;
+   return -ENOBUFS;
+   }
+
+   if (priv->num_ibss_vif ||
+   (priv->nvifs && vif->type == NL80211_IFTYPE_ADHOC)) {
+   ath_err(common, "IBSS coexistence with other modes is not 
allowed\n");
+   mutex_unlock(&priv->mutex);
+   return -ENOBUFS;
}
 
ath9k_htc_ps_wakeup(priv);
@@ -1238,6 +1244,8 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
priv->nvifs++;
priv->vif = vif;
 
+   INC_VIF(priv, vif->type);
+
ath_dbg(common, ATH_DBG_CONFIG,
"Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
 
@@ -1271,6 +1279,8 @@ static void ath9k_htc_remove_interface(struct 
ieee80211_hw *hw,
ath9k_htc_remove_station(priv, vif, NULL);
priv->vif = NULL;
 
+   DEC_VIF(priv, vif->type);
+
ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", 
avp->index);
 
ath9k_htc_ps_restore(priv);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 13/33] ath9k_htc: Allow AP interface to be created

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |8 
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   11 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index f650439..378aba3 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -205,6 +205,7 @@ struct ath9k_htc_target_stats {
 } __packed;
 
 #define ATH9K_HTC_MAX_VIF 2
+#define ATH9K_HTC_MAX_BCN_VIF 2
 
 #define INC_VIF(_priv, _type) do { \
switch (_type) {\
@@ -214,6 +215,9 @@ struct ath9k_htc_target_stats {
case NL80211_IFTYPE_ADHOC:  \
_priv->num_ibss_vif++;  \
break;  \
+   case NL80211_IFTYPE_AP: \
+   _priv->num_ap_vif++;\
+   break;  \
default:\
break;  \
}   \
@@ -227,6 +231,9 @@ struct ath9k_htc_target_stats {
case NL80211_IFTYPE_ADHOC:  \
_priv->num_ibss_vif--;  \
break;  \
+   case NL80211_IFTYPE_AP: \
+   _priv->num_ap_vif--;\
+   break;  \
default:\
break;  \
}   \
@@ -395,6 +402,7 @@ struct ath9k_htc_priv {
u8 vif_sta_pos[ATH9K_HTC_MAX_VIF];
u8 num_ibss_vif;
u8 num_sta_vif;
+   u8 num_ap_vif;
 
u16 op_flags;
u16 curtxpow;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f5333dc9..0694f2e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1202,6 +1202,14 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
return -ENOBUFS;
}
 
+   if (((vif->type == NL80211_IFTYPE_AP) ||
+(vif->type == NL80211_IFTYPE_ADHOC)) &&
+   ((priv->num_ap_vif + priv->num_ibss_vif) >= ATH9K_HTC_MAX_BCN_VIF)) 
{
+   ath_err(common, "Max. number of beaconing interfaces 
reached\n");
+   mutex_unlock(&priv->mutex);
+   return -ENOBUFS;
+   }
+
ath9k_htc_ps_wakeup(priv);
memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
@@ -1213,6 +1221,9 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
case NL80211_IFTYPE_ADHOC:
hvif.opmode = cpu_to_be32(HTC_M_IBSS);
break;
+   case NL80211_IFTYPE_AP:
+   hvif.opmode = cpu_to_be32(HTC_M_HOSTAP);
+   break;
default:
ath_err(common,
"Interface type %d not yet supported\n", vif->type);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 14/33] ath9k_htc: Calculate and set the HW opmode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   15 ++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 0694f2e..ce11b96 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -177,6 +177,18 @@ static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv 
*priv,
ath_hw_setbssidmask(common);
 }
 
+static void ath9k_htc_set_opmode(struct ath9k_htc_priv *priv)
+{
+   if (priv->num_ibss_vif)
+   priv->ah->opmode = NL80211_IFTYPE_ADHOC;
+   else if (priv->num_ap_vif)
+   priv->ah->opmode = NL80211_IFTYPE_AP;
+   else
+   priv->ah->opmode = NL80211_IFTYPE_STATION;
+
+   ath9k_hw_setopmode(priv->ah);
+}
+
 void ath9k_htc_reset(struct ath9k_htc_priv *priv)
 {
struct ath_hw *ah = priv->ah;
@@ -1250,12 +1262,12 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
 
ath9k_htc_set_bssid_mask(priv, vif);
 
-   priv->ah->opmode = vif->type;
priv->vif_slot |= (1 << avp->index);
priv->nvifs++;
priv->vif = vif;
 
INC_VIF(priv, vif->type);
+   ath9k_htc_set_opmode(priv);
 
ath_dbg(common, ATH_DBG_CONFIG,
"Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
@@ -1291,6 +1303,7 @@ static void ath9k_htc_remove_interface(struct 
ieee80211_hw *hw,
priv->vif = NULL;
 
DEC_VIF(priv, vif->type);
+   ath9k_htc_set_opmode(priv);
 
ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface at idx: %d\n", 
avp->index);
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 15/33] ath9k_htc: Add ANI for AP mode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

The time granularity for the ANI task is different for AP and
station mode.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |1 +
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |9 -
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 378aba3..83deb94 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -32,6 +32,7 @@
 #include "wmi.h"
 
 #define ATH_STA_SHORT_CALINTERVAL 1000/* 1 second */
+#define ATH_AP_SHORT_CALINTERVAL  100 /* 100 ms */
 #define ATH_ANI_POLLINTERVAL  100 /* 100 ms */
 #define ATH_LONG_CALINTERVAL  3   /* 30 seconds */
 #define ATH_RESTART_CALINTERVAL   120 /* 20 minutes */
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index ce11b96..f986d93 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -952,7 +952,8 @@ void ath9k_ani_work(struct work_struct *work)
unsigned int timestamp = jiffies_to_msecs(jiffies);
u32 cal_interval, short_cal_interval;
 
-   short_cal_interval = ATH_STA_SHORT_CALINTERVAL;
+   short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
+   ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
 
/* Only calibrate if awake */
if (ah->power_mode != ATH9K_PM_AWAKE)
@@ -1269,6 +1270,9 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
INC_VIF(priv, vif->type);
ath9k_htc_set_opmode(priv);
 
+   if (priv->ah->opmode == NL80211_IFTYPE_AP)
+   ath_start_ani(priv);
+
ath_dbg(common, ATH_DBG_CONFIG,
"Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
 
@@ -1302,6 +1306,9 @@ static void ath9k_htc_remove_interface(struct 
ieee80211_hw *hw,
ath9k_htc_remove_station(priv, vif, NULL);
priv->vif = NULL;
 
+   if (priv->ah->opmode == NL80211_IFTYPE_AP)
+   cancel_delayed_work_sync(&priv->ath9k_ani_work);
+
DEC_VIF(priv, vif->type);
ath9k_htc_set_opmode(priv);
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 16/33] ath9k_htc: Disable powersave if an AP interface is present

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f986d93..b98749e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1375,7 +1375,8 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 
changed)
 
}
 
-   if (changed & IEEE80211_CONF_CHANGE_PS) {
+   if ((priv->ah->opmode != NL80211_IFTYPE_AP) &&
+   (changed & IEEE80211_CONF_CHANGE_PS)) {
if (conf->flags & IEEE80211_CONF_PS) {
ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
priv->ps_enabled = true;
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 17/33] ath9k_htc: Configure beacon timers in AP mode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Handle multi-interface situations by checking if
AP interfaces are already present.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   78 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   45 +++--
 drivers/net/wireless/ath/ath9k/wmi.c|4 -
 4 files changed, 115 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 83deb94..4c11ffe 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -352,10 +352,8 @@ struct ath_led {
 
 struct htc_beacon_config {
u16 beacon_interval;
-   u16 listen_interval;
u16 dtim_period;
u16 bmiss_timeout;
-   u8 dtim_count;
 };
 
 struct ath_btcoex {
@@ -379,6 +377,7 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv 
*priv);
 #define OP_LED_DEINIT BIT(5)
 #define OP_BT_PRIORITY_DETECTEDBIT(6)
 #define OP_BT_SCAN BIT(7)
+#define OP_TSF_RESET   BIT(8)
 
 struct ath9k_htc_priv {
struct device *dev;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index bbbdd60..e897a56 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -138,6 +138,51 @@ static void ath9k_htc_beacon_config_sta(struct 
ath9k_htc_priv *priv,
WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
 }
 
+static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
+  struct htc_beacon_config *bss_conf)
+{
+   struct ath_common *common = ath9k_hw_common(priv->ah);
+   enum ath9k_int imask = 0;
+   u32 nexttbtt, intval, tsftu;
+   __be32 htc_imask = 0;
+   int ret;
+   u8 cmd_rsp;
+   u64 tsf;
+
+   intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
+   intval /= ATH9K_HTC_MAX_BCN_VIF;
+   nexttbtt = intval;
+
+   if (priv->op_flags & OP_TSF_RESET) {
+   intval |= ATH9K_BEACON_RESET_TSF;
+   priv->op_flags &= ~OP_TSF_RESET;
+   } else {
+   /*
+* Pull nexttbtt forward to reflect the current TSF.
+*/
+   tsf = ath9k_hw_gettsf64(priv->ah);
+   tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
+   do {
+   nexttbtt += intval;
+   } while (nexttbtt < tsftu);
+   }
+
+   intval |= ATH9K_BEACON_ENA;
+
+   if (priv->op_flags & OP_ENABLE_BEACON)
+   imask |= ATH9K_INT_SWBA;
+
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "AP Beacon config, intval: %d, nexttbtt: %u imask: 0x%x\n",
+   bss_conf->beacon_interval, nexttbtt, imask);
+
+   WMI_CMD(WMI_DISABLE_INTR_CMDID);
+   ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
+   priv->bmiss_cnt = 0;
+   htc_imask = cpu_to_be32(imask);
+   WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
+}
+
 static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
  struct htc_beacon_config *bss_conf)
 {
@@ -260,13 +305,36 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
 
+   /*
+* Changing the beacon interval when multiple AP interfaces
+* are configured will affect beacon transmission of all
+* of them.
+*/
+   if ((priv->ah->opmode == NL80211_IFTYPE_AP) &&
+   (priv->num_ap_vif > 1) &&
+   (vif->type == NL80211_IFTYPE_AP) &&
+   (cur_conf->beacon_interval != bss_conf->beacon_int)) {
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "Changing beacon interval of multiple AP interfaces 
!\n");
+   return;
+   }
+
+   /*
+* If the HW is operating in AP mode, any new station interfaces that
+* are added cannot change the beacon parameters.
+*/
+   if (priv->num_ap_vif &&
+   (vif->type != NL80211_IFTYPE_AP)) {
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "HW in AP mode, cannot set STA beacon parameters\n");
+   return;
+   }
+
cur_conf->beacon_interval = bss_conf->beacon_int;
if (cur_conf->beacon_interval == 0)
cur_conf->beacon_interval = 100;
 
cur_conf->dtim_period = bss_conf->dtim_period;
-   cur_conf->listen_interval = 1;
-   cur_conf->dtim_count = 1;
cur_conf->bmiss_timeout =
ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
 
@@ -277,6 +345,9 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
case NL80211_IFTYPE_ADHOC:
ath9k_htc_beac

[ath9k-devel] [RFC/WIP 19/33] ath9k_htc: Fix TBTT calculation for IBSS mode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

The target beacon transmission time has to be synced with the HW
TSF when configuring beacon timers in Adhoc mode. Failing to do this
would cause erroneous beacon transmission, for example, on completion
of a scan run to check for IBSS merges.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index b4431a9..0803c25 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -190,20 +190,31 @@ static void ath9k_htc_beacon_config_adhoc(struct 
ath9k_htc_priv *priv,
 {
struct ath_common *common = ath9k_hw_common(priv->ah);
enum ath9k_int imask = 0;
-   u32 nexttbtt, intval;
+   u32 nexttbtt, intval, tsftu;
__be32 htc_imask = 0;
int ret;
u8 cmd_rsp;
+   u64 tsf;
 
intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
nexttbtt = intval;
+
+   /*
+* Pull nexttbtt forward to reflect the current TSF.
+*/
+   tsf = ath9k_hw_gettsf64(priv->ah);
+   tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
+   do {
+   nexttbtt += intval;
+   } while (nexttbtt < tsftu);
+
intval |= ATH9K_BEACON_ENA;
if (priv->op_flags & OP_ENABLE_BEACON)
imask |= ATH9K_INT_SWBA;
 
-   ath_dbg(common, ATH_DBG_BEACON,
-   "IBSS Beacon config, intval: %d, imask: 0x%x\n",
-   bss_conf->beacon_interval, imask);
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "IBSS Beacon config, intval: %d, nexttbtt: %u, imask: 0x%x\n",
+   bss_conf->beacon_interval, nexttbtt, imask);
 
WMI_CMD(WMI_DISABLE_INTR_CMDID);
ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 20/33] ath9k_htc: Add TSF adjust capability

2011-01-20 Thread Sujith
From: Sujith Manoharan 

In multi-interface mode, beacons/probe responses that are
sent out must have their timestamp field updated. Calculate
the TSF adjustment value for each beaconing interface and set it
in the frame properly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|3 ++
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   36 +++
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |5 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   12 +++-
 4 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 6b3f0f3..bd1610f 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -244,6 +244,7 @@ struct ath9k_htc_vif {
u8 index;
u16 seq_no;
int bslot;
+   __le64 tsfadjust;
 };
 
 struct ath9k_vif_iter_data {
@@ -475,6 +476,8 @@ void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
struct ieee80211_vif *vif);
 void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
struct ieee80211_vif *vif);
+void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
+struct ieee80211_vif *vif);
 void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 struct ieee80211_vif *vif);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 0803c25..64934cf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -237,6 +237,7 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
struct tx_beacon_header beacon_hdr;
struct ath9k_htc_tx_ctl tx_ctl;
struct ieee80211_tx_info *info;
+   struct ieee80211_mgmt *mgmt;
struct sk_buff *beacon;
u8 *tx_fhdr;
 
@@ -260,6 +261,13 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
return;
}
 
+   /*
+* Update the TSF adjust value here, the HW will
+* add this value for every beacon.
+*/
+   mgmt = (struct ieee80211_mgmt *)beacon->data;
+   mgmt->u.beacon.timestamp = avp->tsfadjust;
+
info = IEEE80211_SKB_CB(beacon);
if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
struct ieee80211_hdr *hdr =
@@ -409,6 +417,34 @@ void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
"Removed interface at beacon slot: %d\n", avp->bslot);
 }
 
+/*
+ * Calculate the TSF adjustment value for all slots
+ * other than zero.
+ */
+void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
+struct ieee80211_vif *vif)
+{
+   struct ath_common *common = ath9k_hw_common(priv->ah);
+   struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *)vif->drv_priv;
+   struct htc_beacon_config *cur_conf = &priv->cur_beacon_conf;
+   u64 tsfadjust;
+
+   if (avp->bslot == 0)
+   return;
+
+   /*
+* The beacon interval cannot be different for multi-AP mode,
+* and we reach here only for VIF slots greater than zero,
+* so beacon_interval is guaranteed to be set in cur_conf.
+*/
+   tsfadjust = cur_conf->beacon_interval * avp->bslot / 
ATH9K_HTC_MAX_BCN_VIF;
+   avp->tsfadjust = cpu_to_le64(TU_TO_USEC(tsfadjust));
+
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "tsfadjust is: %llu for bslot: %d\n",
+   (unsigned long long)tsfadjust, avp->bslot);
+}
+
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 struct ieee80211_vif *vif)
 {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 4980525..5f8e54c 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1282,8 +1282,10 @@ static int ath9k_htc_add_interface(struct ieee80211_hw 
*hw,
 
ath9k_htc_set_opmode(priv);
 
-   if (priv->ah->opmode == NL80211_IFTYPE_AP)
+   if (priv->ah->opmode == NL80211_IFTYPE_AP) {
+   ath9k_hw_set_tsfadjust(priv->ah, 1);
ath_start_ani(priv);
+   }
 
ath_dbg(common, ATH_DBG_CONFIG,
"Attach a VIF of type: %d at idx: %d\n", vif->type, avp->index);
@@ -1621,6 +1623,7 @@ static void ath9k_htc_bss_info_changed(struct 
ieee80211_hw *hw,
if ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon) {
ath_dbg(common, ATH_DBG_CONFIG,
"Beacon enabled for BSS: %pM\n", bss_conf->bssid);
+   ath9k_htc_set_tsfadjust(priv, vif);
priv->op_flags |= OP_ENABLE_BEACON;
ath9k_htc_beacon_config(priv, vif);
}
diff --git a/drive

[ath9k-devel] [RFC/WIP 21/33] ath9k_htc: Configure the beacon queue

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Set operating parameters (cwmin, cwmax) for the beacon queue
in AP mode.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   77 ++-
 1 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 64934cf..c480469 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -18,6 +18,50 @@
 
 #define FUDGE 2
 
+void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
+{
+   struct ath_hw *ah = priv->ah;
+   struct ath9k_tx_queue_info qi, qi_be;
+
+   memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
+   memset(&qi_be, 0, sizeof(struct ath9k_tx_queue_info));
+
+   ath9k_hw_get_txq_props(ah, priv->beaconq, &qi);
+
+   if (priv->ah->opmode == NL80211_IFTYPE_AP) {
+   qi.tqi_aifs = 1;
+   qi.tqi_cwmin = 0;
+   qi.tqi_cwmax = 0;
+   } else if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {
+   int qnum = priv->hwq_map[WME_AC_BE];
+
+   ath9k_hw_get_txq_props(ah, qnum, &qi_be);
+
+   qi.tqi_aifs = qi_be.tqi_aifs;
+
+   /*
+* For WIFI Beacon Distribution
+* Long slot time  : 2x cwmin
+* Short slot time : 4x cwmin
+*/
+   if (ah->slottime == ATH9K_SLOT_TIME_20)
+   qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
+   else
+   qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
+
+   qi.tqi_cwmax = qi_be.tqi_cwmax;
+
+   }
+
+   if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) {
+   ath_err(ath9k_hw_common(ah),
+   "Unable to update beacon queue %u!\n", priv->beaconq);
+   } else {
+   ath9k_hw_resettxqueue(ah, priv->beaconq);
+   }
+}
+
+
 static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
struct htc_beacon_config *bss_conf)
 {
@@ -178,6 +222,8 @@ static void ath9k_htc_beacon_config_ap(struct 
ath9k_htc_priv *priv,
bss_conf->beacon_interval, nexttbtt, imask,
!!(intval & ATH9K_BEACON_RESET_TSF));
 
+   ath9k_htc_beaconq_config(priv);
+
WMI_CMD(WMI_DISABLE_INTR_CMDID);
ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
priv->cur_beacon_conf.bmiss_cnt = 0;
@@ -350,37 +396,6 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv)
ath9k_htc_send_beacon(priv, slot);
 }
 
-/* Currently, only for IBSS */
-void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv)
-{
-   struct ath_hw *ah = priv->ah;
-   struct ath9k_tx_queue_info qi, qi_be;
-   int qnum = priv->hwq_map[WME_AC_BE];
-
-   memset(&qi, 0, sizeof(struct ath9k_tx_queue_info));
-   memset(&qi_be, 0, sizeof(struct ath9k_tx_queue_info));
-
-   ath9k_hw_get_txq_props(ah, qnum, &qi_be);
-
-   qi.tqi_aifs = qi_be.tqi_aifs;
-   /* For WIFI Beacon Distribution
-* Long slot time  : 2x cwmin
-* Short slot time : 4x cwmin
-*/
-   if (ah->slottime == ATH9K_SLOT_TIME_20)
-   qi.tqi_cwmin = 2*qi_be.tqi_cwmin;
-   else
-   qi.tqi_cwmin = 4*qi_be.tqi_cwmin;
-   qi.tqi_cwmax = qi_be.tqi_cwmax;
-
-   if (!ath9k_hw_set_txq_props(ah, priv->beaconq, &qi)) {
-   ath_err(ath9k_hw_common(ah),
-   "Unable to update beacon queue %u!\n", qnum);
-   } else {
-   ath9k_hw_resettxqueue(ah, priv->beaconq);
-   }
-}
-
 void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
struct ieee80211_vif *vif)
 {
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 22/33] ath9k_htc: Handle buffered frames in AP mode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Use the CAB endpoint to send buffered multicast or
broadcast frames after each SWBA event.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|6 +++-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   43 +++
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |5 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   14 ++--
 5 files changed, 65 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index bd1610f..912cce8 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -291,6 +291,7 @@ struct ath9k_htc_tx_ctl {
 
 #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++)
 #define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.rx_stats.c++)
+#define CAB_STAT_INC   priv->debug.tx_stats.cab_queued++
 
 #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++)
 
@@ -300,6 +301,7 @@ struct ath_tx_stats {
u32 skb_queued;
u32 skb_completed;
u32 skb_dropped;
+   u32 cab_queued;
u32 queue_stats[WME_NUM_AC];
 };
 
@@ -323,6 +325,7 @@ struct ath9k_debug {
 
 #define TX_STAT_INC(c) do { } while (0)
 #define RX_STAT_INC(c) do { } while (0)
+#define CAB_STAT_INC   do { } while (0)
 
 #define TX_QSTAT_INC(c) do { } while (0)
 
@@ -499,7 +502,8 @@ void ath_start_ani(struct ath9k_htc_priv *priv);
 
 int ath9k_tx_init(struct ath9k_htc_priv *priv);
 void ath9k_tx_tasklet(unsigned long data);
-int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb);
+int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
+  struct sk_buff *skb, bool is_cab);
 void ath9k_tx_cleanup(struct ath9k_htc_priv *priv);
 bool ath9k_htc_txq_setup(struct ath9k_htc_priv *priv, int subtype);
 int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index c480469..927bb27 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -275,6 +275,48 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff 
*skb,
dev_kfree_skb_any(skb);
 }
 
+static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv,
+   int slot)
+{
+   struct ath_common *common = ath9k_hw_common(priv->ah);
+   struct ieee80211_vif *vif;
+   struct sk_buff *skb;
+   struct ieee80211_hdr *hdr;
+   int padpos, padsize, ret;
+
+   spin_lock_bh(&priv->beacon_lock);
+
+   vif = priv->cur_beacon_conf.bslot[slot];
+
+   skb = ieee80211_get_buffered_bc(priv->hw, vif);
+
+   while(skb) {
+   hdr = (struct ieee80211_hdr *) skb->data;
+
+   padpos = ath9k_cmn_padpos(hdr->frame_control);
+   padsize = padpos & 3;
+   if (padsize && skb->len > padpos) {
+   if (skb_headroom(skb) < padsize) {
+   dev_kfree_skb_any(skb);
+   goto next;
+   }
+   skb_push(skb, padsize);
+   memmove(skb->data, skb->data + padsize, padpos);
+   }
+
+   ret = ath9k_htc_tx_start(priv, skb, true);
+   if (ret != 0) {
+   ath_dbg(common, ATH_DBG_FATAL,
+   "Failed to send CAB frame\n");
+   dev_kfree_skb_any(skb);
+   }
+   next:
+   skb = ieee80211_get_buffered_bc(priv->hw, vif);
+   }
+
+   spin_unlock_bh(&priv->beacon_lock);
+}
+
 static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
  int slot)
 {
@@ -393,6 +435,7 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv)
}
spin_unlock_bh(&priv->beacon_lock);
 
+   ath9k_htc_send_buffered(priv, slot);
ath9k_htc_send_beacon(priv, slot);
 }
 
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 37a41fe..dc96c06 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -748,7 +748,8 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
IEEE80211_HW_HAS_RATE_CONTROL |
IEEE80211_HW_RX_INCLUDES_FCS |
IEEE80211_HW_SUPPORTS_PS |
-   IEEE80211_HW_PS_NULLFUNC_STACK;
+   IEEE80211_HW_PS_NULLFUNC_STACK |
+   IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING;
 
hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 5f8e54c..cc05177 100644
--- a/drivers/net/wireless/ath/ath

[ath9k-devel] [RFC/WIP 25/33] ath9k_htc: Queue WMI events

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Use a queue to handle WMI events and schedule a tasklet
to process the events. This fixes the race between the
WMI event ISR and the SWBA tasklet when the arrival of
WMI events in quick succession could overwrite the SWBA
data before the tasklet from a previous iteration could
have been scheduled.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   27 +++-
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |3 -
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |1 +
 drivers/net/wireless/ath/ath9k/wmi.c|   78 +--
 drivers/net/wireless/ath/ath9k/wmi.h|6 +-
 6 files changed, 61 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 3aa73fc..742777e 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -492,7 +492,8 @@ void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 struct ieee80211_vif *vif);
 void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
-void ath9k_htc_swba(struct ath9k_htc_priv *priv);
+void ath9k_htc_swba(struct ath9k_htc_priv *priv,
+   struct wmi_event_swba *swba);
 
 void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
enum htc_endpoint_id ep_id);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 42a1758..c3eae71 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -404,10 +404,10 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
spin_unlock_bh(&priv->beacon_lock);
 }
 
-static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv)
+static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv,
+ struct wmi_event_swba *swba)
 {
struct ath_common *common = ath9k_hw_common(priv->ah);
-   unsigned long flags;
u64 tsf;
u32 tsftu;
u16 intval;
@@ -415,10 +415,7 @@ static int ath9k_htc_choose_bslot(struct ath9k_htc_priv 
*priv)
 
intval = priv->cur_beacon_conf.beacon_interval & ATH9K_BEACON_PERIOD;
 
-   spin_lock_irqsave(&priv->wmi->wmi_lock, flags);
-   tsf = priv->wmi->tsf;
-   spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);
-
+   tsf = be64_to_cpu(swba->tsf);
tsftu = TSF_TO_TU(tsf >> 32, tsf);
slot = ((tsftu % intval) * ATH9K_HTC_MAX_BCN_VIF) / intval;
slot = ATH9K_HTC_MAX_BCN_VIF - slot - 1;
@@ -430,33 +427,31 @@ static int ath9k_htc_choose_bslot(struct ath9k_htc_priv 
*priv)
return slot;
 }
 
-void ath9k_htc_swba(struct ath9k_htc_priv *priv)
+void ath9k_htc_swba(struct ath9k_htc_priv *priv,
+   struct wmi_event_swba *swba)
 {
struct ath_common *common = ath9k_hw_common(priv->ah);
-   unsigned long flags;
int slot;
 
-   spin_lock_irqsave(&priv->wmi->wmi_lock, flags);
-   if (priv->wmi->beacon_pending != 0) {
-   spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);
+   if (swba->beacon_pending != 0) {
priv->cur_beacon_conf.bmiss_cnt++;
if (priv->cur_beacon_conf.bmiss_cnt > BSTUCK_THRESHOLD) {
-   ath_dbg(common, ATH_DBG_BEACON,
+   ath_dbg(common, ATH_DBG_BSTUCK,
"Beacon stuck, HW reset\n");
-   ath9k_htc_reset(priv);
+   ieee80211_queue_work(priv->hw,
+&priv->fatal_work);
}
return;
}
-   spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);
 
if (priv->cur_beacon_conf.bmiss_cnt) {
-   ath_dbg(common, ATH_DBG_BEACON,
+   ath_dbg(common, ATH_DBG_BSTUCK,
"Resuming beacon xmit after %u misses\n",
priv->cur_beacon_conf.bmiss_cnt);
priv->cur_beacon_conf.bmiss_cnt = 0;
}
 
-   slot = ath9k_htc_choose_bslot(priv);
+   slot = ath9k_htc_choose_bslot(priv, swba);
spin_lock_bh(&priv->beacon_lock);
if (priv->cur_beacon_conf.bslot[slot] == NULL) {
spin_unlock_bh(&priv->beacon_lock);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index b4ae719..09f8e1e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -142,7 +142,6 @@ static void ath9k_deinit_priv(struct ath9k_htc_priv *priv)
 {
ath9k_htc_exit_debug(priv->ah);
ath9k_hw_deinit(priv->ah);
-   tasklet_kill(&priv->swba_tasklet);
tasklet_kill(&priv->rx_tasklet);
taskle

[ath9k-devel] [RFC/WIP 26/33] ath9k_htc: Handle BSSID/AID for multiple interfaces

2011-01-20 Thread Sujith
From: Sujith Manoharan 

The AID and BSSID should be set in the HW only for the
first station interface or adhoc interface. Also, cancel
the ANI timer in stop() for multi-STA scenario. And finally
configure the HW beacon timers only for the first station
interface.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   17 -
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   45 +++
 2 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index c3eae71..15b149e 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -167,8 +167,9 @@ static void ath9k_htc_beacon_config_sta(struct 
ath9k_htc_priv *priv,
/* TSF out of range threshold fixed at 1 second */
bs.bs_tsfoor_threshold = ATH9K_TSFOOR_THRESHOLD;
 
-   ath_dbg(common, ATH_DBG_BEACON, "tsf: %llu tsftu: %u\n", tsf, tsftu);
-   ath_dbg(common, ATH_DBG_BEACON,
+   ath_dbg(common, ATH_DBG_CONFIG, "intval: %u tsf: %llu tsftu: %u\n",
+   intval, tsf, tsftu);
+   ath_dbg(common, ATH_DBG_CONFIG,
"bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n",
bs.bs_bmissthreshold, bs.bs_sleepduration,
bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext);
@@ -559,6 +560,18 @@ void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
return;
}
 
+   /*
+* The beacon paramters are configured only for the first
+* station interface.
+*/
+   if ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
+   (priv->num_sta_vif > 1) &&
+   (vif->type == NL80211_IFTYPE_STATION)) {
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "Beacon already configured for a station interface\n");
+   return;
+   }
+
cur_conf->beacon_interval = bss_conf->beacon_int;
if (cur_conf->beacon_interval == 0)
cur_conf->beacon_interval = 100;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 68a7687..4f72246 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1161,6 +1161,7 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
u8 cmd_rsp;
 
/* Cancel all the running timers/work .. */
+   cancel_delayed_work_sync(&priv->ath9k_ani_work);
cancel_work_sync(&priv->fatal_work);
cancel_work_sync(&priv->ps_work);
cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
@@ -1598,30 +1599,44 @@ static void ath9k_htc_bss_info_changed(struct 
ieee80211_hw *hw,
struct ath9k_htc_priv *priv = hw->priv;
struct ath_hw *ah = priv->ah;
struct ath_common *common = ath9k_hw_common(ah);
+   bool set_assoc;
 
mutex_lock(&priv->mutex);
ath9k_htc_ps_wakeup(priv);
 
+   /*
+* Set the HW AID/BSSID only for the first station interface
+* or in IBSS mode.
+*/
+   set_assoc = !!((priv->ah->opmode == NL80211_IFTYPE_ADHOC) ||
+  ((priv->ah->opmode == NL80211_IFTYPE_STATION) &&
+   (priv->num_sta_vif == 1)));
+
+
if (changed & BSS_CHANGED_ASSOC) {
-   common->curaid = bss_conf->assoc ?
-bss_conf->aid : 0;
-   ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
-   bss_conf->assoc);
+   if (set_assoc) {
+   ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed ASSOC 
%d\n",
+   bss_conf->assoc);
 
-   if (bss_conf->assoc)
-   ath_start_ani(priv);
-   else
-   cancel_delayed_work_sync(&priv->ath9k_ani_work);
+   common->curaid = bss_conf->assoc ?
+   bss_conf->aid : 0;
+
+   if (bss_conf->assoc)
+   ath_start_ani(priv);
+   else
+   cancel_delayed_work_sync(&priv->ath9k_ani_work);
+   }
}
 
if (changed & BSS_CHANGED_BSSID) {
-   /* Set BSSID */
-   memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
-   ath9k_hw_write_associd(ah);
+   if (set_assoc) {
+   memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
+   ath9k_hw_write_associd(ah);
 
-   ath_dbg(common, ATH_DBG_CONFIG,
-   "BSSID: %pM aid: 0x%x\n",
-   common->curbssid, common->curaid);
+   ath_dbg(common, ATH_DBG_CONFIG,
+   "BSSID: %pM aid: 0x%x\n",
+   common

[ath9k-devel] [RFC/WIP 29/33] ath9k_htc: Fix RX length check

2011-01-20 Thread Sujith
From: Sujith Manoharan 

The length of the received SKB could be equal to
HTC_RX_FRAME_HEADER_SIZE in case of packets with phy/crc errors,
in which case they are dropped without being processed.
Fix this check so that the error counters are updated correctly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 1b629fd..9913ef0 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -528,8 +528,9 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
int last_rssi = ATH_RSSI_DUMMY_MARKER;
__le16 fc;
 
-   if (skb->len <= HTC_RX_FRAME_HEADER_SIZE) {
-   ath_err(common, "Corrupted RX frame, dropping\n");
+   if (skb->len < HTC_RX_FRAME_HEADER_SIZE) {
+   ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
+   skb->len);
goto rx_next;
}
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 30/33] ath9k_htc: Fix host RX initialization

2011-01-20 Thread Sujith
From: Sujith Manoharan 

There is no need to set the BSSID mask or opmode when
initializing RX, they would be set correctly in the HW reset
routine.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 9913ef0..458164f 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -451,20 +451,12 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv)
 static void ath9k_htc_opmode_init(struct ath9k_htc_priv *priv)
 {
struct ath_hw *ah = priv->ah;
-   struct ath_common *common = ath9k_hw_common(ah);
-
u32 rfilt, mfilt[2];
 
/* configure rx filter */
rfilt = ath9k_htc_calcrxfilter(priv);
ath9k_hw_setrxfilter(ah, rfilt);
 
-   /* configure bssid mask */
-   ath_hw_setbssidmask(common);
-
-   /* configure operational mode */
-   ath9k_hw_setopmode(ah);
-
/* calculate and install multicast filter */
mfilt[0] = mfilt[1] = ~0;
ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 31/33] ath9k_htc: Remove unused WMI commands

2011-01-20 Thread Sujith
From: Sujith Manoharan 

WMI_TGT_TXQ_ENABLE_CMDID
WMI_HOST_ATTACH
WMI_DEBUG_INFO_CMDID
WMI_BEACON_UPDATE_CMDID
WMI_RESET_CMDID
WMI_RX_LINK_CMDID
WMI_ABORT_TXQ_CMDID
WMI_STOP_DMA_RECV_CMDID

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/wmi.c |   16 
 drivers/net/wireless/ath/ath9k/wmi.h |8 
 2 files changed, 0 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/wmi.c 
b/drivers/net/wireless/ath/ath9k/wmi.c
index 9c11d6e..a5f8f6b 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -27,16 +27,10 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_DISABLE_INTR_CMDID";
case WMI_ENABLE_INTR_CMDID:
return "WMI_ENABLE_INTR_CMDID";
-   case WMI_RX_LINK_CMDID:
-   return "WMI_RX_LINK_CMDID";
case WMI_ATH_INIT_CMDID:
return "WMI_ATH_INIT_CMDID";
-   case WMI_ABORT_TXQ_CMDID:
-   return "WMI_ABORT_TXQ_CMDID";
case WMI_STOP_TX_DMA_CMDID:
return "WMI_STOP_TX_DMA_CMDID";
-   case WMI_STOP_DMA_RECV_CMDID:
-   return "WMI_STOP_DMA_RECV_CMDID";
case WMI_ABORT_TX_DMA_CMDID:
return "WMI_ABORT_TX_DMA_CMDID";
case WMI_DRAIN_TXQ_CMDID:
@@ -51,8 +45,6 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_FLUSH_RECV_CMDID";
case WMI_SET_MODE_CMDID:
return "WMI_SET_MODE_CMDID";
-   case WMI_RESET_CMDID:
-   return "WMI_RESET_CMDID";
case WMI_NODE_CREATE_CMDID:
return "WMI_NODE_CREATE_CMDID";
case WMI_NODE_REMOVE_CMDID:
@@ -61,8 +53,6 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_VAP_REMOVE_CMDID";
case WMI_VAP_CREATE_CMDID:
return "WMI_VAP_CREATE_CMDID";
-   case WMI_BEACON_UPDATE_CMDID:
-   return "WMI_BEACON_UPDATE_CMDID";
case WMI_REG_READ_CMDID:
return "WMI_REG_READ_CMDID";
case WMI_REG_WRITE_CMDID:
@@ -71,10 +61,6 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_RC_STATE_CHANGE_CMDID";
case WMI_RC_RATE_UPDATE_CMDID:
return "WMI_RC_RATE_UPDATE_CMDID";
-   case WMI_DEBUG_INFO_CMDID:
-   return "WMI_DEBUG_INFO_CMDID";
-   case WMI_HOST_ATTACH:
-   return "WMI_HOST_ATTACH";
case WMI_TARGET_IC_UPDATE_CMDID:
return "WMI_TARGET_IC_UPDATE_CMDID";
case WMI_TGT_STATS_CMDID:
@@ -83,8 +69,6 @@ static const char *wmi_cmd_to_name(enum wmi_cmd_id wmi_cmd)
return "WMI_TX_AGGR_ENABLE_CMDID";
case WMI_TGT_DETACH_CMDID:
return "WMI_TGT_DETACH_CMDID";
-   case WMI_TGT_TXQ_ENABLE_CMDID:
-   return "WMI_TGT_TXQ_ENABLE_CMDID";
case WMI_AGGR_LIMIT_CMD:
return "WMI_AGGR_LIMIT_CMD";
}
diff --git a/drivers/net/wireless/ath/ath9k/wmi.h 
b/drivers/net/wireless/ath/ath9k/wmi.h
index b705961..6e3edec 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.h
+++ b/drivers/net/wireless/ath/ath9k/wmi.h
@@ -43,11 +43,8 @@ enum wmi_cmd_id {
/* Commands to Target */
WMI_DISABLE_INTR_CMDID,
WMI_ENABLE_INTR_CMDID,
-   WMI_RX_LINK_CMDID,
WMI_ATH_INIT_CMDID,
-   WMI_ABORT_TXQ_CMDID,
WMI_STOP_TX_DMA_CMDID,
-   WMI_STOP_DMA_RECV_CMDID,
WMI_ABORT_TX_DMA_CMDID,
WMI_DRAIN_TXQ_CMDID,
WMI_DRAIN_TXQ_ALL_CMDID,
@@ -55,23 +52,18 @@ enum wmi_cmd_id {
WMI_STOP_RECV_CMDID,
WMI_FLUSH_RECV_CMDID,
WMI_SET_MODE_CMDID,
-   WMI_RESET_CMDID,
WMI_NODE_CREATE_CMDID,
WMI_NODE_REMOVE_CMDID,
WMI_VAP_REMOVE_CMDID,
WMI_VAP_CREATE_CMDID,
-   WMI_BEACON_UPDATE_CMDID,
WMI_REG_READ_CMDID,
WMI_REG_WRITE_CMDID,
WMI_RC_STATE_CHANGE_CMDID,
WMI_RC_RATE_UPDATE_CMDID,
-   WMI_DEBUG_INFO_CMDID,
-   WMI_HOST_ATTACH,
WMI_TARGET_IC_UPDATE_CMDID,
WMI_TGT_STATS_CMDID,
WMI_TX_AGGR_ENABLE_CMDID,
WMI_TGT_DETACH_CMDID,
-   WMI_TGT_TXQ_ENABLE_CMDID,
WMI_AGGR_LIMIT_CMD = 0x0026,
 };
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 32/33] ath9k_htc: Use SKB's private area for TX parameters

2011-01-20 Thread Sujith
From: Sujith Manoharan 

For all packets sent through the USB_WLAN_TX_PIPE endpoint,
the private area of the SKB's tx_info can be used to store
driver-specific information. For packets sent through USB_REG_OUT_PIPE,
this will not make a difference since they are routed through a
separate routine that doesn't access the private region.

This would help in situations where TX information is required
in the URB callback.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/hif_usb.c|   17 +
 drivers/net/wireless/ath/ath9k/htc.h|   14 +-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   11 +++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c   |   15 ---
 drivers/net/wireless/ath/ath9k/htc_hst.c|   18 +-
 drivers/net/wireless/ath/ath9k/htc_hst.h|5 ++---
 drivers/net/wireless/ath/ath9k/wmi.c|2 +-
 7 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 5ab3084..2c96960 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -282,9 +282,9 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev)
return ret;
 }
 
-static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb,
-  struct ath9k_htc_tx_ctl *tx_ctl)
+static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb)
 {
+   struct ath9k_htc_tx_ctl *tx_ctl;
unsigned long flags;
 
spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
@@ -303,12 +303,14 @@ static int hif_usb_send_tx(struct hif_device_usb 
*hif_dev, struct sk_buff *skb,
__skb_queue_tail(&hif_dev->tx.tx_skb_queue, skb);
hif_dev->tx.tx_skb_cnt++;
 
-   /* Send normal frames immediately */
-   if (!tx_ctl || (tx_ctl && (tx_ctl->type == ATH9K_HTC_NORMAL)))
+   tx_ctl = HTC_SKB_CB(skb);
+
+   /* Send normal/mgmt/beacon frames immediately */
+   if (tx_ctl->type != ATH9K_HTC_AMPDU)
__hif_usb_tx(hif_dev);
 
/* Check if AMPDUs have to be sent immediately */
-   if (tx_ctl && (tx_ctl->type == ATH9K_HTC_AMPDU) &&
+   if ((tx_ctl->type == ATH9K_HTC_AMPDU) &&
(hif_dev->tx.tx_buf_cnt == MAX_TX_URB_NUM) &&
(hif_dev->tx.tx_skb_cnt < 2)) {
__hif_usb_tx(hif_dev);
@@ -350,15 +352,14 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id)
}
 }
 
-static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb,
-   struct ath9k_htc_tx_ctl *tx_ctl)
+static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb)
 {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
int ret = 0;
 
switch (pipe_id) {
case USB_WLAN_TX_PIPE:
-   ret = hif_usb_send_tx(hif_dev, skb, tx_ctl);
+   ret = hif_usb_send_tx(hif_dev, skb);
break;
case USB_REG_OUT_PIPE:
ret = hif_usb_send_regout(hif_dev, skb);
diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index ed82bba..ec3511d 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -67,8 +67,11 @@ enum htc_opmode {
 };
 
 #define ATH9K_HTC_HDRSPACE sizeof(struct htc_frame_hdr)
-#define ATH9K_HTC_AMPDU1
+
+#define ATH9K_HTC_AMPDU  1
 #define ATH9K_HTC_NORMAL 2
+#define ATH9K_HTC_BEACON 3
+#define ATH9K_HTC_MGMT   4
 
 #define ATH9K_HTC_TX_CTSONLY  0x1
 #define ATH9K_HTC_TX_RTSCTS   0x2
@@ -287,6 +290,15 @@ struct ath9k_htc_tx_ctl {
u8 type; /* ATH9K_HTC_* */
 };
 
+static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
+{
+   struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+
+   BUILD_BUG_ON(sizeof(struct ath9k_htc_tx_ctl) >
+IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
+   return (struct ath9k_htc_tx_ctl *) &tx_info->driver_data;
+}
+
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
 
 #define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 15b149e..d23426f 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -345,7 +345,7 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
struct ieee80211_vif *vif;
struct ath9k_htc_vif *avp;
struct tx_beacon_header beacon_hdr;
-   struct ath9k_htc_tx_ctl tx_ctl;
+   struct ath9k_htc_tx_ctl *tx_ctl;
struct ieee80211_tx_info *info;
struct ieee80211_mgmt *mgmt;
struct sk_buff *beacon;
@@ -353,7 +353,6 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
int ret;
 
memset(&beacon_hdr, 0, sizeof(st

[ath9k-devel] [RFC/WIP 05/33] ath9k_htc: Remove OP_PROTECT_ENABLE

2011-01-20 Thread Sujith
From: Sujith Manoharan 

CTS protection can be obtained from mac80211 directly.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h  |   11 +--
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   10 --
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |2 +-
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 08ab28d..79b67a1 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -335,12 +335,11 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv 
*priv);
 #define OP_SCANNING   BIT(1)
 #define OP_LED_ASSOCIATED BIT(2)
 #define OP_LED_ON BIT(3)
-#define OP_PROTECT_ENABLE BIT(4)
-#define OP_ASSOCIATED BIT(5)
-#define OP_ENABLE_BEACON  BIT(6)
-#define OP_LED_DEINIT BIT(7)
-#define OP_BT_PRIORITY_DETECTEDBIT(8)
-#define OP_BT_SCAN BIT(9)
+#define OP_ASSOCIATED BIT(4)
+#define OP_ENABLE_BEACON  BIT(5)
+#define OP_LED_DEINIT BIT(6)
+#define OP_BT_PRIORITY_DETECTEDBIT(7)
+#define OP_BT_SCAN BIT(8)
 
 struct ath9k_htc_priv {
struct device *dev;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 8e76589..fe6e0bb 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1521,16 +1521,6 @@ static void ath9k_htc_bss_info_changed(struct 
ieee80211_hw *hw,
ath9k_htc_beacon_config(priv, vif);
}
 
-   if (changed & BSS_CHANGED_ERP_CTS_PROT) {
-   ath_dbg(common, ATH_DBG_CONFIG, "BSS Changed CTS PROT %d\n",
-   bss_conf->use_cts_prot);
-   if (bss_conf->use_cts_prot &&
-   hw->conf.channel->band != IEEE80211_BAND_5GHZ)
-   priv->op_flags |= OP_PROTECT_ENABLE;
-   else
-   priv->op_flags &= ~OP_PROTECT_ENABLE;
-   }
-
if (changed & BSS_CHANGED_ERP_SLOT) {
if (bss_conf->use_short_slot)
ah->slottime = 9;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index d5f0f41..884deeb 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -156,7 +156,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct 
sk_buff *skb)
 
/* CTS-to-self */
if (!(flags & ATH9K_HTC_TX_RTSCTS) &&
-   (priv->op_flags & OP_PROTECT_ENABLE))
+   (vif && vif->bss_conf.use_cts_prot))
flags |= ATH9K_HTC_TX_CTSONLY;
 
tx_hdr.flags = cpu_to_be32(flags);
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 24/33] ath9k_htc: Fix beacon miss under heavy load

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Transmission of beacons becomes erratic when TX load
is high, since the latency involved in the generation
of a SWBA interrupt on the target to the actual sending
of a beacon is quite high for USB devices.

Fix this by adjusting the beacon response time.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|7 
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |   41 +++---
 2 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 912cce8..3aa73fc 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -357,6 +357,13 @@ struct ath_led {
 
 #define BSTUCK_THRESHOLD 10
 
+/*
+ * Adjust these when the max. no of beaconing interfaces is
+ * increased.
+ */
+#define DEFAULT_SWBA_RESPONSE 40 /* in TUs */
+#define MIN_SWBA_RESPONSE 10 /* in TUs */
+
 struct htc_beacon_config {
struct ieee80211_vif *bslot[ATH9K_HTC_MAX_BCN_VIF];
u16 beacon_interval;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index 927bb27..42a1758 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -197,6 +197,15 @@ static void ath9k_htc_beacon_config_ap(struct 
ath9k_htc_priv *priv,
intval /= ATH9K_HTC_MAX_BCN_VIF;
nexttbtt = intval;
 
+   /*
+* To reduce beacon misses under heavy TX load,
+* set the beacon response time to a larger value.
+*/
+   if (intval > DEFAULT_SWBA_RESPONSE)
+   priv->ah->config.sw_beacon_response_time = 
DEFAULT_SWBA_RESPONSE;
+   else
+   priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
+
if (priv->op_flags & OP_TSF_RESET) {
intval |= ATH9K_BEACON_RESET_TSF;
priv->op_flags &= ~OP_TSF_RESET;
@@ -217,10 +226,11 @@ static void ath9k_htc_beacon_config_ap(struct 
ath9k_htc_priv *priv,
imask |= ATH9K_INT_SWBA;
 
ath_dbg(common, ATH_DBG_CONFIG,
-   "AP Beacon config, intval: %d, nexttbtt: %u "
+   "AP Beacon config, intval: %d, nexttbtt: %u, resp_time: %d "
"imask: 0x%x, tsf_reset: %d\n",
-   bss_conf->beacon_interval, nexttbtt, imask,
-   !!(intval & ATH9K_BEACON_RESET_TSF));
+   bss_conf->beacon_interval, nexttbtt,
+   priv->ah->config.sw_beacon_response_time,
+   imask, !!(intval & ATH9K_BEACON_RESET_TSF));
 
ath9k_htc_beaconq_config(priv);
 
@@ -254,13 +264,23 @@ static void ath9k_htc_beacon_config_adhoc(struct 
ath9k_htc_priv *priv,
nexttbtt += intval;
} while (nexttbtt < tsftu);
 
+   /*
+* Only one IBSS interfce is allowed.
+*/
+   if (intval > DEFAULT_SWBA_RESPONSE)
+   priv->ah->config.sw_beacon_response_time = 
DEFAULT_SWBA_RESPONSE;
+   else
+   priv->ah->config.sw_beacon_response_time = MIN_SWBA_RESPONSE;
+
intval |= ATH9K_BEACON_ENA;
if (priv->op_flags & OP_ENABLE_BEACON)
imask |= ATH9K_INT_SWBA;
 
ath_dbg(common, ATH_DBG_CONFIG,
-   "IBSS Beacon config, intval: %d, nexttbtt: %u, imask: 0x%x\n",
-   bss_conf->beacon_interval, nexttbtt, imask);
+   "IBSS Beacon config, intval: %d, nexttbtt: %u, "
+   "resp_time: %d, imask: 0x%x\n",
+   bss_conf->beacon_interval, nexttbtt,
+   priv->ah->config.sw_beacon_response_time, imask);
 
WMI_CMD(WMI_DISABLE_INTR_CMDID);
ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
@@ -320,6 +340,7 @@ static void ath9k_htc_send_buffered(struct ath9k_htc_priv 
*priv,
 static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
  int slot)
 {
+   struct ath_common *common = ath9k_hw_common(priv->ah);
struct ieee80211_vif *vif;
struct ath9k_htc_vif *avp;
struct tx_beacon_header beacon_hdr;
@@ -328,6 +349,7 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
struct ieee80211_mgmt *mgmt;
struct sk_buff *beacon;
u8 *tx_fhdr;
+   int ret;
 
memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header));
memset(&tx_ctl, 0, sizeof(struct ath9k_htc_tx_ctl));
@@ -370,7 +392,14 @@ static void ath9k_htc_send_beacon(struct ath9k_htc_priv 
*priv,
tx_fhdr = skb_push(beacon, sizeof(beacon_hdr));
memcpy(tx_fhdr, (u8 *) &beacon_hdr, sizeof(beacon_hdr));
 
-   htc_send(priv->htc, beacon, priv->beacon_ep, &tx_ctl);
+   ret = htc_send(priv->htc, beacon, priv->beacon_ep, &tx_ctl);
+   if (ret != 0) {
+   if (ret == -ENOMEM) {
+   ath_dbg(common, ATH_DBG_BSTUCK,
+   "Failed to send beacon, no free T

[ath9k-devel] [RFC/WIP 27/33] ath9k_htc: Move debug code to a separate file

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/Makefile|2 +
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c |  219 
 drivers/net/wireless/ath/ath9k/htc_drv_main.c  |  212 ---
 3 files changed, 221 insertions(+), 212 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/htc_drv_debug.c

diff --git a/drivers/net/wireless/ath/ath9k/Makefile 
b/drivers/net/wireless/ath/ath9k/Makefile
index aca0162..33a9cc1 100644
--- a/drivers/net/wireless/ath/ath9k/Makefile
+++ b/drivers/net/wireless/ath/ath9k/Makefile
@@ -49,4 +49,6 @@ ath9k_htc-y +=htc_hst.o \
htc_drv_init.o \
htc_drv_gpio.o
 
+ath9k_htc-$(CONFIG_ATH9K_HTC_DEBUGFS) += htc_drv_debug.o
+
 obj-$(CONFIG_ATH9K_HTC) += ath9k_htc.o
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
new file mode 100644
index 000..8b679aa
--- /dev/null
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2010-2011 Atheros Communications 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.
+ */
+
+#include "htc.h"
+
+static struct dentry *ath9k_debugfs_root;
+
+static int ath9k_debugfs_open(struct inode *inode, struct file *file)
+{
+   file->private_data = inode->i_private;
+   return 0;
+}
+
+static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
+  size_t count, loff_t *ppos)
+{
+   struct ath9k_htc_priv *priv = file->private_data;
+   struct ath9k_htc_target_stats cmd_rsp;
+   char buf[512];
+   unsigned int len = 0;
+   int ret = 0;
+
+   memset(&cmd_rsp, 0, sizeof(cmd_rsp));
+
+   WMI_CMD(WMI_TGT_STATS_CMDID);
+   if (ret)
+   return -EINVAL;
+
+
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Short Retries",
+   be32_to_cpu(cmd_rsp.tx_shortretry));
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Long Retries",
+   be32_to_cpu(cmd_rsp.tx_longretry));
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Xretries",
+   be32_to_cpu(cmd_rsp.tx_xretries));
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Unaggr. Xretries",
+   be32_to_cpu(cmd_rsp.ht_txunaggr_xretry));
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Xretries (HT)",
+   be32_to_cpu(cmd_rsp.ht_tx_xretries));
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%19s : %10u\n", "TX Rate", priv->debug.txrate);
+
+   if (len > sizeof(buf))
+   len = sizeof(buf);
+
+   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_tgt_stats = {
+   .read = read_file_tgt_stats,
+   .open = ath9k_debugfs_open,
+   .owner = THIS_MODULE,
+   .llseek = default_llseek,
+};
+
+static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+   struct ath9k_htc_priv *priv = file->private_data;
+   char buf[512];
+   unsigned int len = 0;
+
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%20s : %10u\n", "Buffers queued",
+   priv->debug.tx_stats.buf_queued);
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%20s : %10u\n", "Buffers completed",
+   priv->debug.tx_stats.buf_completed);
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%20s : %10u\n", "SKBs queued",
+   priv->debug.tx_stats.skb_queued);
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%20s : %10u\n", "SKBs completed",
+   priv->debug.tx_stats.skb_completed);
+   len += snprintf(buf + len, sizeof(buf) - len,
+   "%20s : %10u\n", "SKBs dropped",
+   priv->debug.tx

[ath9k-devel] [RFC/WIP 18/33] ath9k_htc: Add beacon slots

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Beacon transmission is now handled through a slot mechanism.
This allows multiple beaconing interfaces to be be present.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h|   13 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_beacon.c |  126 ---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c   |5 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c   |   12 ++-
 drivers/net/wireless/ath/ath9k/wmi.c|4 +-
 5 files changed, 140 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 4c11ffe..6b3f0f3 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -243,6 +243,7 @@ struct ath9k_htc_target_stats {
 struct ath9k_htc_vif {
u8 index;
u16 seq_no;
+   int bslot;
 };
 
 struct ath9k_vif_iter_data {
@@ -350,10 +351,14 @@ struct ath_led {
int brightness;
 };
 
+#define BSTUCK_THRESHOLD 10
+
 struct htc_beacon_config {
+   struct ieee80211_vif *bslot[ATH9K_HTC_MAX_BCN_VIF];
u16 beacon_interval;
u16 dtim_period;
u16 bmiss_timeout;
+   u32 bmiss_cnt;
 };
 
 struct ath_btcoex {
@@ -409,7 +414,6 @@ struct ath9k_htc_priv {
u16 txpowlimit;
u16 nvifs;
u16 nstations;
-   u32 bmiss_cnt;
bool rearm_ani;
bool reconfig_beacon;
 
@@ -420,7 +424,6 @@ struct ath9k_htc_priv {
bool tx_queues_stop;
spinlock_t tx_lock;
 
-   struct ieee80211_vif *vif;
struct htc_beacon_config cur_beacon_conf;
unsigned int rxfilter;
struct tasklet_struct swba_tasklet;
@@ -468,11 +471,15 @@ static inline void ath_read_cachesize(struct ath_common 
*common, int *csz)
 
 void ath9k_htc_reset(struct ath9k_htc_priv *priv);
 
+void ath9k_htc_assign_bslot(struct ath9k_htc_priv *priv,
+   struct ieee80211_vif *vif);
+void ath9k_htc_remove_bslot(struct ath9k_htc_priv *priv,
+   struct ieee80211_vif *vif);
 void ath9k_htc_beaconq_config(struct ath9k_htc_priv *priv);
 void ath9k_htc_beacon_config(struct ath9k_htc_priv *priv,
 struct ieee80211_vif *vif);
 void ath9k_htc_beacon_reconfig(struct ath9k_htc_priv *priv);
-void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending);
+void ath9k_htc_swba(struct ath9k_htc_priv *priv);
 
 void ath9k_htc_rxep(void *priv, struct sk_buff *skb,
enum htc_endpoint_id ep_id);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index e897a56..b4431a9 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -173,12 +173,14 @@ static void ath9k_htc_beacon_config_ap(struct 
ath9k_htc_priv *priv,
imask |= ATH9K_INT_SWBA;
 
ath_dbg(common, ATH_DBG_CONFIG,
-   "AP Beacon config, intval: %d, nexttbtt: %u imask: 0x%x\n",
-   bss_conf->beacon_interval, nexttbtt, imask);
+   "AP Beacon config, intval: %d, nexttbtt: %u "
+   "imask: 0x%x, tsf_reset: %d\n",
+   bss_conf->beacon_interval, nexttbtt, imask,
+   !!(intval & ATH9K_BEACON_RESET_TSF));
 
WMI_CMD(WMI_DISABLE_INTR_CMDID);
ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
-   priv->bmiss_cnt = 0;
+   priv->cur_beacon_conf.bmiss_cnt = 0;
htc_imask = cpu_to_be32(imask);
WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
 }
@@ -205,7 +207,7 @@ static void ath9k_htc_beacon_config_adhoc(struct 
ath9k_htc_priv *priv,
 
WMI_CMD(WMI_DISABLE_INTR_CMDID);
ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);
-   priv->bmiss_cnt = 0;
+   priv->cur_beacon_conf.bmiss_cnt = 0;
htc_imask = cpu_to_be32(imask);
WMI_CMD_BUF(WMI_ENABLE_INTR_CMDID, &htc_imask);
 }
@@ -216,9 +218,11 @@ void ath9k_htc_beaconep(void *drv_priv, struct sk_buff 
*skb,
dev_kfree_skb_any(skb);
 }
 
-void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 beacon_pending)
+static void ath9k_htc_send_beacon(struct ath9k_htc_priv *priv,
+ int slot)
 {
-   struct ath9k_htc_vif *avp = (void *)priv->vif->drv_priv;
+   struct ieee80211_vif *vif;
+   struct ath9k_htc_vif *avp;
struct tx_beacon_header beacon_hdr;
struct ath9k_htc_tx_ctl tx_ctl;
struct ieee80211_tx_info *info;
@@ -228,21 +232,18 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv, u8 
beacon_pending)
memset(&beacon_hdr, 0, sizeof(struct tx_beacon_header));
memset(&tx_ctl, 0, sizeof(struct ath9k_htc_tx_ctl));
 
-   /* FIXME: Handle BMISS */
-   if (beacon_pending != 0) {
-   priv->bmiss_cnt++;
-   return;
-   }
-
spin_lock_bh(&priv->beacon_lock);
 
+   vif = priv->cur_beacon_conf.bslot[slot];
+   avp = (s

[ath9k-devel] [RFC/WIP 28/33] ath9k_htc: Add RX error statistics

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc.h   |   16 
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c |  107 ++--
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c  |2 +
 3 files changed, 117 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index 742777e..ed82bba 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -295,6 +295,9 @@ struct ath9k_htc_tx_ctl {
 
 #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++)
 
+void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
+  struct ath_htc_rx_status *rxs);
+
 struct ath_tx_stats {
u32 buf_queued;
u32 buf_completed;
@@ -309,6 +312,14 @@ struct ath_rx_stats {
u32 skb_allocated;
u32 skb_completed;
u32 skb_dropped;
+   u32 err_crc;
+   u32 err_decrypt_crc;
+   u32 err_mic;
+   u32 err_pre_delim;
+   u32 err_post_delim;
+   u32 err_decrypt_busy;
+   u32 err_phy;
+   u32 err_phy_stats[ATH9K_PHYERR_MAX];
 };
 
 struct ath9k_debug {
@@ -329,6 +340,11 @@ struct ath9k_debug {
 
 #define TX_QSTAT_INC(c) do { } while (0)
 
+static inline void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
+struct ath_htc_rx_status *rxs)
+{
+}
+
 #endif /* CONFIG_ATH9K_HTC_DEBUGFS */
 
 #define ATH_LED_PIN_DEF 1
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index 8b679aa..6fc6cb7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -123,27 +123,118 @@ static const struct file_operations fops_xmit = {
.llseek = default_llseek,
 };
 
+void ath9k_htc_err_stat_rx(struct ath9k_htc_priv *priv,
+  struct ath_htc_rx_status *rxs)
+{
+#define RX_PHY_ERR_INC(c) priv->debug.rx_stats.err_phy_stats[c]++
+
+   if (rxs->rs_status & ATH9K_RXERR_CRC)
+   priv->debug.rx_stats.err_crc++;
+   if (rxs->rs_status & ATH9K_RXERR_DECRYPT)
+   priv->debug.rx_stats.err_decrypt_crc++;
+   if (rxs->rs_status & ATH9K_RXERR_MIC)
+   priv->debug.rx_stats.err_mic++;
+   if (rxs->rs_status & ATH9K_RX_DELIM_CRC_PRE)
+   priv->debug.rx_stats.err_pre_delim++;
+   if (rxs->rs_status & ATH9K_RX_DELIM_CRC_POST)
+   priv->debug.rx_stats.err_post_delim++;
+   if (rxs->rs_status & ATH9K_RX_DECRYPT_BUSY)
+   priv->debug.rx_stats.err_decrypt_busy++;
+
+   if (rxs->rs_status & ATH9K_RXERR_PHY) {
+   priv->debug.rx_stats.err_phy++;
+   if (rxs->rs_phyerr < ATH9K_PHYERR_MAX)
+   RX_PHY_ERR_INC(rxs->rs_phyerr);
+   }
+
+#undef RX_PHY_ERR_INC
+}
+
 static ssize_t read_file_recv(struct file *file, char __user *user_buf,
  size_t count, loff_t *ppos)
 {
+#define PHY_ERR(s, p)  \
+   len += snprintf(buf + len, size - len, "%20s : %10u\n", s,  \
+   priv->debug.rx_stats.err_phy_stats[p]);
+
struct ath9k_htc_priv *priv = file->private_data;
-   char buf[512];
-   unsigned int len = 0;
+   char *buf;
+   unsigned int len = 0, size = 1500;
+   ssize_t retval = 0;
 
-   len += snprintf(buf + len, sizeof(buf) - len,
+   buf = kzalloc(size, GFP_KERNEL);
+   if (buf == NULL)
+   return -ENOMEM;
+
+   len += snprintf(buf + len, size - len,
"%20s : %10u\n", "SKBs allocated",
priv->debug.rx_stats.skb_allocated);
-   len += snprintf(buf + len, sizeof(buf) - len,
+   len += snprintf(buf + len, size - len,
"%20s : %10u\n", "SKBs completed",
priv->debug.rx_stats.skb_completed);
-   len += snprintf(buf + len, sizeof(buf) - len,
+   len += snprintf(buf + len, size - len,
"%20s : %10u\n", "SKBs Dropped",
priv->debug.rx_stats.skb_dropped);
 
-   if (len > sizeof(buf))
-   len = sizeof(buf);
-
-   return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+   len += snprintf(buf + len, size - len,
+   "%20s : %10u\n", "CRC ERR",
+   priv->debug.rx_stats.err_crc);
+   len += snprintf(buf + len, size - len,
+   "%20s : %10u\n", "DECRYPT CRC ERR",
+   priv->debug.rx_stats.err_decrypt_crc);
+   len += snprintf(buf + len, size - len,
+   "%20s : %10u\n", "MIC ERR",
+   priv->debug.rx_stats.err_mic);
+   len += snprintf(buf + len, size - len,
+   "%20s : %10u\n", "PRE-DELIM CRC ERR",
+   priv-

[ath9k-devel] [RFC/WIP 23/33] ath9k_htc: Enable AP mode

2011-01-20 Thread Sujith
From: Sujith Manoharan 

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index dc96c06..b4ae719 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -753,7 +753,8 @@ static void ath9k_set_hw_capab(struct ath9k_htc_priv *priv,
 
hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
-   BIT(NL80211_IFTYPE_ADHOC);
+   BIT(NL80211_IFTYPE_ADHOC) |
+   BIT(NL80211_IFTYPE_AP);
 
hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
-- 
1.7.3.5

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


[ath9k-devel] [RFC/WIP 00/33] ath9k_htc AP mode

2011-01-20 Thread Sujith
Sujith wrote:
> This series is the preliminary work for enabling AP mode for ath9k_htc.
> 

A unified patchset can be obtained here:
http://wireless.kernel.org/en/users/Drivers/ath9k_htc#AP_Mode

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


[ath9k-devel] [RFC/WIP 33/33] ath9k_htc: Drain packets on station removal

2011-01-20 Thread Sujith
From: Sujith Manoharan 

When a station entry is removed, there could still be
pending packets destined for that station in the HIF layer.
Sending these to the target is not necessary, so drain them
in the driver itself.

Signed-off-by: Sujith Manoharan 
---
 drivers/net/wireless/ath/ath9k/hif_usb.c  |   34 +
 drivers/net/wireless/ath/ath9k/htc.h  |1 +
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |3 ++
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |8 ++
 drivers/net/wireless/ath/ath9k/htc_hst.c  |5 +++
 drivers/net/wireless/ath/ath9k/htc_hst.h  |2 +
 6 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c 
b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 2c96960..9384e83 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -352,6 +352,39 @@ static void hif_usb_stop(void *hif_handle, u8 pipe_id)
}
 }
 
+static inline bool check_index(struct sk_buff *skb, u8 idx)
+{
+   struct ath9k_htc_tx_ctl *tx_ctl;
+
+   tx_ctl = HTC_SKB_CB(skb);
+
+   if ((tx_ctl->type == ATH9K_HTC_AMPDU) &&
+   (tx_ctl->sta_idx == idx))
+   return true;
+
+   return false;
+}
+
+static void hif_usb_drain(void *hif_handle, u8 idx)
+{
+   struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
+   struct sk_buff *skb, *tmp;
+   unsigned long flags;
+
+   spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
+
+   skb_queue_walk_safe(&hif_dev->tx.tx_skb_queue, skb, tmp) {
+   if (check_index(skb, idx)) {
+   __skb_unlink(skb, &hif_dev->tx.tx_skb_queue);
+   hif_dev->tx.tx_skb_cnt--;
+   dev_kfree_skb_any(skb);
+   TX_STAT_INC(skb_dropped);
+   }
+   }
+
+   spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
+}
+
 static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb)
 {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
@@ -383,6 +416,7 @@ static struct ath9k_htc_hif hif_usb = {
 
.start = hif_usb_start,
.stop = hif_usb_stop,
+   .drain = hif_usb_drain,
.send = hif_usb_send,
 };
 
diff --git a/drivers/net/wireless/ath/ath9k/htc.h 
b/drivers/net/wireless/ath/ath9k/htc.h
index ec3511d..bbed402 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -288,6 +288,7 @@ struct ath9k_htc_rx {
 
 struct ath9k_htc_tx_ctl {
u8 type; /* ATH9K_HTC_* */
+   u8 sta_idx;
 };
 
 static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a5476e8..d6bbd26 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1279,10 +1279,13 @@ static int ath9k_htc_sta_remove(struct ieee80211_hw *hw,
struct ieee80211_sta *sta)
 {
struct ath9k_htc_priv *priv = hw->priv;
+   struct ath9k_htc_sta *ista;
int ret;
 
mutex_lock(&priv->mutex);
ath9k_htc_ps_wakeup(priv);
+   ista = (struct ath9k_htc_sta *) sta->drv_priv;
+   htc_drain(priv->htc, ista->index);
ret = ath9k_htc_remove_station(priv, vif, sta);
ath9k_htc_ps_restore(priv);
mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 7357e70..6b31ebf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -139,6 +139,14 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv,
tx_hdr.node_idx = sta_idx;
tx_hdr.vif_idx = vif_idx;
 
+   /*
+* This is a bit redundant but it helps to get
+* the per-packet index quickly when draining the
+* TX queue in the HIF layer. Otherwise we would
+* have to parse the packet contents ...
+*/
+   tx_ctl->sta_idx = sta_idx;
+
if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
tx_ctl->type = ATH9K_HTC_AMPDU;
tx_hdr.data_type = ATH9K_HTC_AMPDU;
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c 
b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 6ee53de..be92cbf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -317,6 +317,11 @@ void htc_start(struct htc_target *target)
}
 }
 
+void htc_drain(struct htc_target *target, u8 idx)
+{
+   target->hif->drain(target->hif_dev, idx);
+}
+
 void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
   struct sk_buff *skb, bool txok)
 {
diff --git a/drivers/net/wireless/ath/a

[ath9k-devel] [RFC/RFT] ath9k_htc: fix race conditions when stop device

2011-01-20 Thread Stanislaw Gruszka
Similar fix I already posted for ath9k. When stopping device, disable
interrupts, kill tasklets and then works, in correct order. Patch drop
mutex in them middle of a function, which I don't like and can possibly
not be correct. Perhaps this can be arranged differently. Also
there is no synchronize_irq, which IMHO should be added somewhere in
htc/wmi stop.

RFC/RTC for now (note I'm not able to test patch).

Signed-off-by: Stanislaw Gruszka 
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |3 ---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |   21 +++--
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 8e04586..a7bc26d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -142,9 +142,6 @@ static void ath9k_deinit_priv(struct ath9k_htc_priv *priv)
 {
ath9k_htc_exit_debug(priv->ah);
ath9k_hw_deinit(priv->ah);
-   tasklet_kill(&priv->swba_tasklet);
-   tasklet_kill(&priv->rx_tasklet);
-   tasklet_kill(&priv->tx_tasklet);
kfree(priv->ah);
priv->ah = NULL;
 }
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c 
b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f14f37d..a702089 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1026,12 +1026,6 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
int ret = 0;
u8 cmd_rsp;
 
-   /* Cancel all the running timers/work .. */
-   cancel_work_sync(&priv->fatal_work);
-   cancel_work_sync(&priv->ps_work);
-   cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
-   ath9k_led_stop_brightness(priv);
-
mutex_lock(&priv->mutex);
 
if (priv->op_flags & OP_INVALID) {
@@ -1045,8 +1039,23 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw)
WMI_CMD(WMI_DISABLE_INTR_CMDID);
WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
WMI_CMD(WMI_STOP_RECV_CMDID);
+
+   tasklet_kill(&priv->swba_tasklet);
+   tasklet_kill(&priv->rx_tasklet);
+   tasklet_kill(&priv->tx_tasklet);
+
skb_queue_purge(&priv->tx_queue);
 
+   mutex_unlock(&priv->mutex);
+
+   /* Cancel all the running timers/work .. */
+   cancel_work_sync(&priv->fatal_work);
+   cancel_work_sync(&priv->ps_work);
+   cancel_delayed_work_sync(&priv->ath9k_led_blink_work);
+   ath9k_led_stop_brightness(priv);
+
+   mutex_lock(&priv->mutex);
+
/* Remove monitor interface here */
if (ah->opmode == NL80211_IFTYPE_MONITOR) {
if (ath9k_htc_remove_monitor_interface(priv))
-- 
1.7.1

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


Re: [ath9k-devel] [RFC/WIP 30/33] ath9k_htc: Fix host RX initialization

2011-01-20 Thread Vasanthakumar Thiagarajan
On Fri, Jan 21, 2011 at 08:33:41AM +0530, Sujith wrote:
> From: Sujith Manoharan 
> 
> There is no need to set the BSSID mask or opmode when
> initializing RX, they would be set correctly in the HW reset
> routine.
> 
> Signed-off-by: Sujith Manoharan 
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |8 
>  1 files changed, 0 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c 
> b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> index 9913ef0..458164f 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> @@ -451,20 +451,12 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv)
>  static void ath9k_htc_opmode_init(struct ath9k_htc_priv *priv)
>  {
>   struct ath_hw *ah = priv->ah;
> - struct ath_common *common = ath9k_hw_common(ah);
> -
>   u32 rfilt, mfilt[2];
>  
>   /* configure rx filter */
>   rfilt = ath9k_htc_calcrxfilter(priv);
>   ath9k_hw_setrxfilter(ah, rfilt);
>  
> - /* configure bssid mask */
> - ath_hw_setbssidmask(common);
> -
> - /* configure operational mode */
> - ath9k_hw_setopmode(ah);

I think we need to take care a bug in reg AR_STA_ID1 configuration.
During hw reset, operating mode is set in AR_STA_ID1 but right after
it's overwritten. See the following code segment in
ath9k_hw_reset().

 ath9k_hw_set_operating_mode(ah, ah->opmode);

 ENABLE_REGWRITE_BUFFER(ah);

 REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(common->macaddr));
 REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(common->macaddr + 4)
  | macStaId1
  | AR_STA_ID1_RTS_USE_DEF
  | (ah->config.
 ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
  | ah->sta_id1_defaults);


Existing code works because we configure the opmode again through
ath9k_htc_opmode_init() after reset. 

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


Re: [ath9k-devel] [RFC/WIP 15/33] ath9k_htc: Add ANI for AP mode

2011-01-20 Thread Vasanthakumar Thiagarajan
On Fri, Jan 21, 2011 at 08:31:24AM +0530, Sujith wrote:
> From: Sujith Manoharan 
> 
> + if (priv->ah->opmode == NL80211_IFTYPE_AP)
> + cancel_delayed_work_sync(&priv->ath9k_ani_work);
> +

What about ANI for other vifs?

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


Re: [ath9k-devel] [RFC/WIP 30/33] ath9k_htc: Fix host RX initialization

2011-01-20 Thread Sujith
Vasanthakumar Thiagarajan wrote:
> I think we need to take care a bug in reg AR_STA_ID1 configuration.
> During hw reset, operating mode is set in AR_STA_ID1 but right after
> it's overwritten. See the following code segment in
> ath9k_hw_reset().
> 
>  ath9k_hw_set_operating_mode(ah, ah->opmode);
> 
>  ENABLE_REGWRITE_BUFFER(ah);
> 
>  REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(common->macaddr));
>  REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(common->macaddr + 4)
>   | macStaId1
>   | AR_STA_ID1_RTS_USE_DEF
>   | (ah->config.
>  ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
>   | ah->sta_id1_defaults);
> 
> 
> Existing code works because we configure the opmode again through
> ath9k_htc_opmode_init() after reset. 

Looks like I changed this, see commit 6819d57f07440a8f9540967d9212a70e9c98eceb
But yes, opmode_init() in both ath9k and ath9k_htc takes care of this.
I'll fix this.

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


Re: [ath9k-devel] [RFC/WIP 15/33] ath9k_htc: Add ANI for AP mode

2011-01-20 Thread Sujith
Vasanthakumar Thiagarajan wrote:
> On Fri, Jan 21, 2011 at 08:31:24AM +0530, Sujith wrote:
> > From: Sujith Manoharan 
> > 
> > +   if (priv->ah->opmode == NL80211_IFTYPE_AP)
> > +   cancel_delayed_work_sync(&priv->ath9k_ani_work);
> > +
> 
> What about ANI for other vifs?

I have a half-finished patch handling ANI in multi-VIF scenario, will
fold it into this.

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


[ath9k-devel] [RFC] ath9k: fix race conditions when stop device

2011-01-20 Thread Stanislaw Gruszka
We do not kill any scheduled tasklets when stopping device, that may
cause usage of resources after free. Moreover we enable interrupts
in tasklet function, so we could potentially end with interrupts
enabled when driver is not ready to receive them.

I think patch could fix Ben's kernel crash from:
http://marc.info/?l=linux-wireless&m=129438358921501&w=2

RFC for now as I'm not quite familiar with ath9k. If get confirmation
patch is correct, I will repost and cc to -stable.

Signed-off-by: Stanislaw Gruszka 
---
 drivers/net/wireless/ath/ath9k/init.c |5 -
 drivers/net/wireless/ath/ath9k/main.c |9 +
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 767d8b8..b3254a3 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -598,8 +598,6 @@ err_btcoex:
 err_queues:
ath9k_hw_deinit(ah);
 err_hw:
-   tasklet_kill(&sc->intr_tq);
-   tasklet_kill(&sc->bcon_tasklet);
 
kfree(ah);
sc->sc_ah = NULL;
@@ -807,9 +805,6 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 
ath9k_hw_deinit(sc->sc_ah);
 
-   tasklet_kill(&sc->intr_tq);
-   tasklet_kill(&sc->bcon_tasklet);
-
kfree(sc->sc_ah);
sc->sc_ah = NULL;
 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index c03184e..42cfd96 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1320,6 +1320,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 
spin_lock_bh(&sc->sc_pcu_lock);
 
+   /* prevent tasklets to enable interrupts once we disable them */
+   ah->imask &= ~ATH9K_INT_GLOBAL;
+
/* make sure h/w will not generate any interrupt
 * before setting the invalid flag. */
ath9k_hw_disable_interrupts(ah);
@@ -1337,6 +1340,12 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 
spin_unlock_bh(&sc->sc_pcu_lock);
 
+   /* we can now sync irq and kill any running tasklets, since we already
+* disabled interrupts and not holding a spin lock */
+   synchronize_irq(sc->irq);
+   tasklet_kill(&sc->intr_tq);
+   tasklet_kill(&sc->bcon_tasklet);
+
ath9k_ps_restore(sc);
 
sc->ps_idle = true;
-- 
1.7.1

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


Re: [ath9k-devel] ath9k_htc in master mode / 0cf3:9271 Atheros Communications AR9271 802.11n / USB TP-Link TL-WN722N / detachable antenna - RSMA

2011-01-20 Thread Mohammed Shafi
On Fri, Jan 21, 2011 at 3:09 AM, Jorge Luis  wrote:
>
> On 20 Jan 2011 20:14, "C Anthony Risinger"  wrote:
>>
>> On Thu, Jan 20, 2011 at 5:12 AM, Mohammed Shafi
>>  wrote:
>> > On Wed, Jan 19, 2011 at 6:30 AM, Jorge Luis  wrote:
>> >> Senthilkumar Balasubramanian  gmail.com>
>> >> writes:
>> >>> On Mon, Dec 27, 2010 at 9:58 AM, Mohammed Shafi 
>> >>> gmail.com>
>> >> wrote:
>> >>> >
>> >>> > AP mode is yet to be supported in htc. Please refer to this
>> >>> > http://www.spinics.net/lists/linux-wireless/msg52239.html
>> >>>
>> >>> Sujith's patches can be used to test basic AP mode functionality. We
>> >>> are working on addressing the buffering mode cleanly and the new set
>> >>> of patches should be available by first week of January 2011. Let me
>> >>> know if you are interested in doing some verification.
>> >>
>> >> Can you explain what are the limitations of not having the
>> >> buffering mode working?
>> >>
>> >> For what I can understand, that only affects clients with
>> >> power saving enabled.
>> >> Is this correct?
>> >
>> > Yes correct, developers are working to bring that in firmware to make
>> > it perfect.
>>
>> i have the same USB device (TL-WN722N) as well.  i'd like to try the
>> simpler patches in my home network... what are the consequences of not
>> properly handling power save mode?  i have multiple android phones
>> that i'm guessing make use of this feature; does it simply translate
>> to dropped/missed packets, or something more?
>>
>> thanks,
>>
>> C Anthony
>
> Hi,
> I have been testing it with an HTC desire and the device disconnect and
> reconects every 10 seconds unless there is an active data connection.
> It's not usable

*Hi please use the latest wireless testing which has some important fixes.
* Sujith had also sent RFC patches to mailing list for enabling AP
mode with the updated firmware.
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel