Re: [PATCH 00/16] brcmfmac: wowl support and cleanup

2014-10-29 Thread Arend van Spriel

On 10/28/14 15:54, Joe Perches wrote:

On Tue, 2014-10-28 at 14:56 +0100, Arend van Spriel wrote:

This series has a couple of wowl patches that were too late to make
the 3.18 merge window. Apart from those there are a number of rename
and rework patches that get rid of the terms dhd and wl.

The series is intended for 3.19 and applies to the master branch
of the wireless-next repository.

Arend van Spriel (3):
   brcmfmac: show firmware error as string in debug message
   brcmfmac: remove unused defintion
   brcmfmac: do not use firmware error code in driver

Hante Meuleman (13):
   brcmfmac: Add wowl support for USB devices.
   brcmfmac: Add wowl support for SDIO devices.
   brcmfmac: Add wowl patterns support.
   brcmfmac: (clean) Remove usb_rdl.h as it is not needed.
   brcmfmac: (clean) Remove packet filter configuration.
   brcmfmac: (clean) Move tracepoint related function.
   brcmfmac: (clean) Rename files dhd_dbg to debug
   brcmfmac: (clean) Rename dhd_bus.h in bus.h
   brcmfmac: (clean) Rename dhd_common.c in common.c
   brcmfmac: (clean) Rename files wl_cfg80211 to cfg80211
   brcmfmac: (clean) Rename sdio related files.
   brcmfmac: (clean) Rename sdio related files.
   brcmfmac: (clean) Move sdio related function.


Does "(clean) " add anything to these commit subjects?


I think Hante added that to easily track renames in the git log.

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed when conected to 5GHz

2014-10-29 Thread Amitkumar Karwar
Hi Marek,

We have one fix in Rx reorder logic and have handled dev_alloc_skb failure by 
resubmitting the urbs.
Could you please test attached experimental patches?

>[   76.769662] usb 1-1: Received between 2 BAR:2918
>[   76.775047] usb 1-1: Networking send size:2914
>[   77.067491] usb 1-1: rx_pending:10155
>[   77.177524] usb 1-1: rx_pending kernel:10383
>According log it seems rx_pending is slowly increasing until allocation
>fails. Code hacks are attached.

I am checking your hacks. The reason for huge rx_pending count is we might have 
missed to decrement the count at some place. The difference between " Received 
between 2 BAR" and "Networking send size" could be genuine leaks. We will look 
into this.

Regards,
Amit




0001-mwifiex-restart-rxreorder-timer-correctly.patch
Description: 0001-mwifiex-restart-rxreorder-timer-correctly.patch


0001-mwifiex-resubmit-Rx-data-URBS-when-dev_alloc_skb-fai.patch
Description: 0001-mwifiex-resubmit-Rx-data-URBS-when-dev_alloc_skb-fai.patch


Re: MediaTek WiFi hardware support in upstream kernel

2014-10-29 Thread Felix Fietkau
Hi Hackers,

Just a quick heads up:
I'm working on a new driver for MT7662E/MT7612E, written from scratch.
It is already able to bring up the firmware, init the MAC and do basic
TX/RX DMA communication with the firmware.
I've decided to not integrate it with rt2x00, because I want to avoid
dealing with the the unnecessarily convoluted abstractions and legacy
code in there. I believe the result will be simpler and easier to
maintain as a new driver.
As soon as the basic structure is in place, I will put it on a public
git tree and post a link here.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211_hwsim: release driver when ieee80211_register_hw fails

2014-10-29 Thread Junjie Mao
I was not familiar with the acquiring/releasing API either, until I met
with this bug...

Perhaps we can use static checkers to avoid these issues as early as
possible. Any suggestions?

Best Regards
Junjie Mao

Martin Pitt  writes:

> Acked-By: Martin Pitt 
>
> Hello Junjie,
>
> Junjie Mao [2014-10-28  9:31 +0800]:
>> The driver is not released when ieee80211_register_hw fails in
>> mac80211_hwsim_create_radio, leading to the access to the unregistered (and
>> possibly freed) device in platform_driver_unregister:
>
> Many thanks for fixing this! Sorry about that, I don't know these bits
> very well.
>
> Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed when conected to 5GHz

2014-10-29 Thread Belisko Marek
Hi Amitkumar,

On Wed, Oct 29, 2014 at 10:54 AM, Amitkumar Karwar  wrote:
> Hi Marek,
>
> We have one fix in Rx reorder logic and have handled dev_alloc_skb failure by 
> resubmitting the urbs.
> Could you please test attached experimental patches?
I tested both patches and I can still reproduce issue. With
0001-mwifiex-resubmit-Rx-data-URBS-when-dev_alloc_skb-fai.patch
I get kernel crash when allocation fails happens:
[  118.904307] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  118.911431] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  118.918328] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  118.925204] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  118.932291] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  118.939403] usb 1-1: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed
[  120.171372] [ cut here ]
[  120.176288] WARNING: at drivers/usb/core/urb.c:327 usb_submit_urb+0x35/0x4c()
[  120.183776] URB ce411840 submitted while active
[  120.188528] Modules linked in: mwifiex_usb mwifiex btusb
beo_hh1_misc(O) beo_hh1_lsl(O) beo_hh1_summit(O) beo_hh1_tunnel(O)
beo_hh1_rtc(O) beo_hh1_power(O) beo_hh1_dsp(O) beo_hh1_fwupdate(O)
beo_hh1_input(O) beo_hh1_leds(O) beo_hh1_fep(O) beo_ase_fephw(O)
beo_ase_dsp(]
[  120.217461] [] (unwind_backtrace+0x1/0x98) from
[] (warn_slowpath_common+0x33/0x4c)
[  120.227332] [] (warn_slowpath_common+0x33/0x4c) from
[] (warn_slowpath_fmt+0x1d/0x28)
[  120.237386] [] (warn_slowpath_fmt+0x1d/0x28) from
[] (usb_submit_urb+0x35/0x4c)
[  120.246907] [] (usb_submit_urb+0x35/0x4c) from
[] (mwifiex_usb_submit_rx_urb+0x72/0x10c [mwifiex_usb])
[  120.258592] [] (mwifiex_usb_submit_rx_urb+0x72/0x10c
[mwifiex_usb]) from [] (mwifiex_usb_rx_complete+0xe0/0x2b0
[mwifiex_usb])
[  120.272388] [] (mwifiex_usb_rx_complete+0xe0/0x2b0
[mwifiex_usb]) from [] (usb_hcd_giveback_urb+0x29/0x74)
[  120.284360] [] (usb_hcd_giveback_urb+0x29/0x74) from
[] (musb_giveback+0x23/0x2c)
[  120.294051] [] (musb_giveback+0x23/0x2c) from
[] (musb_advance_schedule+0x35/0x16c)
[  120.303922] [] (musb_advance_schedule+0x35/0x16c) from
[] (musb_interrupt+0x61/0x5e0)
[  120.313974] [] (musb_interrupt+0x61/0x5e0) from
[] (dsps_interrupt+0x17d/0x234)
[  120.323492] [] (dsps_interrupt+0x17d/0x234) from
[] (handle_irq_event_percpu+0x33/0x11c)
[  120.333819] [] (handle_irq_event_percpu+0x33/0x11c) from
[] (handle_irq_event+0x29/0x3c)
[  120.344144] [] (handle_irq_event+0x29/0x3c) from
[] (handle_level_irq+0x4f/0x88)
[  120.353738] [] (handle_level_irq+0x4f/0x88) from
[] (generic_handle_irq+0x13/0x1c)
[  120.363525] [] (generic_handle_irq+0x13/0x1c) from
[] (handle_IRQ+0x1d/0x54)
[  120.372758] [] (handle_IRQ+0x1d/0x54) from []
(omap3_intc_handle_irq+0x5d/0x68)
[  120.382262] [] (omap3_intc_handle_irq+0x5d/0x68) from
[] (__irq_svc+0x3f/0x64)
[  120.391666] Exception stack(0xce569d68 to 0xce569db0)
[  120.396977] 9d60:   0001 ce122f98 
0001 a013 cf31e010
[  120.405567] 9d80: a013  cf00e480 ce015b04 ce411ac0
0020 ce122b40 ce569db0
[  120.414151] 9da0: c0050b97 c037e914 4033 
[  120.419473] [] (__irq_svc+0x3f/0x64) from []
(_raw_spin_unlock_irqrestore+0x24/0x30)
[  120.429435] [] (_raw_spin_unlock_irqrestore+0x24/0x30)
from [] (musb_urb_enqueue+0x4d/0x3b8)
[  120.440128] [] (musb_urb_enqueue+0x4d/0x3b8) from
[] (usb_hcd_submit_urb+0x6f/0x57c)
[  120.450094] [] (usb_hcd_submit_urb+0x6f/0x57c) from
[] (mwifiex_usb_submit_rx_urb+0x72/0x10c [mwifiex_usb])
[  120.462229] [] (mwifiex_usb_submit_rx_urb+0x72/0x10c
[mwifiex_usb]) from [] (mwifiex_main_process+0x2a2/0x3ac
[mwifiex])
[  120.475507] [] (mwifiex_main_process+0x2a2/0x3ac
[mwifiex]) from [] (mwifiex_main_work_queue+0xe/0x10
[mwifiex])
[  120.488049] [] (mwifiex_main_work_queue+0xe/0x10
[mwifiex]) from [] (process_one_work+0x117/0x2b4)
[  120.499289] [] (process_one_work+0x117/0x2b4) from
[] (worker_thread+0xd9/0x280)
[  120.508893] [] (worker_thread+0xd9/0x280) from
[] (kthread+0x6b/0x74)
[  120.517487] [] (kthread+0x6b/0x74) from []
(ret_from_fork+0x11/0x3c)
[  120.525978] ---[ end trace 67ca4bd7a80b7c08 ]---
[  120.530838] usb 1-1: usb_submit_urb failed

>
>>[   76.769662] usb 1-1: Received between 2 BAR:2918
>>[   76.775047] usb 1-1: Networking send size:2914
>>[   77.067491] usb 1-1: rx_pending:10155
>>[   77.177524] usb 1-1: rx_pending kernel:10383
>>According log it seems rx_pending is slowly increasing until allocation
>>fails. Code hacks are attached.
>
> I am checking your hacks. The reason for huge rx_pending count is we might 
> have missed to decrement the count at some place. The difference between " 
> Received between 2 BAR" and "Networking send size" could be genuine leaks. We 
> will look into this.
Thanks.
>
> Regards,
> Amit
>
>

BR,

marek

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08

Re: [PATCH] wireless: rt2x00: add new rt2800usb device

2014-10-29 Thread Stanislaw Gruszka
On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> 
> References: https://bugs.debian.org/766802
> Reported-by: Martin Mokrejs 

Was this patch tested by reporter? I would rather see Reported-and-tested-by 
tag :-)

Stanislaw
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Channel Estimation Question

2014-10-29 Thread jeremy lansman

Emmanul;

Thank you for that.

I am a newbe to changing things at this low a level, so before I take 
the time to learn something new, I decided to do a test.


 On the page it says, "When mac80211 wants to ensure that a frame is 
sent, it calls the flush() callback. Until now, iwldvm implemented this 
by waiting that all the frames are sent (ACKed or timeout). In case of 
weak signal, this can take a significant amount of time,..."


In this case the signal is not weak, and there is no co-channel or 
adjacent channel interference.   The only interference will be from 
multipath reflections.


I just ran a test to demonstrate.

Here is a signal sitting in one place as reported by nm-tool:
  Wireless Access Points (* = current AP)
  Busklandia:  Infra, D6:CA:6D:7A:BF:39, Freq 2447 MHz, Rate 54 
Mb/s, Strength 55 WPA2
  FishNet: Infra, D6:CA:6D:7A:BF:37, Freq 2447 MHz, Rate 54 
Mb/s, Strength 55
*Office-C-Band:  Infra, D4:CA:6D:C5:68:29, Freq 5260 MHz, Rate 6 Mb/s, 
Strength 44 WPA


Note I am using my Mikrotik 5 GHz AP, which is on the ouside wall of a 
building some 10 meters away.
Here is the ping to this AP with the laptop on the floor after it has 
been sitting for a while:

64 bytes from 192.168.66.1: icmp_seq=60 ttl=64 time=1.18 ms
64 bytes from 192.168.66.1: icmp_seq=61 ttl=64 time=1.16 ms
64 bytes from 192.168.66.1: icmp_seq=62 ttl=64 time=1.08 ms
64 bytes from 192.168.66.1: icmp_seq=63 ttl=64 time=1.15 ms
64 bytes from 192.168.66.1: icmp_seq=64 ttl=64 time=1.02 ms
64 bytes from 192.168.66.1: icmp_seq=65 ttl=64 time=1.10 ms
64 bytes from 192.168.66.1: icmp_seq=66 ttl=64 time=1.11 ms

Now I pick up the laptop and move it to a stronger signal.

64 bytes from 192.168.66.1: icmp_seq=259 ttl=64 time=1.09 ms
64 bytes from 192.168.66.1: icmp_seq=260 ttl=64 time=1.03 ms
64 bytes from 192.168.66.1: icmp_seq=261 ttl=64 time=0.986 ms
64 bytes from 192.168.66.1: icmp_seq=262 ttl=64 time=0.971 ms
64 bytes from 192.168.66.1: icmp_seq=263 ttl=64 time=1.02 ms
64 bytes from 192.168.66.1: icmp_seq=264 ttl=64 time=1.90 ms
64 bytes from 192.168.66.1: icmp_seq=265 ttl=64 time=1.02 ms
64 bytes from 192.168.66.1: icmp_seq=266 ttl=64 time=6038 ms
64 bytes from 192.168.66.1: icmp_seq=267 ttl=64 time=5032 ms
64 bytes from 192.168.66.1: icmp_seq=268 ttl=64 time=4024 ms
64 bytes from 192.168.66.1: icmp_seq=269 ttl=64 time=3016 ms
64 bytes from 192.168.66.1: icmp_seq=270 ttl=64 time=2008 ms
64 bytes from 192.168.66.1: icmp_seq=271 ttl=64 time=1000 ms
64 bytes from 192.168.66.1: icmp_seq=272 ttl=64 time=99.1 ms
64 bytes from 192.168.66.1: icmp_seq=273 ttl=64 time=4017 ms
64 bytes from 192.168.66.1: icmp_seq=274 ttl=64 time=3011 ms
64 bytes from 192.168.66.1: icmp_seq=275 ttl=64 time=2003 ms
64 bytes from 192.168.66.1: icmp_seq=276 ttl=64 time=995 ms
64 bytes from 192.168.66.1: icmp_seq=277 ttl=64 time=87.5 ms
64 bytes from 192.168.66.1: icmp_seq=278 ttl=64 time=1146 ms
64 bytes from 192.168.66.1: icmp_seq=279 ttl=64 time=139 ms
64 bytes from 192.168.66.1: icmp_seq=280 ttl=64 time=1148 ms
64 bytes from 192.168.66.1: icmp_seq=281 ttl=64 time=142 ms
64 bytes from 192.168.66.1: icmp_seq=282 ttl=64 time=5001 ms
64 bytes from 192.168.66.1: icmp_seq=283 ttl=64 time=4001 ms
64 bytes from 192.168.66.1: icmp_seq=284 ttl=64 time=3002 ms
64 bytes from 192.168.66.1: icmp_seq=285 ttl=64 time=2002 ms
64 bytes from 192.168.66.1: icmp_seq=286 ttl=64 time=1003 ms
64 bytes from 192.168.66.1: icmp_seq=287 ttl=64 time=5.03 ms
64 bytes from 192.168.66.1: icmp_seq=288 ttl=64 time=3018 ms
64 bytes from 192.168.66.1: icmp_seq=289 ttl=64 time=2011 ms
64 bytes from 192.168.66.1: icmp_seq=290 ttl=64 time=1003 ms
64 bytes from 192.168.66.1: icmp_seq=291 ttl=64 time=3.11 ms
64 bytes from 192.168.66.1: icmp_seq=292 ttl=64 time=1007 ms

nm-tool says this signal is much stronger and still says there are no 
other visible access points.


  Wireless Access Points (* = current AP)
FishNet: Infra, D6:CA:6D:7A:BF:37, Freq 2447 MHz, Rate 54 
Mb/s, Strength 75
Busklandia:  Infra, D6:CA:6D:7A:BF:39, Freq 2447 MHz, Rate 54 
Mb/s, Strength 54 WPA2
*Office-C-Band:  Infra, D4:CA:6D:C5:68:29, Freq 5260 MHz, Rate 6 
Mb/s, Strength 59 WPA2


A frequency scan on the Mikrotik  5 GHz both will show there is nothing 
to be seen.


Based upon my theory, it would be true that a lot of frames are not 
acknowledged due to "interference".  However, it would be multipath 
interference.  In 802.11x multipath should not be a problem unless the 
reflection is from a very distant object.


So, although application of your suggested cure SHOULD HELP, it would be 
correcting a symptom for something which is not caused by weak signal.


I would appreciate any comment you have on this, as I suspect you know a 
lot more than I.


Later today I will attempt to apply your suggested fix.

Thanks












On 25/10/2014 18:10, Emmanuel Grumbach wrote:

On Fri, Oct 24, 2014 at 10:05 PM, jeremy lansman
 wrote:

Hi.

I beg your pardon for asking a newbe ques

Re: [PATCH] wireless: rt2x00: add new rt2800usb device

2014-10-29 Thread Cyril Brulebois
Stanislaw Gruszka  (2014-10-29):
> On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> > 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> > 
> > References: https://bugs.debian.org/766802
> > Reported-by: Martin Mokrejs 
> 
> Was this patch tested by reporter? I would rather see Reported-and-tested-by 
> tag :-)

The reporter confirmed the following trick worked:

  # echo rt2800usb >> /etc/modules
  # echo 'install rt2800usb /sbin/modprobe --ignore-install rt2800usb 
$CMDLINE_OPTS && echo 1b75 a200 > /sys/bus/usb/drivers/rt2800usb/new_id' > 
/etc/modprobe.d/ralink.conf
  # modprobe -r rt2800usb ; modprobe rt2800usb

but I'll try and get this patch tested on top of 3.16.x (which is what
we have in Debian at the moment) if that's good enough for you.

Mraw,
KiBi.


signature.asc
Description: Digital signature


[PATCH] mwifiex: restart rxreorder timer correctly

2014-10-29 Thread Avinash Patil
From: Marc Yang 

During 11n RX reordering, if there is a hole in RX table,
driver will not send packets to kernel until the rxreorder
timer expires or the table is full.
However, currently driver always restarts rxreorder timer when
receiving a packet, which causes the timer hardly to expire.
So while connected with to 11n AP in a busy environment,
ping packets may get blocked for about 30 seconds.

This patch fixes this timer restarting by ensuring rxreorder timer
would only be restarted either timer is not set or start_win
has changed.

Signed-off-by: Chin-Ran Lo 
Signed-off-by: Plus Chen 
Signed-off-by: Marc Yang 
Signed-off-by: Cathy Luo 
Signed-off-by: Avinash Patil 
---
 drivers/net/wireless/mwifiex/11n_rxreorder.c | 52 +---
 drivers/net/wireless/mwifiex/11n_rxreorder.h |  2 ++
 drivers/net/wireless/mwifiex/main.h  |  1 +
 3 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c 
b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 4005707..5ef5a0e 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -196,6 +196,7 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv,
mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win);
 
del_timer_sync(&tbl->timer_context.timer);
+   tbl->timer_context.timer_is_set = false;
 
spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
list_del(&tbl->list);
@@ -297,6 +298,7 @@ mwifiex_flush_data(unsigned long context)
(struct reorder_tmr_cnxt *) context;
int start_win, seq_num;
 
+   ctx->timer_is_set = false;
seq_num = mwifiex_11n_find_last_seq_num(ctx);
 
if (seq_num < 0)
@@ -385,6 +387,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private 
*priv, u8 *ta,
 
new_node->timer_context.ptr = new_node;
new_node->timer_context.priv = priv;
+   new_node->timer_context.timer_is_set = false;
 
init_timer(&new_node->timer_context.timer);
new_node->timer_context.timer.function = mwifiex_flush_data;
@@ -399,6 +402,22 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private 
*priv, u8 *ta,
spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
 }
 
+static void
+mwifiex_11n_rxreorder_timer_restart(struct mwifiex_rx_reorder_tbl *tbl)
+{
+   u32 min_flush_time;
+
+   if (tbl->win_size >= MWIFIEX_BA_WIN_SIZE_32)
+   min_flush_time = MIN_FLUSH_TIMER_15_MS;
+   else
+   min_flush_time = MIN_FLUSH_TIMER_MS;
+
+   mod_timer(&tbl->timer_context.timer,
+ jiffies + msecs_to_jiffies(min_flush_time * tbl->win_size));
+
+   tbl->timer_context.timer_is_set = true;
+}
+
 /*
  * This function prepares command for adding a BA request.
  *
@@ -523,31 +542,31 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private 
*priv,
u8 *ta, u8 pkt_type, void *payload)
 {
struct mwifiex_rx_reorder_tbl *tbl;
-   int start_win, end_win, win_size;
+   int prev_start_win, start_win, end_win, win_size;
u16 pkt_index;
bool init_window_shift = false;
+   int ret = 0;
 
tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta);
if (!tbl) {
if (pkt_type != PKT_TYPE_BAR)
mwifiex_11n_dispatch_pkt(priv, payload);
-   return 0;
+   return ret;
}
 
if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) {
mwifiex_11n_dispatch_pkt(priv, payload);
-   return 0;
+   return ret;
}
 
start_win = tbl->start_win;
+   prev_start_win = start_win;
win_size = tbl->win_size;
end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1);
if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) {
init_window_shift = true;
tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT;
}
-   mod_timer(&tbl->timer_context.timer,
- jiffies + msecs_to_jiffies(MIN_FLUSH_TIMER_MS * win_size));
 
if (tbl->flags & RXREOR_FORCE_NO_DROP) {
dev_dbg(priv->adapter->dev,
@@ -568,11 +587,14 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private 
*priv,
if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) {
if (seq_num >= ((start_win + TWOPOW11) &
(MAX_TID_VALUE - 1)) &&
-   seq_num < start_win)
-   return -1;
+   seq_num < start_win) {
+   ret = -1;
+   goto done;
+   }
} else if ((seq_num < start_win) ||
-  (seq_num > (start_win + TWOPOW11))) {
-   return -1;
+  (seq_num >= (start_win + TWOPOW11))) {
+  

pull request: iwlwifi-next 2014-10-29

2014-10-29 Thread Emmanuel Grumbach
Hi John,

Here is a pull request for 3.19. More details below.

Thanks!

The following changes since commit 35a9ad8af0bb0fa3525e6d0d20e32551d226f38e:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
(2014-10-08 21:40:54 -0400)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git
tags/iwlwifi-next-for-john-2014-10-29

for you to fetch changes up to d9e4d61c5b900f6938b4aa49f25a0db37aeb23b6:

  iwlwifi: mvm: unref SCAN ref on scan completion (2014-10-29 13:14:41 +0200)


The big new thing here is netdetect which allows the
firmware to wake up the platform when a specific network
is detected. Along with that I have fixes for d3 operation.
The usual amount of rate scaling stuff - we now support STBC.
The other commit that stands out is Johannes's work on
devcoredump. He basically starts to use the standard
infrastructure he built.


Arik Nemtsov (1):
  iwlwifi: mvm: remove mvm argument from get_queues_mask

David Spinadel (1):
  iwlwifi: mvm: fix scan condition iterator

Eliad Peller (1):
  iwlwifi: mvm: unref SCAN ref on scan completion

Emmanuel Grumbach (12):
  iwlwifi: configure the LTR
  iwlwifi: mvm: BT Coex - update the MPLUT Boost register value
  iwlwifi: mvm: BT coex - fix BT prio for probe requests
  iwlwifi: dvm: drop non VO frames when flushing
  Revert "iwlwifi: mvm: treat EAPOLs like mgmt frames wrt rate"
  iwlwifi: pcie: fix polling in various places
  Merge remote-tracking branch 'iwlwifi-fixes/master' into iwlwifi-next
  iwlwifi: mvm: remove unneeded NULL pointer check
  iwlwifi: pcie: warn if extern fw_debug buffer failed
  iwlwifi: pcie: fix recovery from ARC reset in WoWLAN
  iwlwifi: mvm: BT Coex - move BT_ANTENNA_COUPLING_THRESHOLD to constants
  iwlwifi: mvm: BT Coex - make the multiprio lut a constant

Eran Harary (1):
  iwlwifi: always run the secured flow for family 8000

Eyal Shapira (3):
  iwlwifi: rs: option to easily disable Tx MIMO
  iwlwifi: enable STBC support for 8000 chips
  iwlwifi: mvm: rs: add Tx STBC support

Gregory Greenman (1):
  iwlwifi: allow to restrict Tx aggregation size per-device

Haim Dreyfuss (1):
  iwlwifi: mvm: Add tx power condition to bss_info_changed_ap_ibss

Joe Perches (1):
  iwlwifi: dvm: Fix probable mask then right shift defect

Johannes Berg (3):
  iwlwifi: mvm: improve MCS rate warning
  iwlwifi: mvm: flush queues without mutex held
  iwlwifi: mvm: port to devcoredump framework

Liad Kaufman (1):
  iwlwifi: 8000: fix string given to MODULE_FIRMWARE

Luciano Coelho (7):
  iwlwifi: mvm: hold the rtnl when resuming from a d3 test
  iwlwifi: mvm: split wowlan handling out of the main suspend function
  iwlwifi: mvm: move the check if associated outside of the
iterator for wowlan
  iwlwifi: mvm: spin off a function to start scan offload
  iwlwifi: mvm: add debugfs entry to configure netdetect SSIDs
  iwlwifi: mvm: change the iwl_mvm_d3_iface_iterator into a generic function
  iwlwifi: mvm: remove unnecessary includes in tt.c

Matti Gottlieb (1):
  iwlwifi: mvm: ROC - bug fixes around time events and locking

Max Stepanov (1):
  iwlwifi: mvm: add MVM_FW_BCAST_FILTER_PASS_ALL option

 drivers/net/wireless/iwlwifi/Kconfig|   1 +
 drivers/net/wireless/iwlwifi/dvm/lib.c  |   4 +-
 drivers/net/wireless/iwlwifi/dvm/mac80211.c |  24 
 drivers/net/wireless/iwlwifi/iwl-8000.c |   4 +-
 drivers/net/wireless/iwlwifi/iwl-config.h   |  12 
 drivers/net/wireless/iwlwifi/iwl-drv.c  |   3 -
 drivers/net/wireless/iwlwifi/iwl-fw.h   |   1 -
 drivers/net/wireless/iwlwifi/iwl-trans.h|   6 +-
 drivers/net/wireless/iwlwifi/mvm/coex.c |  13 +
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c  |  14 ++---
 drivers/net/wireless/iwlwifi/mvm/constants.h|   5 ++
 drivers/net/wireless/iwlwifi/mvm/d3.c   | 318
-
 drivers/net/wireless/iwlwifi/mvm/debugfs.c  | 201
+++-
 drivers/net/wireless/iwlwifi/mvm/fw-api-power.h |  35 +++-
 drivers/net/wireless/iwlwifi/mvm/fw-api.h   |   1 +
 drivers/net/wireless/iwlwifi/mvm/fw.c   |   9 +++
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c |   5 +-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 132
--
 drivers/net/wireless/iwlwifi/mvm/mvm.h  |  14 -
 drivers/net/wireless/iwlwifi/mvm/ops.c  |  16 --
 drivers/net/wireless/iwlwifi/mvm/rs.c   |  80
++
 drivers/net/wireless/iwlwifi/mvm/rs.h   |   2 +
 drivers/net/wireless/iwlwif

[PATCH 06/25] iwlwifi: mvm: spin off a function to start scan offload

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

The net-detect feature will require a scan offload to be started in
the same way it is done now for scheduled scan.  Spin a new function
off of the sched_scan_start op code for reuse.  Additionally,
restructure the function a bit for more readability.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 20 ++--
 drivers/net/wireless/iwlwifi/mvm/mvm.h  |  4 
 drivers/net/wireless/iwlwifi/mvm/scan.c | 25 +
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 585fe5b..b17877c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2170,25 +2170,9 @@ static int iwl_mvm_mac_sched_scan_start(struct 
ieee80211_hw *hw,
 
mvm->scan_status = IWL_MVM_SCAN_SCHED;
 
-   if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)) {
-   ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
-   if (ret)
-   goto err;
-   }
-
-   ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+   ret = iwl_mvm_scan_offload_start(mvm, vif, req, ies);
if (ret)
-   goto err;
-
-   if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)
-   ret = iwl_mvm_unified_sched_scan_lmac(mvm, vif, req, ies);
-   else
-   ret = iwl_mvm_sched_scan_start(mvm, req);
-
-   if (!ret)
-   goto out;
-err:
-   mvm->scan_status = IWL_MVM_SCAN_NONE;
+   mvm->scan_status = IWL_MVM_SCAN_NONE;
 out:
mutex_unlock(&mvm->mutex);
return ret;
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index b153ced..14ec678 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -949,6 +949,10 @@ int iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
   struct cfg80211_sched_scan_request *req);
 int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
 struct cfg80211_sched_scan_request *req);
+int iwl_mvm_scan_offload_start(struct iwl_mvm *mvm,
+  struct ieee80211_vif *vif,
+  struct cfg80211_sched_scan_request *req,
+  struct ieee80211_scan_ies *ies);
 int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify);
 int iwl_mvm_rx_scan_offload_results(struct iwl_mvm *mvm,
struct iwl_rx_cmd_buffer *rxb,
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c 
b/drivers/net/wireless/iwlwifi/mvm/scan.c
index b280d5d..64c02a2 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -1007,6 +1007,31 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
sizeof(scan_req), &scan_req);
 }
 
+int iwl_mvm_scan_offload_start(struct iwl_mvm *mvm,
+  struct ieee80211_vif *vif,
+  struct cfg80211_sched_scan_request *req,
+  struct ieee80211_scan_ies *ies)
+{
+   int ret;
+
+   if ((mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)) {
+   ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+   if (ret)
+   return ret;
+   ret = iwl_mvm_unified_sched_scan_lmac(mvm, vif, req, ies);
+   } else {
+   ret = iwl_mvm_config_sched_scan(mvm, vif, req, ies);
+   if (ret)
+   return ret;
+   ret = iwl_mvm_config_sched_scan_profiles(mvm, req);
+   if (ret)
+   return ret;
+   ret = iwl_mvm_sched_scan_start(mvm, req);
+   }
+
+   return ret;
+}
+
 static int iwl_mvm_send_scan_offload_abort(struct iwl_mvm *mvm)
 {
int ret;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/25] iwlwifi: mvm: remove unneeded NULL pointer check

2014-10-29 Thread Emmanuel Grumbach
From: Emmanuel Grumbach 

mac80211 will never call rate_control_tx_status with a NULL
pointer for sta. Remove the superfluous check. This check
misled smatch.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/rs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 0d836fe..66e971a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -1225,7 +1225,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp);
 done:
/* See if there's a better rate or modulation mode to try. */
-   if (sta && sta->supp_rates[info->band])
+   if (sta->supp_rates[info->band])
rs_rate_scale_perform(mvm, sta, lq_sta, tid);
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/25] iwlwifi: mvm: move the check if associated outside of the iterator for wowlan

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

Instead of checking if we are associated when suspending with wowlan
enabled in the interface iterator, allow it to return an unassociated
vif and move the check to the main suspend function.  This will be
needed by netdetect, since it should also work when we are not
associated but the vif is active.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 48 ++-
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/iwlwifi/mvm/d3.c
index b8e8a97..7a66a09 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -611,14 +611,10 @@ static void iwl_mvm_d3_iface_iterator(void *_data, u8 
*mac,
  struct ieee80211_vif *vif)
 {
struct iwl_d3_iter_data *data = _data;
-   struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
return;
 
-   if (mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)
-   return;
-
if (data->vif) {
IWL_ERR(data->mvm, "More than one managed interface active!\n");
data->error = true;
@@ -1029,7 +1025,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 
mutex_lock(&mvm->mutex);
 
-   /* see if there's only a single BSS vif and it's associated */
+   /* see if there's only a single BSS vif */
ieee80211_iterate_active_interfaces_atomic(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_d3_iface_iterator, &suspend_iter_data);
@@ -1042,27 +1038,33 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
vif = suspend_iter_data.vif;
mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
-   ap_sta = rcu_dereference_protected(
-   mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
-   lockdep_is_held(&mvm->mutex));
-   if (IS_ERR_OR_NULL(ap_sta)) {
-   ret = -EINVAL;
-   goto out_noreset;
-   }
+   /* if we're associated, this is wowlan */
+   if (mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) {
+   ap_sta = rcu_dereference_protected(
+   mvm->fw_id_to_mac_id[mvmvif->ap_sta_id],
+   lockdep_is_held(&mvm->mutex));
+   if (IS_ERR_OR_NULL(ap_sta)) {
+   ret = -EINVAL;
+   goto out_noreset;
+   }
 
-   ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, vif,
-   mvmvif, ap_sta);
-   if (ret)
-   goto out_noreset;
+   ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
+   vif, mvmvif, ap_sta);
+   if (ret)
+   goto out_noreset;
 
-   ret = iwl_mvm_switch_to_d3(mvm);
-   if (ret)
-   goto out;
+   ret = iwl_mvm_switch_to_d3(mvm);
+   if (ret)
+   goto out;
 
-   ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
-   vif, mvmvif, ap_sta);
-   if (ret)
-   goto out;
+   ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
+   vif, mvmvif, ap_sta);
+   if (ret)
+   goto out;
+   } else {
+   ret = 1;
+   goto out_noreset;
+   }
 
ret = iwl_mvm_power_update_device(mvm);
if (ret)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/25] iwlwifi: mvm: hold the rtnl when resuming from a d3 test

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

We use ieee80211_iter_keys() which requires the rtnl to be held.  If
we don't lock the rtnl, like we do when we suspend during a d3 test,
we get the following splat:

 RTNL: assertion failed at net/mac80211/key.c (566)
 CPU: 1 PID: 26529 Comm: cat Tainted: GW  O 3.10.29-dev #1
 Hardware name: Dell Inc. Latitude E6430/0CPWYR, BIOS A09 12/13/2012
  e7b15008 e7b15008 e68adc1c c168aa62 e68adc54 f91f20b6 f923700c f9236fd8
  0236  ece23874  f94941e0  e43b8e48 e7b15008
   e8b69e78 e68adcc0 f9493ab9 e68adc68  e43b8e48 e7b15008
 Call Trace:
  [] dump_stack+0x16/0x18
  [] ieee80211_iter_keys+0x166/0x170 [mac80211]
  [] ? iwl_mvm_query_wakeup_reasons+0x5f0/0x5f0 [iwlmvm]
  [] iwl_mvm_setup_connection_keep.isra.5+0x99/0x1d0 [iwlmvm]
  [] ? cfg80211_report_wowlan_wakeup+0x308/0x510 [cfg80211]
  [] iwl_mvm_query_wakeup_reasons+0x3f5/0x5f0 [iwlmvm]
  [] ? init_object+0x3a/0x70
  [] ? iwl_trans_pcie_d3_resume+0x1be/0x3a0 [iwlwifi]
  [] __iwl_mvm_resume+0x14a/0x180 [iwlmvm]
  [] iwl_mvm_d3_test_release+0x26/0xc0 [iwlmvm]
  [] __fput+0xad/0x210
  [] fput+0xd/0x10
  [] task_work_run+0x81/0xb0
  [] do_exit+0x255/0xac0
  [] ? dequeue_signal+0x31/0x1a0
  [] do_group_exit+0x38/0xa0
  [] ? trace_hardirqs_on+0xb/0x10
  [] get_signal_to_deliver+0x1e1/0x8e0
  [] ? try_to_del_timer_sync+0x42/0x60
  [] ? try_to_del_timer_sync+0x60/0x60
  [] ? schedule_timeout+0x102/0x2a0
  [] do_signal+0x3a/0x8e0
  [] ? __internal_add_timer+0xb0/0xb0
  [] ? schedule_timeout_interruptible+0x1a/0x20
  [] ? msleep_interruptible+0x39/0x40
  [] ? iwl_mvm_d3_test_read+0x49/0x70 [iwlmvm]
  [] ? vfs_read+0x8c/0x160
  [] ? SyS_fadvise64_64+0x15f/0x2b0
  [] ? iwl_mvm_wowlan_program_keys+0x4a0/0x4a0 [iwlmvm]
  [] ? SyS_read+0x57/0xa0
  [] do_notify_resume+0x6f/0xa0
  [] work_notifysig+0x29/0x31

Fix this by hold the rtnl lock when calling __iwl_mvm_resume() in the
d3 test wake up path.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/iwlwifi/mvm/d3.c
index c17be0f..5b26922 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -1741,7 +1741,9 @@ static int iwl_mvm_d3_test_release(struct inode *inode, 
struct file *file)
int remaining_time = 10;
 
mvm->d3_test_active = false;
+   rtnl_lock();
__iwl_mvm_resume(mvm, true);
+   rtnl_unlock();
iwl_abort_notification_waits(&mvm->notif_wait);
ieee80211_restart_hw(mvm->hw);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/25] iwlwifi: rs: option to easily disable Tx MIMO

2014-10-29 Thread Emmanuel Grumbach
From: Eyal Shapira 

The current TLC isn't optimized for low latency and some devices
have issues with MIMO. This kind of combo creates latency issues.
Allow to temporarily disable MIMO for tests in order to solve
the latency issues without the added complexity of MIMO.

Signed-off-by: Eyal Shapira 
Signed-off-by: Arik Nemtsov 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/constants.h | 1 +
 drivers/net/wireless/iwlwifi/mvm/rs.c| 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h 
b/drivers/net/wireless/iwlwifi/mvm/constants.h
index d4dfbe4..dfec5b5 100644
--- a/drivers/net/wireless/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/iwlwifi/mvm/constants.h
@@ -95,5 +95,6 @@
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL   0
 #define IWL_MVM_QUOTA_THRESHOLD8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE 0
+#define IWL_MVM_RS_DISABLE_MIMO0
 
 #endif /* __MVM_CONSTANTS_H */
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 18a5399..0d836fe 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -2684,6 +2684,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
lq_sta->ldpc = true;
}
 
+   if (IWL_MVM_RS_DISABLE_MIMO)
+   lq_sta->active_mimo2_rate = 0;
+
lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate,
BITS_PER_LONG);
lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/25] iwlwifi: mvm: split wowlan handling out of the main suspend function

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

Take the WoWLAN handling code out of the main suspend function,
dividing it into three parts: get_config (which is used before the
firmware is switched), switch_to_d3 (which handles the rebooting of
the hardware with the D3 firmware) and config (which configures the D3
firmware for WoWLAN operation).  This is necessary to prepare for the
net-detect implementation, which will use only the switch_to_d3 part
of this flow.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/d3.c | 266 +++---
 1 file changed, 151 insertions(+), 115 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 5b26922..b8e8a97 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -783,6 +783,35 @@ void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, 
struct ieee80211_vif *vif)
IWL_ERR(mvm, "failed to set non-QoS seqno\n");
 }
 
+static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm)
+{
+   iwl_mvm_cancel_scan(mvm);
+
+   iwl_trans_stop_device(mvm->trans);
+
+   /*
+* Set the HW restart bit -- this is mostly true as we're
+* going to load new firmware and reprogram that, though
+* the reprogramming is going to be manual to avoid adding
+* all the MACs that aren't support.
+* We don't have to clear up everything though because the
+* reprogramming is manual. When we resume, we'll actually
+* go through a proper restart sequence again to switch
+* back to the runtime firmware image.
+*/
+   set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
+
+   /* We reprogram keys and shouldn't allocate new key indices */
+   memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table));
+
+   mvm->ptk_ivlen = 0;
+   mvm->ptk_icvlen = 0;
+   mvm->ptk_ivlen = 0;
+   mvm->ptk_icvlen = 0;
+
+   return iwl_mvm_load_d3_fw(mvm);
+}
+
 static int
 iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm,
   const struct iwl_wowlan_config_cmd_v3 *cmd)
@@ -797,116 +826,52 @@ iwl_mvm_send_wowlan_config_cmd(struct iwl_mvm *mvm,
cmd_len, cmd);
 }
 
-static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
-struct cfg80211_wowlan *wowlan,
-bool test)
+static int
+iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm,
+ struct cfg80211_wowlan *wowlan,
+ struct iwl_wowlan_config_cmd_v3 *wowlan_config_cmd,
+ struct ieee80211_vif *vif, struct iwl_mvm_vif *mvmvif,
+ struct ieee80211_sta *ap_sta)
 {
-   struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-   struct iwl_d3_iter_data suspend_iter_data = {
-   .mvm = mvm,
-   };
-   struct ieee80211_vif *vif;
-   struct iwl_mvm_vif *mvmvif;
-   struct ieee80211_sta *ap_sta;
-   struct iwl_mvm_sta *mvm_ap_sta;
-   struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {};
-   struct iwl_wowlan_kek_kck_material_cmd kek_kck_cmd = {};
-   struct iwl_wowlan_tkip_params_cmd tkip_cmd = {};
-   struct iwl_d3_manager_config d3_cfg_cmd_data = {
-   /*
-* Program the minimum sleep time to 10 seconds, as many
-* platforms have issues processing a wakeup signal while
-* still being in the process of suspending.
-*/
-   .min_sleep_time = cpu_to_le32(10 * 1000 * 1000),
-   };
-   struct iwl_host_cmd d3_cfg_cmd = {
-   .id = D3_CONFIG_CMD,
-   .flags = CMD_WANT_SKB,
-   .data[0] = &d3_cfg_cmd_data,
-   .len[0] = sizeof(d3_cfg_cmd_data),
-   };
-   struct wowlan_key_data key_data = {
-   .use_rsc_tsc = false,
-   .tkip = &tkip_cmd,
-   .use_tkip = false,
-   };
int ret;
-   int len __maybe_unused;
-
-   if (!wowlan) {
-   /*
-* mac80211 shouldn't get here, but for D3 test
-* it doesn't warrant a warning
-*/
-   WARN_ON(!test);
-   return -EINVAL;
-   }
-
-   key_data.rsc_tsc = kzalloc(sizeof(*key_data.rsc_tsc), GFP_KERNEL);
-   if (!key_data.rsc_tsc)
-   return -ENOMEM;
-
-   mutex_lock(&mvm->mutex);
-
-   /* see if there's only a single BSS vif and it's associated */
-   ieee80211_iterate_active_interfaces_atomic(
-   mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-   iwl_mvm_d3_iface_iterator, &suspend_iter_data);
+   struct iwl_mvm_sta *mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv;
 
-   if (suspend_iter_data.error || !suspend_iter_data.vif) {
-   ret = 1;
-   goto out_noreset;
-   }
-
-

[PATCH 20/25] iwlwifi: dvm: Fix probable mask then right shift defect

2014-10-29 Thread Emmanuel Grumbach
From: Joe Perches 

Precedence of & and >> is not the same and is not left to right.
shift has higher precedence and should be done after the mask.

Add parentheses around the mask.

Signed-off-by: Joe Perches 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/dvm/lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c 
b/drivers/net/wireless/iwlwifi/dvm/lib.c
index 2191621..02e4ede 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -418,8 +418,8 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, 
bool rssi_ena)
 
 static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg)
 {
-   return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >>
-   BT_UART_MSG_FRAME3SCOESCO_POS;
+   return (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >>
+   BT_UART_MSG_FRAME3SCOESCO_POS;
 }
 
 static void iwlagn_bt_traffic_change_work(struct work_struct *work)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/25] iwlwifi: mvm: remove unnecessary includes in tt.c

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

We used to need to include some headers in order to read the registers
and do all the calculations by ourselves, but this is not done anymore
(i.e. we let the firmware do this for us), so we don't need to include
those headers anymore.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/tt.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/iwlwifi/mvm/tt.c
index acca44a..d4f2c29 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tt.c
@@ -64,10 +64,6 @@
  */
 
 #include "mvm.h"
-#include "iwl-config.h"
-#include "iwl-io.h"
-#include "iwl-csr.h"
-#include "iwl-prph.h"
 
 #define IWL_MVM_TEMP_NOTIF_WAIT_TIMEOUTHZ
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/25] iwlwifi: enable STBC support for 8000 chips

2014-10-29 Thread Emmanuel Grumbach
From: Eyal Shapira 

These chips support STBC in both Tx and Rx.
Given that we've added STBC Tx support enable it.

Signed-off-by: Eyal Shapira 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/iwl-8000.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c 
b/drivers/net/wireless/iwlwifi/iwl-8000.c
index d2b7234..896ea90 100644
--- a/drivers/net/wireless/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-8000.c
@@ -104,6 +104,7 @@ static const struct iwl_base_params iwl8000_base_params = {
 };
 
 static const struct iwl_ht_params iwl8000_ht_params = {
+   .stbc = true,
.ldpc = true,
.ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ),
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/25] iwlwifi: always run the secured flow for family 8000

2014-10-29 Thread Emmanuel Grumbach
From: Eran Harary 

In the new format the "CSS section" has the same TLV type
as the "mem section". So we need to run the secured flow
for all the 8000 products.

Signed-off-by: Eran Harary 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/iwl-config.h | 10 ++
 drivers/net/wireless/iwlwifi/iwl-drv.c|  3 ---
 drivers/net/wireless/iwlwifi/iwl-fw.h |  1 -
 drivers/net/wireless/iwlwifi/pcie/trans.c | 10 --
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h 
b/drivers/net/wireless/iwlwifi/iwl-config.h
index 76d363d..f8aa9cf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/iwlwifi/iwl-config.h
@@ -87,6 +87,16 @@ enum iwl_device_family {
IWL_DEVICE_FAMILY_8000,
 };
 
+static inline bool iwl_has_secure_boot(u32 hw_rev,
+  enum iwl_device_family family)
+{
+   /* return 1 only for family 8000 B0 */
+   if ((family == IWL_DEVICE_FAMILY_8000) && (hw_rev & 0xC))
+   return 1;
+
+   return 0;
+}
+
 /*
  * LED mode
  *IWL_LED_DEFAULT:  use device default
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 0f1084f..d9fa8e0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -807,19 +807,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR,
tlv_len);
drv->fw.mvm_fw = true;
-   drv->fw.img[IWL_UCODE_REGULAR].is_secure = true;
break;
case IWL_UCODE_TLV_SECURE_SEC_INIT:
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT,
tlv_len);
drv->fw.mvm_fw = true;
-   drv->fw.img[IWL_UCODE_INIT].is_secure = true;
break;
case IWL_UCODE_TLV_SECURE_SEC_WOWLAN:
iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN,
tlv_len);
drv->fw.mvm_fw = true;
-   drv->fw.img[IWL_UCODE_WOWLAN].is_secure = true;
break;
case IWL_UCODE_TLV_NUM_OF_CPU:
if (tlv_len != sizeof(u32))
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h 
b/drivers/net/wireless/iwlwifi/iwl-fw.h
index 4f6e668..6f7ae5f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fw.h
@@ -227,7 +227,6 @@ struct fw_desc {
 
 struct fw_img {
struct fw_desc sec[IWL_UCODE_SECTION_MAX];
-   bool is_secure;
bool is_dual_cpus;
 };
 
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index aea0fe9..8027138 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -747,14 +747,11 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans 
*trans,
int first_ucode_section;
 
IWL_DEBUG_FW(trans,
-"working with %s image\n",
-image->is_secure ? "Secured" : "Non Secured");
-   IWL_DEBUG_FW(trans,
 "working with %s CPU\n",
 image->is_dual_cpus ? "Dual" : "Single");
 
/* configure the ucode to be ready to get the secured image */
-   if (image->is_secure) {
+   if (iwl_has_secure_boot(trans->hw_rev, trans->cfg->device_family)) {
/* set secure boot inspector addresses */
iwl_write_prph(trans,
   LMPM_SECURE_INSPECTOR_CODE_ADDR,
@@ -790,7 +787,8 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans 
*trans,
   LMPM_SECURE_CPU2_HDR_MEM_SPACE);
 
/* load to FW the binary sections of CPU2 */
-   if (image->is_secure)
+   if (iwl_has_secure_boot(trans->hw_rev,
+   trans->cfg->device_family))
ret = iwl_pcie_load_cpu_secured_sections(
trans, image, 2,
&first_ucode_section);
@@ -821,7 +819,7 @@ static int iwl_pcie_load_given_ucode(struct iwl_trans 
*trans,
else
iwl_write32(trans, CSR_RESET, 0);
 
-   if (image->is_secure) {
+   if (iwl_has_secure_boot(trans->hw_rev, trans->cfg->device_family)) {
/* wait for image verification to complete  */
ret = iwl_poll_prph_bit(trans,
LMPM_SECURE_BOOT_CPU1_STATUS_ADDR,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to maj

[PATCH 14/25] iwlwifi: mvm: add MVM_FW_BCAST_FILTER_PASS_ALL option

2014-10-29 Thread Emmanuel Grumbach
From: Max Stepanov 

The MVM_FW_BCAST_FILTER_PASS_ALL option defined in iwl-dbg-cfg.ini
configuration file allows to enable/disable FW broadcast filtering.

If MVM_FW_BCAST_FILTER_PASS_ALL is not defined in iwl-dbg-cfg.ini or
its value is 0, the mvm broadcast filtering is enabled.

Setting MVM_FW_BCAST_FILTER_PASS_ALL=1 in iwl-dbg-cfg.ini blocks sending
of BCAST_FILTER_CMD to FW.

Signed-off-by: Max Stepanov 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/constants.h | 3 ++-
 drivers/net/wireless/iwlwifi/mvm/mac80211.c  | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h 
b/drivers/net/wireless/iwlwifi/mvm/constants.h
index f288783..a2b473d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/iwlwifi/mvm/constants.h
@@ -92,10 +92,11 @@
 #define IWL_MVM_BT_COEX_SYNC2SCO   1
 #define IWL_MVM_BT_COEX_CORUNNING  0
 #define IWL_MVM_BT_COEX_MPLUT  1
+#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS  30
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL   0
+#define IWL_MVM_FW_BCAST_FILTER_PASS_ALL   0
 #define IWL_MVM_QUOTA_THRESHOLD8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE 0
 #define IWL_MVM_RS_DISABLE_MIMO0
-#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS  30
 
 #endif /* __MVM_CONSTANTS_H */
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index b17877c..9fc843e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -1382,6 +1382,9 @@ bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
.cmd = cmd,
};
 
+   if (IWL_MVM_FW_BCAST_FILTER_PASS_ALL)
+   return false;
+
memset(cmd, 0, sizeof(*cmd));
cmd->max_bcast_filters = ARRAY_SIZE(cmd->filters);
cmd->max_macs = ARRAY_SIZE(cmd->macs);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/25] iwlwifi: mvm: fix scan condition iterator

2014-10-29 Thread Emmanuel Grumbach
From: David Spinadel 

Scan condition iterator assumes that an interface is associated if
phy_ctxt is assigned, but this isn't the sutuation in P2P device.
OTOH P2P device is never associated so we can simply ignore it.

Signed-off-by: David Spinadel 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c 
b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 64c02a2..042fcdc 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -270,7 +270,8 @@ static void iwl_mvm_scan_condition_iterator(void *data, u8 
*mac,
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
bool *global_bound = data;
 
-   if (mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < MAX_PHYS)
+   if (vif->type != NL80211_IFTYPE_P2P_DEVICE && mvmvif->phy_ctxt &&
+   mvmvif->phy_ctxt->id < MAX_PHYS)
*global_bound = true;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/25] iwlwifi: mvm: port to devcoredump framework

2014-10-29 Thread Emmanuel Grumbach
From: Johannes Berg 

iwlwifi features a debug mechanism that allows to dump
binary data which is helpful to debug the firmware.
Until now, this data was made available for the userspace
through debugfs. For this exact purpose, devcoredump was
created. Move to the new infrastructure.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/Kconfig|  1 +
 drivers/net/wireless/iwlwifi/iwl-trans.h|  4 --
 drivers/net/wireless/iwlwifi/mvm/debugfs.c  | 79 -
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 57 +
 drivers/net/wireless/iwlwifi/mvm/mvm.h  |  1 -
 drivers/net/wireless/iwlwifi/mvm/ops.c  |  5 --
 drivers/net/wireless/iwlwifi/pcie/trans.c   |  2 -
 7 files changed, 48 insertions(+), 101 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/Kconfig 
b/drivers/net/wireless/iwlwifi/Kconfig
index 267e48a..139de90 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -59,6 +59,7 @@ config IWLDVM
 
 config IWLMVM
tristate "Intel Wireless WiFi MVM Firmware support"
+   select BACKPORT_WANT_DEV_COREDUMP
help
  This is the driver that supports the MVM firmware which is
  currently only available for 7260 and 3160 devices.
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/iwlwifi/iwl-trans.h
index d8fc548..0768f83e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -535,9 +535,7 @@ struct iwl_trans_ops {
void (*ref)(struct iwl_trans *trans);
void (*unref)(struct iwl_trans *trans);
 
-#ifdef CONFIG_IWLWIFI_DEBUGFS
struct iwl_trans_dump_data *(*dump_data)(struct iwl_trans *trans);
-#endif
 };
 
 /**
@@ -704,7 +702,6 @@ static inline void iwl_trans_unref(struct iwl_trans *trans)
trans->ops->unref(trans);
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUGFS
 static inline struct iwl_trans_dump_data *
 iwl_trans_dump_data(struct iwl_trans *trans)
 {
@@ -712,7 +709,6 @@ iwl_trans_dump_data(struct iwl_trans *trans)
return NULL;
return trans->ops->dump_data(trans);
 }
-#endif
 
 static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
 struct iwl_host_cmd *cmd)
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index 2a61bac..51b7116 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -121,78 +121,6 @@ static ssize_t iwl_dbgfs_sta_drain_write(struct iwl_mvm 
*mvm, char *buf,
return ret;
 }
 
-static int iwl_dbgfs_fw_error_dump_open(struct inode *inode, struct file *file)
-{
-   struct iwl_mvm *mvm = inode->i_private;
-   int ret;
-
-   if (!mvm)
-   return -EINVAL;
-
-   mutex_lock(&mvm->mutex);
-   if (!mvm->fw_error_dump) {
-   ret = -ENODATA;
-   goto out;
-   }
-
-   file->private_data = mvm->fw_error_dump;
-   mvm->fw_error_dump = NULL;
-   ret = 0;
-
-out:
-   mutex_unlock(&mvm->mutex);
-   return ret;
-}
-
-static ssize_t iwl_dbgfs_fw_error_dump_read(struct file *file,
-   char __user *user_buf,
-   size_t count, loff_t *ppos)
-{
-   struct iwl_mvm_dump_ptrs *dump_ptrs = (void *)file->private_data;
-   ssize_t bytes_read = 0;
-   ssize_t bytes_read_trans = 0;
-
-   if (*ppos < dump_ptrs->op_mode_len)
-   bytes_read +=
-   simple_read_from_buffer(user_buf, count, ppos,
-   dump_ptrs->op_mode_ptr,
-   dump_ptrs->op_mode_len);
-
-   if (bytes_read < 0 || *ppos < dump_ptrs->op_mode_len)
-   return bytes_read;
-
-   if (dump_ptrs->trans_ptr) {
-   *ppos -= dump_ptrs->op_mode_len;
-   bytes_read_trans =
-   simple_read_from_buffer(user_buf + bytes_read,
-   count - bytes_read, ppos,
-   dump_ptrs->trans_ptr->data,
-   dump_ptrs->trans_ptr->len);
-   *ppos += dump_ptrs->op_mode_len;
-
-   if (bytes_read_trans >= 0)
-   bytes_read += bytes_read_trans;
-   else if (!bytes_read)
-   /* propagate the failure */
-   return bytes_read_trans;
-   }
-
-   return bytes_read;
-
-}
-
-static int iwl_dbgfs_fw_error_dump_release(struct inode *inode,
-  struct file *file)
-{
-   struct iwl_mvm_dump_ptrs *dump_ptrs = (void *)file->private_data;
-
-   vfree(dump_ptrs->op_mode_ptr);
-   vfree(dump_ptrs->trans_ptr);
-   kfree(dump_ptrs

[PATCH 08/25] iwlwifi: mvm: change the iwl_mvm_d3_iface_iterator into a generic function

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

Getting the BSS station vif is something that may be needed by other
parts of the code.  So, instead of having an iterator specifically for
d3, change it into a generic one in utils.c.  Additionally, add a
iwl_mvm_get_bss_vif() function to make it easier to retrieving it.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/d3.c| 47 +++-
 drivers/net/wireless/iwlwifi/mvm/mvm.h   |  2 ++
 drivers/net/wireless/iwlwifi/mvm/utils.c | 37 +
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 0b3295e..3bbb511 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -601,29 +601,6 @@ static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm 
*mvm,
return ret;
 }
 
-struct iwl_d3_iter_data {
-   struct iwl_mvm *mvm;
-   struct ieee80211_vif *vif;
-   bool error;
-};
-
-static void iwl_mvm_d3_iface_iterator(void *_data, u8 *mac,
- struct ieee80211_vif *vif)
-{
-   struct iwl_d3_iter_data *data = _data;
-
-   if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
-   return;
-
-   if (data->vif) {
-   IWL_ERR(data->mvm, "More than one managed interface active!\n");
-   data->error = true;
-   return;
-   }
-
-   data->vif = vif;
-}
-
 static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_sta *ap_sta)
 {
@@ -990,9 +967,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 bool test)
 {
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-   struct iwl_d3_iter_data suspend_iter_data = {
-   .mvm = mvm,
-   };
struct ieee80211_vif *vif = NULL;
struct iwl_mvm_vif *mvmvif = NULL;
struct ieee80211_sta *ap_sta = NULL;
@@ -1025,17 +999,12 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
 
mutex_lock(&mvm->mutex);
 
-   /* see if there's only a single BSS vif */
-   ieee80211_iterate_active_interfaces_atomic(
-   mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-   iwl_mvm_d3_iface_iterator, &suspend_iter_data);
-
-   if (suspend_iter_data.error || !suspend_iter_data.vif) {
+   vif = iwl_mvm_get_bss_vif(mvm);
+   if (IS_ERR_OR_NULL(vif)) {
ret = 1;
goto out_noreset;
}
 
-   vif = suspend_iter_data.vif;
mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
/* if we're associated, this is wowlan */
@@ -1639,9 +1608,6 @@ static void iwl_mvm_d3_disconnect_iter(void *data, u8 
*mac,
 
 static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
 {
-   struct iwl_d3_iter_data resume_iter_data = {
-   .mvm = mvm,
-   };
struct ieee80211_vif *vif = NULL;
int ret;
enum iwl_d3_status d3_status;
@@ -1650,15 +1616,10 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool 
test)
mutex_lock(&mvm->mutex);
 
/* get the BSS vif pointer again */
-   ieee80211_iterate_active_interfaces_atomic(
-   mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
-   iwl_mvm_d3_iface_iterator, &resume_iter_data);
-
-   if (WARN_ON(resume_iter_data.error || !resume_iter_data.vif))
+   vif = iwl_mvm_get_bss_vif(mvm);
+   if (IS_ERR_OR_NULL(vif))
goto out_unlock;
 
-   vif = resume_iter_data.vif;
-
ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test);
if (ret)
goto out_unlock;
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 60aee62..aec9f57 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -1214,6 +1214,8 @@ void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, 
struct ieee80211_vif *vif,
 void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
   struct ieee80211_vif *vif);
 
+struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
+
 void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm);
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c 
b/drivers/net/wireless/iwlwifi/mvm/utils.c
index 8021f6e..e56e77e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
@@ -734,3 +734,40 @@ bool iwl_mvm_is_idle(struct iwl_mvm *mvm)
 
return idle;
 }
+
+struct iwl_bss_iter_data {
+   struct ieee80211_vif *vif;
+   bool error;
+};
+
+static void iwl_mvm_bss_iface_iterator(void *_data, u8 *mac,
+  struct ieee80211_vif *vif)
+{
+   struct iwl_bss_iter_data *d

[PATCH 13/25] iwlwifi: mvm: BT Coex - move BT_ANTENNA_COUPLING_THRESHOLD to constants

2014-10-29 Thread Emmanuel Grumbach
From: Emmanuel Grumbach 

This is were it really needs to be.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/coex.c| 4 +---
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | 5 ++---
 drivers/net/wireless/iwlwifi/mvm/constants.h   | 1 +
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c 
b/drivers/net/wireless/iwlwifi/mvm/coex.c
index da2ffb7..515f9cb 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -72,8 +72,6 @@
 #include "mvm.h"
 #include "iwl-debug.h"
 
-#define BT_ANTENNA_COUPLING_THRESHOLD  (30)
-
 const u32 iwl_bt_ctl_kill_msk[BT_KILL_MSK_MAX] = {
[BT_KILL_MSK_DEFAULT] = 0xfc00,
[BT_KILL_MSK_NEVER] = 0x,
@@ -605,7 +603,7 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
 
bt_cmd->max_kill = cpu_to_le32(5);
bt_cmd->bt4_antenna_isolation_thr =
-   cpu_to_le32(BT_ANTENNA_COUPLING_THRESHOLD);
+   cpu_to_le32(IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS);
bt_cmd->bt4_tx_tx_delta_freq_thr = cpu_to_le32(15);
bt_cmd->bt4_tx_rx_max_freq0 = cpu_to_le32(15);
bt_cmd->override_primary_lut = cpu_to_le32(BT_COEX_INVALID_LUT);
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c 
b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
index 8a1d2f3..3f3b8ee 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
@@ -102,8 +102,6 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = 
{
 
 #undef EVENT_PRIO_ANT
 
-#define BT_ANTENNA_COUPLING_THRESHOLD  (30)
-
 static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm)
 {
if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
@@ -593,7 +591,8 @@ int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm)
}
 
bt_cmd->max_kill = 5;
-   bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD;
+   bt_cmd->bt4_antenna_isolation_thr =
+   IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS;
bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling;
bt_cmd->bt4_tx_tx_delta_freq_thr = 15;
bt_cmd->bt4_tx_rx_max_freq0 = 15;
diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h 
b/drivers/net/wireless/iwlwifi/mvm/constants.h
index dfec5b5..f288783 100644
--- a/drivers/net/wireless/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/iwlwifi/mvm/constants.h
@@ -96,5 +96,6 @@
 #define IWL_MVM_QUOTA_THRESHOLD8
 #define IWL_MVM_RS_RSSI_BASED_INIT_RATE 0
 #define IWL_MVM_RS_DISABLE_MIMO0
+#define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS  30
 
 #endif /* __MVM_CONSTANTS_H */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/25] iwlwifi: mvm: add debugfs entry to configure netdetect SSIDs

2014-10-29 Thread Emmanuel Grumbach
From: Luciano Coelho 

Before we get all the chain (ie. mac80211, cfg80211, nl80211 and
userspace) changed to support net-detect, we can use this debugfs
entry for easy testing and as a proof of concept.

Signed-off-by: Luciano Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/d3.c  |   9 +++
 drivers/net/wireless/iwlwifi/mvm/debugfs.c | 122 +
 drivers/net/wireless/iwlwifi/mvm/mvm.h |   4 +
 drivers/net/wireless/iwlwifi/mvm/ops.c |   7 ++
 4 files changed, 142 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 7a66a09..0b3295e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -1061,6 +1061,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
vif, mvmvif, ap_sta);
if (ret)
goto out;
+   } else if (mvm->nd_config) {
+   ret = iwl_mvm_switch_to_d3(mvm);
+   if (ret)
+   goto out;
+
+   ret = iwl_mvm_scan_offload_start(mvm, vif, mvm->nd_config,
+mvm->nd_ies);
+   if (ret)
+   goto out;
} else {
ret = 1;
goto out_noreset;
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index 50527a9..2a61bac 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -1250,6 +1250,126 @@ static ssize_t iwl_dbgfs_d3_sram_read(struct file 
*file, char __user *user_buf,
 
return ret;
 }
+
+#define MAX_NUM_ND_MATCHSETS 10
+
+static ssize_t iwl_dbgfs_netdetect_write(struct iwl_mvm *mvm, char *buf,
+size_t count, loff_t *ppos)
+{
+   const char *seps = ",\n";
+   char *buf_ptr = buf;
+   char *value_str = NULL;
+   int ret, i;
+
+   /* TODO: don't free if write is being called several times in one go */
+   if (mvm->nd_config) {
+   kfree(mvm->nd_config->match_sets);
+   kfree(mvm->nd_config);
+   mvm->nd_config = NULL;
+   kfree(mvm->nd_ies);
+   mvm->nd_ies = NULL;
+   }
+
+   mvm->nd_ies = kzalloc(sizeof(*mvm->nd_ies), GFP_KERNEL);
+   if (!mvm->nd_ies)
+   return -ENOMEM;
+
+   mvm->nd_config = kzalloc(sizeof(*mvm->nd_config) +
+(11 * sizeof(struct ieee80211_channel *)),
+GFP_KERNEL);
+   if (!mvm->nd_config) {
+   ret = -ENOMEM;
+   goto out_free;
+   }
+
+   mvm->nd_config->n_channels = 11;
+   mvm->nd_config->scan_width = NL80211_BSS_CHAN_WIDTH_20;
+   mvm->nd_config->interval = 5;
+   mvm->nd_config->min_rssi_thold = -80;
+   for (i = 0; i < mvm->nd_config->n_channels; i++)
+   mvm->nd_config->channels[i] = &mvm->nvm_data->channels[i];
+
+   mvm->nd_config->match_sets =
+   kcalloc(MAX_NUM_ND_MATCHSETS,
+   sizeof(*mvm->nd_config->match_sets),
+   GFP_KERNEL);
+   if (!mvm->nd_config->match_sets) {
+   ret = -ENOMEM;
+   goto out_free;
+   }
+
+   while ((value_str = strsep(&buf_ptr, seps)) &&
+  strlen(value_str)) {
+   struct cfg80211_match_set *set;
+
+   if (mvm->nd_config->n_match_sets >= MAX_NUM_ND_MATCHSETS) {
+   ret = -EINVAL;
+   goto out_free;
+   }
+
+   set = &mvm->nd_config->match_sets[mvm->nd_config->n_match_sets];
+   set->ssid.ssid_len = strlen(value_str);
+
+   if (set->ssid.ssid_len > IEEE80211_MAX_SSID_LEN) {
+   ret = -EINVAL;
+   goto out_free;
+   }
+
+   memcpy(set->ssid.ssid, value_str, set->ssid.ssid_len);
+
+   mvm->nd_config->n_match_sets++;
+   }
+
+   ret = count;
+
+   if (mvm->nd_config->n_match_sets)
+   goto out;
+
+out_free:
+   if (mvm->nd_config)
+   kfree(mvm->nd_config->match_sets);
+   kfree(mvm->nd_config);
+   mvm->nd_config = NULL;
+   kfree(mvm->nd_ies);
+   mvm->nd_ies = NULL;
+out:
+   return ret;
+}
+
+static ssize_t
+iwl_dbgfs_netdetect_read(struct file *file, char __user *user_buf,
+size_t count, loff_t *ppos)
+{
+   struct iwl_mvm *mvm = file->private_data;
+   size_t bufsz, ret;
+   char *buf;
+   int i, n_match_sets, pos = 0;
+
+   n_match_sets = mvm->nd_config ? mvm->nd_config->n_match_sets : 0;
+
+   bufsz = n_match_sets * (IEEE80211_MAX_SSID_LEN + 1) + 1;
+   buf = kzalloc(bufsz, GFP_KERNEL);
+   if (!buf)
+   return -ENOMEM;
+
+  

[PATCH 11/25] iwlwifi: pcie: fix recovery from ARC reset in WoWLAN

2014-10-29 Thread Emmanuel Grumbach
From: Emmanuel Grumbach 

When the ARC is reset when we exit from Sx in case we had
WoWLAN running, we can't access the prph before we reset
the NIC.

Reviewed-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 5c9064f..aea0fe9 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1023,14 +1023,6 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans 
*trans,
return 0;
}
 
-   iwl_pcie_set_pwr(trans, false);
-
-   val = iwl_read32(trans, CSR_RESET);
-   if (val & CSR_RESET_REG_FLAG_NEVO_RESET) {
-   *status = IWL_D3_STATUS_RESET;
-   return 0;
-   }
-
/*
 * Also enables interrupts - none will happen as the device doesn't
 * know we're waking it up, only when the opmode actually tells it
@@ -1050,6 +1042,8 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans 
*trans,
return ret;
}
 
+   iwl_pcie_set_pwr(trans, false);
+
iwl_trans_pcie_tx_reset(trans);
 
ret = iwl_pcie_rx_init(trans);
@@ -1058,7 +1052,12 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans 
*trans,
return ret;
}
 
-   *status = IWL_D3_STATUS_ALIVE;
+   val = iwl_read32(trans, CSR_RESET);
+   if (val & CSR_RESET_REG_FLAG_NEVO_RESET)
+   *status = IWL_D3_STATUS_RESET;
+   else
+   *status = IWL_D3_STATUS_ALIVE;
+
return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/25] iwlwifi: mvm: BT Coex - make the multiprio lut a constant

2014-10-29 Thread Emmanuel Grumbach
From: Emmanuel Grumbach 

This makes it easier to tune the values during the testing.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/coex.c| 9 ++---
 drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | 9 ++---
 drivers/net/wireless/iwlwifi/mvm/constants.h   | 2 ++
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c 
b/drivers/net/wireless/iwlwifi/mvm/coex.c
index 515f9cb..508c813 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -300,11 +300,6 @@ static const __le64 iwl_ci_mask[][3] = {
},
 };
 
-static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
-   cpu_to_le32(0x2e402280),
-   cpu_to_le32(0x7711a751),
-};
-
 struct corunning_block_luts {
u8 range;
__le32 lut20[BT_COEX_CORUN_LUT_SIZE];
@@ -636,8 +631,8 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
 
memcpy(&bt_cmd->mplut_prio_boost, iwl_bt_prio_boost,
   sizeof(iwl_bt_prio_boost));
-   memcpy(&bt_cmd->multiprio_lut, iwl_bt_mprio_lut,
-  sizeof(iwl_bt_mprio_lut));
+   bt_cmd->multiprio_lut[0] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG0);
+   bt_cmd->multiprio_lut[1] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG1);
 
 send_cmd:
memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif));
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c 
b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
index 3f3b8ee..b571e1b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c
@@ -288,11 +288,6 @@ static const __le64 iwl_ci_mask[][3] = {
},
 };
 
-static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
-   cpu_to_le32(0x2e402280),
-   cpu_to_le32(0x7711a751),
-};
-
 struct corunning_block_luts {
u8 range;
__le32 lut20[BT_COEX_CORUN_LUT_SIZE];
@@ -648,8 +643,8 @@ int iwl_send_bt_init_conf_old(struct iwl_mvm *mvm)
 
memcpy(&bt_cmd->bt_prio_boost, iwl_bt_prio_boost,
   sizeof(iwl_bt_prio_boost));
-   memcpy(&bt_cmd->bt4_multiprio_lut, iwl_bt_mprio_lut,
-  sizeof(iwl_bt_mprio_lut));
+   bt_cmd->bt4_multiprio_lut[0] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG0);
+   bt_cmd->bt4_multiprio_lut[1] = cpu_to_le32(IWL_MVM_BT_COEX_MPLUT_REG1);
 
 send_cmd:
memset(&mvm->last_bt_notif_old, 0, sizeof(mvm->last_bt_notif_old));
diff --git a/drivers/net/wireless/iwlwifi/mvm/constants.h 
b/drivers/net/wireless/iwlwifi/mvm/constants.h
index a2b473d..5c1ea80 100644
--- a/drivers/net/wireless/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/iwlwifi/mvm/constants.h
@@ -92,6 +92,8 @@
 #define IWL_MVM_BT_COEX_SYNC2SCO   1
 #define IWL_MVM_BT_COEX_CORUNNING  0
 #define IWL_MVM_BT_COEX_MPLUT  1
+#define IWL_MVM_BT_COEX_MPLUT_REG0 0x2e402280
+#define IWL_MVM_BT_COEX_MPLUT_REG1 0x7711a751
 #define IWL_MVM_BT_COEX_ANTENNA_COUPLING_THRS  30
 #define IWL_MVM_FW_MCAST_FILTER_PASS_ALL   0
 #define IWL_MVM_FW_BCAST_FILTER_PASS_ALL   0
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/25] iwlwifi: mvm: unref SCAN ref on scan completion

2014-10-29 Thread Emmanuel Grumbach
From: Eliad Peller 

The scan reference wasn't released in case of offloaded scan,
causing the refcount to go wrong and prevent the device
from going into d0i3.

Signed-off-by: Eliad Peller 
Reviewed-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/scan.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c 
b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 042fcdc..5cd59a4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -673,6 +673,7 @@ int iwl_mvm_rx_scan_offload_complete_notif(struct iwl_mvm 
*mvm,
mvm->scan_status = IWL_MVM_SCAN_NONE;
ieee80211_scan_completed(mvm->hw,
 status == IWL_SCAN_OFFLOAD_ABORTED);
+   iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
}
 
mvm->last_ebs_successful = !ebs_status;
@@ -1107,8 +1108,12 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool 
notify)
/*
 * Clear the scan status so the next scan requests will succeed. This
 * also ensures the Rx handler doesn't do anything, as the scan was
-* stopped from above.
+* stopped from above. Since the rx handler won't do anything now,
+* we have to release the scan reference here.
 */
+   if (mvm->scan_status == IWL_MVM_SCAN_OS)
+   iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
+
mvm->scan_status = IWL_MVM_SCAN_NONE;
 
if (notify) {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/25] iwlwifi: pcie: warn if extern fw_debug buffer failed

2014-10-29 Thread Emmanuel Grumbach
From: Emmanuel Grumbach 

Otherwise we have no way to know that the buffer hasn't been
allocated.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 3781b02..5c9064f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -133,7 +133,7 @@ static void iwl_pcie_alloc_fw_monitor(struct iwl_trans 
*trans)
break;
}
 
-   if (!page)
+   if (WARN_ON_ONCE(!page))
return;
 
trans_pcie->fw_mon_page = page;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/25] iwlwifi: mvm: flush queues without mutex held

2014-10-29 Thread Emmanuel Grumbach
From: Johannes Berg 

For WMM-AC we may have to be changing QoS parameters while the
queues are being flushed. This is not relevant in the "drop"
case, but matters when we wait for the device to finish the
transmissions.

To allow this, do the actual waiting without holding the mutex.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index c087bf6..14be108 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2997,18 +2997,24 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
mvmvif = iwl_mvm_vif_from_mac80211(vif);
mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);
 
-   if (WARN_ON_ONCE(!mvmsta))
-   goto done;
+   if (WARN_ON_ONCE(!mvmsta)) {
+   mutex_unlock(&mvm->mutex);
+   return;
+   }
 
if (drop) {
if (iwl_mvm_flush_tx_path(mvm, mvmsta->tfd_queue_msk, true))
IWL_ERR(mvm, "flush request fail\n");
+   mutex_unlock(&mvm->mutex);
} else {
-   iwl_trans_wait_tx_queue_empty(mvm->trans,
- mvmsta->tfd_queue_msk);
+   u32 tfd_queue_msk = mvmsta->tfd_queue_msk;
+   mutex_unlock(&mvm->mutex);
+
+   /* this can take a while, and we may need/want other operations
+* to succeed while doing this, so do it without the mutex held
+*/
+   iwl_trans_wait_tx_queue_empty(mvm->trans, tfd_queue_msk);
}
-done:
-   mutex_unlock(&mvm->mutex);
 }
 
 const struct ieee80211_ops iwl_mvm_hw_ops = {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/25] iwlwifi: allow to restrict Tx aggregation size per-device

2014-10-29 Thread Emmanuel Grumbach
From: Gregory Greenman 

A few slave bus devices show better performance when we
reduce the size of the Tx A-MPDU.

Signed-off-by: Gregory Greenman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/iwl-config.h | 2 ++
 drivers/net/wireless/iwlwifi/mvm/ops.c| 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h 
b/drivers/net/wireless/iwlwifi/iwl-config.h
index 2ef83a3..76d363d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/iwlwifi/iwl-config.h
@@ -246,6 +246,7 @@ struct iwl_pwr_tx_backoff {
  * @nvm_hw_section_num: the ID of the HW NVM section
  * @pwr_tx_backoffs: translation table between power limits and backoffs
  * @max_rx_agg_size: max RX aggregation size of the ADDBA request/response
+ * @max_tx_agg_size: max TX aggregation size of the ADDBA request/response
  *
  * We enable the driver to be backward compatible wrt. hardware features.
  * API differences in uCode shouldn't be handled here but through TLVs
@@ -285,6 +286,7 @@ struct iwl_cfg {
const char *default_nvm_file;
unsigned int max_rx_agg_size;
bool disable_dummy_notification;
+   unsigned int max_tx_agg_size;
 };
 
 /*
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 047d83d..91b28e8 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -403,6 +403,9 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct 
iwl_cfg *cfg,
if (cfg->max_rx_agg_size)
hw->max_rx_aggregation_subframes = cfg->max_rx_agg_size;
 
+   if (cfg->max_tx_agg_size)
+   hw->max_tx_aggregation_subframes = cfg->max_tx_agg_size;
+
op_mode = hw->priv;
op_mode->ops = &iwl_mvm_ops;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/25] iwlwifi: mvm: improve MCS rate warning

2014-10-29 Thread Emmanuel Grumbach
From: Johannes Berg 

The warning gives no information about the frame, and presents
the flags so that one might think they're the frame. Clarify
and add more information.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index c6a517c..8d84873 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -189,8 +189,10 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
 
/* HT rate doesn't make sense for a non data frame */
WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
- "Got an HT rate for a non data frame 0x%x\n",
- info->control.rates[0].flags);
+ "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame 
(fc:0x%x)\n",
+ info->control.rates[0].flags,
+ info->control.rates[0].idx,
+ le16_to_cpu(fc));
 
rate_idx = info->control.rates[0].idx;
/* if the rate isn't a well known legacy rate, take the lowest one */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/25] iwlwifi: mvm: rs: add Tx STBC support

2014-10-29 Thread Emmanuel Grumbach
From: Eyal Shapira 

STBC is enabled on HT/VHT SISO rates in case we don't care
about power consumption and it won't hurt BT.
This is done only in case the peer and our chip support STBC
of course.
While at it fixed a bug which was causing bw and ldpc
flags to be set incorrectly in the rate scale table in case
we are switching to a legacy Tx column. This had no real impact.

Signed-off-by: Eyal Shapira 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/rs.c | 75 ++-
 drivers/net/wireless/iwlwifi/mvm/rs.h |  2 +
 2 files changed, 68 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 66e971a..ce88484 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -505,10 +505,11 @@ static const char *rs_pretty_lq_type(enum iwl_table_type 
type)
 static inline void rs_dump_rate(struct iwl_mvm *mvm, const struct rs_rate 
*rate,
const char *prefix)
 {
-   IWL_DEBUG_RATE(mvm, "%s: (%s: %d) ANT: %s BW: %d SGI: %d LDPC: %d\n",
+   IWL_DEBUG_RATE(mvm,
+  "%s: (%s: %d) ANT: %s BW: %d SGI: %d LDPC: %d STBC %d\n",
   prefix, rs_pretty_lq_type(rate->type),
   rate->index, rs_pretty_ant(rate->ant),
-  rate->bw, rate->sgi, rate->ldpc);
+  rate->bw, rate->sgi, rate->ldpc, rate->stbc);
 }
 
 static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window)
@@ -741,6 +742,12 @@ static u32 ucode_rate_from_rs_rate(struct iwl_mvm *mvm,
IWL_ERR(mvm, "Invalid rate->type %d\n", rate->type);
}
 
+   if (is_siso(rate) && rate->stbc) {
+   /* To enable STBC we need to set both a flag and ANT_AB */
+   ucode_rate |= RATE_MCS_ANT_AB_MSK;
+   ucode_rate |= RATE_MCS_VHT_STBC_MSK;
+   }
+
ucode_rate |= rate->bw;
if (rate->sgi)
ucode_rate |= RATE_MCS_SGI_MSK;
@@ -785,6 +792,8 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
rate->sgi = true;
if (ucode_rate & RATE_MCS_LDPC_MSK)
rate->ldpc = true;
+   if (ucode_rate & RATE_MCS_VHT_STBC_MSK)
+   rate->stbc = true;
 
rate->bw = ucode_rate & RATE_MCS_CHAN_WIDTH_MSK;
 
@@ -794,7 +803,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
 
if (nss == 1) {
rate->type = LQ_HT_SISO;
-   WARN_ON_ONCE(num_of_ant != 1);
+   WARN_ON_ONCE(!rate->stbc && num_of_ant != 1);
} else if (nss == 2) {
rate->type = LQ_HT_MIMO2;
WARN_ON_ONCE(num_of_ant != 2);
@@ -992,7 +1001,15 @@ static void rs_get_lower_rate_down_column(struct 
iwl_lq_sta *lq_sta,
 static inline bool rs_rate_match(struct rs_rate *a,
 struct rs_rate *b)
 {
-   return (a->type == b->type) && (a->ant == b->ant) && (a->sgi == b->sgi);
+   bool ant_match;
+
+   if (a->stbc)
+   ant_match = (b->ant == ANT_A || b->ant == ANT_B);
+   else
+   ant_match = (a->ant == b->ant);
+
+   return (a->type == b->type) && (a->bw == b->bw) && (a->sgi == b->sgi)
+   && ant_match;
 }
 
 static u32 rs_ch_width_from_mac_flags(enum mac80211_rate_control_flags flags)
@@ -1623,6 +1640,8 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
else
rate->type = LQ_LEGACY_G;
 
+   rate->bw = RATE_MCS_CHAN_WIDTH_20;
+   rate->ldpc = false;
rate_mask = lq_sta->active_legacy_rate;
} else if (column->mode == RS_SISO) {
rate->type = lq_sta->is_vht ? LQ_VHT_SISO : LQ_HT_SISO;
@@ -1634,8 +1653,11 @@ static int rs_switch_to_column(struct iwl_mvm *mvm,
WARN_ON_ONCE("Bad column mode");
}
 
-   rate->bw = rs_bw_from_sta_bw(sta);
-   rate->ldpc = lq_sta->ldpc;
+   if (column->mode != RS_LEGACY) {
+   rate->bw = rs_bw_from_sta_bw(sta);
+   rate->ldpc = lq_sta->ldpc;
+   }
+
search_tbl->column = col_id;
rs_set_expected_tpt_table(lq_sta, search_tbl);
 
@@ -1754,6 +1776,29 @@ out:
return action;
 }
 
+static bool rs_stbc_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
+ struct iwl_lq_sta *lq_sta)
+{
+   struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
+   struct ieee80211_vif *vif = mvmsta->vif;
+   bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION &&
+   !vif->bss_conf.ps);
+
+   /* Our chip supports Tx STBC and the peer is an HT/VHT STA which
+* supports STBC of at least 1*SS
+*/
+   if (!lq_sta->stbc)
+   return false;
+
+   if (!mvm->ps_disabled && !sta_

Re: [PATCH] wireless: rt2x00: add new rt2800usb device

2014-10-29 Thread Stanislaw Gruszka
On Wed, Oct 29, 2014 at 12:12:24PM +0100, Cyril Brulebois wrote:
> Stanislaw Gruszka  (2014-10-29):
> > On Tue, Oct 28, 2014 at 04:42:41PM +0100, Cyril Brulebois wrote:
> > > 0x1b75 0xa200 AirLive WN-200USB wireless 11b/g/n dongle
> > > 
> > > References: https://bugs.debian.org/766802
> > > Reported-by: Martin Mokrejs 
> > 
> > Was this patch tested by reporter? I would rather see 
> > Reported-and-tested-by tag :-)
> 
> The reporter confirmed the following trick worked:
> 
>   # echo rt2800usb >> /etc/modules
>   # echo 'install rt2800usb /sbin/modprobe --ignore-install rt2800usb 
> $CMDLINE_OPTS && echo 1b75 a200 > /sys/bus/usb/drivers/rt2800usb/new_id' > 
> /etc/modprobe.d/ralink.conf
>   # modprobe -r rt2800usb ; modprobe rt2800usb

Ok, that's fine .

Acked-by: Stanislaw Gruszka 

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Channel Estimation Question

2014-10-29 Thread Emmanuel Grumbach
On Wed, Oct 29, 2014 at 1:11 PM, jeremy lansman
 wrote:
> Emmanul;
>
> Thank you for that.
>
> I am a newbe to changing things at this low a level, so before I take the
> time to learn something new, I decided to do a test.
>
>  On the page it says, "When mac80211 wants to ensure that a frame is sent,
> it calls the flush() callback. Until now, iwldvm implemented this by waiting
> that all the frames are sent (ACKed or timeout). In case of weak signal,
> this can take a significant amount of time,..."
>
> In this case the signal is not weak, and there is no co-channel or adjacent
> channel interference.   The only interference will be from multipath
> reflections.
>

Well - honestly, this kind of things are really further down in the
firmware, and we have no easy-to-use tools to see what could cause
this kind of latency on this kind of device.
Note that when you move, the RSSI changes and that triggers scan which
induces latency.
But I can't really say much more than this.

> I just ran a test to demonstrate.
>
> Here is a signal sitting in one place as reported by nm-tool:
>   Wireless Access Points (* = current AP)
>   Busklandia:  Infra, D6:CA:6D:7A:BF:39, Freq 2447 MHz, Rate 54 Mb/s,
> Strength 55 WPA2
>   FishNet: Infra, D6:CA:6D:7A:BF:37, Freq 2447 MHz, Rate 54 Mb/s,
> Strength 55
> *Office-C-Band:  Infra, D4:CA:6D:C5:68:29, Freq 5260 MHz, Rate 6 Mb/s,
> Strength 44 WPA
>
> Note I am using my Mikrotik 5 GHz AP, which is on the ouside wall of a
> building some 10 meters away.
> Here is the ping to this AP with the laptop on the floor after it has been
> sitting for a while:
> 64 bytes from 192.168.66.1: icmp_seq=60 ttl=64 time=1.18 ms
> 64 bytes from 192.168.66.1: icmp_seq=61 ttl=64 time=1.16 ms
> 64 bytes from 192.168.66.1: icmp_seq=62 ttl=64 time=1.08 ms
> 64 bytes from 192.168.66.1: icmp_seq=63 ttl=64 time=1.15 ms
> 64 bytes from 192.168.66.1: icmp_seq=64 ttl=64 time=1.02 ms
> 64 bytes from 192.168.66.1: icmp_seq=65 ttl=64 time=1.10 ms
> 64 bytes from 192.168.66.1: icmp_seq=66 ttl=64 time=1.11 ms
>
> Now I pick up the laptop and move it to a stronger signal.
>
> 64 bytes from 192.168.66.1: icmp_seq=259 ttl=64 time=1.09 ms
> 64 bytes from 192.168.66.1: icmp_seq=260 ttl=64 time=1.03 ms
> 64 bytes from 192.168.66.1: icmp_seq=261 ttl=64 time=0.986 ms
> 64 bytes from 192.168.66.1: icmp_seq=262 ttl=64 time=0.971 ms
> 64 bytes from 192.168.66.1: icmp_seq=263 ttl=64 time=1.02 ms
> 64 bytes from 192.168.66.1: icmp_seq=264 ttl=64 time=1.90 ms
> 64 bytes from 192.168.66.1: icmp_seq=265 ttl=64 time=1.02 ms
> 64 bytes from 192.168.66.1: icmp_seq=266 ttl=64 time=6038 ms
> 64 bytes from 192.168.66.1: icmp_seq=267 ttl=64 time=5032 ms
> 64 bytes from 192.168.66.1: icmp_seq=268 ttl=64 time=4024 ms
> 64 bytes from 192.168.66.1: icmp_seq=269 ttl=64 time=3016 ms
> 64 bytes from 192.168.66.1: icmp_seq=270 ttl=64 time=2008 ms
> 64 bytes from 192.168.66.1: icmp_seq=271 ttl=64 time=1000 ms
> 64 bytes from 192.168.66.1: icmp_seq=272 ttl=64 time=99.1 ms
> 64 bytes from 192.168.66.1: icmp_seq=273 ttl=64 time=4017 ms
> 64 bytes from 192.168.66.1: icmp_seq=274 ttl=64 time=3011 ms
> 64 bytes from 192.168.66.1: icmp_seq=275 ttl=64 time=2003 ms
> 64 bytes from 192.168.66.1: icmp_seq=276 ttl=64 time=995 ms
> 64 bytes from 192.168.66.1: icmp_seq=277 ttl=64 time=87.5 ms
> 64 bytes from 192.168.66.1: icmp_seq=278 ttl=64 time=1146 ms
> 64 bytes from 192.168.66.1: icmp_seq=279 ttl=64 time=139 ms
> 64 bytes from 192.168.66.1: icmp_seq=280 ttl=64 time=1148 ms
> 64 bytes from 192.168.66.1: icmp_seq=281 ttl=64 time=142 ms
> 64 bytes from 192.168.66.1: icmp_seq=282 ttl=64 time=5001 ms
> 64 bytes from 192.168.66.1: icmp_seq=283 ttl=64 time=4001 ms
> 64 bytes from 192.168.66.1: icmp_seq=284 ttl=64 time=3002 ms
> 64 bytes from 192.168.66.1: icmp_seq=285 ttl=64 time=2002 ms
> 64 bytes from 192.168.66.1: icmp_seq=286 ttl=64 time=1003 ms
> 64 bytes from 192.168.66.1: icmp_seq=287 ttl=64 time=5.03 ms
> 64 bytes from 192.168.66.1: icmp_seq=288 ttl=64 time=3018 ms
> 64 bytes from 192.168.66.1: icmp_seq=289 ttl=64 time=2011 ms
> 64 bytes from 192.168.66.1: icmp_seq=290 ttl=64 time=1003 ms
> 64 bytes from 192.168.66.1: icmp_seq=291 ttl=64 time=3.11 ms
> 64 bytes from 192.168.66.1: icmp_seq=292 ttl=64 time=1007 ms
>
> nm-tool says this signal is much stronger and still says there are no other
> visible access points.
>
>   Wireless Access Points (* = current AP)
> FishNet: Infra, D6:CA:6D:7A:BF:37, Freq 2447 MHz, Rate 54 Mb/s,
> Strength 75
> Busklandia:  Infra, D6:CA:6D:7A:BF:39, Freq 2447 MHz, Rate 54 Mb/s,
> Strength 54 WPA2
> *Office-C-Band:  Infra, D4:CA:6D:C5:68:29, Freq 5260 MHz, Rate 6 Mb/s,
> Strength 59 WPA2
>
> A frequency scan on the Mikrotik  5 GHz both will show there is nothing to
> be seen.
>
> Based upon my theory, it would be true that a lot of frames are not
> acknowledged due to "interference".  However, it would be multipath
> interference.  In 802.11x multipath should not be a problem unless 

[PATCH 15/25] iwlwifi: mvm: remove mvm argument from get_queues_mask

2014-10-29 Thread Emmanuel Grumbach
From: Arik Nemtsov 

It is unused and won't be available in some future invocations of the
function.

Signed-off-by: Arik Nemtsov 
Reviewed-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | 5 ++---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c | 2 +-
 drivers/net/wireless/iwlwifi/mvm/mvm.h  | 3 +--
 drivers/net/wireless/iwlwifi/mvm/sta.c  | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c 
b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 0c5c0b0..b8ab4a1 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -197,8 +197,7 @@ static void iwl_mvm_mac_tsf_id_iter(void *_data, u8 *mac,
 /*
  * Get the mask of the queues used by the vif
  */
-u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
-   struct ieee80211_vif *vif)
+u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif)
 {
u32 qmask = 0, ac;
 
@@ -227,7 +226,7 @@ static void iwl_mvm_mac_iface_iterator(void *_data, u8 *mac,
}
 
/* Mark the queues used by the vif */
-   data->used_hw_queues |= iwl_mvm_mac_get_queues_mask(data->mvm, vif);
+   data->used_hw_queues |= iwl_mvm_mac_get_queues_mask(vif);
 
/* Mark MAC IDs as used by clearing the available bit, and
 * (below) mark TSFs as used if their existing use is not
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 9fc843e..c087bf6 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -1086,7 +1086,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw 
*hw,
 static void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
struct ieee80211_vif *vif)
 {
-   u32 tfd_msk = iwl_mvm_mac_get_queues_mask(mvm, vif);
+   u32 tfd_msk = iwl_mvm_mac_get_queues_mask(vif);
 
if (tfd_msk) {
mutex_lock(&mvm->mutex);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index aec9f57..d14dc06 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -909,8 +909,7 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 bool force_assoc_off, const u8 *bssid_override);
 int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
-u32 iwl_mvm_mac_get_queues_mask(struct iwl_mvm *mvm,
-   struct ieee80211_vif *vif);
+u32 iwl_mvm_mac_get_queues_mask(struct ieee80211_vif *vif);
 int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
struct ieee80211_vif *vif);
 int iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 1731c20..dd0dc5b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -609,7 +609,7 @@ int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif)
 
lockdep_assert_held(&mvm->mutex);
 
-   qmask = iwl_mvm_mac_get_queues_mask(mvm, vif);
+   qmask = iwl_mvm_mac_get_queues_mask(vif);
 
/*
 * The firmware defines the TFD queue mask to only be relevant
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211_hwsim: release driver when ieee80211_register_hw fails

2014-10-29 Thread Fengguang Wu
On Wed, Oct 29, 2014 at 06:23:02PM +0800, Junjie Mao wrote:
> I was not familiar with the acquiring/releasing API either, until I met
> with this bug...
> 
> Perhaps we can use static checkers to avoid these issues as early as
> possible. Any suggestions?

CC Dan. His smatch checker might be able (or could be enabled) to
handle the verification of missing device_release_driver() call.

Thanks,
Fengguang

> Martin Pitt  writes:
> 
> > Acked-By: Martin Pitt 
> >
> > Hello Junjie,
> >
> > Junjie Mao [2014-10-28  9:31 +0800]:
> >> The driver is not released when ieee80211_register_hw fails in
> >> mac80211_hwsim_create_radio, leading to the access to the unregistered (and
> >> possibly freed) device in platform_driver_unregister:
> >
> > Many thanks for fixing this! Sorry about that, I don't know these bits
> > very well.
> >
> > Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ath10k: handle ieee80211 header and payload tracing separately

2014-10-29 Thread Rajkumar Manoharan
For packet log, the transmitted frame 802.11 header alone is sufficient.
Recording entire packet is also consuming lot of disk space. To optimize
this, tx and rx data tracepoints are splitted into header and payload
tracepoints.

To record tx ieee80211 headers

 trace-cmd record -e ath10k_tx_hdr

To record complete packets

 trace-cmd record -e ath10k_tx_hdr -e ath10k_tx_payload

Cc: Michal Kazior 
Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |  5 +++--
 drivers/net/wireless/ath/ath10k/htt_tx.c |  4 +++-
 drivers/net/wireless/ath/ath10k/trace.h  |  9 +
 drivers/net/wireless/ath/ath10k/wmi.c| 15 ---
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index a691fdf..462f808 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -297,8 +297,6 @@ static inline struct sk_buff 
*ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt)
 DMA_FROM_DEVICE);
ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt rx netbuf pop: ",
msdu->data, msdu->len + skb_tailroom(msdu));
-   trace_ath10k_htt_rx_pop_msdu(ar, msdu->data, msdu->len +
-skb_tailroom(msdu));
 
return msdu;
 }
@@ -875,6 +873,7 @@ static void ath10k_process_rx(struct ath10k *ar,
struct ieee80211_rx_status *status;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
char tid[32];
+   u32 hdr_len = ieee80211_hdrlen(hdr->frame_control);
 
status = IEEE80211_SKB_RXCB(skb);
*status = *rx_status;
@@ -903,6 +902,8 @@ static void ath10k_process_rx(struct ath10k *ar,
   !!(status->flag & RX_FLAG_AMSDU_MORE));
ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "rx skb: ",
skb->data, skb->len);
+   trace_ath10k_rx_hdr(ar, hdr, hdr_len);
+   trace_ath10k_rx_payload(ar, skb->data + hdr_len, skb->len - hdr_len);
 
ieee80211_rx(ar->hw, skb);
 }
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index b0df470..b19d43b 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -455,6 +455,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
dma_addr_t paddr;
u32 frags_paddr;
bool use_frags;
+   u32 hdr_len = ieee80211_hdrlen(hdr->frame_control);
 
res = ath10k_htt_tx_inc_pending(htt);
if (res)
@@ -564,7 +565,8 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
   (u32)skb_cb->paddr, vdev_id, tid);
ath10k_dbg_dump(ar, ATH10K_DBG_HTT_DUMP, NULL, "htt tx msdu: ",
msdu->data, msdu->len);
-   trace_ath10k_htt_tx_msdu(ar, msdu->data, msdu->len);
+   trace_ath10k_tx_hdr(ar, hdr, hdr_len);
+   trace_ath10k_tx_payload(ar, msdu->data + hdr_len, msdu->len - hdr_len);
 
sg_items[0].transfer_id = 0;
sg_items[0].transfer_context = NULL;
diff --git a/drivers/net/wireless/ath/ath10k/trace.h 
b/drivers/net/wireless/ath/ath10k/trace.h
index b9a2ba6..fd9e6bc 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -368,22 +368,22 @@ DECLARE_EVENT_CLASS(ath10k_data_event,
)
 );
 
-DEFINE_EVENT(ath10k_data_event, ath10k_htt_tx_msdu,
+DEFINE_EVENT(ath10k_data_event, ath10k_tx_hdr,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
 
-DEFINE_EVENT(ath10k_data_event, ath10k_htt_rx_pop_msdu,
+DEFINE_EVENT(ath10k_data_event, ath10k_tx_payload,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
 
-DEFINE_EVENT(ath10k_data_event, ath10k_wmi_mgmt_tx,
+DEFINE_EVENT(ath10k_data_event, ath10k_rx_hdr,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
 
-DEFINE_EVENT(ath10k_data_event, ath10k_wmi_bcn_tx,
+DEFINE_EVENT(ath10k_data_event, ath10k_rx_payload,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
@@ -392,6 +392,7 @@ DEFINE_EVENT(ath10k_data_event, ath10k_htt_rx_desc,
 TP_PROTO(struct ath10k *ar, void *data, size_t len),
 TP_ARGS(ar, data, len)
 );
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index ae746ce..c241446 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -798,9 +798,11 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff 
*skb)
int len;
u32 buf_len = skb->len;
u16 fc;
+   u32 hdr_len;
 
hdr = (struct i

[PATCH 2/2] brcmsmac: expose 802.11 core statistics in debugfs

2014-10-29 Thread Arend van Spriel
The 802.11 statistics obtained from the device can be retrieved
dumping the 'macstat' file in debugfs folder.

Reviewed-by: Hante Meuleman 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmsmac/debug.c | 166 +++-
 1 file changed, 133 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.c 
b/drivers/net/wireless/brcm80211/brcmsmac/debug.c
index a5d4add..19740c1 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/debug.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.c
@@ -71,48 +71,148 @@ struct dentry *brcms_debugfs_get_devdir(struct brcms_pub 
*drvr)
 }
 
 static
-ssize_t brcms_debugfs_hardware_read(struct file *f, char __user *data,
-   size_t count, loff_t *ppos)
+int brcms_debugfs_hardware_read(struct seq_file *s, void *data)
 {
-   char buf[128];
-   int res;
-   struct brcms_pub *drvr = f->private_data;
-
-   /* only allow read from start */
-   if (*ppos > 0)
-   return 0;
-
-   res = scnprintf(buf, sizeof(buf),
-   "board vendor: %x\n"
-   "board type: %x\n"
-   "board revision: %x\n"
-   "board flags: %x\n"
-   "board flags2: %x\n"
-   "firmware revision: %x\n",
-   drvr->wlc->hw->d11core->bus->boardinfo.vendor,
-   drvr->wlc->hw->d11core->bus->boardinfo.type,
-   drvr->wlc->hw->boardrev,
-   drvr->wlc->hw->boardflags,
-   drvr->wlc->hw->boardflags2,
-   drvr->wlc->ucode_rev
-   );
-
-   return simple_read_from_buffer(data, count, ppos, buf, res);
+   struct brcms_pub *drvr = s->private;
+
+   seq_printf(s, "board vendor: %x\n"
+  "board type: %x\n"
+  "board revision: %x\n"
+  "board flags: %x\n"
+  "board flags2: %x\n"
+  "firmware revision: %x\n",
+  drvr->wlc->hw->d11core->bus->boardinfo.vendor,
+  drvr->wlc->hw->d11core->bus->boardinfo.type,
+  drvr->wlc->hw->boardrev,
+  drvr->wlc->hw->boardflags,
+  drvr->wlc->hw->boardflags2,
+  drvr->wlc->ucode_rev);
+
+   return 0;
+}
+
+static int brcms_debugfs_macstat_read(struct seq_file *s, void *data)
+{
+   struct brcms_pub *drvr = s->private;
+   struct brcms_info *wl = drvr->ieee_hw->priv;
+   struct macstat stats;
+   int i;
+
+   spin_lock_bh(&wl->lock);
+   stats = *(drvr->wlc->core->macstat_snapshot);
+   spin_unlock_bh(&wl->lock);
+
+   seq_printf(s, "txallfrm: %d\n", stats.txallfrm);
+   seq_printf(s, "txrtsfrm: %d\n", stats.txrtsfrm);
+   seq_printf(s, "txctsfrm: %d\n", stats.txctsfrm);
+   seq_printf(s, "txackfrm: %d\n", stats.txackfrm);
+   seq_printf(s, "txdnlfrm: %d\n", stats.txdnlfrm);
+   seq_printf(s, "txbcnfrm: %d\n", stats.txbcnfrm);
+   seq_printf(s, "txfunfl[8]:");
+   for (i = 0; i < ARRAY_SIZE(stats.txfunfl); i++)
+   seq_printf(s, " %d", stats.txfunfl[i]);
+   seq_printf(s, "\ntxtplunfl: %d\n", stats.txtplunfl);
+   seq_printf(s, "txphyerr: %d\n", stats.txphyerr);
+   seq_printf(s, "pktengrxducast: %d\n", stats.pktengrxducast);
+   seq_printf(s, "pktengrxdmcast: %d\n", stats.pktengrxdmcast);
+   seq_printf(s, "rxfrmtoolong: %d\n", stats.rxfrmtoolong);
+   seq_printf(s, "rxfrmtooshrt: %d\n", stats.rxfrmtooshrt);
+   seq_printf(s, "rxinvmachdr: %d\n", stats.rxinvmachdr);
+   seq_printf(s, "rxbadfcs: %d\n", stats.rxbadfcs);
+   seq_printf(s, "rxbadplcp: %d\n", stats.rxbadplcp);
+   seq_printf(s, "rxcrsglitch: %d\n", stats.rxcrsglitch);
+   seq_printf(s, "rxstrt: %d\n", stats.rxstrt);
+   seq_printf(s, "rxdfrmucastmbss: %d\n", stats.rxdfrmucastmbss);
+   seq_printf(s, "rxmfrmucastmbss: %d\n", stats.rxmfrmucastmbss);
+   seq_printf(s, "rxcfrmucast: %d\n", stats.rxcfrmucast);
+   seq_printf(s, "rxrtsucast: %d\n", stats.rxrtsucast);
+   seq_printf(s, "rxctsucast: %d\n", stats.rxctsucast);
+   seq_printf(s, "rxackucast: %d\n", stats.rxackucast);
+   seq_printf(s, "rxdfrmocast: %d\n", stats.rxdfrmocast);
+   seq_printf(s, "rxmfrmocast: %d\n", stats.rxmfrmocast);
+   seq_printf(s, "rxcfrmocast: %d\n", stats.rxcfrmocast);
+   seq_printf(s, "rxrtsocast: %d\n", stats.rxrtsocast);
+   seq_printf(s, "rxctsocast: %d\n", stats.rxctsocast);
+   seq_printf(s, "rxdfrmmcast: %d\n", stats.rxdfrmmcast);
+   seq_printf(s, "rxmfrmmcast: %d\n", stats.rxmfrmmcast);
+   seq_printf(s, "rxcfrmmcast: %d\n", stats.rxcfrmmcast);
+   seq_printf(s, "rxbeaconmbss: %d\n", stats.rxbeaconmbss);
+   seq_printf(s, "rxdfrmucastobss: %d\n", stats.rxdfrmucastobss);
+   seq_printf(s, "rxbeaconobss: %d\n", stats.rxbeaconobss);
+   seq_printf(s, "rxrsptm

[PATCH 0/2] brcmsmac: fix and expose 802.11 core statistics

2014-10-29 Thread Arend van Spriel
When looking at exposing the 802.11 core statistics a problem was found
in code obtaining the statistics from the device. This series fixes that
and exposes the statistics in debugfs. Hopefully this can reveal what
is causing connectivity issues on certain bcm4313 chipsets.

The series is intended for 3.19 and applies to the master branch of
the wireless-next repository.

Arend van Spriel (2):
  brcmsmac: fix statistic counter update function
  brcmsmac: expose 802.11 core statistics in debugfs

 drivers/net/wireless/brcm80211/brcmsmac/debug.c | 166 +++-
 drivers/net/wireless/brcm80211/brcmsmac/main.c  |  18 +--
 2 files changed, 142 insertions(+), 42 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] brcmsmac: fix statistic counter update function

2014-10-29 Thread Arend van Spriel
The 802.11 core statistics are retrieved from the core registers
but not stored. So the debug code was never triggered to give a
warning message on tx underruns or rx overflows. This patch fixes
this and assures the statistics are stored in the snapshot.

Reviewed-by: Hante Meuleman 
Reviewed-by: Pieter-Paul Giesberts 
Signed-off-by: Arend van Spriel 
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c 
b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 1b47482..bc9be78 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -3081,7 +3081,7 @@ static bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
 static void brcms_c_statsupd(struct brcms_c_info *wlc)
 {
int i;
-   struct macstat macstats;
+   struct macstat *macstats;
 #ifdef DEBUG
u16 delta;
u16 rxf0ovfl;
@@ -3092,31 +3092,31 @@ static void brcms_c_statsupd(struct brcms_c_info *wlc)
if (!wlc->pub->up)
return;
 
+   macstats = wlc->core->macstat_snapshot;
+
 #ifdef DEBUG
/* save last rx fifo 0 overflow count */
-   rxf0ovfl = wlc->core->macstat_snapshot->rxf0ovfl;
+   rxf0ovfl = macstats->rxf0ovfl;
 
/* save last tx fifo  underflow count */
for (i = 0; i < NFIFO; i++)
-   txfunfl[i] = wlc->core->macstat_snapshot->txfunfl[i];
+   txfunfl[i] = macstats->txfunfl[i];
 #endif /* DEBUG */
 
/* Read mac stats from contiguous shared memory */
-   brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, &macstats,
-   sizeof(struct macstat), OBJADDR_SHM_SEL);
+   brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, macstats,
+   sizeof(*macstats), OBJADDR_SHM_SEL);
 
 #ifdef DEBUG
/* check for rx fifo 0 overflow */
-   delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl);
+   delta = (u16)(macstats->rxf0ovfl - rxf0ovfl);
if (delta)
brcms_err(wlc->hw->d11core, "wl%d: %u rx fifo 0 overflows!\n",
  wlc->pub->unit, delta);
 
/* check for tx fifo underflows */
for (i = 0; i < NFIFO; i++) {
-   delta =
-   (u16) (wlc->core->macstat_snapshot->txfunfl[i] -
- txfunfl[i]);
+   delta = macstats->txfunfl[i] - txfunfl[i];
if (delta)
brcms_err(wlc->hw->d11core,
  "wl%d: %u tx fifo %d underflows!\n",
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: handle ieee80211 header and payload tracing separately

2014-10-29 Thread Johannes Berg
On Wed, 2014-10-29 at 19:39 +0530, Rajkumar Manoharan wrote:

> + u32 hdr_len = ieee80211_hdrlen(hdr->frame_control);

> + trace_ath10k_rx_hdr(ar, hdr, hdr_len);
> + trace_ath10k_rx_payload(ar, skb->data + hdr_len, skb->len - hdr_len);

Another note, since you're taking my suggestion :-)

It would be worth hiding that inside the tracepoint's assign function,
so instead of passing data/len here you'd pass the full skb, or the full
skb data/skb len, like this:

ar, skb->data, skb->len

to both tracers. Then inside the tracer you can do the hdrlen check, and
that way move the code into the tracing so it's not hit when tracing is
disabled.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211_hwsim: release driver when ieee80211_register_hw fails

2014-10-29 Thread Johannes Berg
On Tue, 2014-10-28 at 09:31 +0800, Junjie Mao wrote:
> The driver is not released when ieee80211_register_hw fails in
> mac80211_hwsim_create_radio, leading to the access to the unregistered (and
> possibly freed) device in platform_driver_unregister:

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3.18] mac80211: flush keys for AP mode on ieee80211_do_stop

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 11:56 +0100, Felix Fietkau wrote:
> Userspace can add keys to an AP mode interface before start_ap has been
> called. If there have been no calls to start_ap/stop_ap in the mean
> time, the keys will still be around when the interface is brought down.

I applied the following modified version.

johannes

>From 10b68487869031828aede7313c2befc53d6d30ec Mon Sep 17 00:00:00 2001
From: Felix Fietkau 
Date: Mon, 27 Oct 2014 11:56:06 +0100
Subject: [PATCH] mac80211: flush keys for AP mode on ieee80211_do_stop

Userspace can add keys to an AP mode interface before start_ap has been
called. If there have been no calls to start_ap/stop_ap in the mean
time, the keys will still be around when the interface is brought down.

Signed-off-by: Felix Fietkau 
[adjust comments, fix AP_VLAN case]
Signed-off-by: Johannes Berg 
---
 net/mac80211/iface.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index af237223a8cd..3b9e2b7b3f30 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -898,6 +898,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data 
*sdata,
list_del(&sdata->u.vlan.list);
mutex_unlock(&local->mtx);
RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL);
+   /* see comment in the default case below */
+   ieee80211_free_keys(sdata, true);
/* no need to tell driver */
break;
case NL80211_IFTYPE_MONITOR:
@@ -923,17 +925,16 @@ static void ieee80211_do_stop(struct 
ieee80211_sub_if_data *sdata,
/*
 * When we get here, the interface is marked down.
 * Free the remaining keys, if there are any
-* (shouldn't be, except maybe in WDS mode?)
+* (which can happen in AP mode if userspace sets
+* keys before the interface is operating, and maybe
+* also in WDS mode)
 *
 * Force the key freeing to always synchronize_net()
 * to wait for the RX path in case it is using this
-* interface enqueuing frames * at this very time on
+* interface enqueuing frames at this very time on
 * another CPU.
 */
ieee80211_free_keys(sdata, true);
-
-   /* fall through */
-   case NL80211_IFTYPE_AP:
skb_queue_purge(&sdata->skb_queue);
}
 
-- 
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA

2014-10-29 Thread Johannes Berg
On Tue, 2014-10-28 at 15:32 +0200, Luca Coelho wrote:
> (fixed Johannes' email address)
> 
> Both these bugs go far back, so IMHO they should go to 3.8 and stable.

Both applied. I think you meant 3.18 :)

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] staging: rtl8723au: core: pointer issue

2014-10-29 Thread Greg KH
On Sun, Oct 26, 2014 at 04:17:46PM +, Paul McQuade wrote:
> ERROR: "foo * bar" should be "foo *bar"
> 
> Signed-off-by: Paul McQuade 
> ---
>  drivers/staging/rtl8723au/core/rtw_efuse.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

Again with the odd subject :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] staging: rtl8723au: core style issue

2014-10-29 Thread Greg KH
On Mon, Oct 27, 2014 at 12:16:08AM +, Paul McQuade wrote:
> spaces required around %
> 
> Signed-off-by: Paul McQuade 
> ---
>  drivers/staging/rtl8723au/core/rtw_recv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Your subject does not make sense :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] staging: rtl8723au pointer issue

2014-10-29 Thread Greg KH
On Sun, Oct 26, 2014 at 03:59:56PM +, Paul McQuade wrote:
> ERROR: "foo*bar" should be "foo *bar"
> 
> Signed-off-by: Paul McQuade 
> ---
>  drivers/staging/rtl8723au/core/rtw_cmd.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

The subject does not make sense :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][V2] Staging:rtl8723au: open/closed brace issue

2014-10-29 Thread Greg KH
On Sun, Oct 26, 2014 at 03:10:22PM +, Paul McQuade wrote:
> ERROR: that open brace { should be on the previous line
> 
> Signed-off-by: Paul McQuade 
> ---
>  drivers/staging/rtl8723au/core/rtw_ap.c | 130 
> ++--
>  1 file changed, 40 insertions(+), 90 deletions(-)

This doesn't apply to my tree :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] staging: rtl8723au:core

2014-10-29 Thread Greg KH
On Sun, Oct 26, 2014 at 04:18:52PM +, Paul McQuade wrote:
> ERROR: spaces required around that ':' (ctx:VxE)
> 
> Signed-off-by: Paul McQuade 
> ---
>  drivers/staging/rtl8723au/core/rtw_ieee80211.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

Your Subject: makes no sense :(
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] wireless: nl80211: Broadcast CMD_NEW_INTERFACE and CMD_DEL_INTERFACE

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 14:43 +0200, Tomasz Bursztyka wrote:
> Let the other listeners being notified when a new or del interface
> command has been issued, thus reducing later necessary request to be in
> sync with current context.

I see no reason to list "wireless:" in the subject - please just use
nl80211: prefix.

> It bloats a bit nl80211_send_iface() function (I wanted to reuse its logic
> for both commands). Tell me if you would prefer a better way to do this.

I guess I'll see that below :)

It really bloats the *arguments* more than anything, no way to change
that, say by sending the delete message before the wdev is destroyed?

> @@ -2370,10 +2376,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 
> portid, u32 seq, int flag
>   }
>   }
>  
> - if (wdev->ssid_len) {
> - if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
> + if (ssid_len && nla_put(msg, NL80211_ATTR_SSID, ssid_len, ssid))
>   goto nla_put_failure;
> - }

This results in bad indentation.
 
> @@ -2687,10 +2725,17 @@ static int nl80211_del_interface(struct sk_buff *skb, 
> struct genl_info *info)
>  {
>   struct cfg80211_registered_device *rdev = info->user_ptr[0];
>   struct wireless_dev *wdev = info->user_ptr[1];
> + enum nl80211_iftype iftype = wdev->iftype;
> + struct net_device *dev = wdev->netdev;
> + u8 address[ETH_ALEN];
> + u64 id = wdev_id(wdev);
> + int status;
>  
>   if (!rdev->ops->del_virtual_intf)
>   return -EOPNOTSUPP;
>  
> + memcpy(address, wdev_address(wdev), ETH_ALEN);
> +
>   /*
>* If we remove a wireless device without a netdev then clear
>* user_ptr[1] so that nl80211_post_doit won't dereference it
> @@ -2698,10 +2743,17 @@ static int nl80211_del_interface(struct sk_buff *skb, 
> struct genl_info *info)
>* since the wdev has been freed, unlike with a netdev where
>* we need the dev_put() for the netdev to really be freed.
>*/
> - if (!wdev->netdev)
> + if (!dev)
>   info->user_ptr[1] = NULL;
>  
> - return rdev_del_virtual_intf(rdev, wdev);
> + status = rdev_del_virtual_intf(rdev, wdev);
> + if (status < 0)
> + return status;
> +
> + nl80211_notify_iface(rdev, NULL, iftype, id, address, dev,
> +  0, NULL, false, info->snd_portid);

I'm not sure why this needs to be so late in the command, if you put it
first you don't have the whole argument bloating issue.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] wireless: nl80211: Broadcast CMD_NEW_INTERFACE and CMD_DEL_INTERFACE

2014-10-29 Thread Johannes Berg
On Wed, 2014-10-29 at 16:44 +0100, Johannes Berg wrote:

> > +   nl80211_notify_iface(rdev, NULL, iftype, id, address, dev,
> > +0, NULL, false, info->snd_portid);
> 
> I'm not sure why this needs to be so late in the command, if you put it
> first you don't have the whole argument bloating issue.

And if for some reason it really must be so late, maybe you can split
the message building and sending instead.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/48] staging: vt6655: s_cbFillTxBufHead remove unused parameters

2014-10-29 Thread Greg KH
On Sat, Oct 25, 2014 at 09:39:39AM +0100, Malcolm Priestley wrote:
> Remove the following parameters
> PSEthernetHeader psEthHeader
> PSKeyItem pTransmitKey
> bool bNeedEncrypt
> 
> Signed-off-by: Malcolm Priestley 
> ---
>  drivers/staging/vt6655/rxtx.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)

I think this causes a build error, but I'm not quite sure, as I probably
messed up the merge.  Can you refresh this series and resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] mac80211: fix HT+ to HT- (and vice-versa) CSA

2014-10-29 Thread Luca Coelho
On October 29, 2014 5:37:35 PM EET, Johannes Berg  
wrote:
>On Tue, 2014-10-28 at 15:32 +0200, Luca Coelho wrote:
>> (fixed Johannes' email address)
>> 
>> Both these bugs go far back, so IMHO they should go to 3.8 and
>stable.
>
>Both applied. I think you meant 3.18 :)

Oops! Ahrrmmm... The "one" key in my keyboard is stuck.   Hrmhrm! :P

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/31] staging: vt6655: Conversion to mac80211

2014-10-29 Thread Greg KH
On Sat, Oct 25, 2014 at 09:20:10AM +0100, Malcolm Priestley wrote:
> The patches in this series convert the driver to mac80211.
> 
> As well as infrastructure mode the driver now operates in
> IBSS and access point modes.
> 
> Host access point is now working with hostapd in nl80211 mode.
> 
> The driver continues to operate diversity mode in infrastructure mode.
> 
> There is still a lot of work that needs doing particularly remodeling
> rxtx to something similar to vt6656 driver.
> 
> These patches creates huge amount of dead code that will be
> removed in the next series.

I really wanted to apply these, but they wouldn't apply due to other
changes in my branch since you made these.  Actually, I couldn't figure
out what branch you made them against, as they didn't even apply cleanly
to 3.18-rc1.

Can you refresh this series, and your second one, against my
staging-testing branch of staging.git and resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] ath9k: fix some debugfs output

2014-10-29 Thread Dan Carpenter
The right shift operation has higher precedence than the mask so we
left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
then we mask.  It should be left shift, mask, and then right shift.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/net/wireless/ath/ath9k/debug.c 
b/drivers/net/wireless/ath/ath9k/debug.c
index 2a2a17d..c9afc15 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -455,7 +455,7 @@ static ssize_t read_file_dma(struct file *file, char __user 
*user_buf,
 "%2d  %2x  %1x %2x   %2x\n",
 i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset,
 (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3),
-val[2] & (0x7 << (i * 3)) >> (i * 3),
+(val[2] & (0x7 << (i * 3))) >> (i * 3),
 (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset);
}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] mac80211-hwsim: Provide multicast event for HWSIM_CMD_NEW_RADIO

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 12:44 +0200, Jukka Rissanen wrote:

> +static void mcast_msg(struct sk_buff *mcast_skb, struct genl_info *info)
> +{
> + if (info)
> + genl_notify(&hwsim_genl_family, mcast_skb,
> + genl_info_net(info), info->snd_portid,
> + HWSIM_MCGRP_CONFIG, info->nlhdr, GFP_KERNEL);
> + else
> + genlmsg_multicast(&hwsim_genl_family, mcast_skb, 0,
> +   HWSIM_MCGRP_CONFIG, GFP_KERNEL);
> +}

Also - given the parameters and what this does, that's a bad name for
the function. Never mind that it doesn't have any sort of identifier
(say hwsim_ prefix), it doesn't even do what it says it does.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] mac80211-hwsim: Provide multicast event for HWSIM_CMD_NEW_RADIO

2014-10-29 Thread Johannes Berg
On Wed, 2014-10-29 at 16:50 +0100, Johannes Berg wrote:
> On Mon, 2014-10-27 at 12:44 +0200, Jukka Rissanen wrote:
> 
> > +static void mcast_msg(struct sk_buff *mcast_skb, struct genl_info *info)
> > +{
> > +   if (info)
> > +   genl_notify(&hwsim_genl_family, mcast_skb,
> > +   genl_info_net(info), info->snd_portid,
> > +   HWSIM_MCGRP_CONFIG, info->nlhdr, GFP_KERNEL);
> > +   else
> > +   genlmsg_multicast(&hwsim_genl_family, mcast_skb, 0,
> > + HWSIM_MCGRP_CONFIG, GFP_KERNEL);
> > +}
> 
> Also - given the parameters and what this does, that's a bad name for
> the function. Never mind that it doesn't have any sort of identifier
> (say hwsim_ prefix), it doesn't even do what it says it does.

Or maybe it does? I'm unsure what genl_notify() does...

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] mac80211-hwsim: Rename CREATE and DESTROY radio to NEW and DEL radio

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 12:44 +0200, Jukka Rissanen wrote:
> Using the name HWSIM_CMD_NEW_RADIO and HWSIM_CMD_DEL_RADIO is more
> fitting on how other pieces of the wireless system work.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] mac80211-hwsim: Provide multicast event for HWSIM_CMD_NEW_RADIO

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 12:44 +0200, Jukka Rissanen wrote:

> +static void mcast_new_radio(int id, struct genl_info *info,
> + int channels, const char *reg_alpha2,
> + const struct ieee80211_regdomain *regd,
> + bool reg_strict, bool p2p_device,
> + bool use_chanctx)

Since you're adding yet another function with all these arguments, maybe
you could split them out into some kind of radio config struct that you
can pass around?

johannes


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211-hwsim: add frequency attribute to netlink pkts

2014-10-29 Thread Johannes Berg
On Mon, 2014-10-27 at 15:04 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> Add frequency attribute when sending to user-space over
> netlink socket.  The frequency is currently ignored when
> receiving from user-space.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211-hwsim: add frequency attribute to netlink pkts

2014-10-29 Thread Ben Greear
On 10/29/2014 08:55 AM, Johannes Berg wrote:
> On Mon, 2014-10-27 at 15:04 -0700, gree...@candelatech.com wrote:
>> From: Ben Greear 
>>
>> Add frequency attribute when sending to user-space over
>> netlink socket.  The frequency is currently ignored when
>> receiving from user-space.
> 
> Applied.

Do you have any suggestions for how to deal with pkts
received (from user-space netlink) on a frequency that does
not match the current hwsim radio's center frequency?

Thanks,
Ben

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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1 net-next] cfg80211: fix set but not used warning in nl80211_channel_switch()

2014-10-29 Thread Johannes Berg
On Sat, 2014-10-25 at 17:57 +0200, Fabian Frederick wrote:
> radar_detect_width is unused since commit 97dc94f1d933
> ("cfg80211: remove channel_switch combination check")

Applied, thanks.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211-hwsim: support SGI-20

2014-10-29 Thread Johannes Berg
On Fri, 2014-10-24 at 11:12 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> This lets hostapd start if you have SGI-20 configured
> as one of your HT capabilities.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] ath9k: fix some debugfs output

2014-10-29 Thread Joe Perches
On Wed, 2014-10-29 at 18:48 +0300, Dan Carpenter wrote:
> The right shift operation has higher precedence than the mask so we
> left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
> then we mask.  It should be left shift, mask, and then right shift.
> 
Hey Dan.

My grep pattern doesn't like operations on the thing masked.

Did you find this by some tool or visual inspection via grep?


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] iwlwifi: cleanup a mask shift in iwlagn_bt_traffic_is_sco()

2014-10-29 Thread Dan Carpenter
The shift operation is higher precedence so the code is wrong and it
sets of a static checker warning.  But it doesn't affect real life
because BT_UART_MSG_FRAME3SCOESCO_POS is zero so the shift is a no-op.

I have re-written it in normal style and with parenthesis as a cleanup
and to silence the static checker warning.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c 
b/drivers/net/wireless/iwlwifi/dvm/lib.c
index 2191621..065d3d5 100644
--- a/drivers/net/wireless/iwlwifi/dvm/lib.c
+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c
@@ -418,7 +418,7 @@ void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, 
bool rssi_ena)
 
 static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg)
 {
-   return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >>
+   return (uart_msg->frame3 & BT_UART_MSG_FRAME3SCOESCO_MSK) >>
BT_UART_MSG_FRAME3SCOESCO_POS;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] ath9k: fix some debugfs output

2014-10-29 Thread Dan Carpenter
On Wed, Oct 29, 2014 at 09:08:39AM -0700, Joe Perches wrote:
> On Wed, 2014-10-29 at 18:48 +0300, Dan Carpenter wrote:
> > The right shift operation has higher precedence than the mask so we
> > left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
> > then we mask.  It should be left shift, mask, and then right shift.
> > 
> Hey Dan.
> 
> My grep pattern doesn't like operations on the thing masked.
> 
> Did you find this by some tool or visual inspection via grep?
>

I wrote a Smatch check inspired by the i40e bug you found earlier.

regards,
dan carpenter 
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] iw: support setting vif MAC during creation

2014-10-29 Thread Johannes Berg
On Fri, 2014-10-24 at 08:35 -0700, gree...@candelatech.com wrote:
> From: Ben Greear 
> 
> This saves an extra call to change it later, and will
> also keep udev from potentially messing with a vif
> it should not be messing with.

Applied.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mac80211-hwsim: add frequency attribute to netlink pkts

2014-10-29 Thread Johannes Berg
On Wed, 2014-10-29 at 09:02 -0700, Ben Greear wrote:
> On 10/29/2014 08:55 AM, Johannes Berg wrote:
> > On Mon, 2014-10-27 at 15:04 -0700, gree...@candelatech.com wrote:
> >> From: Ben Greear 
> >>
> >> Add frequency attribute when sending to user-space over
> >> netlink socket.  The frequency is currently ignored when
> >> receiving from user-space.
> > 
> > Applied.
> 
> Do you have any suggestions for how to deal with pkts
> received (from user-space netlink) on a frequency that does
> not match the current hwsim radio's center frequency?

No, sorry. I don't even know if you can find out the current frequency?
If you have multi-channel you don't even have a single frequency :)

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] ath9k: fix some debugfs output

2014-10-29 Thread Joe Perches
On Wed, 2014-10-29 at 19:10 +0300, Dan Carpenter wrote:
> On Wed, Oct 29, 2014 at 09:08:39AM -0700, Joe Perches wrote:
> > On Wed, 2014-10-29 at 18:48 +0300, Dan Carpenter wrote:
> > > The right shift operation has higher precedence than the mask so we
> > > left shift by "(i * 3)" and then immediately right shift by "(i * 3)"
> > > then we mask.  It should be left shift, mask, and then right shift.
[]
> > My grep pattern doesn't like operations on the thing masked.
> > Did you find this by some tool or visual inspection via grep?
[]
> I wrote a Smatch check inspired by the i40e bug you found earlier.

Nice.  fyi: I sent a bunch of these already.

https://lkml.org/lkml/2014/10/27/38


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] iwlwifi: cleanup a mask shift in iwlagn_bt_traffic_is_sco()

2014-10-29 Thread Emmanuel Grumbach
On Wed, Oct 29, 2014 at 6:08 PM, Dan Carpenter  wrote:
> The shift operation is higher precedence so the code is wrong and it
> sets of a static checker warning.  But it doesn't affect real life
> because BT_UART_MSG_FRAME3SCOESCO_POS is zero so the shift is a no-op.
>
> I have re-written it in normal style and with parenthesis as a cleanup
> and to silence the static checker warning.
>
> Signed-off-by: Dan Carpenter 
>

In my tree already - I got it from Joe.

https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/iwlwifi-next.git/commit/?id=50f6635afe565a0e1c5ab78f040294fe1dc41de0
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211-hwsim: remove un-used variable

2014-10-29 Thread greearb
From: Ben Greear 

Remove un-used variable added in recent patch.  Can re-add
this when we have an idea how to deal with receiving pkts
from user-space on channels not supported by current operating
mode of the virual radio.

Signed-off-by: Ben Greear 
---
 drivers/net/wireless/mac80211_hwsim.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index b40435c..9dd07f7 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2424,7 +2424,6 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff 
*skb_2,
int frame_data_len;
void *frame_data;
struct sk_buff *skb = NULL;
-   u32 freq;
 
if (info->snd_portid != wmediumd_portid) {
printk(KERN_DEBUG "mac80211-hwsim: port-id mismatch: %d %d\n",
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/48] staging: vt6655: s_cbFillTxBufHead remove unused parameters

2014-10-29 Thread Malcolm Priestley



On 29/10/14 09:15, Greg KH wrote:

On Sat, Oct 25, 2014 at 09:39:39AM +0100, Malcolm Priestley wrote:

Remove the following parameters
PSEthernetHeader psEthHeader
PSKeyItem pTransmitKey
bool bNeedEncrypt

Signed-off-by: Malcolm Priestley 
---
  drivers/staging/vt6655/rxtx.c | 14 ++
  1 file changed, 6 insertions(+), 8 deletions(-)


I think this causes a build error, but I'm not quite sure, as I probably
messed up the merge.  Can you refresh this series and resend?



Sorry about that, this patch in this series got into the wrong order.

I will resend shortly.

Regards

Malcolm

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/34] staging: vt6655: mac80211 conversion: add new rx functions

2014-10-29 Thread Malcolm Priestley
vnt_receive_frame which replaces device_receive_frame

and vnt_rx_data which handles mac80211 rx data

structures ieee80211_hw, ieee80211_vif and variable rx_rate are added
in structure vnt_private
---
 drivers/staging/vt6655/device.h  |   6 +-
 drivers/staging/vt6655/device_main.c |  13 ++--
 drivers/staging/vt6655/dpc.c | 123 +++
 drivers/staging/vt6655/dpc.h |   2 +
 4 files changed, 137 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index d769d09..82e1845 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -56,6 +56,7 @@
 #include 
 #include 
 /* Include Wireless Extension definition and check version - Jean II */
+#include 
 #include 
 #include /* New driver API */
 
@@ -319,7 +320,9 @@ typedef struct __device_opt {
 
 struct vnt_private {
struct pci_dev *pcid;
-
+   /* mac80211 */
+   struct ieee80211_hw *hw;
+   struct ieee80211_vif *vif;
 /* netdev */
struct net_device *dev;
 
@@ -378,6 +381,7 @@ struct vnt_private {
u32 flags;
 
u32 rx_buf_sz;
+   u8 rx_rate;
int multicast_limit;
 
pid_t   MLMEThr_pid;
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index c8f262f..c8ee91c 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1336,7 +1336,7 @@ static int device_rx_srv(struct vnt_private *pDevice, 
unsigned int uIdx)
 pRD = pRD->next) {
if (works++ > 15)
break;
-   if (device_receive_frame(pDevice, pRD)) {
+   if (vnt_receive_frame(pDevice, pRD)) {
if (!device_alloc_rx_buf(pDevice, pRD)) {
dev_err(&pDevice->pcid->dev,
"can not allocate rx buf\n");
@@ -1344,7 +1344,6 @@ static int device_rx_srv(struct vnt_private *pDevice, 
unsigned int uIdx)
}
}
pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
-   pDevice->dev->last_rx = jiffies;
}
 
pDevice->pCurrRD[uIdx] = pRD;
@@ -1360,9 +1359,12 @@ static bool device_alloc_rx_buf(struct vnt_private 
*pDevice, PSRxDesc pRD)
if (pRDInfo->skb == NULL)
return false;
ASSERT(pRDInfo->skb);
-   pRDInfo->skb->dev = pDevice->dev;
-   pRDInfo->skb_dma = pci_map_single(pDevice->pcid, 
skb_tail_pointer(pRDInfo->skb),
- pDevice->rx_buf_sz, 
PCI_DMA_FROMDEVICE);
+
+   pRDInfo->skb_dma =
+   pci_map_single(pDevice->pcid,
+  skb_put(pRDInfo->skb, 
skb_tailroom(pRDInfo->skb)),
+  pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
+
*((unsigned int *)&(pRD->m_rd0RD0)) = 0; /* FIX cast */
 
pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz);
@@ -1380,7 +1382,6 @@ bool device_alloc_frag_buf(struct vnt_private *pDevice,
if (pDeF->skb == NULL)
return false;
ASSERT(pDeF->skb);
-   pDeF->skb->dev = pDevice->dev;
 
return true;
 }
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 67cadea..036bbb0 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -1321,3 +1321,126 @@ static bool s_bAPModeRxData(
 
return true;
 }
+
+static bool vnt_rx_data(struct vnt_private *priv, struct sk_buff *skb,
+   u16 bytes_received)
+{
+   struct ieee80211_hw *hw = priv->hw;
+   struct ieee80211_supported_band *sband;
+   struct ieee80211_rx_status rx_status = { 0 };
+   struct ieee80211_hdr *hdr;
+   __le16 fc;
+   u8 *rsr, *new_rsr, *rssi;
+   __le64 *tsf_time;
+   u16 frame_size;
+   int ii, r;
+   u8 *rx_sts, *rx_rate, *sq;
+   u8 *skb_data;
+   u8 rate_idx = 0;
+   u8 rate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
+   long rx_dbm;
+
+   /* [31:16]RcvByteCount ( not include 4-byte Status ) */
+   frame_size = le16_to_cpu(*((__le16 *)(skb->data + 2)));
+   if (frame_size > 2346 || frame_size < 14) {
+   dev_dbg(&priv->pcid->dev, "--- WRONG Length 1\n");
+   return false;
+   }
+
+   skb_data = (u8 *)skb->data;
+
+   rx_sts = skb_data;
+   rx_rate = skb_data + 1;
+
+   sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
+
+   for (r = RATE_1M; r < MAX_RATE; r++) {
+   if (*rx_rate == rate[r])
+   break;
+   }
+
+   priv->rx_rate = r;
+
+   for (ii = 0; ii < sband->n_bitrates; ii++) {
+   if (sband->bitrates[ii].hw_value == r) {
+   rate_idx = ii;
+   brea

[PATCH v2 00/34] staging: vt6655: Conversion to mac80211

2014-10-29 Thread Malcolm Priestley
The patches in this series convert the driver to mac80211.

As well as infrastructure mode the driver now operates in
IBSS and access point modes.

Host access point is now working with hostapd in nl80211 mode.

The driver continues to operate diversity mode in infrastructure mode.

There is still a lot of work that needs doing particularly remodeling
rxtx to something similar to vt6656 driver.

These patches creates huge amount of dead code that will be
removed in the next series.

Changes from v1 3 additional patches fixing tsf and rssi issues

Rebased on staging-testing.

Malcolm Priestley (34):
  staging: vt6655: mac80211 conversion: add new rx functions
  staging: vt6655: mac80211 conversion: add new key functions
  staging: vt6655: mac8021 conversion: add new tx functions
  staging: vt6655: mac80211 conversion: s_cbFillTxBufHead
  staging: vt6655: dead code remove s_vFillFragParameter.
  staging: vt6655: mac80211 conversion: s_vFillRTSHead convert to using
struct ieee80211_hdr
  staging: vt6655: mac80211 conversion: s_uFillDataHead add power saving
poll
  staging: vt6655: mac80211 conversion add main mac80211 functions
  staging: vt6655: mac80211 conversion add channel bands
  staging: vt6655: mac80211 conversion replace suspend resume functions
  staging: vt6655: mac80211 conversion: device_print_info remove
netdevice.
  staging: vt6655: mac80211 conversion: changes to device_intr
  staging: vt6655: mac80211 conversion: device_tx_srv tx and add report
rates
  staging: vt6655: mac80211 conversion: changes to set channel
  staging: vt6655: mac80211 conversion: enable power saving
  staging: vt6655: mac80211 conversion: changes to CARDbSetPhyParameter
  staging: vt6655: mac80211 conversion: card.c use basic_rates
  staging: vt6655: CARDbSetPhyParameter replace s_vSetRSPINF with
CARDvSetRSPINF
  staging: vt6655: mac80211 conversion: device_init_registers remove
legacy code
  staging: vt6655: mac80211 conversion: device_free_info
  staging: vt6655: switch driver over to mac80211
  staging: vt6655: phy type same as bb type
  staging: vt6655: mac80211 conversion: device_error remove legacy
functions
  staging: vt6655: vt6655_probe remove management pointers
  staging: vt6655: mac80211 conversion: PSbIsNextTBTTWakeUp convert to
mac80211
  staging: vt6655: MACvSetDefaultKeyEntry replace WLAN_WEP104_KEYLEN
  staging: vt6655: baseband.c replace BIT0 with BIT(0)
  staging: vt6655: s_vGenerateTxParameter remove unused cbMACHdLen
  staging: vt6655: device_init_registers replace spin lock
  staging: vt6655: baseband.c timers replace spin lock
  staging: vt6655: fifo & frag control remove big endian values
  staging: vt6655: vnt_rx_data: uCurrRSSI should have the value of *rssi
  staging: vt6655: don't update bUpdateBBVGA when off channel
  staging: vt6655: reset tsf on dissociation

 drivers/staging/vt6655/Kconfig   |4 +-
 drivers/staging/vt6655/baseband.c|   21 +-
 drivers/staging/vt6655/card.c|  185 +
 drivers/staging/vt6655/card.h|4 +-
 drivers/staging/vt6655/channel.c |  152 +++-
 drivers/staging/vt6655/channel.h |2 +
 drivers/staging/vt6655/desc.h|   33 +-
 drivers/staging/vt6655/device.h  |   11 +-
 drivers/staging/vt6655/device_main.c | 1328 --
 drivers/staging/vt6655/dpc.c |  123 
 drivers/staging/vt6655/dpc.h |2 +
 drivers/staging/vt6655/key.c |  136 
 drivers/staging/vt6655/key.h |   17 +
 drivers/staging/vt6655/mac.c |2 +-
 drivers/staging/vt6655/power.c   |   34 +-
 drivers/staging/vt6655/rxtx.c| 1098 +++-
 drivers/staging/vt6655/rxtx.h|   14 +
 17 files changed, 1698 insertions(+), 1468 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/34] staging: vt6655: mac80211 conversion: add new key functions

2014-10-29 Thread Malcolm Priestley
vnt_key_init_table to initialize the table

vnt_set_keys to set the keys

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device.h |   1 +
 drivers/staging/vt6655/key.c| 136 
 drivers/staging/vt6655/key.h|  17 +
 3 files changed, 154 insertions(+)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 82e1845..bc9b81a 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -323,6 +323,7 @@ struct vnt_private {
/* mac80211 */
struct ieee80211_hw *hw;
struct ieee80211_vif *vif;
+   unsigned long key_entry_inuse;
 /* netdev */
struct net_device *dev;
 
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c
index 02caffb..b2fa812 100644
--- a/drivers/staging/vt6655/key.c
+++ b/drivers/staging/vt6655/key.c
@@ -790,3 +790,139 @@ bool KeybSetAllGroupKey(
}
return true;
 }
+
+int vnt_key_init_table(struct vnt_private *priv)
+{
+   u32 i;
+
+   for (i = 0; i < MAX_KEY_TABLE; i++)
+   MACvDisableKeyEntry(priv->PortOffset, i);
+
+   return 0;
+}
+
+static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
+   struct ieee80211_key_conf *key, u32 key_type, u32 mode,
+   bool onfly_latch)
+{
+   struct vnt_private *priv = hw->priv;
+   u8 broadcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+   u16 key_mode = 0;
+   u32 entry = 0;
+   u8 *bssid;
+   u8 key_inx = key->keyidx;
+   u8 i;
+
+   if (mac_addr)
+   bssid = mac_addr;
+   else
+   bssid = &broadcast[0];
+
+   if (key_type != VNT_KEY_DEFAULTKEY) {
+   for (i = 0; i < (MAX_KEY_TABLE - 1); i++) {
+   if (!test_bit(i, &priv->key_entry_inuse)) {
+   set_bit(i, &priv->key_entry_inuse);
+
+   key->hw_key_idx = i;
+   entry = key->hw_key_idx;
+   break;
+   }
+   }
+   }
+
+   switch (key_type) {
+   /* fallthrough */
+   case VNT_KEY_DEFAULTKEY:
+   /* default key last entry */
+   entry = MAX_KEY_TABLE - 1;
+   key->hw_key_idx = entry;
+   case VNT_KEY_ALLGROUP:
+   key_mode |= VNT_KEY_ALLGROUP;
+   if (onfly_latch)
+   key_mode |= VNT_KEY_ONFLY_ALL;
+   case VNT_KEY_GROUP_ADDRESS:
+   key_mode |= mode;
+   case VNT_KEY_GROUP:
+   key_mode |= (mode << 4);
+   key_mode |= VNT_KEY_GROUP;
+   break;
+   case  VNT_KEY_PAIRWISE:
+   key_mode |= mode;
+   key_inx = 4;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   if (onfly_latch)
+   key_mode |= VNT_KEY_ONFLY;
+
+   if (mode == KEY_CTL_WEP) {
+   if (key->keylen == WLAN_KEY_LEN_WEP40)
+   key->key[15] &= 0x7f;
+   if (key->keylen == WLAN_KEY_LEN_WEP104)
+   key->key[15] |= 0x80;
+   }
+
+   MACvSetKeyEntry(priv->PortOffset, key_mode, entry, key_inx,
+   bssid, (u32 *)key->key, priv->byLocalID);
+
+   return 0;
+}
+
+int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+struct ieee80211_vif *vif, struct ieee80211_key_conf *key)
+{
+   struct ieee80211_bss_conf *conf = &vif->bss_conf;
+   struct vnt_private *priv = hw->priv;
+   u8 *mac_addr = NULL;
+   u8 key_dec_mode = 0;
+   int ret = 0;
+   u32 u;
+
+   if (sta)
+   mac_addr = &sta->addr[0];
+
+   switch (key->cipher) {
+   case 0:
+   for (u = 0 ; u < MAX_KEY_TABLE; u++)
+   MACvDisableKeyEntry(priv->PortOffset, u);
+   return ret;
+
+   case WLAN_CIPHER_SUITE_WEP40:
+   case WLAN_CIPHER_SUITE_WEP104:
+   for (u = 0; u < MAX_KEY_TABLE; u++)
+   MACvDisableKeyEntry(priv->PortOffset, u);
+
+   vnt_set_keymode(hw, mac_addr,
+   key, VNT_KEY_DEFAULTKEY, KEY_CTL_WEP, true);
+
+   key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+
+   return ret;
+   case WLAN_CIPHER_SUITE_TKIP:
+   key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+   key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+
+   key_dec_mode = KEY_CTL_TKIP;
+
+   break;
+   case WLAN_CIPHER_SUITE_CCMP:
+   key_dec_mode = KEY_CTL_CCMP;
+
+   key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+   }
+
+   if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
+   vnt_set_keymode(hw, mac_addr,
+   key, VNT_KEY_PAIRWISE, key_dec_mode, true);
+   } else {
+   vnt_set_keymod

[PATCH v2 09/34] staging: vt6655: mac80211 conversion add channel bands

2014-10-29 Thread Malcolm Priestley
Add rates and channels according to rf type for vnt_init_bands which is a
mac80211 replacement for init_channel_table.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/channel.c | 140 +++
 drivers/staging/vt6655/channel.h |   2 +
 drivers/staging/vt6655/device_main.c |   2 +
 3 files changed, 144 insertions(+)

diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index a19965f..4b3c798 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -352,6 +352,146 @@ static struct
 
 /*-  Export Functions  --*/
 
+static struct ieee80211_rate vnt_rates_bg[] = {
+   { .bitrate = 10,  .hw_value = RATE_1M },
+   { .bitrate = 20,  .hw_value = RATE_2M },
+   { .bitrate = 55,  .hw_value = RATE_5M },
+   { .bitrate = 110, .hw_value = RATE_11M },
+   { .bitrate = 60,  .hw_value = RATE_6M },
+   { .bitrate = 90,  .hw_value = RATE_9M },
+   { .bitrate = 120, .hw_value = RATE_12M },
+   { .bitrate = 180, .hw_value = RATE_18M },
+   { .bitrate = 240, .hw_value = RATE_24M },
+   { .bitrate = 360, .hw_value = RATE_36M },
+   { .bitrate = 480, .hw_value = RATE_48M },
+   { .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_rate vnt_rates_a[] = {
+   { .bitrate = 60,  .hw_value = RATE_6M },
+   { .bitrate = 90,  .hw_value = RATE_9M },
+   { .bitrate = 120, .hw_value = RATE_12M },
+   { .bitrate = 180, .hw_value = RATE_18M },
+   { .bitrate = 240, .hw_value = RATE_24M },
+   { .bitrate = 360, .hw_value = RATE_36M },
+   { .bitrate = 480, .hw_value = RATE_48M },
+   { .bitrate = 540, .hw_value = RATE_54M },
+};
+
+static struct ieee80211_channel vnt_channels_2ghz[] = {
+   { .center_freq = 2412, .hw_value = 1 },
+   { .center_freq = 2417, .hw_value = 2 },
+   { .center_freq = 2422, .hw_value = 3 },
+   { .center_freq = 2427, .hw_value = 4 },
+   { .center_freq = 2432, .hw_value = 5 },
+   { .center_freq = 2437, .hw_value = 6 },
+   { .center_freq = 2442, .hw_value = 7 },
+   { .center_freq = 2447, .hw_value = 8 },
+   { .center_freq = 2452, .hw_value = 9 },
+   { .center_freq = 2457, .hw_value = 10 },
+   { .center_freq = 2462, .hw_value = 11 },
+   { .center_freq = 2467, .hw_value = 12 },
+   { .center_freq = 2472, .hw_value = 13 },
+   { .center_freq = 2484, .hw_value = 14 }
+};
+
+static struct ieee80211_channel vnt_channels_5ghz[] = {
+   { .center_freq = 4915, .hw_value = 15 },
+   { .center_freq = 4920, .hw_value = 16 },
+   { .center_freq = 4925, .hw_value = 17 },
+   { .center_freq = 4935, .hw_value = 18 },
+   { .center_freq = 4940, .hw_value = 19 },
+   { .center_freq = 4945, .hw_value = 20 },
+   { .center_freq = 4960, .hw_value = 21 },
+   { .center_freq = 4980, .hw_value = 22 },
+   { .center_freq = 5035, .hw_value = 23 },
+   { .center_freq = 5040, .hw_value = 24 },
+   { .center_freq = 5045, .hw_value = 25 },
+   { .center_freq = 5055, .hw_value = 26 },
+   { .center_freq = 5060, .hw_value = 27 },
+   { .center_freq = 5080, .hw_value = 28 },
+   { .center_freq = 5170, .hw_value = 29 },
+   { .center_freq = 5180, .hw_value = 30 },
+   { .center_freq = 5190, .hw_value = 31 },
+   { .center_freq = 5200, .hw_value = 32 },
+   { .center_freq = 5210, .hw_value = 33 },
+   { .center_freq = 5220, .hw_value = 34 },
+   { .center_freq = 5230, .hw_value = 35 },
+   { .center_freq = 5240, .hw_value = 36 },
+   { .center_freq = 5260, .hw_value = 37 },
+   { .center_freq = 5280, .hw_value = 38 },
+   { .center_freq = 5300, .hw_value = 39 },
+   { .center_freq = 5320, .hw_value = 40 },
+   { .center_freq = 5500, .hw_value = 41 },
+   { .center_freq = 5520, .hw_value = 42 },
+   { .center_freq = 5540, .hw_value = 43 },
+   { .center_freq = 5560, .hw_value = 44 },
+   { .center_freq = 5580, .hw_value = 45 },
+   { .center_freq = 5600, .hw_value = 46 },
+   { .center_freq = 5620, .hw_value = 47 },
+   { .center_freq = 5640, .hw_value = 48 },
+   { .center_freq = 5660, .hw_value = 49 },
+   { .center_freq = 5680, .hw_value = 50 },
+   { .center_freq = 5700, .hw_value = 51 },
+   { .center_freq = 5745, .hw_value = 52 },
+   { .center_freq = 5765, .hw_value = 53 },
+   { .center_freq = 5785, .hw_value = 54 },
+   { .center_freq = 5805, .hw_value = 55 },
+   { .center_freq = 5825, .hw_value = 56 }
+};
+
+static struct ieee80211_supported_band vnt_supported_2ghz_band = {
+   .channels = vnt_channels_2ghz,
+   .n_channels = ARRAY_SIZE(vnt_channels_2ghz),
+   .bitrates = vnt_rates_bg,
+   .n_bitrates = ARRAY_SIZE(vnt_rates_bg),
+};
+
+static struct ieee80211_supported_band vnt_supported_5ghz_band = {
+   .channels = vnt_channels_5ghz,
+   .n_cha

[PATCH v2 06/34] staging: vt6655: mac80211 conversion: s_vFillRTSHead convert to using struct ieee80211_hdr

2014-10-29 Thread Malcolm Priestley
Removing PSEthernetHeader

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/rxtx.c | 91 ++-
 1 file changed, 12 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 09df536..a1a594f 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -127,7 +127,7 @@ s_vFillRTSHead(
unsigned intcbFrameLength,
bool bNeedAck,
bool bDisCRC,
-   PSEthernetHeader psEthHeader,
+   struct ieee80211_hdr *hdr,
unsigned short wCurrentRate,
unsigned char byFBOption
 );
@@ -789,7 +789,7 @@ s_vFillRTSHead(
unsigned int cbFrameLength,
bool bNeedAck,
bool bDisCRC,
-   PSEthernetHeader psEthHeader,
+   struct ieee80211_hdr *hdr,
unsigned short wCurrentRate,
unsigned char byFBOption
 )
@@ -841,22 +841,8 @@ s_vFillRTSHead(
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);
 
-
-   if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
-   (pDevice->op_mode == NL80211_IFTYPE_AP)) {
-   ether_addr_copy(buf->data.ra,
-   psEthHeader->abyDstAddr);
-   } else {
-   ether_addr_copy(buf->data.ra,
-   pDevice->abyBSSID);
-   }
-   if (pDevice->op_mode == NL80211_IFTYPE_AP)
-   ether_addr_copy(buf->data.ta,
-   pDevice->abyBSSID);
-   else
-   ether_addr_copy(buf->data.ta,
-   psEthHeader->abySrcAddr);
-
+   ether_addr_copy(buf->data.ra, hdr->addr1);
+   ether_addr_copy(buf->data.ta, hdr->addr2);
} else {
struct vnt_rts_g_fb *buf = pvRTS;
/* Get SignalField, ServiceField & Length */
@@ -909,23 +895,8 @@ s_vFillRTSHead(
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);
 
-
-   if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
-   (pDevice->op_mode == NL80211_IFTYPE_AP)) {
-   ether_addr_copy(buf->data.ra,
-   psEthHeader->abyDstAddr);
-   } else {
-   ether_addr_copy(buf->data.ra,
-   pDevice->abyBSSID);
-   }
-
-   if (pDevice->op_mode == NL80211_IFTYPE_AP)
-   ether_addr_copy(buf->data.ta,
-   pDevice->abyBSSID);
-   else
-   ether_addr_copy(buf->data.ta,
-   psEthHeader->abySrcAddr);
-
+   ether_addr_copy(buf->data.ra, hdr->addr1);
+   ether_addr_copy(buf->data.ta, hdr->addr2);
} // if (byFBOption == AUTO_FB_NONE)
} else if (byPktType == PK_TYPE_11A) {
if (byFBOption == AUTO_FB_NONE) {
@@ -946,23 +917,8 @@ s_vFillRTSHead(
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEEE80211_STYPE_RTS);
 
-
-   if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
-   (pDevice->op_mode == NL80211_IFTYPE_AP)) {
-   ether_addr_copy(buf->data.ra,
-   psEthHeader->abyDstAddr);
-   } else {
-   ether_addr_copy(buf->data.ra,
-   pDevice->abyBSSID);
-   }
-
-   if (pDevice->op_mode == NL80211_IFTYPE_AP)
-   ether_addr_copy(buf->data.ta,
-   pDevice->abyBSSID);
-   else
-   ether_addr_copy(buf->data.ta,
-   psEthHeader->abySrcAddr);
-
+   ether_addr_copy(buf->data.ra, hdr->addr1);
+   ether_addr_copy(buf->data.ta, hdr->addr2);
} else {
struct vnt_rts_a_fb *buf = pvRTS;
/* Get SignalField, ServiceField & Length */
@@ -991,20 +947,8 @@ s_vFillRTSHead(
cpu_to_le16(IEEE80211_FTYPE_CTL |
IEE

[PATCH v2 03/34] staging: vt6655: mac8021 conversion: add new tx functions

2014-10-29 Thread Malcolm Priestley
vnt_fill_txkey a mac80211 repacement for s_vFillTxKey

vnt_generate_fifo_header mac80211 replacement for vGenerateFIFOHeader

vnt_beacon_make for making and despatching beacon.

vnt_beacon_enable to enabling beacon

struct vnt_tx_fifo_head is also added to replace typedef
struct tagSTxBufHead that will be removed later.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h |   1 +
 drivers/staging/vt6655/rxtx.c | 311 ++
 drivers/staging/vt6655/rxtx.h |  14 ++
 3 files changed, 326 insertions(+)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 8f510c6..9068c3e 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -287,6 +287,7 @@ typedef struct tagTDES1 {
 STDES1;
 
 typedef struct tagDEVICE_TD_INFO {
+   void *mic_hdr;
struct sk_buff *skb;
unsigned char *buf;
dma_addr_t  skb_dma;
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index da7c0a8..99ce5a3 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -2994,3 +2994,314 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct 
sk_buff *skb,
// Poll Transmit the adapter
MACvTransmit0(pDevice->PortOffset);
 }
+
+static void vnt_fill_txkey(struct ieee80211_hdr *hdr, u8 *key_buffer,
+  struct ieee80211_key_conf *tx_key,
+  struct sk_buff *skb, u16 payload_len,
+  struct vnt_mic_hdr *mic_hdr)
+{
+   struct ieee80211_key_seq seq;
+   u8 *iv = ((u8 *)hdr + ieee80211_get_hdrlen_from_skb(skb));
+
+   /* strip header and icv len from payload */
+   payload_len -= ieee80211_get_hdrlen_from_skb(skb);
+   payload_len -= tx_key->icv_len;
+
+   switch (tx_key->cipher) {
+   case WLAN_CIPHER_SUITE_WEP40:
+   case WLAN_CIPHER_SUITE_WEP104:
+   memcpy(key_buffer, iv, 3);
+   memcpy(key_buffer + 3, tx_key->key, tx_key->keylen);
+
+   if (tx_key->keylen == WLAN_KEY_LEN_WEP40) {
+   memcpy(key_buffer + 8, iv, 3);
+   memcpy(key_buffer + 11,
+  tx_key->key, WLAN_KEY_LEN_WEP40);
+   }
+
+   break;
+   case WLAN_CIPHER_SUITE_TKIP:
+   ieee80211_get_tkip_p2k(tx_key, skb, key_buffer);
+
+   break;
+   case WLAN_CIPHER_SUITE_CCMP:
+
+   if (!mic_hdr)
+   return;
+
+   mic_hdr->id = 0x59;
+   mic_hdr->payload_len = cpu_to_be16(payload_len);
+   ether_addr_copy(mic_hdr->mic_addr2, hdr->addr2);
+
+   ieee80211_get_key_tx_seq(tx_key, &seq);
+
+   memcpy(mic_hdr->ccmp_pn, seq.ccmp.pn, IEEE80211_CCMP_PN_LEN);
+
+   if (ieee80211_has_a4(hdr->frame_control))
+   mic_hdr->hlen = cpu_to_be16(28);
+   else
+   mic_hdr->hlen = cpu_to_be16(22);
+
+   ether_addr_copy(mic_hdr->addr1, hdr->addr1);
+   ether_addr_copy(mic_hdr->addr2, hdr->addr2);
+   ether_addr_copy(mic_hdr->addr3, hdr->addr3);
+
+   mic_hdr->frame_control = cpu_to_le16(
+   le16_to_cpu(hdr->frame_control) & 0xc78f);
+   mic_hdr->seq_ctrl = cpu_to_le16(
+   le16_to_cpu(hdr->seq_ctrl) & 0xf);
+
+   if (ieee80211_has_a4(hdr->frame_control))
+   ether_addr_copy(mic_hdr->addr4, hdr->addr4);
+
+   memcpy(key_buffer, tx_key->key, WLAN_KEY_LEN_CCMP);
+
+   break;
+   default:
+   break;
+   }
+}
+
+int vnt_generate_fifo_header(struct vnt_private *priv, u32 dma_idx,
+PSTxDesc head_td, struct sk_buff *skb)
+{
+   PDEVICE_TD_INFO td_info = head_td->pTDInfo;
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_tx_rate *tx_rate = &info->control.rates[0];
+   struct ieee80211_rate *rate;
+   struct ieee80211_key_conf *tx_key;
+   struct ieee80211_hdr *hdr;
+   struct vnt_tx_fifo_head *tx_buffer_head =
+   (struct vnt_tx_fifo_head *)td_info->buf;
+   u32 frag;
+   u16 tx_body_size = skb->len, current_rate;
+   u8 pkt_type;
+   bool is_pspoll = false;
+
+   memset(tx_buffer_head, 0, sizeof(*tx_buffer_head));
+
+   hdr = (struct ieee80211_hdr *)(skb->data);
+
+   rate = ieee80211_get_tx_rate(priv->hw, info);
+
+   current_rate = rate->hw_value;
+   if (priv->wCurrentRate != current_rate &&
+   !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
+   priv->wCurrentRate = current_rate;
+
+   RFbSetPower(priv, priv->wCurrentRate,
+   priv->hw->conf.chandef.chan->hw_value);
+   }
+
+   if (current_rate > RATE_11M)
+ 

[PATCH v2 04/34] staging: vt6655: mac80211 conversion: s_cbFillTxBufHead

2014-10-29 Thread Malcolm Priestley
Covert to handle mac80211 sk_buff data removing fragmentation processing
via s_vFillFragParameter and calls to vGenerateMACHeader and s_vSWencryption

fragmentation is now handled by mac80211.

There is still more todos with this function when legacy net device code
have been remove from driver.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/rxtx.c | 583 --
 1 file changed, 46 insertions(+), 537 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 99ce5a3..b114a60 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -144,7 +144,7 @@ s_vGenerateTxParameter(
unsigned intcbFrameSize,
bool bNeedACK,
unsigned intuDMAIdx,
-   PSEthernetHeader psEthHeader,
+   void *psEthHeader,
unsigned short wCurrentRate
 );
 
@@ -1176,7 +1176,7 @@ s_vGenerateTxParameter(
unsigned int cbFrameSize,
bool bNeedACK,
unsigned int uDMAIdx,
-   PSEthernetHeader psEthHeader,
+   void *psEthHeader,
unsigned short wCurrentRate
 )
 {
@@ -1301,46 +1301,26 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned 
char byPktType,
  unsigned int uDMAIdx, PSTxDesc pHeadTD,
  PSEthernetHeader psEthHeader, unsigned char *pPacket,
  bool bNeedEncrypt, PSKeyItem pTransmitKey,
- unsigned int uNodeIndex, unsigned int *puMACfragNum)
+ unsigned int is_pspoll, unsigned int *puMACfragNum)
 {
-   unsigned int cbMACHdLen;
+   PDEVICE_TD_INFO td_info = pHeadTD->pTDInfo;
+   struct sk_buff *skb = td_info->skb;
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+   struct vnt_tx_fifo_head *tx_buffer_head =
+   (struct vnt_tx_fifo_head *)td_info->buf;
+   u16 fifo_ctl = le16_to_cpu(tx_buffer_head->fifo_ctl);
unsigned int cbFrameSize;
-   unsigned int cbFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
-   unsigned int cbFragPayloadSize;
-   unsigned int cbLastFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
-   unsigned int cbLastFragPayloadSize;
-   unsigned int uFragIdx;
-   unsigned char *pbyPayloadHead;
-   unsigned char *pbyIVHead;
-   unsigned char *pbyMacHdr;
-   unsigned short wFragType; //00:Non-Frag, 01:Start, 10:Mid, 11:Last
__le16 uDuration;
unsigned char *pbyBuffer;
-   unsigned int cbIVlen = 0;
-   unsigned int cbICVlen = 0;
-   unsigned int cbMIClen = 0;
-   unsigned int cbFCSlen = 4;
-   unsigned int cb802_1_H_len = 0;
unsigned int uLength = 0;
-   unsigned int uTmpLen = 0;
unsigned int cbMICHDR = 0;
-   u32 dwMICKey0, dwMICKey1;
-   u32 dwMIC_Priority;
-   u32 *pdwMIC_L;
-   u32 *pdwMIC_R;
-   u32 dwSafeMIC_L, dwSafeMIC_R; /* Fix "Last Frag Size" < "MIC length". */
-   bool bMIC2Frag = false;
-   unsigned int uMICFragLen = 0;
unsigned int uMACfragNum = 1;
unsigned int uPadding = 0;
unsigned int cbReqCount = 0;
-
-   bool bNeedACK;
-   bool bRTS;
-   bool bIsAdhoc;
-   unsigned char *pbyType;
+   bool bNeedACK = (bool)(fifo_ctl & FIFOCTL_NEEDACK);
+   bool bRTS = (bool)(fifo_ctl & FIFOCTL_RTS);
PSTxDesc   ptdCurr;
-   PSTxBufHeadpsTxBufHd = (PSTxBufHead) pbyTxBufferAddr;
unsigned int cbHeaderLength = 0;
void *pvRrvTime;
struct vnt_mic_hdr *pMICHDR;
@@ -1348,72 +1328,35 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned 
char byPktType,
void *pvCTS;
void *pvTxDataHd;
unsigned short wTxBufSize;   // FFinfo size
-   unsigned int uTotalCopyLength = 0;
unsigned char byFBOption = AUTO_FB_NONE;
-   bool bIsWEP256 = false;
-   PSMgmtObjectpMgmt = pDevice->pMgmt;
 
pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
 
-   if ((pDevice->op_mode == NL80211_IFTYPE_ADHOC) ||
-   (pDevice->op_mode == NL80211_IFTYPE_AP)) {
-   if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
-   bNeedACK = false;
-   else
-   bNeedACK = true;
-   bIsAdhoc = true;
-   } else {
-   // MSDUs in Infra mode always need ACK
-   bNeedACK = true;
-   bIsAdhoc = false;
-   }
-
-   if (pDevice->bLongHeader)
-   cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
-   else
-   cbMACHdLen = WLAN_HDR_ADDR3_LEN;
+   cbFrameSize = skb->len + 4;
 
-   if ((bNeedEncrypt == true) && (pTransmitKey != NULL)) {
-   if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
-   cbIVlen = 4;
-   cbICVlen = 4;
-   if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN)
- 

[PATCH v2 13/34] staging: vt6655: mac80211 conversion: device_tx_srv tx and add report rates

2014-10-29 Thread Malcolm Priestley
vnt_int_report_rate reports backs tx rate and is replacment for 
STAvUpdateTDStatCounter
and BSSvUpdateNodeTxCounter.

Replacing existing code.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 166 ++-
 1 file changed, 85 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 69c98c2..a888c26 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1208,19 +1208,84 @@ bool device_alloc_frag_buf(struct vnt_private *pDevice,
return true;
 }
 
+static const u8 fallback_rate0[5][5] = {
+   {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
+   {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
+   {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
+   {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
+   {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
+};
+
+static const u8 fallback_rate1[5][5] = {
+   {RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
+   {RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
+   {RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
+   {RATE_48M, RATE_48M, RATE_24M, RATE_12M, RATE_12M},
+   {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M}
+};
+
+static int vnt_int_report_rate(struct vnt_private *priv,
+  PDEVICE_TD_INFO context, u8 tsr0, u8 tsr1)
+{
+   struct vnt_tx_fifo_head *fifo_head;
+   struct ieee80211_tx_info *info;
+   struct ieee80211_rate *rate;
+   u16 fb_option;
+   u8 tx_retry = (tsr0 & TSR0_NCR);
+   s8 idx;
+
+   if (!context)
+   return -ENOMEM;
+
+   if (!context->skb)
+   return -EINVAL;
+
+   fifo_head = (struct vnt_tx_fifo_head *)context->buf;
+   fb_option = (le16_to_cpu(fifo_head->fifo_ctl) &
+   (FIFOCTL_AUTO_FB_0 | FIFOCTL_AUTO_FB_1));
+
+   info = IEEE80211_SKB_CB(context->skb);
+   idx = info->control.rates[0].idx;
+
+   if (fb_option && !(tsr1 & TSR1_TERR)) {
+   u8 tx_rate;
+   u8 retry = tx_retry;
+
+   rate = ieee80211_get_tx_rate(priv->hw, info);
+   tx_rate = rate->hw_value - RATE_18M;
+
+   if (retry > 4)
+   retry = 4;
+
+   if (fb_option & FIFOCTL_AUTO_FB_0)
+   tx_rate = fallback_rate0[tx_rate][retry];
+   else if (fb_option & FIFOCTL_AUTO_FB_1)
+   tx_rate = fallback_rate1[tx_rate][retry];
+
+   if (info->band == IEEE80211_BAND_5GHZ)
+   idx = tx_rate - RATE_6M;
+   else
+   idx = tx_rate;
+   }
+
+   ieee80211_tx_info_clear_status(info);
+
+   info->status.rates[0].count = tx_retry;
+
+   if (!(tsr1 & TSR1_TERR)) {
+   info->status.rates[0].idx = idx;
+   info->flags |= IEEE80211_TX_STAT_ACK;
+   }
+
+   return 0;
+}
+
 static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx)
 {
PSTxDesc pTD;
-   bool bFull = false;
int  works = 0;
unsigned char byTsr0;
unsigned char byTsr1;
-   unsigned intuFrameSize, uFIFOHeaderSize;
-   PSTxBufHead  pTxBufHead;
-   struct net_device_stats *pStats = &pDevice->dev->stats;
-   struct sk_buff *skb;
-   unsigned intuNodeIndex;
-   PSMgmtObject pMgmt = pDevice->pMgmt;
 
for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] > 0; pTD = 
pTD->next) {
if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC)
@@ -1234,22 +1299,8 @@ static int device_tx_srv(struct vnt_private *pDevice, 
unsigned int uIdx)
//Only the status of first TD in the chain is correct
if (pTD->m_td1TD1.byTCR & TCR_STP) {
if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) {
-   uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength;
-   uFrameSize = pTD->pTDInfo->dwReqCount - 
uFIFOHeaderSize;
-   pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf);
-   // Update the statistics based on the Transmit 
status
-   // now, we DONT check TSR0_CDH
-
-   STAvUpdateTDStatCounter(&pDevice->scStatistic,
-   byTsr0, byTsr1,
-   (unsigned char 
*)(pTD->pTDInfo->buf + uFIFOHeaderSize),
-   uFrameSize, uIdx);
-
-   BSSvUpdateNodeTxCounter(pDevice,
-   byTsr0, byTsr1,
-   (unsigned char 
*)(pTD->pTDInfo->buf),
-  

[PATCH v2 10/34] staging: vt6655: mac80211 conversion replace suspend resume functions

2014-10-29 Thread Malcolm Priestley
add vt6655_suspend and vt6655_resume

remove viawget_suspend and viawget_resume.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 104 ---
 1 file changed, 34 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 054841b..b0f94a8 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -274,8 +274,6 @@ static int  device_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd);
 
 #ifdef CONFIG_PM
 static int device_notify_reboot(struct notifier_block *, unsigned long event, 
void *ptr);
-static int viawget_suspend(struct pci_dev *pcid, pm_message_t state);
-static int viawget_resume(struct pci_dev *pcid);
 static struct notifier_block device_notifier = {
.notifier_call = device_notify_reboot,
.next = NULL,
@@ -3482,6 +3480,37 @@ vt6655_probe(struct pci_dev *pcid, const struct 
pci_device_id *ent)
 
 /*--*/
 
+#ifdef CONFIG_PM
+static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state)
+{
+   struct vnt_private *priv = pci_get_drvdata(pcid);
+   unsigned long flags;
+
+   spin_lock_irqsave(&priv->lock, flags);
+
+   pci_save_state(pcid);
+
+   MACbShutdown(priv->PortOffset);
+
+   pci_disable_device(pcid);
+   pci_set_power_state(pcid, pci_choose_state(pcid, state));
+
+   spin_unlock_irqrestore(&priv->lock, flags);
+
+   return 0;
+}
+
+static int vt6655_resume(struct pci_dev *pcid)
+{
+
+   pci_set_power_state(pcid, PCI_D0);
+   pci_enable_wake(pcid, PCI_D0, 0);
+   pci_restore_state(pcid);
+
+   return 0;
+}
+#endif
+
 MODULE_DEVICE_TABLE(pci, vt6655_pci_id_table);
 
 static struct pci_driver device_driver = {
@@ -3490,8 +3519,8 @@ static struct pci_driver device_driver = {
.probe = vt6655_probe,
.remove = vt6655_remove,
 #ifdef CONFIG_PM
-   .suspend = viawget_suspend,
-   .resume = viawget_resume,
+   .suspend = vt6655_suspend,
+   .resume = vt6655_resume,
 #endif
 };
 
@@ -3532,75 +3561,10 @@ device_notify_reboot(struct notifier_block *nb, 
unsigned long event, void *p)
for_each_pci_dev(pdev) {
if (pci_dev_driver(pdev) == &device_driver) {
if (pci_get_drvdata(pdev))
-   viawget_suspend(pdev, PMSG_HIBERNATE);
+   vt6655_suspend(pdev, PMSG_HIBERNATE);
}
}
}
return NOTIFY_DONE;
 }
-
-static int
-viawget_suspend(struct pci_dev *pcid, pm_message_t state)
-{
-   int power_status;   // to silence the compiler
-
-   struct vnt_private *pDevice = pci_get_drvdata(pcid);
-   PSMgmtObject  pMgmt = pDevice->pMgmt;
-
-   netif_stop_queue(pDevice->dev);
-   spin_lock_irq(&pDevice->lock);
-   pci_save_state(pcid);
-   del_timer(&pDevice->sTimerCommand);
-   del_timer(&pMgmt->sTimerSecondCallback);
-   pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
-   pDevice->uCmdDequeueIdx = 0;
-   pDevice->uCmdEnqueueIdx = 0;
-   pDevice->bCmdRunning = false;
-   MACbShutdown(pDevice->PortOffset);
-   MACvSaveContext(pDevice->PortOffset, pDevice->abyMacContext);
-   pDevice->bLinkPass = false;
-   memset(pMgmt->abyCurrBSSID, 0, 6);
-   pMgmt->eCurrState = WMAC_STATE_IDLE;
-   pci_disable_device(pcid);
-   power_status = pci_set_power_state(pcid, pci_choose_state(pcid, state));
-   spin_unlock_irq(&pDevice->lock);
-   return 0;
-}
-
-static int
-viawget_resume(struct pci_dev *pcid)
-{
-   struct vnt_private *pDevice = pci_get_drvdata(pcid);
-   PSMgmtObject  pMgmt = pDevice->pMgmt;
-   int power_status;   // to silence the compiler
-
-   power_status = pci_set_power_state(pcid, PCI_D0);
-   power_status = pci_enable_wake(pcid, PCI_D0, 0);
-   pci_restore_state(pcid);
-   if (netif_running(pDevice->dev)) {
-   spin_lock_irq(&pDevice->lock);
-   MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext);
-   device_init_registers(pDevice);
-   if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS
-   pMgmt->sNodeDBTable[0].bActive = false;
-   pDevice->bLinkPass = false;
-   if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-   // In Adhoc, BSS state set back to started.
-   pMgmt->eCurrState = WMAC_STATE_STARTED;
-   } else {
-   pMgmt->eCurrMode = WMAC_MODE_STANDBY;
-   pMgmt->eCurrState = WMAC_STATE_IDLE;
-   }
-   }
-   init_timer(&pMgmt->sTimerSecondCallback);
-   init_timer(&pDevice->sTimerComma

[PATCH v2 05/34] staging: vt6655: dead code remove s_vFillFragParameter.

2014-10-29 Thread Malcolm Priestley
s_vFillFragParameter is nolonger used.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/rxtx.c | 47 ---
 1 file changed, 47 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index b114a60..09df536 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -148,15 +148,6 @@ s_vGenerateTxParameter(
unsigned short wCurrentRate
 );
 
-static void s_vFillFragParameter(
-   struct vnt_private *pDevice,
-   unsigned char *pbyBuffer,
-   unsigned intuTxType,
-   void *pvtdCurr,
-   unsigned short wFragType,
-   unsigned intcbReqCount
-);
-
 static unsigned int
 s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
  unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
@@ -1257,44 +1248,6 @@ s_vGenerateTxParameter(
}
 }
 
-static
-void
-s_vFillFragParameter(
-   struct vnt_private *pDevice,
-   unsigned char *pbyBuffer,
-   unsigned int uTxType,
-   void *pvtdCurr,
-   unsigned short wFragType,
-   unsigned int cbReqCount
-)
-{
-   PSTxBufHead pTxBufHead = (PSTxBufHead) pbyBuffer;
-
-   if (uTxType == TYPE_SYNCDMA) {
-   PSTxSyncDesc ptdCurr = (PSTxSyncDesc)pvtdCurr;
-
-   //Set FIFOCtl & TimeStamp in TxSyncDesc
-   ptdCurr->m_wFIFOCtl = pTxBufHead->wFIFOCtl;
-   ptdCurr->m_wTimeStamp = pTxBufHead->wTimeStamp;
-   //Set TSR1 & ReqCount in TxDescHead
-   ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned 
short)(cbReqCount));
-   if (wFragType == FRAGCTL_ENDFRAG) //Last Fragmentation
-   ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
-   else
-   ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
-   } else {
-   PSTxDesc ptdCurr = (PSTxDesc)pvtdCurr;
-   //Set TSR1 & ReqCount in TxDescHead
-   ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned 
short)(cbReqCount));
-   if (wFragType == FRAGCTL_ENDFRAG) //Last Fragmentation
-   ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
-   else
-   ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
-   }
-
-   pTxBufHead->wFragCtl |= (unsigned short)wFragType;//0x0001; //  
 0001
-}
-
 static unsigned int
 s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,
  unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/34] staging: vt6655: mac80211 conversion add main mac80211 functions

2014-10-29 Thread Malcolm Priestley
Replace existing vt6655_probe with one converted to mac80211
with the following operations

vnt_tx_80211
vnt_start
vnt_stop
vnt_add_interface
vnt_remove_interface
vnt_config
vnt_bss_info_changed
vnt_prepare_multicast
vnt_configure
vnt_set_key
vnt_get_tsf
vnt_set_tsf
vnt_reset_tsf

The following variables are also added.
basic_rates
mc_list_count
mac_hw

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device.h  |   3 +
 drivers/staging/vt6655/device_main.c | 754 ---
 2 files changed, 621 insertions(+), 136 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 7d521c6..17a36dc 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -324,7 +324,10 @@ struct vnt_private {
struct ieee80211_hw *hw;
struct ieee80211_vif *vif;
unsigned long key_entry_inuse;
+   u32 basic_rates;
u16 current_aid;
+   int mc_list_count;
+   u8 mac_hw;
 /* netdev */
struct net_device *dev;
 
diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index c8ee91c..23d9344 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -809,142 +809,6 @@ static const struct net_device_ops device_netdev_ops = {
.ndo_set_rx_mode= device_set_multi,
 };
 
-static int
-vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
-{
-   static bool bFirst = true;
-   struct net_device *dev = NULL;
-   PCHIP_INFO  pChip_info = (PCHIP_INFO)ent->driver_data;
-   struct vnt_private *pDevice;
-   int rc;
-
-   dev = alloc_etherdev(sizeof(*pDevice));
-
-   pDevice = netdev_priv(dev);
-
-   if (dev == NULL) {
-   pr_err(DEVICE_NAME ": allocate net device failed\n");
-   return -ENOMEM;
-   }
-
-   // Chain it all together
-   SET_NETDEV_DEV(dev, &pcid->dev);
-
-   if (bFirst) {
-   pr_notice("%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION);
-   pr_notice("Copyright (c) 2003 VIA Networking Technologies, 
Inc.\n");
-   bFirst = false;
-   }
-
-   vt6655_init_info(pcid, &pDevice, pChip_info);
-   pDevice->dev = dev;
-
-   if (pci_enable_device(pcid)) {
-   device_free_info(pDevice);
-   return -ENODEV;
-   }
-   dev->irq = pcid->irq;
-
-#ifdef DEBUG
-   pr_debug("Before get pci_info memaddr is %x\n", pDevice->memaddr);
-#endif
-   if (!device_get_pci_info(pDevice, pcid)) {
-   pr_err(DEVICE_NAME ": Failed to find PCI device.\n");
-   device_free_info(pDevice);
-   return -ENODEV;
-   }
-
-#ifdef DEBUG
-
-   pr_debug("after get pci_info memaddr is %x, io addr is %x,io_size is 
%d\n", pDevice->memaddr, pDevice->ioaddr, pDevice->io_size);
-   {
-   int i;
-   u32 bar, len;
-   u32 address[] = {
-   PCI_BASE_ADDRESS_0,
-   PCI_BASE_ADDRESS_1,
-   PCI_BASE_ADDRESS_2,
-   PCI_BASE_ADDRESS_3,
-   PCI_BASE_ADDRESS_4,
-   PCI_BASE_ADDRESS_5,
-   0};
-   for (i = 0; address[i]; i++) {
-   pci_read_config_dword(pcid, address[i], &bar);
-   pr_debug("bar %d is %x\n", i, bar);
-   if (!bar) {
-   pr_debug("bar %d not implemented\n", i);
-   continue;
-   }
-   if (bar & PCI_BASE_ADDRESS_SPACE_IO) {
-   /* This is IO */
-
-   len = bar & (PCI_BASE_ADDRESS_IO_MASK & 0x);
-   len = len & ~(len - 1);
-
-   pr_debug("IO space:  len in IO %x, BAR %d\n", 
len, i);
-   } else {
-   len = bar & 0xFFF0;
-   len = ~len + 1;
-
-   pr_debug("len in MEM %x, BAR %d\n", len, i);
-   }
-   }
-   }
-#endif
-
-   pDevice->PortOffset = ioremap(pDevice->memaddr & 
PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size);
-
-   if (pDevice->PortOffset == NULL) {
-   pr_err(DEVICE_NAME ": Failed to IO remapping ..\n");
-   device_free_info(pDevice);
-   return -ENODEV;
-   }
-
-   rc = pci_request_regions(pcid, DEVICE_NAME);
-   if (rc) {
-   pr_err(DEVICE_NAME ": Failed to find PCI device\n");
-   device_free_info(pDevice);
-   return -ENODEV;
-   }
-
-   dev->base_addr = pDevice->ioaddr;
-   // do reset
-   if (!MACbSoftwareReset(pDevice->PortOffset)) {
-   pr_err(DEVICE_NAME ": Failed to access MAC hardware.

[PATCH v2 12/34] staging: vt6655: mac80211 conversion: changes to device_intr

2014-10-29 Thread Malcolm Priestley
Remove net device code.

Remove current measure code and function s_vCompleteCurrentMeasure
and switch code which are now handled by mac80211

Change beaconing to mac80211.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 175 ++-
 1 file changed, 8 insertions(+), 167 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 5ece184..69c98c2 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -400,45 +400,6 @@ device_set_options(struct vnt_private *pDevice)
 (int)pDevice->bDiversityRegCtlON);
 }
 
-static void s_vCompleteCurrentMeasure(struct vnt_private *pDevice,
- unsigned char byResult)
-{
-   unsigned int ii;
-   unsigned long dwDuration = 0;
-   unsigned char byRPI0 = 0;
-
-   for (ii = 1; ii < 8; ii++) {
-   pDevice->dwRPIs[ii] *= 255;
-   dwDuration |= *((unsigned short 
*)(pDevice->pCurrMeasureEID->sReq.abyDuration));
-   dwDuration <<= 10;
-   pDevice->dwRPIs[ii] /= dwDuration;
-   pDevice->abyRPIs[ii] = (unsigned char)pDevice->dwRPIs[ii];
-   byRPI0 += pDevice->abyRPIs[ii];
-   }
-   pDevice->abyRPIs[0] = (0xFF - byRPI0);
-
-   if (pDevice->uNumOfMeasureEIDs == 0) {
-   VNTWIFIbMeasureReport(pDevice->pMgmt,
- true,
- pDevice->pCurrMeasureEID,
- byResult,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
-   );
-   } else {
-   VNTWIFIbMeasureReport(pDevice->pMgmt,
- false,
- pDevice->pCurrMeasureEID,
- byResult,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
-   );
-   CARDbStartMeasure(pDevice, pDevice->pCurrMeasureEID++, 
pDevice->uNumOfMeasureEIDs);
-   }
-}
-
 //
 // Initialisation of MAC & BBP registers
 //
@@ -2056,14 +2017,11 @@ static int  device_xmit(struct sk_buff *skb, struct 
net_device *dev) {
 
 static  irqreturn_t  device_intr(int irq,  void *dev_instance)
 {
-   struct net_device *dev = dev_instance;
-   struct vnt_private *pDevice = netdev_priv(dev);
+   struct vnt_private *pDevice = dev_instance;
int max_count = 0;
unsigned long dwMIBCounter = 0;
-   PSMgmtObjectpMgmt = pDevice->pMgmt;
unsigned char byOrgPageSel = 0;
int handled = 0;
-   unsigned char byData = 0;
int ii = 0;
unsigned long flags;
 
@@ -2106,94 +2064,7 @@ static  irqreturn_t  device_intr(int irq,  void 
*dev_instance)
device_error(pDevice, pDevice->dwIsr);
}
 
-   if (pDevice->byLocalID > REV_ID_VT3253_B1) {
-   if (pDevice->dwIsr & ISR_MEASURESTART) {
-   // 802.11h measure start
-   pDevice->byOrgChannel = pDevice->byCurrentCh;
-   VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, 
&(pDevice->byOrgRCR));
-   VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, 
(RCR_RXALLTYPE | RCR_UNICAST | RCR_BROADCAST | RCR_MULTICAST | RCR_WPAERR));
-   MACvSelectPage1(pDevice->PortOffset);
-   VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR0, 
&(pDevice->dwOrgMAR0));
-   VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR4, 
&(pDevice->dwOrgMAR4));
-   MACvSelectPage0(pDevice->PortOffset);
-   //
-   if (set_channel(pDevice, 
pDevice->pCurrMeasureEID->sReq.byChannel)) {
-   pDevice->bMeasureInProgress = true;
-   MACvSelectPage1(pDevice->PortOffset);
-   MACvRegBitsOn(pDevice->PortOffset, 
MAC_REG_MSRCTL, MSRCTL_READY);
-   MACvSelectPage0(pDevice->PortOffset);
-   pDevice->byBasicMap = 0;
-   pDevice->byCCAFraction = 0;
-   for (ii = 0; ii < 8; ii++)
-   pDevice->dwRPIs[ii] = 0;
-
-   } else {
-   // can not measure because set channel 
fail
-   //

[PATCH v2 32/34] staging: vt6655: vnt_rx_data: uCurrRSSI should have the value of *rssi

2014-10-29 Thread Malcolm Priestley
Fixes issue of byBBVGANew is wrong in device_intr

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/dpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 036bbb0..11153ef 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -1382,7 +1382,7 @@ static bool vnt_rx_data(struct vnt_private *priv, struct 
sk_buff *skb,
RFvRSSITodBm(priv, *rssi, &rx_dbm);
 
priv->byBBPreEDRSSI = (u8)rx_dbm + 1;
-   priv->uCurrRSSI = priv->byBBPreEDRSSI;
+   priv->uCurrRSSI = *rssi;
 
skb_pull(skb, 4);
skb_trim(skb, frame_size);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 30/34] staging: vt6655: baseband.c timers replace spin lock

2014-10-29 Thread Malcolm Priestley
Use spin_lock_irqsave and spin_unlock_irqrestore

in functions TimerSQ3CallBack and TimerState1CallBack

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/baseband.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index 8adeea4..c7ad927 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2786,9 +2786,11 @@ TimerSQ3CallBack(
 )
 {
struct vnt_private *pDevice = hDeviceContext;
+   unsigned long flags;
 
pr_debug("TimerSQ3CallBack...\n");
-   spin_lock_irq(&pDevice->lock);
+
+   spin_lock_irqsave(&pDevice->lock, flags);
 
pr_debug("3.[%08x][%08x], %d\n",
 (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
@@ -2803,7 +2805,7 @@ TimerSQ3CallBack(
add_timer(&pDevice->TimerSQ3Tmax3);
add_timer(&pDevice->TimerSQ3Tmax2);
 
-   spin_unlock_irq(&pDevice->lock);
+   spin_unlock_irqrestore(&pDevice->lock, flags);
 }
 
 /*+
@@ -2830,10 +2832,12 @@ TimerState1CallBack(
 )
 {
struct vnt_private *pDevice = hDeviceContext;
+   unsigned long flags;
 
pr_debug("TimerState1CallBack...\n");
 
-   spin_lock_irq(&pDevice->lock);
+   spin_lock_irqsave(&pDevice->lock, flags);
+
if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) {
s_vChangeAntenna(pDevice);
pDevice->TimerSQ3Tmax3.expires =  RUN_AT(pDevice->byTMax3 * HZ);
@@ -2864,5 +2868,6 @@ TimerState1CallBack(
}
pDevice->byAntennaState = 0;
BBvClearAntDivSQ3Value(pDevice);
-   spin_unlock_irq(&pDevice->lock);
+
+   spin_unlock_irqrestore(&pDevice->lock, flags);
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 27/34] staging: vt6655: baseband.c replace BIT0 with BIT(0)

2014-10-29 Thread Malcolm Priestley
Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/baseband.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index b8a64c0..8adeea4 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2116,7 +2116,7 @@ bool BBbVT3253Init(struct vnt_private *pDevice)
bResult &= BBbWriteEmbedded(dwIoBase, 
byVT3253B0_AGC4_RFMD2959[ii][0], byVT3253B0_AGC4_RFMD2959[ii][1]);
 
VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
-   MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
+   MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
}
pDevice->abyBBVGA[0] = 0x18;
pDevice->abyBBVGA[1] = 0x0A;
@@ -2149,7 +2149,7 @@ bool BBbVT3253Init(struct vnt_private *pDevice)
bResult &= BBbWriteEmbedded(dwIoBase, 
byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
 
VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
-   MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
+   MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
 
pDevice->abyBBVGA[0] = 0x14;
pDevice->abyBBVGA[1] = 0x0A;
@@ -2455,7 +2455,7 @@ BBvPowerSaveModeON(void __iomem *dwIoBase)
unsigned char byOrgData;
 
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
-   byOrgData |= BIT0;
+   byOrgData |= BIT(0);
BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
 }
 
@@ -2477,7 +2477,7 @@ BBvPowerSaveModeOFF(void __iomem *dwIoBase)
unsigned char byOrgData;
 
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
-   byOrgData &= ~(BIT0);
+   byOrgData &= ~(BIT(0));
BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 33/34] staging: vt6655: don't update bUpdateBBVGA when off channel

2014-10-29 Thread Malcolm Priestley
Check flag conf IEEE80211_CONF_OFFCHANNEL so that RSSI doesn't swing wildly
on scanning.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index c5eca10..968ea9a 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2040,6 +2040,7 @@ static  irqreturn_t  device_intr(int irq,  void 
*dev_instance)
if (pDevice->vif &&
pDevice->op_mode != NL80211_IFTYPE_ADHOC) {
if (pDevice->bUpdateBBVGA &&
+   !(pDevice->hw->conf.flags & 
IEEE80211_CONF_OFFCHANNEL) &&
pDevice->vif->bss_conf.assoc &&
pDevice->uCurrRSSI) {
longldBm;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 21/34] staging: vt6655: switch driver over to mac80211

2014-10-29 Thread Malcolm Priestley
Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig
index c3ba693..77cfc70 100644
--- a/drivers/staging/vt6655/Kconfig
+++ b/drivers/staging/vt6655/Kconfig
@@ -1,8 +1,6 @@
 config VT6655
tristate "VIA Technologies VT6655 support"
-   depends on PCI && WLAN && m
-   select WIRELESS_EXT
-   select WEXT_PRIV
+   depends on PCI && MAC80211 && m
---help---
This is a vendor-written driver for VIA VT6655.
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 29/34] staging: vt6655: device_init_registers replace spin lock

2014-10-29 Thread Malcolm Priestley
Use spin_lock_irqsave and spin_unlock_irqrestore.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index d7dd002..c5eca10 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -406,6 +406,7 @@ device_set_options(struct vnt_private *pDevice)
 
 static void device_init_registers(struct vnt_private *pDevice)
 {
+   unsigned long flags;
unsigned int ii;
unsigned char byValue;
unsigned char byValue1;
@@ -439,11 +440,11 @@ static void device_init_registers(struct vnt_private 
*pDevice)
/* Get Local ID */
VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &pDevice->byLocalID);
 
-   spin_lock_irq(&pDevice->lock);
+   spin_lock_irqsave(&pDevice->lock, flags);
 
SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM);
 
-   spin_unlock_irq(&pDevice->lock);
+   spin_unlock_irqrestore(&pDevice->lock, flags);
 
/* Get Channel range */
pDevice->byMinChannel = 1;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 34/34] staging: vt6655: reset tsf on dissociation

2014-10-29 Thread Malcolm Priestley
Ensuring that tsf counter does not run while idle.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 968ea9a..07d2101 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2980,6 +2980,11 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
 
CARDvSetFirstNextTBTT(priv->PortOffset,
  conf->beacon_int);
+   } else {
+   VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL,
+TFTCTL_TSFCNTRST);
+   VNSvOutPortB(priv->PortOffset + MAC_REG_TFTCTL,
+TFTCTL_TSFCNTREN);
}
}
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 26/34] staging: vt6655: MACvSetDefaultKeyEntry replace WLAN_WEP104_KEYLEN

2014-10-29 Thread Malcolm Priestley
with WLAN_KEY_LEN_WEP40

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index e3b0b7f..a347f39 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -1526,7 +1526,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, 
unsigned int uKeyLen,
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
dwData = *pdwKey;
-   if (uKeyLen == WLAN_WEP104_KEYLEN)
+   if (uKeyLen == WLAN_KEY_LEN_WEP40)
dwData |= 0x8000;
 
VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 31/34] staging: vt6655: fifo & frag control remove big endian values

2014-10-29 Thread Malcolm Priestley
Endian conversion now happens at run time only little endian
values are valid.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/desc.h | 32 
 1 file changed, 32 deletions(-)

diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 9068c3e..b59405b 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -118,37 +118,7 @@
  */
 #define CB_MAX_TX_ABORT_RETRY   3
 
-#ifdef __BIG_ENDIAN
-
 /* WMAC definition FIFO Control */
-#define FIFOCTL_AUTO_FB_1   0x0010
-#define FIFOCTL_AUTO_FB_0   0x0008
-#define FIFOCTL_GRPACK  0x0004
-#define FIFOCTL_11GA0x0003
-#define FIFOCTL_11GB0x0002
-#define FIFOCTL_11B 0x0001
-#define FIFOCTL_11A 0x
-#define FIFOCTL_RTS 0x8000
-#define FIFOCTL_ISDMA0  0x4000
-#define FIFOCTL_GENINT  0x2000
-#define FIFOCTL_TMOEN   0x1000
-#define FIFOCTL_LRETRY  0x0800
-#define FIFOCTL_CRCDIS  0x0400
-#define FIFOCTL_NEEDACK 0x0200
-#define FIFOCTL_LHEAD   0x0100
-
-/* WMAC definition Frag Control */
-#define FRAGCTL_AES 0x0003
-#define FRAGCTL_TKIP0x0002
-#define FRAGCTL_LEGACY  0x0001
-#define FRAGCTL_NONENCRYPT  0x
-#define FRAGCTL_ENDFRAG 0x0300
-#define FRAGCTL_MIDFRAG 0x0200
-#define FRAGCTL_STAFRAG 0x0100
-#define FRAGCTL_NONFRAG 0x
-
-#else
-
 #define FIFOCTL_AUTO_FB_1   0x1000
 #define FIFOCTL_AUTO_FB_0   0x0800
 #define FIFOCTL_GRPACK  0x0400
@@ -175,8 +145,6 @@
 #define FRAGCTL_STAFRAG 0x0001
 #define FRAGCTL_NONFRAG 0x
 
-#endif
-
 #define TYPE_TXDMA0 0
 #define TYPE_AC0DMA 1
 #define TYPE_ATIMDMA2
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 25/34] staging: vt6655: mac80211 conversion: PSbIsNextTBTTWakeUp convert to mac80211

2014-10-29 Thread Malcolm Priestley
Wake up to listen to next beacon when struct ieee80211_conf -> listen_interval 
== 1

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/power.c | 19 ++-
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index fe33bb2..5371802 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -327,21 +327,14 @@ PSbIsNextTBTTWakeUp(
 )
 {
struct vnt_private *pDevice = hDeviceContext;
-   PSMgmtObjectpMgmt = pDevice->pMgmt;
+   struct ieee80211_hw *hw = pDevice->hw;
+   struct ieee80211_conf *conf = &hw->conf;
bool bWakeUp = false;
 
-   if (pMgmt->wListenInterval >= 2) {
-   if (pMgmt->wCountToWakeUp == 0)
-   pMgmt->wCountToWakeUp = pMgmt->wListenInterval;
-
-   pMgmt->wCountToWakeUp--;
-
-   if (pMgmt->wCountToWakeUp == 1) {
-   // Turn on wake up to listen next beacon
-   MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, 
PSCTL_LNBCN);
-   bWakeUp = true;
-   }
-
+   if (conf->listen_interval == 1) {
+   /* Turn on wake up to listen next beacon */
+   MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
+   bWakeUp = true;
}
 
return bWakeUp;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 28/34] staging: vt6655: s_vGenerateTxParameter remove unused cbMACHdLen

2014-10-29 Thread Malcolm Priestley
Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/rxtx.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 23ee379..9beabea 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -1132,7 +1132,6 @@ s_vGenerateTxParameter(
unsigned short wCurrentRate
 )
 {
-   unsigned int cbMACHdLen = WLAN_HDR_ADDR3_LEN; //24
unsigned short wFifoCtl;
bool bDisCRC = false;
unsigned char byFBOption = AUTO_FB_NONE;
@@ -1150,9 +1149,6 @@ s_vGenerateTxParameter(
else if (wFifoCtl & FIFOCTL_AUTO_FB_1)
byFBOption = AUTO_FB_1;
 
-   if (pDevice->bLongHeader)
-   cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
-
if (!pvRrvTime)
return;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 24/34] staging: vt6655: vt6655_probe remove management pointers

2014-10-29 Thread Malcolm Priestley
All these pointers are now dead.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 0bd2ca8..d7dd002 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -3266,8 +3266,6 @@ vt6655_probe(struct pci_dev *pcid, const struct 
pci_device_id *ent)
/* Enable the chip specified capabilities */
priv->flags = priv->sOpts.flags | (pChip_info->flags & 0xff00UL);
priv->tx_80211 = device_dma0_tx_80211;
-   priv->sMgmtObj.pAdapter = (void *)priv;
-   priv->pMgmt = &(priv->sMgmtObj);
 
wiphy = priv->hw->wiphy;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 20/34] staging: vt6655: mac80211 conversion: device_free_info

2014-10-29 Thread Malcolm Priestley
Remove net device code and add mac80211 unregister code.

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 25 +++--
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 77d81b3..451b608 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -806,31 +806,20 @@ static bool device_get_pci_info(struct vnt_private 
*pDevice,
 
 static void device_free_info(struct vnt_private *pDevice)
 {
-   struct net_device *dev = pDevice->dev;
-
-   ASSERT(pDevice);
-//2008-0714-01by chester
-   device_release_WPADEV(pDevice);
-
-//2008-07-21-01by MikeLiu
-//unregister wpadev
-   if (wpa_set_wpadev(pDevice, 0) != 0)
-   pr_err("unregister wpadev fail?\n");
+   if (!pDevice)
+   return;
 
-#ifdef HOSTAP
-   if (dev)
-   vt6655_hostap_set_hostapd(pDevice, 0, 0);
-#endif
-   if (dev)
-   unregister_netdev(dev);
+   if (pDevice->mac_hw)
+   ieee80211_unregister_hw(pDevice->hw);
 
if (pDevice->PortOffset)
iounmap(pDevice->PortOffset);
 
if (pDevice->pcid)
pci_release_regions(pDevice->pcid);
-   if (dev)
-   free_netdev(dev);
+
+   if (pDevice->hw)
+   ieee80211_free_hw(pDevice->hw);
 }
 
 static bool device_init_rings(struct vnt_private *pDevice)
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 23/34] staging: vt6655: mac80211 conversion: device_error remove legacy functions

2014-10-29 Thread Malcolm Priestley
Remove netif_stop_queue, bCmdRunning and timer functions

Signed-off-by: Malcolm Priestley 
---
 drivers/staging/vt6655/device_main.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 451b608..0bd2ca8 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1313,10 +1313,6 @@ static void device_error(struct vnt_private *pDevice, 
unsigned short status)
if (status & ISR_FETALERR) {
dev_err(&pDevice->pcid->dev, "Hardware fatal error\n");
 
-   netif_stop_queue(pDevice->dev);
-   del_timer(&pDevice->sTimerCommand);
-   del_timer(&(pDevice->pMgmt->sTimerSecondCallback));
-   pDevice->bCmdRunning = false;
MACbShutdown(pDevice->PortOffset);
return;
}
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >