Re: [PATCH] ath10k: Fix deadlock when peer cannot be created.

2016-03-30 Thread Julian Calaby
Hi Ben,

On Thu, Mar 31, 2016 at 10:08 AM,   wrote:
> From: Ben Greear 
>
> We must not attempt to send WMI packets while dholding the data-lock,

s/dholding/holding/ ?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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: Fix deadlock when peer cannot be created.

2016-03-30 Thread greearb
From: Ben Greear 

We must not attempt to send WMI packets while dholding the data-lock,
as it may deadlock:

BUG: sleeping function called from invalid context at 
drivers/net/wireless/ath/ath10k/wmi.c:1824
in_atomic(): 1, irqs_disabled(): 0, pid: 2878, name: wpa_supplicant

=
[ INFO: possible recursive locking detected ]
4.4.6+ #21 Tainted: GW  O
-
wpa_supplicant/2878 is trying to acquire lock:
 (&(>data_lock)->rlock){+.-...}, at: [] 
ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]

but task is already holding lock:
 (&(>data_lock)->rlock){+.-...}, at: [] 
ath10k_peer_create+0x122/0x1ae [ath10k_core]

other info that might help us debug this:
 Possible unsafe locking scenario:

   CPU0
   
  lock(&(>data_lock)->rlock);
  lock(&(>data_lock)->rlock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by wpa_supplicant/2878:
 #0:  (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x12/0x14
 #1:  (>conf_mutex){+.+.+.}, at: [] 
ath10k_add_interface+0x3b/0xbda [ath10k_core]
 #2:  (&(>data_lock)->rlock){+.-...}, at: [] 
ath10k_peer_create+0x122/0x1ae [ath10k_core]
 #3:  (rcu_read_lock){..}, at: [] rcu_read_lock+0x0/0x66 
[mac80211]

stack backtrace:
CPU: 3 PID: 2878 Comm: wpa_supplicant Tainted: GW  O4.4.6+ #21
Hardware name: To be filled by O.E.M. To be filled by O.E.M./ChiefRiver, BIOS 
4.6.5 06/07/2013
  8801fcadf8f0 8137086d 82681720
 82681720 8801fcadf9b0 8112e3be 8801fcadf920
 0001 82681720 a0721500 8801fcb8d348
Call Trace:
 [] dump_stack+0x81/0xb6
 [] __lock_acquire+0xc5b/0xde7
 [] ? ath10k_wmi_tx_beacons_iter+0x15/0x11a [ath10k_core]
 [] ? mark_lock+0x24/0x201
 [] lock_acquire+0x132/0x1cb
 [] ? lock_acquire+0x132/0x1cb
 [] ? ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] _raw_spin_lock_bh+0x31/0x40
 [] ? ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ath10k_wmi_tx_beacons_iter+0x26/0x11a [ath10k_core]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] __iterate_interfaces+0x9d/0x13d [mac80211]
 [] ieee80211_iterate_active_interfaces_atomic+0x32/0x3e 
[mac80211]
 [] ? ath10k_wmi_cmd_send_nowait+0x1ce/0x1ce [ath10k_core]
 [] ath10k_wmi_tx_beacons_nowait.isra.13+0x14/0x16 
[ath10k_core]
 [] ath10k_wmi_cmd_send+0x71/0x242 [ath10k_core]
 [] ath10k_wmi_peer_delete+0x3f/0x42 [ath10k_core]
 [] ath10k_peer_create+0x15e/0x1ae [ath10k_core]
 [] ath10k_add_interface+0x70d/0xbda [ath10k_core]
 [] drv_add_interface+0x123/0x1a5 [mac80211]
 [] ieee80211_do_open+0x351/0x667 [mac80211]
 [] ieee80211_open+0x49/0x4c [mac80211]
 [] __dev_open+0x88/0xde
 [] __dev_change_flags+0xa4/0x13a
 [] dev_change_flags+0x1f/0x54
 [] devinet_ioctl+0x2b9/0x5c9
 [] ? copy_to_user+0x32/0x38
 [] inet_ioctl+0x81/0x9d
 [] ? inet_ioctl+0x81/0x9d
 [] sock_do_ioctl+0x20/0x3d
 [] sock_ioctl+0x222/0x22e
 [] do_vfs_ioctl+0x453/0x4d7
 [] ? __sys_recvmsg+0x4c/0x5b
 [] ? __fget_light+0x48/0x6c
 [] SyS_ioctl+0x52/0x74
 [] entry_SYSCALL_64_fastpath+0x16/0x7a

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

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 6e781e6..bf59a49 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -700,10 +700,10 @@ static int ath10k_peer_create(struct ath10k *ar,
 
peer = ath10k_peer_find(ar, vdev_id, addr);
if (!peer) {
+   spin_unlock_bh(>data_lock);
ath10k_warn(ar, "failed to find peer %pM on vdev %i after 
creation\n",
addr, vdev_id);
ath10k_wmi_peer_delete(ar, vdev_id, addr);
-   spin_unlock_bh(>data_lock);
return -ENOENT;
}
 
-- 
2.4.3

--
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/5] wireless: ti: Convert specialized logging macros to kernel style

2016-03-30 Thread Joe Perches
On Wed, 2016-03-30 at 14:51 +0300, Kalle Valo wrote:
> Joe Perches  writes:
> > Using the normal kernel logging mechanisms makes this code
> > a bit more like other wireless drivers.
> Personally I don't see the point but I don't have any strong opinions. A
> bigger problem is that TI drivers are not really in active development
> and that's I'm not thrilled to take big patches like this for dormant
> drivers.

Not very dormant.

35 patches in the last year, most of them adding functionality.

--
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] brcmfmac: Don't increase 8021x_cnt for dropped packets

2016-03-30 Thread per . forlin
From: Per Forlin 

The pend_8021x_cnt gets into a state where it's not being decreased.
When the brcmf_netdev_wait_pend8021x is called it will timeout
because there are no pending packets to be consumed. There is no
easy way of getting out of this state once it has happened.
Preventing the counter from being increased in case of dropped
packets seem like a reasonable solution.


Log showing overflow txq and increased cnt:

// Extra debug prints
brcmfmac: [brcmf_netdev_wait_pend8021x] pend_8021x_cnt == 0
brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 1
brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 2

brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!
brcmfmac: brcmf_sdio_bus_txdata: out of bus->txq !!!

// Extra debug prints
brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 3
brcmfmac: [brcmf_netdev_start_xmit] pend_8021x_cnt == 4
brcmfmac: [brcmf_netdev_wait_pend8021x] pend_8021x_cnt == 4

WARNING: at .../brcmfmac/core.c:1289 brcmf_netdev_wait_pend8021x
  (warn_slowpath_common)
  (warn_slowpath_null)
  (brcmf_netdev_wait_pend8021x [brcmfmac])
  (send_key_to_dongle [brcmfmac])
  (brcmf_cfg80211_del_key [brcmfmac])
  (nl80211_del_key [cfg80211])
  (genl_rcv_msg)
  (netlink_rcv_skb)
  (genl_rcv)
  (netlink_unicast)
  (netlink_sendmsg)
  (sock_sendmsg)
  (___sys_sendmsg)
  (__sys_sendmsg)
  (SyS_sendmsg)

Signed-off-by: Per Forlin 

---
I came across this bug in an older kernel but it seems relevant
for the latest kernel as well. I'm not familiar with the code
but I can reproduce the issue and verify a fix for it.
This patch seems to work for my use case but I need to run some more
tests to know for sure.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index ed9998b..8b1e30c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -241,7 +241,8 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff 
*skb,
 done:
if (ret) {
ifp->stats.tx_dropped++;
+   if (eh->h_proto == htons(ETH_P_PAE))
+   atomic_dec(>pend_8021x_cnt);
} else {
ifp->stats.tx_packets++;
ifp->stats.tx_bytes += skb->len;
-- 
2.1.4

--
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: Bonjour mDNS broacast can be lost during BT-WLAN coexistence schemes?

2016-03-30 Thread Adrian Chadd
Hi!

I don't know if you can do simulaneous wlan and BT RX - especially
since WLAN RX sometimes requires ACKs to be sent. :) But for
multicast, sure. You'd have to check the NIC schematic and antenna
switch programming to see if you can do simultaneous wlan RX (with no
TXing, eg RTS/CTS, ACK, etc) whilst also doing BT RX.

As for BT_ACTIVE -> powersave; I don't think you can get interrupts
based on that, but you can poll the gpio pin yourself and then tell
the driver to not transmit and/or enter sleep state. Entering sleep
state requires that you send some frame anyway to tell the AP you're
going to sleep.


-a
--
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: [lsb-discuss] Google Summer of Code 2016 - Many new applications

2016-03-30 Thread Till Kamppeter

On 03/28/2016 11:42 AM, Greg KH wrote:

On Sat, Mar 26, 2016 at 03:07:18PM -0300, Till Kamppeter wrote:

If there's anything else I need to do here, becides try to find a
co-mentor, please let me know.



I am grateful if you could enter as co-mentor, especially if there is any
kernel project now which has only one mentor.


I don't understand, we only have one kernel project with one proposed
mentor (me) right now, are we requiring all projects to have 2 mentors
now?  I've never done it that way in the past...


Generally, a single person can mentor a student, but if something 
unforeseen happens to a mentor, there is a backup. The backup mentor 
actually does not need to mentor as long as there is all OK with the 
primary mentor. He only needs to "WANT TO MENTOR" to later on be able to 
do the evaluations if the primary mentor is not able to do so.


   Till


--
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: Question on rhashtable in worst-case scenario.

2016-03-30 Thread Ben Greear

On 03/30/2016 09:38 AM, David Miller wrote:

From: Johannes Berg 
Date: Wed, 30 Mar 2016 11:14:12 +0200


On Tue, 2016-03-29 at 09:16 -0700, Ben Greear wrote:

Looks like rhashtable has too much policy in it to properly deal with
cases where there are too many hash collisions, so I am going to work
on reverting it's use in mac80211.


I'm not really all that happy with that approach - can't we fix the
rhashtable? It's a pretty rare corner case that many keys really are
identical and no kind of hash algorithm, but it seems much better to
still deal with it than to remove the rhashtable usage and go back to
hand-rolling something.


Yeah reverting seems like a really idiotic way to deal with the issue.



If someone can fix rhashtable, then great.
I read some earlier comments [1] back when someone else reported
similar problems, and the comments seemed to indicate that rhashtable was
broken in this manner on purpose to protect against hashing attacks.

If you are baking in this type of policy to what should be a basic
data-type, then it is not useful for how it is being used in
the mac80211 stack.

[1]  http://lkml.iu.edu/hypermail/linux/kernel/1512.2/01681.html

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: Question on rhashtable in worst-case scenario.

2016-03-30 Thread David Miller
From: Johannes Berg 
Date: Wed, 30 Mar 2016 11:14:12 +0200

> On Tue, 2016-03-29 at 09:16 -0700, Ben Greear wrote:
>> Looks like rhashtable has too much policy in it to properly deal with
>> cases where there are too many hash collisions, so I am going to work
>> on reverting it's use in mac80211.
> 
> I'm not really all that happy with that approach - can't we fix the
> rhashtable? It's a pretty rare corner case that many keys really are
> identical and no kind of hash algorithm, but it seems much better to
> still deal with it than to remove the rhashtable usage and go back to
> hand-rolling something.

Yeah reverting seems like a really idiotic way to deal with the issue.
--
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 3/3] ath10k: fix unconditional num_mpdus_ready subtraction

2016-03-30 Thread Rajkumar Manoharan
Decrement num_mpdus_ready only when rx amsdu is processed successfully.
Not doing so, will result in leak and impact stabilty under low memory
cases.

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

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 96a7417..9696c2e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2412,14 +2412,12 @@ static void ath10k_htt_txrx_compl_task(unsigned long 
ptr)
struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
struct ath10k *ar = htt->ar;
struct htt_tx_done tx_done = {};
-   struct sk_buff_head rx_q;
struct sk_buff_head rx_ind_q;
struct sk_buff_head tx_ind_q;
struct sk_buff *skb;
unsigned long flags;
int num_mpdus;
 
-   __skb_queue_head_init(_q);
__skb_queue_head_init(_ind_q);
__skb_queue_head_init(_ind_q);
 
@@ -2448,11 +2446,13 @@ static void ath10k_htt_txrx_compl_task(unsigned long 
ptr)
ath10k_mac_tx_push_pending(ar);
 
num_mpdus = atomic_read(>num_mpdus_ready);
-   atomic_sub(num_mpdus, >num_mpdus_ready);
 
-   while (num_mpdus--) {
+   while (num_mpdus) {
if (ath10k_htt_rx_handle_amsdu(htt))
break;
+
+   num_mpdus--;
+   atomic_dec(>num_mpdus_ready);
}
 
while ((skb = __skb_dequeue(_ind_q))) {
-- 
2.7.4

--
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 2/3] ath10k: remove unnecessary warning for probe response drops

2016-03-30 Thread Rajkumar Manoharan
qca99x0 and qca4019 solutions limit probe responses transmissions.
Logging warning message for each probe response drop is flooding
kernel log unnecessary with " failed to increase tx mgmt pending
count: -16, dropping". Hence reducing log level to debug.

Reported-by: Sebastian Gottschall 
Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index ed00853..a7aafb35c 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3994,8 +3994,8 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
 
ret = ath10k_htt_tx_mgmt_inc_pending(htt, is_mgmt, is_presp);
if (ret) {
-   ath10k_warn(ar, "failed to increase tx mgmt pending 
count: %d, dropping\n",
-   ret);
+   ath10k_dbg(ar, ATH10K_DBG_MAC, "failed to increase tx 
mgmt pending count: %d, dropping\n",
+  ret);
ath10k_htt_tx_dec_pending(htt);
spin_unlock_bh(>htt.tx_lock);
ieee80211_free_txskb(ar->hw, skb);
-- 
2.7.4

--
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/3] ath10k: fix calibration init sequence of qca99x0

2016-03-30 Thread Rajkumar Manoharan
pre-calibration is meant for qca4019 which contains only caldata
whereas calibration file is used by ar9888 and qca99x0 that contains
both board data and caldata. So by definition both pre-cal-file and
cal-file can not coexist. Keeping them in shared memory (union), is
breaking boot sequence of qca99x0. Fix it by storing both binaries
in separate memories. This issue is reported in ipq8064 platform which
includes caldata in flash memory.

Reported-by: Sebastian Gottschall 
Signed-off-by: Rajkumar Manoharan 
---
 drivers/net/wireless/ath/ath10k/core.h | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index b6c157e..a7d04bc 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -725,10 +725,8 @@ struct ath10k {
const void *firmware_data;
size_t firmware_len;
 
-   union {
-   const struct firmware *pre_cal_file;
-   const struct firmware *cal_file;
-   };
+   const struct firmware *pre_cal_file;
+   const struct firmware *cal_file;
 
struct {
const void *firmware_codeswap_data;
-- 
2.7.4

--
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: [RFC] ath10k: implement dql for htt tx

2016-03-30 Thread Ben Greear

On 03/30/2016 02:22 AM, Michal Kazior wrote:

On 29 March 2016 at 17:54, Ben Greear  wrote:

On 03/29/2016 12:49 AM, Michal Kazior wrote:


if you are getting a pure codel result of 160ms, that means the
implementation is broken. But I think (after having read your
description twice), the baseline result today of 160ms of queuing was
with a fq_codel *qdisc* doing the work on top of huge buffers,



Yes. The 160ms is with fq_codel qdisc with ath10k doing DQL at 6mbps.
Without DQL ath10k would clog up all tx slots (1424 of them) with
frames. At 6mbps you typically want/need a handful (5-10) of frames to
be queued.



Have you actually verified you can use all tx slots?


It works in most cases. I guess you're suspecting some of your
tx(flushing?) problems might be induced by overcommiting?


The way the
firmware uses it's tx buffers I think you may not be able to actually
do that...and in practice, you will get a lot fewer usable tx-buffers
than configured


Could be, e.g. I'm aware management frames are kind of a special case
in recent firmware revisions.

What would/do you expect firmware would/will do when we overcommit?
The driver does advertise number of HTT tx slots so I would expect it
to work fine if it didn't crash during boot.


The firmware will return something like tx-dropped immediately.  The reason
is that the firmware keeps more than one internal priority queue, and in 
general, reserves
some of the tx-descriptors for high priority.

So, you never see tx-queues completely full in the driver, so tx queues are
not stopped farther up the stack.

Possibly I am confused about some of this, so I'm quite curious if you ever see
tx-queues determined to be full in the ath10k driver.

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


[PATCH 28/43] iwlwifi: mvm: remove uneeded D0I3 checking

2016-03-30 Thread Emmanuel Grumbach
From: Chaya Rachel Ivgi 

The driver can read the current state during D0I3,
therefore there is no reason not to do it.

Signed-off-by: Chaya Rachel Ivgi 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 8d27137..3f5df76 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -787,9 +787,6 @@ static int iwl_mvm_tcool_get_cur_state(struct 
thermal_cooling_device *cdev,
 {
struct iwl_mvm *mvm = (struct iwl_mvm *)(cdev->devdata);
 
-   if (test_bit(IWL_MVM_STATUS_IN_D0I3, >status))
-   return -EBUSY;
-
*state = mvm->cooling_dev.cur_state;
 
return 0;
-- 
2.5.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 41/43] iwlwifi: mvm: fix inconsistent lock in dqa mode

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

When working in DQA mode, there is a lockdep log warning
about an inconsistent state of the mvmsta->lock and the
mvm->queue_info_lock. Fix this. This mode is not activated
for now.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index e157bd5..12614b7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -296,7 +296,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
 
lockdep_assert_held(>mutex);
 
-   spin_lock(>queue_info_lock);
+   spin_lock_bh(>queue_info_lock);
 
/*
 * Non-QoS, QoS NDP and MGMT frames should go to a MGMT queue, if one
@@ -324,7 +324,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
if (queue >= 0)
mvm->queue_info[queue].setup_reserved = false;
 
-   spin_unlock(>queue_info_lock);
+   spin_unlock_bh(>queue_info_lock);
 
/* TODO: support shared queues for same RA */
if (queue < 0)
@@ -402,12 +402,12 @@ static void iwl_mvm_tx_deferred_stream(struct iwl_mvm 
*mvm,
 
__skb_queue_head_init(_tx);
 
+   /* Disable bottom-halves when entering TX path */
+   local_bh_disable();
spin_lock(>lock);
skb_queue_splice_init(_data->deferred_tx_frames, _tx);
spin_unlock(>lock);
 
-   /* Disable bottom-halves when entering TX path */
-   local_bh_disable();
while ((skb = __skb_dequeue(_tx)))
if (no_queue || iwl_mvm_tx_skb(mvm, skb, sta))
ieee80211_free_txskb(mvm->hw, skb);
-- 
2.5.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 31/43] iwlwifi: edit the 9000 series PCI IDs

2016-03-30 Thread Emmanuel Grumbach
From: Oren Givon 

Edit some of the 9560 series and 5165 series PCI IDs.
These devices do not exist yet.

Signed-off-by: Oren Givon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index fb8b5ec..41c6dd5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -483,17 +483,19 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
{IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)},
 
 /* 9000 Series */
+   {IWL_PCI_DEVICE(0x9DF0, 0x0A10, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9560_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x2010, iwl5165_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x2526, 0x0A10, iwl9560_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x2526, 0x0010, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x1420, iwl5165_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0010, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0310, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0510, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0710, iwl5165_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9560_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x2526, 0x0410, iwl9560_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x2526, 0x0610, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0210, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0410, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x9DF0, 0x0610, iwl9560_2ac_cfg)},
 #endif /* CONFIG_IWLMVM */
 
{0}
-- 
2.5.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 v6 1/2] dt: bindings: add MARVELL's sd8xxx wireless device

2016-03-30 Thread Rob Herring
On Wed, Mar 30, 2016 at 8:19 AM, Amitkumar Karwar  wrote:
> From: Xinming Hu 
>
> Add device tree binding documentation for MARVELL's sd8xxx
> (sd8897 and sd8997) wlan chip.
>
> Signed-off-by: Xinming Hu 
> Signed-off-by: Amitkumar Karwar 
> ---
> Listing changelist for both 1/2 and 2/2 patches
> v3: Don't update adapter->dt_node if mwifiex_plt_dev is NULL
>
> v4: a)Corrected the 'name' and 'compatible' property names.(Arnd Bergmann and 
> Rob
> Herring)
> b)Patch description wraped in 72 columns(Rob Herring)
> c)Moved DT binding file to bindings/net/wireless/(Rob Herring)
> d)Renamed "mwifiex,chip-gpio" to "marvell,wakeup-gpios"(Rob Herring/
> Arnd Bergmann)
> e)Replaced #ifdef with __maybe_unused(Arnd Bergmann)
>
> v5: a)Removed wildcards from compatible string(Arnd Bergmann)
> b)Prepared single patch for all binding changes(Rob Herring)
> c)Specified our node as a subnode of SDIO controller. With this approach, 
> we
> don't need to register new platform driver. (Rob herring)
>
> v6: a)List out the specific property names for marvell,caldata* and size of 
> the data(Rob Herring)
> b)Use sdio function number for both the unit address and reg(Rob Herring)
> ---
>  .../bindings/net/wireless/marvell-sd8xxx.txt   | 63 
> ++
>  1 file changed, 63 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
>
> diff --git 
> a/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt 
> b/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
> new file mode 100644
> index 000..337fed4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
> @@ -0,0 +1,63 @@
> +Marvell 8897/8997 (sd8897/sd8997) SDIO devices
> +--
> +
> +This node provides properties for controlling the marvell sdio wireless 
> device.
> +The node is expected to be specified as a child node to the SDIO controller 
> that
> +connects the device to the system.
> +
> +Required properties:
> +
> +  - compatible : should be one of the following:
> +   * "marvell,sd8897"
> +   * "marvell,sd8997"
> +
> +Optional properties:
> +
> +  - marvell,caldata* : A series of properties with marvell,caldata prefix,
> + represent calibration data downloaded to the device 
> during
> + initialization. This is an array of unsigned values.

unsigned 8-bit values...

> + the properties should follow below property name and
> + corresponding array length:
> +   "marvell,caldata_00_txpwrlimit_2g_cfg_set" (length = 566).
> +   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub0" (length = 502).
> +   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub1" (length = 688).
> +   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub2" (length = 750).
> +   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub3" (length = 502).

The 00 and cfg_set seem pretty pointless, and '-' is preferred over '_'. So:

marvell,caldata-txpwrlimit-5g-sub3

> +  - marvell,wakeup-pin : 'wakeuppin' is a wakeup pin number of wifi chip 
> which will

Drop "wakeuppin is"

> + be configured to firmware. firmware will wakeup host 
> side use
> + the pin during suspend/resume stage.
> +  - interrupt-parent: phandle of the parent interrupt controller
> +  - interrupts : interrupt pin number to the cpu. driver will request an irq 
> based on
> +this interrupt number. during system suspend, the irq will 
> be enabled
> +as system wakeup source, so that the wifi chip can wakeup 
> host

You need to use the wakeup-source binding here
(bindings/power/wakeup-source.txt). Probably on the BT binding too?

> +platform under certain condition. during system resume, the 
> irq will
> +be disabled to make sure unnecessary interrupt is not 
> received.
> +
> +Example:
> +
> +Tx power limit calibration data is configured in below example.
> +The calibration data is an array of unsigned values, the length
> +can vary between hw versions.
> +IRQ pin 38 is used as system wakeup source interrupt. wakeup pin 3 is 
> configured
> +so that firmware can wakeup host using this device side pin.
> +
> + {
> +   status = "okay";
> +   vmmc-supply = <_en_reg>;
> +   bus-width = <4>;
> +   cap-power-off-card;
> +   keep-power-in-suspend;
> +
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   mwifiex: mwifiex@1 {

wifi@1

> +   compatible = "marvell,sd8897";
> +   reg = <1>;
> +   interrupt-parent = <>;
> +   interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
> +
> +   marvell,caldata_00_txpwrlimit_2g_cfg_set = /bits/ 8 <
> +   0x01 0x00 0x06 0x00 0x08 0x02 0x89 0x01>;
> +   marvell,wakeup-pin = <3>;
> 

[PATCH 04/43] iwlwifi: mvm: support dumping UMAC internal txfifos

2016-03-30 Thread Emmanuel Grumbach
From: Golan Ben-Ami 

In case of FW error, support dumping the UMAC internal txfifos.
To do so, support version 2 of shared memory cfg command, which
contains the sizes of the internal txfifos, and move the command
to the system group.

Signed-off-by: Golan Ben-Ami 
Signed-off-by: Emmanuel Grumbach 
---
 .../net/wireless/intel/iwlwifi/iwl-fw-error-dump.h |  1 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h   |  3 +
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h  | 12 
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h| 17 -
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c| 79 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c| 28 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  3 +
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   |  8 +++
 8 files changed, 146 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
index 8425e1a..09b7ea2 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h
@@ -105,6 +105,7 @@ enum iwl_fw_error_dump_type {
IWL_FW_ERROR_DUMP_RB = 11,
IWL_FW_ERROR_DUMP_PAGING = 12,
IWL_FW_ERROR_DUMP_RADIO_REG = 13,
+   IWL_FW_ERROR_DUMP_INTERNAL_TXF = 14,
 
IWL_FW_ERROR_DUMP_MAX,
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index 15ec4e2..3a72b97 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -324,6 +324,8 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
  * @IWL_UCODE_TLV_CAPA_CTDP_SUPPORT: supports cTDP command
  * @IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED: supports usniffer enabled in
  * regular image.
+ * @IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared
+ * memory addresses from the firmware.
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -361,6 +363,7 @@ enum iwl_ucode_tlv_capa {
IWL_UCODE_TLV_CAPA_TEMP_THS_REPORT_SUPPORT  = (__force 
iwl_ucode_tlv_capa_t)75,
IWL_UCODE_TLV_CAPA_CTDP_SUPPORT = (__force 
iwl_ucode_tlv_capa_t)76,
IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED = (__force 
iwl_ucode_tlv_capa_t)77,
+   IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG= (__force 
iwl_ucode_tlv_capa_t)80,
 
NUM_IWL_UCODE_TLV_CAPA
 #ifdef __CHECKER__
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
index c46e596..6c1d20d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2016Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
+ * Copyright(c) 2016Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -345,6 +347,16 @@ enum secure_load_status_reg {
 #define TXF_READ_MODIFY_DATA   (0xa00448)
 #define TXF_READ_MODIFY_ADDR   (0xa0044c)
 
+/* UMAC Internal Tx Fifo */
+#define TXF_CPU2_FIFO_ITEM_CNT (0xA00538)
+#define TXF_CPU2_WR_PTR(0xA00514)
+#define TXF_CPU2_RD_PTR(0xA00510)
+#define TXF_CPU2_FENCE_PTR (0xA00518)
+#define TXF_CPU2_LOCK_FENCE(0xA00524)
+#define TXF_CPU2_NUM   (0xA0053C)
+#define TXF_CPU2_READ_MODIFY_DATA  (0xA00548)
+#define TXF_CPU2_READ_MODIFY_ADDR  (0xA0054C)
+
 /* Radio registers access */
 #define RSP_RADIO_CMD  (0xa02804)
 #define RSP_RADIO_RDDAT(0xa02814)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 4a0fc47..61711b1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -287,6 +287,10 @@ enum iwl_phy_ops_subcmd_ids {
DTS_MEASUREMENT_NOTIF_WIDE = 0xFF,
 };
 
+enum iwl_system_subcmd_ids {
+   SHARED_MEM_CFG_CMD = 0x0,
+};
+
 enum iwl_data_path_subcmd_ids {
UPDATE_MU_GROUPS_CMD = 0x1,
TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2,
@@ -302,6 +306,7 @@ enum iwl_prot_offload_subcmd_ids {
 enum {
LEGACY_GROUP = 0x0,
LONG_GROUP = 0x1,
+   SYSTEM_GROUP = 0x2,
PHY_OPS_GROUP = 0x4,
DATA_PATH_GROUP = 0x5,

[PATCH 25/43] iwlwifi: mvm: report checksum is done also for IPv6 packets

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

Currently the code checks if hardware reported both L4 and L3
checksums as valid, and only then reports it as validated to
the stack.
However, IPv6 does not have checksum at all and the L3 checksum
valid bit is always off for IPv6 packets, with the result of the
stack re-validating L4 checksum.
Fix code to set CHECKSUM_UNNECESSARY also for IPv6 packets whose
TCP/UDP checksum was verified.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h | 15 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c  |  9 +++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
index 7a16e55..4c086d0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rx.h
@@ -268,12 +268,25 @@ enum iwl_rx_mpdu_amsdu_info {
IWL_RX_MPDU_AMSDU_LAST_SUBFRAME = 0x80,
 };
 
+enum iwl_rx_l3_proto_values {
+   IWL_RX_L3_TYPE_NONE,
+   IWL_RX_L3_TYPE_IPV4,
+   IWL_RX_L3_TYPE_IPV4_FRAG,
+   IWL_RX_L3_TYPE_IPV6_FRAG,
+   IWL_RX_L3_TYPE_IPV6,
+   IWL_RX_L3_TYPE_IPV6_IN_IPV4,
+   IWL_RX_L3_TYPE_ARP,
+   IWL_RX_L3_TYPE_EAPOL,
+};
+
+#define IWL_RX_L3_PROTO_POS 4
+
 enum iwl_rx_l3l4_flags {
IWL_RX_L3L4_IP_HDR_CSUM_OK  = BIT(0),
IWL_RX_L3L4_TCP_UDP_CSUM_OK = BIT(1),
IWL_RX_L3L4_TCP_FIN_SYN_RST_PSH = BIT(2),
IWL_RX_L3L4_TCP_ACK = BIT(3),
-   IWL_RX_L3L4_L3_PROTO_MASK   = 0xf << 4,
+   IWL_RX_L3L4_L3_PROTO_MASK   = 0xf << IWL_RX_L3_PROTO_POS,
IWL_RX_L3L4_L4_PROTO_MASK   = 0xf << 8,
IWL_RX_L3L4_RSS_HASH_MASK   = 0xf << 12,
 };
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 9a54f2d..b2bc3d9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -294,10 +294,15 @@ static void iwl_mvm_rx_csum(struct ieee80211_sta *sta,
 {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
+   u16 flags = le16_to_cpu(desc->l3l4_flags);
+   u8 l3_prot = (u8)((flags & IWL_RX_L3L4_L3_PROTO_MASK) >>
+ IWL_RX_L3_PROTO_POS);
 
if (mvmvif->features & NETIF_F_RXCSUM &&
-   desc->l3l4_flags & cpu_to_le16(IWL_RX_L3L4_IP_HDR_CSUM_OK) &&
-   desc->l3l4_flags & cpu_to_le16(IWL_RX_L3L4_TCP_UDP_CSUM_OK))
+   flags & IWL_RX_L3L4_TCP_UDP_CSUM_OK &&
+   (flags & IWL_RX_L3L4_IP_HDR_CSUM_OK ||
+l3_prot == IWL_RX_L3_TYPE_IPV6 ||
+l3_prot == IWL_RX_L3_TYPE_IPV6_FRAG))
skb->ip_summed = CHECKSUM_UNNECESSARY;
 }
 
-- 
2.5.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 29/43] iwlwifi: pcie: request one more interrupt vector

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

We want to request an interrupt vector for RSS queue per CPU,
one vector for fallback queue, and one for non-rx interrupts.
Future patch will make sure that no RSS traffic is directed to
fallback queue.
This will enable us to enable fast path on traffic that otherwise
would have been received on the fallback queue.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 0c40209..f1a506b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1435,7 +1435,7 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev 
*pdev,
int ret, i;
 
if (trans->cfg->mq_rx_supported) {
-   max_vector = min_t(u32, (num_possible_cpus() + 1),
+   max_vector = min_t(u32, (num_possible_cpus() + 2),
   IWL_MAX_RX_HW_QUEUES);
for (i = 0; i < max_vector; i++)
trans_pcie->msix_entries[i].entry = i;
-- 
2.5.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 37/43] iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

Declare and enable support of RX and TX checksum for 9000 family.
Configure offload_assist in the TX cmd accordingly to support
TX csum.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c |   1 +
 drivers/net/wireless/intel/iwlwifi/iwl-config.h   |   2 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  13 +--
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c   | 124 +-
 4 files changed, 133 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
index 277396a..1f25ba6 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
@@ -137,6 +137,7 @@ static const struct iwl_tt_params iwl9000_tt_params = {
.dccm2_len = IWL9000_DCCM2_LEN, \
.smem_offset = IWL9000_SMEM_OFFSET, \
.smem_len = IWL9000_SMEM_LEN,   \
+   .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,   \
.thermal_params = _tt_params,   \
.apmg_not_supported = true, \
.mq_rx_supported = true,\
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 8cbd248..b002557 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -131,6 +131,8 @@ enum iwl_led_mode {
 #define IWL_MAX_WD_TIMEOUT 12
 
 #define IWL_DEFAULT_MAX_TX_POWER 22
+#define IWL_TX_CSUM_NETIF_FLAGS (NETIF_F_IPV6_CSUM | NETIF_F_IP_CSUM |\
+NETIF_F_TSO | NETIF_F_TSO6)
 
 /* Antenna presence definitions */
 #defineANT_NONE0x0
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 115d7aa..4f5ec49 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -665,12 +665,13 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
}
 
hw->netdev_features |= mvm->cfg->features;
-   if (!iwl_mvm_is_csum_supported(mvm))
-   hw->netdev_features &= ~NETIF_F_RXCSUM;
-
-   if (IWL_MVM_SW_TX_CSUM_OFFLOAD)
-   hw->netdev_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-   NETIF_F_TSO | NETIF_F_TSO6;
+   if (!iwl_mvm_is_csum_supported(mvm)) {
+   hw->netdev_features &= ~(IWL_TX_CSUM_NETIF_FLAGS |
+NETIF_F_RXCSUM);
+   /* We may support SW TX CSUM */
+   if (IWL_MVM_SW_TX_CSUM_OFFLOAD)
+   hw->netdev_features |= IWL_TX_CSUM_NETIF_FLAGS;
+   }
 
ret = ieee80211_register_hw(mvm->hw);
if (ret)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 24cff98..efb9b98 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "iwl-trans.h"
 #include "iwl-eeprom-parse.h"
@@ -98,6 +99,111 @@ iwl_mvm_bar_check_trigger(struct iwl_mvm *mvm, const u8 
*addr,
addr, tid, ssn);
 }
 
+#define OPT_HDR(type, skb, off) \
+   (type *)(skb_network_header(skb) + (off))
+
+static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
+   struct ieee80211_hdr *hdr,
+   struct ieee80211_tx_info *info,
+   struct iwl_tx_cmd *tx_cmd)
+{
+#if IS_ENABLED(CONFIG_INET)
+   u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
+   u16 offload_assist = le16_to_cpu(tx_cmd->offload_assist);
+   u8 protocol = 0;
+
+   /*
+* Do not compute checksum if already computed or if transport will
+* compute it
+*/
+   if (skb->ip_summed != CHECKSUM_PARTIAL || IWL_MVM_SW_TX_CSUM_OFFLOAD)
+   return;
+
+   /* We do not expect to be requested to csum stuff we do not support */
+   if (WARN_ONCE(!(mvm->hw->netdev_features & IWL_TX_CSUM_NETIF_FLAGS) ||
+ (skb->protocol != htons(ETH_P_IP) &&
+  skb->protocol != htons(ETH_P_IPV6)),
+ "No support for requested checksum\n")) {
+   skb_checksum_help(skb);
+   return;
+   }
+
+   if (skb->protocol == htons(ETH_P_IP)) {
+   protocol = ip_hdr(skb)->protocol;
+   } else {
+#if IS_ENABLED(CONFIG_IPV6)
+   struct ipv6hdr *ipv6h =
+   (struct ipv6hdr *)skb_network_header(skb);
+ 

[PATCH 32/43] iwlwifi: mvm: use bss client queue for bss station

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

Use the reserved BSS Client queue when connecting to an AP
in DQA mode.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h |  3 +++
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c| 18 +-
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 8217eb2..9652687 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -89,6 +89,8 @@ enum {
 /*
  * DQA queue numbers
  *
+ * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
+ * that we are never left without the possibility to connect to an AP.
  * @IWL_MVM_DQA_MIN_MGMT_QUEUE: first TXQ in pool for MGMT and non-QOS frames.
  * Each MGMT queue is mapped to a single STA
  * MGMT frames are frames that return true on ieee80211_is_mgmt()
@@ -100,6 +102,7 @@ enum {
  * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
  */
 enum iwl_mvm_dqa_txq {
+   IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4,
IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
IWL_MVM_DQA_MIN_DATA_QUEUE = 10,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 3f36a66..e157bd5 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -336,7 +336,8 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
 * as aggregatable.
 * Mark all DATA queues as allowing to be aggregated at some point
 */
-   cfg.aggregate = (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE);
+   cfg.aggregate = (queue >= IWL_MVM_DQA_MIN_DATA_QUEUE ||
+queue == IWL_MVM_DQA_BSS_CLIENT_QUEUE);
 
IWL_DEBUG_TX_QUEUES(mvm, "Allocating queue #%d to sta %d on tid %d\n",
queue, mvmsta->sta_id, tid);
@@ -448,7 +449,8 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
 }
 
 static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm,
- struct ieee80211_sta *sta)
+ struct ieee80211_sta *sta,
+ enum nl80211_iftype vif_type)
 {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
int queue;
@@ -456,8 +458,13 @@ static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm,
spin_lock_bh(>queue_info_lock);
 
/* Make sure we have free resources for this STA */
-   queue = iwl_mvm_find_free_queue(mvm, IWL_MVM_DQA_MIN_DATA_QUEUE,
-   IWL_MVM_DQA_MAX_DATA_QUEUE);
+   if (vif_type == NL80211_IFTYPE_STATION && !sta->tdls &&
+   !mvm->queue_info[IWL_MVM_DQA_BSS_CLIENT_QUEUE].hw_queue_refcount &&
+   !mvm->queue_info[IWL_MVM_DQA_BSS_CLIENT_QUEUE].setup_reserved)
+   queue = IWL_MVM_DQA_BSS_CLIENT_QUEUE;
+   else
+   queue = iwl_mvm_find_free_queue(mvm, IWL_MVM_DQA_MIN_DATA_QUEUE,
+   IWL_MVM_DQA_MAX_DATA_QUEUE);
if (queue < 0) {
spin_unlock_bh(>queue_info_lock);
IWL_ERR(mvm, "No available queues for new station\n");
@@ -551,7 +558,8 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
}
 
if (iwl_mvm_is_dqa_supported(mvm)) {
-   ret = iwl_mvm_reserve_sta_stream(mvm, sta);
+   ret = iwl_mvm_reserve_sta_stream(mvm, sta,
+ieee80211_vif_type_p2p(vif));
if (ret)
goto err;
}
-- 
2.5.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 13/43] iwlwifi: pcie: do not pad QoS AMSDU

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

We insert padding if the MAC header's size is not a multiple of 4
to ensure that the SNAP header is DWORD aligned. When we do so, we
let the firmware know by setting a bit in Tx command
(TX_CMD_FLG_MH_PAD) which will instruct the firmware to drop those
2 bytes before sending the frame.
However, this is not needed for AMSDU as the sub frame header (14B)
complements the MAC header (26B) so that the SNAP header is DWORD
aligned without adding any pad.

Until 9000, the firmware didn't check the TX_CMD_FLG_MH_PAD bit
but rather checked the length of the MAC header itself and
assumed the entity that enqueued the frame (driver or internal
firmware code) added the pad.
Since the driver inserted the pad even for AMSDU this logic applied.
Note that the padding is a DMA optimization but it's not strictly
needed, so we could pad even if it was not needed.

However, the CSUM hardware introduced for the 9000 devices requires
to not pad AMSDU as it is not needed, and will fail if such a pad
exists.
Due to older FW not checking the padding bit but checking the mac
header size itself - we cannot do this adjustments for older
generations.
Do not align the size if it is an AMSDU and HW checksum is enabled -
which will only happen on 9000 devices and on.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index cc6fa00..e1f7a3f 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -2210,6 +2210,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct 
sk_buff *skb,
__le16 fc;
u8 hdr_len;
u16 wifi_seq;
+   bool amsdu;
 
txq = _pcie->txq[txq_id];
q = >q;
@@ -2301,11 +2302,18 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct 
sk_buff *skb,
 */
len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) +
  hdr_len - IWL_HCMD_SCRATCHBUF_SIZE;
-   tb1_len = ALIGN(len, 4);
-
-   /* Tell NIC about any 2-byte padding after MAC header */
-   if (tb1_len != len)
-   tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
+   /* do not align A-MSDU to dword as the subframe header aligns it */
+   amsdu = ieee80211_is_data_qos(fc) &&
+   (*ieee80211_get_qos_ctl(hdr) &
+IEEE80211_QOS_CTL_A_MSDU_PRESENT);
+   if (trans_pcie->sw_csum_tx || !amsdu) {
+   tb1_len = ALIGN(len, 4);
+   /* Tell NIC about any 2-byte padding after MAC header */
+   if (tb1_len != len)
+   tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
+   } else {
+   tb1_len = len;
+   }
 
/* The first TB points to the scratchbuf data - min_copy bytes */
memcpy(>scratchbufs[q->write_ptr], _cmd->hdr,
@@ -2323,8 +2331,7 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct 
sk_buff *skb,
goto out_err;
iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, false);
 
-   if (ieee80211_is_data_qos(fc) &&
-   (*ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_A_MSDU_PRESENT)) {
+   if (amsdu) {
if (unlikely(iwl_fill_data_tbs_amsdu(trans, skb, txq, hdr_len,
 out_meta, dev_cmd,
 tb1_len)))
-- 
2.5.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 38/43] iwlwifi: remove IWL_*_UCODE_API_OK

2016-03-30 Thread Emmanuel Grumbach
_UCODE_API_OK was a intermediate version between MIN and
MAX. If a user had a firmware below _OK but above _MIN, the
driver would work but the user would get a warning in the
kernel log telling him to update his firmware.
This is not needed since most users won't look for these
messages in the kernel log if their wifi is working.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-1000.c   | 10 ++
 drivers/net/wireless/intel/iwlwifi/iwl-2000.c   | 18 --
 drivers/net/wireless/intel/iwlwifi/iwl-5000.c   | 11 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-6000.c   | 20 
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c   | 20 +---
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c   | 11 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c   |  6 +-
 drivers/net/wireless/intel/iwlwifi/iwl-config.h |  3 ---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c| 24 +---
 9 files changed, 21 insertions(+), 102 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-1000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-1000.c
index a90dbab..ef22c3d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-1000.c
@@ -34,10 +34,6 @@
 #define IWL1000_UCODE_API_MAX 5
 #define IWL100_UCODE_API_MAX 5
 
-/* Oldest version we won't warn about */
-#define IWL1000_UCODE_API_OK 5
-#define IWL100_UCODE_API_OK 5
-
 /* Lowest firmware API version supported */
 #define IWL1000_UCODE_API_MIN 1
 #define IWL100_UCODE_API_MIN 5
@@ -86,7 +82,6 @@ static const struct iwl_eeprom_params iwl1000_eeprom_params = 
{
 #define IWL_DEVICE_1000\
.fw_name_pre = IWL1000_FW_PRE,  \
.ucode_api_max = IWL1000_UCODE_API_MAX, \
-   .ucode_api_ok = IWL1000_UCODE_API_OK,   \
.ucode_api_min = IWL1000_UCODE_API_MIN, \
.device_family = IWL_DEVICE_FAMILY_1000,\
.max_inst_size = IWLAGN_RTC_INST_SIZE,  \
@@ -112,7 +107,6 @@ const struct iwl_cfg iwl1000_bg_cfg = {
 #define IWL_DEVICE_100 \
.fw_name_pre = IWL100_FW_PRE,   \
.ucode_api_max = IWL100_UCODE_API_MAX,  \
-   .ucode_api_ok = IWL100_UCODE_API_OK,\
.ucode_api_min = IWL100_UCODE_API_MIN,  \
.device_family = IWL_DEVICE_FAMILY_100, \
.max_inst_size = IWLAGN_RTC_INST_SIZE,  \
@@ -136,5 +130,5 @@ const struct iwl_cfg iwl100_bg_cfg = {
IWL_DEVICE_100,
 };
 
-MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK));
-MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK));
+MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
+MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX));
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-2000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-2000.c
index a6da959..dc246c9 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-2000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-2000.c
@@ -36,12 +36,6 @@
 #define IWL105_UCODE_API_MAX 6
 #define IWL135_UCODE_API_MAX 6
 
-/* Oldest version we won't warn about */
-#define IWL2030_UCODE_API_OK 6
-#define IWL2000_UCODE_API_OK 6
-#define IWL105_UCODE_API_OK 6
-#define IWL135_UCODE_API_OK 6
-
 /* Lowest firmware API version supported */
 #define IWL2030_UCODE_API_MIN 5
 #define IWL2000_UCODE_API_MIN 5
@@ -114,7 +108,6 @@ static const struct iwl_eeprom_params iwl20x0_eeprom_params 
= {
 #define IWL_DEVICE_2000\
.fw_name_pre = IWL2000_FW_PRE,  \
.ucode_api_max = IWL2000_UCODE_API_MAX, \
-   .ucode_api_ok = IWL2000_UCODE_API_OK,   \
.ucode_api_min = IWL2000_UCODE_API_MIN, \
.device_family = IWL_DEVICE_FAMILY_2000,\
.max_inst_size = IWL60_RTC_INST_SIZE,   \
@@ -142,7 +135,6 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = {
 #define IWL_DEVICE_2030\
.fw_name_pre = IWL2030_FW_PRE,  \
.ucode_api_max = IWL2030_UCODE_API_MAX, \
-   .ucode_api_ok = IWL2030_UCODE_API_OK,   \
.ucode_api_min = IWL2030_UCODE_API_MIN, \
.device_family = IWL_DEVICE_FAMILY_2030,\
.max_inst_size = IWL60_RTC_INST_SIZE,   \
@@ -163,7 +155,6 @@ const struct iwl_cfg iwl2030_2bgn_cfg = {
 #define IWL_DEVICE_105 \
.fw_name_pre = IWL105_FW_PRE,   \
.ucode_api_max = IWL105_UCODE_API_MAX,  \
-  

[PATCH 27/43] iwlwifi: trans: fix iwl_trans_txq_scd_cfg.sta_id sign

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

For some reason, this was defined as a signed variable.
Make it unsigned.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 91d74b3..fa4ab4b 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -7,6 +7,7 @@
  *
  * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -33,6 +34,7 @@
  *
  * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -519,7 +521,7 @@ struct iwl_trans;
 
 struct iwl_trans_txq_scd_cfg {
u8 fifo;
-   s8 sta_id;
+   u8 sta_id;
u8 tid;
bool aggregate;
int frame_limit;
-- 
2.5.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 07/43] iwlwifi: pcie: fix global table size

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

My patch resized the pool size, but neglected to resize
the global table, which is obviously wrong since the global
table maps the pool's rxb to vid one to one. This results
in a panic in 9000 devices.
Add a build bug to avoid such a case in the future.

Fixes: 7b5424361ec9 ("iwlwifi: pcie: fine tune number of rxbs")
Reported-by: Haim Dreyfuss 
Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h | 2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index dadafbd..34bf7ce 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -348,7 +348,7 @@ struct iwl_tso_hdr_page {
 struct iwl_trans_pcie {
struct iwl_rxq *rxq;
struct iwl_rx_mem_buffer rx_pool[RX_POOL_SIZE];
-   struct iwl_rx_mem_buffer *global_table[MQ_RX_TABLE_SIZE];
+   struct iwl_rx_mem_buffer *global_table[RX_POOL_SIZE];
struct iwl_rb_allocator rba;
struct iwl_trans *trans;
struct iwl_drv *drv;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 4be3c35..e379dba 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -908,6 +908,8 @@ int iwl_pcie_rx_init(struct iwl_trans *trans)
allocator_pool_size = trans->num_rx_queues *
(RX_CLAIM_REQ_ALLOC - RX_POST_REQ_ALLOC);
num_alloc = queue_size + allocator_pool_size;
+   BUILD_BUG_ON(ARRAY_SIZE(trans_pcie->global_table) !=
+ARRAY_SIZE(trans_pcie->rx_pool));
for (i = 0; i < num_alloc; i++) {
struct iwl_rx_mem_buffer *rxb = _pcie->rx_pool[i];
 
-- 
2.5.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


pull request: iwlwifi-next 2016-03-30

2016-03-30 Thread Grumbach, Emmanuel
Hi Kalle,

This is a pull request for 4.7. Lots of work here and more to come when
dependencies on mac80211 will be resolved.
Let me know if you have issues!

Thanks.

The following changes since commit 1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 
(2016-03-19 10:05:34 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
tags/iwlwifi-next-for-kalle-2016-03-30

for you to fetch changes up to 46167a8fd4248533ad15867e6988ff20e76de641:

  iwlwifi: pcie: remove duplicate assignment of variable isr_stats (2016-03-30 
16:24:52 +0300)


* Support for Link Quality measurement (Aviya)
* Improvements in thermal (Chaya Rachel)
* Various cleanups (many people)
* Improvements in firmware error dump (Golan)
* More work 9000 devices and MSIx (Haim)
* Continuation of the Dynamic Queue Allocation work (Liad)
* Scan timeout to cope with buggy firmware (Luca)
* D0i3 improvements (Luca)
* Make the paging less memory hungry (Matti)
* 9000 new Rx path (Sara)


Aviya Erenfeld (2):
  iwlwifi: mvm: add LQM vendor command and notification
  iwlwifi: add a debugfs hook for LQM

Ayala Beker (1):
  iwlwifi: mvm: update GSCAN capabilities

Chaya Rachel Ivgi (2):
  iwlwifi: mvm: handle async temperature notification with unlocked mutex
  iwlwifi: mvm: remove uneeded D0I3 checking

Colin Ian King (1):
  iwlwifi: pcie: remove duplicate assignment of variable isr_stats

David Spinadel (1):
  iwlwifi: mvm: set aux STA ID in scan config

Emmanuel Grumbach (6):
  iwlwifi: pcie: print error value as signed int
  iwlwifi: mvm: modify the max SP to infinite
  iwlwifi: add missing mutex_destroy statements
  iwlwifi: make uapsd_disable module param a bitmap
  iwlwifi: remove IWLWIFI_UAPSD Kconfig
  iwlwifi: remove IWL_*_UCODE_API_OK

Eva Rachel Retuya (1):
  iwlwifi: dvm: use alloc_ordered_workqueue()

Golan Ben-Ami (2):
  iwlwifi: mvm: support dumping UMAC internal txfifos
  iwlwifi: store fw memory segments length and addresses in run-time

Haim Dreyfuss (2):
  iwlwifi: 9000: update device id and FW serial number
  iwlwifi: pcie: Fix index iteration on free_irq in MSIX mode

Johannes Berg (1):
  iwlwifi: mvm: remove is_data_qos variable in TX

Liad Kaufman (7):
  iwlwifi: mvm: support bss dynamic alloc/dealloc of queues
  iwlwifi: trans: fix iwl_trans_txq_scd_cfg.sta_id sign
  iwlwifi: mvm: use bss client queue for bss station
  iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd
  iwlwifi: mvm: allocate dedicated queue for cab in dqa mode
  iwlwifi: mvm: move cmd queue to be #0 in dqa mode
  iwlwifi: mvm: fix inconsistent lock in dqa mode

Luca Coelho (3):
  iwlwifi: pcie: refcounting is not necessary anymore
  iwlwifi: mvm: add a scan timeout for regular scans
  iwlwifi: mvm: allow setting the thermal state in D0i3

Matti Gottlieb (2):
  iwlwifi: mvm: Decrease size of the paging download buffer
  iwlwifi: mvm: make sure FW contains the right amount of paging sections

Oren Givon (1):
  iwlwifi: edit the 9000 series PCI IDs

Sara Sharon (11):
  iwlwifi: pcie: clear trans reference on queue stop
  iwlwifi: pcie: fix global table size
  iwlwifi: pcie: enable interrupts explicitly on resume
  iwlwifi: pcie: do not pad QoS AMSDU
  iwlwifi: mvm: add support for new TX CMD API
  iwlwifi: pcie: write to legacy register also in MQ
  iwlwifi: remove support for fw older than -16.ucode
  iwlwifi: mvm: report checksum is done also for IPv6 packets
  iwlwifi: pcie: request one more interrupt vector
  iwlwifi: mvm: improve RSS configuration
  iwlwifi: mvm: enable TCP/UDP checksum support for 9000 family

 drivers/net/wireless/intel/iwlwifi/Kconfig |   10 --
 drivers/net/wireless/intel/iwlwifi/dvm/main.c  |2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-1000.c  |   10 +-
 drivers/net/wireless/intel/iwlwifi/iwl-2000.c  |   18 +-
 drivers/net/wireless/intel/iwlwifi/iwl-5000.c  |   11 +-
 drivers/net/wireless/intel/iwlwifi/iwl-6000.c  |   20 +--
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c  |   26 +--
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c  |   13 +-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c  |   17 +-
 drivers/net/wireless/intel/iwlwifi/iwl-config.h|7 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   |  100 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-fw-error-dump.h |1 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h   |   41 -
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h|2 +
 drivers/net/wireless/intel/iwlwifi/iwl-modparams.h |   10 +-
 

[PATCH 24/43] iwlwifi: dvm: use alloc_ordered_workqueue()

2016-03-30 Thread Emmanuel Grumbach
From: Eva Rachel Retuya 

Use alloc_ordered_workqueue() to allocate the workqueue instead of
create_singlethread_workqueue() since the latter is deprecated and is scheduled
for removal.

There are work items doing related operations that shouldn't be swapped when
queued in a certain order hence preserve the strict execution ordering of a
single threaded (ST) workqueue by switching to alloc_ordered_workqueue().

WQ_MEM_RECLAIM flag is not needed since the worker is not depended
during memory reclaim.

Signed-off-by: Eva Rachel Retuya 
Acked-by: Tejun Heo 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/dvm/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
index 85628127..6147162 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c
@@ -1071,7 +1071,7 @@ static void iwl_bg_restart(struct work_struct *data)
 
 static void iwl_setup_deferred_work(struct iwl_priv *priv)
 {
-   priv->workqueue = create_singlethread_workqueue(DRV_NAME);
+   priv->workqueue = alloc_ordered_workqueue(DRV_NAME, 0);
 
INIT_WORK(>restart, iwl_bg_restart);
INIT_WORK(>beacon_update, iwl_bg_beacon_update);
-- 
2.5.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 09/43] iwlwifi: pcie: refcounting is not necessary anymore

2016-03-30 Thread Emmanuel Grumbach
From: Luca Coelho 

We don't use the refcount value anymore, all the refcounting is done
in the runtime PM usage_count value.  Remove it.

Signed-off-by: Luca Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c  |  4 +---
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h |  4 
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c| 25 --
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 05b9685..3456669 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -651,10 +651,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
/* The PCI device starts with a reference taken and we are
 * supposed to release it here.  But to simplify the
 * interaction with the opmode, we don't do it now, but let
-* the opmode release it when it's ready.  To account for this
-* reference, we start with ref_count set to 1.
+* the opmode release it when it's ready.
 */
-   trans_pcie->ref_count = 1;
 
return 0;
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 34bf7ce..9ce4ec6 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -403,10 +403,6 @@ struct iwl_trans_pcie {
bool cmd_hold_nic_awake;
bool ref_cmd_in_flight;
 
-   /* protect ref counter */
-   spinlock_t ref_lock;
-   u32 ref_count;
-
dma_addr_t fw_mon_phys;
struct page *fw_mon_page;
u32 fw_mon_size;
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index d4306e2..007bcb5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2015,38 +2015,32 @@ static void iwl_trans_pcie_set_bits_mask(struct 
iwl_trans *trans, u32 reg,
 void iwl_trans_pcie_ref(struct iwl_trans *trans)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-   unsigned long flags;
 
if (iwlwifi_mod_params.d0i3_disable)
return;
 
-   spin_lock_irqsave(_pcie->ref_lock, flags);
-   IWL_DEBUG_RPM(trans, "ref_counter: %d\n", trans_pcie->ref_count);
-   trans_pcie->ref_count++;
pm_runtime_get(_pcie->pci_dev->dev);
-   spin_unlock_irqrestore(_pcie->ref_lock, flags);
+
+#ifdef CONFIG_PM
+   IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
+ atomic_read(_pcie->pci_dev->dev.power.usage_count));
+#endif /* CONFIG_PM */
 }
 
 void iwl_trans_pcie_unref(struct iwl_trans *trans)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-   unsigned long flags;
 
if (iwlwifi_mod_params.d0i3_disable)
return;
 
-   spin_lock_irqsave(_pcie->ref_lock, flags);
-   IWL_DEBUG_RPM(trans, "ref_counter: %d\n", trans_pcie->ref_count);
-   if (WARN_ON_ONCE(trans_pcie->ref_count == 0)) {
-   spin_unlock_irqrestore(_pcie->ref_lock, flags);
-   return;
-   }
-   trans_pcie->ref_count--;
-
pm_runtime_mark_last_busy(_pcie->pci_dev->dev);
pm_runtime_put_autosuspend(_pcie->pci_dev->dev);
 
-   spin_unlock_irqrestore(_pcie->ref_lock, flags);
+#ifdef CONFIG_PM
+   IWL_DEBUG_RPM(trans, "runtime usage count: %d\n",
+ atomic_read(_pcie->pci_dev->dev.power.usage_count));
+#endif /* CONFIG_PM */
 }
 
 static const char *get_csr_string(int cmd)
@@ -2794,7 +2788,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev 
*pdev,
trans_pcie->trans = trans;
spin_lock_init(_pcie->irq_lock);
spin_lock_init(_pcie->reg_lock);
-   spin_lock_init(_pcie->ref_lock);
mutex_init(_pcie->mutex);
init_waitqueue_head(_pcie->ucode_write_waitq);
trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
-- 
2.5.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 30/43] iwlwifi: mvm: improve RSS configuration

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

Improve current RSS configuration:
 * Use netdev_rss_key instead of keeping a local copy.
 * Configure also UDP hashing to have UDP traffic spread across queues.
 * Do not direct RSS traffic to our fallback queue.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 5 -
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c  | 9 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 1 -
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ---
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index abc16f7..362a546 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -65,6 +65,7 @@
  */
 #include 
 #include 
+#include 
 
 #include "mvm.h"
 #include "fw-dbg.h"
@@ -880,8 +881,10 @@ static ssize_t iwl_dbgfs_indirection_tbl_write(struct 
iwl_mvm *mvm,
struct iwl_rss_config_cmd cmd = {
.flags = cpu_to_le32(IWL_RSS_ENABLE),
.hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
+IWL_RSS_HASH_TYPE_IPV4_UDP |
 IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
 IWL_RSS_HASH_TYPE_IPV6_TCP |
+IWL_RSS_HASH_TYPE_IPV6_UDP |
 IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
};
int ret, i, num_repeats, nbytes = count / 2;
@@ -905,7 +908,7 @@ static ssize_t iwl_dbgfs_indirection_tbl_write(struct 
iwl_mvm *mvm,
memcpy(_table[i * nbytes], cmd.indirection_table,
   ARRAY_SIZE(cmd.indirection_table) % nbytes);
 
-   memcpy(cmd.secret_key, mvm->secret_key, sizeof(cmd.secret_key));
+   netdev_rss_key_fill(cmd.secret_key, sizeof(cmd.secret_key));
 
mutex_lock(>mutex);
ret = iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), );
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index f375275..2dc97a1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -64,6 +64,7 @@
  *
  */
 #include 
+#include 
 
 #include "iwl-trans.h"
 #include "iwl-op-mode.h"
@@ -114,14 +115,18 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
struct iwl_rss_config_cmd cmd = {
.flags = cpu_to_le32(IWL_RSS_ENABLE),
.hash_mask = IWL_RSS_HASH_TYPE_IPV4_TCP |
+IWL_RSS_HASH_TYPE_IPV4_UDP |
 IWL_RSS_HASH_TYPE_IPV4_PAYLOAD |
 IWL_RSS_HASH_TYPE_IPV6_TCP |
+IWL_RSS_HASH_TYPE_IPV6_UDP |
 IWL_RSS_HASH_TYPE_IPV6_PAYLOAD,
};
 
+   /* Do not direct RSS traffic to Q 0 which is our fallback queue */
for (i = 0; i < ARRAY_SIZE(cmd.indirection_table); i++)
-   cmd.indirection_table[i] = i % mvm->trans->num_rx_queues;
-   memcpy(cmd.secret_key, mvm->secret_key, sizeof(cmd.secret_key));
+   cmd.indirection_table[i] =
+   1 + (i % (mvm->trans->num_rx_queues - 1));
+   netdev_rss_key_fill(cmd.secret_key, sizeof(cmd.secret_key));
 
return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), );
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index f0e2597..a9de2ad 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -699,7 +699,6 @@ struct iwl_mvm {
atomic_t pending_frames[IWL_MVM_STATION_COUNT];
u32 tfd_drained[IWL_MVM_STATION_COUNT];
u8 rx_ba_sessions;
-   u32 secret_key[IWL_RSS_HASH_KEY_CNT];
 
/* configured by mac80211 */
u32 rts_threshold;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 9fc705c..e36bcad 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -725,9 +725,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct 
iwl_cfg *cfg,
 
iwl_mvm_tof_init(mvm);
 
-   /* init RSS hash key */
-   get_random_bytes(mvm->secret_key, sizeof(mvm->secret_key));
-
return op_mode;
 
  out_unregister:
-- 
2.5.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 12/43] iwlwifi: mvm: modify the max SP to infinite

2016-03-30 Thread Emmanuel Grumbach
This makes u-APSD work with more peers.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/power.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 0668601..2e0a882 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -208,7 +208,7 @@ enum iwl_power_scheme {
 };
 
 #define IWL_CONN_MAX_LISTEN_INTERVAL   10
-#define IWL_UAPSD_MAX_SP   IEEE80211_WMM_IE_STA_QOSINFO_SP_2
+#define IWL_UAPSD_MAX_SP   IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 enum iwl_dbgfs_pm_mask {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
index f313910..7b1f6ad 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
@@ -227,7 +227,7 @@ static void iwl_mvm_power_configure_uapsd(struct iwl_mvm 
*mvm,
cpu_to_le16(IWL_MVM_PS_SNOOZE_WINDOW);
}
 
-   cmd->uapsd_max_sp = IWL_UAPSD_MAX_SP;
+   cmd->uapsd_max_sp = mvm->hw->uapsd_max_sp_len;
 
if (mvm->cur_ucode == IWL_UCODE_WOWLAN || cmd->flags &
cpu_to_le16(POWER_FLAGS_SNOOZE_ENA_MSK)) {
-- 
2.5.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 35/43] iwlwifi: mvm: move cmd queue to be #0 in dqa mode

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

Change the CMD queue to be queue #0 (rather than queue #9)
when working in DQA mode.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   | 2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c   | 5 -
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 8 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  | 5 -
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index b38cb03..60eed84 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -89,6 +89,7 @@ enum {
 /*
  * DQA queue numbers
  *
+ * @IWL_MVM_DQA_CMD_QUEUE: a queue reserved for sending HCMDs to the FW
  * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames
  * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
  * that we are never left without the possibility to connect to an AP.
@@ -103,6 +104,7 @@ enum {
  * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
  */
 enum iwl_mvm_dqa_txq {
+   IWL_MVM_DQA_CMD_QUEUE = 0,
IWL_MVM_DQA_GCAST_QUEUE = 3,
IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4,
IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 2dc97a1..6ad5c60 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -652,7 +652,10 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm 
*mvm,
 */
 
memset(>queue_info, 0, sizeof(mvm->queue_info));
-   mvm->queue_info[IWL_MVM_CMD_QUEUE].hw_queue_refcount = 1;
+   if (iwl_mvm_is_dqa_supported(mvm))
+   mvm->queue_info[IWL_MVM_DQA_CMD_QUEUE].hw_queue_refcount = 1;
+   else
+   mvm->queue_info[IWL_MVM_CMD_QUEUE].hw_queue_refcount = 1;
 
for (i = 0; i < IEEE80211_MAX_QUEUES; i++)
atomic_set(>mac80211_queue_stop_count[i], 0);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 43fd857..5f95056 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -252,10 +252,14 @@ unsigned long iwl_mvm_get_used_hw_queues(struct iwl_mvm 
*mvm,
.exclude_vif = exclude_vif,
.used_hw_queues =
BIT(IWL_MVM_OFFCHANNEL_QUEUE) |
-   BIT(mvm->aux_queue) |
-   BIT(IWL_MVM_CMD_QUEUE),
+   BIT(mvm->aux_queue),
};
 
+   if (iwl_mvm_is_dqa_supported(mvm))
+   data.used_hw_queues |= BIT(IWL_MVM_DQA_CMD_QUEUE);
+   else
+   data.used_hw_queues |= BIT(IWL_MVM_CMD_QUEUE);
+
lockdep_assert_held(>mutex);
 
/* mark all VIF used hw queues */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index e36bcad..cb00926 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -619,7 +619,10 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const 
struct iwl_cfg *cfg,
trans_cfg.command_groups = iwl_mvm_groups;
trans_cfg.command_groups_size = ARRAY_SIZE(iwl_mvm_groups);
 
-   trans_cfg.cmd_queue = IWL_MVM_CMD_QUEUE;
+   if (iwl_mvm_is_dqa_supported(mvm))
+   trans_cfg.cmd_queue = IWL_MVM_DQA_CMD_QUEUE;
+   else
+   trans_cfg.cmd_queue = IWL_MVM_CMD_QUEUE;
trans_cfg.cmd_fifo = IWL_MVM_TX_FIFO_CMD;
trans_cfg.scd_set_active = true;
 
-- 
2.5.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 34/43] iwlwifi: mvm: allocate dedicated queue for cab in dqa mode

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

In DQA mode, allocate a dedicated queue (#3) for content
after beacon (AKA "CaB").

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   |  2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 18 --
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 9652687..b38cb03 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -89,6 +89,7 @@ enum {
 /*
  * DQA queue numbers
  *
+ * @IWL_MVM_DQA_GCAST_QUEUE: a queue reserved for P2P GO/SoftAP GCAST frames
  * @IWL_MVM_DQA_BSS_CLIENT_QUEUE: a queue reserved for BSS activity, to ensure
  * that we are never left without the possibility to connect to an AP.
  * @IWL_MVM_DQA_MIN_MGMT_QUEUE: first TXQ in pool for MGMT and non-QOS frames.
@@ -102,6 +103,7 @@ enum {
  * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
  */
 enum iwl_mvm_dqa_txq {
+   IWL_MVM_DQA_GCAST_QUEUE = 3,
IWL_MVM_DQA_BSS_CLIENT_QUEUE = 4,
IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index c02c105..43fd857 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -447,13 +447,19 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct 
iwl_mvm *mvm,
 
/* Allocate the CAB queue for softAP and GO interfaces */
if (vif->type == NL80211_IFTYPE_AP) {
-   u8 queue = find_first_zero_bit(_hw_queues,
-  mvm->first_agg_queue);
+   u8 queue;
 
-   if (queue >= mvm->first_agg_queue) {
-   IWL_ERR(mvm, "Failed to allocate cab queue\n");
-   ret = -EIO;
-   goto exit_fail;
+   if (!iwl_mvm_is_dqa_supported(mvm)) {
+   queue = find_first_zero_bit(_hw_queues,
+   mvm->first_agg_queue);
+
+   if (queue >= mvm->first_agg_queue) {
+   IWL_ERR(mvm, "Failed to allocate cab queue\n");
+   ret = -EIO;
+   goto exit_fail;
+   }
+   } else {
+   queue = IWL_MVM_DQA_GCAST_QUEUE;
}
 
vif->cab_queue = queue;
-- 
2.5.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 33/43] iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

Set the correct sta_id in the SCD_QUEUE_CONFIG command sent
to the FW when enabling/disabling queues. This is needed in
DQA-mode to allow the FW to associate between queue and STA.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   | 1 +
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index a9de2ad..cd5f16e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -665,6 +665,7 @@ struct iwl_mvm {
/* Map to HW queue */
u32 hw_queue_to_mac80211;
u8 hw_queue_refcount;
+   u8 ra_sta_id; /* The RA this queue is mapped to, if exists */
/*
 * This is to mark that queue is reserved for a STA but not yet
 * allocated. This is needed to make sure we have at least one
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index 76866b9..486c985 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -608,6 +608,8 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int 
mac80211_queue,
mvm->queue_info[queue].hw_queue_refcount++;
if (mvm->queue_info[queue].hw_queue_refcount > 1)
enable_queue = false;
+   else
+   mvm->queue_info[queue].ra_sta_id = cfg->sta_id;
mvm->queue_info[queue].tid_bitmap |= BIT(cfg->tid);
 
IWL_DEBUG_TX_QUEUES(mvm,
@@ -693,6 +695,8 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, 
int mac80211_queue,
return;
}
 
+   cmd.sta_id = mvm->queue_info[queue].ra_sta_id;
+
/* Make sure queue info is correct even though we overwrite it */
WARN(mvm->queue_info[queue].hw_queue_refcount ||
 mvm->queue_info[queue].tid_bitmap ||
-- 
2.5.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 36/43] iwlwifi: mvm: add a scan timeout for regular scans

2016-03-30 Thread Emmanuel Grumbach
From: Luca Coelho 

If something goes wrong with the firmware and we never get a scan
complete notification, we stay stuck forever.  In order to avoid this
situation, add a timeout and trigger an NMI if it expires before
receiving the notification., so we can clean things up.

Signed-off-by: Luca Coelho 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  |  5 +
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 21 +
 3 files changed, 28 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index cd5f16e..2d685e0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -710,6 +710,7 @@ struct iwl_mvm {
struct iwl_mcast_filter_cmd *mcast_filter_cmd;
enum iwl_mvm_scan_type scan_type;
enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all;
+   struct timer_list scan_timer;
 
/* max number of simultaneous scans the FW supports */
unsigned int max_scans;
@@ -1314,6 +1315,7 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm);
 int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);
 int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
 void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
+void iwl_mvm_scan_timeout(unsigned long data);
 
 /* Scheduled scan */
 void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index cb00926..656541c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -728,6 +728,9 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct 
iwl_cfg *cfg,
 
iwl_mvm_tof_init(mvm);
 
+   setup_timer(>scan_timer, iwl_mvm_scan_timeout,
+   (unsigned long)mvm);
+
return op_mode;
 
  out_unregister:
@@ -783,6 +786,8 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode 
*op_mode)
 
iwl_mvm_tof_clean(mvm);
 
+   del_timer_sync(>scan_timer);
+
mutex_destroy(>mutex);
mutex_destroy(>d0i3_suspend_mutex);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 25b007c..c1d1be9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -70,6 +70,7 @@
 
 #include "mvm.h"
 #include "fw-api-scan.h"
+#include "iwl-io.h"
 
 #define IWL_DENSE_EBS_SCAN_RATIO 5
 #define IWL_SPARSE_EBS_SCAN_RATIO 1
@@ -398,6 +399,10 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm 
*mvm,
ieee80211_scan_completed(mvm->hw,
scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED);
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
+   del_timer(>scan_timer);
+   } else {
+   IWL_ERR(mvm,
+   "got scan complete notification but no scan is 
running\n");
}
 
mvm->last_ebs_successful =
@@ -1217,6 +1222,18 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm 
*mvm, int type)
return -EIO;
 }
 
+#define SCAN_TIMEOUT (16 * HZ)
+
+void iwl_mvm_scan_timeout(unsigned long data)
+{
+   struct iwl_mvm *mvm = (struct iwl_mvm *)data;
+
+   IWL_ERR(mvm, "regular scan timed out\n");
+
+   del_timer(>scan_timer);
+   iwl_force_nmi(mvm->trans);
+}
+
 int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
   struct cfg80211_scan_request *req,
   struct ieee80211_scan_ies *ies)
@@ -1296,6 +1313,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
mvm->scan_status |= IWL_MVM_SCAN_REGULAR;
iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN);
 
+   mod_timer(>scan_timer, jiffies + SCAN_TIMEOUT);
+
return 0;
 }
 
@@ -1413,6 +1432,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm 
*mvm,
if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) {
ieee80211_scan_completed(mvm->hw, aborted);
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
+   del_timer(>scan_timer);
} else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
ieee80211_sched_scan_stopped(mvm->hw);
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
@@ -1608,6 +1628,7 @@ out:
 * to release the scan reference here.
 */
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
+   del_timer(>scan_timer);
if (notify)
ieee80211_scan_completed(mvm->hw, true);
} else if (notify) {
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 

[PATCH 26/43] iwlwifi: mvm: set aux STA ID in scan config

2016-03-30 Thread Emmanuel Grumbach
From: David Spinadel 

Auxilary station ID in flag in scan config command wasn't set
although we set the station ID. Add the flag.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 09eb72c..25b007c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -961,6 +961,7 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS |
 SCAN_CONFIG_FLAG_SET_TX_CHAINS |
 SCAN_CONFIG_FLAG_SET_RX_CHAINS |
+SCAN_CONFIG_FLAG_SET_AUX_STA_ID |
 SCAN_CONFIG_FLAG_SET_ALL_TIMES |
 SCAN_CONFIG_FLAG_SET_LEGACY_RATES |
 SCAN_CONFIG_FLAG_SET_MAC_ADDR |
-- 
2.5.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 42/43] iwlwifi: mvm: allow setting the thermal state in D0i3

2016-03-30 Thread Emmanuel Grumbach
From: Luca Coelho 

We were not allowing the thermal state to be set when we were in D0i3
mode.  It was not very clearly specified how it should work, but now a
decision was made to allow the state to be set in D0i3 (which will
cause a brief wake up).  Remove the check in the set_cur_state
operation.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 3f5df76..eb3f460 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -801,9 +801,6 @@ static int iwl_mvm_tcool_set_cur_state(struct 
thermal_cooling_device *cdev,
if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR))
return -EIO;
 
-   if (test_bit(IWL_MVM_STATUS_IN_D0I3, >status))
-   return -EBUSY;
-
mutex_lock(>mutex);
 
if (new_state >= ARRAY_SIZE(iwl_mvm_cdev_budgets)) {
-- 
2.5.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 43/43] iwlwifi: pcie: remove duplicate assignment of variable isr_stats

2016-03-30 Thread Emmanuel Grumbach
From: Colin Ian King 

isr_stats is written twice with the same value, remove one of the
redundant assignments to isr_stats.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 59a7e45..7f8a232 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1811,7 +1811,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void 
*dev_id)
struct msix_entry *entry = dev_id;
struct iwl_trans_pcie *trans_pcie = iwl_pcie_get_trans_pcie(entry);
struct iwl_trans *trans = trans_pcie->trans;
-   struct isr_statistics *isr_stats = isr_stats = _pcie->isr_stats;
+   struct isr_statistics *isr_stats = _pcie->isr_stats;
u32 inta_fh, inta_hw;
 
lock_map_acquire(>sync_cmd_lockdep_map);
-- 
2.5.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 39/43] iwlwifi: pcie: Fix index iteration on free_irq in MSIX mode

2016-03-30 Thread Emmanuel Grumbach
From: Haim Dreyfuss 

In MSIX mode we iterate over the allocated interrupt vectors and
register them to an handler. In case of registration failure,
we free all the allocated irq.
we use the outer index mistakenly instead of the inner one.

Signed-off-by: Haim Dreyfuss 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index f1a506b..5e1a13e 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1500,8 +1500,8 @@ static int iwl_pcie_init_msix_handler(struct pci_dev 
*pdev,
IWL_ERR(trans_pcie->trans,
"Error allocating IRQ %d\n", i);
for (j = 0; j < i; j++)
-   free_irq(trans_pcie->msix_entries[i].vector,
-_pcie->msix_entries[i]);
+   free_irq(trans_pcie->msix_entries[j].vector,
+_pcie->msix_entries[j]);
pci_disable_msix(pdev);
return ret;
}
-- 
2.5.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 40/43] iwlwifi: store fw memory segments length and addresses in run-time

2016-03-30 Thread Emmanuel Grumbach
From: Golan Ben-Ami 

Currently reading the fw memory segments is done according to
addresses and data length that are hard-coded.
Lately a new tlv was appended to the ucode, that contains
the data type, length and address.
Parse this tlv, and in run-time store the memory segments length
and addresses that would be dumped upon a fw error.

Signed-off-by: Golan Ben-Ami 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 45 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | 32 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h  |  2 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c  | 61 ++--
 4 files changed, 125 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 605910f..48e8737 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -179,6 +179,8 @@ static void iwl_dealloc_ucode(struct iwl_drv *drv)
kfree(drv->fw.dbg_conf_tlv[i]);
for (i = 0; i < ARRAY_SIZE(drv->fw.dbg_trigger_tlv); i++)
kfree(drv->fw.dbg_trigger_tlv[i]);
+   for (i = 0; i < ARRAY_SIZE(drv->fw.dbg_mem_tlv); i++)
+   kfree(drv->fw.dbg_mem_tlv[i]);
 
for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
iwl_free_fw_img(drv, drv->fw.img + i);
@@ -297,6 +299,7 @@ struct iwl_firmware_pieces {
size_t dbg_conf_tlv_len[FW_DBG_CONF_MAX];
struct iwl_fw_dbg_trigger_tlv *dbg_trigger_tlv[FW_DBG_TRIGGER_MAX];
size_t dbg_trigger_tlv_len[FW_DBG_TRIGGER_MAX];
+   struct iwl_fw_dbg_mem_seg_tlv *dbg_mem_tlv[FW_DBG_MEM_MAX];
 };
 
 /*
@@ -1041,6 +1044,37 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
iwl_store_gscan_capa(>fw, tlv_data, tlv_len);
gscan_capa = true;
break;
+   case IWL_UCODE_TLV_FW_MEM_SEG: {
+   struct iwl_fw_dbg_mem_seg_tlv *dbg_mem =
+   (void *)tlv_data;
+   u32 type;
+
+   if (tlv_len != (sizeof(*dbg_mem)))
+   goto invalid_tlv_len;
+
+   type = le32_to_cpu(dbg_mem->data_type);
+   drv->fw.dbg_dynamic_mem = true;
+
+   if (type >= ARRAY_SIZE(drv->fw.dbg_mem_tlv)) {
+   IWL_ERR(drv,
+   "Skip unknown dbg mem segment: %u\n",
+   dbg_mem->data_type);
+   break;
+   }
+
+   if (pieces->dbg_mem_tlv[type]) {
+   IWL_ERR(drv,
+   "Ignore duplicate mem segment: %u\n",
+   dbg_mem->data_type);
+   break;
+   }
+
+   IWL_DEBUG_INFO(drv, "Found debug memory segment: %u\n",
+  dbg_mem->data_type);
+
+   pieces->dbg_mem_tlv[type] = dbg_mem;
+   break;
+   }
default:
IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type);
break;
@@ -1350,6 +1384,17 @@ static void iwl_req_fw_callback(const struct firmware 
*ucode_raw, void *context)
}
}
 
+   for (i = 0; i < ARRAY_SIZE(drv->fw.dbg_mem_tlv); i++) {
+   if (pieces->dbg_mem_tlv[i]) {
+   drv->fw.dbg_mem_tlv[i] =
+   kmemdup(pieces->dbg_mem_tlv[i],
+   sizeof(*drv->fw.dbg_mem_tlv[i]),
+   GFP_KERNEL);
+   if (!drv->fw.dbg_mem_tlv[i])
+   goto out_free_fw;
+   }
+   }
+
/* Now that we can no longer fail, copy information */
 
/*
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index a6e8826..843232b 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -142,6 +142,7 @@ enum iwl_ucode_tlv_type {
IWL_UCODE_TLV_FW_DBG_CONF   = 39,
IWL_UCODE_TLV_FW_DBG_TRIGGER= 40,
IWL_UCODE_TLV_FW_GSCAN_CAPA = 50,
+   IWL_UCODE_TLV_FW_MEM_SEG= 51,
 };
 
 struct iwl_ucode_tlv {
@@ -492,6 +493,37 @@ enum iwl_fw_dbg_monitor_mode {
 };
 
 /**
+ * enum iwl_fw_mem_seg_type - data types for dumping on error
+ *
+ * @FW_DBG_MEM_SMEM: the data type is SMEM
+ * @FW_DBG_MEM_DCCM_LMAC: the data type is DCCM_LMAC
+ * @FW_DBG_MEM_DCCM_UMAC: the data type is DCCM_UMAC
+ */

[PATCH 20/43] iwlwifi: pcie: write to legacy register also in MQ

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

Due to hardware bug, upon any shadow free-queue register write
access, a legacy RBD shadow register must be written as well.
This is required in order to trigger a copy of the shadow registers
values after MAC exits sleep state.
Specifically, the driver has to write (any value) to the legacy RBD
register each time FRBDCB is accessed.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index e379dba..59a7e45 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -210,8 +210,12 @@ static void iwl_pcie_rxq_inc_wr_ptr(struct iwl_trans 
*trans,
if (trans->cfg->mq_rx_supported)
iwl_write_prph(trans, RFH_Q_FRBDCB_WIDX(rxq->id),
   rxq->write_actual);
-   else
-   iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual);
+   /*
+* write to FH_RSCSR_CHNL0_WPTR register even in MQ as a W/A to
+* hardware shadow registers bug - writing to RFH_Q_FRBDCB_WIDX will
+* not wake the NIC.
+*/
+   iwl_write32(trans, FH_RSCSR_CHNL0_WPTR, rxq->write_actual);
 }
 
 static void iwl_pcie_rxq_check_wrptr(struct iwl_trans *trans)
-- 
2.5.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 19/43] iwlwifi: mvm: support bss dynamic alloc/dealloc of queues

2016-03-30 Thread Emmanuel Grumbach
From: Liad Kaufman 

"DQA" is shorthand for "dynamic queue allocation". This
enables on-demand allocation of queues per RA/TID rather than
statically allocating per vif, thus allowing a potential
benefit of various factors.

Please refer to the DOC section this patch adds to sta.h to
see a more in-depth explanation of this feature.

There are many things to take into consideration when working
in DQA mode, and this patch is only one in a series. Note that
default operation mode is non-DQA mode, unless the FW
indicates that it supports DQA mode.

This patch enables support of DQA for a station connected to
an AP, and works in a non-aggregated mode.

When a frame for an unused RA/TID arrives at the driver, it
isn't TXed immediately, but deferred first until a suitable
queue is first allocated for it, and then TXed by a worker
that both allocates the queues and TXes deferred traffic.

When a STA is removed, its queues goes back into the queue
pools for reuse as needed.

Signed-off-by: Liad Kaufman 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c   |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   |  22 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c |  21 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  49 +
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |   7 +
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  |   1 +
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  | 254 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |  87 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c   |  54 +
 9 files changed, 481 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index c1a3131..e3561bb 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -723,7 +723,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
return -EIO;
}
 
-   ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false);
+   ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false, 0);
if (ret)
return ret;
rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index e6bd0c8..8217eb2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -80,12 +80,32 @@
 #include "fw-api-stats.h"
 #include "fw-api-tof.h"
 
-/* Tx queue numbers */
+/* Tx queue numbers for non-DQA mode */
 enum {
IWL_MVM_OFFCHANNEL_QUEUE = 8,
IWL_MVM_CMD_QUEUE = 9,
 };
 
+/*
+ * DQA queue numbers
+ *
+ * @IWL_MVM_DQA_MIN_MGMT_QUEUE: first TXQ in pool for MGMT and non-QOS frames.
+ * Each MGMT queue is mapped to a single STA
+ * MGMT frames are frames that return true on ieee80211_is_mgmt()
+ * @IWL_MVM_DQA_MAX_MGMT_QUEUE: last TXQ in pool for MGMT frames
+ * @IWL_MVM_DQA_MIN_DATA_QUEUE: first TXQ in pool for DATA frames.
+ * DATA frames are intended for !ieee80211_is_mgmt() frames, but if
+ * the MGMT TXQ pool is exhausted, mgmt frames can be sent on DATA queues
+ * as well
+ * @IWL_MVM_DQA_MAX_DATA_QUEUE: last TXQ in pool for DATA frames
+ */
+enum iwl_mvm_dqa_txq {
+   IWL_MVM_DQA_MIN_MGMT_QUEUE = 5,
+   IWL_MVM_DQA_MAX_MGMT_QUEUE = 8,
+   IWL_MVM_DQA_MIN_DATA_QUEUE = 10,
+   IWL_MVM_DQA_MAX_DATA_QUEUE = 31,
+};
+
 enum iwl_mvm_tx_fifo {
IWL_MVM_TX_FIFO_BK = 0,
IWL_MVM_TX_FIFO_BE,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index e885db3..c02c105 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -425,12 +425,17 @@ static int iwl_mvm_mac_ctxt_allocate_resources(struct 
iwl_mvm *mvm,
return 0;
}
 
-   /* Find available queues, and allocate them to the ACs */
+   /*
+* Find available queues, and allocate them to the ACs. When in
+* DQA-mode they aren't really used, and this is done only so the
+* mac80211 ieee80211_check_queues() function won't fail
+*/
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
u8 queue = find_first_zero_bit(_hw_queues,
   mvm->first_agg_queue);
 
-   if (queue >= mvm->first_agg_queue) {
+   if (!iwl_mvm_is_dqa_supported(mvm) &&
+   queue >= mvm->first_agg_queue) {
IWL_ERR(mvm, "Failed to allocate queue\n");
ret = -EIO;
goto exit_fail;
@@ -495,6 +500,10 @@ int iwl_mvm_mac_ctxt_init(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif)
 

[PATCH 23/43] iwlwifi: remove support for fw older than -16.ucode

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

API version lower than 16 is not supported anymore - don't
load older ucode.
Remove code handling older versions.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c  |   12 +-
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c  |4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c  |4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   |5 +-
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h   |4 -
 drivers/net/wireless/intel/iwlwifi/mvm/Makefile|2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/coex.c  |   42 -
 .../net/wireless/intel/iwlwifi/mvm/coex_legacy.c   | 1315 
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   |  164 +--
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |   16 -
 drivers/net/wireless/intel/iwlwifi/mvm/sf.c|8 +-
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c |   86 --
 12 files changed, 41 insertions(+), 1621 deletions(-)
 delete mode 100644 drivers/net/wireless/intel/iwlwifi/mvm/coex_legacy.c

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
index fc475ce..f4012a3 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
@@ -77,15 +77,15 @@
 #define IWL3168_UCODE_API_MAX  21
 
 /* Oldest version we won't warn about */
-#define IWL7260_UCODE_API_OK   13
-#define IWL7265_UCODE_API_OK   13
-#define IWL7265D_UCODE_API_OK  13
+#define IWL7260_UCODE_API_OK   16
+#define IWL7265_UCODE_API_OK   16
+#define IWL7265D_UCODE_API_OK  16
 #define IWL3168_UCODE_API_OK   20
 
 /* Lowest firmware API version supported */
-#define IWL7260_UCODE_API_MIN  13
-#define IWL7265_UCODE_API_MIN  13
-#define IWL7265D_UCODE_API_MIN 13
+#define IWL7260_UCODE_API_MIN  16
+#define IWL7265_UCODE_API_MIN  16
+#define IWL7265D_UCODE_API_MIN 16
 #define IWL3168_UCODE_API_MIN  20
 
 /* NVM versions */
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index 97be104..49bb2a5 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -74,11 +74,11 @@
 #define IWL8265_UCODE_API_MAX  21
 
 /* Oldest version we won't warn about */
-#define IWL8000_UCODE_API_OK   13
+#define IWL8000_UCODE_API_OK   16
 #define IWL8265_UCODE_API_OK   20
 
 /* Lowest firmware API version supported */
-#define IWL8000_UCODE_API_MIN  13
+#define IWL8000_UCODE_API_MIN  16
 #define IWL8265_UCODE_API_MIN  20
 
 /* NVM versions */
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
index 642fc92..277396a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
@@ -58,10 +58,10 @@
 #define IWL9000_UCODE_API_MAX  21
 
 /* Oldest version we won't warn about */
-#define IWL9000_UCODE_API_OK   13
+#define IWL9000_UCODE_API_OK   16
 
 /* Lowest firmware API version supported */
-#define IWL9000_UCODE_API_MIN  13
+#define IWL9000_UCODE_API_MIN  16
 
 /* NVM versions */
 #define IWL9000_NVM_VERSION0x0a1d
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 7cd17f0..9a680ac 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1255,10 +1255,7 @@ static void iwl_req_fw_callback(const struct firmware 
*ucode_raw, void *context)
if (err)
goto try_again;
 
-   if (fw_has_api(>fw.ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION))
-   api_ver = drv->fw.ucode_ver;
-   else
-   api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
+   api_ver = drv->fw.ucode_ver;
 
/*
 * api_ver should match the api version forming part of the
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index c82b9416..a6e8826 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -245,13 +245,11 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t;
 
 /**
  * enum iwl_ucode_tlv_api - ucode api
- * @IWL_UCODE_TLV_API_BT_COEX_SPLIT: new API for BT Coex
  * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
  * longer than the passive one, which is essential for fragmented scan.
  * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
  * @IWL_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header
  * @IWL_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
- * @IWL_UCODE_TLV_API_NEW_VERSION: new versioning format
  * @IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority
  * instead of 3.
  * @IWL_UCODE_TLV_API_TX_POWER_CHAIN: TX 

[PATCH 17/43] iwlwifi: 9000: update device id and FW serial number

2016-03-30 Thread Emmanuel Grumbach
From: Haim Dreyfuss 

Update device id and FW serial number for 2X2 antenna devices
in 9000 generation product. These will not be available on
the market in the coming year.

Signed-off-by: Haim Dreyfuss 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c   |  8 
 drivers/net/wireless/intel/iwlwifi/iwl-config.h |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c   | 10 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
index 318b1dc..642fc92 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2015 Intel Deutschland GmbH
+ * Copyright(c) 2015-2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -18,7 +18,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2015 Intel Deutschland GmbH
+ * Copyright(c) 2015-2016 Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -143,8 +143,8 @@ static const struct iwl_tt_params iwl9000_tt_params = {
.vht_mu_mimo_supported = true,  \
.mac_addr_from_csr = true
 
-const struct iwl_cfg iwl9260_2ac_cfg = {
-   .name = "Intel(R) Dual Band Wireless AC 9260",
+const struct iwl_cfg iwl9560_2ac_cfg = {
+   .name = "Intel(R) Dual Band Wireless AC 9560",
.fw_name_pre = IWL9000_FW_PRE,
IWL_DEVICE_9000,
.ht_params = _ht_params,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index 3e4d346..8cbd248 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -439,7 +439,7 @@ extern const struct iwl_cfg iwl8265_2ac_cfg;
 extern const struct iwl_cfg iwl4165_2ac_cfg;
 extern const struct iwl_cfg iwl8260_2ac_sdio_cfg;
 extern const struct iwl_cfg iwl4165_2ac_sdio_cfg;
-extern const struct iwl_cfg iwl9260_2ac_cfg;
+extern const struct iwl_cfg iwl9560_2ac_cfg;
 extern const struct iwl_cfg iwl5165_2ac_cfg;
 #endif /* CONFIG_IWLMVM */
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 3456669..fb8b5ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -485,15 +485,15 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 /* 9000 Series */
{IWL_PCI_DEVICE(0x9DF0, 0x2A10, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x2010, iwl5165_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x9DF0, 0x0A10, iwl9260_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9260_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0A10, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0010, iwl9560_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0310, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0510, iwl5165_2ac_cfg)},
{IWL_PCI_DEVICE(0x9DF0, 0x0710, iwl5165_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x9DF0, 0x0210, iwl9260_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x9DF0, 0x0410, iwl9260_2ac_cfg)},
-   {IWL_PCI_DEVICE(0x9DF0, 0x0610, iwl9260_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0210, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0410, iwl9560_2ac_cfg)},
+   {IWL_PCI_DEVICE(0x2526, 0x0610, iwl9560_2ac_cfg)},
 #endif /* CONFIG_IWLMVM */
 
{0}
-- 
2.5.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 21/43] iwlwifi: remove IWLWIFI_UAPSD Kconfig

2016-03-30 Thread Emmanuel Grumbach
We have a module parameter, this is enough.
per platform customizations will be done through the init
script of the platform.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/Kconfig   | 10 --
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c |  7 ---
 2 files changed, 17 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig 
b/drivers/net/wireless/intel/iwlwifi/Kconfig
index 16c4f38..492035f 100644
--- a/drivers/net/wireless/intel/iwlwifi/Kconfig
+++ b/drivers/net/wireless/intel/iwlwifi/Kconfig
@@ -88,16 +88,6 @@ config IWLWIFI_BCAST_FILTERING
  If unsure, don't enable this option, as some programs might
  expect incoming broadcasts for their normal operations.
 
-config IWLWIFI_UAPSD
-   bool "enable U-APSD by default"
-   depends on IWLMVM
-   help
- Say Y here to enable U-APSD by default. This may cause
- interoperability problems with some APs, manifesting in lower than
- expected throughput due to those APs not enabling aggregation
-
- If unsure, say N.
-
 config IWLWIFI_PCIE_RTPM
bool "Enable runtime power management mode for PCIe devices"
depends on IWLMVM && PM
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 2cd9c31..9c2a2fd 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1560,9 +1560,7 @@ struct iwl_mod_params iwlwifi_mod_params = {
.power_level = IWL_POWER_INDEX_1,
.d0i3_disable = true,
.d0i3_entry_delay = 1000,
-#ifndef CONFIG_IWLWIFI_UAPSD
.uapsd_disable = IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT,
-#endif /* CONFIG_IWLWIFI_UAPSD */
/* the rest are 0 by default */
 };
 IWL_EXPORT_SYMBOL(iwlwifi_mod_params);
@@ -1682,13 +1680,8 @@ MODULE_PARM_DESC(lar_disable, "disable LAR functionality 
(default: N)");
 
 module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable,
   uint, S_IRUGO | S_IWUSR);
-#ifdef CONFIG_IWLWIFI_UAPSD
-MODULE_PARM_DESC(uapsd_disable,
-"disable U-APSD functionality bitmap 1: BSS 2: P2P Client 
(default: 0)");
-#else
 MODULE_PARM_DESC(uapsd_disable,
 "disable U-APSD functionality bitmap 1: BSS 2: P2P Client 
(default: 3)");
-#endif
 
 /*
  * set bt_coex_active to true, uCode will do kill/defer
-- 
2.5.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 22/43] iwlwifi: mvm: update GSCAN capabilities

2016-03-30 Thread Emmanuel Grumbach
From: Ayala Beker 

Gscan capabilities were updated with new capabilities supported
by the device. Update GSCAN capabilities TLV.

Signed-off-by: Ayala Beker 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 9c2a2fd..7cd17f0 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1060,11 +1060,18 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
return -EINVAL;
}
 
-   if (WARN(fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
-!gscan_capa,
-"GSCAN is supported but capabilities TLV is unavailable\n"))
+   /*
+* If ucode advertises that it supports GSCAN but GSCAN
+* capabilities TLV is not present, or if it has an old format,
+* warn and continue without GSCAN.
+*/
+   if (fw_has_capa(capa, IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT) &&
+   !gscan_capa) {
+   IWL_DEBUG_INFO(drv,
+  "GSCAN is supported but capabilities TLV is 
unavailable\n");
__clear_bit((__force long)IWL_UCODE_TLV_CAPA_GSCAN_SUPPORT,
capa->_capa);
+   }
 
return 0;
 
-- 
2.5.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 05/43] iwlwifi: mvm: add LQM vendor command and notification

2016-03-30 Thread Emmanuel Grumbach
From: Aviya Erenfeld 

LQM stands for Link Quality Measurement. The firmware
will collect a defined set of statitics (see the
notification for details) that allow to know how busy
the medium is. The driver issues a request to the firmware
that includes the duration of the measurement (the firmware
needs to be on channel for that amount of time) and the
timeout (in case the firmware has a lot of offchannel
activities). If the timeout elapses, the firmware will
send partial results which are still valuable.
In case of disassociation / channel switch and alike, the
driver is in charge of stopping the measurements and the
firmware will reply with partial results.

The user space API for now is debugfs only and will be
implmemented in an upcoming patch.

Signed-off-by: Aviya Erenfeld 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h  |  2 +
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   | 62 
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  | 12 
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  |  9 +++
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c| 71 +++
 6 files changed, 166 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index 3a72b97..c82b9416 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -326,6 +326,7 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
  * regular image.
  * @IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG: support getting more shared
  * memory addresses from the firmware.
+ * @IWL_UCODE_TLV_CAPA_LQM_SUPPORT: supports Link Quality Measurement
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -364,6 +365,7 @@ enum iwl_ucode_tlv_capa {
IWL_UCODE_TLV_CAPA_CTDP_SUPPORT = (__force 
iwl_ucode_tlv_capa_t)76,
IWL_UCODE_TLV_CAPA_USNIFFER_UNIFIED = (__force 
iwl_ucode_tlv_capa_t)77,
IWL_UCODE_TLV_CAPA_EXTEND_SHARED_MEM_CFG= (__force 
iwl_ucode_tlv_capa_t)80,
+   IWL_UCODE_TLV_CAPA_LQM_SUPPORT  = (__force 
iwl_ucode_tlv_capa_t)81,
 
NUM_IWL_UCODE_TLV_CAPA
 #ifdef __CHECKER__
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
index 61711b1..e6bd0c8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -279,6 +279,11 @@ enum {
 /* Please keep this enum *SORTED* by hex value.
  * Needed for binary search, otherwise a warning will be triggered.
  */
+enum iwl_mac_conf_subcmd_ids {
+   LINK_QUALITY_MEASUREMENT_CMD = 0x1,
+   LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF = 0xFE,
+};
+
 enum iwl_phy_ops_subcmd_ids {
CMD_DTS_MEASUREMENT_TRIGGER_WIDE = 0x0,
CTDP_CONFIG_CMD = 0x03,
@@ -307,6 +312,7 @@ enum {
LEGACY_GROUP = 0x0,
LONG_GROUP = 0x1,
SYSTEM_GROUP = 0x2,
+   MAC_CONF_GROUP = 0x3,
PHY_OPS_GROUP = 0x4,
DATA_PATH_GROUP = 0x5,
PROT_OFFLOAD_GROUP = 0xb,
@@ -2017,4 +2023,60 @@ struct iwl_stored_beacon_notif {
u8 data[MAX_STORED_BEACON_SIZE];
 } __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_1 */
 
+#define LQM_NUMBER_OF_STATIONS_IN_REPORT 16
+
+enum iwl_lqm_cmd_operatrions {
+   LQM_CMD_OPERATION_START_MEASUREMENT = 0x01,
+   LQM_CMD_OPERATION_STOP_MEASUREMENT = 0x02,
+};
+
+enum iwl_lqm_status {
+   LQM_STATUS_SUCCESS = 0,
+   LQM_STATUS_TIMEOUT = 1,
+   LQM_STATUS_ABORT = 2,
+};
+
+/**
+ * Link Quality Measurement command
+ * @cmd_operatrion: command operation to be performed (start or stop)
+ * as defined above.
+ * @mac_id: MAC ID the measurement applies to.
+ * @measurement_time: time of the total measurement to be performed, in uSec.
+ * @timeout: maximum time allowed until a response is sent, in uSec.
+ */
+struct iwl_link_qual_msrmnt_cmd {
+   __le32 cmd_operation;
+   __le32 mac_id;
+   __le32 measurement_time;
+   __le32 timeout;
+} __packed /* LQM_CMD_API_S_VER_1 */;
+
+/**
+ * Link Quality Measurement notification
+ *
+ * @frequent_stations_air_time: an array containing the total air time
+ * (in uSec) used by the most frequently transmitting stations.
+ * @number_of_stations: the number of uniqe stations included in the array
+ * (a number between 0 to 16)
+ * @total_air_time_other_stations: the total air time (uSec) used by all the
+ * stations which are not included in the above report.
+ * @time_in_measurement_window: the total time in uSec in which a measurement
+ * took place.
+ * @tx_frame_dropped: the number of TX frames dropped due to retry limit during
+ * measurement
+ * @mac_id: MAC ID the measurement applies to.
+ * @status: return 

[PATCH 15/43] iwlwifi: add missing mutex_destroy statements

2016-03-30 Thread Emmanuel Grumbach
iwlwifi / iwlmvm didn't destroy their mutexes. Fix that.

Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c| 3 +++
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 6153c8e..d4b71a7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -782,6 +782,9 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode 
*op_mode)
 
iwl_mvm_tof_clean(mvm);
 
+   mutex_destroy(>mutex);
+   mutex_destroy(>d0i3_suspend_mutex);
+
ieee80211_free_hw(mvm->hw);
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 28fe220..0c40209 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1695,6 +1695,7 @@ void iwl_trans_pcie_free(struct iwl_trans *trans)
}
 
free_percpu(trans_pcie->tso_hdr_page);
+   mutex_destroy(_pcie->mutex);
iwl_trans_free(trans);
 }
 
-- 
2.5.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 10/43] iwlwifi: mvm: handle async temperature notification with unlocked mutex

2016-03-30 Thread Emmanuel Grumbach
From: Chaya Rachel Ivgi 

Use RX_HANDLER_ASYNC_UNLOCKED instead of unlock and re-lock
the mutex independently.

Signed-off-by: Chaya Rachel Ivgi 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c  | 9 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 46a22fd..6153c8e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -292,7 +292,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = 
{
RX_HANDLER(DTS_MEASUREMENT_NOTIFICATION, iwl_mvm_temp_notif,
   RX_HANDLER_ASYNC_LOCKED),
RX_HANDLER_GRP(PHY_OPS_GROUP, DTS_MEASUREMENT_NOTIF_WIDE,
-  iwl_mvm_temp_notif, RX_HANDLER_ASYNC_LOCKED),
+  iwl_mvm_temp_notif, RX_HANDLER_ASYNC_UNLOCKED),
RX_HANDLER_GRP(PHY_OPS_GROUP, CT_KILL_NOTIFICATION,
   iwl_mvm_ct_kill_notif, RX_HANDLER_SYNC),
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index f1f2825..8d27137 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -204,20 +204,11 @@ void iwl_mvm_temp_notif(struct iwl_mvm *mvm, struct 
iwl_rx_cmd_buffer *rxb)
if (WARN_ON(ths_crossed >= IWL_MAX_DTS_TRIPS))
return;
 
-   /*
-* We are now handling a temperature notification from the firmware
-* in ASYNC and hold the mutex. thermal_notify_framework will call
-* us back through get_temp() which ought to send a SYNC command to
-* the firmware and hence to take the mutex.
-* Avoid the deadlock by unlocking the mutex here.
-*/
if (mvm->tz_device.tzone) {
struct iwl_mvm_thermal_device *tz_dev = >tz_device;
 
-   mutex_unlock(>mutex);
thermal_notify_framework(tz_dev->tzone,
 tz_dev->fw_trips_index[ths_crossed]);
-   mutex_lock(>mutex);
}
 #endif /* CONFIG_THERMAL */
 }
-- 
2.5.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 06/43] iwlwifi: add a debugfs hook for LQM

2016-03-30 Thread Emmanuel Grumbach
From: Aviya Erenfeld 

Add debugfs entry named lqm_send_cmd for kicking a
measurement. This hook takes the duration and the timeout
as parameter.

Signed-off-by: Aviya Erenfeld 
Signed-off-by: Emmanuel Grumbach 
---
 .../net/wireless/intel/iwlwifi/mvm/debugfs-vif.c   | 85 ++
 1 file changed, 85 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index 1400445..3a279d3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -1425,6 +1425,89 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file 
*file,
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
+static const char * const chanwidths[] = {
+   [NL80211_CHAN_WIDTH_20_NOHT] = "noht",
+   [NL80211_CHAN_WIDTH_20] = "ht20",
+   [NL80211_CHAN_WIDTH_40] = "ht40",
+   [NL80211_CHAN_WIDTH_80] = "vht80",
+   [NL80211_CHAN_WIDTH_80P80] = "vht80p80",
+   [NL80211_CHAN_WIDTH_160] = "vht160",
+};
+
+static bool iwl_mvm_lqm_notif_wait(struct iwl_notif_wait_data *notif_wait,
+  struct iwl_rx_packet *pkt, void *data)
+{
+   struct ieee80211_vif *vif = data;
+   struct iwl_mvm *mvm =
+   container_of(notif_wait, struct iwl_mvm, notif_wait);
+   struct iwl_link_qual_msrmnt_notif *report = (void *)pkt->data;
+   u32 num_of_stations = le32_to_cpu(report->number_of_stations);
+   int i;
+
+   IWL_INFO(mvm, "LQM report:\n");
+   IWL_INFO(mvm, "\tstatus: %d\n", report->status);
+   IWL_INFO(mvm, "\tmacID: %d\n", le32_to_cpu(report->mac_id));
+   IWL_INFO(mvm, "\ttx_frame_dropped: %d\n",
+le32_to_cpu(report->tx_frame_dropped));
+   IWL_INFO(mvm, "\ttime_in_measurement_window: %d us\n",
+le32_to_cpu(report->time_in_measurement_window));
+   IWL_INFO(mvm, "\ttotal_air_time_other_stations: %d\n",
+le32_to_cpu(report->total_air_time_other_stations));
+   IWL_INFO(mvm, "\tchannel_freq: %d\n",
+vif->bss_conf.chandef.center_freq1);
+   IWL_INFO(mvm, "\tchannel_width: %s\n",
+chanwidths[vif->bss_conf.chandef.width]);
+   IWL_INFO(mvm, "\tnumber_of_stations: %d\n", num_of_stations);
+   for (i = 0; i < num_of_stations; i++)
+   IWL_INFO(mvm, "\t\tsta[%d]: %d\n", i,
+report->frequent_stations_air_time[i]);
+
+   return true;
+}
+
+static ssize_t iwl_dbgfs_lqm_send_cmd_write(struct ieee80211_vif *vif,
+   char *buf, size_t count,
+   loff_t *ppos)
+{
+   struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+   struct iwl_mvm *mvm = mvmvif->mvm;
+   struct iwl_notification_wait wait_lqm_notif;
+   static u16 lqm_notif[] = {
+   WIDE_ID(MAC_CONF_GROUP,
+   LINK_QUALITY_MEASUREMENT_COMPLETE_NOTIF)
+   };
+   int err;
+   u32 duration;
+   u32 timeout;
+
+   if (sscanf(buf, "%d,%d", , ) != 2)
+   return -EINVAL;
+
+   iwl_init_notification_wait(>notif_wait, _lqm_notif,
+  lqm_notif, ARRAY_SIZE(lqm_notif),
+  iwl_mvm_lqm_notif_wait, vif);
+   mutex_lock(>mutex);
+   err = iwl_mvm_send_lqm_cmd(vif, LQM_CMD_OPERATION_START_MEASUREMENT,
+  duration, timeout);
+   mutex_unlock(>mutex);
+
+   if (err) {
+   IWL_ERR(mvm, "Failed to send lqm cmdf(err=%d)\n", err);
+   iwl_remove_notification(>notif_wait, _lqm_notif);
+   return err;
+   }
+
+   /* wait for 2 * timeout (safety guard) and convert to jiffies*/
+   timeout = msecs_to_jiffies((timeout * 2) / 1000);
+
+   err = iwl_wait_notification(>notif_wait, _lqm_notif,
+   timeout);
+   if (err)
+   IWL_ERR(mvm, "Getting lqm notif timed out\n");
+
+   return count;
+}
+
 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -1449,6 +1532,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_abort, 32);
 MVM_DEBUGFS_READ_FILE_OPS(tof_range_response);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
+MVM_DEBUGFS_WRITE_FILE_OPS(lqm_send_cmd, 64);
 
 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
@@ -1488,6 +1572,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, 
struct ieee80211_vif *vif)
 S_IRUSR | S_IWUSR);
MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir,

[PATCH 14/43] iwlwifi: mvm: add support for new TX CMD API

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

TX CMD API has changed to support offload assist.
Currently we do not enable checksum yet, but must set the
padding indication, to avoid FW errors.
Set other amsdu flag as well.
The rest of the flags will be configured only if HW csum
is enabled and will be set in future patches.
This change is backward compatible.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h | 35 --
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c|  9 +-
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
index ba3f0bb..dadcccd 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
@@ -6,6 +6,7 @@
  * GPL LICENSE SUMMARY
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -193,11 +194,41 @@ enum iwl_tx_pm_timeouts {
 #define IWL_BAR_DFAULT_RETRY_LIMIT 60
 #define IWL_LOW_RETRY_LIMIT7
 
+/**
+ * enum iwl_tx_offload_assist_flags_pos -  set %iwl_tx_cmd offload_assist 
values
+ * @TX_CMD_OFFLD_IP_HDR_OFFSET: offset to start of IP header (in words)
+ * from mac header end. For normal case it is 4 words for SNAP.
+ * note: tx_cmd, mac header and pad are not counted in the offset.
+ * This is used to help the offload in case there is tunneling such as
+ * IPv6 in IPv4, in such case the ip header offset should point to the
+ * inner ip header and IPv4 checksum of the external header should be
+ * calculated by driver.
+ * @TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum
+ * @TX_CMD_OFFLD_L3_EN: enable IP header checksum
+ * @TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV
+ * field. Doesn't include the pad.
+ * @TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for
+ * alignment
+ * @TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU
+ */
+enum iwl_tx_offload_assist_flags_pos {
+   TX_CMD_OFFLD_IP_HDR =   0,
+   TX_CMD_OFFLD_L4_EN =6,
+   TX_CMD_OFFLD_L3_EN =7,
+   TX_CMD_OFFLD_MH_SIZE =  8,
+   TX_CMD_OFFLD_PAD =  13,
+   TX_CMD_OFFLD_AMSDU =14,
+};
+
+#define IWL_TX_CMD_OFFLD_MH_MASK   0x1f
+#define IWL_TX_CMD_OFFLD_IP_HDR_MASK   0x3f
+
 /* TODO: complete documentation for try_cnt and btkill_cnt */
 /**
  * struct iwl_tx_cmd - TX command struct to FW
  * ( TX_CMD = 0x1c )
  * @len: in bytes of the payload, see below for details
+ * @offload_assist: TX offload configuration
  * @tx_flags: combination of TX_CMD_FLG_*
  * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
  * cleared. Combination of RATE_MCS_*
@@ -231,7 +262,7 @@ enum iwl_tx_pm_timeouts {
  */
 struct iwl_tx_cmd {
__le16 len;
-   __le16 next_frame_len;
+   __le16 offload_assist;
__le32 tx_flags;
struct {
u8 try_cnt;
@@ -255,7 +286,7 @@ struct iwl_tx_cmd {
__le16 reserved4;
u8 payload[0];
struct ieee80211_hdr hdr[0];
-} __packed; /* TX_CMD_API_S_VER_3 */
+} __packed; /* TX_CMD_API_S_VER_6 */
 
 /*
  * TX response related data
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 75870e6..138d64d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -126,6 +126,9 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff 
*skb,
u8 *qc = ieee80211_get_qos_ctl(hdr);
tx_cmd->tid_tspec = qc[0] & 0xf;
tx_flags &= ~TX_CMD_FLG_SEQ_CTL;
+   if (*qc & IEEE80211_QOS_CTL_A_MSDU_PRESENT)
+   tx_cmd->offload_assist |=
+   cpu_to_le16(BIT(TX_CMD_OFFLD_AMSDU));
} else if (ieee80211_is_back_req(fc)) {
struct ieee80211_bar *bar = (void *)skb->data;
u16 control = le16_to_cpu(bar->control);
@@ -186,9 +189,13 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct 
sk_buff *skb,
/* Total # bytes to be transmitted */
tx_cmd->len = cpu_to_le16((u16)skb->len +
(uintptr_t)info->driver_data[0]);
-   tx_cmd->next_frame_len = 0;
tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
tx_cmd->sta_id = sta_id;
+
+   /* padding is inserted later in transport */
+   if (ieee80211_hdrlen(fc) % 4 &&
+   !(tx_cmd->offload_assist & cpu_to_le16(BIT(TX_CMD_OFFLD_AMSDU
+   tx_cmd->offload_assist |= 

[PATCH 16/43] iwlwifi: make uapsd_disable module param a bitmap

2016-03-30 Thread Emmanuel Grumbach
This allows to disable uapsd for BSS only, or P2P client
separately. Remove the now unneeded
IWL_MVM_P2P_UAPSD_STANDALONE constant.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c   | 10 ++
 drivers/net/wireless/intel/iwlwifi/iwl-modparams.h | 10 --
 drivers/net/wireless/intel/iwlwifi/mvm/constants.h |  1 -
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  |  3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  3 ++-
 5 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index f899666..2cd9c31 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1561,7 +1561,7 @@ struct iwl_mod_params iwlwifi_mod_params = {
.d0i3_disable = true,
.d0i3_entry_delay = 1000,
 #ifndef CONFIG_IWLWIFI_UAPSD
-   .uapsd_disable = true,
+   .uapsd_disable = IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT,
 #endif /* CONFIG_IWLWIFI_UAPSD */
/* the rest are 0 by default */
 };
@@ -1681,11 +1681,13 @@ module_param_named(lar_disable, 
iwlwifi_mod_params.lar_disable,
 MODULE_PARM_DESC(lar_disable, "disable LAR functionality (default: N)");
 
 module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable,
-  bool, S_IRUGO | S_IWUSR);
+  uint, S_IRUGO | S_IWUSR);
 #ifdef CONFIG_IWLWIFI_UAPSD
-MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)");
+MODULE_PARM_DESC(uapsd_disable,
+"disable U-APSD functionality bitmap 1: BSS 2: P2P Client 
(default: 0)");
 #else
-MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: Y)");
+MODULE_PARM_DESC(uapsd_disable,
+"disable U-APSD functionality bitmap 1: BSS 2: P2P Client 
(default: 3)");
 #endif
 
 /*
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
index d1a5dd1..6c5c2f9 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-modparams.h
@@ -92,6 +92,11 @@ enum iwl_amsdu_size {
IWL_AMSDU_12K = 2,
 };
 
+enum iwl_uapsd_disable {
+   IWL_DISABLE_UAPSD_BSS   = BIT(0),
+   IWL_DISABLE_UAPSD_P2P_CLIENT= BIT(1),
+};
+
 /**
  * struct iwl_mod_params
  *
@@ -109,7 +114,8 @@ enum iwl_amsdu_size {
  * @debug_level: levels are IWL_DL_*
  * @ant_coupling: antenna coupling in dB, default = 0
  * @nvm_file: specifies a external NVM file
- * @uapsd_disable: disable U-APSD, default = 1
+ * @uapsd_disable: disable U-APSD, see %enum iwl_uapsd_disable, default =
+ * IWL_DISABLE_UAPSD_BSS | IWL_DISABLE_UAPSD_P2P_CLIENT
  * @d0i3_disable: disable d0i3, default = 1,
  * @d0i3_entry_delay: time to wait after no refs are taken before
  * entering D0i3 (in msecs)
@@ -131,7 +137,7 @@ struct iwl_mod_params {
 #endif
int ant_coupling;
char *nvm_file;
-   bool uapsd_disable;
+   u32 uapsd_disable;
bool d0i3_disable;
unsigned int d0i3_entry_delay;
bool lar_disable;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
index 4b560e4..b96b1c6 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
@@ -75,7 +75,6 @@
 #define IWL_MVM_WOWLAN_PS_RX_DATA_TIMEOUT  (10 * USEC_PER_MSEC)
 #define IWL_MVM_SHORT_PS_TX_DATA_TIMEOUT   (2 * 1024) /* defined in TU */
 #define IWL_MVM_SHORT_PS_RX_DATA_TIMEOUT   (40 * 1024) /* defined in TU */
-#define IWL_MVM_P2P_UAPSD_STANDALONE   0
 #define IWL_MVM_P2P_LOWLATENCY_PS_ENABLE   0
 #define IWL_MVM_UAPSD_RX_DATA_TIMEOUT  (50 * USEC_PER_MSEC)
 #define IWL_MVM_UAPSD_TX_DATA_TIMEOUT  (50 * USEC_PER_MSEC)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index cff9c16..1a3481b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2345,7 +2345,8 @@ static void iwl_mvm_check_uapsd(struct iwl_mvm *mvm, 
struct ieee80211_vif *vif,
return;
}
 
-   if (iwlwifi_mod_params.uapsd_disable) {
+   if (!vif->p2p &&
+   (iwlwifi_mod_params.uapsd_disable & IWL_DISABLE_UAPSD_BSS)) {
vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD;
return;
}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 2e0a882..02ef1d9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1072,7 +1072,8 @@ bool iwl_mvm_is_p2p_standalone_uapsd_supported(struct 
iwl_mvm *mvm)
 {
return fw_has_capa(>fw->ucode_capa,
   

[PATCH 18/43] iwlwifi: mvm: remove is_data_qos variable in TX

2016-03-30 Thread Emmanuel Grumbach
From: Johannes Berg 

"is_data_qos == true" is equivalent to "tid < IWL_MAX_TID_COUNT"
since tid is only assigned (and range-checked) in that case.

This removes a (harmless) smatch warning that occurs because it
can't seem to follow the above logic from the code.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 138d64d..c7c3d7b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -654,7 +654,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct 
sk_buff *skb,
u16 seq_number = 0;
u8 tid = IWL_MAX_TID_COUNT;
u8 txq_id = info->hw_queue;
-   bool is_data_qos = false, is_ampdu = false;
+   bool is_ampdu = false;
int hdrlen;
 
mvmsta = iwl_mvm_sta_from_mac80211(sta);
@@ -694,7 +694,6 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct 
sk_buff *skb,
seq_number &= IEEE80211_SCTL_SEQ;
hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
hdr->seq_ctrl |= cpu_to_le16(seq_number);
-   is_data_qos = true;
is_ampdu = info->flags & IEEE80211_TX_CTL_AMPDU;
}
 
@@ -722,7 +721,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct 
sk_buff *skb,
if (iwl_trans_tx(mvm->trans, skb, dev_cmd, txq_id))
goto drop_unlock_sta;
 
-   if (is_data_qos && !ieee80211_has_morefrags(fc))
+   if (tid < IWL_MAX_TID_COUNT && !ieee80211_has_morefrags(fc))
mvmsta->tid_data[tid].seq_number = seq_number + 0x10;
 
spin_unlock(>lock);
-- 
2.5.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 11/43] iwlwifi: pcie: print error value as signed int

2016-03-30 Thread Emmanuel Grumbach
Bjorn pointed out that printing an error value as an
hexadecimal isn't very convenient. Change that.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 007bcb5..28fe220 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1466,7 +1466,7 @@ static void iwl_pcie_set_interrupt_capa(struct pci_dev 
*pdev,
 
ret = pci_enable_msi(pdev);
if (ret) {
-   dev_err(>dev, "pci_enable_msi failed(0X%x)\n", ret);
+   dev_err(>dev, "pci_enable_msi failed - %d\n", ret);
/* enable rfkill interrupt: hw bug w/a */
pci_read_config_word(pdev, PCI_COMMAND, _cmd);
if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
-- 
2.5.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 08/43] iwlwifi: pcie: enable interrupts explicitly on resume

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

When entering suspend the driver calls iwl_disable_interrupts() and
then iwl_pcie_disable_ict().
On resume the driver calls only iwl_pcie_reset_ict() without calling
explicitly to iwl_enable_interrupts().
This mostly works since iwl_pcie_reset_ict is calling to
iwl_enable_interrupts, but it doesn't work when there is no ict_table
in MSIx mode.
The result is that driver tries to resume but fails since it doesn't
get the RX interrupt from FW indicating that d0i3 exit was completed.
Fix it by adding an explicit call to enable interrupts.

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

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index eb39c7e..d4306e2 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1321,6 +1321,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans 
*trans,
 * after this call.
 */
iwl_pcie_reset_ict(trans);
+   iwl_enable_interrupts(trans);
 
iwl_set_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
iwl_set_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-- 
2.5.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 02/43] iwlwifi: mvm: Decrease size of the paging download buffer

2016-03-30 Thread Emmanuel Grumbach
From: Matti Gottlieb 

Currently the driver has 2 buffers for paging:
1. paging db - this contains all of the pages that were in the FW
image, that the driver stores for the FW. This is allocated for each
block separately (not contiguous).
2. download buffer - we need to provide this empty buffer for the
iwl_sdio_load_fw_chunk function to copy the requested pages to the shared
memory. This is one big buffer of contiguous memory whose size is the
size of all the blocks that the fw paging section can contain.

This download buffer size is too big, and causes the allocation to fail
sometimes. Since the driver allocates memory for each block separately,
it is not possible for the FW to request all of the pages in one request
(the FW gives an address and size, so blocks need to be contiguous for
this to happen), therefore the FW is limited to request only one block.

Decrease the size of the paging download buffer to be the size of a
paging block.

Signed-off-by: Matti Gottlieb 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 594cd0d..ebbadcf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -410,7 +410,9 @@ static int iwl_trans_get_paging_item(struct iwl_mvm *mvm)
goto exit;
}
 
-   mvm->trans->paging_download_buf = kzalloc(MAX_PAGING_IMAGE_SIZE,
+   /* Add an extra page for headers */
+   mvm->trans->paging_download_buf = kzalloc(PAGING_BLOCK_SIZE +
+ FW_PAGING_SIZE,
  GFP_KERNEL);
if (!mvm->trans->paging_download_buf) {
ret = -ENOMEM;
-- 
2.5.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 03/43] iwlwifi: mvm: make sure FW contains the right amount of paging sections

2016-03-30 Thread Emmanuel Grumbach
From: Matti Gottlieb 

Paging contains 3 sections in the fw. The first for the paging separator,
The second for the CSS block, the third with the paging data.

Currently if the driver finds the paging separator, and there is only
section left (CSS), once reading the CSS section, the driver will
attempt to read the paging data and will go out of the arrays bounds.

Make sure that the FW image contains the right amount of sections for
paging.

Signed-off-by: Matti Gottlieb 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index ebbadcf..766c262 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -174,8 +174,12 @@ static int iwl_fill_paging_mem(struct iwl_mvm *mvm, const 
struct fw_img *image)
}
}
 
-   if (sec_idx >= IWL_UCODE_SECTION_MAX) {
-   IWL_ERR(mvm, "driver didn't find paging image\n");
+   /*
+* If paging is enabled there should be at least 2 more sections left
+* (one for CSS and one for Paging data)
+*/
+   if (sec_idx >= ARRAY_SIZE(image->sec) - 1) {
+   IWL_ERR(mvm, "Paging: Missing CSS and/or paging sections\n");
iwl_free_fw_paging(mvm);
return -EINVAL;
}
-- 
2.5.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 01/43] iwlwifi: pcie: clear trans reference on queue stop

2016-03-30 Thread Emmanuel Grumbach
From: Sara Sharon 

Currently when stop flow is performed, there might be transport TX RTPM
references that are not freed in case we unmap a queue that still has
packets not reclaimed. Fix that.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c | 59 +---
 1 file changed, 36 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index 16ad820..cc6fa00 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -596,6 +596,28 @@ static void iwl_pcie_free_tso_page(struct sk_buff *skb)
}
 }
 
+static void iwl_pcie_clear_cmd_in_flight(struct iwl_trans *trans)
+{
+   struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+
+   lockdep_assert_held(_pcie->reg_lock);
+
+   if (trans_pcie->ref_cmd_in_flight) {
+   trans_pcie->ref_cmd_in_flight = false;
+   IWL_DEBUG_RPM(trans, "clear ref_cmd_in_flight - unref\n");
+   iwl_trans_pcie_unref(trans);
+   }
+
+   if (!trans->cfg->base_params->apmg_wake_up_wa)
+   return;
+   if (WARN_ON(!trans_pcie->cmd_hold_nic_awake))
+   return;
+
+   trans_pcie->cmd_hold_nic_awake = false;
+   __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
+  CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+}
+
 /*
  * iwl_pcie_txq_unmap -  Unmap any remaining DMA mappings and free skb's
  */
@@ -620,6 +642,20 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, 
int txq_id)
}
iwl_pcie_txq_free_tfd(trans, txq);
q->read_ptr = iwl_queue_inc_wrap(q->read_ptr);
+
+   if (q->read_ptr == q->write_ptr) {
+   unsigned long flags;
+
+   spin_lock_irqsave(_pcie->reg_lock, flags);
+   if (txq_id != trans_pcie->cmd_queue) {
+   IWL_DEBUG_RPM(trans, "Q %d - last tx freed\n",
+ q->id);
+   iwl_trans_pcie_unref(trans);
+   } else {
+   iwl_pcie_clear_cmd_in_flight(trans);
+   }
+   spin_unlock_irqrestore(_pcie->reg_lock, flags);
+   }
}
txq->active = false;
 
@@ -1148,29 +1184,6 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans 
*trans,
return 0;
 }
 
-static int iwl_pcie_clear_cmd_in_flight(struct iwl_trans *trans)
-{
-   struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-
-   lockdep_assert_held(_pcie->reg_lock);
-
-   if (trans_pcie->ref_cmd_in_flight) {
-   trans_pcie->ref_cmd_in_flight = false;
-   IWL_DEBUG_RPM(trans, "clear ref_cmd_in_flight - unref\n");
-   iwl_trans_pcie_unref(trans);
-   }
-
-   if (trans->cfg->base_params->apmg_wake_up_wa) {
-   if (WARN_ON(!trans_pcie->cmd_hold_nic_awake))
-   return 0;
-
-   trans_pcie->cmd_hold_nic_awake = false;
-   __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
-  
CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-   }
-   return 0;
-}
-
 /*
  * iwl_pcie_cmdq_reclaim - Reclaim TX command queue entries already Tx'd
  *
-- 
2.5.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: Question on rhashtable in worst-case scenario.

2016-03-30 Thread Johannes Berg
On Wed, 2016-03-30 at 21:55 +0800, Herbert Xu wrote:

> Well to start with you should assess whether you really want to
> hash multiple objects with the same key.  In particular, can an
> adversary generate a large number of such objects?

No, the only reason this happens is local - if you take the single
hardware and connect it to the same AP many times. This is what Ben is
doing - he's creating virtual interfaces on top of the same physical
hardware, and then connection all of these to the same AP, mostly for
testing the AP.

> If your conclusion is that yes you really want to do this, then
> we have the parameter insecure_elasticity that you can use to
> disable the rehashing based on chain length.

But we really don't want that either - in the normal case where you
don't create all these virtual interfaces for testing, you have a
certain number of peers that can vary a lot (zero to hundreds, in
theory thousands) where you *don't* have the same key, so we still want
to have the rehashing if the chains get longer in that case.

It's really just the degenerate case that Ben is creating locally
that's causing a problem, afaict, though it's a bit disconcerting that
rhashtable in general can cause strange failures at delete time.

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: Question on rhashtable in worst-case scenario.

2016-03-30 Thread Herbert Xu
On Wed, Mar 30, 2016 at 11:14:12AM +0200, Johannes Berg wrote:
> On Tue, 2016-03-29 at 09:16 -0700, Ben Greear wrote:
> > Looks like rhashtable has too much policy in it to properly deal with
> > cases where there are too many hash collisions, so I am going to work
> > on reverting it's use in mac80211.
> 
> I'm not really all that happy with that approach - can't we fix the
> rhashtable? It's a pretty rare corner case that many keys really are
> identical and no kind of hash algorithm, but it seems much better to
> still deal with it than to remove the rhashtable usage and go back to
> hand-rolling something.

Well to start with you should assess whether you really want to
hash multiple objects with the same key.  In particular, can an
adversary generate a large number of such objects?

If your conclusion is that yes you really want to do this, then
we have the parameter insecure_elasticity that you can use to
disable the rehashing based on chain length.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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 v6 2/2] mwifiex: add platform specific wakeup interrupt support

2016-03-30 Thread Amitkumar Karwar
From: Xinming Hu 

On some arm-based platforms, we need to configure platform specific
parameters by device tree node and also define our node as a child
node of parent SDIO host controller.
This patch parses these parameters from device tree. It includes
calibration data dowoload to firmware, wakeup pin configured to firmware,
and soc specific wake up gpio, which will be set as wakeup interrupt pin.

Signed-off-by: Xinming Hu 
Signed-off-by: Amitkumar Karwar 
---
 drivers/net/wireless/marvell/mwifiex/main.h| 11 
 drivers/net/wireless/marvell/mwifiex/sdio.c| 77 ++
 drivers/net/wireless/marvell/mwifiex/sdio.h|  7 +++
 drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 14 -
 4 files changed, 106 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.h 
b/drivers/net/wireless/marvell/mwifiex/main.h
index eb2c90c..9da27cf 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -37,6 +37,17 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "decl.h"
 #include "ioctl.h"
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 901c064..c55e69b 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -73,6 +73,66 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = {
{"EXTLAST", NULL, 0, 0xFE},
 };
 
+static const struct of_device_id mwifiex_sdio_of_match_table[] = {
+   { .compatible = "marvell,sd8897" },
+   { .compatible = "marvell,sd8997" },
+   { }
+};
+
+static irqreturn_t mwifiex_wake_irq_wifi(int irq, void *priv)
+{
+   struct mwifiex_plt_wake_cfg *cfg = priv;
+
+   if (cfg->irq_wifi >= 0) {
+   pr_info("%s: wake by wifi", __func__);
+   cfg->wake_by_wifi = true;
+   disable_irq_nosync(irq);
+   }
+
+   return IRQ_HANDLED;
+}
+
+/* This function parse device tree node using mmc subnode devicetree API.
+ * The device node is saved in card->plt_of_node.
+ * if the device tree node exist and include interrupts attributes, this
+ * function will also request platform specific wakeup interrupt.
+ */
+static int mwifiex_sdio_probe_of(struct device *dev, struct sdio_mmc_card 
*card)
+{
+   struct mwifiex_plt_wake_cfg *cfg;
+   int ret;
+
+   if (!dev->of_node ||
+   !of_match_node(mwifiex_sdio_of_match_table, dev->of_node)) {
+   pr_err("sdio platform data not available");
+   return -1;
+   }
+
+   card->plt_of_node = dev->of_node;
+   card->plt_wake_cfg = devm_kzalloc(dev, sizeof(*card->plt_wake_cfg),
+ GFP_KERNEL);
+   cfg = card->plt_wake_cfg;
+   if (cfg && card->plt_of_node) {
+   cfg->irq_wifi = irq_of_parse_and_map(card->plt_of_node, 0);
+   if (!cfg->irq_wifi) {
+   dev_err(dev, "fail to parse irq_wifi from device tree");
+   } else {
+   ret = devm_request_irq(dev, cfg->irq_wifi,
+  mwifiex_wake_irq_wifi,
+  IRQF_TRIGGER_LOW,
+  "wifi_wake", cfg);
+   if (ret) {
+   dev_err(dev,
+   "Failed to request irq_wifi %d (%d)\n",
+   cfg->irq_wifi, ret);
+   }
+   disable_irq(cfg->irq_wifi);
+   }
+   }
+
+   return 0;
+}
+
 /*
  * SDIO probe.
  *
@@ -127,6 +187,9 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct 
sdio_device_id *id)
return -EIO;
}
 
+   /* device tree node parsing and platform specific configuration*/
+   mwifiex_sdio_probe_of(>dev, card);
+
if (mwifiex_add_card(card, _remove_card_sem, _ops,
 MWIFIEX_SDIO)) {
pr_err("%s: add card failed\n", __func__);
@@ -183,6 +246,13 @@ static int mwifiex_sdio_resume(struct device *dev)
mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
  MWIFIEX_SYNC_CMD);
 
+   /* Disable platform specific wakeup interrupt */
+   if (card->plt_wake_cfg && card->plt_wake_cfg->irq_wifi >= 0) {
+   disable_irq_wake(card->plt_wake_cfg->irq_wifi);
+   if (!card->plt_wake_cfg->wake_by_wifi)
+   disable_irq(card->plt_wake_cfg->irq_wifi);
+   }
+
return 0;
 }
 
@@ -262,6 +332,13 @@ static int mwifiex_sdio_suspend(struct device *dev)
 
adapter = card->adapter;
 
+   /* Enable platform specific wakeup 

[PATCH v6 1/2] dt: bindings: add MARVELL's sd8xxx wireless device

2016-03-30 Thread Amitkumar Karwar
From: Xinming Hu 

Add device tree binding documentation for MARVELL's sd8xxx
(sd8897 and sd8997) wlan chip.

Signed-off-by: Xinming Hu 
Signed-off-by: Amitkumar Karwar 
---
Listing changelist for both 1/2 and 2/2 patches
v3: Don't update adapter->dt_node if mwifiex_plt_dev is NULL

v4: a)Corrected the 'name' and 'compatible' property names.(Arnd Bergmann and 
Rob
Herring)
b)Patch description wraped in 72 columns(Rob Herring)
c)Moved DT binding file to bindings/net/wireless/(Rob Herring)
d)Renamed "mwifiex,chip-gpio" to "marvell,wakeup-gpios"(Rob Herring/
Arnd Bergmann)
e)Replaced #ifdef with __maybe_unused(Arnd Bergmann)

v5: a)Removed wildcards from compatible string(Arnd Bergmann)
b)Prepared single patch for all binding changes(Rob Herring)
c)Specified our node as a subnode of SDIO controller. With this approach, we
don't need to register new platform driver. (Rob herring)

v6: a)List out the specific property names for marvell,caldata* and size of the 
data(Rob Herring)
b)Use sdio function number for both the unit address and reg(Rob Herring)
---
 .../bindings/net/wireless/marvell-sd8xxx.txt   | 63 ++
 1 file changed, 63 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt 
b/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
new file mode 100644
index 000..337fed4
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
@@ -0,0 +1,63 @@
+Marvell 8897/8997 (sd8897/sd8997) SDIO devices
+--
+
+This node provides properties for controlling the marvell sdio wireless device.
+The node is expected to be specified as a child node to the SDIO controller 
that
+connects the device to the system.
+
+Required properties:
+
+  - compatible : should be one of the following:
+   * "marvell,sd8897"
+   * "marvell,sd8997"
+
+Optional properties:
+
+  - marvell,caldata* : A series of properties with marvell,caldata prefix,
+ represent calibration data downloaded to the device during
+ initialization. This is an array of unsigned values.
+ the properties should follow below property name and
+ corresponding array length:
+   "marvell,caldata_00_txpwrlimit_2g_cfg_set" (length = 566).
+   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub0" (length = 502).
+   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub1" (length = 688).
+   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub2" (length = 750).
+   "marvell,caldata_00_txpwrlimit_5g_cfg_set_sub3" (length = 502).
+  - marvell,wakeup-pin : 'wakeuppin' is a wakeup pin number of wifi chip which 
will
+ be configured to firmware. firmware will wakeup host side 
use
+ the pin during suspend/resume stage.
+  - interrupt-parent: phandle of the parent interrupt controller
+  - interrupts : interrupt pin number to the cpu. driver will request an irq 
based on
+this interrupt number. during system suspend, the irq will be 
enabled
+as system wakeup source, so that the wifi chip can wakeup host
+platform under certain condition. during system resume, the 
irq will
+be disabled to make sure unnecessary interrupt is not received.
+
+Example:
+
+Tx power limit calibration data is configured in below example.
+The calibration data is an array of unsigned values, the length
+can vary between hw versions.
+IRQ pin 38 is used as system wakeup source interrupt. wakeup pin 3 is 
configured
+so that firmware can wakeup host using this device side pin.
+
+ {
+   status = "okay";
+   vmmc-supply = <_en_reg>;
+   bus-width = <4>;
+   cap-power-off-card;
+   keep-power-in-suspend;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+   mwifiex: mwifiex@1 {
+   compatible = "marvell,sd8897";
+   reg = <1>;
+   interrupt-parent = <>;
+   interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
+
+   marvell,caldata_00_txpwrlimit_2g_cfg_set = /bits/ 8 <
+   0x01 0x00 0x06 0x00 0x08 0x02 0x89 0x01>;
+   marvell,wakeup-pin = <3>;
+   };
+};
-- 
1.8.1.4

--
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 2/2] iwlwifi: mvm: fix memory leak in paging

2016-03-30 Thread Emmanuel Grumbach
From: Matti Gottlieb 

Currently paging download buffer is freed during the
the unloading of the opmode which happens when the driver
is unloaded.

This causes a memory leak since the paging download
buffer is allocated every time we enable the
interface, so the download buffer can be allocated many
times, but only be freed once.

Free paging download buffer during disabling of the
interface.

CC: sta...@vger.kernel.org [4.3+]
Signed-off-by: Matti Gottlieb 
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 76e649c..a50f4df 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1147,6 +1147,8 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
/* the fw is stopped, the aux sta is dead: clean up driver state */
iwl_mvm_del_aux_sta(mvm);
 
+   iwl_free_fw_paging(mvm);
+
/*
 * Clear IN_HW_RESTART flag when stopping the hw (as restart_complete()
 * won't be called in this case).
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 5e8ab79..d278399 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -761,8 +761,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode 
*op_mode)
for (i = 0; i < NVM_MAX_NUM_SECTIONS; i++)
kfree(mvm->nvm_sections[i].data);
 
-   iwl_free_fw_paging(mvm);
-
iwl_mvm_tof_clean(mvm);
 
ieee80211_free_hw(mvm->hw);
-- 
2.5.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 1/2] iwlwifi: pcie: lower the debug level for RSA semaphore access

2016-03-30 Thread Emmanuel Grumbach
IWL_INFO is not an error but still printed by default.
"can't access the RSA semaphore it is write protected" seems
worrisome but it is not really a problem.

CC:  [4.1+]
Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index eb39c7e..b2b7935 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -732,8 +732,8 @@ static int iwl_pcie_rsa_race_bug_wa(struct iwl_trans *trans)
 */
val = iwl_read_prph(trans, PREG_AUX_BUS_WPROT_0);
if (val & (BIT(1) | BIT(17))) {
-   IWL_INFO(trans,
-"can't access the RSA semaphore it is write 
protected\n");
+   IWL_DEBUG_INFO(trans,
+  "can't access the RSA semaphore it is write 
protected\n");
return 0;
}
 
-- 
2.5.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


pull request: iwlwifi 2016-03-30

2016-03-30 Thread Grumbach, Emmanuel
Hi Kalle,

This is a pull request for 4.6 that includes 2 trivial fixes.
Please let me know if you have issues.
Thanks!

The following changes since commit 1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 
(2016-03-19 10:05:34 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git 
tags/iwlwifi-for-kalle-2016-03-30

for you to fetch changes up to 7fdf9663261cc77a516396fec82cee8a8ea07e76:

  iwlwifi: mvm: fix memory leak in paging (2016-03-20 23:01:54 +0200)


* lower the debug level of a benign print
* fix a memory leak


Emmanuel Grumbach (1):
  iwlwifi: pcie: lower the debug level for RSA semaphore access

Matti Gottlieb (1):
  iwlwifi: mvm: fix memory leak in paging

 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c  | 2 --
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 
deletions(-)N�r��yb�X��ǧv�^�)޺{.n�+{��*ޕ�,�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer 
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len;
}
 
+   /* Drive CS line high */
+   gpio_direction_output(master->cs_gpios[0], 1);
return 0;
 }
 
-static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
-void *buf, size_t len, bool fixed)
+static 

Re: [PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Emmanuel Grumbach
On Wed, Mar 30, 2016 at 3:58 PM, Eyal Reizer  wrote:
>
> From: Eyal 

Are you trying to hide or something? :)

>
> Add support for using with both wl12xx and wl18xx.
>
> - all wilink family needs special init command for entering wspi mode.
>   extra clock cycles should be sent after the spi init command while the
>   cs pin is high.
> - switch to controling the cs pin from the spi driver for achieveing the
>   above.
> - the selected cs gpio is read from the spi device-tree node using the
>   cs-gpios field and setup as a gpio.
> - See the example below for specifying the cs gpio using the cs-gpios entry
>
>{
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <_pins>;
> cs-gpios = < 5 0>;
> #address-cells = <1>;
> #size-cells = <0>;
> wlcore: wlcore@0 {
> compatible = "ti,wl1835";
> vwlan-supply = <_en_reg>;
> spi-max-frequency = <4800>;
> reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
> interrupt-parent = <>;
> interrupts = <27 IRQ_TYPE_EDGE_RISING>;
> };
> };
>
> Signed-off-by: Eyal Reizer 
> ---
>  drivers/net/wireless/ti/wlcore/spi.c |  176 
> ++
>  1 file changed, 157 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
> b/drivers/net/wireless/ti/wlcore/spi.c
> index 96d9c9d..6c5a369 100644
> --- a/drivers/net/wireless/ti/wlcore/spi.c
> +++ b/drivers/net/wireless/ti/wlcore/spi.c
> @@ -32,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include "wlcore.h"
>  #include "wl12xx_80211.h"
> @@ -70,16 +71,30 @@
>  #define WSPI_MAX_CHUNK_SIZE4092
>
>  /*
> - * only support SPI for 12xx - this code should be reworked when 18xx
> - * support is introduced
> + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
> + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
>   */
> -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
> +#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
>
>  /* Maximum number of SPI write chunks */
>  #define WSPI_MAX_NUM_OF_CHUNKS \
> ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
>
>
> +struct wilink_familiy_data {
> +   char name[8];
> +};
> +
> +const struct wilink_familiy_data *wilink_data;
> +
> +static const struct wilink_familiy_data wl18xx_data = {
> +   .name = "wl18xx",
> +};
> +
> +static const struct wilink_familiy_data wl12xx_data = {
> +   .name = "wl12xx",
> +};
> +
>  struct wl12xx_spi_glue {
> struct device *dev;
> struct platform_device *core;
> @@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
> struct spi_transfer t;
> struct spi_message m;
> u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
> +   struct spi_device *spi = (struct spi_device *)glue->dev;
> +   struct spi_master *master = spi->master;
>
> if (!cmd) {
> dev_err(child->parent,
> @@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
> return;
> }
>
> +   if (!master->cs_gpios) {
> +   dev_err(child->parent,
> +   "spi chip select pin missing in platform data!\n");
> +   return;
> +   }
> +
> +   /* Drive CS line low */
> +   gpio_direction_output(master->cs_gpios[0], 0);
> +
> memset(, 0, sizeof(t));
> spi_message_init();
>
> @@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
> spi_message_add_tail(, );
>
> spi_sync(to_spi_device(glue->dev), );
> +
> +   /* Send extra clocks with CS high. this is required by the wilink
> +* family in order for successfully enter WSPI mode
> +*/
> +   gpio_direction_output(master->cs_gpios[0], 1);
> +
> +   memset(, 0, sizeof(m));
> +   spi_message_init();
> +
> +   cmd[0] = 0xff;
> +   cmd[1] = 0xff;
> +   cmd[2] = 0xff;
> +   cmd[3] = 0xff;
> +   swab32s((u32 *)cmd);
> +
> +   t.tx_buf = cmd;
> +   t.len = 4;
> +   spi_message_add_tail(, );
> +   spi_sync(to_spi_device(glue->dev), );
> +
> kfree(cmd);
>  }
>
> @@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct 
> device *child, int addr,
> u32 *busy_buf;
> u32 *cmd;
> u32 chunk_len;
> +   struct spi_device *spi = (struct spi_device *)glue->dev;
> +   struct spi_master *master = spi->master;
> +
> +   if (!master->cs_gpios) {
> +   dev_err(child->parent,
> +   "spi chip select pin missing in platform data!\n");
> +   return -EINVAL;
> +   }
> +   /* Drive CS line low */
> +   gpio_direction_output(master->cs_gpios[0], 0);
>
> while (len > 0) {
> chunk_len = min_t(size_t, 

[PATCH] wlcore: spi: add wl18xx support

2016-03-30 Thread Eyal Reizer
From: Eyal 

Add support for using with both wl12xx and wl18xx.

- all wilink family needs special init command for entering wspi mode.
  extra clock cycles should be sent after the spi init command while the
  cs pin is high.
- switch to controling the cs pin from the spi driver for achieveing the
  above.
- the selected cs gpio is read from the spi device-tree node using the
  cs-gpios field and setup as a gpio.
- See the example below for specifying the cs gpio using the cs-gpios entry

   {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <_pins>;
cs-gpios = < 5 0>;
#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
vwlan-supply = <_en_reg>;
spi-max-frequency = <4800>;
reg = <0>;  /* chip select 0 on spi0, ie spi0.0 */
interrupt-parent = <>;
interrupts = <27 IRQ_TYPE_EDGE_RISING>;
};
};

Signed-off-by: Eyal Reizer 
---
 drivers/net/wireless/ti/wlcore/spi.c |  176 ++
 1 file changed, 157 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/spi.c 
b/drivers/net/wireless/ti/wlcore/spi.c
index 96d9c9d..6c5a369 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -70,16 +71,30 @@
 #define WSPI_MAX_CHUNK_SIZE4092
 
 /*
- * only support SPI for 12xx - this code should be reworked when 18xx
- * support is introduced
+ * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to
+ * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx
  */
-#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
+#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE)
 
 /* Maximum number of SPI write chunks */
 #define WSPI_MAX_NUM_OF_CHUNKS \
((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
 
 
+struct wilink_familiy_data {
+   char name[8];
+};
+
+const struct wilink_familiy_data *wilink_data;
+
+static const struct wilink_familiy_data wl18xx_data = {
+   .name = "wl18xx",
+};
+
+static const struct wilink_familiy_data wl12xx_data = {
+   .name = "wl12xx",
+};
+
 struct wl12xx_spi_glue {
struct device *dev;
struct platform_device *core;
@@ -120,6 +135,8 @@ static void wl12xx_spi_init(struct device *child)
struct spi_transfer t;
struct spi_message m;
u8 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
 
if (!cmd) {
dev_err(child->parent,
@@ -127,6 +144,15 @@ static void wl12xx_spi_init(struct device *child)
return;
}
 
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return;
+   }
+
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
+
memset(, 0, sizeof(t));
spi_message_init();
 
@@ -163,6 +189,26 @@ static void wl12xx_spi_init(struct device *child)
spi_message_add_tail(, );
 
spi_sync(to_spi_device(glue->dev), );
+
+   /* Send extra clocks with CS high. this is required by the wilink
+* family in order for successfully enter WSPI mode
+*/
+   gpio_direction_output(master->cs_gpios[0], 1);
+
+   memset(, 0, sizeof(m));
+   spi_message_init();
+
+   cmd[0] = 0xff;
+   cmd[1] = 0xff;
+   cmd[2] = 0xff;
+   cmd[3] = 0xff;
+   swab32s((u32 *)cmd);
+
+   t.tx_buf = cmd;
+   t.len = 4;
+   spi_message_add_tail(, );
+   spi_sync(to_spi_device(glue->dev), );
+
kfree(cmd);
 }
 
@@ -213,6 +259,16 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
u32 *busy_buf;
u32 *cmd;
u32 chunk_len;
+   struct spi_device *spi = (struct spi_device *)glue->dev;
+   struct spi_master *master = spi->master;
+
+   if (!master->cs_gpios) {
+   dev_err(child->parent,
+   "spi chip select pin missing in platform data!\n");
+   return -EINVAL;
+   }
+   /* Drive CS line low */
+   gpio_direction_output(master->cs_gpios[0], 0);
 
while (len > 0) {
chunk_len = min_t(size_t, WSPI_MAX_CHUNK_SIZE, len);
@@ -267,25 +323,44 @@ static int __must_check wl12xx_spi_raw_read(struct device 
*child, int addr,
len -= chunk_len;
}
 
+   /* Drive CS line high */
+   gpio_direction_output(master->cs_gpios[0], 1);
return 0;
 }
 
-static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
-

RE: [PATCH v5 2/4] mwifiex: add platform specific wakeup interrupt support

2016-03-30 Thread Amitkumar Karwar
Hi Kalle,

> From: Kalle Valo [mailto:kv...@codeaurora.org]
> Sent: Wednesday, March 30, 2016 6:09 PM
> To: Amitkumar Karwar
> Cc: linux-wireless@vger.kernel.org; Cathy Luo; Nishant Sarmukadam;
> devicet...@vger.kernel.org; Wei-Ning Huang; Xinming Hu
> Subject: Re: [PATCH v5 2/4] mwifiex: add platform specific wakeup
> interrupt support
> 
> Amitkumar Karwar  writes:
> 
> > From: Xinming Hu 
> >
> > On some arm-based platforms, we need to configure platform specific
> > parameters by device tree node and also define our node as a child
> > node of parent SDIO host controller.
> > This patch parses these parameters from device tree. It includes
> > calibration data dowoload to firmware, wakeup pin configured to
> > firmware, and soc specific wake up gpio, which will be set as wakeup
> interrupt pin.
> >
> > Signed-off-by: Xinming Hu 
> > Signed-off-by: Amitkumar Karwar 
> 
> I only see patch 2, where are the rest three? Also it's not clear what's
> the plan with this patchset.
> 

Yes. It should have been [PATCH v5 2/2]
I am going to submit v6 shortly which address below comments from Rob Herring.
https://patchwork.kernel.org/patch/8618261/

Regards,
Amitkumar
--
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 v5 2/4] mwifiex: add platform specific wakeup interrupt support

2016-03-30 Thread Kalle Valo
Amitkumar Karwar  writes:

> From: Xinming Hu 
>
> On some arm-based platforms, we need to configure platform specific
> parameters by device tree node and also define our node as a child
> node of parent SDIO host controller.
> This patch parses these parameters from device tree. It includes
> calibration data dowoload to firmware, wakeup pin configured to firmware,
> and soc specific wake up gpio, which will be set as wakeup interrupt pin.
>
> Signed-off-by: Xinming Hu 
> Signed-off-by: Amitkumar Karwar 

I only see patch 2, where are the rest three? Also it's not clear what's
the plan with this patchset.

-- 
Kalle Valo
--
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] bcma: use of_dma_configure() to set initial dma mask

2016-03-30 Thread Kalle Valo
Arnd Bergmann  writes:

> While fixing another bug, I noticed that bcma manually sets up
> a dma_mask pointer for its child devices. We have a generic
> helper for that now, which should be able to cope better with
> any variations that might be needed to deal with cache coherency,
> unusual DMA address offsets, iommus, or limited DMA masks, none
> of which are currently handled here.
>
> This changes the core to use the of_dma_configure(), like
> we do for platform devices that are probed directly from
> DT.
>
> Signed-off-by: Arnd Bergmann 
> ---
> This patch needs to be tested to ensure we don't introduce
> regressions, and should probably go into 4.7 as a cleanup.

Is anyone able to test this? The full patch is here:

https://patchwork.kernel.org/patch/8608751/

-- 
Kalle Valo
--
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


wireless-drivers-next is open

2016-03-30 Thread Kalle Valo
Hi,

now that the merge window is closed wireless-drivers-next is open for
new patches going to 4.7.

wireless-drivers remains open for important fixes going to 4.6.

-- 
Kalle Valo
--
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: [V11,2/2] brcmfmac: add support for nl80211 BSS_SELECT feature

2016-03-30 Thread Kalle Valo
Arend Van Spriel  writes:

>> But please do remind about this, I seldomly check the "Awaiting
>> Upstream" queue so sometimes it might take way too long before I apply
>> the patch.
>
> So this is another way of saying the author should keep an eye on his
> patches when it ends up in this state or in general ;-) Noted.

Yeah, exactly :) Especially it's very helpful to send a note once the
dependency is in wireless-drivers-next, otherwise I need to manually
check and unsurprisingly I don't do it that often...

-- 
Kalle Valo
--
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] wil6210: add module parameter for alternate interface name

2016-03-30 Thread Kalle Valo
Lior David  writes:

>>> +   const char *ifname = alt_ifname ? "wigig%d" : "wlan%d";
>>>  
>>> wdev = wil_cfg80211_init(dev);
>>> if (IS_ERR(wdev)) {
>>> @@ -160,7 +166,7 @@ void *wil_if_alloc(struct device *dev)
>>> ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels;
>>> cfg80211_chandef_create(>preset_chandef, ch, NL80211_CHAN_NO_HT);
>>>  
>>> -   ndev = alloc_netdev(0, "wlan%d", NET_NAME_UNKNOWN, wil_dev_setup);
>>> +   ndev = alloc_netdev(0, ifname, NET_NAME_UNKNOWN, wil_dev_setup);
>>> if (!ndev) {
>>> dev_err(dev, "alloc_netdev_mqs failed\n");
>>> rc = -ENOMEM;
>> 
>> To me this looks like an ugly hack and I hope there is a better way to
>> handle the problem this patch is fixing. I think interface names
>> shouldn't matter from functionality point of view, anything requiring
>> certain naming is broken.
>> 
>> But if the interface name is so important why not use "wigig%d" always?
>> The user space can rename the interface name anyway.
>
> The problem we try to solve is with Android. Android uses hard-coded "wlan0"
> interface name for wifi. We have a platform where wigig(11ad) is used
> alongside wifi(11ac). Both are independent and managed by separate services,
> but started at boot at roughly the same time. Sometimes 11ad will get wlan0
> interface name and 11ac will get wlan1, and wifi will not work.
> We considered using "wigig%d" always as you suggested, but it may break an
> unknown number of existing tools/scripts that rely on wlan0 interface
> name.

I got the idea why this is done, I just don't think that the way the
issue is solved is a good one. Can't you just rename the interface
during boot? Like older Ubuntu versions had a udev rule at
/etc/udev/rules.d/70-persistent-net.rules to name the interfaces (no
idea if it's still available after systemd was taken into use).

> As I see it, it is an issue of classification. Network drivers use a default
> interface name prefix depending on the device type. Ethernet drivers get 
> "eth%d",
> wireless drivers get "wlan%d" and so on. There are even existing drivers
> that give different prefixes based on other conditions, for example see
> drivers/s390/net/ctcm_main.c, ctcm_init_netdevice.
> For our 11ad device, in many platforms it is used as a wifi replacement, so
> the wlan%d name is appropriate, in other platforms it is used as
> a different wireless device for different purposes, so the default "wigig%d"
> prefix seems appropriate.

Every platform works differently, even systemd even has it's own weird
naming scheme:

https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

I really don't think that we should start working around interface
naming problems by selecting the name with module parameters. But having
"wigig%d" as the default sounds like a good idea to me.

-- 
Kalle Valo
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
On Wed, Mar 30, 2016 at 8:00 PM, Kalle Valo  wrote:
> Wei-Ning Huang  writes:
>
>> Kalle, can you help amend the message if this patch is accepted?
>
> Sure, I'll fix the typo in the commit log.
>
> But please try to avoid top posting, it makes it more difficult to
> follow the threads.
>
> --
> Kalle Valo

Noted, thanks for the reminder :)

Wei-Ning


-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Kalle Valo
Wei-Ning Huang  writes:

> Kalle, can you help amend the message if this patch is accepted?

Sure, I'll fix the typo in the commit log.

But please try to avoid top posting, it makes it more difficult to
follow the threads.

-- 
Kalle Valo
--
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/5] wireless: ti: Convert specialized logging macros to kernel style

2016-03-30 Thread Kalle Valo
Joe Perches  writes:

> Using the normal kernel logging mechanisms makes this code
> a bit more like other wireless drivers.

Personally I don't see the point but I don't have any strong opinions. A
bigger problem is that TI drivers are not really in active development
and that's I'm not thrilled to take big patches like this for dormant
drivers.

-- 
Kalle Valo
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Sedat Dilek
On Wed, Mar 30, 2016 at 12:38 PM, Wei-Ning Huang  wrote:
> ah.. thanks.
>
> Kalle, can you help amend the message if this patch is accepted?
> Thanks a lot.
>

http://its-not-its.info/

- Sedat -

> Wei-Ning
>
> On Wed, Mar 30, 2016 at 6:26 PM, Sedat Dilek  wrote:
>> On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang  
>> wrote:
>>> In mwifiex_enable_hs, we need to check if
>>> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
>>
>> it's... its member (not it's) :-).
>>
>> - Sedat -
>>
>>> This sometimes cause kernel panic when suspend/resume.
>>>
>>> Signed-off-by: Wei-Ning Huang 
>>> ---
>>>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
>>> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> index d5c56eb..d8de432 100644
>>> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>>> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>>>
>>> if (priv && priv->sched_scanning) {
>>>  #ifdef CONFIG_PM
>>> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
>>> +   if (priv->wdev.wiphy->wowlan_config &&
>>> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>>>  #endif
>>> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>>> mwifiex_stop_bg_scan(priv);
>>> --
>>> 2.1.2
>>>
>>> --
>>> 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
>
>
>
> --
> Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
> wnhu...@google.com | Cell: +886 910-380678
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
ah.. thanks.

Kalle, can you help amend the message if this patch is accepted?
Thanks a lot.

Wei-Ning

On Wed, Mar 30, 2016 at 6:26 PM, Sedat Dilek  wrote:
> On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang  wrote:
>> In mwifiex_enable_hs, we need to check if
>> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
>
> it's... its member (not it's) :-).
>
> - Sedat -
>
>> This sometimes cause kernel panic when suspend/resume.
>>
>> Signed-off-by: Wei-Ning Huang 
>> ---
>>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
>> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> index d5c56eb..d8de432 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>>
>> if (priv && priv->sched_scanning) {
>>  #ifdef CONFIG_PM
>> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
>> +   if (priv->wdev.wiphy->wowlan_config &&
>> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>>  #endif
>> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>> mwifiex_stop_bg_scan(priv);
>> --
>> 2.1.2
>>
>> --
>> 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



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Sedat Dilek
On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang  wrote:
> In mwifiex_enable_hs, we need to check if
> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.

it's... its member (not it's) :-).

- Sedat -

> This sometimes cause kernel panic when suspend/resume.
>
> Signed-off-by: Wei-Ning Huang 
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> index d5c56eb..d8de432 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>
> if (priv && priv->sched_scanning) {
>  #ifdef CONFIG_PM
> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
> +   if (priv->wdev.wiphy->wowlan_config &&
> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>  #endif
> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
> mwifiex_stop_bg_scan(priv);
> --
> 2.1.2
>
> --
> 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
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
In mwifiex_enable_hs, we need to check if
priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
This sometimes cause kernel panic when suspend/resume.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index d5c56eb..d8de432 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 
if (priv && priv->sched_scanning) {
 #ifdef CONFIG_PM
-   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
+   if (priv->wdev.wiphy->wowlan_config &&
+   !priv->wdev.wiphy->wowlan_config->nd_config) {
 #endif
mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
mwifiex_stop_bg_scan(priv);
-- 
2.1.2

--
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] CHROMIUM: mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
Sorry, please ignore this one. I forgot to strip the CHROMIUM: tag.

Wei-Ning

On Wed, Mar 30, 2016 at 6:08 PM, Wei-Ning Huang  wrote:
> In mwifiex_enable_hs, we need to check if
> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
> This sometimes cause kernel panic when suspend/resume.
>
> Signed-off-by: Wei-Ning Huang 
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> index d5c56eb..d8de432 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>
> if (priv && priv->sched_scanning) {
>  #ifdef CONFIG_PM
> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
> +   if (priv->wdev.wiphy->wowlan_config &&
> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>  #endif
> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
> mwifiex_stop_bg_scan(priv);
> --
> 2.1.2
>



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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] CHROMIUM: mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
In mwifiex_enable_hs, we need to check if
priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
This sometimes cause kernel panic when suspend/resume.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index d5c56eb..d8de432 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 
if (priv && priv->sched_scanning) {
 #ifdef CONFIG_PM
-   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
+   if (priv->wdev.wiphy->wowlan_config &&
+   !priv->wdev.wiphy->wowlan_config->nd_config) {
 #endif
mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
mwifiex_stop_bg_scan(priv);
-- 
2.1.2

--
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: [RFC] ath10k: implement dql for htt tx

2016-03-30 Thread Michal Kazior
On 30 March 2016 at 02:57, Dave Taht  wrote:
> As a side note of wifi ideas complementary to codel, please see:
>
> http://blog.cerowrt.org/post/selective_unprotect/
>
> On Tue, Mar 29, 2016 at 12:49 AM, Michal Kazior  
> wrote:
[...]
>> On the other hand DQL will react also to host system interrupt service
>> time. On slow CPUs (typically found on routers and such) you might end
>> up grinding the CPU so much you need deeper tx queues to keep the hw
>> busy (and therefore keep performance maxed). DQL should automatically
>> adjust to that while "txop limit" might not.
>
> Mmmm current multi-core generation arm routers should be fast enough.

While this helps it doesn't mean you can magically un-serialize
interrupt/txrx completion work.


[...]
 To sum things up:
  - DQL might be able to replace the explicit txop queue limiting
 (which requires rate control info)
>>>
>>> I am pessimistic. Perhaps as a fallback?
>>
>> At first I was (too) considering DQL as a nice fallback but the more I
>> think about the more it makes sense to use it as the main source of
>> deriving time slices for tx scheduling.
>
> I don't really get how dql can be applied per station in it's current forrm.

I was thinking of the following scheme:
 - disable excessive retries in fw (apparently doable via WMI pdev parameter)
 - deficit-based round-robin over stations
 - maintain DQL structure per station
 - when station gets its turn to xmit push frames to fw
 - keep doing that (with regard to per station DQL limits) until either:
   - associated software queue becomes empty
   - 1 timeslice for given station has elapsed
 - i was thinking of extracting timeslices from DQL or maintaining
it separately
 - try next station
 - do not submit packets to multiple stations at once (MU will need
more work..), i.e. always drain tx completely before switching to next
station
 - each station may need a different timeslice (to squeeze out max
burst performance)


[...]
 PS. I'm not feeling comfortable attaching 1MB attachment to a mailing
 list. Is this okay or should I use something else next time?
>>>
>>> I/you can slam results into the github blogcerowrt repo and then pull
>>> out stuff selectively
>>
>> Good idea, thanks!
>
> You got commit privs.

Yep, thanks!


Michał
--
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: [RFC] ath10k: implement dql for htt tx

2016-03-30 Thread Michal Kazior
On 29 March 2016 at 17:54, Ben Greear  wrote:
> On 03/29/2016 12:49 AM, Michal Kazior wrote:
>
>>> if you are getting a pure codel result of 160ms, that means the
>>> implementation is broken. But I think (after having read your
>>> description twice), the baseline result today of 160ms of queuing was
>>> with a fq_codel *qdisc* doing the work on top of huge buffers,
>>
>>
>> Yes. The 160ms is with fq_codel qdisc with ath10k doing DQL at 6mbps.
>> Without DQL ath10k would clog up all tx slots (1424 of them) with
>> frames. At 6mbps you typically want/need a handful (5-10) of frames to
>> be queued.
>
>
> Have you actually verified you can use all tx slots?

It works in most cases. I guess you're suspecting some of your
tx(flushing?) problems might be induced by overcommiting?

> The way the
> firmware uses it's tx buffers I think you may not be able to actually
> do that...and in practice, you will get a lot fewer usable tx-buffers
> than configured

Could be, e.g. I'm aware management frames are kind of a special case
in recent firmware revisions.

What would/do you expect firmware would/will do when we overcommit?
The driver does advertise number of HTT tx slots so I would expect it
to work fine if it didn't crash during boot.


Michał
--
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: Question on rhashtable in worst-case scenario.

2016-03-30 Thread Johannes Berg
On Tue, 2016-03-29 at 09:16 -0700, Ben Greear wrote:
> Looks like rhashtable has too much policy in it to properly deal with
> cases where there are too many hash collisions, so I am going to work
> on reverting it's use in mac80211.

I'm not really all that happy with that approach - can't we fix the
rhashtable? It's a pretty rare corner case that many keys really are
identical and no kind of hash algorithm, but it seems much better to
still deal with it than to remove the rhashtable usage and go back to
hand-rolling something.

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


Compliance of rt2800usb to ETSI EN 300 328 regulation

2016-03-30 Thread MANDRIN Bertrand
Dear all,

I'm looking for information about the compliancy of the rt2800usb and the
ETSI EN 300 328 (V1.8.1) regulation.

I didn't find any specific flag in the driver to enable to be compliant to
this regulation, so I'm wondering if there is something to be enabled in
the driver?

Would someone know if this driver has already been tested for this
regulation? 

Many thanks in advance for your help.

Best regards,
Bertrand
--
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