Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

2017-01-23 Thread Joe Perches
On Tue, 2017-01-24 at 05:18 +, Valo, Kalle wrote:
> Joe Perches  writes:
> 
> > On Mon, 2017-01-23 at 15:04 +, Srinivas Kandagatla wrote:
> > > use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().
> > 
> > []
> > > diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
> > > b/drivers/net/wireless/ath/ath10k/pci.c
> > 
> > []
> > > @@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k 
> > > *ar, u32 address, void *data,
> > >*/
> > >   alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
> > >  
> > > - data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
> > > + data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
> > >  alloc_nbytes,
> > >  _data_base,
> > >  GFP_ATOMIC);
> > 
> > trivia:
> > 
> > Nicer to realign arguments and remove the unnecessary cast.
> > 
> > Perhaps:
> > 
> > data_buf = dma_zalloc_coherent(ar->dev, alloc_nbytes, _data_base,
> >    GFP_ATOMIC);
> 
> Sure, but that should be in a separate patch.

I don't think so, trivial patches can be combined.

It's also nicer to realign all modified multiline
arguments when performing these changes.

Coccinelle generally does it automatically.


Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

2017-01-23 Thread Valo, Kalle
Joe Perches  writes:

> On Mon, 2017-01-23 at 15:04 +, Srinivas Kandagatla wrote:
>> use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().
> []
>> diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
>> b/drivers/net/wireless/ath/ath10k/pci.c
> []
>> @@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, 
>> u32 address, void *data,
>>   */
>>  alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
>>  
>> -data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
>> +data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
>> alloc_nbytes,
>> _data_base,
>> GFP_ATOMIC);
>
> trivia:
>
> Nicer to realign arguments and remove the unnecessary cast.
>
> Perhaps:
>
>   data_buf = dma_zalloc_coherent(ar->dev, alloc_nbytes, _data_base,
>  GFP_ATOMIC);

Sure, but that should be in a separate patch.

-- 
Kalle Valo

Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

2017-01-23 Thread Joe Perches
On Mon, 2017-01-23 at 15:04 +, Srinivas Kandagatla wrote:
> use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().
[]
> diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
> b/drivers/net/wireless/ath/ath10k/pci.c
[]
> @@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, 
> u32 address, void *data,
>*/
>   alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
>  
> - data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
> + data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
>  alloc_nbytes,
>  _data_base,
>  GFP_ATOMIC);

trivia:

Nicer to realign arguments and remove the unnecessary cast.

Perhaps:

data_buf = dma_zalloc_coherent(ar->dev, alloc_nbytes, _data_base,
   GFP_ATOMIC);




[PATCH 10/25] iwlwifi: enlarge number of ucode sections

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

The maximum number of firmware sections is now 32 instead of 16 for
a000 devices. Set the appropriate define.  Avoid out of bounds access
in case there are more sections than the maximum set by driver.

Make the driver extensible to FW size changes by allocating the
section memory dynamically.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/ucode.c|  2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c  | 31 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h  |  1 -
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h   |  3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c   |  4 +--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c   |  4 +--
 8 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
index 8c0719468d00..2a04d0cd71ae 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
@@ -163,7 +163,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
   REGULATORY_DISABLE_BEACON_HINTS;
 
 #ifdef CONFIG_PM_SLEEP
-   if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
+   if (priv->fw->img[IWL_UCODE_WOWLAN].num_sec &&
priv->trans->ops->d3_suspend &&
priv->trans->ops->d3_resume &&
device_can_wakeup(priv->trans->dev)) {
diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/ucode.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/ucode.c
index c7509c51e9d9..d6013bfe991c 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/ucode.c
@@ -407,7 +407,7 @@ int iwl_run_init_ucode(struct iwl_priv *priv)
lockdep_assert_held(>mutex);
 
/* No init ucode required? Curious, but maybe ok */
-   if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
+   if (!priv->fw->img[IWL_UCODE_INIT].num_sec)
return 0;
 
iwl_init_notification_wait(>notif_wait, _wait,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index a6719d67ac00..1d1af4bc1530 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -166,8 +166,9 @@ static void iwl_free_fw_desc(struct iwl_drv *drv, struct 
fw_desc *desc)
 static void iwl_free_fw_img(struct iwl_drv *drv, struct fw_img *img)
 {
int i;
-   for (i = 0; i < IWL_UCODE_SECTION_MAX; i++)
+   for (i = 0; i < img->num_sec; i++)
iwl_free_fw_desc(drv, >sec[i]);
+   kfree(img->sec);
 }
 
 static void iwl_dealloc_ucode(struct iwl_drv *drv)
@@ -240,7 +241,7 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool 
first)
 }
 
 struct fw_img_parsing {
-   struct fw_sec sec[IWL_UCODE_SECTION_MAX];
+   struct fw_sec *sec;
int sec_counter;
 };
 
@@ -383,6 +384,7 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces 
*pieces,
struct fw_img_parsing *img;
struct fw_sec *sec;
struct fw_sec_parsing *sec_parse;
+   size_t alloc_size;
 
if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX))
return -1;
@@ -390,6 +392,13 @@ static int iwl_store_ucode_sec(struct iwl_firmware_pieces 
*pieces,
sec_parse = (struct fw_sec_parsing *)data;
 
img = >img[type];
+
+   alloc_size = sizeof(*img->sec) * (img->sec_counter + 1);
+   sec = krealloc(img->sec, alloc_size, GFP_KERNEL);
+   if (!sec)
+   return -ENOMEM;
+   img->sec = sec;
+
sec = >sec[img->sec_counter];
 
sec->offset = le32_to_cpu(sec_parse->offset);
@@ -1089,12 +1098,18 @@ static int iwl_alloc_ucode(struct iwl_drv *drv,
   enum iwl_ucode_type type)
 {
int i;
-   for (i = 0;
-i < IWL_UCODE_SECTION_MAX && get_sec_size(pieces, type, i);
-i++)
-   if (iwl_alloc_fw_desc(drv, &(drv->fw.img[type].sec[i]),
- get_sec(pieces, type, i)))
+   struct fw_desc *sec;
+
+   sec = kcalloc(pieces->img[type].sec_counter, sizeof(*sec), GFP_KERNEL);
+   if (!sec)
+   return -ENOMEM;
+   drv->fw.img[type].sec = sec;
+   drv->fw.img[type].num_sec = pieces->img[type].sec_counter;
+
+   for (i = 0; i < pieces->img[type].sec_counter; i++)
+   if (iwl_alloc_fw_desc(drv, [i], get_sec(pieces, type, i)))
return -ENOMEM;
+
return 0;
 }
 
@@ -1457,6 +1472,8 @@ static void iwl_req_fw_callback(const struct firmware 
*ucode_raw, void *context)
complete(>request_firmware_complete);

[PATCH 11/25] iwlwifi: mvm: change iwl_mvm_tx_csum to return value

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

Currently the function changes the TX cmd itself.
Make it more generic by returning a value, as preperation
to the new TX cmd.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 66957ac12ca4..7f2fe3ffe547 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -102,14 +102,13 @@ iwl_mvm_bar_check_trigger(struct iwl_mvm *mvm, const u8 
*addr,
 #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)
+static u16 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb,
+  struct ieee80211_hdr *hdr,
+  struct ieee80211_tx_info *info)
 {
 #if IS_ENABLED(CONFIG_INET)
u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
-   u16 offload_assist = le16_to_cpu(tx_cmd->offload_assist);
+   u16 offload_assist = 0;
u8 protocol = 0;
 
/*
@@ -117,7 +116,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct 
sk_buff *skb,
 * compute it
 */
if (skb->ip_summed != CHECKSUM_PARTIAL || IWL_MVM_SW_TX_CSUM_OFFLOAD)
-   return;
+   goto out;
 
/* 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) ||
@@ -125,7 +124,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct 
sk_buff *skb,
   skb->protocol != htons(ETH_P_IPV6)),
  "No support for requested checksum\n")) {
skb_checksum_help(skb);
-   return;
+   goto out;
}
 
if (skb->protocol == htons(ETH_P_IP)) {
@@ -145,7 +144,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct 
sk_buff *skb,
protocol != NEXTHDR_HOP &&
protocol != NEXTHDR_DEST) {
skb_checksum_help(skb);
-   return;
+   goto out;
}
 
hp = OPT_HDR(struct ipv6_opt_hdr, skb, off);
@@ -159,7 +158,7 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct 
sk_buff *skb,
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP) {
WARN_ON_ONCE(1);
skb_checksum_help(skb);
-   return;
+   goto out;
}
 
/* enable L4 csum */
@@ -191,7 +190,8 @@ static void iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct 
sk_buff *skb,
mh_len /= 2;
offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE;
 
-   tx_cmd->offload_assist = cpu_to_le16(offload_assist);
+out:
+   return offload_assist;
 #endif
 }
 
@@ -295,7 +295,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff 
*skb,
!(tx_cmd->offload_assist & cpu_to_le16(BIT(TX_CMD_OFFLD_AMSDU
tx_cmd->offload_assist |= cpu_to_le16(BIT(TX_CMD_OFFLD_PAD));
 
-   iwl_mvm_tx_csum(mvm, skb, hdr, info, tx_cmd);
+   tx_cmd->offload_assist |=
+   cpu_to_le16(iwl_mvm_tx_csum(mvm, skb, hdr, info));
 }
 
 /*
-- 
2.11.0



[PATCH 17/25] iwlwifi: mvm: rs: Remove unused 'mcs' variable

2017-01-23 Thread Luca Coelho
From: Kirtika Ruchandani 

Commit 5fc0f76c4 introduced Rx stats from debugfs, the function
iwl_mvm_reset_frame_stats from that commit defines and sets mcs but
does not use it. Compiling iwlwifi with W=1 gives this warning -

iwlwifi/mvm/rs.c: In function ‘iwl_mvm_update_frame_stats’:
iwlwifi/mvm/rs.c:3074:14: warning: variable ‘mcs’ set but not used 
[-Wunused-but-set-variable]

Fixes: 5fc0f76c43bd (iwlwifi: mvm: add Rx frames statistics via debugfs)
Signed-off-by: Kirtika Ruchandani 
Cc: Eyal Shapira 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 0b79f4a43eaf..80f99c365b6a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -3065,7 +3065,7 @@ static void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm)
 
 void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
 {
-   u8 nss = 0, mcs = 0;
+   u8 nss = 0;
 
spin_lock(>drv_stats_lock);
 
@@ -3093,11 +3093,9 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 
rate, bool agg)
 
if (rate & RATE_MCS_HT_MSK) {
mvm->drv_rx_stats.ht_frames++;
-   mcs = rate & RATE_HT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_HT_MCS_NSS_MSK) >> RATE_HT_MCS_NSS_POS) + 1;
} else if (rate & RATE_MCS_VHT_MSK) {
mvm->drv_rx_stats.vht_frames++;
-   mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
nss = ((rate & RATE_VHT_MCS_NSS_MSK) >>
   RATE_VHT_MCS_NSS_POS) + 1;
} else {
-- 
2.11.0



[PATCH 14/25] iwlwifi: fix MODULE_FIRMWARE for 6030

2017-01-23 Thread Luca Coelho
From: Jürg Billeter 

IWL6000G2B_UCODE_API_MAX is not defined. ucode_api_max of
IWL_DEVICE_6030 uses IWL6000G2_UCODE_API_MAX. Use this also for
MODULE_FIRMWARE.

Fixes: 9d9b21d1b616 ("iwlwifi: remove IWL_*_UCODE_API_OK")
Signed-off-by: Jürg Billeter 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-6000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-6000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
index 0b9f6a7bc834..39335b7b0c16 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
@@ -371,4 +371,4 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
 MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
-MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_MAX));
+MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
-- 
2.11.0



[PATCH 22/25] iwlwifi: dvm: remove unused variable compiler warning in debugfs.c

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

When compiling with W=1, we get the following warning in debugfs.c:

/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c: 
In function ‘iwl_dbgfs_fw_restart_write’:
/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c:2313:6:
 warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  int ret;
  ^

Fix it by ignoring the return value in this case.

Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
index affe760c8c22..376c79337a0e 100644
--- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct file 
*file,
 {
struct iwl_priv *priv = file->private_data;
bool restart_fw = iwlwifi_mod_params.restart_fw;
-   int ret;
+   int __maybe_unused ret;
 
iwlwifi_mod_params.restart_fw = true;
 
-- 
2.11.0



[PATCH 13/25] iwlwifi: mvm: support version 2 of stored beacon notification

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

For 9000 devices withg upload, FW cannot send the entire phy
flags, and will send only the band - which is what we really
care about anyway. Change is backward compatible.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   | 6 +++---
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 2 +-
 2 files changed, 4 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 ae12badc0c2a..567597c26115 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h
@@ -2075,7 +2075,7 @@ struct iwl_mu_group_mgmt_notif {
  * @system_time: system time on air rise
  * @tsf: TSF on air rise
  * @beacon_timestamp: beacon on air rise
- * @phy_flags: general phy flags: band, modulation, etc.
+ * @band: band, matches _RES_PHY_FLAGS_BAND_24 definition
  * @channel: channel this beacon was received on
  * @rates: rate in ucode internal format
  * @byte_count: frame's byte count
@@ -2084,12 +2084,12 @@ struct iwl_stored_beacon_notif {
__le32 system_time;
__le64 tsf;
__le32 beacon_timestamp;
-   __le16 phy_flags;
+   __le16 band;
__le16 channel;
__le32 rates;
__le32 byte_count;
u8 data[MAX_STORED_BEACON_SIZE];
-} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_1 */
+} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_2 */
 
 #define LQM_NUMBER_OF_STATIONS_IN_REPORT 16
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 4a0874e40731..ebf6c071eb36 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -1565,7 +1565,7 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
rx_status.flag |= RX_FLAG_MACTIME_PLCP_START;
rx_status.device_timestamp = le32_to_cpu(sb->system_time);
rx_status.band =
-   (sb->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ?
+   (sb->band & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ?
NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
rx_status.freq =
ieee80211_channel_to_frequency(le16_to_cpu(sb->channel),
-- 
2.11.0



[PATCH 23/25] iwlwifi: mvm: mark ret as maybe_unused in iwl_dbgfs_fw_restart_write()

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

The value returned from iwl_mvm_send_cmd_pdu() in this function is not
used and always returns an error (which is the whole point of the
call).  Tag the ret variable with __maybe_unused to avoid this compile
warning when W=1 is used:

/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c: 
In function ‘iwl_dbgfs_fw_restart_write’:
/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c:875:6:
 warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  int ret;
  ^

Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 7b7d2a146e30..a260cd503200 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -798,7 +798,7 @@ static ssize_t iwl_dbgfs_drv_rx_stats_read(struct file 
*file,
 static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,
  size_t count, loff_t *ppos)
 {
-   int ret;
+   int __maybe_unused ret;
 
mutex_lock(>mutex);
 
-- 
2.11.0



[PATCH 16/25] iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables

2017-01-23 Thread Luca Coelho
From: Kirtika Ruchandani 

mvmvif is defined and set in rs_mimo_allow but not used. Compiling
iwlwifi with W=1 gives the following warning, remove it. mvmsta is
used only to obtain mvmvif so remove it as well.

iwlwifi/mvm/rs.c: In function 'rs_mimo_allow':
iwlwifi/mvm/rs.c:165:22: warning: variable 'mvmvif' set but not 
used.[-Wunused-but-set-variable]

This fix removes calls to iwl_mvm_sta_from_mac &
iwl_mvm_vif_from_mac. They are both accessors, and do not have any
side-effects.  Commit e621c2282e31 ("iwlwifi: rs: Remove workaround
that disables MIMO on P2P") removed a workaround that disabled MIMO on
P2P, 'mvmvif' was used for that workaround, but not removed with it.

Fixes: e621c2282e31 ("iwlwifi: rs: Remove workaround that disables MIMO on P2P")
Signed-off-by: Kirtika Ruchandani 
Cc: Alexander Bondar 
Cc: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 227c5ed9cbe6..0b79f4a43eaf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -161,9 +161,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
  struct rs_rate *rate,
  const struct rs_tx_column *next_col)
 {
-   struct iwl_mvm_sta *mvmsta;
-   struct iwl_mvm_vif *mvmvif;
-
if (!sta->ht_cap.ht_supported)
return false;
 
@@ -176,9 +173,6 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
if (!iwl_mvm_bt_coex_is_mimo_allowed(mvm, sta))
return false;
 
-   mvmsta = iwl_mvm_sta_from_mac80211(sta);
-   mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
-
if (mvm->nvm_data->sku_cap_mimo_disabled)
return false;
 
-- 
2.11.0



[PATCH 24/25] iwlwifi: mvm: use mvm_disable_queue instead of sharing logic

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

When removing inactive queue - use the central disable queue
function. This is needed due to a000 changes to come, but is
a proper cleanup anyway.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   | 22 --
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 10 ++
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 4a9cb76b7611..a672aa71c656 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1657,8 +1657,8 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, 
int mac80211_queue,
  * Disable a TXQ.
  * Note that in non-DQA mode the %mac80211_queue and %tid params are ignored.
  */
-void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
-u8 tid, u8 flags);
+int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
+   u8 tid, u8 flags);
 int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, u8 minq, u8 maxq);
 
 /* Return a bitmask with all the hw supported queues, except for the
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index cf8222a8b588..4ea9589e8823 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -755,28 +755,22 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
 * first
 */
if (using_inactive_queue) {
-   struct iwl_scd_txq_cfg_cmd cmd = {
-   .scd_queue = queue,
-   .action = SCD_CFG_DISABLE_QUEUE,
-   };
-   u8 txq_curr_ac;
-
-   disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
+   u8 txq_curr_ac, sta_id;
 
spin_lock_bh(>queue_info_lock);
txq_curr_ac = mvm->queue_info[queue].mac80211_ac;
-   cmd.sta_id = mvm->queue_info[queue].ra_sta_id;
-   cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[txq_curr_ac];
-   cmd.tid = mvm->queue_info[queue].txq_tid;
+   sta_id = mvm->queue_info[queue].ra_sta_id;
spin_unlock_bh(>queue_info_lock);
 
+   disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
/* Disable the queue */
if (disable_agg_tids)
iwl_mvm_invalidate_sta_queue(mvm, queue,
 disable_agg_tids, false);
-   iwl_trans_txq_disable(mvm->trans, queue, false);
-   ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd),
-  );
+
+   ret = iwl_mvm_disable_txq(mvm, queue,
+ mvmsta->vif->hw_queue[txq_curr_ac],
+ tid, 0);
if (ret) {
IWL_ERR(mvm,
"Failed to free inactive queue %d (ret=%d)\n",
@@ -791,7 +785,7 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
}
 
/* If TXQ is allocated to another STA, update removal in FW */
-   if (cmd.sta_id != mvmsta->sta_id)
+   if (sta_id != mvmsta->sta_id)
iwl_mvm_invalidate_sta_queue(mvm, queue, 0, true);
}
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index d04babd99b53..2beea3b98e52 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -706,8 +706,8 @@ void iwl_mvm_enable_txq(struct iwl_mvm *mvm, int queue, int 
mac80211_queue,
}
 }
 
-void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
-u8 tid, u8 flags)
+int iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
+   u8 tid, u8 flags)
 {
struct iwl_scd_txq_cfg_cmd cmd = {
.scd_queue = queue,
@@ -720,7 +720,7 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, 
int mac80211_queue,
 
if (WARN_ON(mvm->queue_info[queue].hw_queue_refcount == 0)) {
spin_unlock_bh(>queue_info_lock);
-   return;
+   return 0;
}
 
mvm->queue_info[queue].tid_bitmap &= ~BIT(tid);
@@ -760,7 +760,7 @@ void iwl_mvm_disable_txq(struct iwl_mvm *mvm, int queue, 
int mac80211_queue,
/* If the queue is still enabled - nothing left to do in this func */
if (cmd.action == SCD_CFG_ENABLE_QUEUE) {

[PATCH 18/25] iwlwifi: pcie: trans: Remove unused 'shift_param'

2017-01-23 Thread Luca Coelho
From: Kirtika Ruchandani 

shift_param is defined and set in iwl_pcie_load_cpu_sections but not
used. Fix this to avoid -Wunused-but-set-variable warning.

The code using it turned into dead code with commit dcab8ecd5617
("iwlwifi: mvm: support ucode load for family_8000 B0 only") which
added a separate function iwl_pcie_load_given_ucode_8000 (then 8000b)
for IWL_DEVICE_FAMILY_8000. Commit 76f8c0e17edc ("iwlwifi: pcie:
remove dead code") removed the dead code but left shift_param as is.

iwlwifi/pcie/trans.c: In function ‘iwl_pcie_load_cpu_sections’:
iwlwifi/pcie/trans.c:871:6: warning: variable ‘shift_param’ set but not used 
[-Wunused-but-set-variable]

Fixes: dcab8ecd5617 ("iwlwifi: mvm: support ucode load for family_8000 B0 only")
Fixes: 76f8c0e17edc ("iwlwifi: pcie: remove dead code")
Signed-off-by: Kirtika Ruchandani 
Cc: Sara Sharon 
Cc: Luca Coelho 
Cc: Liad Kaufman 
Cc: Emmanuel Grumbach 
[removed some unnecessary braces]
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index bf0ecdcf7402..16790db650c1 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -868,17 +868,13 @@ static int iwl_pcie_load_cpu_sections(struct iwl_trans 
*trans,
  int cpu,
  int *first_ucode_section)
 {
-   int shift_param;
int i, ret = 0;
u32 last_read_idx = 0;
 
-   if (cpu == 1) {
-   shift_param = 0;
+   if (cpu == 1)
*first_ucode_section = 0;
-   } else {
-   shift_param = 16;
+   else
(*first_ucode_section)++;
-   }
 
for (i = *first_ucode_section; i < image->num_sec; i++) {
last_read_idx = i;
-- 
2.11.0



[PATCH 12/25] iwlwifi: mvm: separate rate calculation to a new function

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

In preparation for the new TX cmd - move the rate calculation
to a diffrent function, and make it independent of the TX
command.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 84 +++--
 1 file changed, 45 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 7f2fe3ffe547..af828eda3330 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -299,6 +299,50 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct 
sk_buff *skb,
cpu_to_le16(iwl_mvm_tx_csum(mvm, skb, hdr, info));
 }
 
+static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,
+  struct ieee80211_tx_info *info,
+  struct ieee80211_sta *sta)
+{
+   int rate_idx;
+   u8 rate_plcp;
+   u32 rate_flags;
+
+   /* HT rate doesn't make sense for a non data frame */
+   WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
+ "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame\n",
+ info->control.rates[0].flags,
+ info->control.rates[0].idx);
+
+   rate_idx = info->control.rates[0].idx;
+   /* if the rate isn't a well known legacy rate, take the lowest one */
+   if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
+   rate_idx = rate_lowest_index(
+   >nvm_data->bands[info->band], sta);
+
+   /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
+   if (info->band == NL80211_BAND_5GHZ)
+   rate_idx += IWL_FIRST_OFDM_RATE;
+
+   /* For 2.4 GHZ band, check that there is no need to remap */
+   BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
+
+   /* Get PLCP rate for tx_cmd->rate_n_flags */
+   rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx);
+
+   if (info->band == NL80211_BAND_2GHZ &&
+   !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
+   rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
+   else
+   rate_flags =
+   BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
+
+   /* Set CCK flag as needed */
+   if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
+   rate_flags |= RATE_MCS_CCK_MSK;
+
+   return (u32)rate_plcp | rate_flags;
+}
+
 /*
  * Sets the fields in the Tx cmd that are rate related
  */
@@ -306,10 +350,6 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct 
iwl_tx_cmd *tx_cmd,
struct ieee80211_tx_info *info,
struct ieee80211_sta *sta, __le16 fc)
 {
-   u32 rate_flags;
-   int rate_idx;
-   u8 rate_plcp;
-
/* Set retry limit on RTS packets */
tx_cmd->rts_retry_limit = IWL_RTS_DFAULT_RETRY_LIMIT;
 
@@ -338,46 +378,12 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct 
iwl_tx_cmd *tx_cmd,
cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR);
}
 
-   /* HT rate doesn't make sense for a non data frame */
-   WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS,
- "Got an HT rate (flags:0x%x/mcs:%d) for a non data frame 
(fc:0x%x)\n",
- info->control.rates[0].flags,
- info->control.rates[0].idx,
- le16_to_cpu(fc));
-
-   rate_idx = info->control.rates[0].idx;
-   /* if the rate isn't a well known legacy rate, take the lowest one */
-   if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
-   rate_idx = rate_lowest_index(
-   >nvm_data->bands[info->band], sta);
-
-   /* For 5 GHZ band, remap mac80211 rate indices into driver indices */
-   if (info->band == NL80211_BAND_5GHZ)
-   rate_idx += IWL_FIRST_OFDM_RATE;
-
-   /* For 2.4 GHZ band, check that there is no need to remap */
-   BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0);
-
-   /* Get PLCP rate for tx_cmd->rate_n_flags */
-   rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(rate_idx);
-
mvm->mgmt_last_antenna_idx =
iwl_mvm_next_antenna(mvm, iwl_mvm_get_valid_tx_ant(mvm),
 mvm->mgmt_last_antenna_idx);
 
-   if (info->band == NL80211_BAND_2GHZ &&
-   !iwl_mvm_bt_coex_is_shared_ant_avail(mvm))
-   rate_flags = mvm->cfg->non_shared_ant << RATE_MCS_ANT_POS;
-   else
-   rate_flags =
-   BIT(mvm->mgmt_last_antenna_idx) << RATE_MCS_ANT_POS;
-
-   /* Set CCK flag as needed */
-   if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
-   rate_flags |= RATE_MCS_CCK_MSK;
-
/* Set the rate in the 

[PATCH 15/25] iwlwifi: mvm: remove unused variable in iwl_mvm_handle_statistics()

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

The temperature variable is set but not used in
iwl_mvm_handle_statistics().  Remove it to avoid the following
compiler warning when W=1 is used:

/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/rx.c: In 
function ‘iwl_mvm_handle_rx_statistics’:
/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/rx.c:759:6: 
warning: variable ‘temperature’ set but not used [-Wunused-but-set-variable]
  u32 temperature;
  ^

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

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 0e60e38b2acf..e16687d5afaa 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -621,12 +621,10 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
};
int expected_size = iwl_mvm_has_new_rx_api(mvm) ? sizeof(*stats) :
sizeof(struct iwl_notif_statistics_v10);
-   u32 temperature;
 
if (iwl_rx_packet_payload_len(pkt) != expected_size)
goto invalid;
 
-   temperature = le32_to_cpu(stats->general.radio_temperature);
data.mac_id = stats->rx.general.mac_id;
data.beacon_filter_average_energy =
stats->general.beacon_filter_average_energy;
-- 
2.11.0



[PATCH 21/25] iwlwifi: mvm: remove unused sta_id variable in iwl_mvm_change_queue_owner()

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

Remove the sta_id variable, to avoid this compile warning when
compiling with W=1:

/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/sta.c: In 
function ‘iwl_mvm_change_queue_owner’:
/home/luca/iwlwifi/stack-dev/drivers/net/wireless/intel/iwlwifi/mvm/sta.c:871:5:
 warning: variable ‘sta_id’ set but not used [-Wunused-but-set-variable]
  s8 sta_id;
 ^

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

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 636c8b03e318..cf8222a8b588 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -868,7 +868,6 @@ static void iwl_mvm_change_queue_owner(struct iwl_mvm *mvm, 
int queue)
.scd_queue = queue,
.action = SCD_CFG_UPDATE_QUEUE_TID,
};
-   s8 sta_id;
int tid;
unsigned long tid_bitmap;
int ret;
@@ -876,7 +875,6 @@ static void iwl_mvm_change_queue_owner(struct iwl_mvm *mvm, 
int queue)
lockdep_assert_held(>mutex);
 
spin_lock_bh(>queue_info_lock);
-   sta_id = mvm->queue_info[queue].ra_sta_id;
tid_bitmap = mvm->queue_info[queue].tid_bitmap;
spin_unlock_bh(>queue_info_lock);
 
-- 
2.11.0



[PATCH 20/25] iwlwifi: pcie: cleanup rfkill checks

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

Move repeating code to a separate function.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 39 -
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 16790db650c1..c1d99d15796d 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1062,6 +1062,20 @@ static int iwl_pcie_load_given_ucode_8000(struct 
iwl_trans *trans,
   _ucode_section);
 }
 
+static bool iwl_trans_check_hw_rf_kill(struct iwl_trans *trans)
+{
+   bool hw_rfkill = iwl_is_rfkill_set(trans);
+
+   if (hw_rfkill)
+   set_bit(STATUS_RFKILL, >status);
+   else
+   clear_bit(STATUS_RFKILL, >status);
+
+   iwl_trans_pcie_rf_kill(trans, hw_rfkill);
+
+   return hw_rfkill;
+}
+
 static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool 
low_power)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
@@ -1204,12 +1218,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans 
*trans,
mutex_lock(_pcie->mutex);
 
/* If platform's RF_KILL switch is NOT set to KILL */
-   hw_rfkill = iwl_is_rfkill_set(trans);
-   if (hw_rfkill)
-   set_bit(STATUS_RFKILL, >status);
-   else
-   clear_bit(STATUS_RFKILL, >status);
-   iwl_trans_pcie_rf_kill(trans, hw_rfkill);
+   hw_rfkill = iwl_trans_check_hw_rf_kill(trans);
if (hw_rfkill && !run_in_rfkill) {
ret = -ERFKILL;
goto out;
@@ -1257,13 +1266,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans 
*trans,
ret = iwl_pcie_load_given_ucode(trans, fw);
 
/* re-check RF-Kill state since we may have missed the interrupt */
-   hw_rfkill = iwl_is_rfkill_set(trans);
-   if (hw_rfkill)
-   set_bit(STATUS_RFKILL, >status);
-   else
-   clear_bit(STATUS_RFKILL, >status);
-
-   iwl_trans_pcie_rf_kill(trans, hw_rfkill);
+   hw_rfkill = iwl_trans_check_hw_rf_kill(trans);
if (hw_rfkill && !run_in_rfkill)
ret = -ERFKILL;
 
@@ -1655,7 +1658,6 @@ static int iwl_pcie_init_msix_handler(struct pci_dev 
*pdev,
 static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-   bool hw_rfkill;
int err;
 
lockdep_assert_held(_pcie->mutex);
@@ -1679,13 +1681,8 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans 
*trans, bool low_power)
/* Set is_down to false here so that...*/
trans_pcie->is_down = false;
 
-   hw_rfkill = iwl_is_rfkill_set(trans);
-   if (hw_rfkill)
-   set_bit(STATUS_RFKILL, >status);
-   else
-   clear_bit(STATUS_RFKILL, >status);
-   /* ... rfkill can call stop_device and set it false if needed */
-   iwl_trans_pcie_rf_kill(trans, hw_rfkill);
+   /* ...rfkill can call stop_device and set it false if needed */
+   iwl_trans_check_hw_rf_kill(trans);
 
/* Make sure we sync here, because we'll need full access later */
if (low_power)
-- 
2.11.0



[PATCH 07/25] iwlwifi: mvm: bump max API to 28

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

We skipped one release, so bump twice, to 28.

Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c | 4 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 4 ++--
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-a000.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
index d4b73dedf89b..a72e58623d3a 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-7000.c
@@ -73,8 +73,8 @@
 /* Highest firmware API version supported */
 #define IWL7260_UCODE_API_MAX  17
 #define IWL7265_UCODE_API_MAX  17
-#define IWL7265D_UCODE_API_MAX 26
-#define IWL3168_UCODE_API_MAX  26
+#define IWL7265D_UCODE_API_MAX 28
+#define IWL3168_UCODE_API_MAX  28
 
 /* Lowest firmware API version supported */
 #define IWL7260_UCODE_API_MIN  17
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index d02ca1491d16..df0fc24e99e1 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -70,8 +70,8 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL8000_UCODE_API_MAX  26
-#define IWL8265_UCODE_API_MAX  26
+#define IWL8000_UCODE_API_MAX  28
+#define IWL8265_UCODE_API_MAX  28
 
 /* Lowest firmware API version supported */
 #define IWL8000_UCODE_API_MIN  17
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
index ff850410d897..a5f0c0bf85ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-9000.c
@@ -55,7 +55,7 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL9000_UCODE_API_MAX  26
+#define IWL9000_UCODE_API_MAX  28
 
 /* Lowest firmware API version supported */
 #define IWL9000_UCODE_API_MIN  17
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
index ea1618525878..82f18d967c40 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-a000.c
@@ -55,7 +55,7 @@
 #include "iwl-agn-hw.h"
 
 /* Highest firmware API version supported */
-#define IWL_A000_UCODE_API_MAX 26
+#define IWL_A000_UCODE_API_MAX 28
 
 /* Lowest firmware API version supported */
 #define IWL_A000_UCODE_API_MIN 24
-- 
2.11.0



[PATCH 08/25] iwlwifi: mvm: simplify paging allocation code

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

Some of the code there is duplicate while the only change is
the block size. Unifying it shortens the code and make the
difference clearer.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 61 +++--
 1 file changed, 15 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 872066317fa5..04fe1051b1e5 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -259,9 +259,7 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
 {
struct page *block;
dma_addr_t phys = 0;
-   int blk_idx = 0;
-   int order, num_of_pages;
-   int dma_enabled;
+   int blk_idx, order, num_of_pages, size, dma_enabled;
 
if (mvm->fw_paging_db[0].fw_paging_block)
return 0;
@@ -274,7 +272,6 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
num_of_pages = image->paging_mem_size / FW_PAGING_SIZE;
mvm->num_of_paging_blk = ((num_of_pages - 1) /
NUM_OF_PAGE_PER_GROUP) + 1;
-
mvm->num_of_pages_in_last_blk =
num_of_pages -
NUM_OF_PAGE_PER_GROUP * (mvm->num_of_paging_blk - 1);
@@ -284,46 +281,13 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
 mvm->num_of_paging_blk,
 mvm->num_of_pages_in_last_blk);
 
-   /* allocate block of 4Kbytes for paging CSS */
-   order = get_order(FW_PAGING_SIZE);
-   block = alloc_pages(GFP_KERNEL, order);
-   if (!block) {
-   /* free all the previous pages since we failed */
-   iwl_free_fw_paging(mvm);
-   return -ENOMEM;
-   }
-
-   mvm->fw_paging_db[blk_idx].fw_paging_block = block;
-   mvm->fw_paging_db[blk_idx].fw_paging_size = FW_PAGING_SIZE;
-
-   if (dma_enabled) {
-   phys = dma_map_page(mvm->trans->dev, block, 0,
-   PAGE_SIZE << order, DMA_BIDIRECTIONAL);
-   if (dma_mapping_error(mvm->trans->dev, phys)) {
-   /*
-* free the previous pages and the current one since
-* we failed to map_page.
-*/
-   iwl_free_fw_paging(mvm);
-   return -ENOMEM;
-   }
-   mvm->fw_paging_db[blk_idx].fw_paging_phys = phys;
-   } else {
-   mvm->fw_paging_db[blk_idx].fw_paging_phys = PAGING_ADDR_SIG |
-   blk_idx << BLOCK_2_EXP_SIZE;
-   }
-
-   IWL_DEBUG_FW(mvm,
-"Paging: allocated 4K(CSS) bytes (order %d) for firmware 
paging.\n",
-order);
-
/*
-* allocate blocks in dram.
-* since that CSS allocated in fw_paging_db[0] loop start from index 1
+* Allocate CSS and paging blocks in dram.
 */
-   for (blk_idx = 1; blk_idx < mvm->num_of_paging_blk + 1; blk_idx++) {
-   /* allocate block of PAGING_BLOCK_SIZE (32K) */
-   order = get_order(PAGING_BLOCK_SIZE);
+   for (blk_idx = 0; blk_idx < mvm->num_of_paging_blk + 1; blk_idx++) {
+   /* For CSS allocate 4KB, for others PAGING_BLOCK_SIZE (32K) */
+   size = blk_idx ? PAGING_BLOCK_SIZE : FW_PAGING_SIZE;
+   order = get_order(size);
block = alloc_pages(GFP_KERNEL, order);
if (!block) {
/* free all the previous pages since we failed */
@@ -332,7 +296,7 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
}
 
mvm->fw_paging_db[blk_idx].fw_paging_block = block;
-   mvm->fw_paging_db[blk_idx].fw_paging_size = PAGING_BLOCK_SIZE;
+   mvm->fw_paging_db[blk_idx].fw_paging_size = size;
 
if (dma_enabled) {
phys = dma_map_page(mvm->trans->dev, block, 0,
@@ -353,9 +317,14 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
blk_idx << BLOCK_2_EXP_SIZE;
}
 
-   IWL_DEBUG_FW(mvm,
-"Paging: allocated 32K bytes (order %d) for 
firmware paging.\n",
-order);
+   if (!blk_idx)
+   IWL_DEBUG_FW(mvm,
+"Paging: allocated 4K(CSS) bytes (order 
%d) for firmware paging.\n",
+order);
+   else
+   IWL_DEBUG_FW(mvm,
+"Paging: allocated 32K bytes (order %d) 
for firmware paging.\n",
+order);
}
 
return 0;
-- 
2.11.0



[PATCH 09/25] iwlwifi: mvm: replace the number of blocks calculation

2017-01-23 Thread Luca Coelho
From: Sara Sharon 

The logic in the paging calculations is a bit hard to
follow. Replace it with a kernel define.

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 04fe1051b1e5..606b3fc18d46 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -270,8 +270,8 @@ static int iwl_alloc_fw_paging_mem(struct iwl_mvm *mvm,
BUILD_BUG_ON(BIT(BLOCK_2_EXP_SIZE) != PAGING_BLOCK_SIZE);
 
num_of_pages = image->paging_mem_size / FW_PAGING_SIZE;
-   mvm->num_of_paging_blk = ((num_of_pages - 1) /
-   NUM_OF_PAGE_PER_GROUP) + 1;
+   mvm->num_of_paging_blk =
+   DIV_ROUND_UP(num_of_pages, NUM_OF_PAGE_PER_GROUP);
mvm->num_of_pages_in_last_blk =
num_of_pages -
NUM_OF_PAGE_PER_GROUP * (mvm->num_of_paging_blk - 1);
-- 
2.11.0



[PATCH 05/25] iwlwifi: allow memory debug TLV to specify the memory type

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

Due to some new features and changes, the firmware file will now
specify what type of memory to dump, in upper 8 bits of the type
field of the TLV. Parse it (types we don't understand are errors)
and teach the code to dump periphery memory.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 12 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | 15 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c  | 65 +++-
 3 files changed, 79 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 431581229948..a6719d67ac00 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1020,6 +1020,18 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
IWL_DEBUG_INFO(drv, "Found debug memory segment: %u\n",
   dbg_mem->data_type);
 
+   switch (type & FW_DBG_MEM_TYPE_MASK) {
+   case FW_DBG_MEM_TYPE_REGULAR:
+   case FW_DBG_MEM_TYPE_PRPH:
+   /* we know how to handle these */
+   break;
+   default:
+   IWL_ERR(drv,
+   "Found debug memory segment with 
invalid type: 0x%x\n",
+   type);
+   return -EINVAL;
+   }
+
size = sizeof(*pieces->dbg_mem_tlv) *
   (pieces->n_dbg_mem_tlv + 1);
n = krealloc(pieces->dbg_mem_tlv, size, GFP_KERNEL);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
index 11245b9117c7..c84207576587 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h
@@ -489,9 +489,22 @@ enum iwl_fw_dbg_monitor_mode {
 };
 
 /**
+ * enum iwl_fw_mem_seg_type - memory segment type
+ * @FW_DBG_MEM_TYPE_MASK: mask for the type indication
+ * @FW_DBG_MEM_TYPE_REGULAR: regular memory
+ * @FW_DBG_MEM_TYPE_PRPH: periphery memory (requires special reading)
+ */
+enum iwl_fw_mem_seg_type {
+   FW_DBG_MEM_TYPE_MASK= 0xff00,
+   FW_DBG_MEM_TYPE_REGULAR = 0x,
+   FW_DBG_MEM_TYPE_PRPH= 0x0100,
+};
+
+/**
  * struct iwl_fw_dbg_mem_seg_tlv - configures the debug data memory segments
  *
- * @data_type: the memory segment type to record
+ * @data_type: the memory segment type to record, see  iwl_fw_mem_seg_type
+ * for what we care about
  * @ofs: the memory segment offset
  * @len: the memory segment length, in bytes
  *
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 7df3c3f4749e..10f2c6e4056a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -406,6 +406,30 @@ static const struct iwl_prph_range 
iwl_prph_dump_addr_9000[] = {
{ .start = 0x00a02400, .end = 0x00a02758 },
 };
 
+static void _iwl_read_prph_block(struct iwl_trans *trans, u32 start,
+u32 len_bytes, __le32 *data)
+{
+   u32 i;
+
+   for (i = 0; i < len_bytes / 4; i++)
+   *data++ = cpu_to_le32(iwl_read_prph_no_grab(trans, start + i));
+}
+
+static bool iwl_read_prph_block(struct iwl_trans *trans, u32 start,
+   u32 len_bytes, __le32 *data)
+{
+   unsigned long flags;
+   bool success = false;
+
+   if (iwl_trans_grab_nic_access(trans, )) {
+   success = true;
+   _iwl_read_prph_block(trans, start, len_bytes, data);
+   iwl_trans_release_nic_access(trans, );
+   }
+
+   return success;
+}
+
 static void iwl_dump_prph(struct iwl_trans *trans,
  struct iwl_fw_error_dump_data **data,
  const struct iwl_prph_range *iwl_prph_dump_addr,
@@ -422,21 +446,18 @@ static void iwl_dump_prph(struct iwl_trans *trans,
/* The range includes both boundaries */
int num_bytes_in_chunk = iwl_prph_dump_addr[i].end -
 iwl_prph_dump_addr[i].start + 4;
-   int reg;
-   __le32 *val;
 
(*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH);
(*data)->len = cpu_to_le32(sizeof(*prph) +
num_bytes_in_chunk);
prph = (void *)(*data)->data;
prph->prph_start = cpu_to_le32(iwl_prph_dump_addr[i].start);
-   val = (void *)prph->data;
 
-   for (reg = iwl_prph_dump_addr[i].start;
-  

[PATCH 02/25] iwlwifi: mvm: don't restart HW if suspend fails with unified image

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

For unified images, we shouldn't restart the HW if suspend fails.  The
only reason for restarting the HW with non-unified images is to go
back to the D0 image.

Fixes: 23ae61282b88 ("iwlwifi: mvm: Do not switch to D3 image on suspend")
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index b88e2048ae0b..207d8ae1e116 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -1262,12 +1262,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
iwl_trans_d3_suspend(mvm->trans, test, !unified_image);
  out:
if (ret < 0) {
-   iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
-   if (mvm->restart_fw > 0) {
-   mvm->restart_fw--;
-   ieee80211_restart_hw(mvm->hw);
-   }
iwl_mvm_free_nd(mvm);
+
+   if (!unified_image) {
+   iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
+   if (mvm->restart_fw > 0) {
+   mvm->restart_fw--;
+   ieee80211_restart_hw(mvm->hw);
+   }
+   }
}
  out_noreset:
mutex_unlock(>mutex);
-- 
2.11.0



[PATCH 01/25] iwlwifi: mvm: expose device timestamp in radiotap

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

Set the relevant fields to export the 32-bit device timestamp to
radiotap using the new mac80211 infrastructure. This will be useful
to allow synchronising monitor captures taken on different hardware
simultaneously.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 45122dafe922..039cb2ad2d3e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -463,6 +463,13 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
IEEE80211_RADIOTAP_MCS_HAVE_STBC;
hw->radiotap_vht_details |= IEEE80211_RADIOTAP_VHT_KNOWN_STBC |
IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED;
+
+   hw->radiotap_timestamp.units_pos =
+   IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US |
+   IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ;
+   /* this is the case for CCK frames, it's better (only 8) for OFDM */
+   hw->radiotap_timestamp.accuracy = 22;
+
hw->rate_control_algorithm = "iwl-mvm-rs";
hw->uapsd_queues = IWL_MVM_UAPSD_QUEUES;
hw->uapsd_max_sp_len = IWL_UAPSD_MAX_SP;
-- 
2.11.0



[PATCH 00/25] iwlwifi: updates intended for v4.11 2017-01-23

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

Hi,

Here's my first series for v4.11.  These are the changes:

* A bunch of cleanups here and there;
* A few simple bugfixes;
* Some more work in preparation for A000 family support;
* Add support for radiotap timestamps;
* Some work on our firmware debugging capabilities;

As usual, I'm pushing this to a pending branch, for kbuild bot, and
will send a pull-request later.

Please review.

Cheers,
Luca.

Johannes Berg (5):
  iwlwifi: mvm: expose device timestamp in radiotap
  iwlwifi: mvm: accept arbitrary memory dump TLVs
  iwlwifi: mvm: make iwl_dump_prph() void
  iwlwifi: allow memory debug TLV to specify the memory type
  iwlwifi: mvm: properly check for transport data in dump

Jürg Billeter (1):
  iwlwifi: fix MODULE_FIRMWARE for 6030

Kirtika Ruchandani (3):
  iwlwifi: mvm: rs: Remove unused 'mvmvif'/'mvmsta' variables
  iwlwifi: mvm: rs: Remove unused 'mcs' variable
  iwlwifi: pcie: trans: Remove unused 'shift_param'

Luca Coelho (7):
  iwlwifi: mvm: don't restart HW if suspend fails with unified image
  iwlwifi: mvm: bump max API to 28
  iwlwifi: mvm: remove unused variable in iwl_mvm_handle_statistics()
  iwlwifi: dvm: make rs_tl_get_load() return void
  iwlwifi: mvm: remove unused sta_id variable in
iwl_mvm_change_queue_owner()
  iwlwifi: dvm: remove unused variable compiler warning in debugfs.c
  iwlwifi: mvm: mark ret as maybe_unused in iwl_dbgfs_fw_restart_write()

Sara Sharon (9):
  iwlwifi: mvm: simplify paging allocation code
  iwlwifi: mvm: replace the number of blocks calculation
  iwlwifi: enlarge number of ucode sections
  iwlwifi: mvm: change iwl_mvm_tx_csum to return value
  iwlwifi: mvm: separate rate calculation to a new function
  iwlwifi: mvm: support version 2 of stored beacon notification
  iwlwifi: pcie: cleanup rfkill checks
  iwlwifi: mvm: use mvm_disable_queue instead of sharing logic
  iwlwifi: mvm: cleanup redundant assignment

 drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c  |   2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/dvm/rs.c   |  11 +-
 drivers/net/wireless/intel/iwlwifi/dvm/ucode.c|   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-6000.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c |   4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c |   4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-a000.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c  |  98 +
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h  |  24 ++---
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h   |   7 +-
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c   |  13 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c  |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h   |   6 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c   | 123 ++
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c   |  69 
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |   9 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rs.c   |  10 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c   |   2 -
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  |  24 ++---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c   | 107 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c|  14 ++-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c   |  51 -
 26 files changed, 299 insertions(+), 297 deletions(-)

-- 
2.11.0



[PATCH 06/25] iwlwifi: mvm: properly check for transport data in dump

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

When copying from vmalloc'ed memory to the SG list, don't crash
if the transport didn't provide any data.

Fixes: 7e62a699aafb ("iwlwifi: mvm: use dev_coredumpsg()")
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 10f2c6e4056a..36f79953c7a1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -848,11 +848,12 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
 sg_nents(sg_dump_data),
 fw_error_dump->op_mode_ptr,
 fw_error_dump->op_mode_len, 0);
-   sg_pcopy_from_buffer(sg_dump_data,
-sg_nents(sg_dump_data),
-fw_error_dump->trans_ptr->data,
-fw_error_dump->trans_ptr->len,
-fw_error_dump->op_mode_len);
+   if (fw_error_dump->trans_ptr)
+   sg_pcopy_from_buffer(sg_dump_data,
+sg_nents(sg_dump_data),
+fw_error_dump->trans_ptr->data,
+fw_error_dump->trans_ptr->len,
+fw_error_dump->op_mode_len);
dev_coredumpsg(mvm->trans->dev, sg_dump_data, file_len,
   GFP_KERNEL);
}
-- 
2.11.0



[PATCH 03/25] iwlwifi: mvm: accept arbitrary memory dump TLVs

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

There's no reason to be validating the memory dump types, or
checking them for duplication, or anything, since we really
just pass them through from the TLV to the dump.

Thus, change the way we handle memory dump TLVs to let the
driver just blindly use anything specified there, dumping it
into the memory dump output file.

This makes the system extensible without driver changes.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 57 +---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h | 18 +---
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h  |  4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c  | 47 +--
 4 files changed, 46 insertions(+), 80 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 45b2f679e4d8..431581229948 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -179,8 +179,7 @@ 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]);
+   kfree(drv->fw.dbg_mem_tlv);
 
for (i = 0; i < IWL_UCODE_TYPE_MAX; i++)
iwl_free_fw_img(drv, drv->fw.img + i);
@@ -276,7 +275,8 @@ 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];
+   struct iwl_fw_dbg_mem_seg_tlv *dbg_mem_tlv;
+   size_t n_dbg_mem_tlv;
 };
 
 /*
@@ -1009,31 +1009,25 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
struct iwl_fw_dbg_mem_seg_tlv *dbg_mem =
(void *)tlv_data;
u32 type;
+   size_t size;
+   struct iwl_fw_dbg_mem_seg_tlv *n;
 
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;
+   size = sizeof(*pieces->dbg_mem_tlv) *
+  (pieces->n_dbg_mem_tlv + 1);
+   n = krealloc(pieces->dbg_mem_tlv, size, GFP_KERNEL);
+   if (!n)
+   return -ENOMEM;
+   pieces->dbg_mem_tlv = n;
+   pieces->dbg_mem_tlv[pieces->n_dbg_mem_tlv] = *dbg_mem;
+   pieces->n_dbg_mem_tlv++;
break;
}
default:
@@ -1345,19 +1339,12 @@ 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 */
 
+   drv->fw.dbg_mem_tlv = pieces->dbg_mem_tlv;
+   pieces->dbg_mem_tlv = NULL;
+   drv->fw.n_dbg_mem_tlv = pieces->n_dbg_mem_tlv;
+
/*
 * The (size - 16) / 12 formula is based on the information recorded
 * for each event, which is of mode 1 (including timestamp) for all
@@ -1441,25 +1428,25 @@ static void iwl_req_fw_callback(const struct 

[PATCH 04/25] iwlwifi: mvm: make iwl_dump_prph() void

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

The return value is never used, so make the function void.

Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
index 46ab6b9f680b..7df3c3f4749e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
@@ -406,17 +406,17 @@ static const struct iwl_prph_range 
iwl_prph_dump_addr_9000[] = {
{ .start = 0x00a02400, .end = 0x00a02758 },
 };
 
-static u32 iwl_dump_prph(struct iwl_trans *trans,
-struct iwl_fw_error_dump_data **data,
-const struct iwl_prph_range *iwl_prph_dump_addr,
-u32 range_len)
+static void iwl_dump_prph(struct iwl_trans *trans,
+ struct iwl_fw_error_dump_data **data,
+ const struct iwl_prph_range *iwl_prph_dump_addr,
+ u32 range_len)
 {
struct iwl_fw_error_dump_prph *prph;
unsigned long flags;
-   u32 prph_len = 0, i;
+   u32 i;
 
if (!iwl_trans_grab_nic_access(trans, ))
-   return 0;
+   return;
 
for (i = 0; i < range_len; i++) {
/* The range includes both boundaries */
@@ -425,8 +425,6 @@ static u32 iwl_dump_prph(struct iwl_trans *trans,
int reg;
__le32 *val;
 
-   prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk;
-
(*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH);
(*data)->len = cpu_to_le32(sizeof(*prph) +
num_bytes_in_chunk);
@@ -444,8 +442,6 @@ static u32 iwl_dump_prph(struct iwl_trans *trans,
}
 
iwl_trans_release_nic_access(trans, );
-
-   return prph_len;
 }
 
 /*
-- 
2.11.0



pull-request: iwlwifi 2017-01-23

2017-01-23 Thread Luca Coelho
Hi Kalle,

After a long time (too long time, I admit), here comes a pull request
with two fixes intended for v4.10.  Nothing major, just two small fixes
that were pending in our internal trees.  I have some more, but I'm
keeping this small for the -rc series.  More details in the tag
description.

I have sent this out before and kbuildbot didn't find any issues.

Cheers,
Luca.



The following changes since commit 92549cdc288f47f3a98cf80ac5890c91f5876a06:

  iwlwifi: fix kernel crash when unregistering thermal zone (2017-01-21 
14:58:37 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git 
tags/iwlwifi-for-kalle-2017-01-23

for you to fetch changes up to 03c902bff524e0cf664737a33f2365f7837040bf:

  iwlwifi: mvm: avoid crash on restart w/o reserved queues (2017-01-23 12:55:32 
+0200)


* Remove an extra hyphen from a string that was preventing the firmware to load
* Avoid a crash when the firmware is restarted in certain scenarios with DQA


Johannes Berg (1):
  iwlwifi: mvm: avoid crash on restart w/o reserved queues

Jürg Billeter (1):
  iwlwifi: fix double hyphen in MODULE_FIRMWARE for 8000

 drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  | 7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

signature.asc
Description: This is a digitally signed message part


Re: [RFC 0/1] ath9k: Frame corruption simulator

2017-01-23 Thread Ben Greear

On 01/20/2017 07:26 AM, Wojciech Dubowik wrote:



On 20/01/17 15:45, Ben Greear wrote:



On 01/20/2017 06:29 AM, Wojciech Dubowik wrote:

I have been debugging customer reported timeout and loss of
communication and I have relaized that I don't have such a lossy
environment available in the lab. To speed up debugging I have
written frame corruption simulator which will allow me to
totally loose specific types of packets. I have been mostly
using it with the mask 0x5000 which drops some EAPOL
and deauthentication frames. This way I was able to test better
timeouts and fail paths.
At the moment only management, null function and EAPOL frames
are supported. One can add more if necessary.


Would it be worth having a unique percentage configurable for each
of the selected packet types?

I wanted to keep it simple. I have been just repeating test when I didn't have
luck with specific frame loss sequence. In real life conditions frame are not 
lost
more or less depending on the type. Unless there is a hacker behind;o)


How about moving this up into mac80211 so other drivers could
be supported as well?  Couldn't you just drop the frames instead
of corrupting their checksum?  That would work with things like ath10k
as well.

I have started so but then:
 1) no more tx flags available


Look through the kernel code for SO_NOFCS.  I bet that path would give you
the ability to pass down a corrupted FCS on demand.


 2) how other drivers can handle tx frame corruption in HW so it is eqivalent
  to frame corruption in the air
 3) info.control.flags are being freed at some point in ath9k and I don't know
   how it works in other drivers
 4) dropping is not equal tx failed with no ack as status for tx drop status is 
always ok
seen from mac layer.


You should be able to lie to the mac80211 stack and tell it the frame had a 
tx-failure.

I also plan to start hacking some logic into wpa_supplicant later this week to 
allow it to delay and/or
corrupt the 4-way auth messages (and others after that).  That feature may also 
help
with your testing...

Thanks,
Ben


  For example it makes a difference for hostapd with EAPOL TX Status. There, 
mlme
 sends an event when no ack is received and whole series failed. Actually one 
could
specify whether to drop, to corrupt or just add random data.

Wojtek


I would like to have something like this, but with the added ability
to corrupt specific things like information-elements in management
frames to better test the receiver's packet parsing and error checking
logic.  For this feature, checksum would not be corrupted.

Thanks,
Ben





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



Urgent Delivery!!

2017-01-23 Thread Mr. Lewis Hawkins
Good day!

I am contacting you regarding a special cargo that has been abandoned here at 
our warehouse for over a period of 2 years and when scanned, it revealed an 
undisclosed sum of money in it. From my findings, the cargo originated from 
Europe and the content was not declared as money by the consignor in order to 
avoid diversion by the shipping agent, and also failure to pay the special 
cargo non-inspection fee of 3,400. I strongly believe the box will contain 
about 2.6 million or more.

In my private search for a reliable person, my proposal now is to present you 
as the recipient of the cargo since the shipper has abandoned it which is a 
possibility due to the fact it has been abandoned for a period whereby a new 
beneficiary can be presented to the clearance department for claim and also my 
position at this shipping service. I will pay for the fee and arrange for the 
cargo to be delivered to your address. Alternatively, I can personally bring it 
myself and then we share the total money in the box equally.


Regards,

Mr. Lewis Hawkins
Asst. Operations Manager
Zim American Integrated Shipping Services Co. LLC.
Chicago (IL) Agents: 9950 W.Lawrence Avenue, 
Suite 215 Schiller Park, IL 60176


Re: Strange Behaviors in 802.11 Association MLME

2017-01-23 Thread Johannes Berg
On Mon, 2017-01-16 at 16:16 -0500, Jinghao Shi wrote:
> Hi,
> 
> We're working on a formal validation framework for wireless protocol
> implementations. We have performed experiments on the 802.11
> association state machine and have found peculiar association
> behaviors.We'd like to share our findings to the community and
> confirm
> whether they reveal potential implementation bugs.
> 
> TLDR version: the client sends association request despite having
> received association response from the AP, is this a bug?
> 
> We utilized a real time reactive packet jammer to create the
> following
> packet loss pattern (the rate control policy was set to re-transmit
> the packet at most once before reporting the packet as failed. This
> may not be realistic in practice but helps reveal interesting
> behaviors faster.)
> 
>  - ASSOC_REQ (received by the AP, confirmed by the following
> ASSOC_RESP)
>  - ACK < JAMMED
>  - ASSOC_REQ_RETRY <- JAMMED, the driver will declare this packet
> as failed
>  - ASSOC_RESP (received by the client, confirmed by the following
> ACK)
>  - ACK
>  - ASSOC_REQ <--- problematic packet
>  - ...

I don't really see a problem. We assume that the packet was lost due to
the missing ACK, so instead of waiting for a long time, we transmit a
new one. Typically, a missing ACK is far less likely than a missing
frame.

If, as here, the association response arrives, we should properly act
on it either way.

johannes


[PATCH 2/3] ath10k: use dma_zalloc_coherent()

2017-01-23 Thread Srinivas Kandagatla
use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().

Signed-off-by: Srinivas Kandagatla 
---
 drivers/net/wireless/ath/ath10k/ce.c  | 9 +
 drivers/net/wireless/ath/ath10k/pci.c | 3 +--
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 0b4d796..c2b388f 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -958,7 +958,7 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int 
ce_id,
 * coherent DMA are unsupported
 */
dest_ring->base_addr_owner_space_unaligned =
-   dma_alloc_coherent(ar->dev,
+   dma_zalloc_coherent(ar->dev,
   (nentries * sizeof(struct ce_desc) +
CE_DESC_RING_ALIGN),
   _addr, GFP_KERNEL);
@@ -969,13 +969,6 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int 
ce_id,
 
dest_ring->base_addr_ce_space_unaligned = base_addr;
 
-   /*
-* Correctly initialize memory to 0 to prevent garbage
-* data crashing system when download firmware
-*/
-   memset(dest_ring->base_addr_owner_space_unaligned, 0,
-  nentries * sizeof(struct ce_desc) + CE_DESC_RING_ALIGN);
-
dest_ring->base_addr_owner_space = PTR_ALIGN(
dest_ring->base_addr_owner_space_unaligned,
CE_DESC_RING_ALIGN);
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index b541a1c..855e3de 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 
address, void *data,
 */
alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
 
-   data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
+   data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
   alloc_nbytes,
   _data_base,
   GFP_ATOMIC);
@@ -905,7 +905,6 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 
address, void *data,
ret = -ENOMEM;
goto done;
}
-   memset(data_buf, 0, alloc_nbytes);
 
remaining_bytes = nbytes;
ce_data = ce_data_base;
-- 
2.10.1



[PATCH 3/3] ath10k: fix typo in addr calculation

2017-01-23 Thread Srinivas Kandagatla
CORE_CTRL_ADDRESS is offset in register address space, it does not
make sense to OR it to derive the final address. It looks like its
a typo, so fix it.
Signed-off-by: Srinivas Kandagatla 
---
 drivers/net/wireless/ath/ath10k/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 855e3de..023ab10 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1936,7 +1936,7 @@ static int ath10k_pci_wake_target_cpu(struct ath10k *ar)
 {
u32 addr, val;
 
-   addr = SOC_CORE_BASE_ADDRESS | CORE_CTRL_ADDRESS;
+   addr = SOC_CORE_BASE_ADDRESS + CORE_CTRL_ADDRESS;
val = ath10k_pci_read32(ar, addr);
val |= CORE_CTRL_CPU_INTR_MASK;
ath10k_pci_write32(ar, addr, val);
-- 
2.10.1



[PATCH 1/3] ath10k: remove multiple defines of DIAG_TRANSFER_LIMIT

2017-01-23 Thread Srinivas Kandagatla
DIAG_TRANSFER_LIMIT is redefined with same value and comments
just below this entry, remove this duplicate entry.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/net/wireless/ath/ath10k/pci.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index 9854ad5..c76789d 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -25,11 +25,6 @@
 #include "ahb.h"
 
 /*
- * maximum number of bytes that can be handled atomically by DiagRead/DiagWrite
- */
-#define DIAG_TRANSFER_LIMIT 2048
-
-/*
  * maximum number of bytes that can be
  * handled atomically by DiagRead/DiagWrite
  */
-- 
2.10.1



Re: [PATCH v2 01/13] wil6210: add sysfs file for FTM calibration

2017-01-23 Thread Lior David
On 1/19/2017 3:14 PM, Arend Van Spriel wrote:
> On 19-1-2017 13:36, Lior David wrote:
>> On 1/19/2017 2:24 PM, Valo, Kalle wrote:
>>> Maya Erez  writes:
>>>
 From: Lior David 

 In fine timing measurements, the calculation is affected by
 2 parts: timing of packets over the air, which is platform
 independent, and platform-specific delays, which are dependent
 on things like antenna cable length and type.
 Add a sysfs file which allows to get/set these platform specific
 delays, separated into the TX and RX components.
 There are 2 key scenarios where the file can be used:
 1. Calibration - start with some initial values (for example,
 the default values at startup), make measurements at a known
 distance, then iteratively change the values until the
 measurement results match the known distance.
 2. Adjust the delays when platform starts up, based on known
 values.

 Signed-off-by: Lior David 
 Signed-off-by: Maya Erez 
>>>
>>> Can't this go via nl80211? sysfs is not really supposed to be used for
>>> something like this.
>>>
>> There is no nl80211 API for this (yet?).
> 
> So come up with one...?
I checked this further and had some more internal discussion.
This change is only about FTM calibration which is highly vendor specific so I
don't think NL80211 API is appropriate for it. Since it is needed in production
(to calibrate the platform after boot using pre-computed values), I think sysfs
is a reasonable place for it.

> 
>> Will it be ok to put this in debugfs? Normally this will be in the board
>> file (as part of RF configuration) but it will be useful to play
>> with these values for debugging/diagnostics.
> 
> What is doing the FTM measurements? Is it all done in user-space? That
> would mean you also need measurement data exported to user-space. How is
> that done? Intel has a FTM api proposal, but it has not been submitted
> upstream (yet?).
> 
Our plan is to use the FTM API from intel once it is submitted upstream, but as
I said this change is about FTM calibration which is separate from the generic
FTM API.

Thanks,
Lior


From:Miss:Fatima Yusuf.

2017-01-23 Thread Miss Fatima Yusuf


From:Miss:Fatima Yusuf.

For sure this mail would definitely come to you as a surprise, but do take your 
good time to go through it, My name is Miss.Fatima Yusuf,i am from Ivory Coast.

I lost my parents a year and couple of months ago. My father was a serving 
director of the Agro-exporting board until his death. He was assassinated by 
his business partners.Before his death, he made a deposit of US$9.7 Million 
Dollars here in Cote d'ivoire which was for the purchase of cocoa processing 
machine and development of another factory before his untimely death.

Being that this part of the world experiences political and crises time without 
number, there is no guarantee of lives and properties. I cannot invest this 
money here any long, despite the fact it had been my late father’s industrial 
plans.

I want you to do me a favor to receive this funds into your country or any 
safer place as the beneficiary, I have plans to invest this money in 
continuation with the investment vision of my late father, but not in this 
place again rather in your country. I have the vision of going into real estate 
and industrial production or any profitable business venture.

I will be ready to compensate you with 20% of the total Amount, now all my hope 
is banked on you and i really wants to invest this money in your country, where 
there is stability of Government, political and economic welfare.

My greatest worry now is how to move out of this country because my uncle is 
threatening to kill me as he killed my father,Please do not let anybody hear 
about this, it is between me and you alone because of my security reason.

I am waiting to hear from you.

Yours Sincerely,
Miss Fatima Yusuf.


[PATCH 2/2] iwlwifi: mvm: avoid crash on restart w/o reserved queues

2017-01-23 Thread Luca Coelho
From: Johannes Berg 

When the firmware restarts in a situation in which any station
has no queue reserved anymore because that queue was used, the
code will crash trying to access the queue_info array at the
offset 255, which is far too big. Fix this by checking that a
queue is actually reserved before writing its status.

Fixes: 8d98ae6eb0d5 ("iwlwifi: mvm: re-assign old queues after hw restart in 
dqa mode")
Signed-off-by: Johannes Berg 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 636c8b03e318..09e9e2e3ed04 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -1164,9 +1164,10 @@ static void iwl_mvm_realloc_queues_after_restart(struct 
iwl_mvm *mvm,
.frame_limit = IWL_FRAME_LIMIT,
};
 
-   /* Make sure reserved queue is still marked as such (or allocated) */
-   mvm->queue_info[mvm_sta->reserved_queue].status =
-   IWL_MVM_QUEUE_RESERVED;
+   /* Make sure reserved queue is still marked as such (if allocated) */
+   if (mvm_sta->reserved_queue != IEEE80211_INVAL_HW_QUEUE)
+   mvm->queue_info[mvm_sta->reserved_queue].status =
+   IWL_MVM_QUEUE_RESERVED;
 
for (i = 0; i <= IWL_MAX_TID_COUNT; i++) {
struct iwl_mvm_tid_data *tid_data = _sta->tid_data[i];
-- 
2.11.0



[PATCH 0/2] iwlwifi: updates intended for v4.10 2017-01-23

2017-01-23 Thread Luca Coelho
From: Luca Coelho 

Hi,

These are a couple of fixes intended for v4.10.  One avoids a crash in
specific scenarios, the other prevents a firmware load failure due to
wrong file name.

--
Luca.

Johannes Berg (1):
  iwlwifi: mvm: avoid crash on restart w/o reserved queues

J�rg Billeter (1):
  iwlwifi: fix double hyphen in MODULE_FIRMWARE for 8000

 drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  | 7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.11.0



[PATCH 1/2] iwlwifi: fix double hyphen in MODULE_FIRMWARE for 8000

2017-01-23 Thread Luca Coelho
From: Jürg Billeter 

Mistakenly, the driver is trying to load the 8000C firmware with an
incorrect name (i.e. with two hyphens where there should be only one)
and that fails.  Fix that by removing the hyphen from the format
macro.

Fixes: e1ba684f762b ("iwlwifi: 8000: fix MODULE_FIRMWARE input")
Signed-off-by: Jürg Billeter 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c 
b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
index d02ca1491d16..8d3e53fac1da 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-8000.c
@@ -91,7 +91,7 @@
 
 #define IWL8000_FW_PRE "iwlwifi-8000C-"
 #define IWL8000_MODULE_FIRMWARE(api) \
-   IWL8000_FW_PRE "-" __stringify(api) ".ucode"
+   IWL8000_FW_PRE __stringify(api) ".ucode"
 
 #define IWL8265_FW_PRE "iwlwifi-8265-"
 #define IWL8265_MODULE_FIRMWARE(api) \
-- 
2.11.0



Re: [RFC v3 0/8] ath10k sdio support

2017-01-23 Thread Valo, Kalle
Erik Stromdahl  writes:

> This is the third version of the sdio RFC patch series.
> The actual sdio code (patch 6) has been subject to a massive overhaul,
> mainly as a result of Kalle's review comments.
> It no longer has any strong resemblance of the original ath6kl code from
> which it was originally based upon.
>
> Previous pathes 6 to 10 have been merged into one single patch.
>
> The previous series had a rework of the "HTC fake service" connect
> (ep 0 connect) that introduced a race between the actual endpoint
> connect and the HTC ready message. This issue has been addressed,
> and the current patches (3 and 4) has been rewritten accordingly.
>
> * overview of patches *
>
> Patches 1 to 4 are more or less identical to the previous RFC, with an
> exception for patch 3 that changes the "HTC fake service" connect
> (mentioned above).
>
> Patch 5 is a squashed version of previous patches 6 to 10.
>
> Patch 6 is the actual sdio patch
>
> Patches 7 to 8 are new and adds special sdio versions of BMI get
> target info and HTC ready.
>
> The new version was built and tested against:
> tag: ath-201701121109
>
> Erik Stromdahl (8):
>   ath10k: htc: made static function public
>   ath10k: htc: rx trailer lookahead support
>   ath10k: htc: move htc ctrl ep connect to htc_init
>   ath10k: htc: refactorization
>   ath10k: various sdio related definitions
>   ath10k: sdio support
>   ath10k: sdio get target info
>   ath10k: htc: ready_ext msg support

I pushed now this, and your usb series as well, to ath.git
master-pending branch. Let's see if kbuild bot finds any problems.

-- 
Kalle Valo

Re: [PATCH 0/6] iwlwifi: updates intended for v4.10 2017-01-13

2017-01-23 Thread Coelho, Luciano
On Fri, 2017-01-13 at 14:39 +0200, Luca Coelho wrote:
> From: Luca Coelho 
> 
> Hi,
> 
> Here are a few fixes that I intend to send for v4.10:
> 
> * fix suspend failure with unified firmware images
> * fix a potential crash when dumping debug data
> * fix a couple of mistakes in FW names exported by the modules
> * small fix for PS-Poll enabling via debugfs
> * fix for dynamic queue allocation offchannel data

As discussed on IRC, it got a bit late for some of these patches (due to
my trip last week).  So, let's ignore this and I'll send a new version
with less patches today.

--
Luca.

[PATCH] mac80211: don't try to sleep in rate_control_rate_init()

2017-01-23 Thread Johannes Berg
From: Johannes Berg 

In my previous patch, I missed that rate_control_rate_init() is
called from some places that cannot sleep, so it cannot call
ieee80211_recalc_min_chandef(). Remove that call for now to fix
the context bug, we'll have to find a different way to fix the
minimum channel width issue.

Fixes: 96aa2e7cf126 ("mac80211: calculate min channel width correctly")
Reported-by: Xiaolong Ye (via lkp-robot) 
Signed-off-by: Johannes Berg 
---
 net/mac80211/rate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 9e2641d45587..206698bc93f4 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -40,8 +40,6 @@ void rate_control_rate_init(struct sta_info *sta)
 
ieee80211_sta_set_rx_nss(sta);
 
-   ieee80211_recalc_min_chandef(sta->sdata);
-
if (!ref)
return;
 
-- 
2.9.3