[linux-yocto] [linux-yocto-4.12][PATCH 6/6] iwlwifi: mvm: support new flush API

2017-11-13 Thread Liwei Song
From: Mordechai Goodstein 

commit d167e81ad452c317271078076a5999c820d28016 upstream.

This new API allows flushing queues based on station ID and TID in A000
devices.  One reason for using this is that tfd_queue_mask is only good
for 32 queues, which is not enough for A000 devices.

Signed-off-by: Sara Sharon 
Signed-off-by: Mordechai Goodstein 
Signed-off-by: Luca Coelho 
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   | 19 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h | 14 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  2 +
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   | 12 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   | 51 --
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 44 ++-
 6 files changed, 100 insertions(+), 42 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index d95fbde28902..b6605ecf1003 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -119,19 +119,30 @@ static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm 
*mvm, char *buf,
size_t count, loff_t *ppos)
 {
int ret;
-   u32 scd_q_msk;
+   u32 flush_arg;
 
if (!iwl_mvm_firmware_running(mvm) ||
mvm->cur_ucode != IWL_UCODE_REGULAR)
return -EIO;
 
-   if (sscanf(buf, "%x", &scd_q_msk) != 1)
+   if (kstrtou32(buf, 0, &flush_arg))
return -EINVAL;
 
-   IWL_ERR(mvm, "FLUSHING queues: scd_q_msk = 0x%x\n", scd_q_msk);
+   if (iwl_mvm_has_new_tx_api(mvm)) {
+   IWL_DEBUG_TX_QUEUES(mvm,
+   "FLUSHING all tids queues on sta_id = %d\n",
+   flush_arg);
+   mutex_lock(&mvm->mutex);
+   ret = iwl_mvm_flush_sta_tids(mvm, flush_arg, 0xFF, 0) ? : count;
+   mutex_unlock(&mvm->mutex);
+   return ret;
+   }
+
+   IWL_DEBUG_TX_QUEUES(mvm, "FLUSHING queues mask to flush = 0x%x\n",
+   flush_arg);
 
mutex_lock(&mvm->mutex);
-   ret =  iwl_mvm_flush_tx_path(mvm, scd_q_msk, 0) ? : count;
+   ret =  iwl_mvm_flush_tx_path(mvm, flush_arg, 0) ? : count;
mutex_unlock(&mvm->mutex);
 
return ret;
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 1360ebfdc51b..2b75bce903c8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
@@ -809,12 +809,24 @@ enum iwl_dump_control {
  * @flush_ctl: control flags
  * @reserved: reserved
  */
-struct iwl_tx_path_flush_cmd {
+struct iwl_tx_path_flush_cmd_v1 {
__le32 queues_ctl;
__le16 flush_ctl;
__le16 reserved;
 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */
 
+/**
+ * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command
+ * @sta_id: station ID to flush
+ * @tid_mask: TID mask to flush
+ * @reserved: reserved
+ */
+struct iwl_tx_path_flush_cmd {
+   __le32 sta_id;
+   __le16 tid_mask;
+   __le16 reserved;
+} __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_2 */
+
 /* Available options for the SCD_QUEUE_CFG HCMD */
 enum iwl_scd_cfg_actions {
SCD_CFG_DISABLE_QUEUE   = 0x0,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index cc9219c84f3c..f98032b08ee3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1361,6 +1361,8 @@ static inline const char *iwl_mvm_get_tx_fail_reason(u32 
status) { return ""; }
 #endif
 int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
 int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 
flags);
+int iwl_mvm_flush_sta_tids(struct iwl_mvm *mvm, u32 sta_id,
+  u16 tids, u32 flags);
 
 void iwl_mvm_async_handlers_purge(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 3da5ec40aaea..e9cb29223c9b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -1449,9 +1449,15 @@ int iwl_mvm_enter_d0i3(struct iwl_op_mode *op_mode)
synchronize_net();
 
/* Flush the hw queues, in case something got queued during entry */
-   ret = iwl_mvm_flush_tx_path(mvm, iwl_mvm_flushable_queues(mvm), flags);
-   if (ret)
-   return ret;
+   /* TODO new tx api */
+   if (iwl_mvm_has_new_tx_api(mvm)) {
+   WARN_ONCE(1, "d0i3: Need to implement flush TX queue\n");
+   } else {
+   ret = iwl_mvm_flush_tx_path(mvm, iwl_mvm_flushable_queues(mvm),
+   flags)

[linux-yocto] [linux-yocto-4.12][PATCH 5/6] iwlwifi: mvm: avoid variable shadowing

2017-11-13 Thread Liwei Song
From: Johannes Berg 

commit a9c50726ce3279646e2e22314b0917455a3c5e86 upstream.

Avoid one kind of symbol shadowing another in iwl_mvm_flush_sta()
by renaming the function parameter.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 0274d8cd7be5..cc9219c84f3c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1360,7 +1360,7 @@ const char *iwl_mvm_get_tx_fail_reason(u32 status);
 static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
 #endif
 int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
-int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool int_sta, u32 flags);
+int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 
flags);
 
 void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 42618a9c48f8..df0273e1b308 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1895,11 +1895,11 @@ int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 
tfd_msk, u32 flags)
return ret;
 }
 
-int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool int_sta, u32 flags)
+int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool internal, u32 flags)
 {
u32 mask;
 
-   if (int_sta) {
+   if (internal) {
struct iwl_mvm_int_sta *int_sta = sta;
 
mask = int_sta->tfd_queue_msk;
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [linux-yocto-4.12][PATCH 4/6] iwlwifi: mvm: add and use iwl_mvm_device_running()

2017-11-13 Thread Liwei Song
From: Johannes Berg 

commit aab6930d30d5176fe1ff38fe051a9fca2cac066d upstream.

This will help refactor this later.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
[adjust patch for newer patch used before this one]
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c  | 25 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  5 +
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c   | 14 ++---
 4 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 402846650cbe..d95fbde28902 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -7,7 +7,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
- * Copyright(c) 2016 Intel Deutschland GmbH
+ * Copyright(c) 2016 - 2017 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
@@ -34,6 +34,7 @@
  *
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -82,7 +83,8 @@ static ssize_t iwl_dbgfs_ctdp_budget_read(struct file *file,
char buf[16];
int pos, budget;
 
-   if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR)
+   if (!iwl_mvm_firmware_running(mvm) ||
+   mvm->cur_ucode != IWL_UCODE_REGULAR)
return -EIO;
 
mutex_lock(&mvm->mutex);
@@ -102,7 +104,8 @@ static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm 
*mvm, char *buf,
 {
int ret;
 
-   if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR)
+   if (!iwl_mvm_firmware_running(mvm) ||
+   mvm->cur_ucode != IWL_UCODE_REGULAR)
return -EIO;
 
mutex_lock(&mvm->mutex);
@@ -118,7 +121,8 @@ static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm 
*mvm, char *buf,
int ret;
u32 scd_q_msk;
 
-   if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR)
+   if (!iwl_mvm_firmware_running(mvm) ||
+   mvm->cur_ucode != IWL_UCODE_REGULAR)
return -EIO;
 
if (sscanf(buf, "%x", &scd_q_msk) != 1)
@@ -139,7 +143,8 @@ static ssize_t iwl_dbgfs_sta_drain_write(struct iwl_mvm 
*mvm, char *buf,
struct iwl_mvm_sta *mvmsta;
int sta_id, drain, ret;
 
-   if (!mvm->ucode_loaded || mvm->cur_ucode != IWL_UCODE_REGULAR)
+   if (!iwl_mvm_firmware_running(mvm) ||
+   mvm->cur_ucode != IWL_UCODE_REGULAR)
return -EIO;
 
if (sscanf(buf, "%d %d", &sta_id, &drain) != 2)
@@ -172,7 +177,7 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, char 
__user *user_buf,
size_t ret;
u8 *ptr;
 
-   if (!mvm->ucode_loaded)
+   if (!iwl_mvm_firmware_running(mvm))
return -EINVAL;
 
/* default is to dump the entire data segment */
@@ -205,7 +210,7 @@ static ssize_t iwl_dbgfs_sram_write(struct iwl_mvm *mvm, 
char *buf,
u32 offset, len;
u32 img_offset, img_len;
 
-   if (!mvm->ucode_loaded)
+   if (!iwl_mvm_firmware_running(mvm))
return -EINVAL;
 
img = &mvm->fw->img[mvm->cur_ucode];
@@ -258,7 +263,7 @@ static ssize_t iwl_dbgfs_set_nic_temperature_write(struct 
iwl_mvm *mvm,
 {
int temperature;
 
-   if (!mvm->ucode_loaded && !mvm->temperature_test)
+   if (!iwl_mvm_firmware_running(mvm) && !mvm->temperature_test)
return -EIO;
 
if (kstrtoint(buf, 10, &temperature))
@@ -305,7 +310,7 @@ static ssize_t iwl_dbgfs_nic_temp_read(struct file *file,
int pos, ret;
s32 temp;
 
-   if (!mvm->ucode_loaded)
+   if (!iwl_mvm_firmware_running(mvm))
return -EIO;
 
mutex_lock(&mvm->mutex);
@@ -371,7 +376,7 @@ static ssize_t iwl_dbgfs_disable_power_off_write(struct 
iwl_mvm *mvm, char *buf,
 {
int ret, val;
 
-   if (!mvm->ucode_loaded)
+   if (!iwl_mvm_firmware_running(mvm))
return -EIO;
 
if (!strncmp("disable_power_off_d0=", buf, 21)) {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 95763ccb365f..d8d5b5e1f5ff 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4045,7 +4045,7 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw 
*hw, int idx,
 
mutex_lock(&mvm->mutex);
 
-   if (mvm->ucode_loaded) {
+   if (iwl_mvm_firmware_

[linux-yocto] [linux-yocto-4.12][PATCH 2/6] iwlwifi: mvm: wait for the flushed queue only

2017-11-13 Thread Liwei Song
From: Sara Sharon 

commit 0b90964a265d6e0b60182b88f3947c6ef0ae4184 upstream.

The function flushed only agg queue and no more traffic
is queued on it.
However, it waits for all queues to empty, which is not
necessary and may take more time.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 8f129bccbced..3695d99d0c92 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2861,8 +2861,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
iwl_mvm_drain_sta(mvm, mvmsta, true);
if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), 0))
IWL_ERR(mvm, "Couldn't flush the AGG queue\n");
-   iwl_trans_wait_tx_queues_empty(mvm->trans,
-  mvmsta->tfd_queue_msk);
+   iwl_trans_wait_tx_queues_empty(mvm->trans, BIT(txq_id));
iwl_mvm_drain_sta(mvm, mvmsta, false);
 
iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false);
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [linux-yocto-4.12][PATCH 3/6] iwlwifi: add wait for tx queue empty

2017-11-13 Thread Liwei Song
From: Sara Sharon 

commit d6d517b7730c2dada199db83ebbc670c50fa9952 upstream.

Now that we have 512 queues, add a wait for single TX
queue to gen2.
This replaces gen1 wait_tx_queues_empty, which was limited
to 32 queues.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c|  2 +
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h| 20 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  | 41 -
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |  2 +
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c   | 72 ++-
 6 files changed, 107 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
index 0bde26bab15d..c0871f8f2c68 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
@@ -102,6 +102,8 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
if (!trans->dev_cmd_pool)
return NULL;
 
+   WARN_ON(!ops->wait_txq_empty && !ops->wait_tx_queues_empty);
+
return trans;
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 0ebfdbb22992..d3a78a11821a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -619,7 +619,8 @@ struct iwl_tx_queue_cfg_rsp {
  * @txq_disable: de-configure a Tx queue to send AMPDUs
  * Must be atomic
  * @txq_set_shared_mode: change Tx queue shared/unshared marking
- * @wait_tx_queue_empty: wait until tx queues are empty. May sleep.
+ * @wait_tx_queues_empty: wait until tx queues are empty. May sleep.
+ * @wait_txq_empty: wait until specific tx queue is empty. May sleep.
  * @freeze_txq_timer: prevents the timer of the queue from firing until the
  * queue is set to awake. Must be atomic.
  * @block_txq_ptrs: stop updating the write pointers of the Tx queues. Note
@@ -692,6 +693,7 @@ struct iwl_trans_ops {
bool shared);
 
int (*wait_tx_queues_empty)(struct iwl_trans *trans, u32 txq_bm);
+   int (*wait_txq_empty)(struct iwl_trans *trans, int queue);
void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs,
 bool freeze);
void (*block_txq_ptrs)(struct iwl_trans *trans, bool block);
@@ -1198,6 +1200,9 @@ static inline void iwl_trans_block_txq_ptrs(struct 
iwl_trans *trans,
 static inline int iwl_trans_wait_tx_queues_empty(struct iwl_trans *trans,
 u32 txqs)
 {
+   if (WARN_ON_ONCE(!trans->ops->wait_tx_queues_empty))
+   return -ENOTSUPP;
+
if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
return -EIO;
@@ -1206,6 +1211,19 @@ static inline int iwl_trans_wait_tx_queues_empty(struct 
iwl_trans *trans,
return trans->ops->wait_tx_queues_empty(trans, txqs);
 }
 
+static inline int iwl_trans_wait_txq_empty(struct iwl_trans *trans, int queue)
+{
+   if (WARN_ON_ONCE(!trans->ops->wait_txq_empty))
+   return -ENOTSUPP;
+
+   if (WARN_ON_ONCE(trans->state != IWL_TRANS_FW_ALIVE)) {
+   IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
+   return -EIO;
+   }
+
+   return trans->ops->wait_txq_empty(trans, queue);
+}
+
 static inline void iwl_trans_write8(struct iwl_trans *trans, u32 ofs, u8 val)
 {
trans->ops->write8(trans, ofs, val);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index bfd1eea9e748..95763ccb365f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4013,6 +4013,8 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
IWL_ERR(mvm, "flush request fail\n");
} else {
msk |= mvmsta->tfd_queue_msk;
+   if (iwl_mvm_has_new_tx_api(mvm))
+   iwl_mvm_wait_sta_queues_empty(mvm, mvmsta);
}
}
 
@@ -4021,7 +4023,7 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
/* this can take a while, and we may need/want other operations
 * to succeed while doing this, so do it without the mutex held
 */
-   if (!drop)
+   if (!drop && !iwl_mvm_has_new_tx_api(mvm))
iwl_trans_wait_tx_queues_empty(mvm->trans, msk);
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 3695d99d0c92..bc52739eeb25 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wi

[linux-yocto] [linux-yocto-4.12][PATCH 1/6] iwlwifi: mvm: flush per station for DQA mode

2017-11-13 Thread Liwei Song
From: Sara Sharon 

commit d49394a131060fda209ba91e903c9d6316db2e4d upstream.

Avoid using the global flush and move to flush per
station whenever possible in DQA mode.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
Signed-off-by: Liwei Song 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 26 --
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   |  6 -
 .../net/wireless/intel/iwlwifi/mvm/time-event.c|  5 -
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 17 ++
 5 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index db5ad222e5ea..bfd1eea9e748 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1451,7 +1451,7 @@ static void iwl_mvm_prepare_mac_removal(struct iwl_mvm 
*mvm,
 {
u32 tfd_msk = iwl_mvm_mac_get_queues_mask(vif);
 
-   if (tfd_msk) {
+   if (tfd_msk && !iwl_mvm_is_dqa_supported(mvm)) {
/*
 * mac80211 first removes all the stations of the vif and
 * then removes the vif. When it removes a station it also
@@ -1460,6 +1460,8 @@ static void iwl_mvm_prepare_mac_removal(struct iwl_mvm 
*mvm,
 * of these AMPDU sessions are properly closed.
 * We still need to take care of the shared queues of the vif.
 * Flush them here.
+* For DQA mode there is no need - broacast and multicast queue
+* are flushed separately.
 */
mutex_lock(&mvm->mutex);
iwl_mvm_flush_tx_path(mvm, tfd_msk, 0);
@@ -4006,21 +4008,21 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
/* make sure only TDLS peers or the AP are flushed */
WARN_ON(i != mvmvif->ap_sta_id && !sta->tdls);
 
-   msk |= mvmsta->tfd_queue_msk;
+   if (drop) {
+   if (iwl_mvm_flush_sta(mvm, mvmsta, false, 0))
+   IWL_ERR(mvm, "flush request fail\n");
+   } else {
+   msk |= mvmsta->tfd_queue_msk;
+   }
}
 
-   if (drop) {
-   if (iwl_mvm_flush_tx_path(mvm, msk, 0))
-   IWL_ERR(mvm, "flush request fail\n");
-   mutex_unlock(&mvm->mutex);
-   } else {
-   mutex_unlock(&mvm->mutex);
+   mutex_unlock(&mvm->mutex);
 
-   /* this can take a while, and we may need/want other operations
-* to succeed while doing this, so do it without the mutex held
-*/
+   /* this can take a while, and we may need/want other operations
+* to succeed while doing this, so do it without the mutex held
+*/
+   if (!drop)
iwl_trans_wait_tx_queues_empty(mvm->trans, msk);
-   }
 }
 
 static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 52f8d7a6a7dc..78629899cc21 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1355,6 +1355,8 @@ const char *iwl_mvm_get_tx_fail_reason(u32 status);
 static inline const char *iwl_mvm_get_tx_fail_reason(u32 status) { return ""; }
 #endif
 int iwl_mvm_flush_tx_path(struct iwl_mvm *mvm, u32 tfd_msk, u32 flags);
+int iwl_mvm_flush_sta(struct iwl_mvm *mvm, void *sta, bool int_sta, u32 flags);
+
 void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm);
 
 static inline void iwl_mvm_set_tx_cmd_ccmp(struct ieee80211_tx_info *info,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 614d67810d05..8f129bccbced 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1611,7 +1611,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
if (ret)
return ret;
/* flush its queues here since we are freeing mvm_sta */
-   ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, 0);
+   ret = iwl_mvm_flush_sta(mvm, mvm_sta, false, 0);
if (ret)
return ret;
ret = iwl_trans_wait_tx_queues_empty(mvm->trans,
@@ -1978,6 +1978,8 @@ static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm 
*mvm,
 
lockdep_assert_held(&mvm->mutex);
 
+   iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true, 0);
+
if (vif->type == NL80211_IFTYPE_AP ||
vif->type == NL80211_IFTYPE_ADHOC)
iwl_mvm_disable_txq(mvm, vif->cab_queue, vif->cab_queue,
@@ -2187,6 +2189,8 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct 
ieee80211_vif *vi

[linux-yocto] [linux-yocto-4.12][PATCH 0/6] fix calltrace when run wpa_supplicant the second time

2017-11-13 Thread Liwei Song
6 upstream patches to fix a calltrace when run wpa_supplicant at the second time
on NUC7i5BNH.
"WARNING: CPU: 0 PID: 1089 at 
drivers/net/wireless/intel/iwlwifi/mvm/utils.c:786 
iwl_mvm_disable_txq+0x2c0/0x360 [iwlmvm]"
[  116.076858] Call Trace:
[  116.077514]  iwl_mvm_send_rm_bcast_sta+0x137/0x140 [iwlmvm]
[  116.078176]  ? iwl_mvm_send_rm_bcast_sta+0x137/0x140 [iwlmvm]
[  116.078842]  ? iwl_mvm_rm_mcast_sta+0x6b/0x90 [iwlmvm]
[  116.079489]  iwl_mvm_stop_ap_ibss+0xd4/0x170 [iwlmvm]
[  116.080157]  ieee80211_stop_ap+0x1a1/0x370 [mac80211]


Johannes Berg (2):
  iwlwifi: mvm: add and use iwl_mvm_device_running()
  iwlwifi: mvm: avoid variable shadowing

Mordechai Goodstein (1):
  iwlwifi: mvm: support new flush API

Sara Sharon (3):
  iwlwifi: mvm: flush per station for DQA mode
  iwlwifi: mvm: wait for the flushed queue only
  iwlwifi: add wait for tx queue empty

 drivers/net/wireless/intel/iwlwifi/iwl-trans.c |  2 +
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 20 -
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   | 44 +++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h | 14 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 30 +++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  9 +++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   | 12 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   | 91 --
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h   |  2 +
 .../net/wireless/intel/iwlwifi/mvm/time-event.c|  5 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c| 14 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 43 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c| 72 ++---
 13 files changed, 262 insertions(+), 96 deletions(-)

-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] v4.8.x - stable updates comprising v4.8.26

2017-11-13 Thread Paul Gortmaker
Bruce, Yocto kernel folks:

Here is another 4.8.x stable update.  Continuing on top of the
previously released v4.8.25 kernel, we now have the appropriate content
from 4.9.25 --> 4.9.29 (inclusive) applied on top of the latest 4.8
baseline.  Once again, I've combined several 4.9.x which results in
just about 200 backported commits out of that original 4.9.x range.

As usual, I've put this 4.8.x queue through the various testing that I
figured made sense, which includes but is not limited to:

-x86-64 sanity boot test + workloads of defconfig on COTS Core2 box.
-build MIPS, PPC, ARM, ARM64 with defconfig
-build x86-64 allmodconfig/allyesconfig
-build i386 allmodconfig/allyesconfig

I bumped the Makefile and did the signed tag just as per the previously
released 4.8.x versions.

Please find a signed v4.8.26 tag using this key:

http://pgp.mit.edu/pks/lookup?op=vindex&search=0xEBCE84042C07D1D6

in the repo in my kernel.org directory here:

   https://git.kernel.org/cgit/linux/kernel/git/paulg/linux-4.8.y.git/
   git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux-4.8.y.git

for merge to standard/base in linux-yocto-4.8 and then out from there
into the other base and BSP branches.

For those who are interested, the evolution of the commits is here:

   https://git.kernel.org/cgit/linux/kernel/git/paulg/longterm-queue-4.8.git/

This repo isn't needed for anything; it just exists for transparency and
so people can see how the commits were adjusted to apply to the 4.8.x
kernel baseline in case people are interested.

Paul.
--
-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto