Skip to contentSkip to conversation

pull-request: iwlwifi-next 2016-09-19

PATCH In review Luca Coelho 3 participants 31 messages Sep 19, 2016 – Sep 26, 2016 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

Hi Kalle,

Here we go again, now I'm almost catching up with the pending stuff in our internal tree, just in time for 4.9.  This pull contains a bunch of fixes to DQA and new HW support code, a few new features and some cleanups.  More details in the tag description.

Let me know if everything's fine (or not). :)

Luca.

The following changes since commit 80ba4f1d365af206b9e818d17d22fed02fe5def0:

  mwifiex: fix null pointer deference when adapter is null (2016-09-17 18:26:32 +0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2016-09-19

for you to fetch changes up to e9dd5c83fd1c8d36d9b8180a1ca7576f823442fd:

  iwlwifi: pcie: use LIST_HEAD() macro (2016-09-19 10:10:19 +0300)

----------------------------------------------------------------
* added support for MU-MIMO sniffer
* added support for RRM by scan
* added support for packet injection
* migrate to devm memory allocation handling
* some fixes, mostly in DQA and new HW support
* other generic cleanups

----------------------------------------------------------------
Arik Nemtsov (1):
      iwlwifi: move BIOS MCC retrieval to common code

Aviya Erenfeld (1):
      iwlwifi: mvm: add support for MU-MIMO air sniffer

Avrahams Stern (1):
      iwlwifi: mvm: Add support for RRM by scan

Emmanuel Grumbach (1):
      iwlwifi: don't export trace points that are used in iwlwifi only

Haim Dreyfuss (1):
      iwlwifi: check for valid ethernet address provided by OEM

Ido Yariv (1):
      iwlwifi: mvm: Add mem debugfs entry

Johannes Berg (6):
      iwlwifi: mvm: compare full command ID
      iwlwifi: mvm: make iwl_mvm_update_sta() an inline
      iwlwifi: mvm: document passing unexpected Block Ack Request frames
      iwlwifi: mvm: move AP-specific code to right function
      iwlwifi: mvm: use LIST_HEAD() macro
      iwlwifi: pcie: use LIST_HEAD() macro

Liad Kaufman (1):
      iwlwifi: mvm: remove variable shadowing

Oren Givon (1):
      iwlwifi: add new 8265 series PCI ID

Roee Zamir (1):
      iwlwifi: mvm: Add debugfs function for clocks diff

Sara Sharon (9):
      iwlwifi: pcie: fix typo in struct name for a000 devices
      iwlwifi: mvm: cleanup skb queue functions use
      iwlwifi: mvm: fix DQA AP mode station assumption
      iwlwifi: mvm: support BAR in reorder buffer
      iwlwifi: mvm: support packet injection
      iwlwifi: pcie: log full command sequence
      iwlwifi: move to wide ID for all commands
      iwlwifi: mvm: disable P2P queue on mac context release
      iwlwifi: mvm: set HCMD_NAME for PHY_DB as well

Sharon Dvir (1):
      iwlwifi: migrate to devm_* API

 drivers/net/wireless/intel/iwlwifi/iwl-devtrace.c    |   3 --
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h     |   5 ++ drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c  |   8 +++- drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c   | 104 ++++++++++++++++++++++++++++++++++++++++-- drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h   |  20 +++++++- drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c      |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c       |  11 ++---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h       |   5 +- drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c |  26 +++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c     | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h |  20 ++++---- drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h      |  52 ++++++++++++++++++++- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c    |  47 ++++++++++--------- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c    |  18 ++++++++

 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h         |   6 +++
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c         |  93 +------------------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c         |  32 +++++++------

 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c        |  30 ++++++++---- drivers/net/wireless/intel/iwlwifi/mvm/scan.c        |  61 ++++++++++++++++++++++--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c         |  13 ++---- drivers/net/wireless/intel/iwlwifi/mvm/sta.h         |  11 +++-- drivers/net/wireless/intel/iwlwifi/mvm/tx.c          |  35 +++++++++++--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c        |   1 + drivers/net/wireless/intel/iwlwifi/pcie/internal.h   |   2 - drivers/net/wireless/intel/iwlwifi/pcie/rx.c         |   9 ++-- drivers/net/wireless/intel/iwlwifi/pcie/trans.c      |  84 ++++++++++++++-------------------- drivers/net/wireless/intel/iwlwifi/pcie/tx.c         |   2 +-

 27 files changed, 632 insertions(+), 252 deletions(-)
#1 lore raw

PATCH 1/25 iwlwifi: mvm: remove variable shadowing

From: Liad Kaufman <[email protected]>

Variable "ac" defined twice. Fix that.

Fixes commit 93f436e2c7fe ("iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd")
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +3 -3
index 216aa54..d3a0378 100644
@@ -745,14 +745,14 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
 			.scd_queue = queue,
 			.action = SCD_CFG_DISABLE_QUEUE,
 		};
-		u8 ac;
+		u8 txq_curr_ac;
 
 		disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
 
 		spin_lock_bh(&mvm->queue_info_lock);
-		ac = mvm->queue_info[queue].mac80211_ac;
+		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[ac];
+		cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[txq_curr_ac];
 		cmd.tid = mvm->queue_info[queue].txq_tid;
 		spin_unlock_bh(&mvm->queue_info_lock);
 
Signature · 1 line
2.9.3
#2 lore raw

PATCH 2/25 iwlwifi: pcie: fix typo in struct name for a000 devices

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

commit 3cd1980b0cdf ("iwlwifi: pcie: introduce new tfd and tb formats")

---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
index 188b0de..74199b1 100644
@@ -2953,7 +2953,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
 
 	if (cfg->use_tfh) {
 		trans_pcie->max_tbs = IWL_TFH_NUM_TBS;
-		trans_pcie->tfd_size = sizeof(struct iwl_tfh_tb);
+		trans_pcie->tfd_size = sizeof(struct iwl_tfh_tfd);
 
 	} else {
 		trans_pcie->max_tbs = IWL_NUM_OF_TBS;
Signature · 1 line
2.9.3
#3 lore raw

PATCH 3/25 iwlwifi: mvm: cleanup skb queue functions use

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

Use skb_queue_empty() and not skb_peek_tail() to check for empty list.
Avoid a redundant check as well - loop will take care of it.

---
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +7 -6
index d6d9ec4..b386628 100644
@@ -418,10 +418,11 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm,
 
 		ssn = ieee80211_sn_inc(ssn);
 
-		/* holes are valid since nssn indicates frames were received. */
-		if (skb_queue_empty(skb_list) || !skb_peek_tail(skb_list))
-			continue;
-		/* Empty the list. Will have more than one frame for A-MSDU */
+		/*
+		 * Empty the list. Will have more than one frame for A-MSDU.
+		 * Empty list is valid as well since nssn indicates frames were
+		 * received.
+		 */
 		while ((skb = __skb_dequeue(skb_list))) {
 			iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb,
 							reorder_buf->queue,
@@ -434,7 +435,7 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm,
 	if (reorder_buf->num_stored && !reorder_buf->removed) {
 		u16 index = reorder_buf->head_sn % reorder_buf->buf_size;
 
-		while (!skb_peek_tail(&reorder_buf->entries[index]))
+		while (skb_queue_empty(&reorder_buf->entries[index]))
 			index = (index + 1) % reorder_buf->buf_size;
 		/* modify timer to match next frame's expiration time */
 		mod_timer(&reorder_buf->reorder_timer,
@@ -462,7 +463,7 @@ void iwl_mvm_reorder_timer_expired(unsigned long data)
 	for (i = 0; i < buf->buf_size ; i++) {
 		index = (buf->head_sn + i) % buf->buf_size;
 
-		if (!skb_peek_tail(&buf->entries[index]))
+		if (skb_queue_empty(&buf->entries[index]))
 			continue;
 		if (!time_after(jiffies, buf->reorder_time[index] +
 				RX_REORDER_BUF_TIMEOUT_MQ))
Signature · 1 line
2.9.3
#4 lore raw

PATCH 4/25 iwlwifi: mvm: compare full command ID

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

When comparing command IDs, the group should be taken into account so the same command/notification from a different group doesn't trigger anything unexpected. Fix this by comparing to the wide ID.

Fixes commit 1738d60b31d7 ("iwlwifi: mvm: handle RX MPDUs separately")
---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +13 -10
index 43ea1e5..de34c9f 100644
@@ -966,10 +966,11 @@ static void iwl_mvm_rx(struct iwl_op_mode *op_mode,
 {
 	struct iwl_rx_packet *pkt = rxb_addr(rxb);
 	struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
+	u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-	if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+	if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
 		iwl_mvm_rx_rx_mpdu(mvm, napi, rxb);
-	else if (pkt->hdr.cmd == REPLY_RX_PHY_CMD)
+	else if (cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_PHY_CMD))
 		iwl_mvm_rx_rx_phy_cmd(mvm, rxb);
 	else
 		iwl_mvm_rx_common(mvm, rxb, pkt);
@@ -981,13 +982,14 @@ static void iwl_mvm_rx_mq(struct iwl_op_mode *op_mode,
 {
 	struct iwl_rx_packet *pkt = rxb_addr(rxb);
 	struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
+	u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-	if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+	if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
 		iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0);
-	else if (unlikely(pkt->hdr.group_id == DATA_PATH_GROUP &&
-			  pkt->hdr.cmd == RX_QUEUES_NOTIFICATION))
+	else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP,
+					 RX_QUEUES_NOTIFICATION)))
 		iwl_mvm_rx_queue_notif(mvm, rxb, 0);
-	else if (pkt->hdr.cmd == FRAME_RELEASE)
+	else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE))
 		iwl_mvm_rx_frame_release(mvm, napi, rxb, 0);
 	else
 		iwl_mvm_rx_common(mvm, rxb, pkt);
@@ -1666,13 +1668,14 @@ static void iwl_mvm_rx_mq_rss(struct iwl_op_mode *op_mode,
 {
 	struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
 	struct iwl_rx_packet *pkt = rxb_addr(rxb);
+	u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd);
 
-	if (unlikely(pkt->hdr.cmd == FRAME_RELEASE))
+	if (unlikely(cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)))
 		iwl_mvm_rx_frame_release(mvm, napi, rxb, queue);
-	else if (unlikely(pkt->hdr.cmd == RX_QUEUES_NOTIFICATION &&
-			  pkt->hdr.group_id == DATA_PATH_GROUP))
+	else if (unlikely(cmd == WIDE_ID(DATA_PATH_GROUP,
+					 RX_QUEUES_NOTIFICATION)))
 		iwl_mvm_rx_queue_notif(mvm, rxb, queue);
-	else if (likely(pkt->hdr.cmd == REPLY_RX_MPDU_CMD))
+	else if (likely(cmd == WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD)))
 		iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue);
 }
 
Signature · 1 line
2.9.3
#5 lore raw

PATCH 5/25 iwlwifi: mvm: add support for MU-MIMO air sniffer

In reply to Luca Coelho

From: Aviya Erenfeld <[email protected]>

enable MU-MIMO air sniffer if it's supported by the NIC

---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +8 -0
index 9506e65..b7d80b5 100644
@@ -720,6 +720,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 	if (ret)
 		iwl_mvm_leds_exit(mvm);
 
+	if (mvm->cfg->vht_mu_mimo_supported)
+		wiphy_ext_feature_set(hw->wiphy,
+				      NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
+
 	return ret;
 }
 
@@ -2229,6 +2233,10 @@ static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw,
 	case NL80211_IFTYPE_ADHOC:
 		iwl_mvm_bss_info_changed_ap_ibss(mvm, vif, bss_conf, changes);
 		break;
+	case NL80211_IFTYPE_MONITOR:
+		if (changes & BSS_CHANGED_MU_GROUPS)
+			iwl_mvm_update_mu_groups(mvm, vif);
+		break;
 	default:
 		/* shouldn't happen */
 		WARN_ON_ONCE(1);
Signature · 1 line
2.9.3
#6 lore raw

PATCH 6/25 iwlwifi: check for valid ethernet address provided by OEM

In reply to Luca Coelho

From: Haim Dreyfuss <[email protected]>

In 9000 family products we added an option to let the OEM fuse the mac address via registers. If these registers are zeroed we use the OTP address instead. Make sure that the address provided by the OEM is valid and, if not, fall back to the OTP address as well.

Fixes commit 17c867bfe89b ("iwlwifi: add support for getting HW address from CSR")
---
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +10 -5
index 43f8f7d..adba3b0 100644
@@ -564,11 +564,16 @@ static void iwl_set_hw_address_from_csr(struct iwl_trans *trans,
 	__le32 mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_STRAP));
 	__le32 mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_STRAP));
 
-	/* If OEM did not fuse address - get it from OTP */
-	if (!mac_addr0 && !mac_addr1) {
-		mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_OTP));
-		mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_OTP));
-	}
+	iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
+	/*
+	 * If the OEM fused a valid address, use it instead of the one in the
+	 * OTP
+	 */
+	if (is_valid_ether_addr(data->hw_addr))
+		return;
+
+	mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_OTP));
+	mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_OTP));
 
 	iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
 }
Signature · 1 line
2.9.3
#7 lore raw

PATCH 7/25 iwlwifi: mvm: fix DQA AP mode station assumption

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

There was recently a Full AP mode feature added where hostap adds the station at auth stage, and not assoc.
However, when running with legacy hostapd, we get the auth response before station was added, and tx_skb_non_sta fails to allocate a queue, resulting in a complete failure of association. Take care of this situation as well.
Add a warning when no valid queue is returned at all and make mvm drop the packet instead of passing it on.
Refactor the function a bit while at it.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 35 +++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +28 -7
index 1051777..e0c9065 100644
@@ -490,16 +490,34 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
 static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm,
 				      struct ieee80211_tx_info *info, __le16 fc)
 {
-	if (iwl_mvm_is_dqa_supported(mvm)) {
-		if (info->control.vif->type == NL80211_IFTYPE_AP &&
-		    ieee80211_is_probe_resp(fc))
+	if (!iwl_mvm_is_dqa_supported(mvm))
+		return info->hw_queue;
+
+	switch (info->control.vif->type) {
+	case NL80211_IFTYPE_AP:
+		/*
+		 * handle legacy hostapd as well, where station may be added
+		 * only after assoc.
+		 */
+		if (ieee80211_is_probe_resp(fc) || ieee80211_is_auth(fc))
 			return IWL_MVM_DQA_AP_PROBE_RESP_QUEUE;
-		else if (ieee80211_is_mgmt(fc) &&
-			 info->control.vif->type == NL80211_IFTYPE_P2P_DEVICE)
+		if (info->hw_queue == info->control.vif->cab_queue)
+			return info->hw_queue;
+
+		WARN_ON_ONCE(1);
+		return IWL_MVM_DQA_AP_PROBE_RESP_QUEUE;
+	case NL80211_IFTYPE_P2P_DEVICE:
+		if (ieee80211_is_mgmt(fc))
 			return IWL_MVM_DQA_P2P_DEVICE_QUEUE;
-	}
+		if (info->hw_queue == info->control.vif->cab_queue)
+			return info->hw_queue;
 
-	return info->hw_queue;
+		WARN_ON_ONCE(1);
+		return IWL_MVM_DQA_P2P_DEVICE_QUEUE;
+	default:
+		WARN_ONCE(1, "Not a ctrl vif, no available queue\n");
+		return -1;
+	}
 }
 
 int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
@@ -560,6 +578,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
 			sta_id = mvmvif->bcast_sta.sta_id;
 			queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info,
 							   hdr->frame_control);
+			if (queue < 0)
+				return -1;
+
 		} else if (info.control.vif->type == NL80211_IFTYPE_STATION &&
 			   is_multicast_ether_addr(hdr->addr1)) {
 			u8 ap_sta_id = ACCESS_ONCE(mvmvif->ap_sta_id);
Signature · 1 line
2.9.3
#8 lore raw

PATCH 8/25 iwlwifi: mvm: support BAR in reorder buffer

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

On default queue we will not receive frame release notification, but the BAR itself.
Upon receiving the BAR driver should look at the NSSN and adjust window accordingly.

Fixes b915c10174fb ("iwlwifi: mvm: add reorder buffer per queue")
---
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +9 -3
index b386628..0274f14 100644
@@ -600,9 +600,10 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 
 	mvm_sta = iwl_mvm_sta_from_mac80211(sta);
 
-	/* not a data packet */
-	if (!ieee80211_is_data_qos(hdr->frame_control) ||
-	    is_multicast_ether_addr(hdr->addr1))
+	/* not a data packet or a bar */
+	if (!ieee80211_is_back_req(hdr->frame_control) &&
+	    (!ieee80211_is_data_qos(hdr->frame_control) ||
+	     is_multicast_ether_addr(hdr->addr1)))
 		return false;
 
 	if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
@@ -626,6 +627,11 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 
 	spin_lock_bh(&buffer->lock);
 
+	if (ieee80211_is_back_req(hdr->frame_control)) {
+		iwl_mvm_release_frames(mvm, sta, napi, buffer, nssn);
+		goto drop;
+	}
+
 	/*
 	 * If there was a significant jump in the nssn - adjust.
 	 * If the SN is smaller than the NSSN it might need to first go into
Signature · 1 line
2.9.3
#9 lore raw

PATCH 9/25 iwlwifi: mvm: Add support for RRM by scan

In reply to Luca Coelho

From: Avrahams Stern <[email protected]>

Implement support for RRM by adding an option to configure the scan dwell time and reporting scan start time and BSS detection time, and Advertise support for these features.

---
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h   |  5 ++
 .../net/wireless/intel/iwlwifi/mvm/fw-api-scan.h   | 20 ++++---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 10 ++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h       |  6 +++
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c      | 61 +++++++++++++++++++---
 5 files changed, 88 insertions(+), 14 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h +5 -0
index 1b1e045..94423f0 100644
@@ -256,6 +256,10 @@ typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t;
  *	instead of 3.
  * @IWL_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size
  *	(command version 3) that supports per-chain limits
+ * @IWL_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan
+ *	iteration complete notification, and the timestamp reported for RX
+ *	received during scan, are reported in TSF of the mac specified in the
+ *	scan request.
  *
  * @NUM_IWL_UCODE_TLV_API: number of bits used
  */
@@ -267,6 +271,7 @@ enum iwl_ucode_tlv_api {
 	IWL_UCODE_TLV_API_NEW_VERSION           = (__force iwl_ucode_tlv_api_t)20,
 	IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY	= (__force iwl_ucode_tlv_api_t)24,
 	IWL_UCODE_TLV_API_TX_POWER_CHAIN	= (__force iwl_ucode_tlv_api_t)27,
+	IWL_UCODE_TLV_API_SCAN_TSF_REPORT	= (__force iwl_ucode_tlv_api_t)28,
 
 	NUM_IWL_UCODE_TLV_API
 #ifdef __CHECKER__
drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h +12 -8
index f01dab0..0c294c9f 100644
@@ -7,6 +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
  *
  * 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
@@ -603,6 +604,8 @@ struct iwl_scan_req_umac_tail {
  * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  * @ooc_priority: out of channel priority - &enum iwl_scan_priority
  * @general_flags: &enum iwl_umac_scan_general_flags
+ * @reserved2: for future use and alignment
+ * @scan_start_mac_id: report the scan start TSF time according to this mac TSF
  * @extended_dwell: dwell time for channels 1, 6 and 11
  * @active_dwell: dwell time for active scan
  * @passive_dwell: dwell time for passive scan
@@ -620,8 +623,10 @@ struct iwl_scan_req_umac {
 	__le32 flags;
 	__le32 uid;
 	__le32 ooc_priority;
-	/* SCAN_GENERAL_PARAMS_API_S_VER_1 */
-	__le32 general_flags;
+	/* SCAN_GENERAL_PARAMS_API_S_VER_4 */
+	__le16 general_flags;
+	u8 reserved2;
+	u8 scan_start_mac_id;
 	u8 extended_dwell;
 	u8 active_dwell;
 	u8 passive_dwell;
@@ -629,7 +634,7 @@ struct iwl_scan_req_umac {
 	__le32 max_out_time;
 	__le32 suspend_time;
 	__le32 scan_priority;
-	/* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
+	/* SCAN_CHANNEL_PARAMS_API_S_VER_4 */
 	u8 channel_flags;
 	u8 n_channels;
 	__le16 reserved;
@@ -718,8 +723,8 @@ struct iwl_scan_offload_profiles_query {
  * @status: one of SCAN_COMP_STATUS_*
  * @bt_status: BT on/off status
  * @last_channel: last channel that was scanned
- * @tsf_low: TSF timer (lower half) in usecs
- * @tsf_high: TSF timer (higher half) in usecs
+ * @start_tsf: TSF timer in usecs of the scan start time for the mac specified
+ *	in &struct iwl_scan_req_umac.
  * @results: array of scan results, only "scanned_channels" of them are valid
  */
 struct iwl_umac_scan_iter_complete_notif {
@@ -728,9 +733,8 @@ struct iwl_umac_scan_iter_complete_notif {
 	u8 status;
 	u8 bt_status;
 	u8 last_channel;
-	__le32 tsf_low;
-	__le32 tsf_high;
+	__le64 start_tsf;
 	struct iwl_scan_results_notif results[];
-} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
+} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */
 
 #endif
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +10 -0
index b7d80b5..a5ede8c 100644
@@ -653,6 +653,16 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 			IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT))
 		hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES;
 
+	if (fw_has_api(&mvm->fw->ucode_capa,
+		       IWL_UCODE_TLV_API_SCAN_TSF_REPORT)) {
+		wiphy_ext_feature_set(hw->wiphy,
+				      NL80211_EXT_FEATURE_SCAN_START_TIME);
+		wiphy_ext_feature_set(hw->wiphy,
+				      NL80211_EXT_FEATURE_BSS_PARENT_TSF);
+		wiphy_ext_feature_set(hw->wiphy,
+				      NL80211_EXT_FEATURE_SET_SCAN_DWELL);
+	}
+
 	mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
 
 #ifdef CONFIG_PM_SLEEP
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +6 -0
index 83f3889..e68a2bd 100644
@@ -821,6 +821,12 @@ struct iwl_mvm {
 	/* UMAC scan tracking */
 	u32 scan_uid_status[IWL_MVM_MAX_UMAC_SCANS];
 
+	/* start time of last scan in TSF of the mac that requested the scan */
+	u64 scan_start;
+
+	/* the vif that requested the current scan */
+	struct iwl_mvm_vif *scan_vif;
+
 	/* rx chain antennas set through debugfs for the scan command */
 	u8 scan_rx_ant;
 
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +55 -6

140 lines not on this page · raw message

Signature · 1 line
2.9.3
#10 lore raw

PATCH 10/25 iwlwifi: mvm: support packet injection

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

For automatic testing packet injection can be useful. Support injection through debugfs.

---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 55 ++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +55 -0
index b344898..540b7c9 100644
@@ -917,6 +917,59 @@ static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm,
 	return ret ?: count;
 }
 
+static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
+					     char *buf, size_t count,
+					     loff_t *ppos)
+{
+	struct iwl_rx_cmd_buffer rxb = {
+		._rx_page_order = 0,
+		.truesize = 0, /* not used */
+		._offset = 0,
+	};
+	struct iwl_rx_packet *pkt;
+	struct iwl_rx_mpdu_desc *desc;
+	int bin_len = count / 2;
+	int ret = -EINVAL;
+
+	/* supporting only 9000 descriptor */
+	if (!mvm->trans->cfg->mq_rx_supported)
+		return -ENOTSUPP;
+
+	rxb._page = alloc_pages(GFP_ATOMIC, 0);
+	if (!rxb._page)
+		return -ENOMEM;
+	pkt = rxb_addr(&rxb);
+
+	ret = hex2bin(page_address(rxb._page), buf, bin_len);
+	if (ret)
+		goto out;
+
+	/* avoid invalid memory access */
+	if (bin_len < sizeof(*pkt) + sizeof(*desc))
+		goto out;
+
+	/* check this is RX packet */
+	if (WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd) !=
+	    WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))
+		goto out;
+
+	/* check the length in metadata matches actual received length */
+	desc = (void *)pkt->data;
+	if (le16_to_cpu(desc->mpdu_len) !=
+	    (bin_len - sizeof(*desc) - sizeof(*pkt)))
+		goto out;
+
+	local_bh_disable();
+	iwl_mvm_rx_mpdu_mq(mvm, NULL, &rxb, 0);
+	local_bh_enable();
+	ret = 0;
+
+out:
+	iwl_free_rxb(&rxb);
+
+	return ret ?: count;
+}
+
 static ssize_t iwl_dbgfs_fw_dbg_conf_read(struct file *file,
 					  char __user *user_buf,
 					  size_t count, loff_t *ppos)
@@ -1454,6 +1507,7 @@ MVM_DEBUGFS_WRITE_FILE_OPS(cont_recording, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(max_amsdu_len, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
 			   (IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
+MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512);
 
 #ifdef CONFIG_IWLWIFI_BCAST_FILTERING
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256);
@@ -1502,6 +1556,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
 	MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, S_IWUSR);
 	MVM_DEBUGFS_ADD_FILE(cont_recording, mvm->debugfs_dir, S_IWUSR);
 	MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, S_IWUSR);
+	MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, S_IWUSR);
 	if (!debugfs_create_bool("enable_scan_iteration_notif",
 				 S_IRUSR | S_IWUSR,
 				 mvm->debugfs_dir,
Signature · 1 line
2.9.3
#27 lore raw

PATCH 24/25 iwlwifi: mvm: use LIST_HEAD() macro

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

There's no need to declare a list and then init it manually, just use the LIST_HEAD() macro.

---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +1 -3
index 3eccd89..75f3ca0 100644
@@ -858,9 +858,7 @@ static void iwl_mvm_async_handlers_wk(struct work_struct *wk)
 	struct iwl_mvm *mvm =
 		container_of(wk, struct iwl_mvm, async_handlers_wk);
 	struct iwl_async_handler_entry *entry, *tmp;
-	struct list_head local_list;
-
-	INIT_LIST_HEAD(&local_list);
+	LIST_HEAD(local_list);
 
 	/* Ensure that we are not in stop flow (check iwl_mvm_mac_stop) */
 
Signature · 1 line
2.9.3
#15 lore raw

PATCH 12/25 iwlwifi: pcie: log full command sequence

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

Log group as well. Remove 0x prefix to match TX logging.

---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +3 -2
index 0b5b331..78cb6d2 100644
@@ -1108,13 +1108,14 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
 			FH_RSCSR_RXQ_POS != rxq->id);
 
 		IWL_DEBUG_RX(trans,
-			     "cmd at offset %d: %s (0x%.2x, seq 0x%x)\n",
+			     "cmd at offset %d: %s (%.2x.%2x, seq 0x%x)\n",
 			     rxcb._offset,
 			     iwl_get_cmd_string(trans,
 						iwl_cmd_id(pkt->hdr.cmd,
 							   pkt->hdr.group_id,
 							   0)),
-			     pkt->hdr.cmd, le16_to_cpu(pkt->hdr.sequence));
+			     pkt->hdr.group_id, pkt->hdr.cmd,
+			     le16_to_cpu(pkt->hdr.sequence));
 
 		len = iwl_rx_packet_len(pkt);
 		len += sizeof(u32); /* account for status word */
Signature · 1 line
2.9.3
#23 lore raw

PATCH 20/25 iwlwifi: add new 8265 series PCI ID

In reply to Luca Coelho

From: Oren Givon <[email protected]>

Add a new PCI ID for the 8265 series.

---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 -0
index 14c6e94..3d766f2 100644
@@ -487,6 +487,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 	{IWL_PCI_DEVICE(0x24FD, 0x1130, iwl8265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x24FD, 0x0130, iwl8265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)},
+	{IWL_PCI_DEVICE(0x24FD, 0x10D0, iwl8265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)},
 	{IWL_PCI_DEVICE(0x24FD, 0x9010, iwl8265_2ac_cfg)},
Signature · 1 line
2.9.3
#19 lore raw

PATCH 16/25 iwlwifi: don't export trace points that are used in iwlwifi only

In reply to Luca Coelho

From: Emmanuel Grumbach <[email protected]>

This can save a few bytes

---
 drivers/net/wireless/intel/iwlwifi/iwl-devtrace.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-devtrace.c +0 -3
index 1d9dd153..50510fb 100644
@@ -33,9 +33,6 @@
 #define CREATE_TRACE_POINTS
 #include "iwl-devtrace.h"
 
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_iowrite8);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ioread32);
-EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_iowrite32);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_event);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_error);
 EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_cont_event);
Signature · 1 line
2.9.3
#22 lore raw

PATCH 19/25 iwlwifi: mvm: Add debugfs function for clocks diff

In reply to Luca Coelho

From: Roee Zamir <[email protected]>

New function, reveals the diff between gp2 and host time.

---
 .../net/wireless/intel/iwlwifi/mvm/debugfs-vif.c   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +26 -0
index b232717..8ff1921 100644
@@ -504,6 +504,28 @@ static inline char *iwl_dbgfs_is_match(char *name, char *buf)
 	return !strncmp(name, buf, len) ? buf + len : NULL;
 }
 
+static ssize_t iwl_dbgfs_os_device_timediff_read(struct file *file,
+						 char __user *user_buf,
+						 size_t count, loff_t *ppos)
+{
+	struct ieee80211_vif *vif = file->private_data;
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+	struct iwl_mvm *mvm = mvmvif->mvm;
+	u32 curr_gp2;
+	u64 curr_os;
+	s64 diff;
+	char buf[64];
+	const size_t bufsz = sizeof(buf);
+	int pos = 0;
+
+	iwl_mvm_get_sync_time(mvm, &curr_gp2, &curr_os);
+	do_div(curr_os, NSEC_PER_USEC);
+	diff = curr_os - curr_gp2;
+	pos += scnprintf(buf + pos, bufsz - pos, "diff=%lld\n", diff);
+
+	return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
+}
+
 static ssize_t iwl_dbgfs_tof_enable_write(struct ieee80211_vif *vif,
 					  char *buf,
 					  size_t count, loff_t *ppos)
@@ -1530,6 +1552,8 @@ MVM_DEBUGFS_READ_FILE_OPS(tof_range_response);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
 MVM_DEBUGFS_WRITE_FILE_OPS(lqm_send_cmd, 64);
+MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
+
 
 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
@@ -1570,6 +1594,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 	MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir,
 				 S_IRUSR | S_IWUSR);
 	MVM_DEBUGFS_ADD_FILE_VIF(lqm_send_cmd, mvmvif->dbgfs_dir, S_IWUSR);
+	MVM_DEBUGFS_ADD_FILE_VIF(os_device_timediff,
+				 mvmvif->dbgfs_dir, S_IRUSR);
 
 	if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
 	    mvmvif == mvm->bf_allowed_vif)
Signature · 1 line
2.9.3
#16 lore raw

PATCH 13/25 iwlwifi: mvm: make iwl_mvm_update_sta() an inline

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

There's no point in making this an out-of-line function since it just calls a single other function with a few changed parameters.

---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c |  7 -------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 11 ++++++++---
 2 files changed, 8 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +0 -7
index d3a0378..258a234 100644
@@ -1297,13 +1297,6 @@ err:
 	return ret;
 }
 
-int iwl_mvm_update_sta(struct iwl_mvm *mvm,
-		       struct ieee80211_vif *vif,
-		       struct ieee80211_sta *sta)
-{
-	return iwl_mvm_sta_send_to_fw(mvm, sta, true, 0);
-}
-
 int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
 		      bool drain)
 {
drivers/net/wireless/intel/iwlwifi/mvm/sta.h +8 -3
index 709542b..e068d53 100644
@@ -473,9 +473,14 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
 int iwl_mvm_add_sta(struct iwl_mvm *mvm,
 		    struct ieee80211_vif *vif,
 		    struct ieee80211_sta *sta);
-int iwl_mvm_update_sta(struct iwl_mvm *mvm,
-		       struct ieee80211_vif *vif,
-		       struct ieee80211_sta *sta);
+
+static inline int iwl_mvm_update_sta(struct iwl_mvm *mvm,
+				     struct ieee80211_vif *vif,
+				     struct ieee80211_sta *sta)
+{
+	return iwl_mvm_sta_send_to_fw(mvm, sta, true, 0);
+}
+
 int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
 		   struct ieee80211_vif *vif,
 		   struct ieee80211_sta *sta);
Signature · 1 line
2.9.3
#18 lore raw

PATCH 15/25 iwlwifi: mvm: document passing unexpected Block Ack Request frames

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

When we get an unexpected Block Ack Request frame, the BAID from the hardware will be invalid, and we'll pass it to mac80211 for further handling (sending a delBA action frame.)

Add a comment explaining that, in case anyone looks in the future.

---
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +5 -0
index 0274f14..a57c6ef 100644
@@ -591,6 +591,11 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 	baid = (reorder & IWL_RX_MPDU_REORDER_BAID_MASK) >>
 		IWL_RX_MPDU_REORDER_BAID_SHIFT;
 
+	/*
+	 * This also covers the case of receiving a Block Ack Request
+	 * outside a BA session; we'll pass it to mac80211 and that
+	 * then sends a delBA action frame.
+	 */
 	if (baid == IWL_RX_REORDER_DATA_INVALID_BAID)
 		return false;
 
Signature · 1 line
2.9.3
#17 lore raw

PATCH 14/25 iwlwifi: move to wide ID for all commands

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

Due to firmware design considerations, move to wide ID for all commands.

---
 drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c | 8 ++++++--
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c      | 3 +++
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h      | 5 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c        | 4 ++--
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h  | 2 --
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c     | 1 -
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c        | 2 +-
 7 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c +6 -2
index 8aa1f2b..88f260d 100644
@@ -99,8 +99,12 @@ void iwl_notification_wait_notify(struct iwl_notif_wait_data *notif_wait,
 				continue;
 
 			for (i = 0; i < w->n_cmds; i++) {
-				if (w->cmds[i] ==
-				    WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd)) {
+				u16 rec_id = WIDE_ID(pkt->hdr.group_id,
+						     pkt->hdr.cmd);
+
+				if (w->cmds[i] == rec_id ||
+				    (!iwl_cmd_groupid(w->cmds[i]) &&
+				     DEF_ID(w->cmds[i]) == rec_id)) {
 					found = true;
 					break;
 				}
drivers/net/wireless/intel/iwlwifi/iwl-trans.c +3 -0
index b0bd67c..b42152c 100644
@@ -140,6 +140,9 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
 	if (!(cmd->flags & CMD_ASYNC))
 		lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
 
+	if (trans->wide_cmd_header && !iwl_cmd_groupid(cmd->id))
+		cmd->id = DEF_ID(cmd->id);
+
 	ret = trans->ops->send_cmd(trans, cmd);
 
 	if (!(cmd->flags & CMD_ASYNC))
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +3 -2
index 04e998d..0296124 100644
@@ -153,6 +153,7 @@ static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version)
 
 /* make u16 wide id out of u8 group and opcode */
 #define WIDE_ID(grp, opcode) ((grp << 8) | opcode)
+#define DEF_ID(opcode) ((1 << 8) | (opcode))
 
 /* due to the conversion, this group is special; new groups
  * should be defined in the appropriate fw-api header files
@@ -484,7 +485,6 @@ struct iwl_hcmd_arr {
  * @bc_table_dword: set to true if the BC table expects the byte count to be
  *	in DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
- * @wide_cmd_header: firmware supports wide host command header
  * @sw_csum_tx: transport should compute the TCP checksum
  * @command_groups: array of command groups, each member is an array of the
  *	commands in the group; for debugging only
@@ -506,7 +506,6 @@ struct iwl_trans_config {
 	enum iwl_amsdu_size rx_buf_size;
 	bool bc_table_dword;
 	bool scd_set_active;
-	bool wide_cmd_header;
 	bool sw_csum_tx;
 	const struct iwl_hcmd_arr *command_groups;
 	int command_groups_size;
@@ -770,6 +769,7 @@ enum iwl_plat_pm_mode {
  * @hw_id_str: a string with info about HW ID. Set during transport allocation.
  * @pm_support: set to true in start_hw if link pm is supported
  * @ltr_enabled: set to true if the LTR is enabled
+ * @wide_cmd_header: true when ucode supports wide command header format
  * @num_rx_queues: number of RX queues allocated by the transport;
  *	the transport must set this before calling iwl_drv_start()
  * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
@@ -821,6 +821,7 @@ struct iwl_trans {
 
 	const struct iwl_hcmd_arr *command_groups;
 	int command_groups_size;
+	bool wide_cmd_header;
 
 	u8 num_rx_queues;
 
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +2 -2
index de34c9f..b2d8722 100644
@@ -652,8 +652,8 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 	/* the hardware splits the A-MSDU */
 	if (mvm->cfg->mq_rx_supported)
 		trans_cfg.rx_buf_size = IWL_AMSDU_4K;
-	trans_cfg.wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa,
-					       IWL_UCODE_TLV_API_WIDE_CMD_HDR);
+	trans->wide_cmd_header = fw_has_api(&mvm->fw->ucode_capa,
+					    IWL_UCODE_TLV_API_WIDE_CMD_HDR);
 
 	if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_DW_BC_TABLE)
 		trans_cfg.bc_table_dword = true;
drivers/net/wireless/intel/iwlwifi/pcie/internal.h +0 -2
index 987a077..2d81630 100644
@@ -332,7 +332,6 @@ enum iwl_shared_irq_flags {
  * @rx_buf_size: Rx buffer size
  * @bc_table_dword: true if the BC table expects DWORD (as opposed to bytes)
  * @scd_set_active: should the transport configure the SCD for HCMD queue
- * @wide_cmd_header: true when ucode supports wide command header format
  * @sw_csum_tx: if true, then the transport will compute the csum of the TXed
  *	frame.
  * @rx_page_order: page order for receive buffer size
@@ -405,7 +404,6 @@ struct iwl_trans_pcie {
 	enum iwl_amsdu_size rx_buf_size;
 	bool bc_table_dword;
 	bool scd_set_active;
-	bool wide_cmd_header;
 	bool sw_csum_tx;
 	u32 rx_page_order;
 
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +0 -1
index 74199b1..68fa843 100644
@@ -1755,7 +1755,6 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
 	trans_pcie->rx_page_order =
 		iwl_trans_get_rb_size_order(trans_pcie->rx_buf_size);
 
-	trans_pcie->wide_cmd_header = trans_cfg->wide_cmd_header;
 	trans_pcie->bc_table_dword = trans_cfg->bc_table_dword;
 	trans_pcie->scd_set_active = trans_cfg->scd_set_active;
 	trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx;
drivers/net/wireless/intel/iwlwifi/pcie/tx.c +1 -1
index 0d156fd..e00e7d8 100644
@@ -1493,7 +1493,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
 	const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD];
 	u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD];
 
-	if (WARN(!trans_pcie->wide_cmd_header &&
+	if (WARN(!trans->wide_cmd_header &&
 		 group_id > IWL_ALWAYS_LONG_GROUP,
 		 "unsupported wide command %#x\n", cmd->id))
 		return -EINVAL;
Signature · 1 line
2.9.3
#14 lore raw

PATCH 11/25 iwlwifi: move BIOS MCC retrieval to common code

In reply to Luca Coelho

From: Arik Nemtsov <[email protected]>

This will be used by more than MVM, so move it to iwlwifi

While at it, rename WRD_METHOD to the more appropriate WRDD_METHOD and add some documentation.

---
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 89 +++++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h | 20 ++++-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c       | 93 +---------------------
 3 files changed, 109 insertions(+), 93 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +89 -0
index adba3b0..3bd6fc1 100644
@@ -67,6 +67,7 @@
 #include <linux/export.h>
 #include <linux/etherdevice.h>
 #include <linux/pci.h>
+#include <linux/acpi.h>
 #include "iwl-drv.h"
 #include "iwl-modparams.h"
 #include "iwl-nvm-parse.h"
@@ -904,3 +905,91 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
 	return regd;
 }
 IWL_EXPORT_SYMBOL(iwl_parse_nvm_mcc_info);
+
+#ifdef CONFIG_ACPI
+#define WRDD_METHOD		"WRDD"
+#define WRDD_WIFI		(0x07)
+#define WRDD_WIGIG		(0x10)
+
+static u32 iwl_wrdd_get_mcc(struct device *dev, union acpi_object *wrdd)
+{
+	union acpi_object *mcc_pkg, *domain_type, *mcc_value;
+	u32 i;
+
+	if (wrdd->type != ACPI_TYPE_PACKAGE ||
+	    wrdd->package.count < 2 ||
+	    wrdd->package.elements[0].type != ACPI_TYPE_INTEGER ||
+	    wrdd->package.elements[0].integer.value != 0) {
+		IWL_DEBUG_EEPROM(dev, "Unsupported wrdd structure\n");
+		return 0;
+	}
+
+	for (i = 1 ; i < wrdd->package.count ; ++i) {
+		mcc_pkg = &wrdd->package.elements[i];
+
+		if (mcc_pkg->type != ACPI_TYPE_PACKAGE ||
+		    mcc_pkg->package.count < 2 ||
+		    mcc_pkg->package.elements[0].type != ACPI_TYPE_INTEGER ||
+		    mcc_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
+			mcc_pkg = NULL;
+			continue;
+		}
+
+		domain_type = &mcc_pkg->package.elements[0];
+		if (domain_type->integer.value == WRDD_WIFI)
+			break;
+
+		mcc_pkg = NULL;
+	}
+
+	if (mcc_pkg) {
+		mcc_value = &mcc_pkg->package.elements[1];
+		return mcc_value->integer.value;
+	}
+
+	return 0;
+}
+
+int iwl_get_bios_mcc(struct device *dev, char *mcc)
+{
+	acpi_handle root_handle;
+	acpi_handle handle;
+	struct acpi_buffer wrdd = {ACPI_ALLOCATE_BUFFER, NULL};
+	acpi_status status;
+	u32 mcc_val;
+
+	root_handle = ACPI_HANDLE(dev);
+	if (!root_handle) {
+		IWL_DEBUG_EEPROM(dev,
+				 "Could not retrieve root port ACPI handle\n");
+		return -ENOENT;
+	}
+
+	/* Get the method's handle */
+	status = acpi_get_handle(root_handle, (acpi_string)WRDD_METHOD,
+				 &handle);
+	if (ACPI_FAILURE(status)) {
+		IWL_DEBUG_EEPROM(dev, "WRD method not found\n");
+		return -ENOENT;
+	}
+
+	/* Call WRDD with no arguments */
+	status = acpi_evaluate_object(handle, NULL, NULL, &wrdd);
+	if (ACPI_FAILURE(status)) {
+		IWL_DEBUG_EEPROM(dev, "WRDC invocation failed (0x%x)\n",
+				 status);
+		return -ENOENT;
+	}
+
+	mcc_val = iwl_wrdd_get_mcc(dev, wrdd.pointer);
+	kfree(wrdd.pointer);
+	if (!mcc_val)
+		return -ENOENT;
+
+	mcc[0] = (mcc_val >> 8) & 0xff;
+	mcc[1] = mcc_val & 0xff;
+	mcc[2] = '\0';
+	return 0;
+}
+IWL_EXPORT_SYMBOL(iwl_get_bios_mcc);
+#endif
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +19 -1
index d704d52..7249e5b 100644
@@ -5,7 +5,8 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2015 Intel Corporation. All rights reserved.
+ * Copyright(c) 2016        Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -93,4 +94,21 @@ struct ieee80211_regdomain *
 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
 		       int num_of_ch, __le32 *channels, u16 fw_mcc);
 
+#ifdef CONFIG_ACPI
+/**
+ * iwl_get_bios_mcc - read MCC from BIOS, if available
+ *
+ * @dev: the struct device
+ * @mcc: output buffer (3 bytes) that will get the MCC
+ *
+ * This function tries to read the current MCC from ACPI if available.
+ */
+int iwl_get_bios_mcc(struct device *dev, char *mcc);
+#else
+static inline int iwl_get_bios_mcc(struct device *dev, char *mcc)
+{
+	return -ENOENT;
+}
+#endif
+
 #endif /* __iwl_nvm_parse_h__ */
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +1 -92

111 lines not on this page · raw message

Signature · 1 line
2.9.3
#20 lore raw

PATCH 17/25 iwlwifi: mvm: disable P2P queue on mac context release

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

AP queue is properly released, but P2P queue isn't.

Fixes commit 4c965139a3cd ("iwlwifi: mvm: support p2p device frames tx on dqa queue #2")
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +5 -0
index 69c42ce..d742d27 100644
@@ -539,6 +539,11 @@ void iwl_mvm_mac_ctxt_release(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 			iwl_mvm_disable_txq(mvm, IWL_MVM_OFFCHANNEL_QUEUE,
 					    IWL_MVM_OFFCHANNEL_QUEUE,
 					    IWL_MAX_TID_COUNT, 0);
+		else
+			iwl_mvm_disable_txq(mvm,
+					    IWL_MVM_DQA_P2P_DEVICE_QUEUE,
+					    vif->hw_queue[0], IWL_MAX_TID_COUNT,
+					    0);
 
 		break;
 	case NL80211_IFTYPE_AP:
Signature · 1 line
2.9.3
#25 lore raw

PATCH 22/25 iwlwifi: mvm: Add mem debugfs entry

In reply to Luca Coelho

From: Ido Yariv <[email protected]>

In order to access cached/paged memory, there are a couple of firmware commands (one for UMAC and one for LMAC) that let the host access memory and registers indirectly. Since this is done by the firmware on behalf of the host, even if memory is paged out or cached, the host will retrieve the memory as the firmware sees it (paged out memory will get paged in).

Export this mechanism via a debugfs entry for both read and write access.

WARNING: This mechanism has no protections at all. Invalid addresses may crash or hang the firmware. Writing to arbitrary memory also comes with no guarantees.

---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 129 +++++++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h  |  50 +++++++++
 2 files changed, 179 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +129 -0
index 540b7c9..539d718 100644
@@ -1518,6 +1518,132 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram, 8);
 #endif
 
+static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
+				  size_t count, loff_t *ppos)
+{
+	struct iwl_mvm *mvm = file->private_data;
+	struct iwl_dbg_mem_access_cmd cmd = {};
+	struct iwl_dbg_mem_access_rsp *rsp;
+	struct iwl_host_cmd hcmd = {
+		.flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
+		.data = { &cmd, },
+		.len = { sizeof(cmd) },
+	};
+	size_t delta, len;
+	ssize_t ret;
+
+	hcmd.id = iwl_cmd_id(*ppos >> 24 ? UMAC_RD_WR : LMAC_RD_WR,
+			     DEBUG_GROUP, 0);
+	cmd.op = cpu_to_le32(DEBUG_MEM_OP_READ);
+
+	/* Take care of alignment of both the position and the length */
+	delta = *ppos & 0x3;
+	cmd.addr = cpu_to_le32(*ppos - delta);
+	cmd.len = cpu_to_le32(min(ALIGN(count + delta, 4) / 4,
+				  (size_t)DEBUG_MEM_MAX_SIZE_DWORDS));
+
+	mutex_lock(&mvm->mutex);
+	ret = iwl_mvm_send_cmd(mvm, &hcmd);
+	mutex_unlock(&mvm->mutex);
+
+	if (ret < 0)
+		return ret;
+
+	rsp = (void *)hcmd.resp_pkt->data;
+	if (le32_to_cpu(rsp->status) != DEBUG_MEM_STATUS_SUCCESS) {
+		ret = -ENXIO;
+		goto out;
+	}
+
+	len = min((size_t)le32_to_cpu(rsp->len) << 2,
+		  iwl_rx_packet_payload_len(hcmd.resp_pkt) - sizeof(*rsp));
+	len = min(len - delta, count);
+	if (len < 0) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	ret = len - copy_to_user(user_buf, (void *)rsp->data + delta, len);
+	*ppos += ret;
+
+out:
+	iwl_free_resp(&hcmd);
+	return ret;
+}
+
+static ssize_t iwl_dbgfs_mem_write(struct file *file,
+				   const char __user *user_buf, size_t count,
+				   loff_t *ppos)
+{
+	struct iwl_mvm *mvm = file->private_data;
+	struct iwl_dbg_mem_access_cmd *cmd;
+	struct iwl_dbg_mem_access_rsp *rsp;
+	struct iwl_host_cmd hcmd = {};
+	size_t cmd_size;
+	size_t data_size;
+	u32 op, len;
+	ssize_t ret;
+
+	hcmd.id = iwl_cmd_id(*ppos >> 24 ? UMAC_RD_WR : LMAC_RD_WR,
+			     DEBUG_GROUP, 0);
+
+	if (*ppos & 0x3 || count < 4) {
+		op = DEBUG_MEM_OP_WRITE_BYTES;
+		len = min(count, (size_t)(4 - (*ppos & 0x3)));
+		data_size = len;
+	} else {
+		op = DEBUG_MEM_OP_WRITE;
+		len = min(count >> 2, (size_t)DEBUG_MEM_MAX_SIZE_DWORDS);
+		data_size = len << 2;
+	}
+
+	cmd_size = sizeof(*cmd) + ALIGN(data_size, 4);
+	cmd = kzalloc(cmd_size, GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->op = cpu_to_le32(op);
+	cmd->len = cpu_to_le32(len);
+	cmd->addr = cpu_to_le32(*ppos);
+	if (copy_from_user((void *)cmd->data, user_buf, data_size)) {
+		kfree(cmd);
+		return -EFAULT;
+	}
+
+	hcmd.flags = CMD_WANT_SKB | CMD_SEND_IN_RFKILL,
+	hcmd.data[0] = (void *)cmd;
+	hcmd.len[0] = cmd_size;
+
+	mutex_lock(&mvm->mutex);
+	ret = iwl_mvm_send_cmd(mvm, &hcmd);
+	mutex_unlock(&mvm->mutex);
+
+	kfree(cmd);
+
+	if (ret < 0)
+		return ret;
+
+	rsp = (void *)hcmd.resp_pkt->data;
+	if (rsp->status != DEBUG_MEM_STATUS_SUCCESS) {
+		ret = -ENXIO;
+		goto out;
+	}
+
+	ret = data_size;
+	*ppos += ret;
+
+out:
+	iwl_free_resp(&hcmd);
+	return ret;
+}
+
+static const struct file_operations iwl_dbgfs_mem_ops = {
+	.read = iwl_dbgfs_mem_read,
+	.write = iwl_dbgfs_mem_write,
+	.open = simple_open,
+	.llseek = default_llseek,
+};
+
 int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
 {
 	struct dentry *bcast_dir __maybe_unused;
@@ -1615,6 +1741,9 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
 				 mvm->debugfs_dir, &mvm->nvm_phy_sku_blob))
 		goto err;
 
+	debugfs_create_file("mem", S_IRUSR | S_IWUSR, dbgfs_dir, mvm,
+			    &iwl_dbgfs_mem_ops);
+
 	/*
 	 * Create a symlink with mac80211. It will be removed when mac80211
 	 * exists (before the opmode exists which removes the target.)
drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h +50 -0

66 lines not on this page · raw message

Signature · 1 line
2.9.3
#21 lore raw

PATCH 18/25 iwlwifi: migrate to devm_* API

In reply to Luca Coelho

From: Sharon Dvir <[email protected]>

Change PCIE and trans resource allocations to managed resources.

---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c  |  8 +--
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 81 ++++++++++---------------
 2 files changed, 34 insertions(+), 55 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.c +2 -6
index b42152c..d42cab2 100644
@@ -78,7 +78,7 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
 	static struct lock_class_key __key;
 #endif
 
-	trans = kzalloc(sizeof(*trans) + priv_size, GFP_KERNEL);
+	trans = devm_kzalloc(dev, sizeof(*trans) + priv_size, GFP_KERNEL);
 	if (!trans)
 		return NULL;
 
@@ -103,18 +103,14 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
 				  SLAB_HWCACHE_ALIGN,
 				  NULL);
 	if (!trans->dev_cmd_pool)
-		goto free;
+		return NULL;
 
 	return trans;
- free:
-	kfree(trans);
-	return NULL;
 }
 
 void iwl_trans_free(struct iwl_trans *trans)
 {
 	kmem_cache_destroy(trans->dev_cmd_pool);
-	kfree(trans);
 }
 
 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +32 -49

156 lines not on this page · raw message

Signature · 1 line
2.9.3
#24 lore raw

PATCH 21/25 iwlwifi: mvm: move AP-specific code to right function

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

There's no need for the common MAC context function to have an if on AP mode, the values can be overridden in the AP-specific function later. Clean that up by adding the full command as a new parameter to the AP-specific function, and doing it there.

---
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 42 +++++++++++------------
 1 file changed, 20 insertions(+), 22 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +20 -22
index d742d27..6b962d6 100644
@@ -774,26 +774,6 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 		cmd->ac[txf].fifos_mask = BIT(txf);
 	}
 
-	if (vif->type == NL80211_IFTYPE_AP) {
-		/* in AP mode, the MCAST FIFO takes the EDCA params from VO */
-		cmd->ac[IWL_MVM_TX_FIFO_VO].fifos_mask |=
-			BIT(IWL_MVM_TX_FIFO_MCAST);
-
-		/*
-		 * in AP mode, pass probe requests and beacons from other APs
-		 * (needed for ht protection); when there're no any associated
-		 * station don't ask FW to pass beacons to prevent unnecessary
-		 * wake-ups.
-		 */
-		cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
-		if (mvmvif->ap_assoc_sta_count || !mvm->drop_bcn_ap_mode) {
-			cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
-			IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n");
-		} else {
-			IWL_DEBUG_HC(mvm, "No need to receive beacons\n");
-		}
-	}
-
 	if (vif->bss_conf.qos)
 		cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
 
@@ -1191,6 +1171,7 @@ static void iwl_mvm_mac_ap_iterator(void *_data, u8 *mac,
  */
 static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
 					 struct ieee80211_vif *vif,
+					 struct iwl_mac_ctx_cmd *cmd,
 					 struct iwl_mac_data_ap *ctxt_ap,
 					 bool add)
 {
@@ -1201,6 +1182,23 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
 		.beacon_device_ts = 0
 	};
 
+	/* in AP mode, the MCAST FIFO takes the EDCA params from VO */
+	cmd->ac[IWL_MVM_TX_FIFO_VO].fifos_mask |= BIT(IWL_MVM_TX_FIFO_MCAST);
+
+	/*
+	 * in AP mode, pass probe requests and beacons from other APs
+	 * (needed for ht protection); when there're no any associated
+	 * station don't ask FW to pass beacons to prevent unnecessary
+	 * wake-ups.
+	 */
+	cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
+	if (mvmvif->ap_assoc_sta_count || !mvm->drop_bcn_ap_mode) {
+		cmd->filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
+		IWL_DEBUG_HC(mvm, "Asking FW to pass beacons\n");
+	} else {
+		IWL_DEBUG_HC(mvm, "No need to receive beacons\n");
+	}
+
 	ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int);
 	ctxt_ap->bi_reciprocal =
 		cpu_to_le32(iwl_mvm_reciprocal(vif->bss_conf.beacon_int));
@@ -1258,7 +1256,7 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
 	iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
 
 	/* Fill the data specific for ap mode */
-	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap,
+	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.ap,
 				     action == FW_CTXT_ACTION_ADD);
 
 	return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
@@ -1277,7 +1275,7 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
 	iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
 
 	/* Fill the data specific for GO mode */
-	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap,
+	iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd, &cmd.go.ap,
 				     action == FW_CTXT_ACTION_ADD);
 
 	cmd.go.ctwin = cpu_to_le32(noa->oppps_ctwindow &
Signature · 1 line
2.9.3
#28 lore raw

PATCH 25/25 iwlwifi: pcie: use LIST_HEAD() macro

In reply to Luca Coelho

From: Johannes Berg <[email protected]>

There's no need to declare a list and then init it manually, just use the LIST_HEAD() macro.

---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +1 -3
index 78cb6d2..6fe5546 100644
@@ -487,15 +487,13 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
 
 	while (pending) {
 		int i;
-		struct list_head local_allocated;
+		LIST_HEAD(local_allocated);
 		gfp_t gfp_mask = GFP_KERNEL;
 
 		/* Do not post a warning if there are only a few requests */
 		if (pending < RX_PENDING_WATERMARK)
 			gfp_mask |= __GFP_NOWARN;
 
-		INIT_LIST_HEAD(&local_allocated);
-
 		for (i = 0; i < RX_CLAIM_REQ_ALLOC;) {
 			struct iwl_rx_mem_buffer *rxb;
 			struct page *page;
Signature · 1 line
2.9.3
#26 lore raw

PATCH 23/25 iwlwifi: mvm: set HCMD_NAME for PHY_DB as well

In reply to Luca Coelho

From: Sara Sharon <[email protected]>

Currently it is logged as UNKNOWN.
Also, 0x6c seems to be the permanent ID for this command, remove incorrect comment and uncomment the command from the commands list.

---
 drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c    | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c +1 -1
index 7beba9a..2893826 100644
@@ -110,7 +110,7 @@ enum iwl_phy_db_section_type {
 	IWL_PHY_DB_MAX
 };
 
-#define PHY_DB_CMD 0x6c /* TEMP API - The actual is 0x8c */
+#define PHY_DB_CMD 0x6c
 
 /*
  * phy db - configure operational ucode
drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h +1 -1
index fdd9506..9763369 100644
@@ -205,7 +205,7 @@ enum {
 	/* Phy */
 	PHY_CONFIGURATION_CMD = 0x6a,
 	CALIB_RES_NOTIF_PHY_DB = 0x6b,
-	/* PHY_DB_CMD = 0x6c, */
+	PHY_DB_CMD = 0x6c,
 
 	/* ToF - 802.11mc FTM */
 	TOF_CMD = 0x10,
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +1 -0
index b2d8722..3eccd89 100644
@@ -359,6 +359,7 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = {
 	HCMD_NAME(BT_COEX_CI),
 	HCMD_NAME(PHY_CONFIGURATION_CMD),
 	HCMD_NAME(CALIB_RES_NOTIF_PHY_DB),
+	HCMD_NAME(PHY_DB_CMD),
 	HCMD_NAME(SCAN_OFFLOAD_COMPLETE),
 	HCMD_NAME(SCAN_OFFLOAD_UPDATE_PROFILES_CMD),
 	HCMD_NAME(SCAN_OFFLOAD_CONFIG_CMD),
Signature · 1 line
2.9.3
#29 lore raw

pull-request: iwlwifi-next 2016-09-19-2

In reply to Luca Coelho

Hi Kalle,

Please drop my previous pull-request.  There was a compilation error that I missed to due a missing flag in my .config.  I fixed it now and this is the new pull request that includes the fix.

Here we go again, now I'm almost catching up with the pending stuff in our internal tree, just in time for 4.9.  This pull contains a bunch of fixes to DQA and new HW support code, a few new features and some cleanups.  More details in the tag description.

Let me know if everything's fine (or not). :)

Luca.

The following changes since commit 80ba4f1d365af206b9e818d17d22fed02fe5def0:

mwifiex: fix null pointer deference when adapter is null (2016-09-17 18:26:32 +0300)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2016-09-19-2

for you to fetch changes up to 0979a913f879ea39504200d83fb9f275a555a58d:

iwlwifi: pcie: use LIST_HEAD() macro (2016-09-19 11:29:35 +0300)

----------------------------------------------------------------
* added support for MU-MIMO sniffer
* added support for RRM by scan
* added support for packet injection
* migrate to devm memory allocation handling
* some fixes, mostly in DQA and new HW support
* other generic cleanups

----------------------------------------------------------------
Arik Nemtsov (1):
iwlwifi: move BIOS MCC retrieval to common code

Aviya Erenfeld (1):
iwlwifi: mvm: add support for MU-MIMO air sniffer

Avrahams Stern (1):
iwlwifi: mvm: Add support for RRM by scan

Emmanuel Grumbach (1):
iwlwifi: don't export trace points that are used in iwlwifi only

Haim Dreyfuss (1):
iwlwifi: check for valid ethernet address provided by OEM

Ido Yariv (1):
iwlwifi: mvm: Add mem debugfs entry

Johannes Berg (6):
iwlwifi: mvm: compare full command ID
iwlwifi: mvm: make iwl_mvm_update_sta() an inline
iwlwifi: mvm: document passing unexpected Block Ack Request frames
iwlwifi: mvm: move AP-specific code to right function
iwlwifi: mvm: use LIST_HEAD() macro
iwlwifi: pcie: use LIST_HEAD() macro

Liad Kaufman (1):
iwlwifi: mvm: remove variable shadowing

Oren Givon (1):
iwlwifi: add new 8265 series PCI ID

Roee Zamir (1):
iwlwifi: mvm: Add debugfs function for clocks diff

Sara Sharon (9):
iwlwifi: pcie: fix typo in struct name for a000 devices
iwlwifi: mvm: cleanup skb queue functions use
iwlwifi: mvm: fix DQA AP mode station assumption
iwlwifi: mvm: support BAR in reorder buffer
iwlwifi: mvm: support packet injection
iwlwifi: pcie: log full command sequence
iwlwifi: move to wide ID for all commands
iwlwifi: mvm: disable P2P queue on mac context release
iwlwifi: mvm: set HCMD_NAME for PHY_DB as well

Sharon Dvir (1):
iwlwifi: migrate to devm_* API

 drivers/net/wireless/intel/iwlwifi/iwl-devtrace.c    |   3 --
 drivers/net/wireless/intel/iwlwifi/iwl-fw-file.h     |   5 ++
 drivers/net/wireless/intel/iwlwifi/iwl-notif-wait.c  |   8 +++-
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c   | 104 ++++++++++++++++++++++++++++++++++++++++--
 drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h   |  20 +++++++-
 drivers/net/wireless/intel/iwlwifi/iwl-phy-db.c      |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c       |  11 ++---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h       |   5 +-
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c |  26 +++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c     | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-scan.h |  20 ++++----
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h      |  52 ++++++++++++++++++++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c    |  47 ++++++++++---------
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c    |  18 ++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h         |   7 +++
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c         |  93 +------------------------------------
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c         |  32 +++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c        |  30 ++++++++----
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c        |  61 ++++++++++++++++++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c         |  13 ++----
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h         |  11 +++--
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c          |  35 +++++++++++---
 drivers/net/wireless/intel/iwlwifi/mvm/utils.c       |  22 +++++++++
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c        |   1 +
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h   |   2 -
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c         |   9 ++--
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c      |  84 ++++++++++++++--------------------
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c         |   2 +-
 28 files changed, 655 insertions(+), 252 deletions(-)
#11 lore raw

Re: [PATCH 10/25] iwlwifi: mvm: support packet injection

In reply to Luca Coelho
Quoted 7 lines · Luca Coelho

From: Sara Sharon <[email protected]>

For automatic testing packet injection can be useful. Support injection through debugfs.

The commit log doesn't tell a lot. I started to wonder why use debugfs and not the proper interface through mac80211?

Quoted 42 lines
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +36 -0
@@ -917,6 +917,59 @@ static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm,
 	return ret ?: count;
 }
 
+static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
+					     char *buf, size_t count,
+					     loff_t *ppos)
+{
+	struct iwl_rx_cmd_buffer rxb = {
+		._rx_page_order = 0,
+		.truesize = 0, /* not used */
+		._offset = 0,
+	};
+	struct iwl_rx_packet *pkt;
+	struct iwl_rx_mpdu_desc *desc;
+	int bin_len = count / 2;
+	int ret = -EINVAL;
+
+	/* supporting only 9000 descriptor */
+	if (!mvm->trans->cfg->mq_rx_supported)
+		return -ENOTSUPP;
+
+	rxb._page = alloc_pages(GFP_ATOMIC, 0);
+	if (!rxb._page)
+		return -ENOMEM;
+	pkt = rxb_addr(&rxb);
+
+	ret = hex2bin(page_address(rxb._page), buf, bin_len);
+	if (ret)
+		goto out;
+
+	/* avoid invalid memory access */
+	if (bin_len < sizeof(*pkt) + sizeof(*desc))
+		goto out;
+
+	/* check this is RX packet */
+	if (WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd) !=
+	    WIDE_ID(LEGACY_GROUP, REPLY_RX_MPDU_CMD))
+		goto out;
+

drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c static ssize_t iwl_dbgfs_indirection_tbl_write(struct iwl_mvm *mvm, · line 965

Quoted 10 lines
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +10 -0
+	/* check the length in metadata matches actual received length */
+	desc = (void *)pkt->data;
+	if (le16_to_cpu(desc->mpdu_len) !=
+	    (bin_len - sizeof(*desc) - sizeof(*pkt)))
+		goto out;
+
+	local_bh_disable();
+	iwl_mvm_rx_mpdu_mq(mvm, NULL, &rxb, 0);
+	local_bh_enable();
+	ret = 0;

But reading from the code makes me suspect that this isn't really normal packet injection, more like passing full descriptors to the hw. Did I understand correctly?

Signature · 1 line
Kalle Valo
#12 lore raw

RE: [PATCH 10/25] iwlwifi: mvm: support packet injection

Quoted 1 line

The commit log doesn't tell a lot. I started to wonder why use debugfs and not the proper interface through mac80211?

This is RX packet injection, not TX. So the injection goes up - from the driver to mac80211. Since we use it to test some mvm data path stuff, we don't want to inject at mac80211 level.

Quoted 1 line

But reading from the code makes me suspect that this isn't really normal packet injection, more like passing full descriptors to the hw. Did I understand correctly?

For injecting at driver level we need the injected packet to contain a fake of the HW descriptor for the driver processing. This descriptor isn't being passed to the hw, but to the driver since it is RX.
The code isn't creating the descriptor, but it is validating length and other checks to make sure we won't access invalid memory or so.

Sara
---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#13 lore raw

Re: [PATCH 10/25] iwlwifi: mvm: support packet injection

Quoted 11 lines · Sara
Quoted 2 lines

The commit log doesn't tell a lot. I started to wonder why use debugfs and not the proper interface through mac80211?

This is RX packet injection, not TX. So the injection goes up - from the driver to mac80211. Since we use it to test some mvm data path stuff, we don't want to inject at mac80211 level.

Quoted 3 lines

But reading from the code makes me suspect that this isn't really normal packet injection, more like passing full descriptors to the hw. Did I understand correctly?

Quoted 5 lines

For injecting at driver level we need the injected packet to contain a fake of the HW descriptor for the driver processing. This descriptor isn't being passed to the hw, but to the driver since it is RX. The code isn't creating the descriptor, but it is validating length and other checks to make sure we won't access invalid memory or so.

Ah, makes sense. No need to resend this, but in the future please try to explain higher level design like this in the commit log. That avoids a lot of guessing (wrong) for me and others.

Signature · 1 line
Kalle Valo
#30 lore raw

Re: pull-request: iwlwifi-next 2016-09-19-2

In reply to Luca Coelho
Quoted 2 lines · Luca Coelho

Please drop my previous pull-request. =C2=A0There was a compilation error that I missed to due a missing flag in my .config. =C2=A0I fixed it now a=

nd

Quoted 4 lines

this is the new pull request that includes the fix.

Here we go again, now I'm almost catching up with the pending stuff in our internal tree, just in time for 4.9.=C2=A0=C2=A0This pull contains a =

bunch of

Quoted 9 lines

fixes to DQA and new HW support code, a few new features and some cleanups.=C2=A0=C2=A0More details in the tag description.

Let me know if everything's fine (or not). :)

Luca.

The following changes since commit 80ba4f1d365af206b9e818d17d22fed02fe5de=

f0:

Quoted 2 lines

mwifiex: fix null pointer deference when adapter is null (2016-09-17 18=

:26:32 +0300)

Quoted 4 lines

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git =

tags/iwlwifi-next-for-kalle-2016-09-19-2

Pulled, thanks.

--=20
Kalle Valo