Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 13/13] ath10k: handle FW API differences for scan structures
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

The wmi_start_scan_cmd has an extra filed in our main
firmware track, reflact that to not have a mismatch in
case of 10.x track.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   19 ++++++--
 drivers/net/wireless/ath/ath10k/wmi.h |   82 +++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 2a55bc8..d4ba78546 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2377,11 +2377,15 @@ out:
 	return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->wmi_init_cmdid);
 }
 
-static int ath10k_wmi_start_scan_calc_len(const struct wmi_start_scan_arg *arg)
+static int ath10k_wmi_start_scan_calc_len(struct ath10k *ar,
+					  const struct wmi_start_scan_arg *arg)
 {
 	int len;
 
-	len = sizeof(struct wmi_start_scan_cmd);
+	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features))
+		len = sizeof(struct wmi_start_scan_cmd_10x);
+	else
+		len = sizeof(struct wmi_start_scan_cmd);
 
 	if (arg->ie_len) {
 		if (!arg->ie)
@@ -2441,7 +2445,7 @@ int ath10k_wmi_start_scan(struct ath10k *ar,
 	int len = 0;
 	int i;
 
-	len = ath10k_wmi_start_scan_calc_len(arg);
+	len = ath10k_wmi_start_scan_calc_len(ar, arg);
 	if (len < 0)
 		return len; /* len contains error code here */
 
@@ -2473,7 +2477,14 @@ int ath10k_wmi_start_scan(struct ath10k *ar,
 	cmd->scan_ctrl_flags    = __cpu_to_le32(arg->scan_ctrl_flags);
 
 	/* TLV list starts after fields included in the struct */
-	off = sizeof(*cmd);
+	/* There's just one filed that differes the two start_scan
+	 * structures - burst_duration, which we are not using btw,
+	   no point to make the split here, just shift the buffer to fit with
+	   given FW */
+	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features))
+		off = sizeof(struct wmi_start_scan_cmd_10x);
+	else
+		off = sizeof(struct wmi_start_scan_cmd);
 
 	if (arg->n_channels) {
 		channels = (void *)skb->data + off;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index fcada27..75b9978 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1715,6 +1715,88 @@ struct wmi_start_scan_cmd {
 	 */
 } __packed;
 
+/* This is the definition from 10.X firmware branch */
+struct wmi_start_scan_cmd_10x {
+	/* Scan ID */
+	__le32 scan_id;
+
+	/* Scan requestor ID */
+	__le32 scan_req_id;
+
+	/* VDEV id(interface) that is requesting scan */
+	__le32 vdev_id;
+
+	/* Scan Priority, input to scan scheduler */
+	__le32 scan_priority;
+
+	/* Scan events subscription */
+	__le32 notify_scan_events;
+
+	/* dwell time in msec on active channels */
+	__le32 dwell_time_active;
+
+	/* dwell time in msec on passive channels */
+	__le32 dwell_time_passive;
+
+	/*
+	 * min time in msec on the BSS channel,only valid if atleast one
+	 * VDEV is active
+	 */
+	__le32 min_rest_time;
+
+	/*
+	 * max rest time in msec on the BSS channel,only valid if at least
+	 * one VDEV is active
+	 */
+	/*
+	 * the scanner will rest on the bss channel at least min_rest_time
+	 * after min_rest_time the scanner will start checking for tx/rx
+	 * activity on all VDEVs. if there is no activity the scanner will
+	 * switch to off channel. if there is activity the scanner will let
+	 * the radio on the bss channel until max_rest_time expires.at
+	 * max_rest_time scanner will switch to off channel irrespective of
+	 * activity. activity is determined by the idle_time parameter.
+	 */
+	__le32 max_rest_time;
+
+	/*
+	 * time before sending next set of probe requests.
+	 * The scanner keeps repeating probe requests transmission with
+	 * period specified by repeat_probe_time.
+	 * The number of probe requests specified depends on the ssid_list
+	 * and bssid_list
+	 */
+	__le32 repeat_probe_time;
+
+	/* time in msec between 2 consequetive probe requests with in a set. */
+	__le32 probe_spacing_time;
+
+	/*
+	 * data inactivity time in msec on bss channel that will be used by
+	 * scanner for measuring the inactivity.
+	 */
+	__le32 idle_time;
+
+	/* maximum time in msec allowed for scan  */
+	__le32 max_scan_time;
+
+	/*
+	 * delay in msec before sending first probe request after switching
+	 * to a channel
+	 */
+	__le32 probe_delay;
+
+	/* Scan control flags */
+	__le32 scan_ctrl_flags;
+
+	/*
+	 * TLV (tag length value )  paramerters follow the scan_cmd structure.
+	 * TLV can contain channel list, bssid list, ssid list and
+	 * ie. the TLV tags are defined above;
+	 */
+} __packed;
+
+
 struct wmi_ssid_arg {
 	int len;
 	const u8 *ssid;
-- 
1.7.10


^ permalink raw reply related

* [PATCH 09/13] ath10k: split wmi_cmd_init path
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

Due to API differences in initialization structures for
main and 10.x firmwares we need to split the wmi_init_cmd
and wmi_resource_config  structures.

This will be usefull also when setting the correct TARGET values,
like: number of peers, vdevs, pdevs etc.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |    6 +-
 drivers/net/wireless/ath/ath10k/wmi.c  |   91 +++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h  |  196 ++++++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 31860a6..3a56715 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -595,7 +595,11 @@ int ath10k_core_start(struct ath10k *ar)
 
 	ath10k_info("firmware %s booted\n", ar->hw->wiphy->fw_version);
 
-	status = ath10k_wmi_cmd_init(ar);
+	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features))
+		status = ath10k_wmi_10x_cmd_init(ar);
+	else
+		status = ath10k_wmi_cmd_init(ar);
+
 	if (status) {
 		ath10k_err("could not send WMI init command (%d)\n", status);
 		goto err_disconnect_htc;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 4992ad1..f88a1d3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2019,6 +2019,97 @@ out:
 	return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->wmi_init_cmdid);
 }
 
+int ath10k_wmi_10x_cmd_init(struct ath10k *ar)
+{
+	struct wmi_init_cmd_10x *cmd;
+	struct sk_buff *buf;
+	struct wmi_resource_config_10x config = {};
+	u32 len, val;
+	int i;
+
+	config.num_vdevs = __cpu_to_le32(TARGET_NUM_VDEVS);
+	config.num_peers = __cpu_to_le32(TARGET_NUM_PEERS + TARGET_NUM_VDEVS);
+	config.num_peer_keys = __cpu_to_le32(TARGET_NUM_PEER_KEYS);
+	config.num_tids = __cpu_to_le32(TARGET_NUM_TIDS);
+	config.ast_skid_limit = __cpu_to_le32(TARGET_AST_SKID_LIMIT);
+	config.tx_chain_mask = __cpu_to_le32(TARGET_TX_CHAIN_MASK);
+	config.rx_chain_mask = __cpu_to_le32(TARGET_RX_CHAIN_MASK);
+	config.rx_timeout_pri_vo = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
+	config.rx_timeout_pri_vi = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
+	config.rx_timeout_pri_be = __cpu_to_le32(TARGET_RX_TIMEOUT_LO_PRI);
+	config.rx_timeout_pri_bk = __cpu_to_le32(TARGET_RX_TIMEOUT_HI_PRI);
+	config.rx_decap_mode = __cpu_to_le32(TARGET_RX_DECAP_MODE);
+
+	config.scan_max_pending_reqs =
+		__cpu_to_le32(TARGET_SCAN_MAX_PENDING_REQS);
+
+	config.bmiss_offload_max_vdev =
+		__cpu_to_le32(TARGET_BMISS_OFFLOAD_MAX_VDEV);
+
+	config.roam_offload_max_vdev =
+		__cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_VDEV);
+
+	config.roam_offload_max_ap_profiles =
+		__cpu_to_le32(TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES);
+
+	config.num_mcast_groups = __cpu_to_le32(TARGET_NUM_MCAST_GROUPS);
+	config.num_mcast_table_elems =
+		__cpu_to_le32(TARGET_NUM_MCAST_TABLE_ELEMS);
+
+	config.mcast2ucast_mode = __cpu_to_le32(TARGET_MCAST2UCAST_MODE);
+	config.tx_dbg_log_size = __cpu_to_le32(TARGET_TX_DBG_LOG_SIZE);
+	config.num_wds_entries = __cpu_to_le32(TARGET_NUM_WDS_ENTRIES);
+	config.dma_burst_size = __cpu_to_le32(TARGET_DMA_BURST_SIZE);
+	config.mac_aggr_delim = __cpu_to_le32(TARGET_MAC_AGGR_DELIM);
+
+	val = TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK;
+	config.rx_skip_defrag_timeout_dup_detection_check = __cpu_to_le32(val);
+
+	config.vow_config = __cpu_to_le32(TARGET_VOW_CONFIG);
+
+	config.num_msdu_desc = __cpu_to_le32(TARGET_NUM_MSDU_DESC);
+	config.max_frag_entries = __cpu_to_le32(TARGET_MAX_FRAG_ENTRIES);
+
+	len = sizeof(*cmd) +
+	      (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
+
+	buf = ath10k_wmi_alloc_skb(len);
+	if (!buf)
+		return -ENOMEM;
+
+	cmd = (struct wmi_init_cmd_10x *)buf->data;
+
+	if (ar->wmi.num_mem_chunks == 0) {
+		cmd->num_host_mem_chunks = 0;
+		goto out;
+	}
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
+		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+
+	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
+
+	for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
+		cmd->host_mem_chunks[i].ptr =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].paddr);
+		cmd->host_mem_chunks[i].size =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].len);
+		cmd->host_mem_chunks[i].req_id =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
+
+		ath10k_dbg(ATH10K_DBG_WMI,
+			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   i,
+			   cmd->host_mem_chunks[i].size,
+			   cmd->host_mem_chunks[i].ptr);
+	}
+out:
+	memcpy(&cmd->resource_config, &config, sizeof(config));
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi init 10x\n");
+	return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->wmi_init_cmdid);
+}
+
 static int ath10k_wmi_start_scan_calc_len(const struct wmi_start_scan_arg *arg)
 {
 	int len;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 8c67fb4..2f18349 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1377,6 +1377,189 @@ struct wmi_resource_config {
 	__le32 max_frag_entries;
 } __packed;
 
+struct wmi_resource_config_10x {
+	/* number of virtual devices (VAPs) to support */
+	__le32 num_vdevs;
+
+	/* number of peer nodes to support */
+	__le32 num_peers;
+
+	/* number of keys per peer */
+	__le32 num_peer_keys;
+
+	/* total number of TX/RX data TIDs */
+	__le32 num_tids;
+
+	/*
+	 * max skid for resolving hash collisions
+	 *
+	 *   The address search table is sparse, so that if two MAC addresses
+	 *   result in the same hash value, the second of these conflicting
+	 *   entries can slide to the next index in the address search table,
+	 *   and use it, if it is unoccupied.  This ast_skid_limit parameter
+	 *   specifies the upper bound on how many subsequent indices to search
+	 *   over to find an unoccupied space.
+	 */
+	__le32 ast_skid_limit;
+
+	/*
+	 * the nominal chain mask for transmit
+	 *
+	 *   The chain mask may be modified dynamically, e.g. to operate AP
+	 *   tx with a reduced number of chains if no clients are associated.
+	 *   This configuration parameter specifies the nominal chain-mask that
+	 *   should be used when not operating with a reduced set of tx chains.
+	 */
+	__le32 tx_chain_mask;
+
+	/*
+	 * the nominal chain mask for receive
+	 *
+	 *   The chain mask may be modified dynamically, e.g. for a client
+	 *   to use a reduced number of chains for receive if the traffic to
+	 *   the client is low enough that it doesn't require downlink MIMO
+	 *   or antenna diversity.
+	 *   This configuration parameter specifies the nominal chain-mask that
+	 *   should be used when not operating with a reduced set of rx chains.
+	 */
+	__le32 rx_chain_mask;
+
+	/*
+	 * what rx reorder timeout (ms) to use for the AC
+	 *
+	 *   Each WMM access class (voice, video, best-effort, background) will
+	 *   have its own timeout value to dictate how long to wait for missing
+	 *   rx MPDUs to arrive before flushing subsequent MPDUs that have
+	 *   already been received.
+	 *   This parameter specifies the timeout in milliseconds for each
+	 *   class.
+	 */
+	__le32 rx_timeout_pri_vi;
+	__le32 rx_timeout_pri_vo;
+	__le32 rx_timeout_pri_be;
+	__le32 rx_timeout_pri_bk;
+
+	/*
+	 * what mode the rx should decap packets to
+	 *
+	 *   MAC can decap to RAW (no decap), native wifi or Ethernet types
+	 *   THis setting also determines the default TX behavior, however TX
+	 *   behavior can be modified on a per VAP basis during VAP init
+	 */
+	__le32 rx_decap_mode;
+
+	/* what is the maximum scan requests than can be queued */
+	__le32 scan_max_pending_reqs;
+
+	/* maximum VDEV that could use BMISS offload */
+	__le32 bmiss_offload_max_vdev;
+
+	/* maximum VDEV that could use offload roaming */
+	__le32 roam_offload_max_vdev;
+
+	/* maximum AP profiles that would push to offload roaming */
+	__le32 roam_offload_max_ap_profiles;
+
+	/*
+	 * how many groups to use for mcast->ucast conversion
+	 *
+	 *   The target's WAL maintains a table to hold information regarding
+	 *   which peers belong to a given multicast group, so that if
+	 *   multicast->unicast conversion is enabled, the target can convert
+	 *   multicast tx frames to a series of unicast tx frames, to each
+	 *   peer within the multicast group.
+	     This num_mcast_groups configuration parameter tells the target how
+	 *   many multicast groups to provide storage for within its multicast
+	 *   group membership table.
+	 */
+	__le32 num_mcast_groups;
+
+	/*
+	 * size to alloc for the mcast membership table
+	 *
+	 *   This num_mcast_table_elems configuration parameter tells the
+	 *   target how many peer elements it needs to provide storage for in
+	 *   its multicast group membership table.
+	 *   These multicast group membership table elements are shared by the
+	 *   multicast groups stored within the table.
+	 */
+	__le32 num_mcast_table_elems;
+
+	/*
+	 * whether/how to do multicast->unicast conversion
+	 *
+	 *   This configuration parameter specifies whether the target should
+	 *   perform multicast --> unicast conversion on transmit, and if so,
+	 *   what to do if it finds no entries in its multicast group
+	 *   membership table for the multicast IP address in the tx frame.
+	 *   Configuration value:
+	 *   0 -> Do not perform multicast to unicast conversion.
+	 *   1 -> Convert multicast frames to unicast, if the IP multicast
+	 *        address from the tx frame is found in the multicast group
+	 *        membership table.  If the IP multicast address is not found,
+	 *        drop the frame.
+	 *   2 -> Convert multicast frames to unicast, if the IP multicast
+	 *        address from the tx frame is found in the multicast group
+	 *        membership table.  If the IP multicast address is not found,
+	 *        transmit the frame as multicast.
+	 */
+	__le32 mcast2ucast_mode;
+
+	/*
+	 * how much memory to allocate for a tx PPDU dbg log
+	 *
+	 *   This parameter controls how much memory the target will allocate
+	 *   to store a log of tx PPDU meta-information (how large the PPDU
+	 *   was, when it was sent, whether it was successful, etc.)
+	 */
+	__le32 tx_dbg_log_size;
+
+	/* how many AST entries to be allocated for WDS */
+	__le32 num_wds_entries;
+
+	/*
+	 * MAC DMA burst size, e.g., For target PCI limit can be
+	 * 0 -default, 1 256B
+	 */
+	__le32 dma_burst_size;
+
+	/*
+	 * Fixed delimiters to be inserted after every MPDU to
+	 * account for interface latency to avoid underrun.
+	 */
+	__le32 mac_aggr_delim;
+
+	/*
+	 *   determine whether target is responsible for detecting duplicate
+	 *   non-aggregate MPDU and timing out stale fragments.
+	 *
+	 *   A-MPDU reordering is always performed on the target.
+	 *
+	 *   0: target responsible for frag timeout and dup checking
+	 *   1: host responsible for frag timeout and dup checking
+	 */
+	__le32 rx_skip_defrag_timeout_dup_detection_check;
+
+	/*
+	 * Configuration for VoW :
+	 * No of Video Nodes to be supported
+	 * and Max no of descriptors for each Video link (node).
+	 */
+	__le32 vow_config;
+
+	/* Number of msdu descriptors target should use */
+	__le32 num_msdu_desc;
+
+	/*
+	 * Max. number of Tx fragments per MSDU
+	 *  This parameter controls the max number of Tx fragments per MSDU.
+	 *  This is sent by the target as part of the WMI_SERVICE_READY event
+	 *  and is overriden by the OS shim as required.
+	 */
+	__le32 max_frag_entries;
+} __packed;
+
+
 #define NUM_UNITS_IS_NUM_VDEVS   0x1
 #define NUM_UNITS_IS_NUM_PEERS   0x2
 
@@ -1401,6 +1584,18 @@ struct wmi_init_cmd {
 	struct host_memory_chunk host_mem_chunks[1];
 } __packed;
 
+/* _10x stucture is from 10.X FW API */
+struct wmi_init_cmd_10x {
+	struct wmi_resource_config_10x resource_config;
+	__le32 num_host_mem_chunks;
+
+	/*
+	 * variable number of host memory chunks.
+	 * This should be the last element in the structure
+	 */
+	struct host_memory_chunk host_mem_chunks[1];
+} __packed;
+
 /* TLV for channel list */
 struct wmi_chan_list {
 	__le32 tag; /* WMI_CHAN_LIST_TAG */
@@ -3435,6 +3630,7 @@ int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g,
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
 			      u32 value);
 int ath10k_wmi_cmd_init(struct ath10k *ar);
+int ath10k_wmi_10x_cmd_init(struct ath10k *ar);
 int ath10k_wmi_start_scan(struct ath10k *ar, const struct wmi_start_scan_arg *);
 void ath10k_wmi_start_scan_init(struct ath10k *ar, struct wmi_start_scan_arg *);
 int ath10k_wmi_stop_scan(struct ath10k *ar,
-- 
1.7.10


^ permalink raw reply related

* [PATCH 08/13] ath10k: bring back the WMI path for mgmt frames
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

This is still used by the 10.X firmware.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h   |    5 ++-
 drivers/net/wireless/ath/ath10k/htt_tx.c |    4 +--
 drivers/net/wireless/ath/ath10k/mac.c    |   27 ++++++++++------
 drivers/net/wireless/ath/ath10k/wmi.c    |   49 ++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h    |    1 +
 5 files changed, 73 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 0c9e6f3..377560d 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -49,9 +49,9 @@ struct ath10k_skb_cb {
 	dma_addr_t paddr;
 	bool is_mapped;
 	bool is_aborted;
+	u8 vdev_id;
 
 	struct {
-		u8 vdev_id;
 		u8 tid;
 		bool is_offchan;
 
@@ -284,6 +284,9 @@ enum ath10k_fw_features {
 	/* firmware from 10X branch */
 	ATH10K_FW_FEATURE_10X = 1,
 
+	/* firmware support tx frame management over WMI, otherwise it's HTT */
+	ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX = 2,
+
 	/* keep last */
 	ATH10K_FW_FEATURE_COUNT,
 };
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 3b93c6a..d9335e9 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -308,7 +308,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	struct sk_buff *txdesc = NULL;
 	struct htt_cmd *cmd;
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
-	u8 vdev_id = skb_cb->htt.vdev_id;
+	u8 vdev_id = skb_cb->vdev_id;
 	int len = 0;
 	int msdu_id = -1;
 	int res;
@@ -384,7 +384,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
 	struct sk_buff *txdesc = NULL;
 	bool use_frags;
-	u8 vdev_id = ATH10K_SKB_CB(msdu)->htt.vdev_id;
+	u8 vdev_id = ATH10K_SKB_CB(msdu)->vdev_id;
 	u8 tid;
 	int prefetch_len, desc_len;
 	int msdu_id = -1;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 99a9bad..18fae5e 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1489,7 +1489,7 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
 static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	int ret;
+	int ret = 0;
 
 	if (ar->htt.target_version_major >= 3) {
 		/* Since HTT 3.0 there is no separate mgmt tx command */
@@ -1497,16 +1497,23 @@ static void ath10k_tx_htt(struct ath10k *ar, struct sk_buff *skb)
 		goto exit;
 	}
 
-	if (ieee80211_is_mgmt(hdr->frame_control))
-		ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
-	else if (ieee80211_is_nullfunc(hdr->frame_control))
+	if (ieee80211_is_mgmt(hdr->frame_control)) {
+		if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
+			     ar->fw_features))
+			ret = ath10k_wmi_mgmt_tx(ar, skb);
+		else
+			ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
+	} else if (!test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
+			     ar->fw_features) &&
+		   ieee80211_is_nullfunc(hdr->frame_control)) {
 		/* FW does not report tx status properly for NullFunc frames
 		 * unless they are sent through mgmt tx path. mac80211 sends
-		 * those frames when it detects link/beacon loss and depends on
-		 * the tx status to be correct. */
+		 * those frames when it detects link/beacon loss and depends
+		 * on the tx status to be correct. */
 		ret = ath10k_htt_mgmt_tx(&ar->htt, skb);
-	else
+	} else {
 		ret = ath10k_htt_tx(&ar->htt, skb);
+	}
 
 exit:
 	if (ret) {
@@ -1557,7 +1564,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
 
 		hdr = (struct ieee80211_hdr *)skb->data;
 		peer_addr = ieee80211_get_DA(hdr);
-		vdev_id = ATH10K_SKB_CB(skb)->htt.vdev_id;
+		vdev_id = ATH10K_SKB_CB(skb)->vdev_id;
 
 		spin_lock_bh(&ar->data_lock);
 		peer = ath10k_peer_find(ar, vdev_id, peer_addr);
@@ -1757,14 +1764,14 @@ static void ath10k_tx(struct ieee80211_hw *hw,
 		ath10k_tx_h_seq_no(skb);
 	}
 
+	ATH10K_SKB_CB(skb)->vdev_id = vdev_id;
 	ATH10K_SKB_CB(skb)->htt.is_offchan = false;
-	ATH10K_SKB_CB(skb)->htt.vdev_id = vdev_id;
 	ATH10K_SKB_CB(skb)->htt.tid = tid;
 
 	if (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) {
 		spin_lock_bh(&ar->data_lock);
 		ATH10K_SKB_CB(skb)->htt.is_offchan = true;
-		ATH10K_SKB_CB(skb)->htt.vdev_id = ar->scan.vdev_id;
+		ATH10K_SKB_CB(skb)->vdev_id = ar->scan.vdev_id;
 		spin_unlock_bh(&ar->data_lock);
 
 		ath10k_dbg(ATH10K_DBG_MAC, "queued offchannel skb %p\n", skb);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 3b1ae88..4992ad1 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -418,6 +418,55 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 	return ret;
 }
 
+int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb)
+{
+	int ret = 0;
+	struct wmi_mgmt_tx_cmd *cmd;
+	struct ieee80211_hdr *hdr;
+	struct sk_buff *wmi_skb;
+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	int len;
+	u16 fc;
+
+	hdr = (struct ieee80211_hdr *)skb->data;
+	fc = le16_to_cpu(hdr->frame_control);
+
+	if (WARN_ON_ONCE(!ieee80211_is_mgmt(hdr->frame_control)))
+		return -EINVAL;
+
+	len = sizeof(cmd->hdr) + skb->len;
+	len = round_up(len, 4);
+
+	wmi_skb = ath10k_wmi_alloc_skb(len);
+	if (!wmi_skb)
+		return -ENOMEM;
+
+	cmd = (struct wmi_mgmt_tx_cmd *)wmi_skb->data;
+
+	cmd->hdr.vdev_id = __cpu_to_le32(ATH10K_SKB_CB(skb)->vdev_id);
+	cmd->hdr.tx_rate = 0;
+	cmd->hdr.tx_power = 0;
+	cmd->hdr.buf_len = __cpu_to_le32((u32)(skb->len));
+
+	memcpy(cmd->hdr.peer_macaddr.addr, ieee80211_get_DA(hdr), ETH_ALEN);
+	memcpy(cmd->buf, skb->data, skb->len);
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi mgmt tx skb %p len %d ftype %02x stype %02x\n",
+		   wmi_skb, wmi_skb->len, fc & IEEE80211_FCTL_FTYPE,
+		   fc & IEEE80211_FCTL_STYPE);
+
+	/* Send the management frame buffer to the target */
+	ret = ath10k_wmi_cmd_send(ar, wmi_skb, ar->wmi.cmd->wmi_mgmt_tx_cmdid);
+	if (ret)
+		return ret;
+
+	/* TODO: report tx status to mac80211 - temporary just ACK */
+	info->flags |= IEEE80211_TX_STAT_ACK;
+	ieee80211_tx_status_irqsafe(ar->hw, skb);
+
+	return ret;
+}
+
 static int ath10k_wmi_event_scan(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct wmi_scan_event *event = (struct wmi_scan_event *)skb->data;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 3825937..8c67fb4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -3483,5 +3483,6 @@ int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar,
 int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id);
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 			     enum wmi_force_fw_hang_type type, u32 delay_ms);
+int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb);
 
 #endif /* _WMI_H_ */
-- 
1.7.10


^ permalink raw reply related

* [PATCH 11/13] ath10k: introduce dynamic vdev parameters
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

Both firmwares (main and 10.x) have different set of vdev
parameters. To stay in sync with FW API, this patch introduces
a dynamic registering method.

ath10k_wmi_vdev_set_param() takes now indirect u32 value
to identify the Vdev parameter it want's to set.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    1 +
 drivers/net/wireless/ath/ath10k/mac.c  |   55 +++++-----
 drivers/net/wireless/ath/ath10k/wmi.c  |  136 ++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h  |  172 +++++++++++++++++++++++++++++++-
 4 files changed, 339 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 377560d..c9ad626 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -117,6 +117,7 @@ struct ath10k_wmi {
 	struct completion unified_ready;
 	wait_queue_head_t tx_credits_wq;
 	struct wmi_cmd_map *cmd;
+	struct wmi_vdev_param_map *vdev_param;
 
 	u32 num_mem_chunks;
 	struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS];
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 18fae5e..ea11a03 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -334,25 +334,29 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr)
 
 static int  ath10k_mac_set_rts(struct ath10k_vif *arvif, u32 value)
 {
+	struct ath10k *ar = arvif->ar;
+	u32 vdev_param;
+
 	if (value != 0xFFFFFFFF)
 		value = min_t(u32, arvif->ar->hw->wiphy->rts_threshold,
 			      ATH10K_RTS_MAX);
 
-	return ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
-					 WMI_VDEV_PARAM_RTS_THRESHOLD,
-					 value);
+	vdev_param = ar->wmi.vdev_param->wmi_vdev_param_rts_threshold;
+	return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value);
 }
 
 static int ath10k_mac_set_frag(struct ath10k_vif *arvif, u32 value)
 {
+	struct ath10k *ar = arvif->ar;
+	u32 vdev_param;
+
 	if (value != 0xFFFFFFFF)
 		value = clamp_t(u32, arvif->ar->hw->wiphy->frag_threshold,
 				ATH10K_FRAGMT_THRESHOLD_MIN,
 				ATH10K_FRAGMT_THRESHOLD_MAX);
 
-	return ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
-					 WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
-					 value);
+	vdev_param = ar->wmi.vdev_param->wmi_vdev_param_fragmentation_threshold;
+	return ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, value);
 }
 
 static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
@@ -677,6 +681,7 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 				struct ieee80211_bss_conf *info,
 				const u8 self_peer[ETH_ALEN])
 {
+	u32 vdev_param;
 	int ret = 0;
 
 	lockdep_assert_held(&arvif->ar->conf_mutex);
@@ -710,8 +715,8 @@ static void ath10k_control_ibss(struct ath10k_vif *arvif,
 		return;
 	}
 
-	ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id,
-					WMI_VDEV_PARAM_ATIM_WINDOW,
+	vdev_param = arvif->ar->wmi.vdev_param->wmi_vdev_param_atim_window;
+	ret = ath10k_wmi_vdev_set_param(arvif->ar, arvif->vdev_id, vdev_param,
 					ATH10K_DEFAULT_ATIM);
 	if (ret)
 		ath10k_warn("Failed to set IBSS ATIM for VDEV:%d ret:%d\n",
@@ -1433,6 +1438,7 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	struct ath10k *ar = arvif->ar;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	struct ieee80211_key_conf *key = info->control.hw_key;
+	u32 vdev_param;
 	int ret;
 
 	if (!ieee80211_has_protected(hdr->frame_control))
@@ -1451,8 +1457,8 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d keyidx %d\n",
 		   arvif->vdev_id, key->keyidx);
 
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-					WMI_VDEV_PARAM_DEF_KEYID,
+	vdev_param = ar->wmi.vdev_param->wmi_vdev_param_def_keyid;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					key->keyidx);
 	if (ret) {
 		ath10k_warn("could not update wep keyidx (%d)\n", ret);
@@ -1943,6 +1949,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 	int ret = 0;
 	u32 value;
 	int bit;
+	u32 vdev_param;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -2004,13 +2011,14 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 		goto exit;
 	}
 
-	ret = ath10k_wmi_vdev_set_param(ar, 0, WMI_VDEV_PARAM_DEF_KEYID,
+	vdev_param = ar->wmi.vdev_param->wmi_vdev_param_def_keyid;
+	ret = ath10k_wmi_vdev_set_param(ar, 0, vdev_param,
 					arvif->def_wep_key_index);
 	if (ret)
 		ath10k_warn("Failed to set default keyid: %d\n", ret);
 
-	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-					WMI_VDEV_PARAM_TX_ENCAP_TYPE,
+	vdev_param = ar->wmi.vdev_param->wmi_vdev_param_tx_encap_type;
+	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 					ATH10K_HW_TXRX_NATIVE_WIFI);
 	if (ret)
 		ath10k_warn("Failed to set TX encap: %d\n", ret);
@@ -2161,6 +2169,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 	struct ath10k *ar = hw->priv;
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 	int ret = 0;
+	u32 vdev_param;
 
 	mutex_lock(&ar->conf_mutex);
 
@@ -2169,8 +2178,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 
 	if (changed & BSS_CHANGED_BEACON_INT) {
 		arvif->beacon_interval = info->beacon_int;
-		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-						WMI_VDEV_PARAM_BEACON_INTERVAL,
+		vdev_param = ar->wmi.vdev_param->wmi_vdev_param_beacon_interval;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 						arvif->beacon_interval);
 		ath10k_dbg(ATH10K_DBG_MAC,
 			   "mac vdev %d beacon_interval %d\n",
@@ -2201,8 +2210,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 			   "mac vdev %d dtim_period %d\n",
 			   arvif->vdev_id, arvif->dtim_period);
 
-		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-						WMI_VDEV_PARAM_DTIM_PERIOD,
+		vdev_param = ar->wmi.vdev_param->wmi_vdev_param_dtim_period;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 						arvif->dtim_period);
 		if (ret)
 			ath10k_warn("Failed to set dtim period for VDEV: %d\n",
@@ -2269,8 +2278,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d cts_prot %d\n",
 			   arvif->vdev_id, cts_prot);
 
-		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-						WMI_VDEV_PARAM_ENABLE_RTSCTS,
+		vdev_param = ar->wmi.vdev_param->wmi_vdev_param_enable_rtscts;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 						cts_prot);
 		if (ret)
 			ath10k_warn("Failed to set CTS prot for VDEV: %d\n",
@@ -2288,8 +2297,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 		ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d slot_time %d\n",
 			   arvif->vdev_id, slottime);
 
-		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-						WMI_VDEV_PARAM_SLOT_TIME,
+		vdev_param = ar->wmi.vdev_param->wmi_vdev_param_slot_time;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 						slottime);
 		if (ret)
 			ath10k_warn("Failed to set erp slot for VDEV: %d\n",
@@ -2307,8 +2316,8 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
 			   "mac vdev %d preamble %dn",
 			   arvif->vdev_id, preamble);
 
-		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
-						WMI_VDEV_PARAM_PREAMBLE,
+		vdev_param = ar->wmi.vdev_param->wmi_vdev_param_preamble;
+		ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
 						preamble);
 		if (ret)
 			ath10k_warn("Failed to set preamble for VDEV: %d\n",
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f0e1ea9..44ed523 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -274,6 +274,131 @@ static struct wmi_cmd_map wmi_10x_cmd_map = {
 	.wmi_gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID,
 };
 
+/* MAIN WMI VDEV param map */
+static struct wmi_vdev_param_map wmi_vdev_param_map = {
+	.wmi_vdev_param_rts_threshold = WMI_VDEV_PARAM_RTS_THRESHOLD,
+	.wmi_vdev_param_fragmentation_threshold =
+				WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
+	.wmi_vdev_param_beacon_interval = WMI_VDEV_PARAM_BEACON_INTERVAL,
+	.wmi_vdev_param_listen_interval = WMI_VDEV_PARAM_LISTEN_INTERVAL,
+	.wmi_vdev_param_multicast_rate = WMI_VDEV_PARAM_MULTICAST_RATE,
+	.wmi_vdev_param_mgmt_tx_rate = WMI_VDEV_PARAM_MGMT_TX_RATE,
+	.wmi_vdev_param_slot_time = WMI_VDEV_PARAM_SLOT_TIME,
+	.wmi_vdev_param_preamble = WMI_VDEV_PARAM_PREAMBLE,
+	.wmi_vdev_param_swba_time = WMI_VDEV_PARAM_SWBA_TIME,
+	.wmi_vdev_stats_update_period = WMI_VDEV_STATS_UPDATE_PERIOD,
+	.wmi_vdev_pwrsave_ageout_time = WMI_VDEV_PWRSAVE_AGEOUT_TIME,
+	.wmi_vdev_host_swba_interval = WMI_VDEV_HOST_SWBA_INTERVAL,
+	.wmi_vdev_param_dtim_period = WMI_VDEV_PARAM_DTIM_PERIOD,
+	.wmi_vdev_oc_scheduler_air_time_limit =
+					WMI_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
+	.wmi_vdev_param_wds = WMI_VDEV_PARAM_WDS,
+	.wmi_vdev_param_atim_window = WMI_VDEV_PARAM_ATIM_WINDOW,
+	.wmi_vdev_param_bmiss_count_max = WMI_VDEV_PARAM_BMISS_COUNT_MAX,
+	.wmi_vdev_param_bmiss_first_bcnt = WMI_VDEV_PARAM_BMISS_FIRST_BCNT,
+	.wmi_vdev_param_bmiss_final_bcnt = WMI_VDEV_PARAM_BMISS_FINAL_BCNT,
+	.wmi_vdev_param_feature_wmm = WMI_VDEV_PARAM_FEATURE_WMM,
+	.wmi_vdev_param_chwidth = WMI_VDEV_PARAM_CHWIDTH,
+	.wmi_vdev_param_chextoffset = WMI_VDEV_PARAM_CHEXTOFFSET,
+	.wmi_vdev_param_disable_htprotection =
+					WMI_VDEV_PARAM_DISABLE_HTPROTECTION,
+	.wmi_vdev_param_sta_quickkickout = WMI_VDEV_PARAM_DISABLE_HTPROTECTION,
+	.wmi_vdev_param_mgmt_rate = WMI_VDEV_PARAM_MGMT_RATE,
+	.wmi_vdev_param_protection_mode = WMI_VDEV_PARAM_PROTECTION_MODE,
+	.wmi_vdev_param_fixed_rate = WMI_VDEV_PARAM_FIXED_RATE,
+	.wmi_vdev_param_sgi = WMI_VDEV_PARAM_SGI,
+	.wmi_vdev_param_ldpc = WMI_VDEV_PARAM_LDPC,
+	.wmi_vdev_param_tx_stbc = WMI_VDEV_PARAM_TX_STBC,
+	.wmi_vdev_param_rx_stbc = WMI_VDEV_PARAM_RX_STBC,
+	.wmi_vdev_param_intra_bss_fwd = WMI_VDEV_PARAM_INTRA_BSS_FWD,
+	.wmi_vdev_param_def_keyid = WMI_VDEV_PARAM_DEF_KEYID,
+	.wmi_vdev_param_nss = WMI_VDEV_PARAM_NSS,
+	.wmi_vdev_param_bcast_data_rate = WMI_VDEV_PARAM_BCAST_DATA_RATE,
+	.wmi_vdev_param_mcast_data_rate = WMI_VDEV_PARAM_MCAST_DATA_RATE,
+	.wmi_vdev_param_mcast_indicate = WMI_VDEV_PARAM_MCAST_INDICATE,
+	.wmi_vdev_param_dhcp_indicate = WMI_VDEV_PARAM_DHCP_INDICATE,
+	.wmi_vdev_param_unknown_dest_indicate =
+			WMI_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
+	.wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs =
+			WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
+	.wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs =
+			WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
+	.wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs =
+			WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
+	.wmi_vdev_param_ap_enable_nawds = WMI_VDEV_PARAM_AP_ENABLE_NAWDS,
+	.wmi_vdev_param_mcast2ucast_set = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_enable_rtscts = WMI_VDEV_PARAM_ENABLE_RTSCTS,
+	.wmi_vdev_param_txbf = WMI_VDEV_PARAM_TXBF,
+	.wmi_vdev_param_packet_powersave = WMI_VDEV_PARAM_PACKET_POWERSAVE,
+	.wmi_vdev_param_drop_unencry = WMI_VDEV_PARAM_DROP_UNENCRY,
+	.wmi_vdev_param_tx_encap_type = WMI_VDEV_PARAM_TX_ENCAP_TYPE,
+	.wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs =
+		WMI_VDEV_PARAM_UNSUPPORTED,
+};
+
+/* 10.X WMI VDEV param map */
+static struct wmi_vdev_param_map wmi_10x_vdev_param_map = {
+	.wmi_vdev_param_rts_threshold = WMI_10X_VDEV_PARAM_RTS_THRESHOLD,
+	.wmi_vdev_param_fragmentation_threshold =
+				WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
+	.wmi_vdev_param_beacon_interval = WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
+	.wmi_vdev_param_listen_interval = WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
+	.wmi_vdev_param_multicast_rate = WMI_10X_VDEV_PARAM_MULTICAST_RATE,
+	.wmi_vdev_param_mgmt_tx_rate = WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
+	.wmi_vdev_param_slot_time = WMI_10X_VDEV_PARAM_SLOT_TIME,
+	.wmi_vdev_param_preamble = WMI_10X_VDEV_PARAM_PREAMBLE,
+	.wmi_vdev_param_swba_time = WMI_10X_VDEV_PARAM_SWBA_TIME,
+	.wmi_vdev_stats_update_period = WMI_10X_VDEV_STATS_UPDATE_PERIOD,
+	.wmi_vdev_pwrsave_ageout_time = WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
+	.wmi_vdev_host_swba_interval = WMI_10X_VDEV_HOST_SWBA_INTERVAL,
+	.wmi_vdev_param_dtim_period = WMI_10X_VDEV_PARAM_DTIM_PERIOD,
+	.wmi_vdev_oc_scheduler_air_time_limit =
+				WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
+	.wmi_vdev_param_wds = WMI_10X_VDEV_PARAM_WDS,
+	.wmi_vdev_param_atim_window = WMI_10X_VDEV_PARAM_ATIM_WINDOW,
+	.wmi_vdev_param_bmiss_count_max = WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
+	.wmi_vdev_param_bmiss_first_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_bmiss_final_bcnt = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_feature_wmm = WMI_10X_VDEV_PARAM_FEATURE_WMM,
+	.wmi_vdev_param_chwidth = WMI_10X_VDEV_PARAM_CHWIDTH,
+	.wmi_vdev_param_chextoffset = WMI_10X_VDEV_PARAM_CHEXTOFFSET,
+	.wmi_vdev_param_disable_htprotection =
+					WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
+	.wmi_vdev_param_sta_quickkickout =
+					WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
+	.wmi_vdev_param_mgmt_rate = WMI_10X_VDEV_PARAM_MGMT_RATE,
+	.wmi_vdev_param_protection_mode = WMI_10X_VDEV_PARAM_PROTECTION_MODE,
+	.wmi_vdev_param_fixed_rate = WMI_10X_VDEV_PARAM_FIXED_RATE,
+	.wmi_vdev_param_sgi = WMI_10X_VDEV_PARAM_SGI,
+	.wmi_vdev_param_ldpc = WMI_10X_VDEV_PARAM_LDPC,
+	.wmi_vdev_param_tx_stbc = WMI_10X_VDEV_PARAM_TX_STBC,
+	.wmi_vdev_param_rx_stbc = WMI_10X_VDEV_PARAM_RX_STBC,
+	.wmi_vdev_param_intra_bss_fwd = WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
+	.wmi_vdev_param_def_keyid = WMI_10X_VDEV_PARAM_DEF_KEYID,
+	.wmi_vdev_param_nss = WMI_10X_VDEV_PARAM_NSS,
+	.wmi_vdev_param_bcast_data_rate = WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
+	.wmi_vdev_param_mcast_data_rate = WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
+	.wmi_vdev_param_mcast_indicate = WMI_10X_VDEV_PARAM_MCAST_INDICATE,
+	.wmi_vdev_param_dhcp_indicate = WMI_10X_VDEV_PARAM_DHCP_INDICATE,
+	.wmi_vdev_param_unknown_dest_indicate =
+			WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
+	.wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs =
+		WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
+	.wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs =
+		WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
+	.wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs =
+		WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
+	.wmi_vdev_param_ap_enable_nawds = WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
+	.wmi_vdev_param_mcast2ucast_set = WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
+	.wmi_vdev_param_enable_rtscts = WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
+	.wmi_vdev_param_txbf = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_packet_powersave = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_drop_unencry = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_tx_encap_type = WMI_VDEV_PARAM_UNSUPPORTED,
+	.wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs =
+		WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
+};
+
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
 	int ret;
@@ -1760,9 +1885,11 @@ int ath10k_wmi_attach(struct ath10k *ar)
 	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features)) {
 		ath10k_warn("Firmware 10.X is not yet supported\n");
 		ar->wmi.cmd = &wmi_10x_cmd_map;
+		ar->wmi.vdev_param = &wmi_10x_vdev_param_map;
 		ret = -ENOTSUPP;
 	} else {
 		ar->wmi.cmd = &wmi_cmd_map;
+		ar->wmi.vdev_param = &wmi_vdev_param_map;
 		ret = 0;
 	}
 
@@ -2520,11 +2647,18 @@ int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id)
 }
 
 int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
-			      enum wmi_vdev_param param_id, u32 param_value)
+			      u32 param_id, u32 param_value)
 {
 	struct wmi_vdev_set_param_cmd *cmd;
 	struct sk_buff *skb;
 
+	if (param_id == WMI_VDEV_PARAM_UNSUPPORTED) {
+		ath10k_dbg(ATH10K_DBG_WMI,
+			   "vdev param %d not supported by firmware\n",
+			    param_id);
+		return -EINVAL;
+	}
+
 	skb = ath10k_wmi_alloc_skb(sizeof(*cmd));
 	if (!skb)
 		return -ENOMEM;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 2f18349..fbff5cb 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2695,6 +2695,61 @@ enum wmi_rate_preamble {
 /* Value to disable fixed rate setting */
 #define WMI_FIXED_RATE_NONE    (0xff)
 
+struct wmi_vdev_param_map {
+	u32 wmi_vdev_param_rts_threshold;
+	u32 wmi_vdev_param_fragmentation_threshold;
+	u32 wmi_vdev_param_beacon_interval;
+	u32 wmi_vdev_param_listen_interval;
+	u32 wmi_vdev_param_multicast_rate;
+	u32 wmi_vdev_param_mgmt_tx_rate;
+	u32 wmi_vdev_param_slot_time;
+	u32 wmi_vdev_param_preamble;
+	u32 wmi_vdev_param_swba_time;
+	u32 wmi_vdev_stats_update_period;
+	u32 wmi_vdev_pwrsave_ageout_time;
+	u32 wmi_vdev_host_swba_interval;
+	u32 wmi_vdev_param_dtim_period;
+	u32 wmi_vdev_oc_scheduler_air_time_limit;
+	u32 wmi_vdev_param_wds;
+	u32 wmi_vdev_param_atim_window;
+	u32 wmi_vdev_param_bmiss_count_max;
+	u32 wmi_vdev_param_bmiss_first_bcnt;
+	u32 wmi_vdev_param_bmiss_final_bcnt;
+	u32 wmi_vdev_param_feature_wmm;
+	u32 wmi_vdev_param_chwidth;
+	u32 wmi_vdev_param_chextoffset;
+	u32 wmi_vdev_param_disable_htprotection;
+	u32 wmi_vdev_param_sta_quickkickout;
+	u32 wmi_vdev_param_mgmt_rate;
+	u32 wmi_vdev_param_protection_mode;
+	u32 wmi_vdev_param_fixed_rate;
+	u32 wmi_vdev_param_sgi;
+	u32 wmi_vdev_param_ldpc;
+	u32 wmi_vdev_param_tx_stbc;
+	u32 wmi_vdev_param_rx_stbc;
+	u32 wmi_vdev_param_intra_bss_fwd;
+	u32 wmi_vdev_param_def_keyid;
+	u32 wmi_vdev_param_nss;
+	u32 wmi_vdev_param_bcast_data_rate;
+	u32 wmi_vdev_param_mcast_data_rate;
+	u32 wmi_vdev_param_mcast_indicate;
+	u32 wmi_vdev_param_dhcp_indicate;
+	u32 wmi_vdev_param_unknown_dest_indicate;
+	u32 wmi_vdev_param_ap_keepalive_min_idle_inactive_time_secs;
+	u32 wmi_vdev_param_ap_keepalive_max_idle_inactive_time_secs;
+	u32 wmi_vdev_param_ap_keepalive_max_unresponsive_time_secs;
+	u32 wmi_vdev_param_ap_enable_nawds;
+	u32 wmi_vdev_param_mcast2ucast_set;
+	u32 wmi_vdev_param_enable_rtscts;
+	u32 wmi_vdev_param_txbf;
+	u32 wmi_vdev_param_packet_powersave;
+	u32 wmi_vdev_param_drop_unencry;
+	u32 wmi_vdev_param_tx_encap_type;
+	u32 wmi_vdev_param_ap_detect_out_of_sync_sleeping_sta_time_secs;
+};
+
+#define WMI_VDEV_PARAM_UNSUPPORTED 0
+
 /* the definition of different VDEV parameters */
 enum wmi_vdev_param {
 	/* RTS Threshold */
@@ -2826,6 +2881,121 @@ enum wmi_vdev_param {
 	WMI_VDEV_PARAM_TX_ENCAP_TYPE,
 };
 
+/* the definition of different VDEV parameters */
+enum wmi_10x_vdev_param {
+	/* RTS Threshold */
+	WMI_10X_VDEV_PARAM_RTS_THRESHOLD = 0x1,
+	/* Fragmentation threshold */
+	WMI_10X_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
+	/* beacon interval in TUs */
+	WMI_10X_VDEV_PARAM_BEACON_INTERVAL,
+	/* Listen interval in TUs */
+	WMI_10X_VDEV_PARAM_LISTEN_INTERVAL,
+	/* muticast rate in Mbps */
+	WMI_10X_VDEV_PARAM_MULTICAST_RATE,
+	/* management frame rate in Mbps */
+	WMI_10X_VDEV_PARAM_MGMT_TX_RATE,
+	/* slot time (long vs short) */
+	WMI_10X_VDEV_PARAM_SLOT_TIME,
+	/* preamble (long vs short) */
+	WMI_10X_VDEV_PARAM_PREAMBLE,
+	/* SWBA time (time before tbtt in msec) */
+	WMI_10X_VDEV_PARAM_SWBA_TIME,
+	/* time period for updating VDEV stats */
+	WMI_10X_VDEV_STATS_UPDATE_PERIOD,
+	/* age out time in msec for frames queued for station in power save */
+	WMI_10X_VDEV_PWRSAVE_AGEOUT_TIME,
+	/*
+	 * Host SWBA interval (time in msec before tbtt for SWBA event
+	 * generation).
+	 */
+	WMI_10X_VDEV_HOST_SWBA_INTERVAL,
+	/* DTIM period (specified in units of num beacon intervals) */
+	WMI_10X_VDEV_PARAM_DTIM_PERIOD,
+	/*
+	 * scheduler air time limit for this VDEV. used by off chan
+	 * scheduler.
+	 */
+	WMI_10X_VDEV_OC_SCHEDULER_AIR_TIME_LIMIT,
+	/* enable/dsiable WDS for this VDEV  */
+	WMI_10X_VDEV_PARAM_WDS,
+	/* ATIM Window */
+	WMI_10X_VDEV_PARAM_ATIM_WINDOW,
+	/* BMISS max */
+	WMI_10X_VDEV_PARAM_BMISS_COUNT_MAX,
+	/* WMM enables/disabled */
+	WMI_10X_VDEV_PARAM_FEATURE_WMM,
+	/* Channel width */
+	WMI_10X_VDEV_PARAM_CHWIDTH,
+	/* Channel Offset */
+	WMI_10X_VDEV_PARAM_CHEXTOFFSET,
+	/* Disable HT Protection */
+	WMI_10X_VDEV_PARAM_DISABLE_HTPROTECTION,
+	/* Quick STA Kickout */
+	WMI_10X_VDEV_PARAM_STA_QUICKKICKOUT,
+	/* Rate to be used with Management frames */
+	WMI_10X_VDEV_PARAM_MGMT_RATE,
+	/* Protection Mode */
+	WMI_10X_VDEV_PARAM_PROTECTION_MODE,
+	/* Fixed rate setting */
+	WMI_10X_VDEV_PARAM_FIXED_RATE,
+	/* Short GI Enable/Disable */
+	WMI_10X_VDEV_PARAM_SGI,
+	/* Enable LDPC */
+	WMI_10X_VDEV_PARAM_LDPC,
+	/* Enable Tx STBC */
+	WMI_10X_VDEV_PARAM_TX_STBC,
+	/* Enable Rx STBC */
+	WMI_10X_VDEV_PARAM_RX_STBC,
+	/* Intra BSS forwarding  */
+	WMI_10X_VDEV_PARAM_INTRA_BSS_FWD,
+	/* Setting Default xmit key for Vdev */
+	WMI_10X_VDEV_PARAM_DEF_KEYID,
+	/* NSS width */
+	WMI_10X_VDEV_PARAM_NSS,
+	/* Set the custom rate for the broadcast data frames */
+	WMI_10X_VDEV_PARAM_BCAST_DATA_RATE,
+	/* Set the custom rate (rate-code) for multicast data frames */
+	WMI_10X_VDEV_PARAM_MCAST_DATA_RATE,
+	/* Tx multicast packet indicate Enable/Disable */
+	WMI_10X_VDEV_PARAM_MCAST_INDICATE,
+	/* Tx DHCP packet indicate Enable/Disable */
+	WMI_10X_VDEV_PARAM_DHCP_INDICATE,
+	/* Enable host inspection of Tx unicast packet to unknown destination */
+	WMI_10X_VDEV_PARAM_UNKNOWN_DEST_INDICATE,
+
+	/* The minimum amount of time AP begins to consider STA inactive */
+	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
+
+	/*
+	 * An associated STA is considered inactive when there is no recent
+	 * TX/RX activity and no downlink frames are buffered for it. Once a
+	 * STA exceeds the maximum idle inactive time, the AP will send an
+	 * 802.11 data-null as a keep alive to verify the STA is still
+	 * associated. If the STA does ACK the data-null, or if the data-null
+	 * is buffered and the STA does not retrieve it, the STA will be
+	 * considered unresponsive
+	 * (see WMI_10X_VDEV_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS).
+	 */
+	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
+
+	/*
+	 * An associated STA is considered unresponsive if there is no recent
+	 * TX/RX activity and downlink frames are buffered for it. Once a STA
+	 * exceeds the maximum unresponsive time, the AP will send a
+	 * WMI_10X_STA_KICKOUT event to the host so the STA can be deleted. */
+	WMI_10X_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
+
+	/* Enable NAWDS : MCAST INSPECT Enable, NAWDS Flag set */
+	WMI_10X_VDEV_PARAM_AP_ENABLE_NAWDS,
+
+	WMI_10X_VDEV_PARAM_MCAST2UCAST_SET,
+	/* Enable/Disable RTS-CTS */
+	WMI_10X_VDEV_PARAM_ENABLE_RTSCTS,
+
+	WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS,
+};
+
 /* slot time long */
 #define WMI_VDEV_SLOT_TIME_LONG		0x1
 /* slot time short */
@@ -3649,7 +3819,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid,
 		       const u8 *bssid);
 int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id);
 int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
-			      enum wmi_vdev_param param_id, u32 param_value);
+			      u32 param_id, u32 param_value);
 int ath10k_wmi_vdev_install_key(struct ath10k *ar,
 				const struct wmi_vdev_install_key_arg *arg);
 int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id,
-- 
1.7.10


^ permalink raw reply related

* [PATCH 06/13] ath10k: drop the fw versioning sanity check
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

It was corrupted and leading to compilation warning
core.c: In function 'ath10k_check_fw_version':
core.c:79: warning: comparison is always true due to limited range of data type

Since we are going to support new FW track in the driver,
the sanity check for fw version number would be an overkill
then. This is just for information purposes anyway.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.c |   25 -------------------------
 drivers/net/wireless/ath/ath10k/hw.h   |    6 ------
 2 files changed, 31 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 76906d5..31860a6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -59,27 +59,6 @@ static void ath10k_send_suspend_complete(struct ath10k *ar)
 	wake_up(&ar->event_queue);
 }
 
-static int ath10k_check_fw_version(struct ath10k *ar)
-{
-	char version[32];
-
-	if (ar->fw_version_major >= SUPPORTED_FW_MAJOR &&
-	    ar->fw_version_minor >= SUPPORTED_FW_MINOR &&
-	    ar->fw_version_release >= SUPPORTED_FW_RELEASE &&
-	    ar->fw_version_build >= SUPPORTED_FW_BUILD)
-		return 0;
-
-	snprintf(version, sizeof(version), "%u.%u.%u.%u",
-		 SUPPORTED_FW_MAJOR, SUPPORTED_FW_MINOR,
-		 SUPPORTED_FW_RELEASE, SUPPORTED_FW_BUILD);
-
-	ath10k_warn("WARNING: Firmware version %s is not officially supported.\n",
-		    ar->hw->wiphy->fw_version);
-	ath10k_warn("Please upgrade to version %s (or newer)\n", version);
-
-	return 0;
-}
-
 static int ath10k_init_connect_htc(struct ath10k *ar)
 {
 	int status;
@@ -616,10 +595,6 @@ int ath10k_core_start(struct ath10k *ar)
 
 	ath10k_info("firmware %s booted\n", ar->hw->wiphy->fw_version);
 
-	status = ath10k_check_fw_version(ar);
-	if (status)
-		goto err_disconnect_htc;
-
 	status = ath10k_wmi_cmd_init(ar);
 	if (status) {
 		ath10k_err("could not send WMI init command (%d)\n", status);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 643f0c9..1b3cf01 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -20,12 +20,6 @@
 
 #include "targaddrs.h"
 
-/* Supported FW version */
-#define SUPPORTED_FW_MAJOR	1
-#define SUPPORTED_FW_MINOR	0
-#define SUPPORTED_FW_RELEASE	0
-#define SUPPORTED_FW_BUILD	636
-
 /* QCA988X 1.0 definitions (unsupported) */
 #define QCA988X_HW_1_0_CHIP_ID_REV	0x0
 
-- 
1.7.10


^ permalink raw reply related

* [PATCH 05/13] ath10k: split ath10k_wmi_service_ready_event_rx
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

Since the both firmwares we are going to support,
have significantly different APIs (WMI and shared
structures), it's easier to actually split the whole
event handling functions, instead cutting them inside.

The fork starts now on ath10k_wmi_process_rx().

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |   66 ++++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h |   40 ++++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 7bbe51f..f87e79a 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1309,6 +1309,70 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
 	complete(&ar->wmi.service_ready);
 }
 
+static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
+						  struct sk_buff *skb)
+{
+	struct wmi_service_ready_event_10x *ev = (void *)skb->data;
+
+	if (skb->len < sizeof(*ev)) {
+		ath10k_warn("Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
+			    skb->len, sizeof(*ev));
+		return;
+	}
+
+	ar->hw_min_tx_power = __le32_to_cpu(ev->hw_min_tx_power);
+	ar->hw_max_tx_power = __le32_to_cpu(ev->hw_max_tx_power);
+	ar->ht_cap_info = __le32_to_cpu(ev->ht_cap_info);
+	ar->vht_cap_info = __le32_to_cpu(ev->vht_cap_info);
+	ar->fw_version_major =
+		(__le32_to_cpu(ev->sw_version) & 0xff000000) >> 24;
+	ar->fw_version_minor = (__le32_to_cpu(ev->sw_version) & 0x00ffffff);
+	ar->phy_capability = __le32_to_cpu(ev->phy_capability);
+	ar->num_rf_chains = __le32_to_cpu(ev->num_rf_chains);
+
+	if (ar->num_rf_chains > WMI_MAX_SPATIAL_STREAM) {
+		ath10k_warn("hardware advertises support for more spatial streams than it should (%d > %d)\n",
+			    ar->num_rf_chains, WMI_MAX_SPATIAL_STREAM);
+		ar->num_rf_chains = WMI_MAX_SPATIAL_STREAM;
+	}
+
+	ar->ath_common.regulatory.current_rd =
+		__le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd);
+
+	ath10k_debug_read_service_map(ar, ev->wmi_service_bitmap,
+				      sizeof(ev->wmi_service_bitmap));
+
+	if (strlen(ar->hw->wiphy->fw_version) == 0) {
+		snprintf(ar->hw->wiphy->fw_version,
+			 sizeof(ar->hw->wiphy->fw_version),
+			 "%u.%u",
+			 ar->fw_version_major,
+			 ar->fw_version_minor);
+	}
+
+	/* FIXME: it probably should be better to support this.
+	   TODO: Next patch introduce memory chunks. It's a must for 10.x FW */
+	if (__le32_to_cpu(ev->num_mem_reqs) > 0) {
+		ath10k_warn("target requested %d memory chunks; ignoring\n",
+			    __le32_to_cpu(ev->num_mem_reqs));
+	}
+
+	ath10k_dbg(ATH10K_DBG_WMI,
+		   "wmi event service ready sw_ver 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n",
+		   __le32_to_cpu(ev->sw_version),
+		   __le32_to_cpu(ev->abi_version),
+		   __le32_to_cpu(ev->phy_capability),
+		   __le32_to_cpu(ev->ht_cap_info),
+		   __le32_to_cpu(ev->vht_cap_info),
+		   __le32_to_cpu(ev->vht_supp_mcs),
+		   __le32_to_cpu(ev->sys_cap_info),
+		   __le32_to_cpu(ev->num_mem_reqs),
+		   __le32_to_cpu(ev->num_rf_chains));
+
+	complete(&ar->wmi.service_ready);
+}
+
+
 static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct wmi_ready_event *ev = (struct wmi_ready_event *)skb->data;
@@ -1545,7 +1609,7 @@ static void ath10k_wmi_10x_process_rx(struct ath10k *ar, struct sk_buff *skb)
 		ath10k_wmi_event_vdev_resume_req(ar, skb);
 		break;
 	case WMI_10X_SERVICE_READY_EVENTID:
-		ath10k_wmi_service_ready_event_rx(ar, skb);
+		ath10k_wmi_10x_service_ready_event_rx(ar, skb);
 		break;
 	case WMI_10X_READY_EVENTID:
 		ath10k_wmi_ready_event_rx(ar, skb);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index c23d070..d309b8b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1130,6 +1130,46 @@ struct wmi_service_ready_event {
 	struct wlan_host_mem_req mem_reqs[1];
 } __packed;
 
+/* This is the definition from 10.X firmware branch */
+struct wmi_service_ready_event_10x {
+	__le32 sw_version;
+	__le32 abi_version;
+
+	/* WMI_PHY_CAPABILITY */
+	__le32 phy_capability;
+
+	/* Maximum number of frag table entries that SW will populate less 1 */
+	__le32 max_frag_entry;
+	__le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
+	__le32 num_rf_chains;
+
+	/*
+	 * The following field is only valid for service type
+	 * WMI_SERVICE_11AC
+	 */
+	__le32 ht_cap_info; /* WMI HT Capability */
+	__le32 vht_cap_info; /* VHT capability info field of 802.11ac */
+	__le32 vht_supp_mcs; /* VHT Supported MCS Set field Rx/Tx same */
+	__le32 hw_min_tx_power;
+	__le32 hw_max_tx_power;
+
+	struct hal_reg_capabilities hal_reg_capabilities;
+
+	__le32 sys_cap_info;
+	__le32 min_pkt_size_enable; /* Enterprise mode short pkt enable */
+
+	/*
+	 * request to host to allocate a chuck of memory and pss it down to FW
+	 * via WM_INIT. FW uses this as FW extesnsion memory for saving its
+	 * data structures. Only valid for low latency interfaces like PCIE
+	 * where FW can access this memory directly (or) by DMA.
+	 */
+	__le32 num_mem_reqs;
+
+	struct wlan_host_mem_req mem_reqs[1];
+} __packed;
+
+
 #define WMI_SERVICE_READY_TIMEOUT_HZ (5*HZ)
 #define WMI_UNIFIED_READY_TIMEOUT_HZ (5*HZ)
 
-- 
1.7.10


^ permalink raw reply related

* [PATCH 04/13] ath10k: implement WMI events handling frame for both firmwares
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

We still use the same function handlers for both main and 10.X
paths. Next step is to track down and make the split needed.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |  131 ++++++++++++++++++++++++++++++++-
 1 file changed, 130 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ed137b8..7bbe51f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1220,6 +1220,24 @@ static void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar,
 	ath10k_dbg(ATH10K_DBG_WMI, "WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID\n");
 }
 
+static void ath10k_wmi_event_inst_rssi_stats(struct ath10k *ar,
+					     struct sk_buff *skb)
+{
+	ath10k_dbg(ATH10K_DBG_WMI, "WMI_INST_RSSI_STATS_EVENTID\n");
+}
+
+static void ath10k_wmi_event_vdev_standby_req(struct ath10k *ar,
+					      struct sk_buff *skb)
+{
+	ath10k_dbg(ATH10K_DBG_WMI, "WMI_VDEV_STANDBY_REQ_EVENTID\n");
+}
+
+static void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar,
+					     struct sk_buff *skb)
+{
+	ath10k_dbg(ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n");
+}
+
 static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
 					      struct sk_buff *skb)
 {
@@ -1430,10 +1448,121 @@ static void ath10k_wmi_main_process_rx(struct ath10k *ar, struct sk_buff *skb)
 	dev_kfree_skb(skb);
 }
 
+static void ath10k_wmi_10x_process_rx(struct ath10k *ar, struct sk_buff *skb)
+{
+	struct wmi_cmd_hdr *cmd_hdr;
+	enum wmi_10x_event_id id;
+	u16 len;
+
+	cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
+	id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
+
+	if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
+		return;
+
+	len = skb->len;
+
+	trace_ath10k_wmi_event(id, skb->data, skb->len);
+
+	switch (id) {
+	case WMI_10X_MGMT_RX_EVENTID:
+		ath10k_wmi_event_mgmt_rx(ar, skb);
+		/* mgmt_rx() owns the skb now! */
+		return;
+	case WMI_10X_SCAN_EVENTID:
+		ath10k_wmi_event_scan(ar, skb);
+		break;
+	case WMI_10X_CHAN_INFO_EVENTID:
+		ath10k_wmi_event_chan_info(ar, skb);
+		break;
+	case WMI_10X_ECHO_EVENTID:
+		ath10k_wmi_event_echo(ar, skb);
+		break;
+	case WMI_10X_DEBUG_MESG_EVENTID:
+		ath10k_wmi_event_debug_mesg(ar, skb);
+		break;
+	case WMI_10X_UPDATE_STATS_EVENTID:
+		ath10k_wmi_event_update_stats(ar, skb);
+		break;
+	case WMI_10X_VDEV_START_RESP_EVENTID:
+		ath10k_wmi_event_vdev_start_resp(ar, skb);
+		break;
+	case WMI_10X_VDEV_STOPPED_EVENTID:
+		ath10k_wmi_event_vdev_stopped(ar, skb);
+		break;
+	case WMI_10X_PEER_STA_KICKOUT_EVENTID:
+		ath10k_wmi_event_peer_sta_kickout(ar, skb);
+		break;
+	case WMI_10X_HOST_SWBA_EVENTID:
+		ath10k_wmi_event_host_swba(ar, skb);
+		break;
+	case WMI_10X_TBTTOFFSET_UPDATE_EVENTID:
+		ath10k_wmi_event_tbttoffset_update(ar, skb);
+		break;
+	case WMI_10X_PHYERR_EVENTID:
+		ath10k_wmi_event_phyerr(ar, skb);
+		break;
+	case WMI_10X_ROAM_EVENTID:
+		ath10k_wmi_event_roam(ar, skb);
+		break;
+	case WMI_10X_PROFILE_MATCH:
+		ath10k_wmi_event_profile_match(ar, skb);
+		break;
+	case WMI_10X_DEBUG_PRINT_EVENTID:
+		ath10k_wmi_event_debug_print(ar, skb);
+		break;
+	case WMI_10X_PDEV_QVIT_EVENTID:
+		ath10k_wmi_event_pdev_qvit(ar, skb);
+		break;
+	case WMI_10X_WLAN_PROFILE_DATA_EVENTID:
+		ath10k_wmi_event_wlan_profile_data(ar, skb);
+		break;
+	case WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID:
+		ath10k_wmi_event_rtt_measurement_report(ar, skb);
+		break;
+	case WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID:
+		ath10k_wmi_event_tsf_measurement_report(ar, skb);
+		break;
+	case WMI_10X_RTT_ERROR_REPORT_EVENTID:
+		ath10k_wmi_event_rtt_error_report(ar, skb);
+		break;
+	case WMI_10X_WOW_WAKEUP_HOST_EVENTID:
+		ath10k_wmi_event_wow_wakeup_host(ar, skb);
+		break;
+	case WMI_10X_DCS_INTERFERENCE_EVENTID:
+		ath10k_wmi_event_dcs_interference(ar, skb);
+		break;
+	case WMI_10X_PDEV_TPC_CONFIG_EVENTID:
+		ath10k_wmi_event_pdev_tpc_config(ar, skb);
+		break;
+	case WMI_10X_INST_RSSI_STATS_EVENTID:
+		ath10k_wmi_event_inst_rssi_stats(ar, skb);
+		break;
+	case WMI_10X_VDEV_STANDBY_REQ_EVENTID:
+		ath10k_wmi_event_vdev_standby_req(ar, skb);
+		break;
+	case WMI_10X_VDEV_RESUME_REQ_EVENTID:
+		ath10k_wmi_event_vdev_resume_req(ar, skb);
+		break;
+	case WMI_10X_SERVICE_READY_EVENTID:
+		ath10k_wmi_service_ready_event_rx(ar, skb);
+		break;
+	case WMI_10X_READY_EVENTID:
+		ath10k_wmi_ready_event_rx(ar, skb);
+		break;
+	default:
+		ath10k_warn("Unknown eventid: %d\n", id);
+		break;
+	}
+
+	dev_kfree_skb(skb);
+}
+
+
 static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features))
-		ath10k_warn("Firmware 10.X is not yet supported\n");
+		ath10k_wmi_10x_process_rx(ar, skb);
 	else
 		ath10k_wmi_main_process_rx(ar, skb);
 }
-- 
1.7.10


^ permalink raw reply related

* [PATCH 07/13] ath10k: implement host memory chunks
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

10.X firmware can request a memory pool from host to offload
it's own resources. This is a feature designed especially
for AP mode where the target has to deal with large number
of peers.

So we allocate and map a consistent DMA memory which FW can
use to store e.g. peer rate contol maps.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |   12 +++
 drivers/net/wireless/ath/ath10k/wmi.c  |  128 ++++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.h  |    3 +
 3 files changed, 135 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 0db08ea..0c9e6f3 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -102,12 +102,24 @@ struct ath10k_bmi {
 	bool done_sent;
 };
 
+#define ATH10K_MAX_MEM_REQS 16
+
+struct ath10k_mem_chunk {
+	void *vaddr;
+	dma_addr_t paddr;
+	u32 len;
+	u32 req_id;
+};
+
 struct ath10k_wmi {
 	enum ath10k_htc_ep_id eid;
 	struct completion service_ready;
 	struct completion unified_ready;
 	wait_queue_head_t tx_credits_wq;
 	struct wmi_cmd_map *cmd;
+
+	u32 num_mem_chunks;
+	struct ath10k_mem_chunk mem_chunks[ATH10K_MAX_MEM_REQS];
 };
 
 struct ath10k_peer_stat {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f87e79a..3b1ae88 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -1238,6 +1238,37 @@ static void ath10k_wmi_event_vdev_resume_req(struct ath10k *ar,
 	ath10k_dbg(ATH10K_DBG_WMI, "WMI_VDEV_RESUME_REQ_EVENTID\n");
 }
 
+static int ath10k_wmi_alloc_host_mem(struct ath10k *ar, u32 req_id,
+				      u32 num_units, u32 unit_len)
+{
+	dma_addr_t paddr;
+	u32 pool_size;
+	int idx = ar->wmi.num_mem_chunks;
+
+	pool_size = num_units * round_up(unit_len, 4);
+
+	if (!pool_size)
+		return -EINVAL;
+
+	ar->wmi.mem_chunks[idx].vaddr = dma_alloc_coherent(ar->dev,
+							   pool_size,
+							   &paddr,
+							   GFP_ATOMIC);
+	if (!ar->wmi.mem_chunks[idx].vaddr) {
+		ath10k_warn("failed to allocate memory chunk\n");
+		return -ENOMEM;
+	}
+
+	memset(ar->wmi.mem_chunks[idx].vaddr, 0, pool_size);
+
+	ar->wmi.mem_chunks[idx].paddr = paddr;
+	ar->wmi.mem_chunks[idx].len = pool_size;
+	ar->wmi.mem_chunks[idx].req_id = req_id;
+	ar->wmi.num_mem_chunks++;
+
+	return 0;
+}
+
 static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
 					      struct sk_buff *skb)
 {
@@ -1312,6 +1343,8 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
 static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
 						  struct sk_buff *skb)
 {
+	u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i;
+	int ret;
 	struct wmi_service_ready_event_10x *ev = (void *)skb->data;
 
 	if (skb->len < sizeof(*ev)) {
@@ -1350,13 +1383,52 @@ static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
 			 ar->fw_version_minor);
 	}
 
-	/* FIXME: it probably should be better to support this.
-	   TODO: Next patch introduce memory chunks. It's a must for 10.x FW */
-	if (__le32_to_cpu(ev->num_mem_reqs) > 0) {
-		ath10k_warn("target requested %d memory chunks; ignoring\n",
-			    __le32_to_cpu(ev->num_mem_reqs));
+	num_mem_reqs = __le32_to_cpu(ev->num_mem_reqs);
+
+	if (num_mem_reqs > ATH10K_MAX_MEM_REQS) {
+		ath10k_warn("requested memory chunks number (%d) exceeds the limit\n",
+			    num_mem_reqs);
+		return;
+	}
+
+	if (!num_mem_reqs)
+		goto exit;
+
+	ath10k_dbg(ATH10K_DBG_WMI, "firmware has requested %d memory chunks\n",
+		   num_mem_reqs);
+
+	for (i = 0; i < num_mem_reqs; ++i) {
+		req_id = __le32_to_cpu(ev->mem_reqs[i].req_id);
+		num_units = __le32_to_cpu(ev->mem_reqs[i].num_units);
+		unit_size = __le32_to_cpu(ev->mem_reqs[i].unit_size);
+		num_unit_info = __le32_to_cpu(ev->mem_reqs[i].num_unit_info);
+
+		if (num_unit_info) {
+			if (num_unit_info & NUM_UNITS_IS_NUM_PEERS)
+				/* number of units to allocate is number of
+				 * peers, 1 extra for self peer on target */
+				/* this needs to be tied, host and target
+				 * can get out of sync */
+				num_units = TARGET_NUM_PEERS + 1;
+			if (num_unit_info & NUM_UNITS_IS_NUM_VDEVS)
+				num_units = TARGET_NUM_VDEVS + 1;
+		}
+
+		ath10k_dbg(ATH10K_DBG_WMI,
+			   "wmi mem_req_id %d num_units %d num_unit_info %d unit size %d actual units %d\n",
+			   req_id,
+			   __le32_to_cpu(ev->mem_reqs[i].num_units),
+			   num_unit_info,
+			   unit_size,
+			   num_units);
+
+		ret = ath10k_wmi_alloc_host_mem(ar, req_id, num_units,
+						unit_size);
+		if (ret)
+			return;
 	}
 
+exit:
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi event service ready sw_ver 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n",
 		   __le32_to_cpu(ev->sw_version),
@@ -1654,6 +1726,17 @@ int ath10k_wmi_attach(struct ath10k *ar)
 
 void ath10k_wmi_detach(struct ath10k *ar)
 {
+	int i;
+
+	/* free the host memory chunks requested by firmware */
+	for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
+		dma_free_coherent(ar->dev,
+				  ar->wmi.mem_chunks[i].len,
+				  ar->wmi.mem_chunks[i].vaddr,
+				  ar->wmi.mem_chunks[i].paddr);
+	}
+
+	ar->wmi.num_mem_chunks = 0;
 }
 
 int ath10k_wmi_connect_htc_service(struct ath10k *ar)
@@ -1793,7 +1876,8 @@ int ath10k_wmi_cmd_init(struct ath10k *ar)
 	struct wmi_init_cmd *cmd;
 	struct sk_buff *buf;
 	struct wmi_resource_config config = {};
-	u32 val;
+	u32 len, val;
+	int i;
 
 	config.num_vdevs = __cpu_to_le32(TARGET_NUM_VDEVS);
 	config.num_peers = __cpu_to_le32(TARGET_NUM_PEERS + TARGET_NUM_VDEVS);
@@ -1846,12 +1930,40 @@ int ath10k_wmi_cmd_init(struct ath10k *ar)
 	config.num_msdu_desc = __cpu_to_le32(TARGET_NUM_MSDU_DESC);
 	config.max_frag_entries = __cpu_to_le32(TARGET_MAX_FRAG_ENTRIES);
 
-	buf = ath10k_wmi_alloc_skb(sizeof(*cmd));
+	len = sizeof(*cmd) +
+	      (sizeof(struct host_memory_chunk) * ar->wmi.num_mem_chunks);
+
+	buf = ath10k_wmi_alloc_skb(len);
 	if (!buf)
 		return -ENOMEM;
 
 	cmd = (struct wmi_init_cmd *)buf->data;
-	cmd->num_host_mem_chunks = 0;
+
+	if (ar->wmi.num_mem_chunks == 0) {
+		cmd->num_host_mem_chunks = 0;
+		goto out;
+	}
+
+	ath10k_dbg(ATH10K_DBG_WMI, "wmi sending %d memory chunks info.\n",
+		   __cpu_to_le32(ar->wmi.num_mem_chunks));
+
+	cmd->num_host_mem_chunks = __cpu_to_le32(ar->wmi.num_mem_chunks);
+
+	for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
+		cmd->host_mem_chunks[i].ptr =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].paddr);
+		cmd->host_mem_chunks[i].size =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].len);
+		cmd->host_mem_chunks[i].req_id =
+			__cpu_to_le32(ar->wmi.mem_chunks[i].req_id);
+
+		ath10k_dbg(ATH10K_DBG_WMI,
+			   "wmi chunk %d len %d requested, addr 0x%x\n",
+			   i,
+			   cmd->host_mem_chunks[i].size,
+			   cmd->host_mem_chunks[i].ptr);
+	}
+out:
 	memcpy(&cmd->resource_config, &config, sizeof(config));
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi init\n");
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index d309b8b..3825937 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -1377,6 +1377,9 @@ struct wmi_resource_config {
 	__le32 max_frag_entries;
 } __packed;
 
+#define NUM_UNITS_IS_NUM_VDEVS   0x1
+#define NUM_UNITS_IS_NUM_PEERS   0x2
+
 /* strucutre describing host memory chunk. */
 struct host_memory_chunk {
 	/* id of the request that is passed up in service ready */
-- 
1.7.10


^ permalink raw reply related

* [PATCH 02/13] ath10k: add wmi_10x_<cmd/event> definitions
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

Introduce the cmd and events definitions for 10.X FW API
and make up the wmi_10x_cmd_map. This is the core of
host-firmware WMI interface for 10.X FW branch.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |  132 +++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/wmi.h |  215 ++++++++++++++++++++++++++++++++-
 2 files changed, 344 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 9cf426f..dd490b4 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -146,7 +146,133 @@ static struct wmi_cmd_map wmi_cmd_map = {
 	.wmi_gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID,
 };
 
-/* TODO: 10.X WMI cmd track */
+/* 10.X WMI cmd track */
+static struct wmi_cmd_map wmi_10x_cmd_map = {
+	.wmi_init_cmdid = WMI_10X_INIT_CMDID,
+	.wmi_start_scan_cmdid = WMI_10X_START_SCAN_CMDID,
+	.wmi_stop_scan_cmdid = WMI_10X_STOP_SCAN_CMDID,
+	.wmi_scan_chan_list_cmdid = WMI_10X_SCAN_CHAN_LIST_CMDID,
+	.wmi_scan_sch_prio_tbl_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_pdev_set_regdomain_cmdid = WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
+	.wmi_pdev_set_channel_cmdid = WMI_10X_PDEV_SET_CHANNEL_CMDID,
+	.wmi_pdev_set_param_cmdid = WMI_10X_PDEV_SET_PARAM_CMDID,
+	.wmi_pdev_pktlog_enable_cmdid = WMI_10X_PDEV_PKTLOG_ENABLE_CMDID,
+	.wmi_pdev_pktlog_disable_cmdid = WMI_10X_PDEV_PKTLOG_DISABLE_CMDID,
+	.wmi_pdev_set_wmm_params_cmdid = WMI_10X_PDEV_SET_WMM_PARAMS_CMDID,
+	.wmi_pdev_set_ht_cap_ie_cmdid = WMI_10X_PDEV_SET_HT_CAP_IE_CMDID,
+	.wmi_pdev_set_vht_cap_ie_cmdid = WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID,
+	.wmi_pdev_set_dscp_tid_map_cmdid =
+				WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID,
+	.wmi_pdev_set_quiet_mode_cmdid = WMI_10X_PDEV_SET_QUIET_MODE_CMDID,
+	.wmi_pdev_green_ap_ps_enable_cmdid =
+				WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID,
+	.wmi_pdev_get_tpc_config_cmdid = WMI_10X_PDEV_GET_TPC_CONFIG_CMDID,
+	.wmi_pdev_set_base_macaddr_cmdid =
+				WMI_10X_PDEV_SET_BASE_MACADDR_CMDID,
+	.wmi_vdev_create_cmdid = WMI_10X_VDEV_CREATE_CMDID,
+	.wmi_vdev_delete_cmdid = WMI_10X_VDEV_DELETE_CMDID,
+	.wmi_vdev_start_request_cmdid = WMI_10X_VDEV_START_REQUEST_CMDID,
+	.wmi_vdev_restart_request_cmdid = WMI_10X_VDEV_RESTART_REQUEST_CMDID,
+	.wmi_vdev_up_cmdid = WMI_10X_VDEV_UP_CMDID,
+	.wmi_vdev_stop_cmdid = WMI_10X_VDEV_STOP_CMDID,
+	.wmi_vdev_down_cmdid = WMI_10X_VDEV_DOWN_CMDID,
+	.wmi_vdev_set_param_cmdid = WMI_10X_VDEV_SET_PARAM_CMDID,
+	.wmi_vdev_install_key_cmdid = WMI_10X_VDEV_INSTALL_KEY_CMDID,
+	.wmi_peer_create_cmdid = WMI_10X_PEER_CREATE_CMDID,
+	.wmi_peer_delete_cmdid = WMI_10X_PEER_DELETE_CMDID,
+	.wmi_peer_flush_tids_cmdid = WMI_10X_PEER_FLUSH_TIDS_CMDID,
+	.wmi_peer_set_param_cmdid = WMI_10X_PEER_SET_PARAM_CMDID,
+	.wmi_peer_assoc_cmdid = WMI_10X_PEER_ASSOC_CMDID,
+	.wmi_peer_add_wds_entry_cmdid = WMI_10X_PEER_ADD_WDS_ENTRY_CMDID,
+	.wmi_peer_remove_wds_entry_cmdid =
+				WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID,
+	.wmi_peer_mcast_group_cmdid = WMI_10X_PEER_MCAST_GROUP_CMDID,
+	.wmi_bcn_tx_cmdid = WMI_10X_BCN_TX_CMDID,
+	.wmi_pdev_send_bcn_cmdid = WMI_10X_PDEV_SEND_BCN_CMDID,
+	.wmi_bcn_tmpl_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_bcn_filter_rx_cmdid = WMI_10X_BCN_FILTER_RX_CMDID,
+	.wmi_prb_req_filter_rx_cmdid = WMI_10X_PRB_REQ_FILTER_RX_CMDID,
+	.wmi_mgmt_tx_cmdid = WMI_10X_MGMT_TX_CMDID,
+	.wmi_prb_tmpl_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_addba_clear_resp_cmdid = WMI_10X_ADDBA_CLEAR_RESP_CMDID,
+	.wmi_addba_send_cmdid = WMI_10X_ADDBA_SEND_CMDID,
+	.wmi_addba_status_cmdid = WMI_10X_ADDBA_STATUS_CMDID,
+	.wmi_delba_send_cmdid = WMI_10X_DELBA_SEND_CMDID,
+	.wmi_addba_set_resp_cmdid = WMI_10X_ADDBA_SET_RESP_CMDID,
+	.wmi_send_singleamsdu_cmdid = WMI_10X_SEND_SINGLEAMSDU_CMDID,
+	.wmi_sta_powersave_mode_cmdid = WMI_10X_STA_POWERSAVE_MODE_CMDID,
+	.wmi_sta_powersave_param_cmdid = WMI_10X_STA_POWERSAVE_PARAM_CMDID,
+	.wmi_sta_mimo_ps_mode_cmdid = WMI_10X_STA_MIMO_PS_MODE_CMDID,
+	.wmi_pdev_dfs_enable_cmdid = WMI_10X_PDEV_DFS_ENABLE_CMDID,
+	.wmi_pdev_dfs_disable_cmdid = WMI_10X_PDEV_DFS_DISABLE_CMDID,
+	.wmi_roam_scan_mode = WMI_10X_ROAM_SCAN_MODE,
+	.wmi_roam_scan_rssi_threshold = WMI_10X_ROAM_SCAN_RSSI_THRESHOLD,
+	.wmi_roam_scan_period = WMI_10X_ROAM_SCAN_PERIOD,
+	.wmi_roam_scan_rssi_change_threshold
+				= WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
+	.wmi_roam_ap_profile = WMI_10X_ROAM_AP_PROFILE,
+	.wmi_ofl_scan_add_ap_profile = WMI_10X_OFL_SCAN_ADD_AP_PROFILE,
+	.wmi_ofl_scan_remove_ap_profile = WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE,
+	.wmi_ofl_scan_period = WMI_10X_OFL_SCAN_PERIOD,
+	.wmi_p2p_dev_set_device_info = WMI_10X_P2P_DEV_SET_DEVICE_INFO,
+	.wmi_p2p_dev_set_discoverability =
+					WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
+	.wmi_p2p_go_set_beacon_ie = WMI_10X_P2P_GO_SET_BEACON_IE,
+	.wmi_p2p_go_set_probe_resp_ie = WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
+	.wmi_p2p_set_vendor_ie_data_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_ap_ps_peer_param_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_ap_ps_peer_uapsd_coex_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_peer_rate_retry_sched_cmdid =
+					WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
+	.wmi_wlan_profile_trigger_cmdid = WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
+	.wmi_wlan_profile_set_hist_intvl_cmdid =
+				WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
+	.wmi_wlan_profile_get_profile_data_cmdid =
+				WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
+	.wmi_wlan_profile_enable_profile_id_cmdid =
+				WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
+	.wmi_wlan_profile_list_profile_id_cmdid =
+				WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
+	.wmi_pdev_suspend_cmdid = WMI_10X_PDEV_SUSPEND_CMDID,
+	.wmi_pdev_resume_cmdid = WMI_10X_PDEV_RESUME_CMDID,
+	.wmi_add_bcn_filter_cmdid = WMI_10X_ADD_BCN_FILTER_CMDID,
+	.wmi_rmv_bcn_filter_cmdid = WMI_10X_RMV_BCN_FILTER_CMDID,
+	.wmi_wow_add_wake_pattern_cmdid = WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID,
+	.wmi_wow_del_wake_pattern_cmdid = WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID,
+	.wmi_wow_enable_disable_wake_event_cmdid =
+				WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
+	.wmi_wow_enable_cmdid = WMI_10X_WOW_ENABLE_CMDID,
+	.wmi_wow_hostwakeup_from_sleep_cmdid =
+				WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
+	.wmi_rtt_measreq_cmdid = WMI_10X_RTT_MEASREQ_CMDID,
+	.wmi_rtt_tsf_cmdid = WMI_10X_RTT_TSF_CMDID,
+	.wmi_vdev_spectral_scan_configure_cmdid =
+				WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
+	.wmi_vdev_spectral_scan_enable_cmdid =
+				WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
+	.wmi_request_stats_cmdid = WMI_10X_REQUEST_STATS_CMDID,
+	.wmi_set_arp_ns_offload_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_network_list_offload_config_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_gtk_offload_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_csa_offload_enable_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_csa_offload_chanswitch_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_chatter_set_mode_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_peer_tid_addba_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_peer_tid_delba_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_sta_dtim_ps_method_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_sta_uapsd_auto_trig_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_sta_keepalive_cmd = WMI_CMD_UNDEFINED,
+	.wmi_echo_cmdid = WMI_10X_ECHO_CMDID,
+	.wmi_pdev_utf_cmdid = WMI_10X_PDEV_UTF_CMDID,
+	.wmi_dbglog_cfg_cmdid = WMI_10X_DBGLOG_CFG_CMDID,
+	.wmi_pdev_qvit_cmdid = WMI_10X_PDEV_QVIT_CMDID,
+	.wmi_pdev_ftm_intg_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_vdev_set_keepalive_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_vdev_get_keepalive_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_force_fw_hang_cmdid = WMI_CMD_UNDEFINED,
+	.wmi_gpio_config_cmdid = WMI_10X_GPIO_CONFIG_CMDID,
+	.wmi_gpio_output_cmdid = WMI_10X_GPIO_OUTPUT_CMDID,
+};
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
@@ -1310,13 +1436,15 @@ static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
 /* WMI Initialization functions */
 int ath10k_wmi_attach(struct ath10k *ar)
 {
-	int ret = 0;
+	int ret;
 
 	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features)) {
 		ath10k_warn("Firmware 10.X is not yet supported\n");
+		ar->wmi.cmd = &wmi_10x_cmd_map;
 		ret = -ENOTSUPP;
 	} else {
 		ar->wmi.cmd = &wmi_cmd_map;
+		ret = 0;
 	}
 
 	init_completion(&ar->wmi.service_ready);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 94fc008..c23d070 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -359,7 +359,9 @@ enum wmi_cmd_group {
 #define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
 #define WMI_EVT_GRP_START_ID(grp_id) (((grp_id) << 12) | 0x1)
 
-/* Command IDs and commande events. */
+#define WMI_CMD_UNDEFINED 0
+
+/* Command IDs and command events for MAIN FW. */
 enum wmi_cmd_id {
 	WMI_INIT_CMDID = 0x1,
 
@@ -600,6 +602,217 @@ enum wmi_event_id {
 	WMI_GPIO_INPUT_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_GPIO),
 };
 
+/* Command IDs and command events for 10.X firmware */
+enum wmi_10x_cmd_id {
+	WMI_10X_START_CMDID = 0x9000,
+	WMI_10X_END_CMDID = 0x9FFF,
+
+	/* initialize the wlan sub system */
+	WMI_10X_INIT_CMDID,
+
+	/* Scan specific commands */
+
+	WMI_10X_START_SCAN_CMDID = WMI_10X_START_CMDID,
+	WMI_10X_STOP_SCAN_CMDID,
+	WMI_10X_SCAN_CHAN_LIST_CMDID,
+	WMI_10X_ECHO_CMDID,
+
+	/* PDEV(physical device) specific commands */
+	WMI_10X_PDEV_SET_REGDOMAIN_CMDID,
+	WMI_10X_PDEV_SET_CHANNEL_CMDID,
+	WMI_10X_PDEV_SET_PARAM_CMDID,
+	WMI_10X_PDEV_PKTLOG_ENABLE_CMDID,
+	WMI_10X_PDEV_PKTLOG_DISABLE_CMDID,
+	WMI_10X_PDEV_SET_WMM_PARAMS_CMDID,
+	WMI_10X_PDEV_SET_HT_CAP_IE_CMDID,
+	WMI_10X_PDEV_SET_VHT_CAP_IE_CMDID,
+	WMI_10X_PDEV_SET_BASE_MACADDR_CMDID,
+	WMI_10X_PDEV_SET_DSCP_TID_MAP_CMDID,
+	WMI_10X_PDEV_SET_QUIET_MODE_CMDID,
+	WMI_10X_PDEV_GREEN_AP_PS_ENABLE_CMDID,
+	WMI_10X_PDEV_GET_TPC_CONFIG_CMDID,
+
+	/* VDEV(virtual device) specific commands */
+	WMI_10X_VDEV_CREATE_CMDID,
+	WMI_10X_VDEV_DELETE_CMDID,
+	WMI_10X_VDEV_START_REQUEST_CMDID,
+	WMI_10X_VDEV_RESTART_REQUEST_CMDID,
+	WMI_10X_VDEV_UP_CMDID,
+	WMI_10X_VDEV_STOP_CMDID,
+	WMI_10X_VDEV_DOWN_CMDID,
+	WMI_10X_VDEV_STANDBY_RESPONSE_CMDID,
+	WMI_10X_VDEV_RESUME_RESPONSE_CMDID,
+	WMI_10X_VDEV_SET_PARAM_CMDID,
+	WMI_10X_VDEV_INSTALL_KEY_CMDID,
+
+	/* peer specific commands */
+	WMI_10X_PEER_CREATE_CMDID,
+	WMI_10X_PEER_DELETE_CMDID,
+	WMI_10X_PEER_FLUSH_TIDS_CMDID,
+	WMI_10X_PEER_SET_PARAM_CMDID,
+	WMI_10X_PEER_ASSOC_CMDID,
+	WMI_10X_PEER_ADD_WDS_ENTRY_CMDID,
+	WMI_10X_PEER_REMOVE_WDS_ENTRY_CMDID,
+	WMI_10X_PEER_MCAST_GROUP_CMDID,
+
+	/* beacon/management specific commands */
+
+	WMI_10X_BCN_TX_CMDID,
+	WMI_10X_BCN_PRB_TMPL_CMDID,
+	WMI_10X_BCN_FILTER_RX_CMDID,
+	WMI_10X_PRB_REQ_FILTER_RX_CMDID,
+	WMI_10X_MGMT_TX_CMDID,
+
+	/* commands to directly control ba negotiation directly from host. */
+	WMI_10X_ADDBA_CLEAR_RESP_CMDID,
+	WMI_10X_ADDBA_SEND_CMDID,
+	WMI_10X_ADDBA_STATUS_CMDID,
+	WMI_10X_DELBA_SEND_CMDID,
+	WMI_10X_ADDBA_SET_RESP_CMDID,
+	WMI_10X_SEND_SINGLEAMSDU_CMDID,
+
+	/* Station power save specific config */
+	WMI_10X_STA_POWERSAVE_MODE_CMDID,
+	WMI_10X_STA_POWERSAVE_PARAM_CMDID,
+	WMI_10X_STA_MIMO_PS_MODE_CMDID,
+
+	/* set debug log config */
+	WMI_10X_DBGLOG_CFG_CMDID,
+
+	/* DFS-specific commands */
+	WMI_10X_PDEV_DFS_ENABLE_CMDID,
+	WMI_10X_PDEV_DFS_DISABLE_CMDID,
+
+	/* QVIT specific command id */
+	WMI_10X_PDEV_QVIT_CMDID,
+
+	/* Offload Scan and Roaming related  commands */
+	WMI_10X_ROAM_SCAN_MODE,
+	WMI_10X_ROAM_SCAN_RSSI_THRESHOLD,
+	WMI_10X_ROAM_SCAN_PERIOD,
+	WMI_10X_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
+	WMI_10X_ROAM_AP_PROFILE,
+	WMI_10X_OFL_SCAN_ADD_AP_PROFILE,
+	WMI_10X_OFL_SCAN_REMOVE_AP_PROFILE,
+	WMI_10X_OFL_SCAN_PERIOD,
+
+	/* P2P specific commands */
+	WMI_10X_P2P_DEV_SET_DEVICE_INFO,
+	WMI_10X_P2P_DEV_SET_DISCOVERABILITY,
+	WMI_10X_P2P_GO_SET_BEACON_IE,
+	WMI_10X_P2P_GO_SET_PROBE_RESP_IE,
+
+	/* AP power save specific config */
+	WMI_10X_AP_PS_PEER_PARAM_CMDID,
+	WMI_10X_AP_PS_PEER_UAPSD_COEX_CMDID,
+
+	/* Rate-control specific commands */
+	WMI_10X_PEER_RATE_RETRY_SCHED_CMDID,
+
+	/* WLAN Profiling commands. */
+	WMI_10X_WLAN_PROFILE_TRIGGER_CMDID,
+	WMI_10X_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
+	WMI_10X_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
+	WMI_10X_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
+	WMI_10X_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
+
+	/* Suspend resume command Ids */
+	WMI_10X_PDEV_SUSPEND_CMDID,
+	WMI_10X_PDEV_RESUME_CMDID,
+
+	/* Beacon filter commands */
+	WMI_10X_ADD_BCN_FILTER_CMDID,
+	WMI_10X_RMV_BCN_FILTER_CMDID,
+
+	/* WOW Specific WMI commands*/
+	WMI_10X_WOW_ADD_WAKE_PATTERN_CMDID,
+	WMI_10X_WOW_DEL_WAKE_PATTERN_CMDID,
+	WMI_10X_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
+	WMI_10X_WOW_ENABLE_CMDID,
+	WMI_10X_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
+
+	/* RTT measurement related cmd */
+	WMI_10X_RTT_MEASREQ_CMDID,
+	WMI_10X_RTT_TSF_CMDID,
+
+	/* transmit beacon by value */
+	WMI_10X_PDEV_SEND_BCN_CMDID,
+
+	/* F/W stats */
+	WMI_10X_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
+	WMI_10X_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
+	WMI_10X_REQUEST_STATS_CMDID,
+
+	/* GPIO Configuration */
+	WMI_10X_GPIO_CONFIG_CMDID,
+	WMI_10X_GPIO_OUTPUT_CMDID,
+
+	WMI_10X_PDEV_UTF_CMDID = WMI_10X_END_CMDID - 1,
+};
+
+enum wmi_10x_event_id {
+	WMI_10X_SERVICE_READY_EVENTID = 0x8000,
+	WMI_10X_READY_EVENTID,
+	WMI_10X_START_EVENTID = 0x9000,
+	WMI_10X_END_EVENTID = 0x9FFF,
+
+	/* Scan specific events */
+	WMI_10X_SCAN_EVENTID = WMI_10X_START_EVENTID,
+	WMI_10X_ECHO_EVENTID,
+	WMI_10X_DEBUG_MESG_EVENTID,
+	WMI_10X_UPDATE_STATS_EVENTID,
+
+	/* Instantaneous RSSI event */
+	WMI_10X_INST_RSSI_STATS_EVENTID,
+
+	/* VDEV specific events */
+	WMI_10X_VDEV_START_RESP_EVENTID,
+	WMI_10X_VDEV_STANDBY_REQ_EVENTID,
+	WMI_10X_VDEV_RESUME_REQ_EVENTID,
+	WMI_10X_VDEV_STOPPED_EVENTID,
+
+	/* peer  specific events */
+	WMI_10X_PEER_STA_KICKOUT_EVENTID,
+
+	/* beacon/mgmt specific events */
+	WMI_10X_HOST_SWBA_EVENTID,
+	WMI_10X_TBTTOFFSET_UPDATE_EVENTID,
+	WMI_10X_MGMT_RX_EVENTID,
+
+	/* Channel stats event */
+	WMI_10X_CHAN_INFO_EVENTID,
+
+	/* PHY Error specific WMI event */
+	WMI_10X_PHYERR_EVENTID,
+
+	/* Roam event to trigger roaming on host */
+	WMI_10X_ROAM_EVENTID,
+
+	/* matching AP found from list of profiles */
+	WMI_10X_PROFILE_MATCH,
+
+	/* debug print message used for tracing FW code while debugging */
+	WMI_10X_DEBUG_PRINT_EVENTID,
+	/* VI spoecific event */
+	WMI_10X_PDEV_QVIT_EVENTID,
+	/* FW code profile data in response to profile request */
+	WMI_10X_WLAN_PROFILE_DATA_EVENTID,
+
+	/*RTT related event ID*/
+	WMI_10X_RTT_MEASUREMENT_REPORT_EVENTID,
+	WMI_10X_TSF_MEASUREMENT_REPORT_EVENTID,
+	WMI_10X_RTT_ERROR_REPORT_EVENTID,
+
+	WMI_10X_WOW_WAKEUP_HOST_EVENTID,
+	WMI_10X_DCS_INTERFERENCE_EVENTID,
+
+	/* TPC config for the current operating channel */
+	WMI_10X_PDEV_TPC_CONFIG_EVENTID,
+
+	WMI_10X_GPIO_INPUT_EVENTID,
+	WMI_10X_PDEV_UTF_EVENTID = WMI_10X_END_EVENTID-1,
+};
+
 enum wmi_phy_mode {
 	MODE_11A        = 0,   /* 11a Mode */
 	MODE_11G        = 1,   /* 11b/g Mode */
-- 
1.7.10


^ permalink raw reply related

* [PATCH 03/13] ath10k: warn if give WMI command is not supported
From: Bartosz Markowski @ 2013-09-25  9:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

This will show and make it easier to track the API
differences in the new AP firmware.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index dd490b4..ed137b8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -399,6 +399,11 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 {
 	int ret = -EINVAL;
 
+	if (cmd_id == WMI_CMD_UNDEFINED) {
+		ath10k_warn("command not supported by given firmware\n");
+		return ret;
+	}
+
 	wait_event_timeout(ar->wmi.tx_credits_wq, ({
 		/* try to send pending beacons first. they take priority */
 		ath10k_wmi_tx_beacons_nowait(ar);
-- 
1.7.10


^ permalink raw reply related

* [PATCH 01/13] ath10k: introduce dynamic WMI structures
From: Bartosz Markowski @ 2013-09-25  9:37 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski
In-Reply-To: <1380101891-18312-1-git-send-email-bartosz.markowski@tieto.com>

This is the initial framework to implement dynamic
WMI API in order to support new firmware (from so
called 10.X branch)

The realization is to have a static WMI cmd map for
each of the firmwares, registered upom wmi init.

This patch creates such map for MAIN FW, updates
wmi_cmd_send() calls to take as a parameter
the map value instead of direct WMI enum.

As soon as complete 10.X API will be on place,
we will introduce the FW IE mechanics to dynamicaly
identify which FW is being used and based on that
we will use correct map, API, structures, etc.

Signed-off-by: Bartosz Markowski <bartosz.markowski@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    4 +
 drivers/net/wireless/ath/ath10k/wmi.c  |  246 +++++++++++++++++++++++++++-----
 drivers/net/wireless/ath/ath10k/wmi.h  |  112 +++++++++++++++
 3 files changed, 323 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 292ad45..0db08ea 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -107,6 +107,7 @@ struct ath10k_wmi {
 	struct completion service_ready;
 	struct completion unified_ready;
 	wait_queue_head_t tx_credits_wq;
+	struct wmi_cmd_map *cmd;
 };
 
 struct ath10k_peer_stat {
@@ -268,6 +269,9 @@ enum ath10k_fw_features {
 	/* wmi_mgmt_rx_hdr contains extra RSSI information */
 	ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX = 0,
 
+	/* firmware from 10X branch */
+	ATH10K_FW_FEATURE_10X = 1,
+
 	/* keep last */
 	ATH10K_FW_FEATURE_COUNT,
 };
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 6803ead..9cf426f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -23,6 +23,131 @@
 #include "wmi.h"
 #include "mac.h"
 
+/* MAIN WMI cmd track */
+static struct wmi_cmd_map wmi_cmd_map = {
+	.wmi_init_cmdid = WMI_INIT_CMDID,
+	.wmi_start_scan_cmdid = WMI_START_SCAN_CMDID,
+	.wmi_stop_scan_cmdid = WMI_STOP_SCAN_CMDID,
+	.wmi_scan_chan_list_cmdid = WMI_SCAN_CHAN_LIST_CMDID,
+	.wmi_scan_sch_prio_tbl_cmdid = WMI_SCAN_SCH_PRIO_TBL_CMDID,
+	.wmi_pdev_set_regdomain_cmdid = WMI_PDEV_SET_REGDOMAIN_CMDID,
+	.wmi_pdev_set_channel_cmdid = WMI_PDEV_SET_CHANNEL_CMDID,
+	.wmi_pdev_set_param_cmdid = WMI_PDEV_SET_PARAM_CMDID,
+	.wmi_pdev_pktlog_enable_cmdid = WMI_PDEV_PKTLOG_ENABLE_CMDID,
+	.wmi_pdev_pktlog_disable_cmdid = WMI_PDEV_PKTLOG_DISABLE_CMDID,
+	.wmi_pdev_set_wmm_params_cmdid = WMI_PDEV_SET_WMM_PARAMS_CMDID,
+	.wmi_pdev_set_ht_cap_ie_cmdid = WMI_PDEV_SET_HT_CAP_IE_CMDID,
+	.wmi_pdev_set_vht_cap_ie_cmdid = WMI_PDEV_SET_VHT_CAP_IE_CMDID,
+	.wmi_pdev_set_dscp_tid_map_cmdid = WMI_PDEV_SET_DSCP_TID_MAP_CMDID,
+	.wmi_pdev_set_quiet_mode_cmdid = WMI_PDEV_SET_QUIET_MODE_CMDID,
+	.wmi_pdev_green_ap_ps_enable_cmdid = WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID,
+	.wmi_pdev_get_tpc_config_cmdid = WMI_PDEV_GET_TPC_CONFIG_CMDID,
+	.wmi_pdev_set_base_macaddr_cmdid = WMI_PDEV_SET_BASE_MACADDR_CMDID,
+	.wmi_vdev_create_cmdid = WMI_VDEV_CREATE_CMDID,
+	.wmi_vdev_delete_cmdid = WMI_VDEV_DELETE_CMDID,
+	.wmi_vdev_start_request_cmdid = WMI_VDEV_START_REQUEST_CMDID,
+	.wmi_vdev_restart_request_cmdid = WMI_VDEV_RESTART_REQUEST_CMDID,
+	.wmi_vdev_up_cmdid = WMI_VDEV_UP_CMDID,
+	.wmi_vdev_stop_cmdid = WMI_VDEV_STOP_CMDID,
+	.wmi_vdev_down_cmdid = WMI_VDEV_DOWN_CMDID,
+	.wmi_vdev_set_param_cmdid = WMI_VDEV_SET_PARAM_CMDID,
+	.wmi_vdev_install_key_cmdid = WMI_VDEV_INSTALL_KEY_CMDID,
+	.wmi_peer_create_cmdid = WMI_PEER_CREATE_CMDID,
+	.wmi_peer_delete_cmdid = WMI_PEER_DELETE_CMDID,
+	.wmi_peer_flush_tids_cmdid = WMI_PEER_FLUSH_TIDS_CMDID,
+	.wmi_peer_set_param_cmdid = WMI_PEER_SET_PARAM_CMDID,
+	.wmi_peer_assoc_cmdid = WMI_PEER_ASSOC_CMDID,
+	.wmi_peer_add_wds_entry_cmdid = WMI_PEER_ADD_WDS_ENTRY_CMDID,
+	.wmi_peer_remove_wds_entry_cmdid = WMI_PEER_REMOVE_WDS_ENTRY_CMDID,
+	.wmi_peer_mcast_group_cmdid = WMI_PEER_MCAST_GROUP_CMDID,
+	.wmi_bcn_tx_cmdid = WMI_BCN_TX_CMDID,
+	.wmi_pdev_send_bcn_cmdid = WMI_PDEV_SEND_BCN_CMDID,
+	.wmi_bcn_tmpl_cmdid = WMI_BCN_TMPL_CMDID,
+	.wmi_bcn_filter_rx_cmdid = WMI_BCN_FILTER_RX_CMDID,
+	.wmi_prb_req_filter_rx_cmdid = WMI_PRB_REQ_FILTER_RX_CMDID,
+	.wmi_mgmt_tx_cmdid = WMI_MGMT_TX_CMDID,
+	.wmi_prb_tmpl_cmdid = WMI_PRB_TMPL_CMDID,
+	.wmi_addba_clear_resp_cmdid = WMI_ADDBA_CLEAR_RESP_CMDID,
+	.wmi_addba_send_cmdid = WMI_ADDBA_SEND_CMDID,
+	.wmi_addba_status_cmdid = WMI_ADDBA_STATUS_CMDID,
+	.wmi_delba_send_cmdid = WMI_DELBA_SEND_CMDID,
+	.wmi_addba_set_resp_cmdid = WMI_ADDBA_SET_RESP_CMDID,
+	.wmi_send_singleamsdu_cmdid = WMI_SEND_SINGLEAMSDU_CMDID,
+	.wmi_sta_powersave_mode_cmdid = WMI_STA_POWERSAVE_MODE_CMDID,
+	.wmi_sta_powersave_param_cmdid = WMI_STA_POWERSAVE_PARAM_CMDID,
+	.wmi_sta_mimo_ps_mode_cmdid = WMI_STA_MIMO_PS_MODE_CMDID,
+	.wmi_pdev_dfs_enable_cmdid = WMI_PDEV_DFS_ENABLE_CMDID,
+	.wmi_pdev_dfs_disable_cmdid = WMI_PDEV_DFS_DISABLE_CMDID,
+	.wmi_roam_scan_mode = WMI_ROAM_SCAN_MODE,
+	.wmi_roam_scan_rssi_threshold = WMI_ROAM_SCAN_RSSI_THRESHOLD,
+	.wmi_roam_scan_period = WMI_ROAM_SCAN_PERIOD,
+	.wmi_roam_scan_rssi_change_threshold =
+					WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD,
+	.wmi_roam_ap_profile = WMI_ROAM_AP_PROFILE,
+	.wmi_ofl_scan_add_ap_profile = WMI_ROAM_AP_PROFILE,
+	.wmi_ofl_scan_remove_ap_profile = WMI_OFL_SCAN_REMOVE_AP_PROFILE,
+	.wmi_ofl_scan_period = WMI_OFL_SCAN_PERIOD,
+	.wmi_p2p_dev_set_device_info = WMI_P2P_DEV_SET_DEVICE_INFO,
+	.wmi_p2p_dev_set_discoverability = WMI_P2P_DEV_SET_DISCOVERABILITY,
+	.wmi_p2p_go_set_beacon_ie = WMI_P2P_DEV_SET_DISCOVERABILITY,
+	.wmi_p2p_go_set_probe_resp_ie = WMI_P2P_GO_SET_PROBE_RESP_IE,
+	.wmi_p2p_set_vendor_ie_data_cmdid = WMI_P2P_SET_VENDOR_IE_DATA_CMDID,
+	.wmi_ap_ps_peer_param_cmdid = WMI_AP_PS_PEER_PARAM_CMDID,
+	.wmi_ap_ps_peer_uapsd_coex_cmdid = WMI_AP_PS_PEER_UAPSD_COEX_CMDID,
+	.wmi_peer_rate_retry_sched_cmdid = WMI_PEER_RATE_RETRY_SCHED_CMDID,
+	.wmi_wlan_profile_trigger_cmdid = WMI_WLAN_PROFILE_TRIGGER_CMDID,
+	.wmi_wlan_profile_set_hist_intvl_cmdid =
+					 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
+	.wmi_wlan_profile_get_profile_data_cmdid =
+				 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
+	.wmi_wlan_profile_enable_profile_id_cmdid =
+				 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
+	.wmi_wlan_profile_list_profile_id_cmdid =
+				 WMI_WLAN_PROFILE_LIST_PROFILE_ID_CMDID,
+	.wmi_pdev_suspend_cmdid = WMI_PDEV_SUSPEND_CMDID,
+	.wmi_pdev_resume_cmdid = WMI_PDEV_RESUME_CMDID,
+	.wmi_add_bcn_filter_cmdid = WMI_ADD_BCN_FILTER_CMDID,
+	.wmi_rmv_bcn_filter_cmdid = WMI_RMV_BCN_FILTER_CMDID,
+	.wmi_wow_add_wake_pattern_cmdid = WMI_WOW_ADD_WAKE_PATTERN_CMDID,
+	.wmi_wow_del_wake_pattern_cmdid = WMI_WOW_DEL_WAKE_PATTERN_CMDID,
+	.wmi_wow_enable_disable_wake_event_cmdid =
+				 WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID,
+	.wmi_wow_enable_cmdid = WMI_WOW_ENABLE_CMDID,
+	.wmi_wow_hostwakeup_from_sleep_cmdid =
+				 WMI_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
+	.wmi_rtt_measreq_cmdid = WMI_RTT_MEASREQ_CMDID,
+	.wmi_rtt_tsf_cmdid = WMI_RTT_TSF_CMDID,
+	.wmi_vdev_spectral_scan_configure_cmdid =
+				 WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID,
+	.wmi_vdev_spectral_scan_enable_cmdid =
+				 WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID,
+	.wmi_request_stats_cmdid = WMI_REQUEST_STATS_CMDID,
+	.wmi_set_arp_ns_offload_cmdid = WMI_SET_ARP_NS_OFFLOAD_CMDID,
+	.wmi_network_list_offload_config_cmdid =
+				 WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID,
+	.wmi_gtk_offload_cmdid = WMI_GTK_OFFLOAD_CMDID,
+	.wmi_csa_offload_enable_cmdid = WMI_CSA_OFFLOAD_ENABLE_CMDID,
+	.wmi_csa_offload_chanswitch_cmdid = WMI_CSA_OFFLOAD_CHANSWITCH_CMDID,
+	.wmi_chatter_set_mode_cmdid = WMI_CHATTER_SET_MODE_CMDID,
+	.wmi_peer_tid_addba_cmdid = WMI_CHATTER_SET_MODE_CMDID,
+	.wmi_peer_tid_delba_cmdid = WMI_PEER_TID_DELBA_CMDID,
+	.wmi_sta_dtim_ps_method_cmdid = WMI_STA_DTIM_PS_METHOD_CMDID,
+	.wmi_sta_uapsd_auto_trig_cmdid = WMI_STA_UAPSD_AUTO_TRIG_CMDID,
+	.wmi_sta_keepalive_cmd = WMI_STA_KEEPALIVE_CMD,
+	.wmi_echo_cmdid = WMI_ECHO_CMDID,
+	.wmi_pdev_utf_cmdid = WMI_PDEV_UTF_CMDID,
+	.wmi_dbglog_cfg_cmdid = WMI_DBGLOG_CFG_CMDID,
+	.wmi_pdev_qvit_cmdid = WMI_PDEV_QVIT_CMDID,
+	.wmi_pdev_ftm_intg_cmdid = WMI_PDEV_FTM_INTG_CMDID,
+	.wmi_vdev_set_keepalive_cmdid = WMI_VDEV_SET_KEEPALIVE_CMDID,
+	.wmi_vdev_get_keepalive_cmdid = WMI_VDEV_GET_KEEPALIVE_CMDID,
+	.wmi_force_fw_hang_cmdid = WMI_FORCE_FW_HANG_CMDID,
+	.wmi_gpio_config_cmdid = WMI_FORCE_FW_HANG_CMDID,
+	.wmi_gpio_output_cmdid = WMI_GPIO_OUTPUT_CMDID,
+};
+
+/* TODO: 10.X WMI cmd track */
+
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
 	int ret;
@@ -64,7 +189,7 @@ static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb)
 }
 
 static int ath10k_wmi_cmd_send_nowait(struct ath10k *ar, struct sk_buff *skb,
-				      enum wmi_cmd_id cmd_id)
+				      u32 cmd_id)
 {
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
 	struct wmi_cmd_hdr *cmd_hdr;
@@ -144,7 +269,7 @@ static void ath10k_wmi_op_ep_tx_credits(struct ath10k *ar)
 }
 
 static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
-			       enum wmi_cmd_id cmd_id)
+			       u32 cmd_id)
 {
 	int ret = -EINVAL;
 
@@ -1055,7 +1180,7 @@ static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 	return 0;
 }
 
-static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
+static void ath10k_wmi_main_process_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct wmi_cmd_hdr *cmd_hdr;
 	enum wmi_event_id id;
@@ -1174,14 +1299,31 @@ static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
 	dev_kfree_skb(skb);
 }
 
+static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb)
+{
+	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features))
+		ath10k_warn("Firmware 10.X is not yet supported\n");
+	else
+		ath10k_wmi_main_process_rx(ar, skb);
+}
+
 /* WMI Initialization functions */
 int ath10k_wmi_attach(struct ath10k *ar)
 {
+	int ret = 0;
+
+	if (test_bit(ATH10K_FW_FEATURE_10X, ar->fw_features)) {
+		ath10k_warn("Firmware 10.X is not yet supported\n");
+		ret = -ENOTSUPP;
+	} else {
+		ar->wmi.cmd = &wmi_cmd_map;
+	}
+
 	init_completion(&ar->wmi.service_ready);
 	init_completion(&ar->wmi.unified_ready);
 	init_waitqueue_head(&ar->wmi.tx_credits_wq);
 
-	return 0;
+	return ret;
 }
 
 void ath10k_wmi_detach(struct ath10k *ar)
@@ -1237,7 +1379,8 @@ int ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g,
 		   "wmi pdev regdomain rd %x rd2g %x rd5g %x ctl2g %x ctl5g %x\n",
 		   rd, rd2g, rd5g, ctl2g, ctl5g);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_REGDOMAIN_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_set_regdomain_cmdid);
 }
 
 int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
@@ -1267,7 +1410,8 @@ int ath10k_wmi_pdev_set_channel(struct ath10k *ar,
 		   "wmi set channel mode %d freq %d\n",
 		   arg->mode, arg->freq);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_CHANNEL_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_set_channel_cmdid);
 }
 
 int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
@@ -1282,7 +1426,8 @@ int ath10k_wmi_pdev_suspend_target(struct ath10k *ar)
 	cmd = (struct wmi_pdev_suspend_cmd *)skb->data;
 	cmd->suspend_opt = WMI_PDEV_SUSPEND;
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SUSPEND_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_suspend_cmdid);
 }
 
 int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
@@ -1293,7 +1438,8 @@ int ath10k_wmi_pdev_resume_target(struct ath10k *ar)
 	if (skb == NULL)
 		return -ENOMEM;
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_RESUME_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_resume_cmdid);
 }
 
 int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
@@ -1312,7 +1458,8 @@ int ath10k_wmi_pdev_set_param(struct ath10k *ar, enum wmi_pdev_param id,
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi pdev set param %d value %d\n",
 		   id, value);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_PARAM_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_set_param_cmdid);
 }
 
 int ath10k_wmi_cmd_init(struct ath10k *ar)
@@ -1382,7 +1529,7 @@ int ath10k_wmi_cmd_init(struct ath10k *ar)
 	memcpy(&cmd->resource_config, &config, sizeof(config));
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi init\n");
-	return ath10k_wmi_cmd_send(ar, buf, WMI_INIT_CMDID);
+	return ath10k_wmi_cmd_send(ar, buf, ar->wmi.cmd->wmi_init_cmdid);
 }
 
 static int ath10k_wmi_start_scan_calc_len(const struct wmi_start_scan_arg *arg)
@@ -1543,7 +1690,8 @@ int ath10k_wmi_start_scan(struct ath10k *ar,
 	}
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi start scan\n");
-	return ath10k_wmi_cmd_send(ar, skb, WMI_START_SCAN_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_start_scan_cmdid);
 }
 
 void ath10k_wmi_start_scan_init(struct ath10k *ar,
@@ -1603,7 +1751,8 @@ int ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg)
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi stop scan reqid %d req_type %d vdev/scan_id %d\n",
 		   arg->req_id, arg->req_type, arg->u.scan_id);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_STOP_SCAN_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_stop_scan_cmdid);
 }
 
 int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id,
@@ -1628,7 +1777,8 @@ int ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id,
 		   "WMI vdev create: id %d type %d subtype %d macaddr %pM\n",
 		   vdev_id, type, subtype, macaddr);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_CREATE_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_create_cmdid);
 }
 
 int ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id)
@@ -1646,20 +1796,21 @@ int ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id)
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "WMI vdev delete id %d\n", vdev_id);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_DELETE_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_delete_cmdid);
 }
 
 static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 				const struct wmi_vdev_start_request_arg *arg,
-				enum wmi_cmd_id cmd_id)
+				u32 cmd_id)
 {
 	struct wmi_vdev_start_request_cmd *cmd;
 	struct sk_buff *skb;
 	const char *cmdname;
 	u32 flags = 0;
 
-	if (cmd_id != WMI_VDEV_START_REQUEST_CMDID &&
-	    cmd_id != WMI_VDEV_RESTART_REQUEST_CMDID)
+	if (cmd_id != ar->wmi.cmd->wmi_vdev_start_request_cmdid &&
+	    cmd_id != ar->wmi.cmd->wmi_vdev_restart_request_cmdid)
 		return -EINVAL;
 	if (WARN_ON(arg->ssid && arg->ssid_len == 0))
 		return -EINVAL;
@@ -1668,9 +1819,9 @@ static int ath10k_wmi_vdev_start_restart(struct ath10k *ar,
 	if (WARN_ON(arg->ssid_len > sizeof(cmd->ssid.ssid)))
 		return -EINVAL;
 
-	if (cmd_id == WMI_VDEV_START_REQUEST_CMDID)
+	if (cmd_id == ar->wmi.cmd->wmi_vdev_start_request_cmdid)
 		cmdname = "start";
-	else if (cmd_id == WMI_VDEV_RESTART_REQUEST_CMDID)
+	else if (cmd_id == ar->wmi.cmd->wmi_vdev_restart_request_cmdid)
 		cmdname = "restart";
 	else
 		return -EINVAL; /* should not happen, we already check cmd_id */
@@ -1722,14 +1873,14 @@ int ath10k_wmi_vdev_start(struct ath10k *ar,
 			  const struct wmi_vdev_start_request_arg *arg)
 {
 	return ath10k_wmi_vdev_start_restart(ar, arg,
-					     WMI_VDEV_START_REQUEST_CMDID);
+				ar->wmi.cmd->wmi_vdev_start_request_cmdid);
 }
 
 int ath10k_wmi_vdev_restart(struct ath10k *ar,
 		     const struct wmi_vdev_start_request_arg *arg)
 {
 	return ath10k_wmi_vdev_start_restart(ar, arg,
-					     WMI_VDEV_RESTART_REQUEST_CMDID);
+				ar->wmi.cmd->wmi_vdev_restart_request_cmdid);
 }
 
 int ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id)
@@ -1746,7 +1897,8 @@ int ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id)
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi vdev stop id 0x%x\n", vdev_id);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_STOP_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_stop_cmdid);
 }
 
 int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
@@ -1767,7 +1919,7 @@ int ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
 		   "wmi mgmt vdev up id 0x%x assoc id %d bssid %pM\n",
 		   vdev_id, aid, bssid);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_UP_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->wmi_vdev_up_cmdid);
 }
 
 int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id)
@@ -1785,7 +1937,8 @@ int ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id)
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi mgmt vdev down id 0x%x\n", vdev_id);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_DOWN_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_down_cmdid);
 }
 
 int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
@@ -1807,7 +1960,8 @@ int ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id,
 		   "wmi vdev id 0x%x set param %d value %d\n",
 		   vdev_id, param_id, param_value);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_SET_PARAM_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_set_param_cmdid);
 }
 
 int ath10k_wmi_vdev_install_key(struct ath10k *ar,
@@ -1842,7 +1996,8 @@ int ath10k_wmi_vdev_install_key(struct ath10k *ar,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi vdev install key idx %d cipher %d len %d\n",
 		   arg->key_idx, arg->key_cipher, arg->key_len);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_VDEV_INSTALL_KEY_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_vdev_install_key_cmdid);
 }
 
 int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id,
@@ -1862,7 +2017,8 @@ int ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi peer create vdev_id %d peer_addr %pM\n",
 		   vdev_id, peer_addr);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PEER_CREATE_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_peer_create_cmdid);
 }
 
 int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id,
@@ -1882,7 +2038,8 @@ int ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi peer delete vdev_id %d peer_addr %pM\n",
 		   vdev_id, peer_addr);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PEER_DELETE_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_peer_delete_cmdid);
 }
 
 int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id,
@@ -1903,7 +2060,8 @@ int ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi peer flush vdev_id %d peer_addr %pM tids %08x\n",
 		   vdev_id, peer_addr, tid_bitmap);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PEER_FLUSH_TIDS_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_peer_flush_tids_cmdid);
 }
 
 int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id,
@@ -1927,7 +2085,8 @@ int ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id,
 		   "wmi vdev %d peer 0x%pM set param %d value %d\n",
 		   vdev_id, peer_addr, param_id, param_value);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PEER_SET_PARAM_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_peer_set_param_cmdid);
 }
 
 int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id,
@@ -1948,7 +2107,8 @@ int ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id,
 		   "wmi set powersave id 0x%x mode %d\n",
 		   vdev_id, psmode);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_STA_POWERSAVE_MODE_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_sta_powersave_mode_cmdid);
 }
 
 int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id,
@@ -1970,7 +2130,8 @@ int ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi sta ps param vdev_id 0x%x param %d value %d\n",
 		   vdev_id, param_id, value);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_STA_POWERSAVE_PARAM_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_sta_powersave_param_cmdid);
 }
 
 int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
@@ -1996,7 +2157,8 @@ int ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac,
 		   "wmi ap ps param vdev_id 0x%X param %d value %d mac_addr %pM\n",
 		   vdev_id, param_id, value, mac);
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_AP_PS_PEER_PARAM_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_ap_ps_peer_param_cmdid);
 }
 
 int ath10k_wmi_scan_chan_list(struct ath10k *ar,
@@ -2049,7 +2211,8 @@ int ath10k_wmi_scan_chan_list(struct ath10k *ar,
 		ci->flags            |= __cpu_to_le32(flags);
 	}
 
-	return ath10k_wmi_cmd_send(ar, skb, WMI_SCAN_CHAN_LIST_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_scan_chan_list_cmdid);
 }
 
 int ath10k_wmi_peer_assoc(struct ath10k *ar,
@@ -2108,7 +2271,8 @@ int ath10k_wmi_peer_assoc(struct ath10k *ar,
 	ath10k_dbg(ATH10K_DBG_WMI,
 		   "wmi peer assoc vdev %d addr %pM\n",
 		   arg->vdev_id, arg->addr);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PEER_ASSOC_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_peer_assoc_cmdid);
 }
 
 int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
@@ -2128,7 +2292,8 @@ int ath10k_wmi_beacon_send_nowait(struct ath10k *ar,
 	cmd->hdr.bcn_len  = __cpu_to_le32(arg->bcn_len);
 	memcpy(cmd->bcn, arg->bcn, arg->bcn_len);
 
-	return ath10k_wmi_cmd_send_nowait(ar, skb, WMI_BCN_TX_CMDID);
+	return ath10k_wmi_cmd_send_nowait(ar, skb,
+					  ar->wmi.cmd->wmi_bcn_tx_cmdid);
 }
 
 static void ath10k_wmi_pdev_set_wmm_param(struct wmi_wmm_params *params,
@@ -2159,7 +2324,8 @@ int ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar,
 	ath10k_wmi_pdev_set_wmm_param(&cmd->ac_vo, &arg->ac_vo);
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi pdev set wmm params\n");
-	return ath10k_wmi_cmd_send(ar, skb, WMI_PDEV_SET_WMM_PARAMS_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_pdev_set_wmm_params_cmdid);
 }
 
 int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
@@ -2175,7 +2341,8 @@ int ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id)
 	cmd->stats_id = __cpu_to_le32(stats_id);
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi request stats %d\n", (int)stats_id);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_REQUEST_STATS_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_request_stats_cmdid);
 }
 
 int ath10k_wmi_force_fw_hang(struct ath10k *ar,
@@ -2194,5 +2361,6 @@ int ath10k_wmi_force_fw_hang(struct ath10k *ar,
 
 	ath10k_dbg(ATH10K_DBG_WMI, "wmi force fw hang %d delay %d\n",
 		   type, delay_ms);
-	return ath10k_wmi_cmd_send(ar, skb, WMI_FORCE_FW_HANG_CMDID);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->wmi_force_fw_hang_cmdid);
 }
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 2c52c23..94fc008 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -208,6 +208,118 @@ struct wmi_mac_addr {
 	(c_macaddr)[5] = (((pwmi_mac_addr)->word1) >> 8) & 0xff; \
 	} while (0)
 
+struct wmi_cmd_map {
+	u32 wmi_init_cmdid;
+	u32 wmi_start_scan_cmdid;
+	u32 wmi_stop_scan_cmdid;
+	u32 wmi_scan_chan_list_cmdid;
+	u32 wmi_scan_sch_prio_tbl_cmdid;
+	u32 wmi_pdev_set_regdomain_cmdid;
+	u32 wmi_pdev_set_channel_cmdid;
+	u32 wmi_pdev_set_param_cmdid;
+	u32 wmi_pdev_pktlog_enable_cmdid;
+	u32 wmi_pdev_pktlog_disable_cmdid;
+	u32 wmi_pdev_set_wmm_params_cmdid;
+	u32 wmi_pdev_set_ht_cap_ie_cmdid;
+	u32 wmi_pdev_set_vht_cap_ie_cmdid;
+	u32 wmi_pdev_set_dscp_tid_map_cmdid;
+	u32 wmi_pdev_set_quiet_mode_cmdid;
+	u32 wmi_pdev_green_ap_ps_enable_cmdid;
+	u32 wmi_pdev_get_tpc_config_cmdid;
+	u32 wmi_pdev_set_base_macaddr_cmdid;
+	u32 wmi_vdev_create_cmdid;
+	u32 wmi_vdev_delete_cmdid;
+	u32 wmi_vdev_start_request_cmdid;
+	u32 wmi_vdev_restart_request_cmdid;
+	u32 wmi_vdev_up_cmdid;
+	u32 wmi_vdev_stop_cmdid;
+	u32 wmi_vdev_down_cmdid;
+	u32 wmi_vdev_set_param_cmdid;
+	u32 wmi_vdev_install_key_cmdid;
+	u32 wmi_peer_create_cmdid;
+	u32 wmi_peer_delete_cmdid;
+	u32 wmi_peer_flush_tids_cmdid;
+	u32 wmi_peer_set_param_cmdid;
+	u32 wmi_peer_assoc_cmdid;
+	u32 wmi_peer_add_wds_entry_cmdid;
+	u32 wmi_peer_remove_wds_entry_cmdid;
+	u32 wmi_peer_mcast_group_cmdid;
+	u32 wmi_bcn_tx_cmdid;
+	u32 wmi_pdev_send_bcn_cmdid;
+	u32 wmi_bcn_tmpl_cmdid;
+	u32 wmi_bcn_filter_rx_cmdid;
+	u32 wmi_prb_req_filter_rx_cmdid;
+	u32 wmi_mgmt_tx_cmdid;
+	u32 wmi_prb_tmpl_cmdid;
+	u32 wmi_addba_clear_resp_cmdid;
+	u32 wmi_addba_send_cmdid;
+	u32 wmi_addba_status_cmdid;
+	u32 wmi_delba_send_cmdid;
+	u32 wmi_addba_set_resp_cmdid;
+	u32 wmi_send_singleamsdu_cmdid;
+	u32 wmi_sta_powersave_mode_cmdid;
+	u32 wmi_sta_powersave_param_cmdid;
+	u32 wmi_sta_mimo_ps_mode_cmdid;
+	u32 wmi_pdev_dfs_enable_cmdid;
+	u32 wmi_pdev_dfs_disable_cmdid;
+	u32 wmi_roam_scan_mode;
+	u32 wmi_roam_scan_rssi_threshold;
+	u32 wmi_roam_scan_period;
+	u32 wmi_roam_scan_rssi_change_threshold;
+	u32 wmi_roam_ap_profile;
+	u32 wmi_ofl_scan_add_ap_profile;
+	u32 wmi_ofl_scan_remove_ap_profile;
+	u32 wmi_ofl_scan_period;
+	u32 wmi_p2p_dev_set_device_info;
+	u32 wmi_p2p_dev_set_discoverability;
+	u32 wmi_p2p_go_set_beacon_ie;
+	u32 wmi_p2p_go_set_probe_resp_ie;
+	u32 wmi_p2p_set_vendor_ie_data_cmdid;
+	u32 wmi_ap_ps_peer_param_cmdid;
+	u32 wmi_ap_ps_peer_uapsd_coex_cmdid;
+	u32 wmi_peer_rate_retry_sched_cmdid;
+	u32 wmi_wlan_profile_trigger_cmdid;
+	u32 wmi_wlan_profile_set_hist_intvl_cmdid;
+	u32 wmi_wlan_profile_get_profile_data_cmdid;
+	u32 wmi_wlan_profile_enable_profile_id_cmdid;
+	u32 wmi_wlan_profile_list_profile_id_cmdid;
+	u32 wmi_pdev_suspend_cmdid;
+	u32 wmi_pdev_resume_cmdid;
+	u32 wmi_add_bcn_filter_cmdid;
+	u32 wmi_rmv_bcn_filter_cmdid;
+	u32 wmi_wow_add_wake_pattern_cmdid;
+	u32 wmi_wow_del_wake_pattern_cmdid;
+	u32 wmi_wow_enable_disable_wake_event_cmdid;
+	u32 wmi_wow_enable_cmdid;
+	u32 wmi_wow_hostwakeup_from_sleep_cmdid;
+	u32 wmi_rtt_measreq_cmdid;
+	u32 wmi_rtt_tsf_cmdid;
+	u32 wmi_vdev_spectral_scan_configure_cmdid;
+	u32 wmi_vdev_spectral_scan_enable_cmdid;
+	u32 wmi_request_stats_cmdid;
+	u32 wmi_set_arp_ns_offload_cmdid;
+	u32 wmi_network_list_offload_config_cmdid;
+	u32 wmi_gtk_offload_cmdid;
+	u32 wmi_csa_offload_enable_cmdid;
+	u32 wmi_csa_offload_chanswitch_cmdid;
+	u32 wmi_chatter_set_mode_cmdid;
+	u32 wmi_peer_tid_addba_cmdid;
+	u32 wmi_peer_tid_delba_cmdid;
+	u32 wmi_sta_dtim_ps_method_cmdid;
+	u32 wmi_sta_uapsd_auto_trig_cmdid;
+	u32 wmi_sta_keepalive_cmd;
+	u32 wmi_echo_cmdid;
+	u32 wmi_pdev_utf_cmdid;
+	u32 wmi_dbglog_cfg_cmdid;
+	u32 wmi_pdev_qvit_cmdid;
+	u32 wmi_pdev_ftm_intg_cmdid;
+	u32 wmi_vdev_set_keepalive_cmdid;
+	u32 wmi_vdev_get_keepalive_cmdid;
+	u32 wmi_force_fw_hang_cmdid;
+	u32 wmi_gpio_config_cmdid;
+	u32 wmi_gpio_output_cmdid;
+};
+
 /*
  * wmi command groups.
  */
-- 
1.7.10


^ permalink raw reply related

* [PATCH 00/13] ath10k: dual-firmware support (MAIN and 10.X)
From: Bartosz Markowski @ 2013-09-25  9:37 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Bartosz Markowski

This patch-set adds framework for dynamic support of 10.X FW branch.

The major changes covered by this work:
* dynamic WMI structures
* WMI cmd/event definitions from 10.x FW track
* memory host chunks feature
* management frames path over WMI for 10.x
* WMI RX events handling for MAIN and 10.X split
* target config split (LARGE AP feature for 10.x)
* scan start sctructure split
* dynamic VDEV and PDEV parameters structures

TODO:
* add FW IEs to identify (runtime) which FW ath10k deals with

Bartosz Markowski (13):
  ath10k: introduce dynamic WMI structures
  ath10k: add wmi_10x_<cmd/event> definitions
  ath10k: warn if give WMI command is not supported
  ath10k: implement WMI events handling frame for both firmwares
  ath10k: split ath10k_wmi_service_ready_event_rx
  ath10k: drop the fw versioning sanity check
  ath10k: implement host memory chunks
  ath10k: bring back the WMI path for mgmt frames
  ath10k: split wmi_cmd_init path
  ath10k: add TARGET values for 10.x firmware
  ath10k: introduce dynamic vdev parameters
  ath10k: introduce dynamic pdev parameters
  ath10k: handle FW API differences for scan structures

 drivers/net/wireless/ath/ath10k/core.c   |   29 +-
 drivers/net/wireless/ath/ath10k/core.h   |   23 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c |    4 +-
 drivers/net/wireless/ath/ath10k/hw.h     |   37 +-
 drivers/net/wireless/ath/ath10k/mac.c    |   93 ++-
 drivers/net/wireless/ath/ath10k/wmi.c    | 1129 ++++++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath10k/wmi.h    |  969 ++++++++++++++++++++++++-
 7 files changed, 2160 insertions(+), 124 deletions(-)

-- 
1.7.10


^ permalink raw reply

* [patch] mwifiex: potential integer underflow in mwifiex_ret_wmm_get_status()
From: Dan Carpenter @ 2013-09-25  8:57 UTC (permalink / raw)
  To: Bing Zhao; +Cc: John W. Linville, linux-wireless, kernel-janitors

If "resp_len" gets set to negative then it counts as a high positive
value.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I spotted this reviewing the int => bool changes, but I don't have the
hardware and can't test it.

diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 2e8f9cd..3c6ee3a 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -772,6 +772,8 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
 			break;
 		}
 
+		if (resp_len < tlv_len + sizeof(tlv_hdr->header))
+			break;
 		curr += (tlv_len + sizeof(tlv_hdr->header));
 		resp_len -= (tlv_len + sizeof(tlv_hdr->header));
 	}

^ permalink raw reply related

* (no subject)
From: Mario Vietri @ 2013-09-25  6:51 UTC (permalink / raw)
  To: linux-wireless

Dear Sirs,

I have a pc with an Intel Card, Intel Corporation Centrino 
Advanced-N 6235 [8086:088e] (rev 24), driven by iwlwifi. I 
have installed the backports version of iwlwifi.

The card and the driver work flawlessly. I am having troubles, 
though, when I try two build two   virtual interfaces on this 
card, one in Station mode and the other in AP mode.

The output of iw list states, among other things, that:

Supported interface modes: 
                                                            │
                  * IBSS
                  * managed
                  * AP
                  * AP/VLAN
                  * monitor
                  * P2P-client
                  * P2P-GO
         software interface modes (can always be added):
                  * AP/VLAN
                  * monitor
         valid interface combinations:
                  * #{ managed } <= 1, #{ AP, P2P-GO } <= 1,
                    total <= 2, #channels <= 1, STA/AP BI must 
match
                  * #{ managed } <= 2, #{ P2P-client } <= 1,
                    total <= 2, #channels <= 1


I have interpreted this to mean that I can put my card into AP 
mode (I did, it works). The "valid interface combinations" 
appeared to state (if I read them right) that I can have at 
most one vif in station mode, 1 vif in AP mode, for a grand 
total of two, provided that they are on the same channel, and 
provided that


  STA/AP BI must match


What does this mean? I have been unable to find this on 
Google, and several posts at moderately knowledgeable BBs like 
SuperUser, StackOverflow and the like have provided no 
enlightenment.

Since clients connecting to my AP are so far unable to obtain
an IP address from my network, I am wondering whether this
requirement, whose meaning I completely ignore, is the source
of the problem.

  

Do you think you can help me out on this one?


Cheers,


Mario
Prof. Mario Vietri
Scuola Normale Superiore
56100 Pisa
Italia

Tel.: 39-050-509096
FAX:  39-050-509045
Cell: 39-333-7877992

^ permalink raw reply

* [PATCH 3.12 2/2] mwifiex: fix NULL pointer dereference in usb suspend handler
From: Bing Zhao @ 2013-09-25  2:31 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Dmitry Khromov, Amitkumar Karwar, Avinash Patil,
	Nishant Sarmukadam, Frank Huang, Bing Zhao
In-Reply-To: <1380076285-29930-1-git-send-email-bzhao@marvell.com>

Bug 60815 - Interface hangs in mwifiex_usb
https://bugzilla.kernel.org/show_bug.cgi?id=60815

[ 2.883807] BUG: unable to handle kernel NULL pointer dereference
            at 0000000000000048
[ 2.883813] IP: [<ffffffff815a65e0>] pfifo_fast_enqueue+0x90/0x90

[ 2.883834] CPU: 1 PID: 3220 Comm: kworker/u8:90 Not tainted
            3.11.1-monotone-l0 #6
[ 2.883834] Hardware name: Microsoft Corporation Surface with
            Windows 8 Pro/Surface with Windows 8 Pro,
            BIOS 1.03.0450 03/29/2013

On Surface Pro, suspend to ram gives a NULL pointer dereference in
pfifo_fast_enqueue(). The stack trace reveals that the offending
call is clearing carrier in mwifiex_usb suspend handler.

Since commit 1499d9f "mwifiex: don't drop carrier flag over suspend"
has removed the carrier flag handling over suspend/resume in SDIO
and PCIe drivers, I'm removing it in USB driver too. This also fixes
the bug for Surface Pro.

Cc: <stable@vger.kernel.org> # 3.5+
Tested-by: Dmitry Khromov <icechrome@gmail.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/usb.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index 2472d4b..1c70b8d 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -447,9 +447,6 @@ static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message)
 	 */
 	adapter->is_suspended = true;
 
-	for (i = 0; i < adapter->priv_num; i++)
-		netif_carrier_off(adapter->priv[i]->netdev);
-
 	if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb)
 		usb_kill_urb(card->rx_cmd.urb);
 
@@ -509,10 +506,6 @@ static int mwifiex_usb_resume(struct usb_interface *intf)
 						  MWIFIEX_RX_CMD_BUF_SIZE);
 	}
 
-	for (i = 0; i < adapter->priv_num; i++)
-		if (adapter->priv[i]->media_connected)
-			netif_carrier_on(adapter->priv[i]->netdev);
-
 	/* Disable Host Sleep */
 	if (adapter->hs_activated)
 		mwifiex_cancel_hs(mwifiex_get_priv(adapter,
-- 
1.8.2.3


^ permalink raw reply related

* [PATCH 3.12 1/2] mwifiex: fix hang issue for USB chipsets
From: Bing Zhao @ 2013-09-25  2:31 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Dmitry Khromov, Amitkumar Karwar, Avinash Patil,
	Nishant Sarmukadam, Frank Huang, Bing Zhao

From: Amitkumar Karwar <akarwar@marvell.com>

Bug 60815 - Interface hangs in mwifiex_usb
https://bugzilla.kernel.org/show_bug.cgi?id=60815

We have 4 bytes of interface header for packets delivered to SDIO
and PCIe, but not for USB interface.

In Tx AMSDU case, currently 4 bytes of garbage data is unnecessarily
appended for USB packets. This sometimes leads to a firmware hang,
because it may not interpret the data packet correctly.

Problem is fixed by removing this redundant headroom for USB.

Cc: <stable@vger.kernel.org> # 3.5+
Tested-by: Dmitry Khromov <icechrome@gmail.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
 drivers/net/wireless/mwifiex/11n_aggr.c | 3 ++-
 drivers/net/wireless/mwifiex/11n_aggr.h | 2 +-
 drivers/net/wireless/mwifiex/wmm.c      | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c
index 21c6882..1214c58 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.c
+++ b/drivers/net/wireless/mwifiex/11n_aggr.c
@@ -150,7 +150,7 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv,
  */
 int
 mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
-			  struct mwifiex_ra_list_tbl *pra_list, int headroom,
+			  struct mwifiex_ra_list_tbl *pra_list,
 			  int ptrindex, unsigned long ra_list_flags)
 			  __releases(&priv->wmm.ra_list_spinlock)
 {
@@ -160,6 +160,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
 	int pad = 0, ret;
 	struct mwifiex_tx_param tx_param;
 	struct txpd *ptx_pd = NULL;
+	int headroom = adapter->iface_type == MWIFIEX_USB ? 0 : INTF_HEADER_LEN;
 
 	skb_src = skb_peek(&pra_list->skb_head);
 	if (!skb_src) {
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.h b/drivers/net/wireless/mwifiex/11n_aggr.h
index 900e1c6..892098d 100644
--- a/drivers/net/wireless/mwifiex/11n_aggr.h
+++ b/drivers/net/wireless/mwifiex/11n_aggr.h
@@ -26,7 +26,7 @@
 int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv,
 				struct sk_buff *skb);
 int mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
-			      struct mwifiex_ra_list_tbl *ptr, int headroom,
+			      struct mwifiex_ra_list_tbl *ptr,
 			      int ptr_index, unsigned long flags)
 			      __releases(&priv->wmm.ra_list_spinlock);
 
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 2e8f9cd..95fa359 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -1239,8 +1239,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter)
 		if (enable_tx_amsdu && mwifiex_is_amsdu_allowed(priv, tid) &&
 		    mwifiex_is_11n_aggragation_possible(priv, ptr,
 							adapter->tx_buf_size))
-			mwifiex_11n_aggregate_pkt(priv, ptr, INTF_HEADER_LEN,
-						  ptr_index, flags);
+			mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags);
 			/* ra_list_spinlock has been freed in
 			   mwifiex_11n_aggregate_pkt() */
 		else
-- 
1.8.2.3


^ permalink raw reply related

* Tracing Association code
From: Prabhunath G @ 2013-09-25  1:40 UTC (permalink / raw)
  To: kernelnewbies, linux-wireless

Hi All,

         I am tracing the association code in linux-wireless. I
understand that association request has to be triggered from station
side (userspace-wpa_supplicant) and has to be sent to the AP
(userspace-hostapd).

In the process of tracing, I found the function ieee80211_assoc(...)
in net/mac80211/cfg.c and also I found that a timer is scheduled to
execute the timer function. My Questions are

1. Who is initiating the timer function, my guess is it should be the
driver & How ?
2. On the AP side how is the association request taken from driver  ->
mac80211 -> hostapd.

Appreciate your help.

Thanks,
Prabhu

^ permalink raw reply

* [PATCH tip/core/rcu 10/13] mac80211: Apply rcu_access_pointer() to avoid sparse false positive
From: Paul E. McKenney @ 2013-09-25  1:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, laijs, dipankar, akpm, mathieu.desnoyers, josh, niv, tglx,
	peterz, rostedt, dhowells, edumazet, darren, fweisbec, sbw,
	Paul E. McKenney, John W. Linville, Johannes Berg,
	David S. Miller, linux-wireless, netdev
In-Reply-To: <1380072916-31557-1-git-send-email-paulmck@linux.vnet.ibm.com>

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>

The sparse checking for rcu_assign_pointer() was recently upgraded
to reject non-__kernel address spaces.  This also rejects __rcu,
which is almost always the right thing to do.  However, the uses in
sta_info_hash_del() are legitimate: They is assigning a pointer to an
element from an RCU-protected list, and all elements of this list are
already visible to caller.

This commit therefore silences this false positive by laundering the
pointer using rcu_access_pointer() as suggested by Josh Triplett.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 net/mac80211/sta_info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index aeb967a..d18ab89 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -75,7 +75,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
 		return -ENOENT;
 	if (s == sta) {
 		rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)],
-				   s->hnext);
+				   rcu_access_pointer(s->hnext));
 		return 0;
 	}
 
@@ -84,7 +84,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
 		s = rcu_dereference_protected(s->hnext,
 					lockdep_is_held(&local->sta_mtx));
 	if (rcu_access_pointer(s->hnext)) {
-		rcu_assign_pointer(s->hnext, sta->hnext);
+		rcu_assign_pointer(s->hnext, rcu_access_pointer(sta->hnext));
 		return 0;
 	}
 
-- 
1.8.1.5


^ permalink raw reply related

* Re: No connection with TP-Link TL-WN823N (rtl8192cu)
From: Larry Finger @ 2013-09-24 22:43 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless
In-Reply-To: <1378764913.31180.9.camel@dcbw.foobar.com>

On 09/09/2013 05:15 PM, Dan Williams wrote:
> On Mon, 2013-09-09 at 16:52 -0500, Larry Finger wrote:

>> I have been running rtl8192cu for the past 24 hours without a permanent
>> disconnect. Under NetworkManager, I see some reason 7 deauthentications, but
>
> Running wpa_supplicant with debugging on might shed some light on these;
> basically:
>
> mv /usr/sbin/wpa_supplicant /
> killall -TERM wpa_supplicant
> /wpa_supplicant -dddtu <piped to your favorite log file>
>
> and NM should automatically reconnect, and then we can figure out what's
> going on in the supplicant.

Dan,

The log of wpa_supplicant associated with the reason 7 disconnects are as follows:

1380060983.255499: RTM_NEWLINK: operstate=1 ifi_flags=0x1003 ([UP])
1380060983.255516: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060983.255588: nl80211: if_removed already cleared - ignore event
1380060983.255600: Ignore event for foreign ifindex 22
1380060983.272257: nl80211: Event message available
1380060983.272307: nl80211: Delete station 20:e5:2a:01:f7:ea
1380060983.280211: nl80211: Event message available
1380060983.280228: nl80211: MLME event 39
1380060983.280230: nl80211: MLME event frame - hexdump(len=26): c0 00 3a 01 1c 
65 9d 5a c3 9d 20 e5 2a 01 f7 ea 20 e5 2a 01 f7 ea 30 d2 07 00
1380060983.280248: wlan3: Event DEAUTH (12) received
1380060983.280252: wlan3: Deauthentication notification
1380060983.280255: wlan3:  * reason 7
1380060983.280258: wlan3:  * address 20:e5:2a:01:f7:ea
1380060983.280260: Deauthentication frame IE(s) - hexdump(len=0): [NULL]
1380060983.280264: wlan3: WPA: Auto connect enabled: try to reconnect (wps=0)
1380060983.280267: wlan3: Setting scan request: 0 sec 100000 usec
1380060983.280271: Added BSSID 20:e5:2a:01:f7:ea into blacklist
1380060983.280276: wlan3: Not rescheduling scan to ensure that specific SSID 
scans occur
1380060983.280281: wlan3: CTRL-EVENT-DISCONNECTED bssid=20:e5:2a:01:f7:ea reason=7
1380060983.280283: wlan3: Disconnect event - remove keys
1380060983.280362: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=0 set_tx=0 seq_len=0 key_len=0
1380060983.290262: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=1 set_tx=0 seq_len=0 key_len=0
1380060983.292660: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=2 set_tx=0 seq_len=0 key_len=0
1380060983.292791: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=3 set_tx=0 seq_len=0 key_len=0
1380060983.292896: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=4 set_tx=0 seq_len=0 key_len=0
1380060983.292992: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=(nil) 
key_idx=5 set_tx=0 seq_len=0 key_len=0
1380060983.293104: wpa_driver_nl80211_set_key: ifindex=22 alg=0 addr=0x6f7710 
key_idx=0 set_tx=0 seq_len=0 key_len=0
1380060983.293110:    addr=20:e5:2a:01:f7:ea
1380060983.293174: wlan3: State: COMPLETED -> DISCONNECTED
1380060983.293178: wpa_driver_nl80211_set_operstate: operstate 1->0 (DORMANT)
1380060983.293182: netlink: Operstate: linkmode=-1, operstate=5
1380060983.293329: EAPOL: External notification - portEnabled=0
1380060983.293333: EAPOL: SUPP_PAE entering state DISCONNECTED
1380060983.293335: EAPOL: Supplicant port status: Unauthorized
1380060983.293445: EAPOL: SUPP_BE entering state INITIALIZE
1380060983.293449: EAPOL: Supplicant port status: Unauthorized
1380060983.293548: EAPOL: External notification - portValid=0
1380060983.293551: EAPOL: Supplicant port status: Unauthorized
1380060983.293862: EAPOL: External notification - EAP success=0
1380060983.293866: EAPOL: Supplicant port status: Unauthorized
1380060983.293998: RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
1380060983.294004: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060983.294049: nl80211: if_removed already cleared - ignore event
1380060983.294071: Ignore event for foreign ifindex 22
1380060983.294075: nl80211: Event message available
1380060983.294096: nl80211: Ignore disconnect event when using userspace SME
1380060983.298420: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060983.300119: nl80211: Event message available
1380060983.300155: nl80211: Regulatory domain change
1380060983.300163: wlan3: Event CHANNEL_LIST_CHANGED (31) received
1380060983.306633: nl80211: Regulatory information - country=00
1380060983.306642: nl80211: 2402-2472 @ 40 MHz
1380060983.306645: nl80211: 2457-2482 @ 20 MHz
1380060983.306647: nl80211: 2474-2494 @ 20 MHz
1380060983.306649: nl80211: 5170-5250 @ 40 MHz
1380060983.306652: nl80211: 5735-5835 @ 40 MHz
1380060983.306665: nl80211: Added 802.11b mode based on 802.11g information
1380060983.312952: nl80211: Event message available
1380060983.313006: nl80211: Regulatory domain change
1380060983.313014: wlan3: Event CHANNEL_LIST_CHANGED (31) received
1380060983.313294: nl80211: Regulatory information - country=US
1380060983.313298: nl80211: 2402-2472 @ 40 MHz
1380060983.313301: nl80211: 5170-5250 @ 40 MHz
1380060983.313303: nl80211: 5250-5330 @ 40 MHz
1380060983.313306: nl80211: 5490-5600 @ 40 MHz
1380060983.313308: nl80211: 5650-5710 @ 40 MHz
1380060983.313311: nl80211: 5735-5835 @ 40 MHz
1380060983.313325: nl80211: Added 802.11b mode based on 802.11g information
1380060983.380401: wlan3: State: DISCONNECTED -> SCANNING
1380060983.380519: Scan SSID - hexdump_ascii(len=9):
      4e 45 54 47 45 41 52 38 31                        NETGEAR81
1380060983.380530: wlan3: Starting AP scan for wildcard SSID
1380060983.380594: nl80211: Scan SSID - hexdump_ascii(len=9):
      4e 45 54 47 45 41 52 38 31                        NETGEAR81
1380060983.380601: nl80211: Scan SSID - hexdump_ascii(len=0): [NULL]
1380060983.711836: Scan requested (ret=0) - scan timeout 30 seconds
1380060983.711858: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060983.711979: nl80211: Event message available
1380060983.711996: nl80211: Scan trigger
1380060984.417923: nl80211: Event message available
1380060984.417967: nl80211: New scan results available
1380060984.417978: wlan3: Event SCAN_RESULTS (3) received
1380060984.418197: nl80211: Received scan results (5 BSSes)
1380060984.418259: Sorted scan results
1380060984.418262: 00:e0:4c:81:86:86 freq=2462 qual=0 noise=0 level=-38 flags=0xb
1380060984.418267: c0:3f:0e:be:2b:44 freq=2422 qual=0 noise=0 level=-50 flags=0xb
1380060984.418271: 20:e5:2a:01:f7:ea freq=2437 qual=0 noise=0 level=-54 flags=0xb
1380060984.418274: 00:1a:70:46:ba:b1 freq=2462 qual=0 noise=0 level=-72 flags=0xb
1380060984.418278: 00:14:bf:85:49:fa freq=2412 qual=0 noise=0 level=-48 flags=0xb
1380060984.418283: wlan3: BSS: Start scan result update 15
1380060984.418325: Add randomness: count=213 entropy=148
1380060984.418328: random pool - hexdump(len=128): [REMOVED]
1380060984.418330: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.418333: random_mix_pool - hexdump(len=5): [REMOVED]
1380060984.418335: random pool - hexdump(len=128): [REMOVED]
1380060984.418337: Add randomness: count=214 entropy=149
1380060984.418340: random pool - hexdump(len=128): [REMOVED]
1380060984.418341: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.418343: random_mix_pool - hexdump(len=5): [REMOVED]
1380060984.418345: random pool - hexdump(len=128): [REMOVED]
1380060984.418347: Add randomness: count=215 entropy=150
1380060984.418350: random pool - hexdump(len=128): [REMOVED]
1380060984.418352: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.418486: random_mix_pool - hexdump(len=5): [REMOVED]
1380060984.418489: random pool - hexdump(len=128): [REMOVED]
1380060984.418491: Add randomness: count=216 entropy=151
1380060984.418494: random pool - hexdump(len=128): [REMOVED]
1380060984.418496: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.418498: random_mix_pool - hexdump(len=5): [REMOVED]
1380060984.418500: random pool - hexdump(len=128): [REMOVED]
1380060984.418502: Add randomness: count=217 entropy=152
1380060984.418505: random pool - hexdump(len=128): [REMOVED]
1380060984.418507: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.418510: random_mix_pool - hexdump(len=5): [REMOVED]
1380060984.418512: random pool - hexdump(len=128): [REMOVED]
1380060984.418516: wlan3: New scan results available
1380060984.418555: WPS: attr type=0x104a len=1
1380060984.418559: WPS: attr type=0x1044 len=1
1380060984.418561: WPS: attr type=0x104a len=1
1380060984.418563: WPS: attr type=0x1044 len=1
1380060984.418565: WPS: attr type=0x104a len=1
1380060984.418567: WPS: attr type=0x1044 len=1
1380060984.418570: WPS: attr type=0x104a len=1
1380060984.418572: WPS: attr type=0x1044 len=1
1380060984.418573: WPS: attr type=0x103b len=1
1380060984.418575: WPS: attr type=0x1047 len=16
1380060984.418578: WPS: attr type=0x1021 len=13
1380060984.418580: WPS: attr type=0x1023 len=10
1380060984.418582: WPS: attr type=0x1024 len=10
1380060984.418584: WPS: attr type=0x1042 len=2
1380060984.418586: WPS: attr type=0x1054 len=8
1380060984.418588: WPS: attr type=0x1011 len=10
1380060984.418590: WPS: attr type=0x1008 len=2
1380060984.418592: WPS: attr type=0x103c len=1
1380060984.418594: WPS: attr type=0x1049 len=6
1380060984.418596: WPS: WFA subelement id=0 len=1
1380060984.418598: WPS: attr type=0x104a len=1
1380060984.418600: WPS: attr type=0x1044 len=1
1380060984.418602: WPS: attr type=0x103b len=1
1380060984.418604: WPS: attr type=0x1047 len=16
1380060984.418606: WPS: attr type=0x1021 len=13
1380060984.418608: WPS: attr type=0x1023 len=10
1380060984.418610: WPS: attr type=0x1024 len=10
1380060984.418611: WPS: attr type=0x1042 len=2
1380060984.418613: WPS: attr type=0x1054 len=8
1380060984.418615: WPS: attr type=0x1011 len=10
1380060984.418617: WPS: attr type=0x1008 len=2
1380060984.418619: WPS: attr type=0x103c len=1
1380060984.418621: WPS: attr type=0x1049 len=6
1380060984.418623: WPS: WFA subelement id=0 len=1
1380060984.418625: WPS: attr type=0x104a len=1
1380060984.418627: WPS: attr type=0x1044 len=1
1380060984.418629: WPS: attr type=0x103b len=1
1380060984.418631: WPS: attr type=0x1047 len=16
1380060984.418632: WPS: attr type=0x1021 len=13
1380060984.418634: WPS: attr type=0x1023 len=10
1380060984.418636: WPS: attr type=0x1024 len=10
1380060984.418638: WPS: attr type=0x1042 len=2
1380060984.418640: WPS: attr type=0x1054 len=8
1380060984.418642: WPS: attr type=0x1011 len=10
1380060984.418644: WPS: attr type=0x1008 len=2
1380060984.418646: WPS: attr type=0x103c len=1
1380060984.418648: WPS: attr type=0x1049 len=6
1380060984.418650: WPS: WFA subelement id=0 len=1
1380060984.418688: wlan3: Selecting BSS from priority group 0
1380060984.418695: wlan3: 0: 00:e0:4c:81:86:86 ssid='OpenWrt' wpa_ie_len=0 
rsn_ie_len=20 caps=0x11 level=-38
1380060984.418698: wlan3:    skip - SSID mismatch
1380060984.418703: wlan3: 1: c0:3f:0e:be:2b:44 ssid='lwfdjf-n' wpa_ie_len=0 
rsn_ie_len=20 caps=0x411 level=-50 wps
1380060984.418706: wlan3:    skip - SSID mismatch
1380060984.418710: wlan3: 2: 20:e5:2a:01:f7:ea ssid='NETGEAR81' wpa_ie_len=0 
rsn_ie_len=20 caps=0x411 level=-54 wps
1380060984.418714: wlan3:    skip - blacklisted (count=1 limit=0)
1380060984.418719: wlan3: 3: 00:1a:70:46:ba:b1 ssid='Larry_wpa1' wpa_ie_len=24 
rsn_ie_len=0 caps=0x411 level=-72
1380060984.418721: wlan3:    skip - SSID mismatch
1380060984.418726: wlan3: 4: 00:14:bf:85:49:fa ssid='radius' wpa_ie_len=0 
rsn_ie_len=0 caps=0x411 level=-48
1380060984.418728: wlan3:    skip - SSID mismatch
1380060984.418731: wlan3: No APs found - clear blacklist and try again
1380060984.418733: Removed BSSID 20:e5:2a:01:f7:ea from blacklist (clear)
1380060984.418799: wlan3: Selecting BSS from priority group 0
1380060984.418804: wlan3: 0: 00:e0:4c:81:86:86 ssid='OpenWrt' wpa_ie_len=0 
rsn_ie_len=20 caps=0x11 level=-38
1380060984.418807: wlan3:    skip - SSID mismatch
1380060984.418811: wlan3: 1: c0:3f:0e:be:2b:44 ssid='lwfdjf-n' wpa_ie_len=0 
rsn_ie_len=20 caps=0x411 level=-50 wps
1380060984.418814: wlan3:    skip - SSID mismatch
1380060984.418818: wlan3: 2: 20:e5:2a:01:f7:ea ssid='NETGEAR81' wpa_ie_len=0 
rsn_ie_len=20 caps=0x411 level=-54 wps
1380060984.418823: wlan3:    selected based on RSN IE
1380060984.418828: wlan3:    selected BSS 20:e5:2a:01:f7:ea ssid='NETGEAR81'
1380060984.418837: wlan3: Request association: reassociate: 0  selected: 
20:e5:2a:01:f7:ea  bssid: 00:00:00:00:00:00  pending: 00:00:00:00:00:00 
wpa_state: SCANNING
1380060984.418841: wlan3: Automatic auth_alg selection: 0x1
1380060984.418845: wlan3: RSN: using IEEE 802.11i/D9.0
1380060984.418848: wlan3: WPA: Selected cipher suites: group 16 pairwise 16 
key_mgmt 2 proto 2
1380060984.418852: wlan3: WPA: clearing AP WPA IE
1380060984.418854: WPA: set AP RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 04 
01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00
1380060984.418865: wlan3: WPA: using GTK CCMP
1380060984.418867: wlan3: WPA: using PTK CCMP
1380060984.418870: wlan3: WPA: using KEY_MGMT WPA-PSK
1380060984.418872: wlan3: WPA: not using MGMT group cipher
1380060984.418875: WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 
0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
1380060984.418886: wlan3: Cancelling scan request
1380060984.418890: wlan3: SME: Trying to authenticate with 20:e5:2a:01:f7:ea 
(SSID='NETGEAR81' freq=2437 MHz)
1380060984.418893: wlan3: No keys have been configured - skip key clearing
1380060984.418896: wlan3: State: SCANNING -> AUTHENTICATING
1380060984.418956: EAPOL: External notification - EAP success=0
1380060984.418959: EAPOL: Supplicant port status: Unauthorized
1380060984.419094: EAPOL: External notification - EAP fail=0
1380060984.419097: EAPOL: Supplicant port status: Unauthorized
1380060984.419195: EAPOL: External notification - portControl=Auto
1380060984.419198: EAPOL: Supplicant port status: Unauthorized
1380060984.419294: nl80211: Authenticate (ifindex=22)
1380060984.419298:   * bssid=20:e5:2a:01:f7:ea
1380060984.419301:   * freq=2437
1380060984.419303:   * SSID - hexdump_ascii(len=9):
      4e 45 54 47 45 41 52 38 31                        NETGEAR81
1380060984.419311:   * IEs - hexdump(len=0): [NULL]
1380060984.419313:   * Auth Type 0
1380060984.439811: nl80211: Authentication request send successfully
1380060984.439836: wlan3: Checking for other virtual interfaces sharing same 
radio (phy0) in event_scan_results
1380060984.439857: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060984.440017: RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
1380060984.440022: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060984.440171: nl80211: if_removed already cleared - ignore event
1380060984.440192: Ignore event for foreign ifindex 22
1380060984.440196: nl80211: Event message available
1380060984.440215: nl80211: New station 20:e5:2a:01:f7:ea
1380060984.440229: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3/BSSs/0
1380060984.440340: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3/BSSs/6
1380060984.440478: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3/BSSs/1
1380060984.440628: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3/BSSs/3
1380060984.441086: nl80211: Event message available
1380060984.441103: nl80211: MLME event 37
1380060984.441106: nl80211: MLME event frame - hexdump(len=41): b0 00 3a 01 1c 
65 9d 5a c3 9d 20 e5 2a 01 f7 ea 20 e5 2a 01 f7 ea 60 d3 00 00 02 00 00 00 dd 09 
00 10 18 02 00 f0 04 00 00
1380060984.441251: wlan3: Event AUTH (11) received
1380060984.441257: wlan3: SME: Authentication response: peer=20:e5:2a:01:f7:ea 
auth_type=0 status_code=0
1380060984.441259: SME: Authentication response IEs - hexdump(len=11): dd 09 00 
10 18 02 00 f0 04 00 00
1380060984.441269: wlan3: Trying to associate with 20:e5:2a:01:f7:ea 
(SSID='NETGEAR81' freq=2437 MHz)
1380060984.441272: wlan3: State: AUTHENTICATING -> ASSOCIATING
1380060984.441275: wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
1380060984.441278: netlink: Operstate: linkmode=-1, operstate=5
1380060984.441370: WPA: set own WPA/RSN IE - hexdump(len=22): 30 14 01 00 00 0f 
ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
1380060984.441383: nl80211: Associate (ifindex=22)
1380060984.441388:   * bssid=20:e5:2a:01:f7:ea
1380060984.441391:   * freq=2437
1380060984.441393:   * SSID - hexdump_ascii(len=9):
      4e 45 54 47 45 41 52 38 31                        NETGEAR81
1380060984.441400:   * IEs - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 
0f ac 04 01 00 00 0f ac 02 00 00
1380060984.441408:   * pairwise=0xfac04
1380060984.441410:   * group=0xfac04
1380060984.441412:   * prev_bssid=20:e5:2a:01:f7:ea
1380060984.441506: nl80211: Association request send successfully
1380060984.446458: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060984.447729: RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
1380060984.447745: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060984.447824: nl80211: if_removed already cleared - ignore event
1380060984.447832: RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
1380060984.447835: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060984.447882: nl80211: if_removed already cleared - ignore event
1380060984.447888: RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
1380060984.447891: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060984.447934: nl80211: if_removed already cleared - ignore event
1380060984.447944: Ignore event for foreign ifindex 22
1380060984.447950: Ignore event for foreign ifindex 22
1380060984.447955: Ignore event for foreign ifindex 22
1380060984.447959: nl80211: Event message available
1380060984.447990: nl80211: MLME event 38
1380060984.447992: nl80211: MLME event frame - hexdump(len=180): 30 00 3a 01 1c 
65 9d 5a c3 9d 20 e5 2a 01 f7 ea 20 e5 2a 01 f7 ea 70 d3 11 04 00 00 02 c0 01 08 
82 84 0b 16 24 30 48 6c 32 04 0c 12 18 60 2d 1a fc 18 1f ff ff 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3d 16 06 00 17 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 7f 01 01 4a 0e 14 00 0a 00 2c 01 c8 00 14 00 
05 00 19 00 dd 18 00 50 f2 04 10 4a 00 01 10 10 3b 00 01 03 10 49 00 06 00 37 2a 
00 01 20 dd 09 00 10 18 02 00 f0 04 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 
00 27 a4 00 00 42 43 5e 00 62 32 2f 00
1380060984.448058: wlan3: Event ASSOC (0) received
1380060984.448062: wlan3: Association info event
1380060984.448064: resp_ies - hexdump(len=150): 01 08 82 84 0b 16 24 30 48 6c 32 
04 0c 12 18 60 2d 1a fc 18 1f ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 3d 16 06 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 7f 01 01 4a 0e 14 00 0a 00 2c 01 c8 00 14 00 05 00 19 00 dd 18 00 50 f2 
04 10 4a 00 01 10 10 3b 00 01 03 10 49 00 06 00 37 2a 00 01 20 dd 09 00 10 18 02 
00 f0 04 00 00 dd 18 00 50 f2 02 01 01 80 00 03 a4 00 00 27 a4 00 00 42 43 5e 00 
62 32 2f 00
1380060984.448115: wlan3: freq=2437 MHz
1380060984.448119: wlan3: State: ASSOCIATING -> ASSOCIATED
1380060984.448122: wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)
1380060984.448125: netlink: Operstate: linkmode=-1, operstate=5
1380060984.448252: wlan3: Associated to a new BSS: BSSID=20:e5:2a:01:f7:ea
1380060984.448254: Add randomness: count=218 entropy=153
1380060984.448257: random pool - hexdump(len=128): [REMOVED]
1380060984.448259: random_mix_pool - hexdump(len=16): [REMOVED]
1380060984.448262: random_mix_pool - hexdump(len=6): [REMOVED]
1380060984.448264: random pool - hexdump(len=128): [REMOVED]
1380060984.448403: wlan3: No keys have been configured - skip key clearing
1380060984.448408: wlan3: Associated with 20:e5:2a:01:f7:ea
1380060984.448411: wlan3: WPA: Association event - clear replay counter
1380060984.448414: wlan3: WPA: Clear old PTK
1380060984.448416: EAPOL: External notification - portEnabled=0
1380060984.448419: EAPOL: Supplicant port status: Unauthorized
1380060984.448614: EAPOL: External notification - portValid=0
1380060984.448617: EAPOL: Supplicant port status: Unauthorized
1380060984.448725: EAPOL: External notification - EAP success=0
1380060984.448728: EAPOL: Supplicant port status: Unauthorized
1380060984.448833: EAPOL: External notification - portEnabled=1
1380060984.448836: EAPOL: SUPP_PAE entering state CONNECTING
1380060984.448838: EAPOL: enable timer tick
1380060984.448841: EAPOL: SUPP_BE entering state IDLE
1380060984.448845: wlan3: Setting authentication timeout: 10 sec 0 usec
1380060984.448849: wlan3: Cancelling scan request
1380060984.448873: nl80211: Event message available
1380060984.448888: nl80211: Ignore connect event (cmd=46) when using userspace SME
1380060984.452421: wlan3: RX EAPOL from 20:e5:2a:01:f7:ea
1380060984.452428: RX EAPOL - hexdump(len=121): 02 03 00 75 02 00 8a 00 10 00 00 
00 00 00 00 00 92 b8 c6 f1 75 b2 15 37 c3 eb 49 b9 2d fa 54 49 83 42 4e b9 00 32 
b8 68 2d 17 83 c6 8a 55 d7 cc 6e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 16 dd 14 00 0f ac 04 9a 21 ff 5f 52 07 69 ba 95 e1 53 81 98 50 
2f 73
1380060984.452472: wlan3: Setting authentication timeout: 10 sec 0 usec
1380060984.452479: wlan3: IEEE 802.1X RX: version=2 type=3 length=117
1380060984.452482: wlan3:   EAPOL-Key type=2
1380060984.452487: wlan3:   key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack)
1380060984.452490: wlan3:   key_length=16 key_data_length=22
1380060984.452492:   replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 92
1380060984.452497:   key_nonce - hexdump(len=32): b8 c6 f1 75 b2 15 37 c3 eb 49 
b9 2d fa 54 49 83 42 4e b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6e
1380060984.452508:   key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00
1380060984.452515:   key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00
1380060984.452520:   key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
1380060984.452525:   key_mic - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00
1380060984.452535: WPA: RX EAPOL-Key - hexdump(len=121): 02 03 00 75 02 00 8a 00 
10 00 00 00 00 00 00 00 92 b8 c6 f1 75 b2 15 37 c3 eb 49 b9 2d fa 54 49 83 42 4e 
b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6e 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 16 dd 14 00 0f ac 04 9a 21 ff 5f 52 07 69 ba 95 e1 53 
81 98 50 2f 73
1380060984.452579: wlan3: State: ASSOCIATED -> 4WAY_HANDSHAKE
1380060984.452689: wlan3: WPA: RX message 1 of 4-Way Handshake from 
20:e5:2a:01:f7:ea (ver=2)
1380060984.452691: RSN: msg 1/4 key data - hexdump(len=22): dd 14 00 0f ac 04 9a 
21 ff 5f 52 07 69 ba 95 e1 53 81 98 50 2f 73
1380060984.452700: WPA: PMKID in EAPOL-Key - hexdump(len=22): dd 14 00 0f ac 04 
9a 21 ff 5f 52 07 69 ba 95 e1 53 81 98 50 2f 73
1380060984.452708: RSN: PMKID from Authenticator - hexdump(len=16): 9a 21 ff 5f 
52 07 69 ba 95 e1 53 81 98 50 2f 73
1380060984.452715: wlan3: RSN: no matching PMKID found
1380060984.452718: Get randomness: len=32 entropy=154
1380060984.453343: random from os_get_random - hexdump(len=32): [REMOVED]
1380060984.453359: random_mix_pool - hexdump(len=20): [REMOVED]
1380060984.453364: random from internal pool - hexdump(len=16): [REMOVED]
1380060984.453369: random_mix_pool - hexdump(len=20): [REMOVED]
1380060984.453373: random from internal pool - hexdump(len=16): [REMOVED]
1380060984.453375: mixed random - hexdump(len=32): [REMOVED]
1380060984.453378: WPA: Renewed SNonce - hexdump(len=32): 01 ea 42 a8 4d 73 75 
b7 40 11 7e 37 2d b5 10 f1 11 96 23 e4 6c ee fb 3e 12 1b 8d c6 34 05 e5 06
1380060984.453498: WPA: PTK derivation - A1=1c:65:9d:5a:c3:9d A2=20:e5:2a:01:f7:ea
1380060984.453502: WPA: Nonce1 - hexdump(len=32): 01 ea 42 a8 4d 73 75 b7 40 11 
7e 37 2d b5 10 f1 11 96 23 e4 6c ee fb 3e 12 1b 8d c6 34 05 e5 06
1380060984.453514: WPA: Nonce2 - hexdump(len=32): b8 c6 f1 75 b2 15 37 c3 eb 49 
b9 2d fa 54 49 83 42 4e b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6e
1380060984.453526: WPA: PMK - hexdump(len=32): [REMOVED]
1380060984.453528: WPA: PTK - hexdump(len=48): [REMOVED]
1380060984.453530: WPA: WPA IE for msg 2/4 - hexdump(len=22): 30 14 01 00 00 0f 
ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
1380060984.453541: WPA: Replay Counter - hexdump(len=8): 00 00 00 00 00 00 00 92
1380060984.453547: wlan3: WPA: Sending EAPOL-Key 2/4
1380060984.453553: WPA: KCK - hexdump(len=16): [REMOVED]
1380060984.453555: WPA: Derived Key MIC - hexdump(len=16): 82 a7 a9 83 fa 60 f2 
6d 62 4c f5 04 0f f8 af 34
1380060984.453562: WPA: TX EAPOL-Key - hexdump(len=121): 01 03 00 75 02 01 0a 00 
00 00 00 00 00 00 00 00 92 01 ea 42 a8 4d 73 75 b7 40 11 7e 37 2d b5 10 f1 11 96 
23 e4 6c ee fb 3e 12 1b 8d c6 34 05 e5 06 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82 a7 a9 83 fa 60 f2 6d 
62 4c f5 04 0f f8 af 34 00 16 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 
0f ac 02 00 00
1380060984.453700: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060984.469955: wlan3: RX EAPOL from 20:e5:2a:01:f7:ea
1380060984.469961: RX EAPOL - hexdump(len=155): 02 03 00 97 02 13 ca 00 10 00 00 
00 00 00 00 00 93 b8 c6 f1 75 b2 15 37 c3 eb 49 b9 2d fa 54 49 83 42 4e b9 00 32 
b8 68 2d 17 83 c6 8a 55 d7 cc 6e 42 4e b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6f 
61 44 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 54 f2 53 22 36 cd f1 52 c4 9c 5b 
d4 94 7b 44 e9 00 38 5f 3e 85 a3 4a 51 74 0d 57 d5 cb 71 63 65 8b ac 25 22 59 67 
6b 18 6c ae f7 97 ba 0a 64 f2 1c 98 78 e7 8b b2 24 c9 6f b5 b7 f9 73 e2 e8 e4 dc 
6c 14 a9 fd 50 58 20 11 d8
1380060984.470007: wlan3: IEEE 802.1X RX: version=2 type=3 length=151
1380060984.470010: wlan3:   EAPOL-Key type=2
1380060984.470015: wlan3:   key_info 0x13ca (ver=2 keyidx=0 rsvd=0 Pairwise 
Install Ack MIC Secure Encr)
1380060984.470018: wlan3:   key_length=16 key_data_length=56
1380060984.470020:   replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 93
1380060984.470025:   key_nonce - hexdump(len=32): b8 c6 f1 75 b2 15 37 c3 eb 49 
b9 2d fa 54 49 83 42 4e b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6e
1380060984.470036:   key_iv - hexdump(len=16): 42 4e b9 00 32 b8 68 2d 17 83 c6 
8a 55 d7 cc 6f
1380060984.470043:   key_rsc - hexdump(len=8): 61 44 1a 00 00 00 00 00
1380060984.470048:   key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
1380060984.470052:   key_mic - hexdump(len=16): 54 f2 53 22 36 cd f1 52 c4 9c 5b 
d4 94 7b 44 e9
1380060984.470062: WPA: RX EAPOL-Key - hexdump(len=155): 02 03 00 97 02 13 ca 00 
10 00 00 00 00 00 00 00 93 b8 c6 f1 75 b2 15 37 c3 eb 49 b9 2d fa 54 49 83 42 4e 
b9 00 32 b8 68 2d 17 83 c6 8a 55 d7 cc 6e 42 4e b9 00 32 b8 68 2d 17 83 c6 8a 55 
d7 cc 6f 61 44 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 54 f2 53 22 36 cd f1 52 
c4 9c 5b d4 94 7b 44 e9 00 38 5f 3e 85 a3 4a 51 74 0d 57 d5 cb 71 63 65 8b ac 25 
22 59 67 6b 18 6c ae f7 97 ba 0a 64 f2 1c 98 78 e7 8b b2 24 c9 6f b5 b7 f9 73 e2 
e8 e4 dc 6c 14 a9 fd 50 58 20 11 d8
1380060984.470127: RSN: encrypted key data - hexdump(len=56): 5f 3e 85 a3 4a 51 
74 0d 57 d5 cb 71 63 65 8b ac 25 22 59 67 6b 18 6c ae f7 97 ba 0a 64 f2 1c 98 78 
e7 8b b2 24 c9 6f b5 b7 f9 73 e2 e8 e4 dc 6c 14 a9 fd 50 58 20 11 d8
1380060984.470163: WPA: decrypted EAPOL-Key key data - hexdump(len=48): [REMOVED]
1380060984.470168: wlan3: State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
1380060984.470172: wlan3: WPA: RX message 3 of 4-Way Handshake from 
20:e5:2a:01:f7:ea (ver=2)
1380060984.470174: WPA: IE KeyData - hexdump(len=48): 30 14 01 00 00 0f ac 04 01 
00 00 0f ac 04 01 00 00 0f ac 02 0c 00 dd 16 00 0f ac 01 01 00 6a 84 ef c7 88 2e 
78 30 d8 21 9e 13 f1 72 05 55 dd 00
1380060984.470304: WPA: RSN IE in EAPOL-Key - hexdump(len=22): 30 14 01 00 00 0f 
ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 0c 00
1380060984.470314: WPA: GTK in EAPOL-Key - hexdump(len=24): [REMOVED]
1380060984.470321: wlan3: WPA: Sending EAPOL-Key 4/4
1380060984.470328: WPA: KCK - hexdump(len=16): [REMOVED]
1380060984.470330: WPA: Derived Key MIC - hexdump(len=16): 8a 6a 7c fb 7d 2f 8b 
d1 33 d7 57 fe 7f 31 35 b4
1380060984.470337: WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f 02 03 0a 00 
00 00 00 00 00 00 00 00 93 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8a 6a 7c fb 7d 2f 8b d1 
33 d7 57 fe 7f 31 35 b4 00 00
1380060984.470457: wlan3: WPA: Installing PTK to the driver
1380060984.470552: wpa_driver_nl80211_set_key: ifindex=22 alg=3 addr=0x6f9ec8 
key_idx=0 set_tx=1 seq_len=6 key_len=16
1380060984.470568:    addr=20:e5:2a:01:f7:ea
1380060984.471873: EAPOL: External notification - portValid=1
1380060984.471879: wlan3: State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
1380060984.471981: RSN: received GTK in pairwise handshake - hexdump(len=18): 
[REMOVED]
1380060984.471985: WPA: Group Key - hexdump(len=16): [REMOVED]
1380060984.471989: wlan3: WPA: Installing GTK to the driver (keyidx=1 tx=0 len=16)
1380060984.471991: WPA: RSC - hexdump(len=6): 61 44 1a 00 00 00
1380060984.472044: wpa_driver_nl80211_set_key: ifindex=22 alg=3 addr=0x492909 
key_idx=1 set_tx=0 seq_len=6 key_len=16
1380060984.472051:    broadcast key
1380060984.473171: wlan3: WPA: Key negotiation completed with 20:e5:2a:01:f7:ea 
[PTK=CCMP GTK=CCMP]
1380060984.473174: wlan3: Cancelling authentication timeout
1380060984.473178: wlan3: State: GROUP_HANDSHAKE -> COMPLETED
1380060984.473183: wlan3: CTRL-EVENT-CONNECTED - Connection to 20:e5:2a:01:f7:ea 
completed (reauth) [id=0 id_str=]
1380060984.473185: wpa_driver_nl80211_set_operstate: operstate 0->1 (UP)
1380060984.473189: netlink: Operstate: linkmode=-1, operstate=6
1380060984.473598: EAPOL: External notification - portValid=1
1380060984.473604: EAPOL: External notification - EAP success=1
1380060984.473607: EAPOL: SUPP_PAE entering state AUTHENTICATING
1380060984.473609: EAPOL: SUPP_BE entering state SUCCESS
1380060984.473611: EAP: EAP entering state DISABLED
1380060984.473613: EAPOL: SUPP_PAE entering state AUTHENTICATED
1380060984.473614: EAPOL: Supplicant port status: Authorized
1380060984.473733: EAPOL: SUPP_BE entering state IDLE
1380060984.473737: EAPOL authentication completed successfully
1380060984.473866: RTM_NEWLINK: operstate=1 ifi_flags=0x11043 
([UP][RUNNING][LOWER_UP])
1380060984.473870: RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan3' added
1380060984.473917: nl80211: if_removed already cleared - ignore event
1380060984.473929: Ignore event for foreign ifindex 22
1380060984.477063: dbus: flush_object_timeout_handler: Timeout - sending changed 
properties of object /fi/w1/wpa_supplicant1/Interfaces/3
1380060985.449860: EAPOL: startWhen --> 0
1380060985.449872: EAPOL: disable timer tick

Any advice on how to debug this will be appreciated.

Thanks,

Larry


^ permalink raw reply

* [PATCH -stable] p54usb: add USB ID for Corega WLUSB2GTST USB adapter
From: Christian Lamparter @ 2013-09-24 19:56 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, the_force

Added USB ID for Corega WLUSB2GTST USB adapter.

Cc: <stable@vger.kernel.org>
Reported-by: Joerg Kalisch <the_force@gmx.de>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
 drivers/net/wireless/p54/p54usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index b9deef6..f42dc3c 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -83,6 +83,7 @@ static struct usb_device_id p54u_table[] = {
 	{USB_DEVICE(0x06a9, 0x000e)},	/* Westell 802.11g USB (A90-211WG-01) */
 	{USB_DEVICE(0x06b9, 0x0121)},	/* Thomson SpeedTouch 121g */
 	{USB_DEVICE(0x0707, 0xee13)},   /* SMC 2862W-G version 2 */
+	{USB_DEVICE(0x07aa, 0x0020)},	/* Corega WLUSB2GTST USB */
 	{USB_DEVICE(0x0803, 0x4310)},	/* Zoom 4410a */
 	{USB_DEVICE(0x083a, 0x4521)},   /* Siemens Gigaset USB Adapter 54 version 2 */
 	{USB_DEVICE(0x083a, 0x4531)},	/* T-Com Sinus 154 data II */
-- 
1.8.4.rc3


^ permalink raw reply related

* RE: [PATCH v5 2/2] Bluetooth: btmrvl: add calibration data download support
From: Bing Zhao @ 2013-09-24 19:54 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: linux-bluetooth@vger.kernel.org, Gustavo Padovan, Johan Hedberg,
	linux-wireless@vger.kernel.org, Mike Frysinger, Hyuckjoo Lee,
	Amitkumar Karwar
In-Reply-To: <C42E9D11-1E8B-499E-96E0-74469F7649EC@holtmann.org>

Hi Marcel,

> > We can extend __hci_cmd_sync() function with a new parameter 'type'.
> > This way we can pass HCI_VENDOR_PKT into __hci_cmd_sync(), while other drivers will pass in
> HCI_COMMAND_PKT.
> 
> That will actually not work. And I also do not want to do that. The __hci_cmd_sync() is for real HCI
> packets. That means types 0x01 and 0x04 only. They need to adhere to the HCI flow control mechanism
> for commands.

I see.

> 
> > Our driver will make HCI_VENDOR_PKT -> MRVL_VENDOR_PKT conversion before downloading the frame to
> firmware. And the MRVL_VENDOR_PKT frame from firmware will be replaced with HCI_VENDOR_PKT while
> uploading the frame to stack.
> >
> > Please let us know if this approach works for you or not.
> 
> I think this is best kept inside the driver. However you might consider building something like
> __hci_cmd_sync() that is specific to your driver, but allows for a similar flow within ->setup().

Sure, we will consider building a function in the driver to handle this.

Thanks,
Bing

^ permalink raw reply

* Re: [PATCH v5 2/2] Bluetooth: btmrvl: add calibration data download support
From: Marcel Holtmann @ 2013-09-24 19:43 UTC (permalink / raw)
  To: Bing Zhao
  Cc: linux-bluetooth@vger.kernel.org, Gustavo Padovan, Johan Hedberg,
	linux-wireless@vger.kernel.org, Mike Frysinger, Hyuckjoo Lee,
	Amitkumar Karwar
In-Reply-To: <477F20668A386D41ADCC57781B1F70430F450779BE@SC-VEXCH1.marvell.com>

Hi Bing,

>>> The reason of not using __hci_cmd_sync() is that we are sending vendor specific command here
>> (MRVL_VENDOR_PKT). The __hci_cmd_sync seems handle HCI_COMMAND_PKT only.
>>> Please let us know if you have any suggestion to solve this problem.
>> 
>> what is a MRVL_VENDOR_PKT actually?
> 
> It's defined as 0xfe in our driver. The firmware doesn't understand 0xff (HCI_VENDOR_PKT).

so it is actually out-of-channel vendor packet.

>> 
>> If you guys are not using standard HCI command/event for vendor operation, then this obviously does
>> not fit. However a similar model might make sense instead of manually building packets all the time.
> 
> We can extend __hci_cmd_sync() function with a new parameter 'type'.
> This way we can pass HCI_VENDOR_PKT into __hci_cmd_sync(), while other drivers will pass in HCI_COMMAND_PKT.

That will actually not work. And I also do not want to do that. The __hci_cmd_sync() is for real HCI packets. That means types 0x01 and 0x04 only. They need to adhere to the HCI flow control mechanism for commands.

> Our driver will make HCI_VENDOR_PKT -> MRVL_VENDOR_PKT conversion before downloading the frame to firmware. And the MRVL_VENDOR_PKT frame from firmware will be replaced with HCI_VENDOR_PKT while uploading the frame to stack.
> 
> Please let us know if this approach works for you or not.

I think this is best kept inside the driver. However you might consider building something like __hci_cmd_sync() that is specific to your driver, but allows for a similar flow within ->setup().

Regards

Marcel


^ permalink raw reply

* RE: [PATCH v5 1/2] Bluetooth: btmrvl: add setup handler
From: Bing Zhao @ 2013-09-24 19:42 UTC (permalink / raw)
  To: Johan Hedberg
  Cc: Marcel Holtmann, linux-bluetooth@vger.kernel.org, Gustavo Padovan,
	linux-wireless@vger.kernel.org, Mike Frysinger, Hyuckjoo Lee,
	Amitkumar Karwar
In-Reply-To: <20130924193010.GA2584@x220.p-661hnu-f1>

Hi Johan,

> Hi Bing,
> 
> On Tue, Sep 24, 2013, Bing Zhao wrote:
> > > that is a bug. It should only be ever called once. Could this be due
> > > to RFKILL issue we had? Please re-test with Johan's patches applied
> > > and check if it makes a difference. Otherwise please send some logs
> > > since we want to get this fixed.
> >
> > Amitkumar Karwar has tested it with latest code on bluetooth-next tree
> > but the result is the same.
> > Apparently two threads race to call hci_dev_open(). If the thread from
> > hci_sock calls hci_dev_open earlier, it ends up not updating HCI_SETUP
> > hdev flag in hci_power_on(). This results that the setup handler gets
> > called again when user brings up the interface later.
> 
> Let's see if I understood this right: the only hci_dev_open call in
> hci_sock.c is the one for the HCIDEVUP ioctl. So what you're doing is
> having user space call the HCIDEVUP ioctl before our own hci_power_on
> callback gets called to initialize the adapter?

That's right. The ioctl is initiated by the Bluetooth daemon.
Amitkumar has a setup that can reproduce this corner case easily.
I tested it on my Ubuntu but I couldn't replicate it.

> 
> You're right that we're missing the clearing of the HCI_SETUP flag for
> such a scenario. Could you try the attached patch. It should fix the
> issue. One problem that it does have is that if the HCIDEVUP ioctl path
> goes through before hci_power_on gets called we will never notify mgmt
> of the adapter. However, that might be acceptable here since if you're
> using HCIDEVUP like this it seems it's not a mgmt based system anyway.
> 
> > I checked the bluetooth-next tree, the following two patches (by
> > Johan) are not present in this tree.
> >
> > bf54303 Bluetooth: Fix rfkill functionality during the HCI setup stage
> > 5e13036 Bluetooth: Introduce a new HCI_RFKILLED flag
> >
> > They are in bluetooth.git tree. So, I'm not certain if Amitkumar has
> > applied them manually or not. Anyway we will re-test with Johan's
> > patches applied and confirm if they fix the race or not.
> 
> I don't think these patches will help you in this case.

OK, we will test your patch instead.

Thanks,
Bing


^ permalink raw reply

* Re: [PATCH v5 1/2] Bluetooth: btmrvl: add setup handler
From: Johan Hedberg @ 2013-09-24 19:30 UTC (permalink / raw)
  To: Bing Zhao
  Cc: Marcel Holtmann, linux-bluetooth@vger.kernel.org, Gustavo Padovan,
	linux-wireless@vger.kernel.org, Mike Frysinger, Hyuckjoo Lee,
	Amitkumar Karwar
In-Reply-To: <477F20668A386D41ADCC57781B1F70430F450779A4@SC-VEXCH1.marvell.com>

[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]

Hi Bing,

On Tue, Sep 24, 2013, Bing Zhao wrote:
> > that is a bug. It should only be ever called once. Could this be due
> > to RFKILL issue we had? Please re-test with Johan's patches applied
> > and check if it makes a difference. Otherwise please send some logs
> > since we want to get this fixed.
> 
> Amitkumar Karwar has tested it with latest code on bluetooth-next tree
> but the result is the same.
> Apparently two threads race to call hci_dev_open(). If the thread from
> hci_sock calls hci_dev_open earlier, it ends up not updating HCI_SETUP
> hdev flag in hci_power_on(). This results that the setup handler gets
> called again when user brings up the interface later.

Let's see if I understood this right: the only hci_dev_open call in
hci_sock.c is the one for the HCIDEVUP ioctl. So what you're doing is
having user space call the HCIDEVUP ioctl before our own hci_power_on
callback gets called to initialize the adapter?

You're right that we're missing the clearing of the HCI_SETUP flag for
such a scenario. Could you try the attached patch. It should fix the
issue. One problem that it does have is that if the HCIDEVUP ioctl path
goes through before hci_power_on gets called we will never notify mgmt
of the adapter. However, that might be acceptable here since if you're
using HCIDEVUP like this it seems it's not a mgmt based system anyway.

> I checked the bluetooth-next tree, the following two patches (by
> Johan) are not present in this tree.
> 
> bf54303 Bluetooth: Fix rfkill functionality during the HCI setup stage
> 5e13036 Bluetooth: Introduce a new HCI_RFKILLED flag
> 
> They are in bluetooth.git tree. So, I'm not certain if Amitkumar has
> applied them manually or not. Anyway we will re-test with Johan's
> patches applied and confirm if they fix the race or not.

I don't think these patches will help you in this case.

Johan

[-- Attachment #2: hci-setup.patch --]
[-- Type: text/plain, Size: 1114 bytes --]

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 634deba..c48bf1a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1164,7 +1164,7 @@ int hci_dev_open(__u16 dev)
 	atomic_set(&hdev->cmd_cnt, 1);
 	set_bit(HCI_INIT, &hdev->flags);
 
-	if (hdev->setup && test_bit(HCI_SETUP, &hdev->dev_flags))
+	if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags) && hdev->setup)
 		ret = hdev->setup(hdev);
 
 	if (!ret) {
@@ -1581,10 +1581,13 @@ static const struct rfkill_ops hci_rfkill_ops = {
 static void hci_power_on(struct work_struct *work)
 {
 	struct hci_dev *hdev = container_of(work, struct hci_dev, power_on);
+	bool setup;
 	int err;
 
 	BT_DBG("%s", hdev->name);
 
+	setup = test_bit(HCI_SETUP, &hdev->dev_flags);
+
 	err = hci_dev_open(hdev->id);
 	if (err < 0) {
 		mgmt_set_powered_failed(hdev, err);
@@ -1595,7 +1598,7 @@ static void hci_power_on(struct work_struct *work)
 		queue_delayed_work(hdev->req_workqueue, &hdev->power_off,
 				   HCI_AUTO_OFF_TIMEOUT);
 
-	if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags))
+	if (setup)
 		mgmt_index_added(hdev);
 }
 

^ permalink raw reply related

* RE: [PATCH v5 2/2] Bluetooth: btmrvl: add calibration data download support
From: Bing Zhao @ 2013-09-24 19:22 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: linux-bluetooth@vger.kernel.org, Gustavo Padovan, Johan Hedberg,
	linux-wireless@vger.kernel.org, Mike Frysinger, Hyuckjoo Lee,
	Amitkumar Karwar
In-Reply-To: <34088279-04B9-49D0-9387-88A602F518EC@holtmann.org>

Hi Marcel,

> > The reason of not using __hci_cmd_sync() is that we are sending vendor specific command here
> (MRVL_VENDOR_PKT). The __hci_cmd_sync seems handle HCI_COMMAND_PKT only.
> > Please let us know if you have any suggestion to solve this problem.
> 
> what is a MRVL_VENDOR_PKT actually?

It's defined as 0xfe in our driver. The firmware doesn't understand 0xff (HCI_VENDOR_PKT).

> 
> If you guys are not using standard HCI command/event for vendor operation, then this obviously does
> not fit. However a similar model might make sense instead of manually building packets all the time.

We can extend __hci_cmd_sync() function with a new parameter 'type'.
This way we can pass HCI_VENDOR_PKT into __hci_cmd_sync(), while other drivers will pass in HCI_COMMAND_PKT.

Our driver will make HCI_VENDOR_PKT -> MRVL_VENDOR_PKT conversion before downloading the frame to firmware. And the MRVL_VENDOR_PKT frame from firmware will be replaced with HCI_VENDOR_PKT while uploading the frame to stack.

Please let us know if this approach works for you or not.

Thanks,
Bing


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox