* Re: [PATCH] ath10k: remove unneded semicolon from ath10k_core_fetch_firmware_api_n()
From: Kalle Valo @ 2013-10-09 14:17 UTC (permalink / raw)
To: ath10k; +Cc: Fengguang Wu, linux-wireless
In-Reply-To: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> From: Fengguang Wu <fengguang.wu@intel.com>
>
> drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon
>
> Removes unneeded semicolon.
>
> Generated by: coccinelle/misc/semicolon.cocci
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Applied.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH] ath10k: fix ath10k_debug_start() locking
From: Kalle Valo @ 2013-10-09 14:15 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
In-Reply-To: <20131008184525.32604.64051.stgit@localhost6.localdomain6>
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> ath10k_debug_start() was not called with conf_mutex, fix that. Also there was a
> deadlock in ath10k_debug_stop(), rename it to ath10k_debug_destroy() and call
> it only when the device is destroyed.
>
> Reported-by: Mohammed Shafi Shajakhan <mohammed@qca.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Applied.
--
Kalle Valo
^ permalink raw reply
* Re: [mac80211] connection drop up to 20x/hour at office
From: Oleksij Rempel @ 2013-10-09 13:54 UTC (permalink / raw)
To: ASIC Felix, linux-wireless, ath9k-devel@lists.ath9k.org
In-Reply-To: <CAJqaZwy4priN+Zjnejvj2bbpBm6wN_smSZZi5FBSNrbDaLgiGw@mail.gmail.com>
Am 09.10.2013 06:29, schrieb ASIC Felix:
> I get this connection drop several times an hour, at office up to
> 20x/hour, with current Ubuntu Kernel + Backports wifi even at home,
> before only at the office. Wifi connection recovers eventually, but
> breaks VM and often even VPN connections.
20x per hour? it mean each 3 mints. Hmm... looks like scan interval of
wpa_supplicant.
Is it possible to change time to live setting of access point?
> Does anyone else see this? Further info needed?
>
> Ubuntu: 12-04 LTS
> Kernel: 3.2.0-54-generic #82-Ubuntu SMP x86_64
> Backports: v3.11-rc3-1-0-g4e81a94
> make menuconfig: [ ] enable powersave by default
>
> [ 1955.984833] wlan0: Aggregation is on for 00:24:01:45:51:41 tid 0
> [ 1961.168180] wlan0: tx session timer expired on 00:24:01:45:51:41 tid 0
> [ 1961.168259] wlan0: Tx BA session stop requested for 00:24:01:45:51:41 tid 0
> [ 1968.356133] wlan0: Stopping Tx BA session for 00:24:01:45:51:41 tid 0
> [ 1969.919269] wlan0: Rx BA session stop requested for
> 00:24:01:45:51:41 tid 1 recipient reason: 36
> [ 1969.921269] wlan0: moving STA 00:24:01:45:51:41 to state 3
> [ 1969.921280] wlan0: moving STA 00:24:01:45:51:41 to state 2
> [ 1969.921289] wlan0: moving STA 00:24:01:45:51:41 to state 1
> [ 1969.921294] wlan0: Removed STA 00:24:01:45:51:41
> [ 1969.994841] wlan0: Destroyed STA 00:24:01:45:51:41
> [ 1969.994901] cfg80211: Calling CRDA to update world regulatory domain
> [ 1970.007475] cfg80211: World regulatory domain updated:
> [ 1970.007483] cfg80211: (start_freq - end_freq @ bandwidth),
> (max_antenna_gain, max_eirp)
> [ 1970.007491] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz),
> (300 mBi, 2000 mBm)
> [ 1970.007497] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz),
> (300 mBi, 2000 mBm)
> [ 1970.007503] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz),
> (300 mBi, 2000 mBm)
> [ 1970.007509] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz),
> (300 mBi, 2000 mBm)
> [ 1970.007515] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz),
> (300 mBi, 2000 mBm)
> [ 1973.450965] wlan0: authenticate with 00:24:01:45:51:41
> [ 1973.450986] wlan0: Allocated STA 00:24:01:45:51:41
> [ 1973.463343] wlan0: Inserted STA 00:24:01:45:51:41
> [ 1973.463352] wlan0: send auth to 00:24:01:45:51:41 (try 1/3)
> [ 1973.573146] wlan0: send auth to 00:24:01:45:51:41 (try 2/3)
> [ 1973.753188] wlan0: authentication with 00:24:01:45:51:41 timed out
> [ 1973.757595] wlan0: Removed STA 00:24:01:45:51:41
>
> Driver / Wifi module etc:
>
> Loading modules backported from Linux version v3.11-rc3-0-g5ae90d8
> Backport generated by backports.git v3.11-rc3-1-0-g4e81a94
> cfg80211: Calling CRDA to update world regulatory domain
> cfg80211: World regulatory domain updated:
> cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
> cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
> cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
> cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
> cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
> cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
> ath9k 0000:0d:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
> ath9k 0000:0d:00.0: setting latency timer to 64
> ath: phy0: ASPM enabled: 0x42
> ath: EEPROM regdomain: 0x6a
> ath: EEPROM indicates we should expect a direct regpair map
> ath: Country alpha2 being used: 00
> ath: Regpair used: 0x6a
> ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
> Registered led device: ath9k-phy0
> ieee80211 phy0: Atheros AR9300 Rev:3 mem=0xffffc900118c0000, irq=18
>
>
> Felix
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Regards,
Oleksij
^ permalink raw reply
* Re: [PATCH] iwlwifi: don't WARN on bad firmware state
From: Emmanuel Grumbach @ 2013-10-09 13:40 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: ilw@linux.intel.com, linux-wireless
In-Reply-To: <20131009132429.GA1265@redhat.com>
On Wed, Oct 9, 2013 at 4:24 PM, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> When we restart firmware and it is marked as not alive, we can still get
> calls from mac80211. Don't WARN on in this situation as this triggers
> automatic bug reports with no valuable information.
>
> This continuation of:
>
> commit 8ca95995e64f5d270889badb3e449dca91106a2b
> Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Date: Sun Sep 15 11:37:17 2013 +0300
>
> iwlwifi: don't WARN on host commands sent when firmware is dead
>
> which remove WARN_ONCE from one place, but those warnings are also
> triggered from other functions.
>
> Patch also adds unlikely() statement.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
I picked it up. Thanks.
^ permalink raw reply
* [PATCH] iwlwifi: don't WARN on bad firmware state
From: Stanislaw Gruszka @ 2013-10-09 13:24 UTC (permalink / raw)
To: ilw; +Cc: linux-wireless
When we restart firmware and it is marked as not alive, we can still get
calls from mac80211. Don't WARN on in this situation as this triggers
automatic bug reports with no valuable information.
This continuation of:
commit 8ca95995e64f5d270889badb3e449dca91106a2b
Author: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Date: Sun Sep 15 11:37:17 2013 +0300
iwlwifi: don't WARN on host commands sent when firmware is dead
which remove WARN_ONCE from one place, but those warnings are also
triggered from other functions.
Patch also adds unlikely() statement.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/iwlwifi/iwl-trans.h | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 80b4750..c6bac7c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -601,7 +601,7 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
{
int ret;
- if (trans->state != IWL_TRANS_FW_ALIVE) {
+ if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
return -EIO;
}
@@ -640,8 +640,8 @@ static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
struct iwl_device_cmd *dev_cmd, int queue)
{
- WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
- "%s bad state = %d", __func__, trans->state);
+ if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
+ IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
return trans->ops->tx(trans, skb, dev_cmd, queue);
}
@@ -649,16 +649,16 @@ static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
static inline void iwl_trans_reclaim(struct iwl_trans *trans, int queue,
int ssn, struct sk_buff_head *skbs)
{
- WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
- "%s bad state = %d", __func__, trans->state);
+ if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
+ IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
trans->ops->reclaim(trans, queue, ssn, skbs);
}
static inline void iwl_trans_txq_disable(struct iwl_trans *trans, int queue)
{
- WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
- "%s bad state = %d", __func__, trans->state);
+ if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
+ IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
trans->ops->txq_disable(trans, queue);
}
@@ -669,8 +669,8 @@ static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
{
might_sleep();
- WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
- "%s bad state = %d", __func__, trans->state);
+ if (unlikely((trans->state != IWL_TRANS_FW_ALIVE)))
+ IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
trans->ops->txq_enable(trans, queue, fifo, sta_id, tid,
frame_limit, ssn);
@@ -685,8 +685,8 @@ static inline void iwl_trans_ac_txq_enable(struct iwl_trans *trans, int queue,
static inline int iwl_trans_wait_tx_queue_empty(struct iwl_trans *trans)
{
- WARN_ONCE(trans->state != IWL_TRANS_FW_ALIVE,
- "%s bad state = %d", __func__, trans->state);
+ if (unlikely(trans->state != IWL_TRANS_FW_ALIVE))
+ IWL_ERR(trans, "%s bad state = %d", __func__, trans->state);
return trans->ops->wait_tx_queue_empty(trans);
}
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel
From: Johannes Berg @ 2013-10-09 11:48 UTC (permalink / raw)
To: Sunil Dutt; +Cc: j, linux-wireless
In-Reply-To: <1381319011-7714-1-git-send-email-c_duttus@qti.qualcomm.com>
> +static int nl80211_parse_sta_channel_info(struct genl_info *info,
> + struct station_parameters *params)
> +{
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
> + params->supported_channels =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + params->supported_channels_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
> + /*
> + * Need to include at least One (first channel, number of
> + * channels) tuple for each subband.Thus, reject any trailing
> + * byte.
> + */
> + if (params->supported_channels_len % 2)
> + params->supported_channels_len -= 1;
> + }
That's not 'reject', that's ignore - and you're also not checking that
it's at least 2 bytes long.
> +
> + if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
> + params->supported_oper_classes =
> + nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + params->supported_oper_classes_len =
> + nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
> + /*
> + * The value of the Length field of the Supported Operating
> + * Classes element is between 2 and 253.
> + */
> + if (params->supported_oper_classes_len < 2 ||
> + params->supported_oper_classes_len > 253)
> + return -EINVAL;
And this would be inconsistent, one is rejected and the other ignored?
Also - you missed sign-off.
johannes
^ permalink raw reply
* [PATCH] cfg80211: Pass station supported channel and oper class info to kernel
From: Sunil Dutt @ 2013-10-09 11:43 UTC (permalink / raw)
To: johannes; +Cc: j, linux-wireless, c_duttus
The information of the peer's supported channels and supported operating
classes are required for the driver to perform TDLS off channel
operations. This commit enhances the function nl80211_(new)set_station
to pass this information of the peer to the driver.
---
include/net/cfg80211.h | 8 ++++++++
include/uapi/linux/nl80211.h | 9 +++++++++
net/wireless/nl80211.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cb71091..b1cfc93 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -735,6 +735,10 @@ enum station_parameters_apply_mask {
* @capability: station capability
* @ext_capab: extended capabilities of the station
* @ext_capab_len: number of extended capabilities
+ * @supported_channels: supported channels in IEEE 802.11 format
+ * @supported_channels_len: number of supported channels
+ * @supported_oper_classes: supported oper classes in IEEE 802.11 format
+ * @supported_oper_classes_len: number of supported operating classes
*/
struct station_parameters {
const u8 *supported_rates;
@@ -754,6 +758,10 @@ struct station_parameters {
u16 capability;
const u8 *ext_capab;
u8 ext_capab_len;
+ const u8 *supported_channels;
+ u8 supported_channels_len;
+ const u8 *supported_oper_classes;
+ u8 supported_oper_classes_len;
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index fde2c02..aec9a8a 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1496,6 +1496,11 @@ enum nl80211_commands {
* @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
* As specified in the &enum nl80211_rxmgmt_flags.
*
+ * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
+ * supported operating classes.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1806,6 +1811,10 @@ enum nl80211_attrs {
NL80211_ATTR_RXMGMT_FLAGS,
+ NL80211_ATTR_STA_SUPPORTED_CHANNELS,
+
+ NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 626dc3b..c234836 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -354,6 +354,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED },
[NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 },
[NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 },
+ [NL80211_ATTR_STA_SUPPORTED_CHANNELS] = { .type = NLA_BINARY },
+ [NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES] = { .type = NLA_BINARY },
};
/* policy for the key attributes */
@@ -3896,9 +3898,43 @@ static int nl80211_parse_sta_wme(struct genl_info *info,
return 0;
}
+static int nl80211_parse_sta_channel_info(struct genl_info *info,
+ struct station_parameters *params)
+{
+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]) {
+ params->supported_channels =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ params->supported_channels_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_CHANNELS]);
+ /*
+ * Need to include at least One (first channel, number of
+ * channels) tuple for each subband.Thus, reject any trailing
+ * byte.
+ */
+ if (params->supported_channels_len % 2)
+ params->supported_channels_len -= 1;
+ }
+
+ if (info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]) {
+ params->supported_oper_classes =
+ nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ params->supported_oper_classes_len =
+ nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES]);
+ /*
+ * The value of the Length field of the Supported Operating
+ * Classes element is between 2 and 253.
+ */
+ if (params->supported_oper_classes_len < 2 ||
+ params->supported_oper_classes_len > 253)
+ return -EINVAL;
+ }
+ return 0;
+}
+
static int nl80211_set_station_tdls(struct genl_info *info,
struct station_parameters *params)
{
+ int err;
/* Dummy STA entry gets updated once the peer capabilities are known */
if (info->attrs[NL80211_ATTR_PEER_AID])
params->aid = nla_get_u16(info->attrs[NL80211_ATTR_PEER_AID]);
@@ -3909,6 +3945,10 @@ static int nl80211_set_station_tdls(struct genl_info *info,
params->vht_capa =
nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);
+ err = nl80211_parse_sta_channel_info(info, params);
+ if (err)
+ return err;
+
return nl80211_parse_sta_wme(info, params);
}
@@ -4089,6 +4129,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}
+ err = nl80211_parse_sta_channel_info(info, ¶ms);
+ if (err)
+ return err;
+
err = nl80211_parse_sta_wme(info, ¶ms);
if (err)
return err;
--
1.8.2.1
^ permalink raw reply related
* Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel
From: Johannes Berg @ 2013-10-09 9:17 UTC (permalink / raw)
To: Undekari, Sunil Dutt; +Cc: j@w1.fi.com, linux-wireless@vger.kernel.org
In-Reply-To: <26F3B0343EE4744AA14EEEF9E1E534511F7251E7@aphydexd01a>
On Wed, 2013-10-09 at 09:13 +0000, Undekari, Sunil Dutt wrote:
> > It's just a question of where to address this - in the kernel or the supplicant. In a way, I'd rather have the kernel reject it and do the policy of ignoring invalid stuff in the supplicant.
> The above statement from you made me to rethink for the following check in the patch sent.
>
> + if (params->supported_oper_classes_len < 2 ||
> + params->supported_oper_classes_len > 253)
> + return -EINVAL;
>
> Are you fine to return a failure for the invalid length for the supported_oper_classes_len? If yes, then shouldn't we also do the similar check for invalid supported_channels_len ( < 2 ).
Certainly works for me - but there should also be something like % 2 I
guess
johannes
^ permalink raw reply
* RE: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel
From: Undekari, Sunil Dutt @ 2013-10-09 9:13 UTC (permalink / raw)
To: Johannes Berg; +Cc: j@w1.fi.com, linux-wireless@vger.kernel.org
In-Reply-To: <1381307517.14186.5.camel@jlt4.sipsolutions.net>
PiBJdCdzIGp1c3QgYSBxdWVzdGlvbiBvZiB3aGVyZSB0byBhZGRyZXNzIHRoaXMgLSBpbiB0aGUg
a2VybmVsIG9yIHRoZSBzdXBwbGljYW50LiBJbiBhIHdheSwgSSdkIHJhdGhlciBoYXZlIHRoZSBr
ZXJuZWwgcmVqZWN0IGl0IGFuZCBkbyB0aGUgcG9saWN5IG9mIGlnbm9yaW5nIGludmFsaWQgc3R1
ZmYgaW4gdGhlIHN1cHBsaWNhbnQuDQpUaGUgYWJvdmUgc3RhdGVtZW50IGZyb20geW91IG1hZGUg
bWUgdG8gcmV0aGluayBmb3IgdGhlIGZvbGxvd2luZyBjaGVjayBpbiB0aGUgcGF0Y2ggc2VudC4g
IA0KDQorICAgICAgICAgICAgICAgaWYgKHBhcmFtcy0+c3VwcG9ydGVkX29wZXJfY2xhc3Nlc19s
ZW4gPCAyIHx8DQorICAgICAgICAgICAgICAgICAgIHBhcmFtcy0+c3VwcG9ydGVkX29wZXJfY2xh
c3Nlc19sZW4gPiAyNTMpDQorICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsN
Cg0KQXJlIHlvdSBmaW5lIHRvIHJldHVybiBhIGZhaWx1cmUgZm9yIHRoZSBpbnZhbGlkIGxlbmd0
aCBmb3IgdGhlIHN1cHBvcnRlZF9vcGVyX2NsYXNzZXNfbGVuPyBJZiB5ZXMsIHRoZW4gc2hvdWxk
bid0IHdlIGFsc28gZG8gdGhlIHNpbWlsYXIgY2hlY2sgZm9yIGludmFsaWQgc3VwcG9ydGVkX2No
YW5uZWxzX2xlbiAoIDwgMiApLg0KDQpSZWdhcmRzLA0KU3VuaWwNCg0KLS0tLS1PcmlnaW5hbCBN
ZXNzYWdlLS0tLS0NCkZyb206IEpvaGFubmVzIEJlcmcgW21haWx0bzpqb2hhbm5lc0BzaXBzb2x1
dGlvbnMubmV0XSANClNlbnQ6IFdlZG5lc2RheSwgT2N0b2JlciAwOSwgMjAxMyAyOjAyIFBNDQpU
bzogVW5kZWthcmksIFN1bmlsIER1dHQNCkNjOiBqQHcxLmZpLmNvbTsgbGludXgtd2lyZWxlc3NA
dmdlci5rZXJuZWwub3JnDQpTdWJqZWN0OiBSZTogW1BBVENIXSBjZmc4MDIxMTogUGFzcyBzdGF0
aW9uIHN1cHBvcnRlZCBjaGFubmVsIGFuZCBvcGVyIGNsYXNzIGluZm8gdG8ga2VybmVsDQoNCk9u
IFdlZCwgMjAxMy0xMC0wOSBhdCAwODoxOSArMDAwMCwgVW5kZWthcmksIFN1bmlsIER1dHQgd3Jv
dGU6DQo+IEhpIEpvaGFubmVzLA0KPiANCj4gPkkgZ3Vlc3MgdGhlbiB3cGFfc3VwcGxpY2FudCB3
b3VsZCBoYXZlIHRvIHJlbW92ZSB0aGUgaW5mbyAtIG1heWJlIHRoZSBmYWlsdXJlIGNhc2Ugc2hv
dWxkbid0IGJlIHF1aXRlIGFzIGRyYWNvbmljPyBNYXliZSBtYWtlIGl0IGlnbm9yZSBhbnkgZXh0
cmEgdHJhaWxpbmcgYnl0ZT8NCj4gVGhhbmtzIGZvciB5b3VyIHBvaW50LiANCj4gSSBzdXBwb3Nl
LCByZXR1cm5pbmcgYSBmYWlsdXJlIGZvciB0aGUgbGVuZ3RoIGJlaW5nIGxlc3MgdGhhbiAyIGV2
ZW4gYWZ0ZXIgaWdub3JpbmcgdGhlIHRyYWlsaW5nIGJ5dGUgaXMgbm90IHJlcXVpcmVkIGZvciB0
aGUgcmVhc29uIHRoYXQgdGhlIHN1cHBvcnRlZCBjaGFubmVscyBpcyBub3QgYSBtYW5kYXRvcnkg
ZmllbGQgKGF0IGxlYXN0IHcuci50IFRETFMpLiBJdCBzaG91bGQgYmUgZmluZSB0byBqdXN0IHBh
c3MgdGhlIGxlbmd0aCBhcyAwIHRvIHRoZSBob3N0IGRyaXZlci4gUGxlYXNlIGNvcnJlY3QgbWUu
DQoNCkl0J3MganVzdCBhIHF1ZXN0aW9uIG9mIHdoZXJlIHRvIGFkZHJlc3MgdGhpcyAtIGluIHRo
ZSBrZXJuZWwgb3IgdGhlIHN1cHBsaWNhbnQuIEluIGEgd2F5LCBJJ2QgcmF0aGVyIGhhdmUgdGhl
IGtlcm5lbCByZWplY3QgaXQgYW5kIGRvIHRoZSBwb2xpY3kgb2YgaWdub3JpbmcgaW52YWxpZCBz
dHVmZiBpbiB0aGUgc3VwcGxpY2FudC4NCg0Kam9oYW5uZXMNCg0K
^ permalink raw reply
* [PATCH] rt2x00: use generic EWMA functions for average RSSI calculations
From: Gabor Juhos @ 2013-10-09 9:00 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, users, Gabor Juhos
Remove the local MOVING_AVERAGE implementation, and use
the generic EWMA functions instead.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/rt2x00/Kconfig | 1 +
drivers/net/wireless/rt2x00/rt2x00.h | 16 ++-----
drivers/net/wireless/rt2x00/rt2x00link.c | 70 +++++++++++-------------------
3 files changed, 29 insertions(+), 58 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
index 68dbbb9..a18b005 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -219,6 +219,7 @@ config RT2X00_LIB_USB
config RT2X00_LIB
tristate
+ select AVERAGE
config RT2X00_LIB_FIRMWARE
boolean
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index fe4c572..30ed92a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -39,6 +39,7 @@
#include <linux/input-polldev.h>
#include <linux/kfifo.h>
#include <linux/hrtimer.h>
+#include <linux/average.h>
#include <net/mac80211.h>
@@ -138,17 +139,6 @@
#define SHORT_EIFS ( SIFS + SHORT_DIFS + \
GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
-/*
- * Structure for average calculation
- * The avg field contains the actual average value,
- * but avg_weight is internally used during calculations
- * to prevent rounding errors.
- */
-struct avg_val {
- int avg;
- int avg_weight;
-};
-
enum rt2x00_chip_intf {
RT2X00_CHIP_INTF_PCI,
RT2X00_CHIP_INTF_PCIE,
@@ -297,7 +287,7 @@ struct link_ant {
* Similar to the avg_rssi in the link_qual structure
* this value is updated by using the walking average.
*/
- struct avg_val rssi_ant;
+ struct ewma rssi_ant;
};
/*
@@ -326,7 +316,7 @@ struct link {
/*
* Currently active average RSSI value
*/
- struct avg_val avg_rssi;
+ struct ewma avg_rssi;
/*
* Work structure for scheduling periodic link tuning.
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index 8368aab..a0e3c02 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -35,50 +35,28 @@
*/
#define DEFAULT_RSSI -128
-/*
- * Helper struct and macro to work with moving/walking averages.
- * When adding a value to the average value the following calculation
- * is needed:
- *
- * avg_rssi = ((avg_rssi * 7) + rssi) / 8;
- *
- * The advantage of this approach is that we only need 1 variable
- * to store the average in (No need for a count and a total).
- * But more importantly, normal average values will over time
- * move less and less towards newly added values this results
- * that with link tuning, the device can have a very good RSSI
- * for a few minutes but when the device is moved away from the AP
- * the average will not decrease fast enough to compensate.
- * The walking average compensates this and will move towards
- * the new values correctly allowing a effective link tuning,
- * the speed of the average moving towards other values depends
- * on the value for the number of samples. The higher the number
- * of samples, the slower the average will move.
- * We use two variables to keep track of the average value to
- * compensate for the rounding errors. This can be a significant
- * error (>5dBm) if the factor is too low.
- */
-#define AVG_SAMPLES 8
-#define AVG_FACTOR 1000
-#define MOVING_AVERAGE(__avg, __val) \
-({ \
- struct avg_val __new; \
- __new.avg_weight = \
- (__avg).avg_weight ? \
- ((((__avg).avg_weight * ((AVG_SAMPLES) - 1)) + \
- ((__val) * (AVG_FACTOR))) / \
- (AVG_SAMPLES)) : \
- ((__val) * (AVG_FACTOR)); \
- __new.avg = __new.avg_weight / (AVG_FACTOR); \
- __new; \
-})
+/* Constants for EWMA calculations. */
+#define RT2X00_EWMA_FACTOR 1024
+#define RT2X00_EWMA_WEIGHT 8
+
+static inline int rt2x00link_get_avg_rssi(struct ewma *ewma)
+{
+ unsigned long avg;
+
+ avg = ewma_read(ewma);
+ if (avg)
+ return -avg;
+
+ return DEFAULT_RSSI;
+}
static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
{
struct link_ant *ant = &rt2x00dev->link.ant;
- if (ant->rssi_ant.avg && rt2x00dev->link.qual.rx_success)
- return ant->rssi_ant.avg;
+ if (rt2x00dev->link.qual.rx_success)
+ return rt2x00link_get_avg_rssi(&ant->rssi_ant);
+
return DEFAULT_RSSI;
}
@@ -100,8 +78,8 @@ static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
{
- rt2x00dev->link.ant.rssi_ant.avg = 0;
- rt2x00dev->link.ant.rssi_ant.avg_weight = 0;
+ ewma_init(&rt2x00dev->link.ant.rssi_ant, RT2X00_EWMA_FACTOR,
+ RT2X00_EWMA_WEIGHT);
}
static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
@@ -249,12 +227,12 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
/*
* Update global RSSI
*/
- link->avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi);
+ ewma_add(&link->avg_rssi, -rxdesc->rssi);
/*
* Update antenna RSSI
*/
- ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi);
+ ewma_add(&ant->rssi_ant, -rxdesc->rssi);
}
void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
@@ -309,6 +287,8 @@ void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna)
*/
rt2x00dev->link.count = 0;
memset(qual, 0, sizeof(*qual));
+ ewma_init(&rt2x00dev->link.avg_rssi, RT2X00_EWMA_FACTOR,
+ RT2X00_EWMA_WEIGHT);
/*
* Restore the VGC level as stored in the registers,
@@ -363,10 +343,10 @@ static void rt2x00link_tuner(struct work_struct *work)
* collect the RSSI data we could use this. Otherwise we
* must fallback to the default RSSI value.
*/
- if (!link->avg_rssi.avg || !qual->rx_success)
+ if (!qual->rx_success)
qual->rssi = DEFAULT_RSSI;
else
- qual->rssi = link->avg_rssi.avg;
+ qual->rssi = rt2x00link_get_avg_rssi(&link->avg_rssi);
/*
* Check if link tuning is supported by the hardware, some hardware
--
1.7.10
^ permalink raw reply related
* Re: [PATCH] cfg80211: Pass station supported channel and oper class info to kernel
From: Johannes Berg @ 2013-10-09 8:31 UTC (permalink / raw)
To: Undekari, Sunil Dutt; +Cc: j@w1.fi.com, linux-wireless
In-Reply-To: <26F3B0343EE4744AA14EEEF9E1E534511F725129@aphydexd01a>
On Wed, 2013-10-09 at 08:19 +0000, Undekari, Sunil Dutt wrote:
> Hi Johannes,
>
> >I guess then wpa_supplicant would have to remove the info - maybe the failure case shouldn't be quite as draconic? Maybe make it ignore any extra trailing byte?
> Thanks for your point.
> I suppose, returning a failure for the length being less than 2 even after ignoring the trailing byte is not required for the reason that the supported channels is not a mandatory field (at least w.r.t TDLS). It should be fine to just pass the length as 0 to the host driver. Please correct me.
It's just a question of where to address this - in the kernel or the
supplicant. In a way, I'd rather have the kernel reject it and do the
policy of ignoring invalid stuff in the supplicant.
johannes
^ permalink raw reply
* Re: [PATCHv2 2/3] mac80211: enable DFS for IBSS mode
From: Johannes Berg @ 2013-10-09 8:03 UTC (permalink / raw)
To: Simon Wunderlich; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1381164067-4830-3-git-send-email-siwu@hrz.tu-chemnitz.de>
On Mon, 2013-10-07 at 18:41 +0200, Simon Wunderlich wrote:
> Allow changing to DFS channels if the channel is available for
> beaconing and userspace controls DFS operation.
>
> Channel switch announcement from other stations on DFS channels will
> be interpreted as radar event. These channels will then be marked as
> unvailable.
Applied
johannes
^ permalink raw reply
* [PATCH v2] mac80211: port CCMP to cryptoapi's CCM driver
From: Ard Biesheuvel @ 2013-10-09 7:56 UTC (permalink / raw)
To: linux-wireless, netdev; +Cc: patches, johannes, David.Laight, Ard Biesheuvel
Use the generic CCM aead chaining mode driver rather than a local
implementation that sits right on top of the core AES cipher.
This allows the use of accelerated implementations of either
CCM as a whole or the CTR mode which it encapsulates.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Changes since v1:
- use a better way to allocate the variable size aead_request struct on the
stack;
- pass only a single data pointer argument as we always encrypt/decrypt in
place;
- add a comment about how vector b_0 is generated.
net/mac80211/Kconfig | 1 +
net/mac80211/aes_ccm.c | 169 ++++++++++++++++---------------------------------
net/mac80211/aes_ccm.h | 14 ++--
net/mac80211/key.h | 2 +-
net/mac80211/wpa.c | 41 ++++++------
5 files changed, 85 insertions(+), 142 deletions(-)
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 62535fe..dc31ec3 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -4,6 +4,7 @@ config MAC80211
select CRYPTO
select CRYPTO_ARC4
select CRYPTO_AES
+ select CRYPTO_CCM
select CRC32
select AVERAGE
---help---
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index be7614b9..7c7df47 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -2,6 +2,8 @@
* Copyright 2003-2004, Instant802 Networks, Inc.
* Copyright 2005-2006, Devicescape Software, Inc.
*
+ * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@ -17,134 +19,75 @@
#include "key.h"
#include "aes_ccm.h"
-static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
+void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+ u8 *data, size_t data_len, u8 *mic)
{
- int i;
- u8 *b_0, *aad, *b, *s_0;
-
- b_0 = scratch + 3 * AES_BLOCK_SIZE;
- aad = scratch + 4 * AES_BLOCK_SIZE;
- b = scratch;
- s_0 = scratch + AES_BLOCK_SIZE;
-
- crypto_cipher_encrypt_one(tfm, b, b_0);
+ struct scatterlist assoc, pt, ct[2];
+ struct {
+ struct aead_request req;
+ u8 priv[crypto_aead_reqsize(tfm)];
+ } aead_req;
- /* Extra Authenticate-only data (always two AES blocks) */
- for (i = 0; i < AES_BLOCK_SIZE; i++)
- aad[i] ^= b[i];
- crypto_cipher_encrypt_one(tfm, b, aad);
+ memset(&aead_req, 0, sizeof(aead_req));
- aad += AES_BLOCK_SIZE;
+ sg_init_one(&pt, data, data_len);
+ sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
+ sg_init_table(ct, 2);
+ sg_set_buf(&ct[0], data, data_len);
+ sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
- for (i = 0; i < AES_BLOCK_SIZE; i++)
- aad[i] ^= b[i];
- crypto_cipher_encrypt_one(tfm, a, aad);
+ aead_request_set_tfm(&aead_req.req, tfm);
+ aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
+ aead_request_set_crypt(&aead_req.req, &pt, ct, data_len, b_0);
- /* Mask out bits from auth-only-b_0 */
- b_0[0] &= 0x07;
-
- /* S_0 is used to encrypt T (= MIC) */
- b_0[14] = 0;
- b_0[15] = 0;
- crypto_cipher_encrypt_one(tfm, s_0, b_0);
+ crypto_aead_encrypt(&aead_req.req);
}
-
-void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
- u8 *data, size_t data_len,
- u8 *cdata, u8 *mic)
+int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+ u8 *data, size_t data_len, u8 *mic)
{
- int i, j, last_len, num_blocks;
- u8 *pos, *cpos, *b, *s_0, *e, *b_0;
-
- b = scratch;
- s_0 = scratch + AES_BLOCK_SIZE;
- e = scratch + 2 * AES_BLOCK_SIZE;
- b_0 = scratch + 3 * AES_BLOCK_SIZE;
-
- num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
- last_len = data_len % AES_BLOCK_SIZE;
- aes_ccm_prepare(tfm, scratch, b);
-
- /* Process payload blocks */
- pos = data;
- cpos = cdata;
- for (j = 1; j <= num_blocks; j++) {
- int blen = (j == num_blocks && last_len) ?
- last_len : AES_BLOCK_SIZE;
-
- /* Authentication followed by encryption */
- for (i = 0; i < blen; i++)
- b[i] ^= pos[i];
- crypto_cipher_encrypt_one(tfm, b, b);
-
- b_0[14] = (j >> 8) & 0xff;
- b_0[15] = j & 0xff;
- crypto_cipher_encrypt_one(tfm, e, b_0);
- for (i = 0; i < blen; i++)
- *cpos++ = *pos++ ^ e[i];
- }
-
- for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
- mic[i] = b[i] ^ s_0[i];
+ struct scatterlist assoc, pt, ct[2];
+ struct {
+ struct aead_request req;
+ u8 priv[crypto_aead_reqsize(tfm)];
+ } aead_req;
+
+ memset(&aead_req, 0, sizeof(aead_req));
+
+ sg_init_one(&pt, data, data_len);
+ sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
+ sg_init_table(ct, 2);
+ sg_set_buf(&ct[0], data, data_len);
+ sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
+
+ aead_request_set_tfm(&aead_req.req, tfm);
+ aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
+ aead_request_set_crypt(&aead_req.req, ct, &pt,
+ data_len + IEEE80211_CCMP_MIC_LEN, b_0);
+
+ return crypto_aead_decrypt(&aead_req.req);
}
-
-int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
- u8 *cdata, size_t data_len, u8 *mic, u8 *data)
+struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[])
{
- int i, j, last_len, num_blocks;
- u8 *pos, *cpos, *b, *s_0, *a, *b_0;
-
- b = scratch;
- s_0 = scratch + AES_BLOCK_SIZE;
- a = scratch + 2 * AES_BLOCK_SIZE;
- b_0 = scratch + 3 * AES_BLOCK_SIZE;
-
- num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
- last_len = data_len % AES_BLOCK_SIZE;
- aes_ccm_prepare(tfm, scratch, a);
-
- /* Process payload blocks */
- cpos = cdata;
- pos = data;
- for (j = 1; j <= num_blocks; j++) {
- int blen = (j == num_blocks && last_len) ?
- last_len : AES_BLOCK_SIZE;
-
- /* Decryption followed by authentication */
- b_0[14] = (j >> 8) & 0xff;
- b_0[15] = j & 0xff;
- crypto_cipher_encrypt_one(tfm, b, b_0);
- for (i = 0; i < blen; i++) {
- *pos = *cpos++ ^ b[i];
- a[i] ^= *pos++;
- }
- crypto_cipher_encrypt_one(tfm, a, a);
- }
-
- for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
- if ((mic[i] ^ s_0[i]) != a[i])
- return -1;
- }
-
- return 0;
-}
+ struct crypto_aead *tfm;
+ int err;
+ tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
+ if (IS_ERR(tfm))
+ return tfm;
-struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
-{
- struct crypto_cipher *tfm;
+ err = crypto_aead_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
+ if (!err)
+ err = crypto_aead_setauthsize(tfm, IEEE80211_CCMP_MIC_LEN);
+ if (!err)
+ return tfm;
- tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
- if (!IS_ERR(tfm))
- crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
-
- return tfm;
+ crypto_free_aead(tfm);
+ return ERR_PTR(err);
}
-
-void ieee80211_aes_key_free(struct crypto_cipher *tfm)
+void ieee80211_aes_key_free(struct crypto_aead *tfm)
{
- crypto_free_cipher(tfm);
+ crypto_free_aead(tfm);
}
diff --git a/net/mac80211/aes_ccm.h b/net/mac80211/aes_ccm.h
index 5b7d744..2c7ab19 100644
--- a/net/mac80211/aes_ccm.h
+++ b/net/mac80211/aes_ccm.h
@@ -12,13 +12,11 @@
#include <linux/crypto.h>
-struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
-void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
- u8 *data, size_t data_len,
- u8 *cdata, u8 *mic);
-int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
- u8 *cdata, size_t data_len,
- u8 *mic, u8 *data);
-void ieee80211_aes_key_free(struct crypto_cipher *tfm);
+struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[]);
+void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+ u8 *data, size_t data_len, u8 *mic);
+int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
+ u8 *data, size_t data_len, u8 *mic);
+void ieee80211_aes_key_free(struct crypto_aead *tfm);
#endif /* AES_CCM_H */
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 036d57e..aaae0ed 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -83,7 +83,7 @@ struct ieee80211_key {
* Management frames.
*/
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
- struct crypto_cipher *tfm;
+ struct crypto_aead *tfm;
u32 replays; /* dot11RSNAStatsCCMPReplays */
} ccmp;
struct {
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index c9edfcb..62dc956 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -301,22 +301,16 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
}
-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
int encrypted)
{
__le16 mask_fc;
int a4_included, mgmt;
u8 qos_tid;
- u8 *b_0, *aad;
u16 data_len, len_a;
unsigned int hdrlen;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- memset(scratch, 0, 6 * AES_BLOCK_SIZE);
-
- b_0 = scratch + 3 * AES_BLOCK_SIZE;
- aad = scratch + 4 * AES_BLOCK_SIZE;
-
/*
* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
* Retry, PwrMgt, MoreData; set Protected
@@ -342,16 +336,22 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
if (encrypted)
data_len -= IEEE80211_CCMP_MIC_LEN;
- /* First block, b_0 */
- b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
+ /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
+ * mode authentication are not allowed to collide, yet both are derived
+ * from this vector b_0. We only set L := 1 here to indicate that the
+ * data size can be represented in (L+1) bytes, and store the size in
+ * the top (L+1) bytes. The setting and clearing of other bits that is
+ * required to derive the two different IVs is handled by the CCM layer.
+ */
+ b_0[0] = 0x1;
+ put_unaligned_be16(data_len, &b_0[14]);
+
/* Nonce: Nonce Flags | A2 | PN
* Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
*/
b_0[1] = qos_tid | (mgmt << 4);
memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
- /* l(m) */
- put_unaligned_be16(data_len, &b_0[14]);
/* AAD (extra authenticate-only data) / masked 802.11 header
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
@@ -407,7 +407,8 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
u8 *pos;
u8 pn[6];
u64 pn64;
- u8 scratch[6 * AES_BLOCK_SIZE];
+ u8 aad[2 * AES_BLOCK_SIZE];
+ u8 b_0[AES_BLOCK_SIZE];
if (info->control.hw_key &&
!(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
@@ -460,9 +461,9 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
return 0;
pos += IEEE80211_CCMP_HDR_LEN;
- ccmp_special_blocks(skb, pn, scratch, 0);
- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
- pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
+ ccmp_special_blocks(skb, pn, b_0, aad, 0);
+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
+ skb_put(skb, IEEE80211_CCMP_MIC_LEN));
return 0;
}
@@ -525,16 +526,16 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
}
if (!(status->flag & RX_FLAG_DECRYPTED)) {
- u8 scratch[6 * AES_BLOCK_SIZE];
+ u8 aad[2 * AES_BLOCK_SIZE];
+ u8 b_0[AES_BLOCK_SIZE];
/* hardware didn't decrypt/verify MIC */
- ccmp_special_blocks(skb, pn, scratch, 1);
+ ccmp_special_blocks(skb, pn, b_0, aad, 1);
if (ieee80211_aes_ccm_decrypt(
- key->u.ccmp.tfm, scratch,
+ key->u.ccmp.tfm, b_0, aad,
skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
data_len,
- skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
- skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN))
return RX_DROP_UNUSABLE;
}
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCHv2 1/3] nl80211/cfg80211: enable DFS for IBSS mode
From: Johannes Berg @ 2013-10-09 7:48 UTC (permalink / raw)
To: Simon Wunderlich; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich
In-Reply-To: <1381164067-4830-2-git-send-email-siwu@hrz.tu-chemnitz.de>
On Mon, 2013-10-07 at 18:41 +0200, Simon Wunderlich wrote:
> To use DFS in IBSS mode, userspace is required to react to radar events.
> It can inform nl80211 that it is capable of doing so by adding a
> NL80211_ATTR_DFS_CAPABLE attribute when joining the IBSS.
>
> This attribute is supplied to let the kernelspace know that the
> userspace application can and will handle radar events, e.g. by
> intiating channel switches to a valid channel. DFS channels may
> only be used if this attribute is supplied and the driver supports
> it. Driver support will be checked even if a channel without DFS
> will be initially joined, as a DFS channel may be chosen later.
Applied, fixed the attribute name above.
johannes
^ permalink raw reply
* Re: [PATCH] cfg80211: rename regulatory_hint_11d() to regulatory_hint_country_ie()
From: Johannes Berg @ 2013-10-09 7:38 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linux-wireless
In-Reply-To: <1380935244-22612-1-git-send-email-mcgrof@do-not-panic.com>
On Fri, 2013-10-04 at 18:07 -0700, Luis R. Rodriguez wrote:
> It is incorrect to refer to this as 11d as 802.11d was just a
> proposed ammendment, 802.11d was merged to the standard so
> use proper terminology.
Applied.
johannes
^ permalink raw reply
* pull-request: mac80211 2013-10-09
From: Johannes Berg @ 2013-10-09 7:11 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]
John,
Another pull request for mac80211 fixes ...
Jouni fixes a remain-on-channel vs. scan bug, and Felix fixes client TX
probing on VLANs.
Let me know if there's any problem.
johannes
The following changes since commit aa5f66d5a1df1c2b04bccdcb19711675c765d7c4:
cfg80211: fix sysfs registration race (2013-09-26 20:03:45 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git for-john
for you to fetch changes up to 22c4ceed0184318ec5a6182c6d75d398452c2e39:
mac80211: Run deferred scan if last roc_list item is not started (2013-09-30 12:36:56 +0200)
----------------------------------------------------------------
Felix Fietkau (2):
mac80211: use sta_info_get_bss() for nl80211 tx and client probing
mac80211: update sta->last_rx on acked tx frames
Jouni Malinen (1):
mac80211: Run deferred scan if last roc_list item is not started
net/mac80211/cfg.c | 2 +-
net/mac80211/offchannel.c | 2 ++
net/mac80211/status.c | 3 +++
net/mac80211/tx.c | 3 ++-
4 files changed, 8 insertions(+), 2 deletions(-)
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [mac80211] connection drop up to 20x/hour at office
From: ASIC Felix @ 2013-10-09 4:29 UTC (permalink / raw)
To: linux-wireless
I get this connection drop several times an hour, at office up to
20x/hour, with current Ubuntu Kernel + Backports wifi even at home,
before only at the office. Wifi connection recovers eventually, but
breaks VM and often even VPN connections.
Does anyone else see this? Further info needed?
Ubuntu: 12-04 LTS
Kernel: 3.2.0-54-generic #82-Ubuntu SMP x86_64
Backports: v3.11-rc3-1-0-g4e81a94
make menuconfig: [ ] enable powersave by default
[ 1955.984833] wlan0: Aggregation is on for 00:24:01:45:51:41 tid 0
[ 1961.168180] wlan0: tx session timer expired on 00:24:01:45:51:41 tid 0
[ 1961.168259] wlan0: Tx BA session stop requested for 00:24:01:45:51:41 tid 0
[ 1968.356133] wlan0: Stopping Tx BA session for 00:24:01:45:51:41 tid 0
[ 1969.919269] wlan0: Rx BA session stop requested for
00:24:01:45:51:41 tid 1 recipient reason: 36
[ 1969.921269] wlan0: moving STA 00:24:01:45:51:41 to state 3
[ 1969.921280] wlan0: moving STA 00:24:01:45:51:41 to state 2
[ 1969.921289] wlan0: moving STA 00:24:01:45:51:41 to state 1
[ 1969.921294] wlan0: Removed STA 00:24:01:45:51:41
[ 1969.994841] wlan0: Destroyed STA 00:24:01:45:51:41
[ 1969.994901] cfg80211: Calling CRDA to update world regulatory domain
[ 1970.007475] cfg80211: World regulatory domain updated:
[ 1970.007483] cfg80211: (start_freq - end_freq @ bandwidth),
(max_antenna_gain, max_eirp)
[ 1970.007491] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz),
(300 mBi, 2000 mBm)
[ 1970.007497] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz),
(300 mBi, 2000 mBm)
[ 1970.007503] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz),
(300 mBi, 2000 mBm)
[ 1970.007509] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz),
(300 mBi, 2000 mBm)
[ 1970.007515] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz),
(300 mBi, 2000 mBm)
[ 1973.450965] wlan0: authenticate with 00:24:01:45:51:41
[ 1973.450986] wlan0: Allocated STA 00:24:01:45:51:41
[ 1973.463343] wlan0: Inserted STA 00:24:01:45:51:41
[ 1973.463352] wlan0: send auth to 00:24:01:45:51:41 (try 1/3)
[ 1973.573146] wlan0: send auth to 00:24:01:45:51:41 (try 2/3)
[ 1973.753188] wlan0: authentication with 00:24:01:45:51:41 timed out
[ 1973.757595] wlan0: Removed STA 00:24:01:45:51:41
Driver / Wifi module etc:
Loading modules backported from Linux version v3.11-rc3-0-g5ae90d8
Backport generated by backports.git v3.11-rc3-1-0-g4e81a94
cfg80211: Calling CRDA to update world regulatory domain
cfg80211: World regulatory domain updated:
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
ath9k 0000:0d:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
ath9k 0000:0d:00.0: setting latency timer to 64
ath: phy0: ASPM enabled: 0x42
ath: EEPROM regdomain: 0x6a
ath: EEPROM indicates we should expect a direct regpair map
ath: Country alpha2 being used: 00
ath: Regpair used: 0x6a
ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
Registered led device: ath9k-phy0
ieee80211 phy0: Atheros AR9300 Rev:3 mem=0xffffc900118c0000, irq=18
Felix
^ permalink raw reply
* Re: [PATCH/RFT v2 1/4] ath10k: fix add_interface failure handling
From: Michal Kazior @ 2013-10-09 2:59 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless, ath10k
In-Reply-To: <87siwbr2sc.fsf@kamboji.qca.qualcomm.com>
On 8 October 2013 12:16, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
> Michal Kazior <michal.kazior@tieto.com> writes:
>
>> On 8 October 2013 05:54, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
>>> Michal Kazior <michal.kazior@tieto.com> writes:
>>>
>>>> If something failed along add_interface() setup it
>>>> was possible to leak a vdev id, vdev and peer.
>>>>
>>>> This could end up with leaked FW state or FW crash
>>>> (assuming add_interface() failure wasn't a result of
>>>> a crash).
>>>>
>>>> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
>>>
>>> Then I apply this patch on top of current ath.git master branch (commit
>>> 18fe0b53e76) interface up fails on the managed mode:
>>>
>>> $ sudo ip link set wlan1 up
>>> RTNETLINK answers: Invalid argument
>>>
>>> Logs don't have anything special (the TX encap error was already
>>> before):
>>>
>>> [ 1259.818863] ath10k: MSI-X didn't succeed (1), trying MSI
>>> [ 1259.819298] ath10k_pci 0000:02:00.0: irq 49 for MSI/MSI-X
>>> [ 1259.820055] ath10k: MSI interrupt handling
>>> [ 1260.747877] ath10k: UART prints disabled
>>> [ 1260.828219] ath10k: firmware 10.1.389 booted
>>> [ 1260.837585] ath10k: htt target version 2.1
>>> [ 1260.838498] ath10k: Failed to set TX encap: -22
>>
>> Ah. Right. I've tested this patch with main FW branch which supports
>> TX encap command. The TX encap issue should be dealth with first.
>
> What do you mean? Did I miss a patch?
You didn't miss any patch.
I think you've already pointed out the TX encap warning in your other email.
It's the TX encap that most likely gets you "invalid argument" when
trying to bring up the interface with my patch as FW 10.1.389 doesn't
support the command.
Michał
^ permalink raw reply
* Re: [PATCH] wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware
From: Joe Perches @ 2013-10-08 20:54 UTC (permalink / raw)
To: Eugene Krasnikov; +Cc: linville, linux-wireless, wcn36xx
In-Reply-To: <1381263958-14846-1-git-send-email-k.eugene.e@gmail.com>
On Tue, 2013-10-08 at 21:25 +0100, Eugene Krasnikov wrote:
> This is a mac80211 driver for Qualcomm WCN3660/WCN3680 devices. So
> far WCN3660/WCN3680 is available only on MSM platform.
some trivia:
> diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
[]
> +static ssize_t read_file_bool_bmps(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_vif *vif = NULL;
> + char buf[3];
> +
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (NL80211_IFTYPE_STATION == vif->type) {
> + if (vif_priv->pw_state == WCN36XX_BMPS)
> + buf[0] = '1';
> + else
> + buf[0] = '0';
> + break;
> + }
please indent this properly.
list_for_each...(...) {
statement...;
statement...;
}
[]
> +static ssize_t write_file_bool_bmps(struct file *file,
> + const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_vif *vif = NULL;
> +
> + char buf[32];
> + int buf_size;
> +
> + buf_size = min(count, (sizeof(buf)-1));
> + if (copy_from_user(buf, user_buf, buf_size))
> + return -EFAULT;
> +
> + switch (buf[0]) {
> + case 'y':
> + case 'Y':
> + case '1':
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (NL80211_IFTYPE_STATION == vif->type) {
trivia:
Please use
if (test == CONSTANT)
Yes, I know the compiler complains if you
mistakenly leave out one of the = this way.
> +#define ADD_FILE(name, mode, fop, priv_data) \
> + do { \
> + struct dentry *d; \
> + d = debugfs_create_file(__stringify(name), \
> + mode, dfs->rootdir, \
> + priv_data, fop); \
> + dfs->file_##name.dentry = d; \
> + if (IS_ERR(d)) { \
> + wcn36xx_warn("Create the debugfs entry failed");\
missing "\n" newline
> + dfs->file_##name.dentry = NULL; \
[]
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
[]
> +static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch *wcn_ch)
> +{
> + struct wcn36xx_dxe_desc *cur_dxe = NULL;
> + struct wcn36xx_dxe_desc *prev_dxe = NULL;
> + struct wcn36xx_dxe_ctl *cur_ctl = NULL;
> + size_t size;
> + int i;
> +
> + size = wcn_ch->desc_num * sizeof(struct wcn36xx_dxe_desc);
> + wcn_ch->cpu_addr = dma_alloc_coherent(NULL, size, &wcn_ch->dma_addr,
> + GFP_KERNEL);
dma_zalloc_coherent
[]
> + memset(wcn_ch->cpu_addr, 0, size);
No longer required.
> + if (0 == i) {
too many styles mixing i == 0 and 0 == i
[]
> +int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
> +{
> + size_t s;
mixing s and size above, please use one style/name.
> + void *cpu_addr;
> +
> + /* Allocate BD headers for MGMT frames */
> +
> + /* Where this come from ask QC */
> + wcn->mgmt_mem_pool.chunk_size = WCN36XX_BD_CHUNK_SIZE +
> + 16 - (WCN36XX_BD_CHUNK_SIZE % 8);
> +
> + s = wcn->mgmt_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_H;
> + cpu_addr = dma_alloc_coherent(NULL, s, &wcn->mgmt_mem_pool.phy_addr,
> + GFP_KERNEL);
same use of dma_zalloc_coherent(...)
> + if (!cpu_addr)
> + goto out_err;
> +
> + wcn->mgmt_mem_pool.virt_addr = cpu_addr;
> + memset(cpu_addr, 0, s);
Now unnecessary memset.
too long, stopped reading.
^ permalink raw reply
* Re: [PATCH] wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware
From: Eugene Krasnikov @ 2013-10-08 20:30 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, wcn36xx
In-Reply-To: <1381263958-14846-1-git-send-email-k.eugene.e@gmail.com>
Hi John,
This is the final version of wcn36xx driver with sparce/smatch
warnings fixed. Please let me know if there are any problems.
On Tue, Oct 8, 2013 at 10:25 PM, Eugene Krasnikov <k.eugene.e@gmail.com> wrote:
> This is a mac80211 driver for Qualcomm WCN3660/WCN3680 devices. So
> far WCN3660/WCN3680 is available only on MSM platform.
>
> Firmware can be found here:
> https://www.codeaurora.org/cgit/external/hisense/platform/vendor/qcom-opensource/wlan/prima/tree/firmware_bin?h=8130_CS
>
> Wiki page is available here:
> http://wireless.kernel.org/en/users/Drivers/wcn36xx
>
> A lot people made a contribution to this driver. Here is the list in
> alphabetical order:
>
> Eugene Krasnikov <k.eugene.e@gmail.com>
> Kalle Valo <kvalo@qca.qualcomm.com>
> Olof Johansson <dev@skyshaper.net>
> Pontus Fuchs <pontus.fuchs@gmail.com>
> Yanbo Li <yanbol@qti.qualcomm.com>
>
> Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
> ---
> MAINTAINERS | 8 +
> drivers/net/wireless/ath/Kconfig | 1 +
> drivers/net/wireless/ath/Makefile | 1 +
> drivers/net/wireless/ath/wcn36xx/Kconfig | 16 +
> drivers/net/wireless/ath/wcn36xx/Makefile | 7 +
> drivers/net/wireless/ath/wcn36xx/debug.c | 188 ++
> drivers/net/wireless/ath/wcn36xx/debug.h | 49 +
> drivers/net/wireless/ath/wcn36xx/dxe.c | 805 +++++
> drivers/net/wireless/ath/wcn36xx/dxe.h | 284 ++
> drivers/net/wireless/ath/wcn36xx/hal.h | 4657 ++++++++++++++++++++++++++++
> drivers/net/wireless/ath/wcn36xx/main.c | 1036 +++++++
> drivers/net/wireless/ath/wcn36xx/pmc.c | 62 +
> drivers/net/wireless/ath/wcn36xx/pmc.h | 33 +
> drivers/net/wireless/ath/wcn36xx/smd.c | 2126 +++++++++++++
> drivers/net/wireless/ath/wcn36xx/smd.h | 127 +
> drivers/net/wireless/ath/wcn36xx/txrx.c | 284 ++
> drivers/net/wireless/ath/wcn36xx/txrx.h | 160 +
> drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 238 ++
> 18 files changed, 10082 insertions(+)
> create mode 100644 drivers/net/wireless/ath/wcn36xx/Kconfig
> create mode 100644 drivers/net/wireless/ath/wcn36xx/Makefile
> create mode 100644 drivers/net/wireless/ath/wcn36xx/debug.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/debug.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/dxe.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/dxe.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/hal.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/main.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/pmc.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/pmc.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/smd.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/smd.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.c
> create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.h
> create mode 100644 drivers/net/wireless/ath/wcn36xx/wcn36xx.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 705bb96..5cf566d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6745,6 +6745,14 @@ L: linux-hexagon@vger.kernel.org
> S: Supported
> F: arch/hexagon/
>
> +QUALCOMM WCN36XX WIRELESS DRIVER
> +M: Eugene Krasnikov <k.eugene.e@gmail.com>
> +L: wcn36xx@lists.infradead.org
> +W: http://wireless.kernel.org/en/users/Drivers/wcn36xx
> +T: git git://github.com/KrasnikovEugene/wcn36xx.git
> +S: Supported
> +F: drivers/net/wireless/ath/wcn36xx/
> +
> QUICKCAM PARALLEL PORT WEBCAMS
> M: Hans Verkuil <hverkuil@xs4all.nl>
> L: linux-media@vger.kernel.org
> diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
> index 1abf1d4..ba81d62 100644
> --- a/drivers/net/wireless/ath/Kconfig
> +++ b/drivers/net/wireless/ath/Kconfig
> @@ -32,5 +32,6 @@ source "drivers/net/wireless/ath/ath6kl/Kconfig"
> source "drivers/net/wireless/ath/ar5523/Kconfig"
> source "drivers/net/wireless/ath/wil6210/Kconfig"
> source "drivers/net/wireless/ath/ath10k/Kconfig"
> +source "drivers/net/wireless/ath/wcn36xx/Kconfig"
>
> endif
> diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
> index fb05cfd..363b056 100644
> --- a/drivers/net/wireless/ath/Makefile
> +++ b/drivers/net/wireless/ath/Makefile
> @@ -5,6 +5,7 @@ obj-$(CONFIG_ATH6KL) += ath6kl/
> obj-$(CONFIG_AR5523) += ar5523/
> obj-$(CONFIG_WIL6210) += wil6210/
> obj-$(CONFIG_ATH10K) += ath10k/
> +obj-$(CONFIG_WCN36XX) += wcn36xx/
>
> obj-$(CONFIG_ATH_COMMON) += ath.o
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig b/drivers/net/wireless/ath/wcn36xx/Kconfig
> new file mode 100644
> index 0000000..591ebae
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
> @@ -0,0 +1,16 @@
> +config WCN36XX
> + tristate "Qualcomm Atheros WCN3660/3680 support"
> + depends on MAC80211 && HAS_DMA
> + ---help---
> + This module adds support for wireless adapters based on
> + Qualcomm Atheros WCN3660 and WCN3680 mobile chipsets.
> +
> + If you choose to build a module, it'll be called wcn36xx.
> +
> +config WCN36XX_DEBUGFS
> + bool "WCN36XX debugfs support"
> + depends on WCN36XX
> + ---help---
> + Enabled debugfs support
> +
> + If unsure, say Y to make it easier to debug problems.
> diff --git a/drivers/net/wireless/ath/wcn36xx/Makefile b/drivers/net/wireless/ath/wcn36xx/Makefile
> new file mode 100644
> index 0000000..50c43b4
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/Makefile
> @@ -0,0 +1,7 @@
> +obj-$(CONFIG_WCN36XX) := wcn36xx.o
> +wcn36xx-y += main.o \
> + dxe.o \
> + txrx.o \
> + smd.o \
> + pmc.o \
> + debug.o
> diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
> new file mode 100644
> index 0000000..682bcd6
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/debug.c
> @@ -0,0 +1,188 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/debugfs.h>
> +#include <linux/uaccess.h>
> +#include "wcn36xx.h"
> +#include "debug.h"
> +#include "pmc.h"
> +
> +#ifdef CONFIG_WCN36XX_DEBUGFS
> +
> +static int wcn36xx_debugfs_open(struct inode *inode, struct file *file)
> +{
> + file->private_data = inode->i_private;
> +
> + return 0;
> +}
> +
> +static ssize_t read_file_bool_bmps(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_vif *vif = NULL;
> + char buf[3];
> +
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (NL80211_IFTYPE_STATION == vif->type) {
> + if (vif_priv->pw_state == WCN36XX_BMPS)
> + buf[0] = '1';
> + else
> + buf[0] = '0';
> + break;
> + }
> + }
> + buf[1] = '\n';
> + buf[2] = 0x00;
> +
> + return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
> +}
> +
> +static ssize_t write_file_bool_bmps(struct file *file,
> + const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_vif *vif = NULL;
> +
> + char buf[32];
> + int buf_size;
> +
> + buf_size = min(count, (sizeof(buf)-1));
> + if (copy_from_user(buf, user_buf, buf_size))
> + return -EFAULT;
> +
> + switch (buf[0]) {
> + case 'y':
> + case 'Y':
> + case '1':
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (NL80211_IFTYPE_STATION == vif->type) {
> + wcn36xx_enable_keep_alive_null_packet(wcn, vif);
> + wcn36xx_pmc_enter_bmps_state(wcn, vif);
> + }
> + }
> + break;
> + case 'n':
> + case 'N':
> + case '0':
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (NL80211_IFTYPE_STATION == vif->type)
> + wcn36xx_pmc_exit_bmps_state(wcn, vif);
> + }
> + break;
> + }
> +
> + return count;
> +}
> +
> +static const struct file_operations fops_wcn36xx_bmps = {
> + .open = wcn36xx_debugfs_open,
> + .read = read_file_bool_bmps,
> + .write = write_file_bool_bmps,
> +};
> +
> +static ssize_t write_file_dump(struct file *file,
> + const char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wcn36xx *wcn = file->private_data;
> + char buf[255], *tmp;
> + int buf_size;
> + u32 arg[WCN36xx_MAX_DUMP_ARGS];
> + int i;
> +
> + memset(buf, 0, sizeof(buf));
> + memset(arg, 0, sizeof(arg));
> +
> + buf_size = min(count, (sizeof(buf) - 1));
> + if (copy_from_user(buf, user_buf, buf_size))
> + return -EFAULT;
> +
> + tmp = buf;
> +
> + for (i = 0; i < WCN36xx_MAX_DUMP_ARGS; i++) {
> + char *begin;
> + begin = strsep(&tmp, " ");
> + if (begin == NULL)
> + break;
> +
> + if (kstrtoul(begin, 0, (unsigned long *)(arg + i)) != 0)
> + break;
> + }
> +
> + wcn36xx_info("DUMP args is %d %d %d %d %d\n", arg[0], arg[1], arg[2],
> + arg[3], arg[4]);
> + wcn36xx_smd_dump_cmd_req(wcn, arg[0], arg[1], arg[2], arg[3], arg[4]);
> +
> + return count;
> +}
> +
> +static const struct file_operations fops_wcn36xx_dump = {
> + .open = wcn36xx_debugfs_open,
> + .write = write_file_dump,
> +};
> +
> +#define ADD_FILE(name, mode, fop, priv_data) \
> + do { \
> + struct dentry *d; \
> + d = debugfs_create_file(__stringify(name), \
> + mode, dfs->rootdir, \
> + priv_data, fop); \
> + dfs->file_##name.dentry = d; \
> + if (IS_ERR(d)) { \
> + wcn36xx_warn("Create the debugfs entry failed");\
> + dfs->file_##name.dentry = NULL; \
> + } \
> + } while (0)
> +
> +
> +void wcn36xx_debugfs_init(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
> +
> + dfs->rootdir = debugfs_create_dir(KBUILD_MODNAME,
> + wcn->hw->wiphy->debugfsdir);
> + if (IS_ERR(dfs->rootdir)) {
> + wcn36xx_warn("Create the debugfs failed\n");
> + dfs->rootdir = NULL;
> + }
> +
> + ADD_FILE(bmps_switcher, S_IRUSR | S_IWUSR,
> + &fops_wcn36xx_bmps, wcn);
> + ADD_FILE(dump, S_IWUSR, &fops_wcn36xx_dump, wcn);
> +}
> +
> +void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
> + debugfs_remove_recursive(dfs->rootdir);
> +}
> +
> +#endif /* CONFIG_WCN36XX_DEBUGFS */
> diff --git a/drivers/net/wireless/ath/wcn36xx/debug.h b/drivers/net/wireless/ath/wcn36xx/debug.h
> new file mode 100644
> index 0000000..46307aa
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/debug.h
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _WCN36XX_DEBUG_H_
> +#define _WCN36XX_DEBUG_H_
> +
> +#include <linux/kernel.h>
> +
> +#define WCN36xx_MAX_DUMP_ARGS 5
> +
> +#ifdef CONFIG_WCN36XX_DEBUGFS
> +struct wcn36xx_dfs_file {
> + struct dentry *dentry;
> + u32 value;
> +};
> +
> +struct wcn36xx_dfs_entry {
> + struct dentry *rootdir;
> + struct wcn36xx_dfs_file file_bmps_switcher;
> + struct wcn36xx_dfs_file file_dump;
> +};
> +
> +void wcn36xx_debugfs_init(struct wcn36xx *wcn);
> +void wcn36xx_debugfs_exit(struct wcn36xx *wcn);
> +
> +#else
> +static inline void wcn36xx_debugfs_init(struct wcn36xx *wcn)
> +{
> +}
> +static inline void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
> +{
> +}
> +
> +#endif /* CONFIG_WCN36XX_DEBUGFS */
> +
> +#endif /* _WCN36XX_DEBUG_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
> new file mode 100644
> index 0000000..ee25786
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
> @@ -0,0 +1,805 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +/* DXE - DMA transfer engine
> + * we have 2 channels(High prio and Low prio) for TX and 2 channels for RX.
> + * through low channels data packets are transfered
> + * through high channels managment packets are transfered
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/interrupt.h>
> +#include "wcn36xx.h"
> +#include "txrx.h"
> +
> +void *wcn36xx_dxe_get_next_bd(struct wcn36xx *wcn, bool is_low)
> +{
> + struct wcn36xx_dxe_ch *ch = is_low ?
> + &wcn->dxe_tx_l_ch :
> + &wcn->dxe_tx_h_ch;
> +
> + return ch->head_blk_ctl->bd_cpu_addr;
> +}
> +
> +static void wcn36xx_dxe_write_register(struct wcn36xx *wcn, int addr, int data)
> +{
> + wcn36xx_dbg(WCN36XX_DBG_DXE,
> + "wcn36xx_dxe_write_register: addr=%x, data=%x\n",
> + addr, data);
> +
> + writel(data, wcn->mmio + addr);
> +}
> +
> +static void wcn36xx_dxe_read_register(struct wcn36xx *wcn, int addr, int *data)
> +{
> + *data = readl(wcn->mmio + addr);
> +
> + wcn36xx_dbg(WCN36XX_DBG_DXE,
> + "wcn36xx_dxe_read_register: addr=%x, data=%x\n",
> + addr, *data);
> +}
> +
> +static void wcn36xx_dxe_free_ctl_block(struct wcn36xx_dxe_ch *ch)
> +{
> + struct wcn36xx_dxe_ctl *ctl = ch->head_blk_ctl, *next;
> + int i;
> +
> + for (i = 0; i < ch->desc_num && ctl; i++) {
> + next = ctl->next;
> + kfree(ctl);
> + ctl = next;
> + }
> +}
> +
> +static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
> +{
> + struct wcn36xx_dxe_ctl *prev_ctl = NULL;
> + struct wcn36xx_dxe_ctl *cur_ctl = NULL;
> + int i;
> +
> + for (i = 0; i < ch->desc_num; i++) {
> + cur_ctl = kzalloc(sizeof(*cur_ctl), GFP_KERNEL);
> + if (!cur_ctl)
> + goto out_fail;
> +
> + cur_ctl->ctl_blk_order = i;
> + if (i == 0) {
> + ch->head_blk_ctl = cur_ctl;
> + ch->tail_blk_ctl = cur_ctl;
> + } else if (ch->desc_num - 1 == i) {
> + prev_ctl->next = cur_ctl;
> + cur_ctl->next = ch->head_blk_ctl;
> + } else {
> + prev_ctl->next = cur_ctl;
> + }
> + prev_ctl = cur_ctl;
> + }
> +
> + return 0;
> +
> +out_fail:
> + wcn36xx_dxe_free_ctl_block(ch);
> + return -ENOMEM;
> +}
> +
> +int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn)
> +{
> + int ret;
> +
> + wcn->dxe_tx_l_ch.ch_type = WCN36XX_DXE_CH_TX_L;
> + wcn->dxe_tx_h_ch.ch_type = WCN36XX_DXE_CH_TX_H;
> + wcn->dxe_rx_l_ch.ch_type = WCN36XX_DXE_CH_RX_L;
> + wcn->dxe_rx_h_ch.ch_type = WCN36XX_DXE_CH_RX_H;
> +
> + wcn->dxe_tx_l_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_TX_L;
> + wcn->dxe_tx_h_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_TX_H;
> + wcn->dxe_rx_l_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_L;
> + wcn->dxe_rx_h_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_H;
> +
> + wcn->dxe_tx_l_ch.dxe_wq = WCN36XX_DXE_WQ_TX_L;
> + wcn->dxe_tx_h_ch.dxe_wq = WCN36XX_DXE_WQ_TX_H;
> +
> + wcn->dxe_tx_l_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_L_BD;
> + wcn->dxe_tx_h_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_H_BD;
> +
> + wcn->dxe_tx_l_ch.ctrl_skb = WCN36XX_DXE_CTRL_TX_L_SKB;
> + wcn->dxe_tx_h_ch.ctrl_skb = WCN36XX_DXE_CTRL_TX_H_SKB;
> +
> + wcn->dxe_tx_l_ch.reg_ctrl = WCN36XX_DXE_REG_CTL_TX_L;
> + wcn->dxe_tx_h_ch.reg_ctrl = WCN36XX_DXE_REG_CTL_TX_H;
> +
> + wcn->dxe_tx_l_ch.def_ctrl = WCN36XX_DXE_CH_DEFAULT_CTL_TX_L;
> + wcn->dxe_tx_h_ch.def_ctrl = WCN36XX_DXE_CH_DEFAULT_CTL_TX_H;
> +
> + /* DXE control block allocation */
> + ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_tx_l_ch);
> + if (ret)
> + goto out_err;
> + ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_tx_h_ch);
> + if (ret)
> + goto out_err;
> + ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_rx_l_ch);
> + if (ret)
> + goto out_err;
> + ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_rx_h_ch);
> + if (ret)
> + goto out_err;
> +
> + /* Initialize SMSM state Clear TX Enable RING EMPTY STATE */
> + ret = wcn->ctrl_ops->smsm_change_state(
> + WCN36XX_SMSM_WLAN_TX_ENABLE,
> + WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY);
> +
> + return 0;
> +
> +out_err:
> + wcn36xx_err("Failed to allocate DXE control blocks\n");
> + wcn36xx_dxe_free_ctl_blks(wcn);
> + return -ENOMEM;
> +}
> +
> +void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn)
> +{
> + wcn36xx_dxe_free_ctl_block(&wcn->dxe_tx_l_ch);
> + wcn36xx_dxe_free_ctl_block(&wcn->dxe_tx_h_ch);
> + wcn36xx_dxe_free_ctl_block(&wcn->dxe_rx_l_ch);
> + wcn36xx_dxe_free_ctl_block(&wcn->dxe_rx_h_ch);
> +}
> +
> +static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch *wcn_ch)
> +{
> + struct wcn36xx_dxe_desc *cur_dxe = NULL;
> + struct wcn36xx_dxe_desc *prev_dxe = NULL;
> + struct wcn36xx_dxe_ctl *cur_ctl = NULL;
> + size_t size;
> + int i;
> +
> + size = wcn_ch->desc_num * sizeof(struct wcn36xx_dxe_desc);
> + wcn_ch->cpu_addr = dma_alloc_coherent(NULL, size, &wcn_ch->dma_addr,
> + GFP_KERNEL);
> + if (!wcn_ch->cpu_addr)
> + return -ENOMEM;
> +
> + memset(wcn_ch->cpu_addr, 0, size);
> +
> + cur_dxe = (struct wcn36xx_dxe_desc *)wcn_ch->cpu_addr;
> + cur_ctl = wcn_ch->head_blk_ctl;
> +
> + for (i = 0; i < wcn_ch->desc_num; i++) {
> + cur_ctl->desc = cur_dxe;
> + cur_ctl->desc_phy_addr = wcn_ch->dma_addr +
> + i * sizeof(struct wcn36xx_dxe_desc);
> +
> + switch (wcn_ch->ch_type) {
> + case WCN36XX_DXE_CH_TX_L:
> + cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_L;
> + cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_L;
> + break;
> + case WCN36XX_DXE_CH_TX_H:
> + cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_H;
> + cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_H;
> + break;
> + case WCN36XX_DXE_CH_RX_L:
> + cur_dxe->ctrl = WCN36XX_DXE_CTRL_RX_L;
> + cur_dxe->src_addr_l = WCN36XX_DXE_WQ_RX_L;
> + break;
> + case WCN36XX_DXE_CH_RX_H:
> + cur_dxe->ctrl = WCN36XX_DXE_CTRL_RX_H;
> + cur_dxe->src_addr_l = WCN36XX_DXE_WQ_RX_H;
> + break;
> + }
> + if (0 == i) {
> + cur_dxe->phy_next_l = 0;
> + } else if ((0 < i) && (i < wcn_ch->desc_num - 1)) {
> + prev_dxe->phy_next_l =
> + cur_ctl->desc_phy_addr;
> + } else if (i == (wcn_ch->desc_num - 1)) {
> + prev_dxe->phy_next_l =
> + cur_ctl->desc_phy_addr;
> + cur_dxe->phy_next_l =
> + wcn_ch->head_blk_ctl->desc_phy_addr;
> + }
> + cur_ctl = cur_ctl->next;
> + prev_dxe = cur_dxe;
> + cur_dxe++;
> + }
> +
> + return 0;
> +}
> +
> +static void wcn36xx_dxe_init_tx_bd(struct wcn36xx_dxe_ch *ch,
> + struct wcn36xx_dxe_mem_pool *pool)
> +{
> + int i, chunk_size = pool->chunk_size;
> + dma_addr_t bd_phy_addr = pool->phy_addr;
> + void *bd_cpu_addr = pool->virt_addr;
> + struct wcn36xx_dxe_ctl *cur = ch->head_blk_ctl;
> +
> + for (i = 0; i < ch->desc_num; i++) {
> + /* Only every second dxe needs a bd pointer,
> + the other will point to the skb data */
> + if (!(i & 1)) {
> + cur->bd_phy_addr = bd_phy_addr;
> + cur->bd_cpu_addr = bd_cpu_addr;
> + bd_phy_addr += chunk_size;
> + bd_cpu_addr += chunk_size;
> + } else {
> + cur->bd_phy_addr = 0;
> + cur->bd_cpu_addr = NULL;
> + }
> + cur = cur->next;
> + }
> +}
> +
> +static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, u16 wcn_ch)
> +{
> + int reg_data = 0;
> +
> + wcn36xx_dxe_read_register(wcn,
> + WCN36XX_DXE_INT_MASK_REG,
> + ®_data);
> +
> + reg_data |= wcn_ch;
> +
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_INT_MASK_REG,
> + (int)reg_data);
> + return 0;
> +}
> +
> +static int wcn36xx_dxe_fill_skb(struct wcn36xx_dxe_ctl *ctl)
> +{
> + struct wcn36xx_dxe_desc *dxe = ctl->desc;
> + struct sk_buff *skb;
> +
> + skb = alloc_skb(WCN36XX_PKT_SIZE, GFP_ATOMIC);
> + if (skb == NULL)
> + return -ENOMEM;
> +
> + dxe->dst_addr_l = dma_map_single(NULL,
> + skb_tail_pointer(skb),
> + WCN36XX_PKT_SIZE,
> + DMA_FROM_DEVICE);
> + ctl->skb = skb;
> +
> + return 0;
> +}
> +
> +static int wcn36xx_dxe_ch_alloc_skb(struct wcn36xx *wcn,
> + struct wcn36xx_dxe_ch *wcn_ch)
> +{
> + int i;
> + struct wcn36xx_dxe_ctl *cur_ctl = NULL;
> +
> + cur_ctl = wcn_ch->head_blk_ctl;
> +
> + for (i = 0; i < wcn_ch->desc_num; i++) {
> + wcn36xx_dxe_fill_skb(cur_ctl);
> + cur_ctl = cur_ctl->next;
> + }
> +
> + return 0;
> +}
> +
> +static void wcn36xx_dxe_ch_free_skbs(struct wcn36xx *wcn,
> + struct wcn36xx_dxe_ch *wcn_ch)
> +{
> + struct wcn36xx_dxe_ctl *cur = wcn_ch->head_blk_ctl;
> + int i;
> +
> + for (i = 0; i < wcn_ch->desc_num; i++) {
> + kfree_skb(cur->skb);
> + cur = cur->next;
> + }
> +}
> +
> +void wcn36xx_dxe_tx_ack_ind(struct wcn36xx *wcn, u32 status)
> +{
> + struct ieee80211_tx_info *info;
> + struct sk_buff *skb;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&wcn->dxe_lock, flags);
> + skb = wcn->tx_ack_skb;
> + wcn->tx_ack_skb = NULL;
> + spin_unlock_irqrestore(&wcn->dxe_lock, flags);
> +
> + if (!skb) {
> + wcn36xx_warn("Spurious TX complete indication\n");
> + return;
> + }
> +
> + info = IEEE80211_SKB_CB(skb);
> +
> + if (status == 1)
> + info->flags |= IEEE80211_TX_STAT_ACK;
> +
> + wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ack status: %d\n", status);
> +
> + ieee80211_tx_status_irqsafe(wcn->hw, skb);
> + ieee80211_wake_queues(wcn->hw);
> +}
> +
> +static void reap_tx_dxes(struct wcn36xx *wcn, struct wcn36xx_dxe_ch *ch)
> +{
> + struct wcn36xx_dxe_ctl *ctl = ch->tail_blk_ctl;
> + struct ieee80211_tx_info *info;
> + unsigned long flags;
> +
> + /*
> + * Make at least one loop of do-while because in case ring is
> + * completely full head and tail are pointing to the same element
> + * and while-do will not make any cycles.
> + */
> + do {
> + if (ctl->skb) {
> + dma_unmap_single(NULL, ctl->desc->src_addr_l,
> + ctl->skb->len, DMA_TO_DEVICE);
> + info = IEEE80211_SKB_CB(ctl->skb);
> + if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
> + /* Keep frame until TX status comes */
> + ieee80211_free_txskb(wcn->hw, ctl->skb);
> + }
> + spin_lock_irqsave(&ctl->skb_lock, flags);
> + if (wcn->queues_stopped) {
> + wcn->queues_stopped = false;
> + ieee80211_wake_queues(wcn->hw);
> + }
> + spin_unlock_irqrestore(&ctl->skb_lock, flags);
> +
> + ctl->skb = NULL;
> + }
> + ctl = ctl->next;
> + } while (ctl != ch->head_blk_ctl &&
> + !(ctl->desc->ctrl & WCN36XX_DXE_CTRL_VALID_MASK));
> +
> + ch->tail_blk_ctl = ctl;
> +}
> +
> +static irqreturn_t wcn36xx_irq_tx_complete(int irq, void *dev)
> +{
> + struct wcn36xx *wcn = (struct wcn36xx *)dev;
> + int int_src, int_reason;
> +
> + wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_INT_SRC_RAW_REG, &int_src);
> +
> + if (int_src & WCN36XX_INT_MASK_CHAN_TX_H) {
> + wcn36xx_dxe_read_register(wcn,
> + WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_H,
> + &int_reason);
> +
> + /* TODO: Check int_reason */
> +
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_0_INT_CLR,
> + WCN36XX_INT_MASK_CHAN_TX_H);
> +
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_ED_CLR,
> + WCN36XX_INT_MASK_CHAN_TX_H);
> + wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ready high\n");
> + reap_tx_dxes(wcn, &wcn->dxe_tx_h_ch);
> + }
> +
> + if (int_src & WCN36XX_INT_MASK_CHAN_TX_L) {
> + wcn36xx_dxe_read_register(wcn,
> + WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_L,
> + &int_reason);
> + /* TODO: Check int_reason */
> +
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_0_INT_CLR,
> + WCN36XX_INT_MASK_CHAN_TX_L);
> +
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_ED_CLR,
> + WCN36XX_INT_MASK_CHAN_TX_L);
> + wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ready low\n");
> + reap_tx_dxes(wcn, &wcn->dxe_tx_l_ch);
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t wcn36xx_irq_rx_ready(int irq, void *dev)
> +{
> + struct wcn36xx *wcn = (struct wcn36xx *)dev;
> +
> + disable_irq_nosync(wcn->rx_irq);
> + wcn36xx_dxe_rx_frame(wcn);
> + enable_irq(wcn->rx_irq);
> + return IRQ_HANDLED;
> +}
> +
> +static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
> +{
> + int ret;
> +
> + ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
> + IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
> + if (ret) {
> + wcn36xx_err("failed to alloc tx irq\n");
> + goto out_err;
> + }
> +
> + ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
> + "wcn36xx_rx", wcn);
> + if (ret) {
> + wcn36xx_err("failed to alloc rx irq\n");
> + goto out_txirq;
> + }
> +
> + enable_irq_wake(wcn->rx_irq);
> +
> + return 0;
> +
> +out_txirq:
> + free_irq(wcn->tx_irq, wcn);
> +out_err:
> + return ret;
> +
> +}
> +
> +static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
> + struct wcn36xx_dxe_ch *ch)
> +{
> + struct wcn36xx_dxe_ctl *ctl = ch->head_blk_ctl;
> + struct wcn36xx_dxe_desc *dxe = ctl->desc;
> + dma_addr_t dma_addr;
> + struct sk_buff *skb;
> +
> + while (!(dxe->ctrl & WCN36XX_DXE_CTRL_VALID_MASK)) {
> + skb = ctl->skb;
> + dma_addr = dxe->dst_addr_l;
> + wcn36xx_dxe_fill_skb(ctl);
> +
> + switch (ch->ch_type) {
> + case WCN36XX_DXE_CH_RX_L:
> + dxe->ctrl = WCN36XX_DXE_CTRL_RX_L;
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_ENCH_ADDR,
> + WCN36XX_DXE_INT_CH1_MASK);
> + break;
> + case WCN36XX_DXE_CH_RX_H:
> + dxe->ctrl = WCN36XX_DXE_CTRL_RX_H;
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_ENCH_ADDR,
> + WCN36XX_DXE_INT_CH3_MASK);
> + break;
> + default:
> + wcn36xx_warn("Unknown channel\n");
> + }
> +
> + dma_unmap_single(NULL, dma_addr, WCN36XX_PKT_SIZE,
> + DMA_FROM_DEVICE);
> + wcn36xx_rx_skb(wcn, skb);
> + ctl = ctl->next;
> + dxe = ctl->desc;
> + }
> +
> + ch->head_blk_ctl = ctl;
> +
> + return 0;
> +}
> +
> +void wcn36xx_dxe_rx_frame(struct wcn36xx *wcn)
> +{
> + int int_src;
> +
> + wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_INT_SRC_RAW_REG, &int_src);
> +
> + /* RX_LOW_PRI */
> + if (int_src & WCN36XX_DXE_INT_CH1_MASK) {
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_CLR,
> + WCN36XX_DXE_INT_CH1_MASK);
> + wcn36xx_rx_handle_packets(wcn, &(wcn->dxe_rx_l_ch));
> + }
> +
> + /* RX_HIGH_PRI */
> + if (int_src & WCN36XX_DXE_INT_CH3_MASK) {
> + /* Clean up all the INT within this channel */
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_CLR,
> + WCN36XX_DXE_INT_CH3_MASK);
> + wcn36xx_rx_handle_packets(wcn, &(wcn->dxe_rx_h_ch));
> + }
> +
> + if (!int_src)
> + wcn36xx_warn("No DXE interrupt pending\n");
> +}
> +
> +int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
> +{
> + size_t s;
> + void *cpu_addr;
> +
> + /* Allocate BD headers for MGMT frames */
> +
> + /* Where this come from ask QC */
> + wcn->mgmt_mem_pool.chunk_size = WCN36XX_BD_CHUNK_SIZE +
> + 16 - (WCN36XX_BD_CHUNK_SIZE % 8);
> +
> + s = wcn->mgmt_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_H;
> + cpu_addr = dma_alloc_coherent(NULL, s, &wcn->mgmt_mem_pool.phy_addr,
> + GFP_KERNEL);
> + if (!cpu_addr)
> + goto out_err;
> +
> + wcn->mgmt_mem_pool.virt_addr = cpu_addr;
> + memset(cpu_addr, 0, s);
> +
> + /* Allocate BD headers for DATA frames */
> +
> + /* Where this come from ask QC */
> + wcn->data_mem_pool.chunk_size = WCN36XX_BD_CHUNK_SIZE +
> + 16 - (WCN36XX_BD_CHUNK_SIZE % 8);
> +
> + s = wcn->data_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_L;
> + cpu_addr = dma_alloc_coherent(NULL, s, &wcn->data_mem_pool.phy_addr,
> + GFP_KERNEL);
> + if (!cpu_addr)
> + goto out_err;
> +
> + wcn->data_mem_pool.virt_addr = cpu_addr;
> + memset(cpu_addr, 0, s);
> +
> + return 0;
> +
> +out_err:
> + wcn36xx_dxe_free_mem_pools(wcn);
> + wcn36xx_err("Failed to allocate BD mempool\n");
> + return -ENOMEM;
> +}
> +
> +void wcn36xx_dxe_free_mem_pools(struct wcn36xx *wcn)
> +{
> + if (wcn->mgmt_mem_pool.virt_addr)
> + dma_free_coherent(NULL, wcn->mgmt_mem_pool.chunk_size *
> + WCN36XX_DXE_CH_DESC_NUMB_TX_H,
> + wcn->mgmt_mem_pool.virt_addr,
> + wcn->mgmt_mem_pool.phy_addr);
> +
> + if (wcn->data_mem_pool.virt_addr) {
> + dma_free_coherent(NULL, wcn->data_mem_pool.chunk_size *
> + WCN36XX_DXE_CH_DESC_NUMB_TX_L,
> + wcn->data_mem_pool.virt_addr,
> + wcn->data_mem_pool.phy_addr);
> + }
> +}
> +
> +int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
> + struct wcn36xx_vif *vif_priv,
> + struct sk_buff *skb,
> + bool is_low)
> +{
> + struct wcn36xx_dxe_ctl *ctl = NULL;
> + struct wcn36xx_dxe_desc *desc = NULL;
> + struct wcn36xx_dxe_ch *ch = NULL;
> + unsigned long flags;
> +
> + ch = is_low ? &wcn->dxe_tx_l_ch : &wcn->dxe_tx_h_ch;
> +
> + ctl = ch->head_blk_ctl;
> +
> + spin_lock_irqsave(&ctl->next->skb_lock, flags);
> +
> + /*
> + * If skb is not null that means that we reached the tail of the ring
> + * hence ring is full. Stop queues to let mac80211 back off until ring
> + * has an empty slot again.
> + */
> + if (NULL != ctl->next->skb) {
> + ieee80211_stop_queues(wcn->hw);
> + wcn->queues_stopped = true;
> + spin_unlock_irqrestore(&ctl->next->skb_lock, flags);
> + return -EBUSY;
> + }
> + spin_unlock_irqrestore(&ctl->next->skb_lock, flags);
> +
> + ctl->skb = NULL;
> + desc = ctl->desc;
> +
> + /* Set source address of the BD we send */
> + desc->src_addr_l = ctl->bd_phy_addr;
> +
> + desc->dst_addr_l = ch->dxe_wq;
> + desc->fr_len = sizeof(struct wcn36xx_tx_bd);
> + desc->ctrl = ch->ctrl_bd;
> +
> + wcn36xx_dbg(WCN36XX_DBG_DXE, "DXE TX\n");
> +
> + wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "DESC1 >>> ",
> + (char *)desc, sizeof(*desc));
> + wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP,
> + "BD >>> ", (char *)ctl->bd_cpu_addr,
> + sizeof(struct wcn36xx_tx_bd));
> +
> + /* Set source address of the SKB we send */
> + ctl = ctl->next;
> + ctl->skb = skb;
> + desc = ctl->desc;
> + if (ctl->bd_cpu_addr) {
> + wcn36xx_err("bd_cpu_addr cannot be NULL for skb DXE\n");
> + return -EINVAL;
> + }
> +
> + desc->src_addr_l = dma_map_single(NULL,
> + ctl->skb->data,
> + ctl->skb->len,
> + DMA_TO_DEVICE);
> +
> + desc->dst_addr_l = ch->dxe_wq;
> + desc->fr_len = ctl->skb->len;
> +
> + /* set dxe descriptor to VALID */
> + desc->ctrl = ch->ctrl_skb;
> +
> + wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "DESC2 >>> ",
> + (char *)desc, sizeof(*desc));
> + wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "SKB >>> ",
> + (char *)ctl->skb->data, ctl->skb->len);
> +
> + /* Move the head of the ring to the next empty descriptor */
> + ch->head_blk_ctl = ctl->next;
> +
> + /*
> + * When connected and trying to send data frame chip can be in sleep
> + * mode and writing to the register will not wake up the chip. Instead
> + * notify chip about new frame through SMSM bus.
> + */
> + if (is_low && vif_priv->pw_state == WCN36XX_BMPS) {
> + wcn->ctrl_ops->smsm_change_state(
> + 0,
> + WCN36XX_SMSM_WLAN_TX_ENABLE);
> + } else {
> + /* indicate End Of Packet and generate interrupt on descriptor
> + * done.
> + */
> + wcn36xx_dxe_write_register(wcn,
> + ch->reg_ctrl, ch->def_ctrl);
> + }
> +
> + return 0;
> +}
> +
> +int wcn36xx_dxe_init(struct wcn36xx *wcn)
> +{
> + int reg_data = 0, ret;
> +
> + reg_data = WCN36XX_DXE_REG_RESET;
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CSR_RESET, reg_data);
> +
> + /* Setting interrupt path */
> + reg_data = WCN36XX_DXE_CCU_INT;
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CCU_INT, reg_data);
> +
> + /***************************************/
> + /* Init descriptors for TX LOW channel */
> + /***************************************/
> + wcn36xx_dxe_init_descs(&wcn->dxe_tx_l_ch);
> + wcn36xx_dxe_init_tx_bd(&wcn->dxe_tx_l_ch, &wcn->data_mem_pool);
> +
> + /* Write channel head to a NEXT register */
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_L,
> + wcn->dxe_tx_l_ch.head_blk_ctl->desc_phy_addr);
> +
> + /* Program DMA destination addr for TX LOW */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_DEST_ADDR_TX_L,
> + WCN36XX_DXE_WQ_TX_L);
> +
> + wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data);
> + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L);
> +
> + /***************************************/
> + /* Init descriptors for TX HIGH channel */
> + /***************************************/
> + wcn36xx_dxe_init_descs(&wcn->dxe_tx_h_ch);
> + wcn36xx_dxe_init_tx_bd(&wcn->dxe_tx_h_ch, &wcn->mgmt_mem_pool);
> +
> + /* Write channel head to a NEXT register */
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_H,
> + wcn->dxe_tx_h_ch.head_blk_ctl->desc_phy_addr);
> +
> + /* Program DMA destination addr for TX HIGH */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_DEST_ADDR_TX_H,
> + WCN36XX_DXE_WQ_TX_H);
> +
> + wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data);
> +
> + /* Enable channel interrupts */
> + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H);
> +
> + /***************************************/
> + /* Init descriptors for RX LOW channel */
> + /***************************************/
> + wcn36xx_dxe_init_descs(&wcn->dxe_rx_l_ch);
> +
> + /* For RX we need to preallocated buffers */
> + wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch);
> +
> + /* Write channel head to a NEXT register */
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_L,
> + wcn->dxe_rx_l_ch.head_blk_ctl->desc_phy_addr);
> +
> + /* Write DMA source address */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_SRC_ADDR_RX_L,
> + WCN36XX_DXE_WQ_RX_L);
> +
> + /* Program preallocated destination address */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_DEST_ADDR_RX_L,
> + wcn->dxe_rx_l_ch.head_blk_ctl->desc->phy_next_l);
> +
> + /* Enable default control registers */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_REG_CTL_RX_L,
> + WCN36XX_DXE_CH_DEFAULT_CTL_RX_L);
> +
> + /* Enable channel interrupts */
> + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L);
> +
> + /***************************************/
> + /* Init descriptors for RX HIGH channel */
> + /***************************************/
> + wcn36xx_dxe_init_descs(&wcn->dxe_rx_h_ch);
> +
> + /* For RX we need to prealocat buffers */
> + wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_h_ch);
> +
> + /* Write chanel head to a NEXT register */
> + wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_H,
> + wcn->dxe_rx_h_ch.head_blk_ctl->desc_phy_addr);
> +
> + /* Write DMA source address */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_SRC_ADDR_RX_H,
> + WCN36XX_DXE_WQ_RX_H);
> +
> + /* Program preallocated destination address */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_CH_DEST_ADDR_RX_H,
> + wcn->dxe_rx_h_ch.head_blk_ctl->desc->phy_next_l);
> +
> + /* Enable default control registers */
> + wcn36xx_dxe_write_register(wcn,
> + WCN36XX_DXE_REG_CTL_RX_H,
> + WCN36XX_DXE_CH_DEFAULT_CTL_RX_H);
> +
> + /* Enable channel interrupts */
> + wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H);
> +
> + ret = wcn36xx_dxe_request_irqs(wcn);
> + if (ret < 0)
> + goto out_err;
> +
> + return 0;
> +
> +out_err:
> + return ret;
> +}
> +
> +void wcn36xx_dxe_deinit(struct wcn36xx *wcn)
> +{
> + free_irq(wcn->tx_irq, wcn);
> + free_irq(wcn->rx_irq, wcn);
> +
> + if (wcn->tx_ack_skb) {
> + ieee80211_tx_status_irqsafe(wcn->hw, wcn->tx_ack_skb);
> + wcn->tx_ack_skb = NULL;
> + }
> +
> + wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch);
> + wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch);
> +}
> diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.h b/drivers/net/wireless/ath/wcn36xx/dxe.h
> new file mode 100644
> index 0000000..c88562f
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/dxe.h
> @@ -0,0 +1,284 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _DXE_H_
> +#define _DXE_H_
> +
> +#include "wcn36xx.h"
> +
> +/*
> +TX_LOW = DMA0
> +TX_HIGH = DMA4
> +RX_LOW = DMA1
> +RX_HIGH = DMA3
> +H2H_TEST_RX_TX = DMA2
> +*/
> +
> +/* DXE registers */
> +#define WCN36XX_DXE_MEM_BASE 0x03000000
> +#define WCN36XX_DXE_MEM_REG 0x202000
> +
> +#define WCN36XX_DXE_CCU_INT 0xA0011
> +#define WCN36XX_DXE_REG_CCU_INT 0x200b10
> +
> +/* TODO This must calculated properly but not hardcoded */
> +#define WCN36XX_DXE_CTRL_TX_L 0x328a44
> +#define WCN36XX_DXE_CTRL_TX_H 0x32ce44
> +#define WCN36XX_DXE_CTRL_RX_L 0x12ad2f
> +#define WCN36XX_DXE_CTRL_RX_H 0x12d12f
> +#define WCN36XX_DXE_CTRL_TX_H_BD 0x30ce45
> +#define WCN36XX_DXE_CTRL_TX_H_SKB 0x32ce4d
> +#define WCN36XX_DXE_CTRL_TX_L_BD 0x308a45
> +#define WCN36XX_DXE_CTRL_TX_L_SKB 0x328a4d
> +
> +/* TODO This must calculated properly but not hardcoded */
> +#define WCN36XX_DXE_WQ_TX_L 0x17
> +#define WCN36XX_DXE_WQ_TX_H 0x17
> +#define WCN36XX_DXE_WQ_RX_L 0xB
> +#define WCN36XX_DXE_WQ_RX_H 0x4
> +
> +/* DXE descriptor control filed */
> +#define WCN36XX_DXE_CTRL_VALID_MASK (0x00000001)
> +
> +/* TODO This must calculated properly but not hardcoded */
> +/* DXE default control register values */
> +#define WCN36XX_DXE_CH_DEFAULT_CTL_RX_L 0x847EAD2F
> +#define WCN36XX_DXE_CH_DEFAULT_CTL_RX_H 0x84FED12F
> +#define WCN36XX_DXE_CH_DEFAULT_CTL_TX_H 0x853ECF4D
> +#define WCN36XX_DXE_CH_DEFAULT_CTL_TX_L 0x843e8b4d
> +
> +/* Common DXE registers */
> +#define WCN36XX_DXE_MEM_CSR (WCN36XX_DXE_MEM_REG + 0x00)
> +#define WCN36XX_DXE_REG_CSR_RESET (WCN36XX_DXE_MEM_REG + 0x00)
> +#define WCN36XX_DXE_ENCH_ADDR (WCN36XX_DXE_MEM_REG + 0x04)
> +#define WCN36XX_DXE_REG_CH_EN (WCN36XX_DXE_MEM_REG + 0x08)
> +#define WCN36XX_DXE_REG_CH_DONE (WCN36XX_DXE_MEM_REG + 0x0C)
> +#define WCN36XX_DXE_REG_CH_ERR (WCN36XX_DXE_MEM_REG + 0x10)
> +#define WCN36XX_DXE_INT_MASK_REG (WCN36XX_DXE_MEM_REG + 0x18)
> +#define WCN36XX_DXE_INT_SRC_RAW_REG (WCN36XX_DXE_MEM_REG + 0x20)
> + /* #define WCN36XX_DXE_INT_CH6_MASK 0x00000040 */
> + /* #define WCN36XX_DXE_INT_CH5_MASK 0x00000020 */
> + #define WCN36XX_DXE_INT_CH4_MASK 0x00000010
> + #define WCN36XX_DXE_INT_CH3_MASK 0x00000008
> + /* #define WCN36XX_DXE_INT_CH2_MASK 0x00000004 */
> + #define WCN36XX_DXE_INT_CH1_MASK 0x00000002
> + #define WCN36XX_DXE_INT_CH0_MASK 0x00000001
> +#define WCN36XX_DXE_0_INT_CLR (WCN36XX_DXE_MEM_REG + 0x30)
> +#define WCN36XX_DXE_0_INT_ED_CLR (WCN36XX_DXE_MEM_REG + 0x34)
> +#define WCN36XX_DXE_0_INT_DONE_CLR (WCN36XX_DXE_MEM_REG + 0x38)
> +#define WCN36XX_DXE_0_INT_ERR_CLR (WCN36XX_DXE_MEM_REG + 0x3C)
> +
> +#define WCN36XX_DXE_0_CH0_STATUS (WCN36XX_DXE_MEM_REG + 0x404)
> +#define WCN36XX_DXE_0_CH1_STATUS (WCN36XX_DXE_MEM_REG + 0x444)
> +#define WCN36XX_DXE_0_CH2_STATUS (WCN36XX_DXE_MEM_REG + 0x484)
> +#define WCN36XX_DXE_0_CH3_STATUS (WCN36XX_DXE_MEM_REG + 0x4C4)
> +#define WCN36XX_DXE_0_CH4_STATUS (WCN36XX_DXE_MEM_REG + 0x504)
> +
> +#define WCN36XX_DXE_REG_RESET 0x5c89
> +
> +/* Temporary BMU Workqueue 4 */
> +#define WCN36XX_DXE_BMU_WQ_RX_LOW 0xB
> +#define WCN36XX_DXE_BMU_WQ_RX_HIGH 0x4
> +/* DMA channel offset */
> +#define WCN36XX_DXE_TX_LOW_OFFSET 0x400
> +#define WCN36XX_DXE_TX_HIGH_OFFSET 0x500
> +#define WCN36XX_DXE_RX_LOW_OFFSET 0x440
> +#define WCN36XX_DXE_RX_HIGH_OFFSET 0x4C0
> +
> +/* Address of the next DXE descriptor */
> +#define WCN36XX_DXE_CH_NEXT_DESC_ADDR 0x001C
> +#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_NEXT_DESC_ADDR)
> +#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_NEXT_DESC_ADDR)
> +#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_NEXT_DESC_ADDR)
> +#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_NEXT_DESC_ADDR)
> +
> +/* DXE Descriptor source address */
> +#define WCN36XX_DXE_CH_SRC_ADDR 0x000C
> +#define WCN36XX_DXE_CH_SRC_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_SRC_ADDR)
> +#define WCN36XX_DXE_CH_SRC_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_SRC_ADDR)
> +
> +/* DXE Descriptor address destination address */
> +#define WCN36XX_DXE_CH_DEST_ADDR 0x0014
> +#define WCN36XX_DXE_CH_DEST_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_DEST_ADDR)
> +#define WCN36XX_DXE_CH_DEST_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_DEST_ADDR)
> +#define WCN36XX_DXE_CH_DEST_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_DEST_ADDR)
> +#define WCN36XX_DXE_CH_DEST_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_DEST_ADDR)
> +
> +/* Interrupt status */
> +#define WCN36XX_DXE_CH_STATUS_REG_ADDR 0x0004
> +#define WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_STATUS_REG_ADDR)
> +#define WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_STATUS_REG_ADDR)
> +#define WCN36XX_DXE_CH_STATUS_REG_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_LOW_OFFSET + \
> + WCN36XX_DXE_CH_STATUS_REG_ADDR)
> +#define WCN36XX_DXE_CH_STATUS_REG_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_HIGH_OFFSET + \
> + WCN36XX_DXE_CH_STATUS_REG_ADDR)
> +
> +
> +/* DXE default control register */
> +#define WCN36XX_DXE_REG_CTL_RX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_LOW_OFFSET)
> +#define WCN36XX_DXE_REG_CTL_RX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_RX_HIGH_OFFSET)
> +#define WCN36XX_DXE_REG_CTL_TX_H (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_HIGH_OFFSET)
> +#define WCN36XX_DXE_REG_CTL_TX_L (WCN36XX_DXE_MEM_REG + \
> + WCN36XX_DXE_TX_LOW_OFFSET)
> +
> +#define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400
> +#define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200
> +
> +
> +/* Interrupt control channel mask */
> +#define WCN36XX_INT_MASK_CHAN_TX_L 0x00000001
> +#define WCN36XX_INT_MASK_CHAN_RX_L 0x00000002
> +#define WCN36XX_INT_MASK_CHAN_RX_H 0x00000008
> +#define WCN36XX_INT_MASK_CHAN_TX_H 0x00000010
> +
> +#define WCN36XX_BD_CHUNK_SIZE 128
> +
> +#define WCN36XX_PKT_SIZE 0xF20
> +enum wcn36xx_dxe_ch_type {
> + WCN36XX_DXE_CH_TX_L,
> + WCN36XX_DXE_CH_TX_H,
> + WCN36XX_DXE_CH_RX_L,
> + WCN36XX_DXE_CH_RX_H
> +};
> +
> +/* amount of descriptors per channel */
> +enum wcn36xx_dxe_ch_desc_num {
> + WCN36XX_DXE_CH_DESC_NUMB_TX_L = 128,
> + WCN36XX_DXE_CH_DESC_NUMB_TX_H = 10,
> + WCN36XX_DXE_CH_DESC_NUMB_RX_L = 512,
> + WCN36XX_DXE_CH_DESC_NUMB_RX_H = 40
> +};
> +
> +/**
> + * struct wcn36xx_dxe_desc - describes descriptor of one DXE buffer
> + *
> + * @ctrl: is a union that consists of following bits:
> + * union {
> + * u32 valid :1; //0 = DMA stop, 1 = DMA continue with this
> + * //descriptor
> + * u32 transfer_type :2; //0 = Host to Host space
> + * u32 eop :1; //End of Packet
> + * u32 bd_handling :1; //if transferType = Host to BMU, then 0
> + * // means first 128 bytes contain BD, and 1
> + * // means create new empty BD
> + * u32 siq :1; // SIQ
> + * u32 diq :1; // DIQ
> + * u32 pdu_rel :1; //0 = don't release BD and PDUs when done,
> + * // 1 = release them
> + * u32 bthld_sel :4; //BMU Threshold Select
> + * u32 prio :3; //Specifies the priority level to use for
> + * // the transfer
> + * u32 stop_channel :1; //1 = DMA stops processing further, channel
> + * //requires re-enabling after this
> + * u32 intr :1; //Interrupt on Descriptor Done
> + * u32 rsvd :1; //reserved
> + * u32 size :14;//14 bits used - ignored for BMU transfers,
> + * //only used for host to host transfers?
> + * } ctrl;
> + */
> +struct wcn36xx_dxe_desc {
> + u32 ctrl;
> + u32 fr_len;
> +
> + u32 src_addr_l;
> + u32 dst_addr_l;
> + u32 phy_next_l;
> + u32 src_addr_h;
> + u32 dst_addr_h;
> + u32 phy_next_h;
> +} __packed;
> +
> +/* DXE Control block */
> +struct wcn36xx_dxe_ctl {
> + struct wcn36xx_dxe_ctl *next;
> + struct wcn36xx_dxe_desc *desc;
> + unsigned int desc_phy_addr;
> + int ctl_blk_order;
> + struct sk_buff *skb;
> + spinlock_t skb_lock;
> + void *bd_cpu_addr;
> + dma_addr_t bd_phy_addr;
> +};
> +
> +struct wcn36xx_dxe_ch {
> + enum wcn36xx_dxe_ch_type ch_type;
> + void *cpu_addr;
> + dma_addr_t dma_addr;
> + enum wcn36xx_dxe_ch_desc_num desc_num;
> + /* DXE control block ring */
> + struct wcn36xx_dxe_ctl *head_blk_ctl;
> + struct wcn36xx_dxe_ctl *tail_blk_ctl;
> +
> + /* DXE channel specific configs */
> + u32 dxe_wq;
> + u32 ctrl_bd;
> + u32 ctrl_skb;
> + u32 reg_ctrl;
> + u32 def_ctrl;
> +};
> +
> +/* Memory Pool for BD headers */
> +struct wcn36xx_dxe_mem_pool {
> + int chunk_size;
> + void *virt_addr;
> + dma_addr_t phy_addr;
> +};
> +
> +struct wcn36xx_vif;
> +int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn);
> +void wcn36xx_dxe_free_mem_pools(struct wcn36xx *wcn);
> +void wcn36xx_dxe_rx_frame(struct wcn36xx *wcn);
> +int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn);
> +void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn);
> +int wcn36xx_dxe_init(struct wcn36xx *wcn);
> +void wcn36xx_dxe_deinit(struct wcn36xx *wcn);
> +int wcn36xx_dxe_init_channels(struct wcn36xx *wcn);
> +int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
> + struct wcn36xx_vif *vif_priv,
> + struct sk_buff *skb,
> + bool is_low);
> +void wcn36xx_dxe_tx_ack_ind(struct wcn36xx *wcn, u32 status);
> +void *wcn36xx_dxe_get_next_bd(struct wcn36xx *wcn, bool is_low);
> +#endif /* _DXE_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h
> new file mode 100644
> index 0000000..c02dbc6
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/hal.h
> @@ -0,0 +1,4657 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _HAL_H_
> +#define _HAL_H_
> +
> +/*---------------------------------------------------------------------------
> + API VERSIONING INFORMATION
> +
> + The RIVA API is versioned as MAJOR.MINOR.VERSION.REVISION
> + The MAJOR is incremented for major product/architecture changes
> + (and then MINOR/VERSION/REVISION are zeroed)
> + The MINOR is incremented for minor product/architecture changes
> + (and then VERSION/REVISION are zeroed)
> + The VERSION is incremented if a significant API change occurs
> + (and then REVISION is zeroed)
> + The REVISION is incremented if an insignificant API change occurs
> + or if a new API is added
> + All values are in the range 0..255 (ie they are 8-bit values)
> + ---------------------------------------------------------------------------*/
> +#define WCN36XX_HAL_VER_MAJOR 1
> +#define WCN36XX_HAL_VER_MINOR 4
> +#define WCN36XX_HAL_VER_VERSION 1
> +#define WCN36XX_HAL_VER_REVISION 2
> +
> +/* This is to force compiler to use the maximum of an int ( 4 bytes ) */
> +#define WCN36XX_HAL_MAX_ENUM_SIZE 0x7FFFFFFF
> +#define WCN36XX_HAL_MSG_TYPE_MAX_ENUM_SIZE 0x7FFF
> +
> +/* Max no. of transmit categories */
> +#define STACFG_MAX_TC 8
> +
> +/* The maximum value of access category */
> +#define WCN36XX_HAL_MAX_AC 4
> +
> +#define WCN36XX_HAL_IPV4_ADDR_LEN 4
> +
> +#define WALN_HAL_STA_INVALID_IDX 0xFF
> +#define WCN36XX_HAL_BSS_INVALID_IDX 0xFF
> +
> +/* Default Beacon template size */
> +#define BEACON_TEMPLATE_SIZE 0x180
> +
> +/* Param Change Bitmap sent to HAL */
> +#define PARAM_BCN_INTERVAL_CHANGED (1 << 0)
> +#define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
> +#define PARAM_SHORT_SLOT_TIME_CHANGED (1 << 2)
> +#define PARAM_llACOEXIST_CHANGED (1 << 3)
> +#define PARAM_llBCOEXIST_CHANGED (1 << 4)
> +#define PARAM_llGCOEXIST_CHANGED (1 << 5)
> +#define PARAM_HT20MHZCOEXIST_CHANGED (1<<6)
> +#define PARAM_NON_GF_DEVICES_PRESENT_CHANGED (1<<7)
> +#define PARAM_RIFS_MODE_CHANGED (1<<8)
> +#define PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED (1<<9)
> +#define PARAM_OBSS_MODE_CHANGED (1<<10)
> +#define PARAM_BEACON_UPDATE_MASK \
> + (PARAM_BCN_INTERVAL_CHANGED | \
> + PARAM_SHORT_PREAMBLE_CHANGED | \
> + PARAM_SHORT_SLOT_TIME_CHANGED | \
> + PARAM_llACOEXIST_CHANGED | \
> + PARAM_llBCOEXIST_CHANGED | \
> + PARAM_llGCOEXIST_CHANGED | \
> + PARAM_HT20MHZCOEXIST_CHANGED | \
> + PARAM_NON_GF_DEVICES_PRESENT_CHANGED | \
> + PARAM_RIFS_MODE_CHANGED | \
> + PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED | \
> + PARAM_OBSS_MODE_CHANGED)
> +
> +/* dump command response Buffer size */
> +#define DUMPCMD_RSP_BUFFER 100
> +
> +/* version string max length (including NULL) */
> +#define WCN36XX_HAL_VERSION_LENGTH 64
> +
> +/* message types for messages exchanged between WDI and HAL */
> +enum wcn36xx_hal_host_msg_type {
> + /* Init/De-Init */
> + WCN36XX_HAL_START_REQ = 0,
> + WCN36XX_HAL_START_RSP = 1,
> + WCN36XX_HAL_STOP_REQ = 2,
> + WCN36XX_HAL_STOP_RSP = 3,
> +
> + /* Scan */
> + WCN36XX_HAL_INIT_SCAN_REQ = 4,
> + WCN36XX_HAL_INIT_SCAN_RSP = 5,
> + WCN36XX_HAL_START_SCAN_REQ = 6,
> + WCN36XX_HAL_START_SCAN_RSP = 7,
> + WCN36XX_HAL_END_SCAN_REQ = 8,
> + WCN36XX_HAL_END_SCAN_RSP = 9,
> + WCN36XX_HAL_FINISH_SCAN_REQ = 10,
> + WCN36XX_HAL_FINISH_SCAN_RSP = 11,
> +
> + /* HW STA configuration/deconfiguration */
> + WCN36XX_HAL_CONFIG_STA_REQ = 12,
> + WCN36XX_HAL_CONFIG_STA_RSP = 13,
> + WCN36XX_HAL_DELETE_STA_REQ = 14,
> + WCN36XX_HAL_DELETE_STA_RSP = 15,
> + WCN36XX_HAL_CONFIG_BSS_REQ = 16,
> + WCN36XX_HAL_CONFIG_BSS_RSP = 17,
> + WCN36XX_HAL_DELETE_BSS_REQ = 18,
> + WCN36XX_HAL_DELETE_BSS_RSP = 19,
> +
> + /* Infra STA asscoiation */
> + WCN36XX_HAL_JOIN_REQ = 20,
> + WCN36XX_HAL_JOIN_RSP = 21,
> + WCN36XX_HAL_POST_ASSOC_REQ = 22,
> + WCN36XX_HAL_POST_ASSOC_RSP = 23,
> +
> + /* Security */
> + WCN36XX_HAL_SET_BSSKEY_REQ = 24,
> + WCN36XX_HAL_SET_BSSKEY_RSP = 25,
> + WCN36XX_HAL_SET_STAKEY_REQ = 26,
> + WCN36XX_HAL_SET_STAKEY_RSP = 27,
> + WCN36XX_HAL_RMV_BSSKEY_REQ = 28,
> + WCN36XX_HAL_RMV_BSSKEY_RSP = 29,
> + WCN36XX_HAL_RMV_STAKEY_REQ = 30,
> + WCN36XX_HAL_RMV_STAKEY_RSP = 31,
> +
> + /* Qos Related */
> + WCN36XX_HAL_ADD_TS_REQ = 32,
> + WCN36XX_HAL_ADD_TS_RSP = 33,
> + WCN36XX_HAL_DEL_TS_REQ = 34,
> + WCN36XX_HAL_DEL_TS_RSP = 35,
> + WCN36XX_HAL_UPD_EDCA_PARAMS_REQ = 36,
> + WCN36XX_HAL_UPD_EDCA_PARAMS_RSP = 37,
> + WCN36XX_HAL_ADD_BA_REQ = 38,
> + WCN36XX_HAL_ADD_BA_RSP = 39,
> + WCN36XX_HAL_DEL_BA_REQ = 40,
> + WCN36XX_HAL_DEL_BA_RSP = 41,
> +
> + WCN36XX_HAL_CH_SWITCH_REQ = 42,
> + WCN36XX_HAL_CH_SWITCH_RSP = 43,
> + WCN36XX_HAL_SET_LINK_ST_REQ = 44,
> + WCN36XX_HAL_SET_LINK_ST_RSP = 45,
> + WCN36XX_HAL_GET_STATS_REQ = 46,
> + WCN36XX_HAL_GET_STATS_RSP = 47,
> + WCN36XX_HAL_UPDATE_CFG_REQ = 48,
> + WCN36XX_HAL_UPDATE_CFG_RSP = 49,
> +
> + WCN36XX_HAL_MISSED_BEACON_IND = 50,
> + WCN36XX_HAL_UNKNOWN_ADDR2_FRAME_RX_IND = 51,
> + WCN36XX_HAL_MIC_FAILURE_IND = 52,
> + WCN36XX_HAL_FATAL_ERROR_IND = 53,
> + WCN36XX_HAL_SET_KEYDONE_MSG = 54,
> +
> + /* NV Interface */
> + WCN36XX_HAL_DOWNLOAD_NV_REQ = 55,
> + WCN36XX_HAL_DOWNLOAD_NV_RSP = 56,
> +
> + WCN36XX_HAL_ADD_BA_SESSION_REQ = 57,
> + WCN36XX_HAL_ADD_BA_SESSION_RSP = 58,
> + WCN36XX_HAL_TRIGGER_BA_REQ = 59,
> + WCN36XX_HAL_TRIGGER_BA_RSP = 60,
> + WCN36XX_HAL_UPDATE_BEACON_REQ = 61,
> + WCN36XX_HAL_UPDATE_BEACON_RSP = 62,
> + WCN36XX_HAL_SEND_BEACON_REQ = 63,
> + WCN36XX_HAL_SEND_BEACON_RSP = 64,
> +
> + WCN36XX_HAL_SET_BCASTKEY_REQ = 65,
> + WCN36XX_HAL_SET_BCASTKEY_RSP = 66,
> + WCN36XX_HAL_DELETE_STA_CONTEXT_IND = 67,
> + WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ = 68,
> + WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_RSP = 69,
> +
> + /* PTT interface support */
> + WCN36XX_HAL_PROCESS_PTT_REQ = 70,
> + WCN36XX_HAL_PROCESS_PTT_RSP = 71,
> +
> + /* BTAMP related events */
> + WCN36XX_HAL_SIGNAL_BTAMP_EVENT_REQ = 72,
> + WCN36XX_HAL_SIGNAL_BTAMP_EVENT_RSP = 73,
> + WCN36XX_HAL_TL_HAL_FLUSH_AC_REQ = 74,
> + WCN36XX_HAL_TL_HAL_FLUSH_AC_RSP = 75,
> +
> + WCN36XX_HAL_ENTER_IMPS_REQ = 76,
> + WCN36XX_HAL_EXIT_IMPS_REQ = 77,
> + WCN36XX_HAL_ENTER_BMPS_REQ = 78,
> + WCN36XX_HAL_EXIT_BMPS_REQ = 79,
> + WCN36XX_HAL_ENTER_UAPSD_REQ = 80,
> + WCN36XX_HAL_EXIT_UAPSD_REQ = 81,
> + WCN36XX_HAL_UPDATE_UAPSD_PARAM_REQ = 82,
> + WCN36XX_HAL_CONFIGURE_RXP_FILTER_REQ = 83,
> + WCN36XX_HAL_ADD_BCN_FILTER_REQ = 84,
> + WCN36XX_HAL_REM_BCN_FILTER_REQ = 85,
> + WCN36XX_HAL_ADD_WOWL_BCAST_PTRN = 86,
> + WCN36XX_HAL_DEL_WOWL_BCAST_PTRN = 87,
> + WCN36XX_HAL_ENTER_WOWL_REQ = 88,
> + WCN36XX_HAL_EXIT_WOWL_REQ = 89,
> + WCN36XX_HAL_HOST_OFFLOAD_REQ = 90,
> + WCN36XX_HAL_SET_RSSI_THRESH_REQ = 91,
> + WCN36XX_HAL_GET_RSSI_REQ = 92,
> + WCN36XX_HAL_SET_UAPSD_AC_PARAMS_REQ = 93,
> + WCN36XX_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ = 94,
> +
> + WCN36XX_HAL_ENTER_IMPS_RSP = 95,
> + WCN36XX_HAL_EXIT_IMPS_RSP = 96,
> + WCN36XX_HAL_ENTER_BMPS_RSP = 97,
> + WCN36XX_HAL_EXIT_BMPS_RSP = 98,
> + WCN36XX_HAL_ENTER_UAPSD_RSP = 99,
> + WCN36XX_HAL_EXIT_UAPSD_RSP = 100,
> + WCN36XX_HAL_SET_UAPSD_AC_PARAMS_RSP = 101,
> + WCN36XX_HAL_UPDATE_UAPSD_PARAM_RSP = 102,
> + WCN36XX_HAL_CONFIGURE_RXP_FILTER_RSP = 103,
> + WCN36XX_HAL_ADD_BCN_FILTER_RSP = 104,
> + WCN36XX_HAL_REM_BCN_FILTER_RSP = 105,
> + WCN36XX_HAL_SET_RSSI_THRESH_RSP = 106,
> + WCN36XX_HAL_HOST_OFFLOAD_RSP = 107,
> + WCN36XX_HAL_ADD_WOWL_BCAST_PTRN_RSP = 108,
> + WCN36XX_HAL_DEL_WOWL_BCAST_PTRN_RSP = 109,
> + WCN36XX_HAL_ENTER_WOWL_RSP = 110,
> + WCN36XX_HAL_EXIT_WOWL_RSP = 111,
> + WCN36XX_HAL_RSSI_NOTIFICATION_IND = 112,
> + WCN36XX_HAL_GET_RSSI_RSP = 113,
> + WCN36XX_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_RSP = 114,
> +
> + /* 11k related events */
> + WCN36XX_HAL_SET_MAX_TX_POWER_REQ = 115,
> + WCN36XX_HAL_SET_MAX_TX_POWER_RSP = 116,
> +
> + /* 11R related msgs */
> + WCN36XX_HAL_AGGR_ADD_TS_REQ = 117,
> + WCN36XX_HAL_AGGR_ADD_TS_RSP = 118,
> +
> + /* P2P WLAN_FEATURE_P2P */
> + WCN36XX_HAL_SET_P2P_GONOA_REQ = 119,
> + WCN36XX_HAL_SET_P2P_GONOA_RSP = 120,
> +
> + /* WLAN Dump commands */
> + WCN36XX_HAL_DUMP_COMMAND_REQ = 121,
> + WCN36XX_HAL_DUMP_COMMAND_RSP = 122,
> +
> + /* OEM_DATA FEATURE SUPPORT */
> + WCN36XX_HAL_START_OEM_DATA_REQ = 123,
> + WCN36XX_HAL_START_OEM_DATA_RSP = 124,
> +
> + /* ADD SELF STA REQ and RSP */
> + WCN36XX_HAL_ADD_STA_SELF_REQ = 125,
> + WCN36XX_HAL_ADD_STA_SELF_RSP = 126,
> +
> + /* DEL SELF STA SUPPORT */
> + WCN36XX_HAL_DEL_STA_SELF_REQ = 127,
> + WCN36XX_HAL_DEL_STA_SELF_RSP = 128,
> +
> + /* Coex Indication */
> + WCN36XX_HAL_COEX_IND = 129,
> +
> + /* Tx Complete Indication */
> + WCN36XX_HAL_OTA_TX_COMPL_IND = 130,
> +
> + /* Host Suspend/resume messages */
> + WCN36XX_HAL_HOST_SUSPEND_IND = 131,
> + WCN36XX_HAL_HOST_RESUME_REQ = 132,
> + WCN36XX_HAL_HOST_RESUME_RSP = 133,
> +
> + WCN36XX_HAL_SET_TX_POWER_REQ = 134,
> + WCN36XX_HAL_SET_TX_POWER_RSP = 135,
> + WCN36XX_HAL_GET_TX_POWER_REQ = 136,
> + WCN36XX_HAL_GET_TX_POWER_RSP = 137,
> +
> + WCN36XX_HAL_P2P_NOA_ATTR_IND = 138,
> +
> + WCN36XX_HAL_ENABLE_RADAR_DETECT_REQ = 139,
> + WCN36XX_HAL_ENABLE_RADAR_DETECT_RSP = 140,
> + WCN36XX_HAL_GET_TPC_REPORT_REQ = 141,
> + WCN36XX_HAL_GET_TPC_REPORT_RSP = 142,
> + WCN36XX_HAL_RADAR_DETECT_IND = 143,
> + WCN36XX_HAL_RADAR_DETECT_INTR_IND = 144,
> + WCN36XX_HAL_KEEP_ALIVE_REQ = 145,
> + WCN36XX_HAL_KEEP_ALIVE_RSP = 146,
> +
> + /* PNO messages */
> + WCN36XX_HAL_SET_PREF_NETWORK_REQ = 147,
> + WCN36XX_HAL_SET_PREF_NETWORK_RSP = 148,
> + WCN36XX_HAL_SET_RSSI_FILTER_REQ = 149,
> + WCN36XX_HAL_SET_RSSI_FILTER_RSP = 150,
> + WCN36XX_HAL_UPDATE_SCAN_PARAM_REQ = 151,
> + WCN36XX_HAL_UPDATE_SCAN_PARAM_RSP = 152,
> + WCN36XX_HAL_PREF_NETW_FOUND_IND = 153,
> +
> + WCN36XX_HAL_SET_TX_PER_TRACKING_REQ = 154,
> + WCN36XX_HAL_SET_TX_PER_TRACKING_RSP = 155,
> + WCN36XX_HAL_TX_PER_HIT_IND = 156,
> +
> + WCN36XX_HAL_8023_MULTICAST_LIST_REQ = 157,
> + WCN36XX_HAL_8023_MULTICAST_LIST_RSP = 158,
> +
> + WCN36XX_HAL_SET_PACKET_FILTER_REQ = 159,
> + WCN36XX_HAL_SET_PACKET_FILTER_RSP = 160,
> + WCN36XX_HAL_PACKET_FILTER_MATCH_COUNT_REQ = 161,
> + WCN36XX_HAL_PACKET_FILTER_MATCH_COUNT_RSP = 162,
> + WCN36XX_HAL_CLEAR_PACKET_FILTER_REQ = 163,
> + WCN36XX_HAL_CLEAR_PACKET_FILTER_RSP = 164,
> +
> + /*
> + * This is temp fix. Should be removed once Host and Riva code is
> + * in sync.
> + */
> + WCN36XX_HAL_INIT_SCAN_CON_REQ = 165,
> +
> + WCN36XX_HAL_SET_POWER_PARAMS_REQ = 166,
> + WCN36XX_HAL_SET_POWER_PARAMS_RSP = 167,
> +
> + WCN36XX_HAL_TSM_STATS_REQ = 168,
> + WCN36XX_HAL_TSM_STATS_RSP = 169,
> +
> + /* wake reason indication (WOW) */
> + WCN36XX_HAL_WAKE_REASON_IND = 170,
> +
> + /* GTK offload support */
> + WCN36XX_HAL_GTK_OFFLOAD_REQ = 171,
> + WCN36XX_HAL_GTK_OFFLOAD_RSP = 172,
> + WCN36XX_HAL_GTK_OFFLOAD_GETINFO_REQ = 173,
> + WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP = 174,
> +
> + WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ = 175,
> + WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_RSP = 176,
> + WCN36XX_HAL_EXCLUDE_UNENCRYPTED_IND = 177,
> +
> + WCN36XX_HAL_SET_THERMAL_MITIGATION_REQ = 178,
> + WCN36XX_HAL_SET_THERMAL_MITIGATION_RSP = 179,
> +
> + WCN36XX_HAL_UPDATE_VHT_OP_MODE_REQ = 182,
> + WCN36XX_HAL_UPDATE_VHT_OP_MODE_RSP = 183,
> +
> + WCN36XX_HAL_P2P_NOA_START_IND = 184,
> +
> + WCN36XX_HAL_GET_ROAM_RSSI_REQ = 185,
> + WCN36XX_HAL_GET_ROAM_RSSI_RSP = 186,
> +
> + WCN36XX_HAL_CLASS_B_STATS_IND = 187,
> + WCN36XX_HAL_DEL_BA_IND = 188,
> + WCN36XX_HAL_DHCP_START_IND = 189,
> + WCN36XX_HAL_DHCP_STOP_IND = 190,
> +
> + WCN36XX_HAL_MSG_MAX = WCN36XX_HAL_MSG_TYPE_MAX_ENUM_SIZE
> +};
> +
> +/* Enumeration for Version */
> +enum wcn36xx_hal_host_msg_version {
> + WCN36XX_HAL_MSG_VERSION0 = 0,
> + WCN36XX_HAL_MSG_VERSION1 = 1,
> + /* define as 2 bytes data */
> + WCN36XX_HAL_MSG_WCNSS_CTRL_VERSION = 0x7FFF,
> + WCN36XX_HAL_MSG_VERSION_MAX_FIELD = WCN36XX_HAL_MSG_WCNSS_CTRL_VERSION
> +};
> +
> +enum driver_type {
> + DRIVER_TYPE_PRODUCTION = 0,
> + DRIVER_TYPE_MFG = 1,
> + DRIVER_TYPE_DVT = 2,
> + DRIVER_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_stop_type {
> + HAL_STOP_TYPE_SYS_RESET,
> + HAL_STOP_TYPE_SYS_DEEP_SLEEP,
> + HAL_STOP_TYPE_RF_KILL,
> + HAL_STOP_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_sys_mode {
> + HAL_SYS_MODE_NORMAL,
> + HAL_SYS_MODE_LEARN,
> + HAL_SYS_MODE_SCAN,
> + HAL_SYS_MODE_PROMISC,
> + HAL_SYS_MODE_SUSPEND_LINK,
> + HAL_SYS_MODE_ROAM_SCAN,
> + HAL_SYS_MODE_ROAM_SUSPEND_LINK,
> + HAL_SYS_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum phy_chan_bond_state {
> + /* 20MHz IF bandwidth centered on IF carrier */
> + PHY_SINGLE_CHANNEL_CENTERED = 0,
> +
> + /* 40MHz IF bandwidth with lower 20MHz supporting the primary channel */
> + PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,
> +
> + /* 40MHz IF bandwidth centered on IF carrier */
> + PHY_DOUBLE_CHANNEL_CENTERED = 2,
> +
> + /* 40MHz IF bandwidth with higher 20MHz supporting the primary ch */
> + PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3,
> +
> + /* 20/40MHZ offset LOW 40/80MHZ offset CENTERED */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4,
> +
> + /* 20/40MHZ offset CENTERED 40/80MHZ offset CENTERED */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5,
> +
> + /* 20/40MHZ offset HIGH 40/80MHZ offset CENTERED */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6,
> +
> + /* 20/40MHZ offset LOW 40/80MHZ offset LOW */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,
> +
> + /* 20/40MHZ offset HIGH 40/80MHZ offset LOW */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8,
> +
> + /* 20/40MHZ offset LOW 40/80MHZ offset HIGH */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9,
> +
> + /* 20/40MHZ offset-HIGH 40/80MHZ offset HIGH */
> + PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,
> +
> + PHY_CHANNEL_BONDING_STATE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* Spatial Multiplexing(SM) Power Save mode */
> +enum wcn36xx_hal_ht_mimo_state {
> + /* Static SM Power Save mode */
> + WCN36XX_HAL_HT_MIMO_PS_STATIC = 0,
> +
> + /* Dynamic SM Power Save mode */
> + WCN36XX_HAL_HT_MIMO_PS_DYNAMIC = 1,
> +
> + /* reserved */
> + WCN36XX_HAL_HT_MIMO_PS_NA = 2,
> +
> + /* SM Power Save disabled */
> + WCN36XX_HAL_HT_MIMO_PS_NO_LIMIT = 3,
> +
> + WCN36XX_HAL_HT_MIMO_PS_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* each station added has a rate mode which specifies the sta attributes */
> +enum sta_rate_mode {
> + STA_TAURUS = 0,
> + STA_TITAN,
> + STA_POLARIS,
> + STA_11b,
> + STA_11bg,
> + STA_11a,
> + STA_11n,
> + STA_11ac,
> + STA_INVALID_RATE_MODE = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* 1,2,5.5,11 */
> +#define WCN36XX_HAL_NUM_DSSS_RATES 4
> +
> +/* 6,9,12,18,24,36,48,54 */
> +#define WCN36XX_HAL_NUM_OFDM_RATES 8
> +
> +/* 72,96,108 */
> +#define WCN36XX_HAL_NUM_POLARIS_RATES 3
> +
> +#define WCN36XX_HAL_MAC_MAX_SUPPORTED_MCS_SET 16
> +
> +enum wcn36xx_hal_bss_type {
> + WCN36XX_HAL_INFRASTRUCTURE_MODE,
> +
> + /* Added for softAP support */
> + WCN36XX_HAL_INFRA_AP_MODE,
> +
> + WCN36XX_HAL_IBSS_MODE,
> +
> + /* Added for BT-AMP support */
> + WCN36XX_HAL_BTAMP_STA_MODE,
> +
> + /* Added for BT-AMP support */
> + WCN36XX_HAL_BTAMP_AP_MODE,
> +
> + WCN36XX_HAL_AUTO_MODE,
> +
> + WCN36XX_HAL_DONOT_USE_BSS_TYPE = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_nw_type {
> + WCN36XX_HAL_11A_NW_TYPE,
> + WCN36XX_HAL_11B_NW_TYPE,
> + WCN36XX_HAL_11G_NW_TYPE,
> + WCN36XX_HAL_11N_NW_TYPE,
> + WCN36XX_HAL_DONOT_USE_NW_TYPE = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +#define WCN36XX_HAL_MAC_RATESET_EID_MAX 12
> +
> +enum wcn36xx_hal_ht_operating_mode {
> + /* No Protection */
> + WCN36XX_HAL_HT_OP_MODE_PURE,
> +
> + /* Overlap Legacy device present, protection is optional */
> + WCN36XX_HAL_HT_OP_MODE_OVERLAP_LEGACY,
> +
> + /* No legacy device, but 20 MHz HT present */
> + WCN36XX_HAL_HT_OP_MODE_NO_LEGACY_20MHZ_HT,
> +
> + /* Protection is required */
> + WCN36XX_HAL_HT_OP_MODE_MIXED,
> +
> + WCN36XX_HAL_HT_OP_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* Encryption type enum used with peer */
> +enum ani_ed_type {
> + WCN36XX_HAL_ED_NONE,
> + WCN36XX_HAL_ED_WEP40,
> + WCN36XX_HAL_ED_WEP104,
> + WCN36XX_HAL_ED_TKIP,
> + WCN36XX_HAL_ED_CCMP,
> + WCN36XX_HAL_ED_WPI,
> + WCN36XX_HAL_ED_AES_128_CMAC,
> + WCN36XX_HAL_ED_NOT_IMPLEMENTED = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +#define WLAN_MAX_KEY_RSC_LEN 16
> +#define WLAN_WAPI_KEY_RSC_LEN 16
> +
> +/* MAX key length when ULA is used */
> +#define WCN36XX_HAL_MAC_MAX_KEY_LENGTH 32
> +#define WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS 4
> +
> +/*
> + * Enum to specify whether key is used for TX only, RX only or both.
> + */
> +enum ani_key_direction {
> + WCN36XX_HAL_TX_ONLY,
> + WCN36XX_HAL_RX_ONLY,
> + WCN36XX_HAL_TX_RX,
> + WCN36XX_HAL_TX_DEFAULT,
> + WCN36XX_HAL_DONOT_USE_KEY_DIRECTION = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum ani_wep_type {
> + WCN36XX_HAL_WEP_STATIC,
> + WCN36XX_HAL_WEP_DYNAMIC,
> + WCN36XX_HAL_WEP_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_link_state {
> +
> + WCN36XX_HAL_LINK_IDLE_STATE = 0,
> + WCN36XX_HAL_LINK_PREASSOC_STATE = 1,
> + WCN36XX_HAL_LINK_POSTASSOC_STATE = 2,
> + WCN36XX_HAL_LINK_AP_STATE = 3,
> + WCN36XX_HAL_LINK_IBSS_STATE = 4,
> +
> + /* BT-AMP Case */
> + WCN36XX_HAL_LINK_BTAMP_PREASSOC_STATE = 5,
> + WCN36XX_HAL_LINK_BTAMP_POSTASSOC_STATE = 6,
> + WCN36XX_HAL_LINK_BTAMP_AP_STATE = 7,
> + WCN36XX_HAL_LINK_BTAMP_STA_STATE = 8,
> +
> + /* Reserved for HAL Internal Use */
> + WCN36XX_HAL_LINK_LEARN_STATE = 9,
> + WCN36XX_HAL_LINK_SCAN_STATE = 10,
> + WCN36XX_HAL_LINK_FINISH_SCAN_STATE = 11,
> + WCN36XX_HAL_LINK_INIT_CAL_STATE = 12,
> + WCN36XX_HAL_LINK_FINISH_CAL_STATE = 13,
> + WCN36XX_HAL_LINK_LISTEN_STATE = 14,
> +
> + WCN36XX_HAL_LINK_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_stats_mask {
> + HAL_SUMMARY_STATS_INFO = 0x00000001,
> + HAL_GLOBAL_CLASS_A_STATS_INFO = 0x00000002,
> + HAL_GLOBAL_CLASS_B_STATS_INFO = 0x00000004,
> + HAL_GLOBAL_CLASS_C_STATS_INFO = 0x00000008,
> + HAL_GLOBAL_CLASS_D_STATS_INFO = 0x00000010,
> + HAL_PER_STA_STATS_INFO = 0x00000020
> +};
> +
> +/* BT-AMP events type */
> +enum bt_amp_event_type {
> + BTAMP_EVENT_CONNECTION_START,
> + BTAMP_EVENT_CONNECTION_STOP,
> + BTAMP_EVENT_CONNECTION_TERMINATED,
> +
> + /* This and beyond are invalid values */
> + BTAMP_EVENT_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
> +};
> +
> +/* PE Statistics */
> +enum pe_stats_mask {
> + PE_SUMMARY_STATS_INFO = 0x00000001,
> + PE_GLOBAL_CLASS_A_STATS_INFO = 0x00000002,
> + PE_GLOBAL_CLASS_B_STATS_INFO = 0x00000004,
> + PE_GLOBAL_CLASS_C_STATS_INFO = 0x00000008,
> + PE_GLOBAL_CLASS_D_STATS_INFO = 0x00000010,
> + PE_PER_STA_STATS_INFO = 0x00000020,
> +
> + /* This and beyond are invalid values */
> + PE_STATS_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/*
> + * Configuration Parameter IDs
> + */
> +#define WCN36XX_HAL_CFG_STA_ID 0
> +#define WCN36XX_HAL_CFG_CURRENT_TX_ANTENNA 1
> +#define WCN36XX_HAL_CFG_CURRENT_RX_ANTENNA 2
> +#define WCN36XX_HAL_CFG_LOW_GAIN_OVERRIDE 3
> +#define WCN36XX_HAL_CFG_POWER_STATE_PER_CHAIN 4
> +#define WCN36XX_HAL_CFG_CAL_PERIOD 5
> +#define WCN36XX_HAL_CFG_CAL_CONTROL 6
> +#define WCN36XX_HAL_CFG_PROXIMITY 7
> +#define WCN36XX_HAL_CFG_NETWORK_DENSITY 8
> +#define WCN36XX_HAL_CFG_MAX_MEDIUM_TIME 9
> +#define WCN36XX_HAL_CFG_MAX_MPDUS_IN_AMPDU 10
> +#define WCN36XX_HAL_CFG_RTS_THRESHOLD 11
> +#define WCN36XX_HAL_CFG_SHORT_RETRY_LIMIT 12
> +#define WCN36XX_HAL_CFG_LONG_RETRY_LIMIT 13
> +#define WCN36XX_HAL_CFG_FRAGMENTATION_THRESHOLD 14
> +#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_ZERO 15
> +#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_ONE 16
> +#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_TWO 17
> +#define WCN36XX_HAL_CFG_FIXED_RATE 18
> +#define WCN36XX_HAL_CFG_RETRYRATE_POLICY 19
> +#define WCN36XX_HAL_CFG_RETRYRATE_SECONDARY 20
> +#define WCN36XX_HAL_CFG_RETRYRATE_TERTIARY 21
> +#define WCN36XX_HAL_CFG_FORCE_POLICY_PROTECTION 22
> +#define WCN36XX_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ 23
> +#define WCN36XX_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ 24
> +#define WCN36XX_HAL_CFG_DEFAULT_RATE_INDEX_24GHZ 25
> +#define WCN36XX_HAL_CFG_DEFAULT_RATE_INDEX_5GHZ 26
> +#define WCN36XX_HAL_CFG_MAX_BA_SESSIONS 27
> +#define WCN36XX_HAL_CFG_PS_DATA_INACTIVITY_TIMEOUT 28
> +#define WCN36XX_HAL_CFG_PS_ENABLE_BCN_FILTER 29
> +#define WCN36XX_HAL_CFG_PS_ENABLE_RSSI_MONITOR 30
> +#define WCN36XX_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE 31
> +#define WCN36XX_HAL_CFG_STATS_PERIOD 32
> +#define WCN36XX_HAL_CFG_CFP_MAX_DURATION 33
> +#define WCN36XX_HAL_CFG_FRAME_TRANS_ENABLED 34
> +#define WCN36XX_HAL_CFG_DTIM_PERIOD 35
> +#define WCN36XX_HAL_CFG_EDCA_WMM_ACBK 36
> +#define WCN36XX_HAL_CFG_EDCA_WMM_ACBE 37
> +#define WCN36XX_HAL_CFG_EDCA_WMM_ACVO 38
> +#define WCN36XX_HAL_CFG_EDCA_WMM_ACVI 39
> +#define WCN36XX_HAL_CFG_BA_THRESHOLD_HIGH 40
> +#define WCN36XX_HAL_CFG_MAX_BA_BUFFERS 41
> +#define WCN36XX_HAL_CFG_RPE_POLLING_THRESHOLD 42
> +#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG 43
> +#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG 44
> +#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG 45
> +#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG 46
> +#define WCN36XX_HAL_CFG_NO_OF_ONCHIP_REORDER_SESSIONS 47
> +#define WCN36XX_HAL_CFG_PS_LISTEN_INTERVAL 48
> +#define WCN36XX_HAL_CFG_PS_HEART_BEAT_THRESHOLD 49
> +#define WCN36XX_HAL_CFG_PS_NTH_BEACON_FILTER 50
> +#define WCN36XX_HAL_CFG_PS_MAX_PS_POLL 51
> +#define WCN36XX_HAL_CFG_PS_MIN_RSSI_THRESHOLD 52
> +#define WCN36XX_HAL_CFG_PS_RSSI_FILTER_PERIOD 53
> +#define WCN36XX_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE 54
> +#define WCN36XX_HAL_CFG_PS_IGNORE_DTIM 55
> +#define WCN36XX_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM 56
> +#define WCN36XX_HAL_CFG_DYNAMIC_PS_POLL_VALUE 57
> +#define WCN36XX_HAL_CFG_PS_NULLDATA_AP_RESP_TIMEOUT 58
> +#define WCN36XX_HAL_CFG_TELE_BCN_WAKEUP_EN 59
> +#define WCN36XX_HAL_CFG_TELE_BCN_TRANS_LI 60
> +#define WCN36XX_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS 61
> +#define WCN36XX_HAL_CFG_TELE_BCN_MAX_LI 62
> +#define WCN36XX_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS 63
> +#define WCN36XX_HAL_CFG_TX_PWR_CTRL_ENABLE 64
> +#define WCN36XX_HAL_CFG_VALID_RADAR_CHANNEL_LIST 65
> +#define WCN36XX_HAL_CFG_TX_POWER_24_20 66
> +#define WCN36XX_HAL_CFG_TX_POWER_24_40 67
> +#define WCN36XX_HAL_CFG_TX_POWER_50_20 68
> +#define WCN36XX_HAL_CFG_TX_POWER_50_40 69
> +#define WCN36XX_HAL_CFG_MCAST_BCAST_FILTER_SETTING 70
> +#define WCN36XX_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL 71
> +#define WCN36XX_HAL_CFG_MAX_TX_POWER_2_4 72
> +#define WCN36XX_HAL_CFG_MAX_TX_POWER_5 73
> +#define WCN36XX_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD 74
> +#define WCN36XX_HAL_CFG_ENABLE_CLOSE_LOOP 75
> +#define WCN36XX_HAL_CFG_BTC_EXECUTION_MODE 76
> +#define WCN36XX_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK 77
> +#define WCN36XX_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS 78
> +#define WCN36XX_HAL_CFG_PS_TX_INACTIVITY_TIMEOUT 79
> +#define WCN36XX_HAL_CFG_WCNSS_API_VERSION 80
> +#define WCN36XX_HAL_CFG_AP_KEEPALIVE_TIMEOUT 81
> +#define WCN36XX_HAL_CFG_GO_KEEPALIVE_TIMEOUT 82
> +#define WCN36XX_HAL_CFG_ENABLE_MC_ADDR_LIST 83
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_INQ_BT 84
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_PAGE_BT 85
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_CONN_BT 86
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_LE_BT 87
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN 88
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN 89
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN 90
> +#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_LE_WLAN 91
> +#define WCN36XX_HAL_CFG_BTC_DYN_MAX_LEN_BT 92
> +#define WCN36XX_HAL_CFG_BTC_DYN_MAX_LEN_WLAN 93
> +#define WCN36XX_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC 94
> +#define WCN36XX_HAL_CFG_BTC_DHCP_PROT_ON_A2DP 95
> +#define WCN36XX_HAL_CFG_BTC_DHCP_PROT_ON_SCO 96
> +#define WCN36XX_HAL_CFG_ENABLE_UNICAST_FILTER 97
> +#define WCN36XX_HAL_CFG_MAX_ASSOC_LIMIT 98
> +#define WCN36XX_HAL_CFG_ENABLE_LPWR_IMG_TRANSITION 99
> +#define WCN36XX_HAL_CFG_ENABLE_MCC_ADAPTIVE_SCHEDULER 100
> +#define WCN36XX_HAL_CFG_ENABLE_DETECT_PS_SUPPORT 101
> +#define WCN36XX_HAL_CFG_AP_LINK_MONITOR_TIMEOUT 102
> +#define WCN36XX_HAL_CFG_BTC_DWELL_TIME_MULTIPLIER 103
> +#define WCN36XX_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE 104
> +#define WCN36XX_HAL_CFG_MAX_PARAMS 105
> +
> +/* Message definitons - All the messages below need to be packed */
> +
> +/* Definition for HAL API Version. */
> +struct wcnss_wlan_version {
> + u8 revision;
> + u8 version;
> + u8 minor;
> + u8 major;
> +} __packed;
> +
> +/* Definition for Encryption Keys */
> +struct wcn36xx_hal_keys {
> + u8 id;
> +
> + /* 0 for multicast */
> + u8 unicast;
> +
> + enum ani_key_direction direction;
> +
> + /* Usage is unknown */
> + u8 rsc[WLAN_MAX_KEY_RSC_LEN];
> +
> + /* =1 for authenticator,=0 for supplicant */
> + u8 pae_role;
> +
> + u16 length;
> + u8 key[WCN36XX_HAL_MAC_MAX_KEY_LENGTH];
> +} __packed;
> +
> +/*
> + * set_sta_key_params Moving here since it is shared by
> + * configbss/setstakey msgs
> + */
> +struct wcn36xx_hal_set_sta_key_params {
> + /* STA Index */
> + u16 sta_index;
> +
> + /* Encryption Type used with peer */
> + enum ani_ed_type enc_type;
> +
> + /* STATIC/DYNAMIC - valid only for WEP */
> + enum ani_wep_type wep_type;
> +
> + /* Default WEP key, valid only for static WEP, must between 0 and 3. */
> + u8 def_wep_idx;
> +
> + /* valid only for non-static WEP encyrptions */
> + struct wcn36xx_hal_keys key[WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS];
> +
> + /*
> + * Control for Replay Count, 1= Single TID based replay count on Tx
> + * 0 = Per TID based replay count on TX
> + */
> + u8 single_tid_rc;
> +
> +} __packed;
> +
> +/* 4-byte control message header used by HAL*/
> +struct wcn36xx_hal_msg_header {
> + enum wcn36xx_hal_host_msg_type msg_type:16;
> + enum wcn36xx_hal_host_msg_version msg_version:16;
> + u32 len;
> +} __packed;
> +
> +/* Config format required by HAL for each CFG item*/
> +struct wcn36xx_hal_cfg {
> + /* Cfg Id. The Id required by HAL is exported by HAL
> + * in shared header file between UMAC and HAL.*/
> + u16 id;
> +
> + /* Length of the Cfg. This parameter is used to go to next cfg
> + * in the TLV format.*/
> + u16 len;
> +
> + /* Padding bytes for unaligned address's */
> + u16 pad_bytes;
> +
> + /* Reserve bytes for making cfgVal to align address */
> + u16 reserve;
> +
> + /* Following the uCfgLen field there should be a 'uCfgLen' bytes
> + * containing the uCfgValue ; u8 uCfgValue[uCfgLen] */
> +} __packed;
> +
> +struct wcn36xx_hal_mac_start_parameters {
> + /* Drive Type - Production or FTM etc */
> + enum driver_type type;
> +
> + /* Length of the config buffer */
> + u32 len;
> +
> + /* Following this there is a TLV formatted buffer of length
> + * "len" bytes containing all config values.
> + * The TLV is expected to be formatted like this:
> + * 0 15 31 31+CFG_LEN-1 length-1
> + * | CFG_ID | CFG_LEN | CFG_BODY | CFG_ID |......|
> + */
> +} __packed;
> +
> +struct wcn36xx_hal_mac_start_req_msg {
> + /* config buffer must start in TLV format just here */
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_mac_start_parameters params;
> +} __packed;
> +
> +struct wcn36xx_hal_mac_start_rsp_params {
> + /* success or failure */
> + u16 status;
> +
> + /* Max number of STA supported by the device */
> + u8 stations;
> +
> + /* Max number of BSS supported by the device */
> + u8 bssids;
> +
> + /* API Version */
> + struct wcnss_wlan_version version;
> +
> + /* CRM build information */
> + u8 crm_version[WCN36XX_HAL_VERSION_LENGTH];
> +
> + /* hardware/chipset/misc version information */
> + u8 wlan_version[WCN36XX_HAL_VERSION_LENGTH];
> +
> +} __packed;
> +
> +struct wcn36xx_hal_mac_start_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_mac_start_rsp_params start_rsp_params;
> +} __packed;
> +
> +struct wcn36xx_hal_mac_stop_req_params {
> + /* The reason for which the device is being stopped */
> + enum wcn36xx_hal_stop_type reason;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_mac_stop_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_mac_stop_req_params stop_req_params;
> +} __packed;
> +
> +struct wcn36xx_hal_mac_stop_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_update_cfg_req_msg {
> + /*
> + * Note: The length specified in tHalUpdateCfgReqMsg messages should be
> + * header.msgLen = sizeof(tHalUpdateCfgReqMsg) + uConfigBufferLen
> + */
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Length of the config buffer. Allows UMAC to update multiple CFGs */
> + u32 len;
> +
> + /*
> + * Following this there is a TLV formatted buffer of length
> + * "uConfigBufferLen" bytes containing all config values.
> + * The TLV is expected to be formatted like this:
> + * 0 15 31 31+CFG_LEN-1 length-1
> + * | CFG_ID | CFG_LEN | CFG_BODY | CFG_ID |......|
> + */
> +
> +} __packed;
> +
> +struct wcn36xx_hal_update_cfg_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> +} __packed;
> +
> +/* Frame control field format (2 bytes) */
> +struct wcn36xx_hal_mac_frame_ctl {
> +
> +#ifndef ANI_LITTLE_BIT_ENDIAN
> +
> + u8 subType:4;
> + u8 type:2;
> + u8 protVer:2;
> +
> + u8 order:1;
> + u8 wep:1;
> + u8 moreData:1;
> + u8 powerMgmt:1;
> + u8 retry:1;
> + u8 moreFrag:1;
> + u8 fromDS:1;
> + u8 toDS:1;
> +
> +#else
> +
> + u8 protVer:2;
> + u8 type:2;
> + u8 subType:4;
> +
> + u8 toDS:1;
> + u8 fromDS:1;
> + u8 moreFrag:1;
> + u8 retry:1;
> + u8 powerMgmt:1;
> + u8 moreData:1;
> + u8 wep:1;
> + u8 order:1;
> +
> +#endif
> +
> +};
> +
> +/* Sequence control field */
> +struct wcn36xx_hal_mac_seq_ctl {
> + u8 fragNum:4;
> + u8 seqNumLo:4;
> + u8 seqNumHi:8;
> +};
> +
> +/* Management header format */
> +struct wcn36xx_hal_mac_mgmt_hdr {
> + struct wcn36xx_hal_mac_frame_ctl fc;
> + u8 durationLo;
> + u8 durationHi;
> + u8 da[6];
> + u8 sa[6];
> + u8 bssId[6];
> + struct wcn36xx_hal_mac_seq_ctl seqControl;
> +};
> +
> +/* FIXME: pronto v1 apparently has 4 */
> +#define WCN36XX_HAL_NUM_BSSID 2
> +
> +/* Scan Entry to hold active BSS idx's */
> +struct wcn36xx_hal_scan_entry {
> + u8 bss_index[WCN36XX_HAL_NUM_BSSID];
> + u8 active_bss_count;
> +};
> +
> +struct wcn36xx_hal_init_scan_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* LEARN - AP Role
> + SCAN - STA Role */
> + enum wcn36xx_hal_sys_mode mode;
> +
> + /* BSSID of the BSS */
> + u8 bssid[ETH_ALEN];
> +
> + /* Whether BSS needs to be notified */
> + u8 notify;
> +
> + /* Kind of frame to be used for notifying the BSS (Data Null, QoS
> + * Null, or CTS to Self). Must always be a valid frame type. */
> + u8 frame_type;
> +
> + /* UMAC has the option of passing the MAC frame to be used for
> + * notifying the BSS. If non-zero, HAL will use the MAC frame
> + * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
> + * appropriate MAC frame based on frameType. */
> + u8 frame_len;
> +
> + /* Following the framelength there is a MAC frame buffer if
> + * frameLength is non-zero. */
> + struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
> +
> + /* Entry to hold number of active BSS idx's */
> + struct wcn36xx_hal_scan_entry scan_entry;
> +};
> +
> +struct wcn36xx_hal_init_scan_con_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* LEARN - AP Role
> + SCAN - STA Role */
> + enum wcn36xx_hal_sys_mode mode;
> +
> + /* BSSID of the BSS */
> + u8 bssid[ETH_ALEN];
> +
> + /* Whether BSS needs to be notified */
> + u8 notify;
> +
> + /* Kind of frame to be used for notifying the BSS (Data Null, QoS
> + * Null, or CTS to Self). Must always be a valid frame type. */
> + u8 frame_type;
> +
> + /* UMAC has the option of passing the MAC frame to be used for
> + * notifying the BSS. If non-zero, HAL will use the MAC frame
> + * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
> + * appropriate MAC frame based on frameType. */
> + u8 frame_length;
> +
> + /* Following the framelength there is a MAC frame buffer if
> + * frameLength is non-zero. */
> + struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
> +
> + /* Entry to hold number of active BSS idx's */
> + struct wcn36xx_hal_scan_entry scan_entry;
> +
> + /* Single NoA usage in Scanning */
> + u8 use_noa;
> +
> + /* Indicates the scan duration (in ms) */
> + u16 scan_duration;
> +
> +};
> +
> +struct wcn36xx_hal_init_scan_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_start_scan_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Indicates the channel to scan */
> + u8 scan_channel;
> +} __packed;
> +
> +struct wcn36xx_hal_start_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u32 start_tsf[2];
> + u8 tx_mgmt_power;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_end_scan_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Indicates the channel to stop scanning. Not used really. But
> + * retained for symmetry with "start Scan" message. It can also
> + * help in error check if needed. */
> + u8 scan_channel;
> +} __packed;
> +
> +struct wcn36xx_hal_end_scan_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_finish_scan_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Identifies the operational state of the AP/STA
> + * LEARN - AP Role SCAN - STA Role */
> + enum wcn36xx_hal_sys_mode mode;
> +
> + /* Operating channel to tune to. */
> + u8 oper_channel;
> +
> + /* Channel Bonding state If 20/40 MHz is operational, this will
> + * indicate the 40 MHz extension channel in combination with the
> + * control channel */
> + enum phy_chan_bond_state cb_state;
> +
> + /* BSSID of the BSS */
> + u8 bssid[ETH_ALEN];
> +
> + /* Whether BSS needs to be notified */
> + u8 notify;
> +
> + /* Kind of frame to be used for notifying the BSS (Data Null, QoS
> + * Null, or CTS to Self). Must always be a valid frame type. */
> + u8 frame_type;
> +
> + /* UMAC has the option of passing the MAC frame to be used for
> + * notifying the BSS. If non-zero, HAL will use the MAC frame
> + * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
> + * appropriate MAC frame based on frameType. */
> + u8 frame_length;
> +
> + /* Following the framelength there is a MAC frame buffer if
> + * frameLength is non-zero. */
> + struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
> +
> + /* Entry to hold number of active BSS idx's */
> + struct wcn36xx_hal_scan_entry scan_entry;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_finish_scan_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> +} __packed;
> +
> +enum wcn36xx_hal_rate_index {
> + HW_RATE_INDEX_1MBPS = 0x82,
> + HW_RATE_INDEX_2MBPS = 0x84,
> + HW_RATE_INDEX_5_5MBPS = 0x8B,
> + HW_RATE_INDEX_6MBPS = 0x0C,
> + HW_RATE_INDEX_9MBPS = 0x12,
> + HW_RATE_INDEX_11MBPS = 0x96,
> + HW_RATE_INDEX_12MBPS = 0x18,
> + HW_RATE_INDEX_18MBPS = 0x24,
> + HW_RATE_INDEX_24MBPS = 0x30,
> + HW_RATE_INDEX_36MBPS = 0x48,
> + HW_RATE_INDEX_48MBPS = 0x60,
> + HW_RATE_INDEX_54MBPS = 0x6C
> +};
> +
> +struct wcn36xx_hal_supported_rates {
> + /*
> + * For Self STA Entry: this represents Self Mode.
> + * For Peer Stations, this represents the mode of the peer.
> + * On Station:
> + *
> + * --this mode is updated when PE adds the Self Entry.
> + *
> + * -- OR when PE sends 'ADD_BSS' message and station context in BSS
> + * is used to indicate the mode of the AP.
> + *
> + * ON AP:
> + *
> + * -- this mode is updated when PE sends 'ADD_BSS' and Sta entry
> + * for that BSS is used to indicate the self mode of the AP.
> + *
> + * -- OR when a station is associated, PE sends 'ADD_STA' message
> + * with this mode updated.
> + */
> +
> + enum sta_rate_mode op_rate_mode;
> +
> + /* 11b, 11a and aniLegacyRates are IE rates which gives rate in
> + * unit of 500Kbps */
> + u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES];
> + u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES];
> + u16 legacy_rates[WCN36XX_HAL_NUM_POLARIS_RATES];
> + u16 reserved;
> +
> + /* Taurus only supports 26 Titan Rates(no ESF/concat Rates will be
> + * supported) First 26 bits are reserved for those Titan rates and
> + * the last 4 bits(bit28-31) for Taurus, 2(bit26-27) bits are
> + * reserved. */
> + /* Titan and Taurus Rates */
> + u32 enhanced_rate_bitmap;
> +
> + /*
> + * 0-76 bits used, remaining reserved
> + * bits 0-15 and 32 should be set.
> + */
> + u8 supported_mcs_set[WCN36XX_HAL_MAC_MAX_SUPPORTED_MCS_SET];
> +
> + /*
> + * RX Highest Supported Data Rate defines the highest data
> + * rate that the STA is able to receive, in unites of 1Mbps.
> + * This value is derived from "Supported MCS Set field" inside
> + * the HT capability element.
> + */
> + u16 rx_highest_data_rate;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_params {
> + /* BSSID of STA */
> + u8 bssid[ETH_ALEN];
> +
> + /* ASSOC ID, as assigned by UMAC */
> + u16 aid;
> +
> + /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
> + u8 type;
> +
> + /* Short Preamble Supported. */
> + u8 short_preamble_supported;
> +
> + /* MAC Address of STA */
> + u8 mac[ETH_ALEN];
> +
> + /* Listen interval of the STA */
> + u16 listen_interval;
> +
> + /* Support for 11e/WMM */
> + u8 wmm_enabled;
> +
> + /* 11n HT capable STA */
> + u8 ht_capable;
> +
> + /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
> + u8 tx_channel_width_set;
> +
> + /* RIFS mode 0 - NA, 1 - Allowed */
> + u8 rifs_mode;
> +
> + /* L-SIG TXOP Protection mechanism
> + 0 - No Support, 1 - Supported
> + SG - there is global field */
> + u8 lsig_txop_protection;
> +
> + /* Max Ampdu Size supported by STA. TPE programming.
> + 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
> + u8 max_ampdu_size;
> +
> + /* Max Ampdu density. Used by RA. 3 : 0~7 : 2^(11nAMPDUdensity -4) */
> + u8 max_ampdu_density;
> +
> + /* Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes */
> + u8 max_amsdu_size;
> +
> + /* Short GI support for 40Mhz packets */
> + u8 sgi_40mhz;
> +
> + /* Short GI support for 20Mhz packets */
> + u8 sgi_20Mhz;
> +
> + /* TODO move this parameter to the end for 3680 */
> + /* These rates are the intersection of peer and self capabilities. */
> + struct wcn36xx_hal_supported_rates supported_rates;
> +
> + /* Robust Management Frame (RMF) enabled/disabled */
> + u8 rmf;
> +
> + /* The unicast encryption type in the association */
> + u32 encrypt_type;
> +
> + /* HAL should update the existing STA entry, if this flag is set. UMAC
> + will set this flag in case of RE-ASSOC, where we want to reuse the
> + old STA ID. 0 = Add, 1 = Update */
> + u8 action;
> +
> + /* U-APSD Flags: 1b per AC. Encoded as follows:
> + b7 b6 b5 b4 b3 b2 b1 b0 =
> + X X X X BE BK VI VO */
> + u8 uapsd;
> +
> + /* Max SP Length */
> + u8 max_sp_len;
> +
> + /* 11n Green Field preamble support
> + 0 - Not supported, 1 - Supported */
> + u8 green_field_capable;
> +
> + /* MIMO Power Save mode */
> + enum wcn36xx_hal_ht_mimo_state mimo_ps;
> +
> + /* Delayed BA Support */
> + u8 delayed_ba_support;
> +
> + /* Max AMPDU duration in 32us */
> + u8 max_ampdu_duration;
> +
> + /* HT STA should set it to 1 if it is enabled in BSS. HT STA should
> + * set it to 0 if AP does not support it. This indication is sent
> + * to HAL and HAL uses this flag to pickup up appropriate 40Mhz
> + * rates. */
> + u8 dsss_cck_mode_40mhz;
> +
> + /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
> + * Retained for backward compalibity with existing HAL code */
> + u8 sta_index;
> +
> + /* BSSID of BSS to which station is associated. Set to 0xFF when
> + * invalid. Retained for backward compalibity with existing HAL
> + * code */
> + u8 bssid_index;
> +
> + u8 p2p;
> +
> + /* TODO add this parameter for 3680. */
> + /* Reserved to align next field on a dword boundary */
> + /* u8 reserved; */
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_config_sta_params sta_params;
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_params_v1 {
> + /* BSSID of STA */
> + u8 bssid[ETH_ALEN];
> +
> + /* ASSOC ID, as assigned by UMAC */
> + u16 aid;
> +
> + /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
> + u8 type;
> +
> + /* Short Preamble Supported. */
> + u8 short_preamble_supported;
> +
> + /* MAC Address of STA */
> + u8 mac[ETH_ALEN];
> +
> + /* Listen interval of the STA */
> + u16 listen_interval;
> +
> + /* Support for 11e/WMM */
> + u8 wmm_enabled;
> +
> + /* 11n HT capable STA */
> + u8 ht_capable;
> +
> + /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
> + u8 tx_channel_width_set;
> +
> + /* RIFS mode 0 - NA, 1 - Allowed */
> + u8 rifs_mode;
> +
> + /* L-SIG TXOP Protection mechanism
> + 0 - No Support, 1 - Supported
> + SG - there is global field */
> + u8 lsig_txop_protection;
> +
> + /* Max Ampdu Size supported by STA. TPE programming.
> + 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
> + u8 max_ampdu_size;
> +
> + /* Max Ampdu density. Used by RA. 3 : 0~7 : 2^(11nAMPDUdensity -4) */
> + u8 max_ampdu_density;
> +
> + /* Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes */
> + u8 max_amsdu_size;
> +
> + /* Short GI support for 40Mhz packets */
> + u8 sgi_40mhz;
> +
> + /* Short GI support for 20Mhz packets */
> + u8 sgi_20Mhz;
> +
> + /* Robust Management Frame (RMF) enabled/disabled */
> + u8 rmf;
> +
> + /* The unicast encryption type in the association */
> + u32 encrypt_type;
> +
> + /* HAL should update the existing STA entry, if this flag is set. UMAC
> + will set this flag in case of RE-ASSOC, where we want to reuse the
> + old STA ID. 0 = Add, 1 = Update */
> + u8 action;
> +
> + /* U-APSD Flags: 1b per AC. Encoded as follows:
> + b7 b6 b5 b4 b3 b2 b1 b0 =
> + X X X X BE BK VI VO */
> + u8 uapsd;
> +
> + /* Max SP Length */
> + u8 max_sp_len;
> +
> + /* 11n Green Field preamble support
> + 0 - Not supported, 1 - Supported */
> + u8 green_field_capable;
> +
> + /* MIMO Power Save mode */
> + enum wcn36xx_hal_ht_mimo_state mimo_ps;
> +
> + /* Delayed BA Support */
> + u8 delayed_ba_support;
> +
> + /* Max AMPDU duration in 32us */
> + u8 max_ampdu_duration;
> +
> + /* HT STA should set it to 1 if it is enabled in BSS. HT STA should
> + * set it to 0 if AP does not support it. This indication is sent
> + * to HAL and HAL uses this flag to pickup up appropriate 40Mhz
> + * rates. */
> + u8 dsss_cck_mode_40mhz;
> +
> + /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
> + * Retained for backward compalibity with existing HAL code */
> + u8 sta_index;
> +
> + /* BSSID of BSS to which station is associated. Set to 0xFF when
> + * invalid. Retained for backward compalibity with existing HAL
> + * code */
> + u8 bssid_index;
> +
> + u8 p2p;
> +
> + /* Reserved to align next field on a dword boundary */
> + u8 reserved;
> +
> + /* These rates are the intersection of peer and self capabilities. */
> + struct wcn36xx_hal_supported_rates supported_rates;
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_req_msg_v1 {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_config_sta_params_v1 sta_params;
> +} __packed;
> +
> +struct config_sta_rsp_params {
> + /* success or failure */
> + u32 status;
> +
> + /* Station index; valid only when 'status' field value SUCCESS */
> + u8 sta_index;
> +
> + /* BSSID Index of BSS to which the station is associated */
> + u8 bssid_index;
> +
> + /* DPU Index for PTK */
> + u8 dpu_index;
> +
> + /* DPU Index for GTK */
> + u8 bcast_dpu_index;
> +
> + /* DPU Index for IGTK */
> + u8 bcast_mgmt_dpu_idx;
> +
> + /* PTK DPU signature */
> + u8 uc_ucast_sig;
> +
> + /* GTK DPU isignature */
> + u8 uc_bcast_sig;
> +
> + /* IGTK DPU signature */
> + u8 uc_mgmt_sig;
> +
> + u8 p2p;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_config_sta_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + struct config_sta_rsp_params params;
> +} __packed;
> +
> +/* Delete STA Request message */
> +struct wcn36xx_hal_delete_sta_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Index of STA to delete */
> + u8 sta_index;
> +
> +} __packed;
> +
> +/* Delete STA Response message */
> +struct wcn36xx_hal_delete_sta_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* Index of STA deleted */
> + u8 sta_id;
> +} __packed;
> +
> +/* 12 Bytes long because this structure can be used to represent rate and
> + * extended rate set IEs. The parser assume this to be at least 12 */
> +struct wcn36xx_hal_rate_set {
> + u8 num_rates;
> + u8 rate[WCN36XX_HAL_MAC_RATESET_EID_MAX];
> +} __packed;
> +
> +/* access category record */
> +struct wcn36xx_hal_aci_aifsn {
> +#ifndef ANI_LITTLE_BIT_ENDIAN
> + u8 rsvd:1;
> + u8 aci:2;
> + u8 acm:1;
> + u8 aifsn:4;
> +#else
> + u8 aifsn:4;
> + u8 acm:1;
> + u8 aci:2;
> + u8 rsvd:1;
> +#endif
> +} __packed;
> +
> +/* contention window size */
> +struct wcn36xx_hal_mac_cw {
> +#ifndef ANI_LITTLE_BIT_ENDIAN
> + u8 max:4;
> + u8 min:4;
> +#else
> + u8 min:4;
> + u8 max:4;
> +#endif
> +} __packed;
> +
> +struct wcn36xx_hal_edca_param_record {
> + struct wcn36xx_hal_aci_aifsn aci;
> + struct wcn36xx_hal_mac_cw cw;
> + u16 txop_limit;
> +} __packed;
> +
> +struct wcn36xx_hal_mac_ssid {
> + u8 length;
> + u8 ssid[32];
> +} __packed;
> +
> +/* Concurrency role. These are generic IDs that identify the various roles
> + * in the software system. */
> +enum wcn36xx_hal_con_mode {
> + WCN36XX_HAL_STA_MODE = 0,
> +
> + /* to support softAp mode . This is misleading.
> + It means AP MODE only. */
> + WCN36XX_HAL_STA_SAP_MODE = 1,
> +
> + WCN36XX_HAL_P2P_CLIENT_MODE,
> + WCN36XX_HAL_P2P_GO_MODE,
> + WCN36XX_HAL_MONITOR_MODE,
> +};
> +
> +/* This is a bit pattern to be set for each mode
> + * bit 0 - sta mode
> + * bit 1 - ap mode
> + * bit 2 - p2p client mode
> + * bit 3 - p2p go mode */
> +enum wcn36xx_hal_concurrency_mode {
> + HAL_STA = 1,
> + HAL_SAP = 2,
> +
> + /* to support sta, softAp mode . This means STA+AP mode */
> + HAL_STA_SAP = 3,
> +
> + HAL_P2P_CLIENT = 4,
> + HAL_P2P_GO = 8,
> + HAL_MAX_CONCURRENCY_PERSONA = 4
> +};
> +
> +struct wcn36xx_hal_config_bss_params {
> + /* BSSID */
> + u8 bssid[ETH_ALEN];
> +
> + /* Self Mac Address */
> + u8 self_mac_addr[ETH_ALEN];
> +
> + /* BSS type */
> + enum wcn36xx_hal_bss_type bss_type;
> +
> + /* Operational Mode: AP =0, STA = 1 */
> + u8 oper_mode;
> +
> + /* Network Type */
> + enum wcn36xx_hal_nw_type nw_type;
> +
> + /* Used to classify PURE_11G/11G_MIXED to program MTU */
> + u8 short_slot_time_supported;
> +
> + /* Co-exist with 11a STA */
> + u8 lla_coexist;
> +
> + /* Co-exist with 11b STA */
> + u8 llb_coexist;
> +
> + /* Co-exist with 11g STA */
> + u8 llg_coexist;
> +
> + /* Coexistence with 11n STA */
> + u8 ht20_coexist;
> +
> + /* Non GF coexist flag */
> + u8 lln_non_gf_coexist;
> +
> + /* TXOP protection support */
> + u8 lsig_tx_op_protection_full_support;
> +
> + /* RIFS mode */
> + u8 rifs_mode;
> +
> + /* Beacon Interval in TU */
> + u16 beacon_interval;
> +
> + /* DTIM period */
> + u8 dtim_period;
> +
> + /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
> + u8 tx_channel_width_set;
> +
> + /* Operating channel */
> + u8 oper_channel;
> +
> + /* Extension channel for channel bonding */
> + u8 ext_channel;
> +
> + /* Reserved to align next field on a dword boundary */
> + u8 reserved;
> +
> + /* TODO move sta to the end for 3680 */
> + /* Context of the station being added in HW
> + * Add a STA entry for "itself" -
> + *
> + * On AP - Add the AP itself in an "STA context"
> + *
> + * On STA - Add the AP to which this STA is joining in an
> + * "STA context"
> + */
> + struct wcn36xx_hal_config_sta_params sta;
> + /* SSID of the BSS */
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* HAL should update the existing BSS entry, if this flag is set.
> + * UMAC will set this flag in case of reassoc, where we want to
> + * resue the the old BSSID and still return success 0 = Add, 1 =
> + * Update */
> + u8 action;
> +
> + /* MAC Rate Set */
> + struct wcn36xx_hal_rate_set rateset;
> +
> + /* Enable/Disable HT capabilities of the BSS */
> + u8 ht;
> +
> + /* Enable/Disable OBSS protection */
> + u8 obss_prot_enabled;
> +
> + /* RMF enabled/disabled */
> + u8 rmf;
> +
> + /* HT Operating Mode operating mode of the 802.11n STA */
> + enum wcn36xx_hal_ht_operating_mode ht_oper_mode;
> +
> + /* Dual CTS Protection: 0 - Unused, 1 - Used */
> + u8 dual_cts_protection;
> +
> + /* Probe Response Max retries */
> + u8 max_probe_resp_retry_limit;
> +
> + /* To Enable Hidden ssid */
> + u8 hidden_ssid;
> +
> + /* To Enable Disable FW Proxy Probe Resp */
> + u8 proxy_probe_resp;
> +
> + /* Boolean to indicate if EDCA params are valid. UMAC might not
> + * have valid EDCA params or might not desire to apply EDCA params
> + * during config BSS. 0 implies Not Valid ; Non-Zero implies
> + * valid */
> + u8 edca_params_valid;
> +
> + /* EDCA Parameters for Best Effort Access Category */
> + struct wcn36xx_hal_edca_param_record acbe;
> +
> + /* EDCA Parameters forBackground Access Category */
> + struct wcn36xx_hal_edca_param_record acbk;
> +
> + /* EDCA Parameters for Video Access Category */
> + struct wcn36xx_hal_edca_param_record acvi;
> +
> + /* EDCA Parameters for Voice Access Category */
> + struct wcn36xx_hal_edca_param_record acvo;
> +
> + /* Ext Bss Config Msg if set */
> + u8 ext_set_sta_key_param_valid;
> +
> + /* SetStaKeyParams for ext bss msg */
> + struct wcn36xx_hal_set_sta_key_params ext_set_sta_key_param;
> +
> + /* Persona for the BSS can be STA,AP,GO,CLIENT value same as enum
> + * wcn36xx_hal_con_mode */
> + u8 wcn36xx_hal_persona;
> +
> + u8 spectrum_mgt_enable;
> +
> + /* HAL fills in the tx power used for mgmt frames in txMgmtPower */
> + s8 tx_mgmt_power;
> +
> + /* maxTxPower has max power to be used after applying the power
> + * constraint if any */
> + s8 max_tx_power;
> +} __packed;
> +
> +struct wcn36xx_hal_config_bss_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_config_bss_params bss_params;
> +} __packed;
> +
> +struct wcn36xx_hal_config_bss_params_v1 {
> + /* BSSID */
> + u8 bssid[ETH_ALEN];
> +
> + /* Self Mac Address */
> + u8 self_mac_addr[ETH_ALEN];
> +
> + /* BSS type */
> + enum wcn36xx_hal_bss_type bss_type;
> +
> + /* Operational Mode: AP =0, STA = 1 */
> + u8 oper_mode;
> +
> + /* Network Type */
> + enum wcn36xx_hal_nw_type nw_type;
> +
> + /* Used to classify PURE_11G/11G_MIXED to program MTU */
> + u8 short_slot_time_supported;
> +
> + /* Co-exist with 11a STA */
> + u8 lla_coexist;
> +
> + /* Co-exist with 11b STA */
> + u8 llb_coexist;
> +
> + /* Co-exist with 11g STA */
> + u8 llg_coexist;
> +
> + /* Coexistence with 11n STA */
> + u8 ht20_coexist;
> +
> + /* Non GF coexist flag */
> + u8 lln_non_gf_coexist;
> +
> + /* TXOP protection support */
> + u8 lsig_tx_op_protection_full_support;
> +
> + /* RIFS mode */
> + u8 rifs_mode;
> +
> + /* Beacon Interval in TU */
> + u16 beacon_interval;
> +
> + /* DTIM period */
> + u8 dtim_period;
> +
> + /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
> + u8 tx_channel_width_set;
> +
> + /* Operating channel */
> + u8 oper_channel;
> +
> + /* Extension channel for channel bonding */
> + u8 ext_channel;
> +
> + /* Reserved to align next field on a dword boundary */
> + u8 reserved;
> +
> + /* SSID of the BSS */
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* HAL should update the existing BSS entry, if this flag is set.
> + * UMAC will set this flag in case of reassoc, where we want to
> + * resue the the old BSSID and still return success 0 = Add, 1 =
> + * Update */
> + u8 action;
> +
> + /* MAC Rate Set */
> + struct wcn36xx_hal_rate_set rateset;
> +
> + /* Enable/Disable HT capabilities of the BSS */
> + u8 ht;
> +
> + /* Enable/Disable OBSS protection */
> + u8 obss_prot_enabled;
> +
> + /* RMF enabled/disabled */
> + u8 rmf;
> +
> + /* HT Operating Mode operating mode of the 802.11n STA */
> + enum wcn36xx_hal_ht_operating_mode ht_oper_mode;
> +
> + /* Dual CTS Protection: 0 - Unused, 1 - Used */
> + u8 dual_cts_protection;
> +
> + /* Probe Response Max retries */
> + u8 max_probe_resp_retry_limit;
> +
> + /* To Enable Hidden ssid */
> + u8 hidden_ssid;
> +
> + /* To Enable Disable FW Proxy Probe Resp */
> + u8 proxy_probe_resp;
> +
> + /* Boolean to indicate if EDCA params are valid. UMAC might not
> + * have valid EDCA params or might not desire to apply EDCA params
> + * during config BSS. 0 implies Not Valid ; Non-Zero implies
> + * valid */
> + u8 edca_params_valid;
> +
> + /* EDCA Parameters for Best Effort Access Category */
> + struct wcn36xx_hal_edca_param_record acbe;
> +
> + /* EDCA Parameters forBackground Access Category */
> + struct wcn36xx_hal_edca_param_record acbk;
> +
> + /* EDCA Parameters for Video Access Category */
> + struct wcn36xx_hal_edca_param_record acvi;
> +
> + /* EDCA Parameters for Voice Access Category */
> + struct wcn36xx_hal_edca_param_record acvo;
> +
> + /* Ext Bss Config Msg if set */
> + u8 ext_set_sta_key_param_valid;
> +
> + /* SetStaKeyParams for ext bss msg */
> + struct wcn36xx_hal_set_sta_key_params ext_set_sta_key_param;
> +
> + /* Persona for the BSS can be STA,AP,GO,CLIENT value same as enum
> + * wcn36xx_hal_con_mode */
> + u8 wcn36xx_hal_persona;
> +
> + u8 spectrum_mgt_enable;
> +
> + /* HAL fills in the tx power used for mgmt frames in txMgmtPower */
> + s8 tx_mgmt_power;
> +
> + /* maxTxPower has max power to be used after applying the power
> + * constraint if any */
> + s8 max_tx_power;
> +
> + /* Context of the station being added in HW
> + * Add a STA entry for "itself" -
> + *
> + * On AP - Add the AP itself in an "STA context"
> + *
> + * On STA - Add the AP to which this STA is joining in an
> + * "STA context"
> + */
> + struct wcn36xx_hal_config_sta_params_v1 sta;
> +} __packed;
> +
> +struct wcn36xx_hal_config_bss_req_msg_v1 {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_config_bss_params_v1 bss_params;
> +} __packed;
> +
> +struct wcn36xx_hal_config_bss_rsp_params {
> + /* Success or Failure */
> + u32 status;
> +
> + /* BSS index allocated by HAL */
> + u8 bss_index;
> +
> + /* DPU descriptor index for PTK */
> + u8 dpu_desc_index;
> +
> + /* PTK DPU signature */
> + u8 ucast_dpu_signature;
> +
> + /* DPU descriptor index for GTK */
> + u8 bcast_dpu_desc_indx;
> +
> + /* GTK DPU signature */
> + u8 bcast_dpu_signature;
> +
> + /* DPU descriptor for IGTK */
> + u8 mgmt_dpu_desc_index;
> +
> + /* IGTK DPU signature */
> + u8 mgmt_dpu_signature;
> +
> + /* Station Index for BSS entry */
> + u8 bss_sta_index;
> +
> + /* Self station index for this BSS */
> + u8 bss_self_sta_index;
> +
> + /* Bcast station for buffering bcast frames in AP role */
> + u8 bss_bcast_sta_idx;
> +
> + /* MAC Address of STA(PEER/SELF) in staContext of configBSSReq */
> + u8 mac[ETH_ALEN];
> +
> + /* HAL fills in the tx power used for mgmt frames in this field. */
> + s8 tx_mgmt_power;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_config_bss_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_config_bss_rsp_params bss_rsp_params;
> +} __packed;
> +
> +struct wcn36xx_hal_delete_bss_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* BSS index to be deleted */
> + u8 bss_index;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_delete_bss_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Success or Failure */
> + u32 status;
> +
> + /* BSS index that has been deleted */
> + u8 bss_index;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_join_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Indicates the BSSID to which STA is going to associate */
> + u8 bssid[ETH_ALEN];
> +
> + /* Indicates the channel to switch to. */
> + u8 channel;
> +
> + /* Self STA MAC */
> + u8 self_sta_mac_addr[ETH_ALEN];
> +
> + /* Local power constraint */
> + u8 local_power_constraint;
> +
> + /* Secondary channel offset */
> + enum phy_chan_bond_state secondary_channel_offset;
> +
> + /* link State */
> + enum wcn36xx_hal_link_state link_state;
> +
> + /* Max TX power */
> + s8 max_tx_power;
> +} __packed;
> +
> +struct wcn36xx_hal_join_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* HAL fills in the tx power used for mgmt frames in this field */
> + u8 tx_mgmt_power;
> +} __packed;
> +
> +struct post_assoc_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + struct wcn36xx_hal_config_sta_params sta_params;
> + struct wcn36xx_hal_config_bss_params bss_params;
> +};
> +
> +struct post_assoc_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct config_sta_rsp_params sta_rsp_params;
> + struct wcn36xx_hal_config_bss_rsp_params bss_rsp_params;
> +};
> +
> +/* This is used to create a set of WEP keys for a given BSS. */
> +struct wcn36xx_hal_set_bss_key_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* BSS Index of the BSS */
> + u8 bss_idx;
> +
> + /* Encryption Type used with peer */
> + enum ani_ed_type enc_type;
> +
> + /* Number of keys */
> + u8 num_keys;
> +
> + /* Array of keys. */
> + struct wcn36xx_hal_keys keys[WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS];
> +
> + /* Control for Replay Count, 1= Single TID based replay count on Tx
> + * 0 = Per TID based replay count on TX */
> + u8 single_tid_rc;
> +} __packed;
> +
> +/* tagged version of set bss key */
> +struct wcn36xx_hal_set_bss_key_req_msg_tagged {
> + struct wcn36xx_hal_set_bss_key_req_msg Msg;
> + u32 tag;
> +} __packed;
> +
> +struct wcn36xx_hal_set_bss_key_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +/*
> + * This is used configure the key information on a given station.
> + * When the sec_type is WEP40 or WEP104, the def_wep_idx is used to locate
> + * a preconfigured key from a BSS the station assoicated with; otherwise
> + * a new key descriptor is created based on the key field.
> + */
> +struct wcn36xx_hal_set_sta_key_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_set_sta_key_params set_sta_key_params;
> +} __packed;
> +
> +struct wcn36xx_hal_set_sta_key_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_remove_bss_key_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* BSS Index of the BSS */
> + u8 bss_idx;
> +
> + /* Encryption Type used with peer */
> + enum ani_ed_type enc_type;
> +
> + /* Key Id */
> + u8 key_id;
> +
> + /* STATIC/DYNAMIC. Used in Nullifying in Key Descriptors for
> + * Static/Dynamic keys */
> + enum ani_wep_type wep_type;
> +} __packed;
> +
> +struct wcn36xx_hal_remove_bss_key_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +/*
> + * This is used by PE to Remove the key information on a given station.
> + */
> +struct wcn36xx_hal_remove_sta_key_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* STA Index */
> + u16 sta_idx;
> +
> + /* Encryption Type used with peer */
> + enum ani_ed_type enc_type;
> +
> + /* Key Id */
> + u8 key_id;
> +
> + /* Whether to invalidate the Broadcast key or Unicast key. In case
> + * of WEP, the same key is used for both broadcast and unicast. */
> + u8 unicast;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_remove_sta_key_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /*success or failure */
> + u32 status;
> +
> +} __packed;
> +
> +#ifdef FEATURE_OEM_DATA_SUPPORT
> +
> +#ifndef OEM_DATA_REQ_SIZE
> +#define OEM_DATA_REQ_SIZE 134
> +#endif
> +
> +#ifndef OEM_DATA_RSP_SIZE
> +#define OEM_DATA_RSP_SIZE 1968
> +#endif
> +
> +struct start_oem_data_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 status;
> + tSirMacAddr self_mac_addr;
> + u8 oem_data_req[OEM_DATA_REQ_SIZE];
> +
> +};
> +
> +struct start_oem_data_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 oem_data_rsp[OEM_DATA_RSP_SIZE];
> +};
> +
> +#endif
> +
> +struct wcn36xx_hal_switch_channel_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Channel number */
> + u8 channel_number;
> +
> + /* Local power constraint */
> + u8 local_power_constraint;
> +
> + /* Secondary channel offset */
> + enum phy_chan_bond_state secondary_channel_offset;
> +
> + /* HAL fills in the tx power used for mgmt frames in this field. */
> + u8 tx_mgmt_power;
> +
> + /* Max TX power */
> + u8 max_tx_power;
> +
> + /* Self STA MAC */
> + u8 self_sta_mac_addr[ETH_ALEN];
> +
> + /* VO WIFI comment: BSSID needed to identify session. As the
> + * request has power constraints, this should be applied only to
> + * that session Since MTU timing and EDCA are sessionized, this
> + * struct needs to be sessionized and bssid needs to be out of the
> + * VOWifi feature flag V IMP: Keep bssId field at the end of this
> + * msg. It is used to mantain backward compatbility by way of
> + * ignoring if using new host/old FW or old host/new FW since it is
> + * at the end of this struct
> + */
> + u8 bssid[ETH_ALEN];
> +} __packed;
> +
> +struct wcn36xx_hal_switch_channel_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Status */
> + u32 status;
> +
> + /* Channel number - same as in request */
> + u8 channel_number;
> +
> + /* HAL fills in the tx power used for mgmt frames in this field */
> + u8 tx_mgmt_power;
> +
> + /* BSSID needed to identify session - same as in request */
> + u8 bssid[ETH_ALEN];
> +
> +} __packed;
> +
> +struct update_edca_params_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /*BSS Index */
> + u16 bss_index;
> +
> + /* Best Effort */
> + struct wcn36xx_hal_edca_param_record acbe;
> +
> + /* Background */
> + struct wcn36xx_hal_edca_param_record acbk;
> +
> + /* Video */
> + struct wcn36xx_hal_edca_param_record acvi;
> +
> + /* Voice */
> + struct wcn36xx_hal_edca_param_record acvo;
> +};
> +
> +struct update_edca_params_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct dpu_stats_params {
> + /* Index of STA to which the statistics */
> + u16 sta_index;
> +
> + /* Encryption mode */
> + u8 enc_mode;
> +
> + /* status */
> + u32 status;
> +
> + /* Statistics */
> + u32 send_blocks;
> + u32 recv_blocks;
> + u32 replays;
> + u8 mic_error_cnt;
> + u32 prot_excl_cnt;
> + u16 format_err_cnt;
> + u16 un_decryptable_cnt;
> + u32 decrypt_err_cnt;
> + u32 decrypt_ok_cnt;
> +};
> +
> +struct wcn36xx_hal_stats_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Valid STA Idx for per STA stats request */
> + u32 sta_id;
> +
> + /* Categories of stats requested as specified in eHalStatsMask */
> + u32 stats_mask;
> +};
> +
> +struct ani_summary_stats_info {
> + /* Total number of packets(per AC) that were successfully
> + * transmitted with retries */
> + u32 retry_cnt[4];
> +
> + /* The number of MSDU packets and MMPDU frames per AC that the
> + * 802.11 station successfully transmitted after more than one
> + * retransmission attempt */
> + u32 multiple_retry_cnt[4];
> +
> + /* Total number of packets(per AC) that were successfully
> + * transmitted (with and without retries, including multi-cast,
> + * broadcast) */
> + u32 tx_frm_cnt[4];
> +
> + /* Total number of packets that were successfully received (after
> + * appropriate filter rules including multi-cast, broadcast) */
> + u32 rx_frm_cnt;
> +
> + /* Total number of duplicate frames received successfully */
> + u32 frm_dup_cnt;
> +
> + /* Total number packets(per AC) failed to transmit */
> + u32 fail_cnt[4];
> +
> + /* Total number of RTS/CTS sequence failures for transmission of a
> + * packet */
> + u32 rts_fail_cnt;
> +
> + /* Total number packets failed transmit because of no ACK from the
> + * remote entity */
> + u32 ack_fail_cnt;
> +
> + /* Total number of RTS/CTS sequence success for transmission of a
> + * packet */
> + u32 rts_succ_cnt;
> +
> + /* The sum of the receive error count and dropped-receive-buffer
> + * error count. HAL will provide this as a sum of (FCS error) +
> + * (Fail get BD/PDU in HW) */
> + u32 rx_discard_cnt;
> +
> + /*
> + * The receive error count. HAL will provide the RxP FCS error
> + * global counter. */
> + u32 rx_error_cnt;
> +
> + /* The sum of the transmit-directed byte count, transmit-multicast
> + * byte count and transmit-broadcast byte count. HAL will sum TPE
> + * UC/MC/BCAST global counters to provide this. */
> + u32 tx_byte_cnt;
> +};
> +
> +/* defines tx_rate_flags */
> +enum tx_rate_info {
> + /* Legacy rates */
> + HAL_TX_RATE_LEGACY = 0x1,
> +
> + /* HT20 rates */
> + HAL_TX_RATE_HT20 = 0x2,
> +
> + /* HT40 rates */
> + HAL_TX_RATE_HT40 = 0x4,
> +
> + /* Rate with Short guard interval */
> + HAL_TX_RATE_SGI = 0x8,
> +
> + /* Rate with Long guard interval */
> + HAL_TX_RATE_LGI = 0x10
> +};
> +
> +struct ani_global_class_a_stats_info {
> + /* The number of MPDU frames received by the 802.11 station for
> + * MSDU packets or MMPDU frames */
> + u32 rx_frag_cnt;
> +
> + /* The number of MPDU frames received by the 802.11 station for
> + * MSDU packets or MMPDU frames when a promiscuous packet filter
> + * was enabled */
> + u32 promiscuous_rx_frag_cnt;
> +
> + /* The receiver input sensitivity referenced to a FER of 8% at an
> + * MPDU length of 1024 bytes at the antenna connector. Each element
> + * of the array shall correspond to a supported rate and the order
> + * shall be the same as the supporteRates parameter. */
> + u32 rx_input_sensitivity;
> +
> + /* The maximum transmit power in dBm upto one decimal. for eg: if
> + * it is 10.5dBm, the value would be 105 */
> + u32 max_pwr;
> +
> + /* Number of times the receiver failed to synchronize with the
> + * incoming signal after detecting the sync in the preamble of the
> + * transmitted PLCP protocol data unit. */
> + u32 sync_fail_cnt;
> +
> + /* Legacy transmit rate, in units of 500 kbit/sec, for the most
> + * recently transmitted frame */
> + u32 tx_rate;
> +
> + /* mcs index for HT20 and HT40 rates */
> + u32 mcs_index;
> +
> + /* to differentiate between HT20 and HT40 rates; short and long
> + * guard interval */
> + u32 tx_rate_flags;
> +};
> +
> +struct ani_global_security_stats {
> + /* The number of unencrypted received MPDU frames that the MAC
> + * layer discarded when the IEEE 802.11 dot11ExcludeUnencrypted
> + * management information base (MIB) object is enabled */
> + u32 rx_wep_unencrypted_frm_cnt;
> +
> + /* The number of received MSDU packets that that the 802.11 station
> + * discarded because of MIC failures */
> + u32 rx_mic_fail_cnt;
> +
> + /* The number of encrypted MPDU frames that the 802.11 station
> + * failed to decrypt because of a TKIP ICV error */
> + u32 tkip_icv_err;
> +
> + /* The number of received MPDU frames that the 802.11 discarded
> + * because of an invalid AES-CCMP format */
> + u32 aes_ccmp_format_err;
> +
> + /* The number of received MPDU frames that the 802.11 station
> + * discarded because of the AES-CCMP replay protection procedure */
> + u32 aes_ccmp_replay_cnt;
> +
> + /* The number of received MPDU frames that the 802.11 station
> + * discarded because of errors detected by the AES-CCMP decryption
> + * algorithm */
> + u32 aes_ccmp_decrpt_err;
> +
> + /* The number of encrypted MPDU frames received for which a WEP
> + * decryption key was not available on the 802.11 station */
> + u32 wep_undecryptable_cnt;
> +
> + /* The number of encrypted MPDU frames that the 802.11 station
> + * failed to decrypt because of a WEP ICV error */
> + u32 wep_icv_err;
> +
> + /* The number of received encrypted packets that the 802.11 station
> + * successfully decrypted */
> + u32 rx_decrypt_succ_cnt;
> +
> + /* The number of encrypted packets that the 802.11 station failed
> + * to decrypt */
> + u32 rx_decrypt_fail_cnt;
> +};
> +
> +struct ani_global_class_b_stats_info {
> + struct ani_global_security_stats uc_stats;
> + struct ani_global_security_stats mc_bc_stats;
> +};
> +
> +struct ani_global_class_c_stats_info {
> + /* This counter shall be incremented for a received A-MSDU frame
> + * with the stations MAC address in the address 1 field or an
> + * A-MSDU frame with a group address in the address 1 field */
> + u32 rx_amsdu_cnt;
> +
> + /* This counter shall be incremented when the MAC receives an AMPDU
> + * from the PHY */
> + u32 rx_ampdu_cnt;
> +
> + /* This counter shall be incremented when a Frame is transmitted
> + * only on the primary channel */
> + u32 tx_20_frm_cnt;
> +
> + /* This counter shall be incremented when a Frame is received only
> + * on the primary channel */
> + u32 rx_20_frm_cnt;
> +
> + /* This counter shall be incremented by the number of MPDUs
> + * received in the A-MPDU when an A-MPDU is received */
> + u32 rx_mpdu_in_ampdu_cnt;
> +
> + /* This counter shall be incremented when an MPDU delimiter has a
> + * CRC error when this is the first CRC error in the received AMPDU
> + * or when the previous delimiter has been decoded correctly */
> + u32 ampdu_delimiter_crc_err;
> +};
> +
> +struct ani_per_sta_stats_info {
> + /* The number of MPDU frames that the 802.11 station transmitted
> + * and acknowledged through a received 802.11 ACK frame */
> + u32 tx_frag_cnt[4];
> +
> + /* This counter shall be incremented when an A-MPDU is transmitted */
> + u32 tx_ampdu_cnt;
> +
> + /* This counter shall increment by the number of MPDUs in the AMPDU
> + * when an A-MPDU is transmitted */
> + u32 tx_mpdu_in_ampdu_cnt;
> +};
> +
> +struct wcn36xx_hal_stats_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Success or Failure */
> + u32 status;
> +
> + /* STA Idx */
> + u32 sta_index;
> +
> + /* Categories of STATS being returned as per eHalStatsMask */
> + u32 stats_mask;
> +
> + /* message type is same as the request type */
> + u16 msg_type;
> +
> + /* length of the entire request, includes the pStatsBuf length too */
> + u16 msg_len;
> +};
> +
> +struct wcn36xx_hal_set_link_state_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bssid[ETH_ALEN];
> + enum wcn36xx_hal_link_state state;
> + u8 self_mac_addr[ETH_ALEN];
> +
> +} __packed;
> +
> +struct set_link_state_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +/* TSPEC Params */
> +struct wcn36xx_hal_ts_info_tfc {
> +#ifndef ANI_LITTLE_BIT_ENDIAN
> + u16 ackPolicy:2;
> + u16 userPrio:3;
> + u16 psb:1;
> + u16 aggregation:1;
> + u16 accessPolicy:2;
> + u16 direction:2;
> + u16 tsid:4;
> + u16 trafficType:1;
> +#else
> + u16 trafficType:1;
> + u16 tsid:4;
> + u16 direction:2;
> + u16 accessPolicy:2;
> + u16 aggregation:1;
> + u16 psb:1;
> + u16 userPrio:3;
> + u16 ackPolicy:2;
> +#endif
> +};
> +
> +/* Flag to schedule the traffic type */
> +struct wcn36xx_hal_ts_info_sch {
> +#ifndef ANI_LITTLE_BIT_ENDIAN
> + u8 rsvd:7;
> + u8 schedule:1;
> +#else
> + u8 schedule:1;
> + u8 rsvd:7;
> +#endif
> +};
> +
> +/* Traffic and scheduling info */
> +struct wcn36xx_hal_ts_info {
> + struct wcn36xx_hal_ts_info_tfc traffic;
> + struct wcn36xx_hal_ts_info_sch schedule;
> +};
> +
> +/* Information elements */
> +struct wcn36xx_hal_tspec_ie {
> + u8 type;
> + u8 length;
> + struct wcn36xx_hal_ts_info ts_info;
> + u16 nom_msdu_size;
> + u16 max_msdu_size;
> + u32 min_svc_interval;
> + u32 max_svc_interval;
> + u32 inact_interval;
> + u32 suspend_interval;
> + u32 svc_start_time;
> + u32 min_data_rate;
> + u32 mean_data_rate;
> + u32 peak_data_rate;
> + u32 max_burst_sz;
> + u32 delay_bound;
> + u32 min_phy_rate;
> + u16 surplus_bw;
> + u16 medium_time;
> +};
> +
> +struct add_ts_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index */
> + u16 sta_index;
> +
> + /* TSPEC handler uniquely identifying a TSPEC for a STA in a BSS */
> + u16 tspec_index;
> +
> + /* To program TPE with required parameters */
> + struct wcn36xx_hal_tspec_ie tspec;
> +
> + /* U-APSD Flags: 1b per AC. Encoded as follows:
> + b7 b6 b5 b4 b3 b2 b1 b0 =
> + X X X X BE BK VI VO */
> + u8 uapsd;
> +
> + /* These parameters are for all the access categories */
> +
> + /* Service Interval */
> + u32 service_interval[WCN36XX_HAL_MAX_AC];
> +
> + /* Suspend Interval */
> + u32 suspend_interval[WCN36XX_HAL_MAX_AC];
> +
> + /* Delay Interval */
> + u32 delay_interval[WCN36XX_HAL_MAX_AC];
> +};
> +
> +struct add_rs_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct del_ts_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index */
> + u16 sta_index;
> +
> + /* TSPEC identifier uniquely identifying a TSPEC for a STA in a BSS */
> + u16 tspec_index;
> +
> + /* To lookup station id using the mac address */
> + u8 bssid[ETH_ALEN];
> +};
> +
> +struct del_ts_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +/* End of TSpec Parameters */
> +
> +/* Start of BLOCK ACK related Parameters */
> +
> +struct wcn36xx_hal_add_ba_session_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index */
> + u16 sta_index;
> +
> + /* Peer MAC Address */
> + u8 mac_addr[ETH_ALEN];
> +
> + /* ADDBA Action Frame dialog token
> + HAL will not interpret this object */
> + u8 dialog_token;
> +
> + /* TID for which the BA is being setup
> + This identifies the TC or TS of interest */
> + u8 tid;
> +
> + /* 0 - Delayed BA (Not supported)
> + 1 - Immediate BA */
> + u8 policy;
> +
> + /* Indicates the number of buffers for this TID (baTID)
> + NOTE - This is the requested buffer size. When this
> + is processed by HAL and subsequently by HDD, it is
> + possible that HDD may change this buffer size. Any
> + change in the buffer size should be noted by PE and
> + advertized appropriately in the ADDBA response */
> + u16 buffer_size;
> +
> + /* BA timeout in TU's 0 means no timeout will occur */
> + u16 timeout;
> +
> + /* b0..b3 - Fragment Number - Always set to 0
> + b4..b15 - Starting Sequence Number of first MSDU
> + for which this BA is setup */
> + u16 ssn;
> +
> + /* ADDBA direction
> + 1 - Originator
> + 0 - Recipient */
> + u8 direction;
> +} __packed;
> +
> +struct wcn36xx_hal_add_ba_session_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* Dialog token */
> + u8 dialog_token;
> +
> + /* TID for which the BA session has been setup */
> + u8 ba_tid;
> +
> + /* BA Buffer Size allocated for the current BA session */
> + u8 ba_buffer_size;
> +
> + u8 ba_session_id;
> +
> + /* Reordering Window buffer */
> + u8 win_size;
> +
> + /* Station Index to id the sta */
> + u8 sta_index;
> +
> + /* Starting Sequence Number */
> + u16 ssn;
> +} __packed;
> +
> +struct wcn36xx_hal_add_ba_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Session Id */
> + u8 session_id;
> +
> + /* Reorder Window Size */
> + u8 win_size;
> +/* Old FW 1.2.2.4 does not support this*/
> +#ifdef FEATURE_ON_CHIP_REORDERING
> + u8 reordering_done_on_chip;
> +#endif
> +} __packed;
> +
> +struct wcn36xx_hal_add_ba_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* Dialog token */
> + u8 dialog_token;
> +} __packed;
> +
> +struct add_ba_info {
> + u16 ba_enable:1;
> + u16 starting_seq_num:12;
> + u16 reserved:3;
> +};
> +
> +struct wcn36xx_hal_trigger_ba_rsp_candidate {
> + u8 sta_addr[ETH_ALEN];
> + struct add_ba_info ba_info[STACFG_MAX_TC];
> +} __packed;
> +
> +struct wcn36xx_hal_trigget_ba_req_candidate {
> + u8 sta_index;
> + u8 tid_bitmap;
> +} __packed;
> +
> +struct wcn36xx_hal_trigger_ba_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Session Id */
> + u8 session_id;
> +
> + /* baCandidateCnt is followed by trigger BA
> + * Candidate List(tTriggerBaCandidate)
> + */
> + u16 candidate_cnt;
> +
> +} __packed;
> +
> +struct wcn36xx_hal_trigger_ba_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* TO SUPPORT BT-AMP */
> + u8 bssid[ETH_ALEN];
> +
> + /* success or failure */
> + u32 status;
> +
> + /* baCandidateCnt is followed by trigger BA
> + * Rsp Candidate List(tTriggerRspBaCandidate)
> + */
> + u16 candidate_cnt;
> +} __packed;
> +
> +struct wcn36xx_hal_del_ba_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index */
> + u16 sta_index;
> +
> + /* TID for which the BA session is being deleted */
> + u8 tid;
> +
> + /* DELBA direction
> + 1 - Originator
> + 0 - Recipient */
> + u8 direction;
> +} __packed;
> +
> +struct wcn36xx_hal_del_ba_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +} __packed;
> +
> +struct tsm_stats_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Traffic Id */
> + u8 tid;
> +
> + u8 bssid[ETH_ALEN];
> +};
> +
> +struct tsm_stats_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /*success or failure */
> + u32 status;
> +
> + /* Uplink Packet Queue delay */
> + u16 uplink_pkt_queue_delay;
> +
> + /* Uplink Packet Queue delay histogram */
> + u16 uplink_pkt_queue_delay_hist[4];
> +
> + /* Uplink Packet Transmit delay */
> + u32 uplink_pkt_tx_delay;
> +
> + /* Uplink Packet loss */
> + u16 uplink_pkt_loss;
> +
> + /* Uplink Packet count */
> + u16 uplink_pkt_count;
> +
> + /* Roaming count */
> + u8 roaming_count;
> +
> + /* Roaming Delay */
> + u16 roaming_delay;
> +};
> +
> +struct set_key_done_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /*bssid of the keys */
> + u8 bssidx;
> + u8 enc_type;
> +};
> +
> +struct wcn36xx_hal_nv_img_download_req_msg {
> + /* Note: The length specified in wcn36xx_hal_nv_img_download_req_msg
> + * messages should be
> + * header.len = sizeof(wcn36xx_hal_nv_img_download_req_msg) +
> + * nv_img_buffer_size */
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Fragment sequence number of the NV Image. Note that NV Image
> + * might not fit into one message due to size limitation of the SMD
> + * channel FIFO. UMAC can hence choose to chop the NV blob into
> + * multiple fragments starting with seqeunce number 0, 1, 2 etc.
> + * The last fragment MUST be indicated by marking the
> + * isLastFragment field to 1. Note that all the NV blobs would be
> + * concatenated together by HAL without any padding bytes in
> + * between.*/
> + u16 frag_number;
> +
> + /* Is this the last fragment? When set to 1 it indicates that no
> + * more fragments will be sent by UMAC and HAL can concatenate all
> + * the NV blobs rcvd & proceed with the parsing. HAL would generate
> + * a WCN36XX_HAL_DOWNLOAD_NV_RSP to the WCN36XX_HAL_DOWNLOAD_NV_REQ
> + * after it receives each fragment */
> + u16 last_fragment;
> +
> + /* NV Image size (number of bytes) */
> + u32 nv_img_buffer_size;
> +
> + /* Following the 'nv_img_buffer_size', there should be
> + * nv_img_buffer_size bytes of NV Image i.e.
> + * u8[nv_img_buffer_size] */
> +} __packed;
> +
> +struct wcn36xx_hal_nv_img_download_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Success or Failure. HAL would generate a
> + * WCN36XX_HAL_DOWNLOAD_NV_RSP after each fragment */
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_nv_store_ind {
> + /* Note: The length specified in tHalNvStoreInd messages should be
> + * header.msgLen = sizeof(tHalNvStoreInd) + nvBlobSize */
> + struct wcn36xx_hal_msg_header header;
> +
> + /* NV Item */
> + u32 table_id;
> +
> + /* Size of NV Blob */
> + u32 nv_blob_size;
> +
> + /* Following the 'nvBlobSize', there should be nvBlobSize bytes of
> + * NV blob i.e. u8[nvBlobSize] */
> +};
> +
> +/* End of Block Ack Related Parameters */
> +
> +#define WCN36XX_HAL_CIPHER_SEQ_CTR_SIZE 6
> +
> +/* Definition for MIC failure indication MAC reports this each time a MIC
> + * failure occures on Rx TKIP packet
> + */
> +struct mic_failure_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bssid[ETH_ALEN];
> +
> + /* address used to compute MIC */
> + u8 src_addr[ETH_ALEN];
> +
> + /* transmitter address */
> + u8 ta_addr[ETH_ALEN];
> +
> + u8 dst_addr[ETH_ALEN];
> +
> + u8 multicast;
> +
> + /* first byte of IV */
> + u8 iv1;
> +
> + /* second byte of IV */
> + u8 key_id;
> +
> + /* sequence number */
> + u8 tsc[WCN36XX_HAL_CIPHER_SEQ_CTR_SIZE];
> +
> + /* receive address */
> + u8 rx_addr[ETH_ALEN];
> +};
> +
> +struct update_vht_op_mode_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u16 op_mode;
> + u16 sta_id;
> +};
> +
> +struct update_vht_op_mode_params_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 status;
> +};
> +
> +struct update_beacon_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bss_index;
> +
> + /* shortPreamble mode. HAL should update all the STA rates when it
> + * receives this message */
> + u8 short_preamble;
> +
> + /* short Slot time. */
> + u8 short_slot_time;
> +
> + /* Beacon Interval */
> + u16 beacon_interval;
> +
> + /* Protection related */
> + u8 lla_coexist;
> + u8 llb_coexist;
> + u8 llg_coexist;
> + u8 ht20_coexist;
> + u8 lln_non_gf_coexist;
> + u8 lsig_tx_op_protection_full_support;
> + u8 rifs_mode;
> +
> + u16 param_change_bitmap;
> +};
> +
> +struct update_beacon_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_send_beacon_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* length of the template. */
> + u32 beacon_length;
> +
> + /* Beacon data. */
> + u8 beacon[BEACON_TEMPLATE_SIZE];
> +
> + u8 bssid[ETH_ALEN];
> +
> + /* TIM IE offset from the beginning of the template. */
> + u32 tim_ie_offset;
> +
> + /* P2P IE offset from the begining of the template */
> + u16 p2p_ie_offset;
> +} __packed;
> +
> +struct send_beacon_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + u32 status;
> +} __packed;
> +
> +struct enable_radar_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bssid[ETH_ALEN];
> + u8 channel;
> +};
> +
> +struct enable_radar_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Link Parameters */
> + u8 bssid[ETH_ALEN];
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct radar_detect_intr_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 radar_det_channel;
> +};
> +
> +struct radar_detect_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* channel number in which the RADAR detected */
> + u8 channel_number;
> +
> + /* RADAR pulse width in usecond */
> + u16 radar_pulse_width;
> +
> + /* Number of RADAR pulses */
> + u16 num_radar_pulse;
> +};
> +
> +struct wcn36xx_hal_get_tpc_report_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 sta[ETH_ALEN];
> + u8 dialog_token;
> + u8 txpower;
> +};
> +
> +struct wcn36xx_hal_get_tpc_report_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_send_probe_resp_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 probe_resp_template[BEACON_TEMPLATE_SIZE];
> + u32 probe_resp_template_len;
> + u32 proxy_probe_req_valid_ie_bmap[8];
> + u8 bssid[ETH_ALEN];
> +};
> +
> +struct send_probe_resp_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct send_unknown_frame_rx_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_delete_sta_context_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u16 aid;
> + u16 sta_id;
> +
> + /* TO SUPPORT BT-AMP */
> + u8 bssid[ETH_ALEN];
> +
> + /* HAL copies bssid from the sta table. */
> + u8 addr2[ETH_ALEN];
> +
> + /* To unify the keepalive / unknown A2 / tim-based disa */
> + u16 reason_code;
> +} __packed;
> +
> +struct indicate_del_sta {
> + struct wcn36xx_hal_msg_header header;
> + u8 aid;
> + u8 sta_index;
> + u8 bss_index;
> + u8 reason_code;
> + u32 status;
> +};
> +
> +struct bt_amp_event_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + enum bt_amp_event_type btAmpEventType;
> +};
> +
> +struct bt_amp_event_rsp {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct tl_hal_flush_ac_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index. originates from HAL */
> + u8 sta_id;
> +
> + /* TID for which the transmit queue is being flushed */
> + u8 tid;
> +};
> +
> +struct tl_hal_flush_ac_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index. originates from HAL */
> + u8 sta_id;
> +
> + /* TID for which the transmit queue is being flushed */
> + u8 tid;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_enter_imps_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +};
> +
> +struct wcn36xx_hal_exit_imps_req {
> + struct wcn36xx_hal_msg_header header;
> +};
> +
> +struct wcn36xx_hal_enter_bmps_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bss_index;
> +
> + /* TBTT value derived from the last beacon */
> +#ifndef BUILD_QWPTTSTATIC
> + u64 tbtt;
> +#endif
> + u8 dtim_count;
> +
> + /* DTIM period given to HAL during association may not be valid, if
> + * association is based on ProbeRsp instead of beacon. */
> + u8 dtim_period;
> +
> + /* For CCX and 11R Roaming */
> + u32 rssi_filter_period;
> +
> + u32 num_beacon_per_rssi_average;
> + u8 rssi_filter_enable;
> +} __packed;
> +
> +struct wcn36xx_hal_exit_bmps_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 send_data_null;
> + u8 bss_index;
> +} __packed;
> +
> +struct wcn36xx_hal_missed_beacon_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bss_index;
> +} __packed;
> +
> +/* Beacon Filtering data structures */
> +
> +/* The above structure would be followed by multiple of below mentioned
> + * structure
> + */
> +struct beacon_filter_ie {
> + u8 element_id;
> + u8 check_ie_presence;
> + u8 offset;
> + u8 value;
> + u8 bitmask;
> + u8 ref;
> +};
> +
> +struct wcn36xx_hal_add_bcn_filter_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u16 capability_info;
> + u16 capability_mask;
> + u16 beacon_interval;
> + u16 ie_num;
> + u8 bss_index;
> + u8 reserved;
> +};
> +
> +struct wcn36xx_hal_rem_bcn_filter_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 ie_Count;
> + u8 rem_ie_id[1];
> +};
> +
> +#define WCN36XX_HAL_IPV4_ARP_REPLY_OFFLOAD 0
> +#define WCN36XX_HAL_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD 1
> +#define WCN36XX_HAL_IPV6_NS_OFFLOAD 2
> +#define WCN36XX_HAL_IPV6_ADDR_LEN 16
> +#define WCN36XX_HAL_OFFLOAD_DISABLE 0
> +#define WCN36XX_HAL_OFFLOAD_ENABLE 1
> +#define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2
> +#define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \
> + (HAL_OFFLOAD_ENABLE|HAL_OFFLOAD_BCAST_FILTER_ENABLE)
> +
> +struct wcn36xx_hal_ns_offload_params {
> + u8 src_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
> + u8 self_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
> +
> + /* Only support 2 possible Network Advertisement IPv6 address */
> + u8 target_ipv6_addr1[WCN36XX_HAL_IPV6_ADDR_LEN];
> + u8 target_ipv6_addr2[WCN36XX_HAL_IPV6_ADDR_LEN];
> +
> + u8 self_addr[ETH_ALEN];
> + u8 src_ipv6_addr_valid:1;
> + u8 target_ipv6_addr1_valid:1;
> + u8 target_ipv6_addr2_valid:1;
> + u8 reserved1:5;
> +
> + /* make it DWORD aligned */
> + u8 reserved2;
> +
> + /* slot index for this offload */
> + u32 slot_index;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_host_offload_req {
> + u8 offload_Type;
> +
> + /* enable or disable */
> + u8 enable;
> +
> + union {
> + u8 host_ipv4_addr[4];
> + u8 host_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
> + } u;
> +};
> +
> +struct wcn36xx_hal_host_offload_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_host_offload_req host_offload_params;
> + struct wcn36xx_hal_ns_offload_params ns_offload_params;
> +};
> +
> +/* Packet Types. */
> +#define WCN36XX_HAL_KEEP_ALIVE_NULL_PKT 1
> +#define WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
> +
> +/* Enable or disable keep alive */
> +#define WCN36XX_HAL_KEEP_ALIVE_DISABLE 0
> +#define WCN36XX_HAL_KEEP_ALIVE_ENABLE 1
> +#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 30 /* unit: s */
> +
> +/* Keep Alive request. */
> +struct wcn36xx_hal_keep_alive_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 packet_type;
> + u32 time_period;
> + u8 host_ipv4_addr[WCN36XX_HAL_IPV4_ADDR_LEN];
> + u8 dest_ipv4_addr[WCN36XX_HAL_IPV4_ADDR_LEN];
> + u8 dest_addr[ETH_ALEN];
> + u8 bss_index;
> +} __packed;
> +
> +struct wcn36xx_hal_rssi_threshold_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + s8 threshold1:8;
> + s8 threshold2:8;
> + s8 threshold3:8;
> + u8 thres1_pos_notify:1;
> + u8 thres1_neg_notify:1;
> + u8 thres2_pos_notify:1;
> + u8 thres2_neg_notify:1;
> + u8 thres3_pos_notify:1;
> + u8 thres3_neg_notify:1;
> + u8 reserved10:2;
> +};
> +
> +struct wcn36xx_hal_enter_uapsd_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bk_delivery:1;
> + u8 be_delivery:1;
> + u8 vi_delivery:1;
> + u8 vo_delivery:1;
> + u8 bk_trigger:1;
> + u8 be_trigger:1;
> + u8 vi_trigger:1;
> + u8 vo_trigger:1;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_exit_uapsd_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + u8 bss_index;
> +};
> +
> +#define WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE 128
> +#define WCN36XX_HAL_WOWL_BCAST_MAX_NUM_PATTERNS 16
> +
> +struct wcn36xx_hal_wowl_add_bcast_ptrn_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Pattern ID */
> + u8 id;
> +
> + /* Pattern byte offset from beginning of the 802.11 packet to start
> + * of the wake-up pattern */
> + u8 byte_Offset;
> +
> + /* Non-Zero Pattern size */
> + u8 size;
> +
> + /* Pattern */
> + u8 pattern[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
> +
> + /* Non-zero pattern mask size */
> + u8 mask_size;
> +
> + /* Pattern mask */
> + u8 mask[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
> +
> + /* Extra pattern */
> + u8 extra[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
> +
> + /* Extra pattern mask */
> + u8 mask_extra[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_wow_del_bcast_ptrn_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Pattern ID of the wakeup pattern to be deleted */
> + u8 id;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_wowl_enter_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Enables/disables magic packet filtering */
> + u8 magic_packet_enable;
> +
> + /* Magic pattern */
> + u8 magic_pattern[ETH_ALEN];
> +
> + /* Enables/disables packet pattern filtering in firmware. Enabling
> + * this flag enables broadcast pattern matching in Firmware. If
> + * unicast pattern matching is also desired,
> + * ucUcastPatternFilteringEnable flag must be set tot true as well
> + */
> + u8 pattern_filtering_enable;
> +
> + /* Enables/disables unicast packet pattern filtering. This flag
> + * specifies whether we want to do pattern match on unicast packets
> + * as well and not just broadcast packets. This flag has no effect
> + * if the ucPatternFilteringEnable (main controlling flag) is set
> + * to false
> + */
> + u8 ucast_pattern_filtering_enable;
> +
> + /* This configuration is valid only when magicPktEnable=1. It
> + * requests hardware to wake up when it receives the Channel Switch
> + * Action Frame.
> + */
> + u8 wow_channel_switch_receive;
> +
> + /* This configuration is valid only when magicPktEnable=1. It
> + * requests hardware to wake up when it receives the
> + * Deauthentication Frame.
> + */
> + u8 wow_deauth_receive;
> +
> + /* This configuration is valid only when magicPktEnable=1. It
> + * requests hardware to wake up when it receives the Disassociation
> + * Frame.
> + */
> + u8 wow_disassoc_receive;
> +
> + /* This configuration is valid only when magicPktEnable=1. It
> + * requests hardware to wake up when it has missed consecutive
> + * beacons. This is a hardware register configuration (NOT a
> + * firmware configuration).
> + */
> + u8 wow_max_missed_beacons;
> +
> + /* This configuration is valid only when magicPktEnable=1. This is
> + * a timeout value in units of microsec. It requests hardware to
> + * unconditionally wake up after it has stayed in WoWLAN mode for
> + * some time. Set 0 to disable this feature.
> + */
> + u8 wow_max_sleep;
> +
> + /* This configuration directs the WoW packet filtering to look for
> + * EAP-ID requests embedded in EAPOL frames and use this as a wake
> + * source.
> + */
> + u8 wow_eap_id_request_enable;
> +
> + /* This configuration directs the WoW packet filtering to look for
> + * EAPOL-4WAY requests and use this as a wake source.
> + */
> + u8 wow_eapol_4way_enable;
> +
> + /* This configuration allows a host wakeup on an network scan
> + * offload match.
> + */
> + u8 wow_net_scan_offload_match;
> +
> + /* This configuration allows a host wakeup on any GTK rekeying
> + * error.
> + */
> + u8 wow_gtk_rekey_error;
> +
> + /* This configuration allows a host wakeup on BSS connection loss.
> + */
> + u8 wow_bss_connection_loss;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_wowl_exit_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_get_rssi_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +};
> +
> +struct wcn36xx_hal_get_roam_rssi_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Valid STA Idx for per STA stats request */
> + u32 sta_id;
> +};
> +
> +struct wcn36xx_hal_set_uapsd_ac_params_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* STA index */
> + u8 sta_idx;
> +
> + /* Access Category */
> + u8 ac;
> +
> + /* User Priority */
> + u8 up;
> +
> + /* Service Interval */
> + u32 service_interval;
> +
> + /* Suspend Interval */
> + u32 suspend_interval;
> +
> + /* Delay Interval */
> + u32 delay_interval;
> +};
> +
> +struct wcn36xx_hal_configure_rxp_filter_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 set_mcst_bcst_filter_setting;
> + u8 set_mcst_bcst_filter;
> +};
> +
> +struct wcn36xx_hal_enter_imps_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_exit_imps_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_enter_bmps_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +} __packed;
> +
> +struct wcn36xx_hal_exit_bmps_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +} __packed;
> +
> +struct wcn36xx_hal_enter_uapsd_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_exit_uapsd_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_rssi_notification_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 rssi_thres1_pos_cross:1;
> + u32 rssi_thres1_neg_cross:1;
> + u32 rssi_thres2_pos_cross:1;
> + u32 rssi_thres2_neg_cross:1;
> + u32 rssi_thres3_pos_cross:1;
> + u32 rssi_thres3_neg_cross:1;
> + u32 avg_rssi:8;
> + u32 reserved:18;
> +
> +};
> +
> +struct wcn36xx_hal_get_rssio_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> + s8 rssi;
> +
> +};
> +
> +struct wcn36xx_hal_get_roam_rssi_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 sta_id;
> + s8 rssi;
> +};
> +
> +struct wcn36xx_hal_wowl_enter_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_wowl_exit_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_add_bcn_filter_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_rem_bcn_filter_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_add_wowl_bcast_ptrn_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_del_wowl_bcast_ptrn_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_host_offload_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_keep_alive_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_set_rssi_thresh_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_set_uapsd_ac_params_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_configure_rxp_filter_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct set_max_tx_pwr_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* BSSID is needed to identify which session issued this request.
> + * As the request has power constraints, this should be applied
> + * only to that session */
> + u8 bssid[ETH_ALEN];
> +
> + u8 self_addr[ETH_ALEN];
> +
> + /* In request, power == MaxTx power to be used. */
> + u8 power;
> +};
> +
> +struct set_max_tx_pwr_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* power == tx power used for management frames */
> + u8 power;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct set_tx_pwr_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* TX Power in milli watts */
> + u32 tx_power;
> +
> + u8 bss_index;
> +};
> +
> +struct set_tx_pwr_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct get_tx_pwr_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 sta_id;
> +};
> +
> +struct get_tx_pwr_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* TX Power in milli watts */
> + u32 tx_power;
> +};
> +
> +struct set_p2p_gonoa_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 opp_ps;
> + u32 ct_window;
> + u8 count;
> + u32 duration;
> + u32 interval;
> + u32 single_noa_duration;
> + u8 ps_selection;
> +};
> +
> +struct set_p2p_gonoa_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_add_sta_self_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 self_addr[ETH_ALEN];
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_add_sta_self_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* Self STA Index */
> + u8 self_sta_index;
> +
> + /* DPU Index (IGTK, PTK, GTK all same) */
> + u8 dpu_index;
> +
> + /* DPU Signature */
> + u8 dpu_signature;
> +} __packed;
> +
> +struct wcn36xx_hal_del_sta_self_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 self_addr[ETH_ALEN];
> +} __packed;
> +
> +struct wcn36xx_hal_del_sta_self_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /*success or failure */
> + u32 status;
> +
> + u8 self_addr[ETH_ALEN];
> +} __packed;
> +
> +struct aggr_add_ts_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Station Index */
> + u16 sta_idx;
> +
> + /* TSPEC handler uniquely identifying a TSPEC for a STA in a BSS.
> + * This will carry the bitmap with the bit positions representing
> + * different AC.s */
> + u16 tspec_index;
> +
> + /* Tspec info per AC To program TPE with required parameters */
> + struct wcn36xx_hal_tspec_ie tspec[WCN36XX_HAL_MAX_AC];
> +
> + /* U-APSD Flags: 1b per AC. Encoded as follows:
> + b7 b6 b5 b4 b3 b2 b1 b0 =
> + X X X X BE BK VI VO */
> + u8 uapsd;
> +
> + /* These parameters are for all the access categories */
> +
> + /* Service Interval */
> + u32 service_interval[WCN36XX_HAL_MAX_AC];
> +
> + /* Suspend Interval */
> + u32 suspend_interval[WCN36XX_HAL_MAX_AC];
> +
> + /* Delay Interval */
> + u32 delay_interval[WCN36XX_HAL_MAX_AC];
> +};
> +
> +struct aggr_add_ts_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status0;
> +
> + /* FIXME PRIMA for future use for 11R */
> + u32 status1;
> +};
> +
> +struct wcn36xx_hal_configure_apps_cpu_wakeup_state_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 is_apps_cpu_awake;
> +};
> +
> +struct wcn36xx_hal_configure_apps_cpu_wakeup_state_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_dump_cmd_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 arg1;
> + u32 arg2;
> + u32 arg3;
> + u32 arg4;
> + u32 arg5;
> +} __packed;
> +
> +struct wcn36xx_hal_dump_cmd_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* Length of the responce message */
> + u32 rsp_length;
> +
> + /* FIXME: Currently considering the the responce will be less than
> + * 100bytes */
> + u8 rsp_buffer[DUMPCMD_RSP_BUFFER];
> +} __packed;
> +
> +#define WLAN_COEX_IND_DATA_SIZE (4)
> +#define WLAN_COEX_IND_TYPE_DISABLE_HB_MONITOR (0)
> +#define WLAN_COEX_IND_TYPE_ENABLE_HB_MONITOR (1)
> +
> +struct coex_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Coex Indication Type */
> + u32 type;
> +
> + /* Coex Indication Data */
> + u32 data[WLAN_COEX_IND_DATA_SIZE];
> +};
> +
> +struct wcn36xx_hal_tx_compl_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Tx Complete Indication Success or Failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_wlan_host_suspend_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 configured_mcst_bcst_filter_setting;
> + u32 active_session_count;
> +};
> +
> +struct wcn36xx_hal_wlan_exclude_unencrpted_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 dot11_exclude_unencrypted;
> + u8 bssid[ETH_ALEN];
> +};
> +
> +struct noa_attr_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 index;
> + u8 opp_ps_flag;
> + u16 ctwin;
> +
> + u16 noa1_interval_count;
> + u16 bss_index;
> + u32 noa1_duration;
> + u32 noa1_interval;
> + u32 noa1_starttime;
> +
> + u16 noa2_interval_count;
> + u16 reserved2;
> + u32 noa2_duration;
> + u32 noa2_interval;
> + u32 noa2_start_time;
> +
> + u32 status;
> +};
> +
> +struct noa_start_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 status;
> + u32 bss_index;
> +};
> +
> +struct wcn36xx_hal_wlan_host_resume_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 configured_mcst_bcst_filter_setting;
> +};
> +
> +struct wcn36xx_hal_host_resume_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +struct wcn36xx_hal_del_ba_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u16 sta_idx;
> +
> + /* Peer MAC Address, whose BA session has timed out */
> + u8 peer_addr[ETH_ALEN];
> +
> + /* TID for which a BA session timeout is being triggered */
> + u8 ba_tid;
> +
> + /* DELBA direction
> + * 1 - Originator
> + * 0 - Recipient
> + */
> + u8 direction;
> +
> + u32 reason_code;
> +
> + /* TO SUPPORT BT-AMP */
> + u8 bssid[ETH_ALEN];
> +};
> +
> +/* PNO Messages */
> +
> +/* Max number of channels that a network can be found on */
> +#define WCN36XX_HAL_PNO_MAX_NETW_CHANNELS 26
> +
> +/* Max number of channels that a network can be found on */
> +#define WCN36XX_HAL_PNO_MAX_NETW_CHANNELS_EX 60
> +
> +/* Maximum numbers of networks supported by PNO */
> +#define WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS 16
> +
> +/* The number of scan time intervals that can be programmed into PNO */
> +#define WCN36XX_HAL_PNO_MAX_SCAN_TIMERS 10
> +
> +/* Maximum size of the probe template */
> +#define WCN36XX_HAL_PNO_MAX_PROBE_SIZE 450
> +
> +/* Type of PNO enabling:
> + *
> + * Immediate - scanning will start immediately and PNO procedure will be
> + * repeated based on timer
> + *
> + * Suspend - scanning will start at suspend
> + *
> + * Resume - scanning will start on system resume
> + */
> +enum pno_mode {
> + PNO_MODE_IMMEDIATE,
> + PNO_MODE_ON_SUSPEND,
> + PNO_MODE_ON_RESUME,
> + PNO_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* Authentication type */
> +enum auth_type {
> + AUTH_TYPE_ANY = 0,
> + AUTH_TYPE_OPEN_SYSTEM = 1,
> +
> + /* Upper layer authentication types */
> + AUTH_TYPE_WPA = 2,
> + AUTH_TYPE_WPA_PSK = 3,
> +
> + AUTH_TYPE_RSN = 4,
> + AUTH_TYPE_RSN_PSK = 5,
> + AUTH_TYPE_FT_RSN = 6,
> + AUTH_TYPE_FT_RSN_PSK = 7,
> + AUTH_TYPE_WAPI_WAI_CERTIFICATE = 8,
> + AUTH_TYPE_WAPI_WAI_PSK = 9,
> +
> + AUTH_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* Encryption type */
> +enum ed_type {
> + ED_ANY = 0,
> + ED_NONE = 1,
> + ED_WEP = 2,
> + ED_TKIP = 3,
> + ED_CCMP = 4,
> + ED_WPI = 5,
> +
> + ED_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* SSID broadcast type */
> +enum ssid_bcast_type {
> + BCAST_UNKNOWN = 0,
> + BCAST_NORMAL = 1,
> + BCAST_HIDDEN = 2,
> +
> + BCAST_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
> +};
> +
> +/* The network description for which PNO will have to look for */
> +struct network_type {
> + /* SSID of the BSS */
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* Authentication type for the network */
> + enum auth_type authentication;
> +
> + /* Encryption type for the network */
> + enum ed_type encryption;
> +
> + /* Indicate the channel on which the Network can be found 0 - if
> + * all channels */
> + u8 channel_count;
> + u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
> +
> + /* Indicates the RSSI threshold for the network to be considered */
> + u8 rssi_threshold;
> +};
> +
> +struct scan_timer {
> + /* How much it should wait */
> + u32 value;
> +
> + /* How many times it should repeat that wait value 0 - keep using
> + * this timer until PNO is disabled */
> + u32 repeat;
> +
> + /* e.g: 2 3 4 0 - it will wait 2s between consecutive scans for 3
> + * times - after that it will wait 4s between consecutive scans
> + * until disabled */
> +};
> +
> +/* The network parameters to be sent to the PNO algorithm */
> +struct scan_timers_type {
> + /* set to 0 if you wish for PNO to use its default telescopic timer */
> + u8 count;
> +
> + /* A set value represents the amount of time that PNO will wait
> + * between two consecutive scan procedures If the desired is for a
> + * uniform timer that fires always at the exact same interval - one
> + * single value is to be set If there is a desire for a more
> + * complex - telescopic like timer multiple values can be set -
> + * once PNO reaches the end of the array it will continue scanning
> + * at intervals presented by the last value */
> + struct scan_timer values[WCN36XX_HAL_PNO_MAX_SCAN_TIMERS];
> +};
> +
> +/* Preferred network list request */
> +struct set_pref_netw_list_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Enable PNO */
> + u32 enable;
> +
> + /* Immediate, On Suspend, On Resume */
> + enum pno_mode mode;
> +
> + /* Number of networks sent for PNO */
> + u32 networks_count;
> +
> + /* The networks that PNO needs to look for */
> + struct network_type networks[WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS];
> +
> + /* The scan timers required for PNO */
> + struct scan_timers_type scan_timers;
> +
> + /* Probe template for 2.4GHz band */
> + u16 band_24g_probe_size;
> + u8 band_24g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
> +
> + /* Probe template for 5GHz band */
> + u16 band_5g_probe_size;
> + u8 band_5g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
> +};
> +
> +/* The network description for which PNO will have to look for */
> +struct network_type_new {
> + /* SSID of the BSS */
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* Authentication type for the network */
> + enum auth_type authentication;
> +
> + /* Encryption type for the network */
> + enum ed_type encryption;
> +
> + /* SSID broadcast type, normal, hidden or unknown */
> + enum ssid_bcast_type bcast_network_type;
> +
> + /* Indicate the channel on which the Network can be found 0 - if
> + * all channels */
> + u8 channel_count;
> + u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
> +
> + /* Indicates the RSSI threshold for the network to be considered */
> + u8 rssi_threshold;
> +};
> +
> +/* Preferred network list request new */
> +struct set_pref_netw_list_req_new {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Enable PNO */
> + u32 enable;
> +
> + /* Immediate, On Suspend, On Resume */
> + enum pno_mode mode;
> +
> + /* Number of networks sent for PNO */
> + u32 networks_count;
> +
> + /* The networks that PNO needs to look for */
> + struct network_type_new networks[WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS];
> +
> + /* The scan timers required for PNO */
> + struct scan_timers_type scan_timers;
> +
> + /* Probe template for 2.4GHz band */
> + u16 band_24g_probe_size;
> + u8 band_24g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
> +
> + /* Probe template for 5GHz band */
> + u16 band_5g_probe_size;
> + u8 band_5g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
> +};
> +
> +/* Preferred network list response */
> +struct set_pref_netw_list_resp {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* status of the request - just to indicate that PNO has
> + * acknowledged the request and will start scanning */
> + u32 status;
> +};
> +
> +/* Preferred network found indication */
> +struct pref_netw_found_ind {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Network that was found with the highest RSSI */
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* Indicates the RSSI */
> + u8 rssi;
> +};
> +
> +/* RSSI Filter request */
> +struct set_rssi_filter_req {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* RSSI Threshold */
> + u8 rssi_threshold;
> +};
> +
> +/* Set RSSI filter resp */
> +struct set_rssi_filter_resp {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* status of the request */
> + u32 status;
> +};
> +
> +/* Update scan params - sent from host to PNO to be used during PNO
> + * scanningx */
> +struct wcn36xx_hal_update_scan_params_req {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Host setting for 11d */
> + u8 dot11d_enabled;
> +
> + /* Lets PNO know that host has determined the regulatory domain */
> + u8 dot11d_resolved;
> +
> + /* Channels on which PNO is allowed to scan */
> + u8 channel_count;
> + u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
> +
> + /* Minimum channel time */
> + u16 active_min_ch_time;
> +
> + /* Maximum channel time */
> + u16 active_max_ch_time;
> +
> + /* Minimum channel time */
> + u16 passive_min_ch_time;
> +
> + /* Maximum channel time */
> + u16 passive_max_ch_time;
> +
> + /* Cb State */
> + enum phy_chan_bond_state state;
> +} __packed;
> +
> +/* Update scan params - sent from host to PNO to be used during PNO
> + * scanningx */
> +struct update_scan_params_req_ex {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Host setting for 11d */
> + u8 dot11d_enabled;
> +
> + /* Lets PNO know that host has determined the regulatory domain */
> + u8 dot11d_resolved;
> +
> + /* Channels on which PNO is allowed to scan */
> + u8 channel_count;
> + u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS_EX];
> +
> + /* Minimum channel time */
> + u16 active_min_ch_time;
> +
> + /* Maximum channel time */
> + u16 active_max_ch_time;
> +
> + /* Minimum channel time */
> + u16 passive_min_ch_time;
> +
> + /* Maximum channel time */
> + u16 passive_max_ch_time;
> +
> + /* Cb State */
> + enum phy_chan_bond_state state;
> +};
> +
> +/* Update scan params - sent from host to PNO to be used during PNO
> + * scanningx */
> +struct wcn36xx_hal_update_scan_params_resp {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* status of the request */
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_set_tx_per_tracking_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* 0: disable, 1:enable */
> + u8 tx_per_tracking_enable;
> +
> + /* Check period, unit is sec. */
> + u8 tx_per_tracking_period;
> +
> + /* (Fail TX packet)/(Total TX packet) ratio, the unit is 10%. */
> + u8 tx_per_tracking_ratio;
> +
> + /* A watermark of check number, once the tx packet exceed this
> + * number, we do the check, default is 5 */
> + u32 tx_per_tracking_watermark;
> +};
> +
> +struct wcn36xx_hal_set_tx_per_tracking_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> +};
> +
> +struct tx_per_hit_ind_msg {
> + struct wcn36xx_hal_msg_header header;
> +};
> +
> +/* Packet Filtering Definitions Begin */
> +#define WCN36XX_HAL_PROTOCOL_DATA_LEN 8
> +#define WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS 240
> +#define WCN36XX_HAL_MAX_NUM_FILTERS 20
> +#define WCN36XX_HAL_MAX_CMP_PER_FILTER 10
> +
> +enum wcn36xx_hal_receive_packet_filter_type {
> + HAL_RCV_FILTER_TYPE_INVALID,
> + HAL_RCV_FILTER_TYPE_FILTER_PKT,
> + HAL_RCV_FILTER_TYPE_BUFFER_PKT,
> + HAL_RCV_FILTER_TYPE_MAX_ENUM_SIZE
> +};
> +
> +enum wcn36xx_hal_rcv_pkt_flt_protocol_type {
> + HAL_FILTER_PROTO_TYPE_INVALID,
> + HAL_FILTER_PROTO_TYPE_MAC,
> + HAL_FILTER_PROTO_TYPE_ARP,
> + HAL_FILTER_PROTO_TYPE_IPV4,
> + HAL_FILTER_PROTO_TYPE_IPV6,
> + HAL_FILTER_PROTO_TYPE_UDP,
> + HAL_FILTER_PROTO_TYPE_MAX
> +};
> +
> +enum wcn36xx_hal_rcv_pkt_flt_cmp_flag_type {
> + HAL_FILTER_CMP_TYPE_INVALID,
> + HAL_FILTER_CMP_TYPE_EQUAL,
> + HAL_FILTER_CMP_TYPE_MASK_EQUAL,
> + HAL_FILTER_CMP_TYPE_NOT_EQUAL,
> + HAL_FILTER_CMP_TYPE_MAX
> +};
> +
> +struct wcn36xx_hal_rcv_pkt_filter_params {
> + u8 protocol_layer;
> + u8 cmp_flag;
> +
> + /* Length of the data to compare */
> + u16 data_length;
> +
> + /* from start of the respective frame header */
> + u8 data_offset;
> +
> + /* Reserved field */
> + u8 reserved;
> +
> + /* Data to compare */
> + u8 compare_data[WCN36XX_HAL_PROTOCOL_DATA_LEN];
> +
> + /* Mask to be applied on the received packet data before compare */
> + u8 data_mask[WCN36XX_HAL_PROTOCOL_DATA_LEN];
> +};
> +
> +struct wcn36xx_hal_sessionized_rcv_pkt_filter_cfg_type {
> + u8 id;
> + u8 type;
> + u8 params_count;
> + u32 coleasce_time;
> + u8 bss_index;
> + struct wcn36xx_hal_rcv_pkt_filter_params params[1];
> +};
> +
> +struct wcn36xx_hal_set_rcv_pkt_filter_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 id;
> + u8 type;
> + u8 params_count;
> + u32 coalesce_time;
> + struct wcn36xx_hal_rcv_pkt_filter_params params[1];
> +};
> +
> +struct wcn36xx_hal_rcv_flt_mc_addr_list_type {
> + /* from start of the respective frame header */
> + u8 data_offset;
> +
> + u32 mc_addr_count;
> + u8 mc_addr[ETH_ALEN][WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS];
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_set_pkt_filter_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_match_cnt_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_match_cnt {
> + u8 id;
> + u32 match_cnt;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_match_cnt_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Success or Failure */
> + u32 status;
> +
> + u32 match_count;
> + struct wcn36xx_hal_rcv_flt_pkt_match_cnt
> + matches[WCN36XX_HAL_MAX_NUM_FILTERS];
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_clear_param {
> + /* only valid for response message */
> + u32 status;
> + u8 id;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_clear_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_rcv_flt_pkt_clear_param param;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_clear_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_rcv_flt_pkt_clear_param param;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + struct wcn36xx_hal_rcv_flt_mc_addr_list_type mc_addr_list;
> +};
> +
> +struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> + u32 status;
> + u8 bss_index;
> +};
> +
> +/* Packet Filtering Definitions End */
> +
> +struct wcn36xx_hal_set_power_params_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Ignore DTIM */
> + u32 ignore_dtim;
> +
> + /* DTIM Period */
> + u32 dtim_period;
> +
> + /* Listen Interval */
> + u32 listen_interval;
> +
> + /* Broadcast Multicast Filter */
> + u32 bcast_mcast_filter;
> +
> + /* Beacon Early Termination */
> + u32 enable_bet;
> +
> + /* Beacon Early Termination Interval */
> + u32 bet_interval;
> +} __packed;
> +
> +struct wcn36xx_hal_set_power_params_resp {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* status of the request */
> + u32 status;
> +} __packed;
> +
> +/* Capability bitmap exchange definitions and macros starts */
> +
> +enum place_holder_in_cap_bitmap {
> + MCC = 0,
> + P2P = 1,
> + DOT11AC = 2,
> + SLM_SESSIONIZATION = 3,
> + DOT11AC_OPMODE = 4,
> + SAP32STA = 5,
> + TDLS = 6,
> + P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7,
> + WLANACTIVE_OFFLOAD = 8,
> + BEACON_OFFLOAD = 9,
> + SCAN_OFFLOAD = 10,
> + ROAM_OFFLOAD = 11,
> + BCN_MISS_OFFLOAD = 12,
> + STA_POWERSAVE = 13,
> + STA_ADVANCED_PWRSAVE = 14,
> + AP_UAPSD = 15,
> + AP_DFS = 16,
> + BLOCKACK = 17,
> + PHY_ERR = 18,
> + BCN_FILTER = 19,
> + RTT = 20,
> + RATECTRL = 21,
> + WOW = 22,
> + MAX_FEATURE_SUPPORTED = 128,
> +};
> +
> +struct wcn36xx_hal_feat_caps_msg {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + u32 feat_caps[4];
> +} __packed;
> +
> +/* status codes to help debug rekey failures */
> +enum gtk_rekey_status {
> + WCN36XX_HAL_GTK_REKEY_STATUS_SUCCESS = 0,
> +
> + /* rekey detected, but not handled */
> + WCN36XX_HAL_GTK_REKEY_STATUS_NOT_HANDLED = 1,
> +
> + /* MIC check error on M1 */
> + WCN36XX_HAL_GTK_REKEY_STATUS_MIC_ERROR = 2,
> +
> + /* decryption error on M1 */
> + WCN36XX_HAL_GTK_REKEY_STATUS_DECRYPT_ERROR = 3,
> +
> + /* M1 replay detected */
> + WCN36XX_HAL_GTK_REKEY_STATUS_REPLAY_ERROR = 4,
> +
> + /* missing GTK key descriptor in M1 */
> + WCN36XX_HAL_GTK_REKEY_STATUS_MISSING_KDE = 5,
> +
> + /* missing iGTK key descriptor in M1 */
> + WCN36XX_HAL_GTK_REKEY_STATUS_MISSING_IGTK_KDE = 6,
> +
> + /* key installation error */
> + WCN36XX_HAL_GTK_REKEY_STATUS_INSTALL_ERROR = 7,
> +
> + /* iGTK key installation error */
> + WCN36XX_HAL_GTK_REKEY_STATUS_IGTK_INSTALL_ERROR = 8,
> +
> + /* GTK rekey M2 response TX error */
> + WCN36XX_HAL_GTK_REKEY_STATUS_RESP_TX_ERROR = 9,
> +
> + /* non-specific general error */
> + WCN36XX_HAL_GTK_REKEY_STATUS_GEN_ERROR = 255
> +};
> +
> +/* wake reason types */
> +enum wake_reason_type {
> + WCN36XX_HAL_WAKE_REASON_NONE = 0,
> +
> + /* magic packet match */
> + WCN36XX_HAL_WAKE_REASON_MAGIC_PACKET = 1,
> +
> + /* host defined pattern match */
> + WCN36XX_HAL_WAKE_REASON_PATTERN_MATCH = 2,
> +
> + /* EAP-ID frame detected */
> + WCN36XX_HAL_WAKE_REASON_EAPID_PACKET = 3,
> +
> + /* start of EAPOL 4-way handshake detected */
> + WCN36XX_HAL_WAKE_REASON_EAPOL4WAY_PACKET = 4,
> +
> + /* network scan offload match */
> + WCN36XX_HAL_WAKE_REASON_NETSCAN_OFFL_MATCH = 5,
> +
> + /* GTK rekey status wakeup (see status) */
> + WCN36XX_HAL_WAKE_REASON_GTK_REKEY_STATUS = 6,
> +
> + /* BSS connection lost */
> + WCN36XX_HAL_WAKE_REASON_BSS_CONN_LOST = 7,
> +};
> +
> +/*
> + Wake Packet which is saved at tWakeReasonParams.DataStart
> + This data is sent for any wake reasons that involve a packet-based wakeup :
> +
> + WCN36XX_HAL_WAKE_REASON_TYPE_MAGIC_PACKET
> + WCN36XX_HAL_WAKE_REASON_TYPE_PATTERN_MATCH
> + WCN36XX_HAL_WAKE_REASON_TYPE_EAPID_PACKET
> + WCN36XX_HAL_WAKE_REASON_TYPE_EAPOL4WAY_PACKET
> + WCN36XX_HAL_WAKE_REASON_TYPE_GTK_REKEY_STATUS
> +
> + The information is provided to the host for auditing and debug purposes
> +
> +*/
> +
> +/* Wake reason indication */
> +struct wcn36xx_hal_wake_reason_ind {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* see tWakeReasonType */
> + u32 reason;
> +
> + /* argument specific to the reason type */
> + u32 reason_arg;
> +
> + /* length of optional data stored in this message, in case HAL
> + * truncates the data (i.e. data packets) this length will be less
> + * than the actual length */
> + u32 stored_data_len;
> +
> + /* actual length of data */
> + u32 actual_data_len;
> +
> + /* variable length start of data (length == storedDataLen) see
> + * specific wake type */
> + u8 data_start[1];
> +
> + u32 bss_index:8;
> + u32 reserved:24;
> +};
> +
> +#define WCN36XX_HAL_GTK_KEK_BYTES 16
> +#define WCN36XX_HAL_GTK_KCK_BYTES 16
> +
> +#define WCN36XX_HAL_GTK_OFFLOAD_FLAGS_DISABLE (1 << 0)
> +
> +#define GTK_SET_BSS_KEY_TAG 0x1234AA55
> +
> +struct wcn36xx_hal_gtk_offload_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* optional flags */
> + u32 flags;
> +
> + /* Key confirmation key */
> + u8 kck[WCN36XX_HAL_GTK_KCK_BYTES];
> +
> + /* key encryption key */
> + u8 kek[WCN36XX_HAL_GTK_KEK_BYTES];
> +
> + /* replay counter */
> + u64 key_replay_counter;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_gtk_offload_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_gtk_offload_get_info_req_msg {
> + struct wcn36xx_hal_msg_header header;
> + u8 bss_index;
> +};
> +
> +struct wcn36xx_hal_gtk_offload_get_info_rsp_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +
> + /* last rekey status when the rekey was offloaded */
> + u32 last_rekey_status;
> +
> + /* current replay counter value */
> + u64 key_replay_counter;
> +
> + /* total rekey attempts */
> + u32 total_rekey_count;
> +
> + /* successful GTK rekeys */
> + u32 gtk_rekey_count;
> +
> + /* successful iGTK rekeys */
> + u32 igtk_rekey_count;
> +
> + u8 bss_index;
> +};
> +
> +struct dhcp_info {
> + /* Indicates the device mode which indicates about the DHCP activity */
> + u8 device_mode;
> +
> + u8 addr[ETH_ALEN];
> +};
> +
> +struct dhcp_ind_status {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* success or failure */
> + u32 status;
> +};
> +
> +/*
> + * Thermal Mitigation mode of operation.
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_MODE_0 - Based on AMPDU disabling aggregation
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_MODE_1 - Based on AMPDU disabling aggregation
> + * and reducing transmit power
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_MODE_2 - Not supported */
> +enum wcn36xx_hal_thermal_mitigation_mode_type {
> + HAL_THERMAL_MITIGATION_MODE_INVALID = -1,
> + HAL_THERMAL_MITIGATION_MODE_0,
> + HAL_THERMAL_MITIGATION_MODE_1,
> + HAL_THERMAL_MITIGATION_MODE_2,
> + HAL_THERMAL_MITIGATION_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
> +};
> +
> +
> +/*
> + * Thermal Mitigation level.
> + * Note the levels are incremental i.e WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_2 =
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_0 +
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_1
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_0 - lowest level of thermal mitigation.
> + * This level indicates normal mode of operation
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_1 - 1st level of thermal mitigation
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_2 - 2nd level of thermal mitigation
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_3 - 3rd level of thermal mitigation
> + *
> + * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_4 - 4th level of thermal mitigation
> + */
> +enum wcn36xx_hal_thermal_mitigation_level_type {
> + HAL_THERMAL_MITIGATION_LEVEL_INVALID = -1,
> + HAL_THERMAL_MITIGATION_LEVEL_0,
> + HAL_THERMAL_MITIGATION_LEVEL_1,
> + HAL_THERMAL_MITIGATION_LEVEL_2,
> + HAL_THERMAL_MITIGATION_LEVEL_3,
> + HAL_THERMAL_MITIGATION_LEVEL_4,
> + HAL_THERMAL_MITIGATION_LEVEL_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
> +};
> +
> +
> +/* WCN36XX_HAL_SET_THERMAL_MITIGATION_REQ */
> +struct set_thermal_mitigation_req_msg {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Thermal Mitigation Operation Mode */
> + enum wcn36xx_hal_thermal_mitigation_mode_type mode;
> +
> + /* Thermal Mitigation Level */
> + enum wcn36xx_hal_thermal_mitigation_level_type level;
> +};
> +
> +struct set_thermal_mitigation_resp {
> +
> + struct wcn36xx_hal_msg_header header;
> +
> + /* status of the request */
> + u32 status;
> +};
> +
> +/* Per STA Class B Statistics. Class B statistics are STA TX/RX stats
> + * provided to FW from Host via periodic messages */
> +struct stats_class_b_ind {
> + struct wcn36xx_hal_msg_header header;
> +
> + /* Duration over which this stats was collected */
> + u32 duration;
> +
> + /* Per STA Stats */
> +
> + /* TX stats */
> + u32 tx_bytes_pushed;
> + u32 tx_packets_pushed;
> +
> + /* RX stats */
> + u32 rx_bytes_rcvd;
> + u32 rx_packets_rcvd;
> + u32 rx_time_total;
> +};
> +
> +#endif /* _HAL_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> new file mode 100644
> index 0000000..7839b31
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -0,0 +1,1036 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include "wcn36xx.h"
> +
> +unsigned int wcn36xx_dbg_mask;
> +module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644);
> +MODULE_PARM_DESC(debug_mask, "Debugging mask");
> +
> +#define CHAN2G(_freq, _idx) { \
> + .band = IEEE80211_BAND_2GHZ, \
> + .center_freq = (_freq), \
> + .hw_value = (_idx), \
> + .max_power = 25, \
> +}
> +
> +#define CHAN5G(_freq, _idx) { \
> + .band = IEEE80211_BAND_5GHZ, \
> + .center_freq = (_freq), \
> + .hw_value = (_idx), \
> + .max_power = 25, \
> +}
> +
> +/* The wcn firmware expects channel values to matching
> + * their mnemonic values. So use these for .hw_value. */
> +static struct ieee80211_channel wcn_2ghz_channels[] = {
> + CHAN2G(2412, 1), /* Channel 1 */
> + CHAN2G(2417, 2), /* Channel 2 */
> + CHAN2G(2422, 3), /* Channel 3 */
> + CHAN2G(2427, 4), /* Channel 4 */
> + CHAN2G(2432, 5), /* Channel 5 */
> + CHAN2G(2437, 6), /* Channel 6 */
> + CHAN2G(2442, 7), /* Channel 7 */
> + CHAN2G(2447, 8), /* Channel 8 */
> + CHAN2G(2452, 9), /* Channel 9 */
> + CHAN2G(2457, 10), /* Channel 10 */
> + CHAN2G(2462, 11), /* Channel 11 */
> + CHAN2G(2467, 12), /* Channel 12 */
> + CHAN2G(2472, 13), /* Channel 13 */
> + CHAN2G(2484, 14) /* Channel 14 */
> +
> +};
> +
> +static struct ieee80211_channel wcn_5ghz_channels[] = {
> + CHAN5G(5180, 36),
> + CHAN5G(5200, 40),
> + CHAN5G(5220, 44),
> + CHAN5G(5240, 48),
> + CHAN5G(5260, 52),
> + CHAN5G(5280, 56),
> + CHAN5G(5300, 60),
> + CHAN5G(5320, 64),
> + CHAN5G(5500, 100),
> + CHAN5G(5520, 104),
> + CHAN5G(5540, 108),
> + CHAN5G(5560, 112),
> + CHAN5G(5580, 116),
> + CHAN5G(5600, 120),
> + CHAN5G(5620, 124),
> + CHAN5G(5640, 128),
> + CHAN5G(5660, 132),
> + CHAN5G(5700, 140),
> + CHAN5G(5745, 149),
> + CHAN5G(5765, 153),
> + CHAN5G(5785, 157),
> + CHAN5G(5805, 161),
> + CHAN5G(5825, 165)
> +};
> +
> +#define RATE(_bitrate, _hw_rate, _flags) { \
> + .bitrate = (_bitrate), \
> + .flags = (_flags), \
> + .hw_value = (_hw_rate), \
> + .hw_value_short = (_hw_rate) \
> +}
> +
> +static struct ieee80211_rate wcn_2ghz_rates[] = {
> + RATE(10, HW_RATE_INDEX_1MBPS, 0),
> + RATE(20, HW_RATE_INDEX_2MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
> + RATE(55, HW_RATE_INDEX_5_5MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
> + RATE(110, HW_RATE_INDEX_11MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
> + RATE(60, HW_RATE_INDEX_6MBPS, 0),
> + RATE(90, HW_RATE_INDEX_9MBPS, 0),
> + RATE(120, HW_RATE_INDEX_12MBPS, 0),
> + RATE(180, HW_RATE_INDEX_18MBPS, 0),
> + RATE(240, HW_RATE_INDEX_24MBPS, 0),
> + RATE(360, HW_RATE_INDEX_36MBPS, 0),
> + RATE(480, HW_RATE_INDEX_48MBPS, 0),
> + RATE(540, HW_RATE_INDEX_54MBPS, 0)
> +};
> +
> +static struct ieee80211_rate wcn_5ghz_rates[] = {
> + RATE(60, HW_RATE_INDEX_6MBPS, 0),
> + RATE(90, HW_RATE_INDEX_9MBPS, 0),
> + RATE(120, HW_RATE_INDEX_12MBPS, 0),
> + RATE(180, HW_RATE_INDEX_18MBPS, 0),
> + RATE(240, HW_RATE_INDEX_24MBPS, 0),
> + RATE(360, HW_RATE_INDEX_36MBPS, 0),
> + RATE(480, HW_RATE_INDEX_48MBPS, 0),
> + RATE(540, HW_RATE_INDEX_54MBPS, 0)
> +};
> +
> +static struct ieee80211_supported_band wcn_band_2ghz = {
> + .channels = wcn_2ghz_channels,
> + .n_channels = ARRAY_SIZE(wcn_2ghz_channels),
> + .bitrates = wcn_2ghz_rates,
> + .n_bitrates = ARRAY_SIZE(wcn_2ghz_rates),
> + .ht_cap = {
> + .cap = IEEE80211_HT_CAP_GRN_FLD |
> + IEEE80211_HT_CAP_SGI_20 |
> + IEEE80211_HT_CAP_DSSSCCK40 |
> + IEEE80211_HT_CAP_LSIG_TXOP_PROT,
> + .ht_supported = true,
> + .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
> + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
> + .mcs = {
> + .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
> + .rx_highest = cpu_to_le16(72),
> + .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
> + }
> + }
> +};
> +
> +static struct ieee80211_supported_band wcn_band_5ghz = {
> + .channels = wcn_5ghz_channels,
> + .n_channels = ARRAY_SIZE(wcn_5ghz_channels),
> + .bitrates = wcn_5ghz_rates,
> + .n_bitrates = ARRAY_SIZE(wcn_5ghz_rates),
> + .ht_cap = {
> + .cap = IEEE80211_HT_CAP_GRN_FLD |
> + IEEE80211_HT_CAP_SGI_20 |
> + IEEE80211_HT_CAP_DSSSCCK40 |
> + IEEE80211_HT_CAP_LSIG_TXOP_PROT |
> + IEEE80211_HT_CAP_SGI_40 |
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40,
> + .ht_supported = true,
> + .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
> + .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
> + .mcs = {
> + .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
> + .rx_highest = cpu_to_le16(72),
> + .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
> + }
> + }
> +};
> +
> +#ifdef CONFIG_PM
> +
> +static const struct wiphy_wowlan_support wowlan_support = {
> + .flags = WIPHY_WOWLAN_ANY
> +};
> +
> +#endif
> +
> +static inline u8 get_sta_index(struct ieee80211_vif *vif,
> + struct wcn36xx_sta *sta_priv)
> +{
> + return NL80211_IFTYPE_STATION == vif->type ?
> + sta_priv->bss_sta_index :
> + sta_priv->sta_index;
> +}
> +
> +static int wcn36xx_start(struct ieee80211_hw *hw)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + int ret;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac start\n");
> +
> + /* SMD initialization */
> + ret = wcn36xx_smd_open(wcn);
> + if (ret) {
> + wcn36xx_err("Failed to open smd channel: %d\n", ret);
> + goto out_err;
> + }
> +
> + /* Allocate memory pools for Mgmt BD headers and Data BD headers */
> + ret = wcn36xx_dxe_allocate_mem_pools(wcn);
> + if (ret) {
> + wcn36xx_err("Failed to alloc DXE mempool: %d\n", ret);
> + goto out_smd_close;
> + }
> +
> + ret = wcn36xx_dxe_alloc_ctl_blks(wcn);
> + if (ret) {
> + wcn36xx_err("Failed to alloc DXE ctl blocks: %d\n", ret);
> + goto out_free_dxe_pool;
> + }
> +
> + wcn->hal_buf = kmalloc(WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
> + if (!wcn->hal_buf) {
> + wcn36xx_err("Failed to allocate smd buf\n");
> + ret = -ENOMEM;
> + goto out_free_dxe_ctl;
> + }
> +
> + ret = wcn36xx_smd_load_nv(wcn);
> + if (ret) {
> + wcn36xx_err("Failed to push NV to chip\n");
> + goto out_free_smd_buf;
> + }
> +
> + ret = wcn36xx_smd_start(wcn);
> + if (ret) {
> + wcn36xx_err("Failed to start chip\n");
> + goto out_free_smd_buf;
> + }
> +
> + /* DMA channel initialization */
> + ret = wcn36xx_dxe_init(wcn);
> + if (ret) {
> + wcn36xx_err("DXE init failed\n");
> + goto out_smd_stop;
> + }
> +
> + wcn36xx_debugfs_init(wcn);
> +
> + if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
> + ret = wcn36xx_smd_feature_caps_exchange(wcn);
> + if (ret)
> + wcn36xx_warn("Exchange feature caps failed\n");
> + }
> + INIT_LIST_HEAD(&wcn->vif_list);
> + return 0;
> +
> +out_smd_stop:
> + wcn36xx_smd_stop(wcn);
> +out_free_smd_buf:
> + kfree(wcn->hal_buf);
> +out_free_dxe_pool:
> + wcn36xx_dxe_free_mem_pools(wcn);
> +out_free_dxe_ctl:
> + wcn36xx_dxe_free_ctl_blks(wcn);
> +out_smd_close:
> + wcn36xx_smd_close(wcn);
> +out_err:
> + return ret;
> +}
> +
> +static void wcn36xx_stop(struct ieee80211_hw *hw)
> +{
> + struct wcn36xx *wcn = hw->priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop\n");
> +
> + wcn36xx_debugfs_exit(wcn);
> + wcn36xx_smd_stop(wcn);
> + wcn36xx_dxe_deinit(wcn);
> + wcn36xx_smd_close(wcn);
> +
> + wcn36xx_dxe_free_mem_pools(wcn);
> + wcn36xx_dxe_free_ctl_blks(wcn);
> +
> + kfree(wcn->hal_buf);
> +}
> +
> +static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct ieee80211_vif *vif = NULL;
> + struct wcn36xx_vif *tmp;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed);
> +
> + if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
> + int ch = WCN36XX_HW_CHANNEL(wcn);
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
> + ch);
> + list_for_each_entry(tmp, &wcn->vif_list, list) {
> + vif = container_of((void *)tmp,
> + struct ieee80211_vif,
> + drv_priv);
> + wcn36xx_smd_switch_channel(wcn, vif, ch);
> + }
> + }
> +
> + return 0;
> +}
> +
> +#define WCN36XX_SUPPORTED_FILTERS (0)
> +
> +static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
> + unsigned int changed,
> + unsigned int *total, u64 multicast)
> +{
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n");
> +
> + *total &= WCN36XX_SUPPORTED_FILTERS;
> +}
> +
> +static void wcn36xx_tx(struct ieee80211_hw *hw,
> + struct ieee80211_tx_control *control,
> + struct sk_buff *skb)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_sta *sta_priv = NULL;
> +
> + if (control->sta)
> + sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv;
> +
> + if (wcn36xx_start_tx(wcn, sta_priv, skb))
> + ieee80211_free_txskb(wcn->hw, skb);
> +}
> +
> +static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
> + struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta,
> + struct ieee80211_key_conf *key_conf)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + struct wcn36xx_sta *sta_priv = vif_priv->sta;
> + int ret = 0;
> + u8 key[WLAN_MAX_KEY_LEN];
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 set key\n");
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "Key: cmd=0x%x algo:0x%x, id:%d, len:%d flags 0x%x\n",
> + cmd, key_conf->cipher, key_conf->keyidx,
> + key_conf->keylen, key_conf->flags);
> + wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "KEY: ",
> + key_conf->key,
> + key_conf->keylen);
> +
> + switch (key_conf->cipher) {
> + case WLAN_CIPHER_SUITE_WEP40:
> + vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
> + break;
> + case WLAN_CIPHER_SUITE_WEP104:
> + vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
> + break;
> + case WLAN_CIPHER_SUITE_CCMP:
> + vif_priv->encrypt_type = WCN36XX_HAL_ED_CCMP;
> + break;
> + case WLAN_CIPHER_SUITE_TKIP:
> + vif_priv->encrypt_type = WCN36XX_HAL_ED_TKIP;
> + break;
> + default:
> + wcn36xx_err("Unsupported key type 0x%x\n",
> + key_conf->cipher);
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> +
> + switch (cmd) {
> + case SET_KEY:
> + if (WCN36XX_HAL_ED_TKIP == vif_priv->encrypt_type) {
> + /*
> + * Supplicant is sending key in the wrong order:
> + * Temporal Key (16 b) - TX MIC (8 b) - RX MIC (8 b)
> + * but HW expects it to be in the order as described in
> + * IEEE 802.11 spec (see chapter 11.7) like this:
> + * Temporal Key (16 b) - RX MIC (8 b) - TX MIC (8 b)
> + */
> + memcpy(key, key_conf->key, 16);
> + memcpy(key + 16, key_conf->key + 24, 8);
> + memcpy(key + 24, key_conf->key + 16, 8);
> + } else {
> + memcpy(key, key_conf->key, key_conf->keylen);
> + }
> +
> + if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
> + sta_priv->is_data_encrypted = true;
> + /* Reconfigure bss with encrypt_type */
> + if (NL80211_IFTYPE_STATION == vif->type)
> + wcn36xx_smd_config_bss(wcn,
> + vif,
> + sta,
> + sta->addr,
> + true);
> +
> + wcn36xx_smd_set_stakey(wcn,
> + vif_priv->encrypt_type,
> + key_conf->keyidx,
> + key_conf->keylen,
> + key,
> + get_sta_index(vif, sta_priv));
> + } else {
> + wcn36xx_smd_set_bsskey(wcn,
> + vif_priv->encrypt_type,
> + key_conf->keyidx,
> + key_conf->keylen,
> + key);
> + if ((WLAN_CIPHER_SUITE_WEP40 == key_conf->cipher) ||
> + (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) {
> + sta_priv->is_data_encrypted = true;
> + wcn36xx_smd_set_stakey(wcn,
> + vif_priv->encrypt_type,
> + key_conf->keyidx,
> + key_conf->keylen,
> + key,
> + get_sta_index(vif, sta_priv));
> + }
> + }
> + break;
> + case DISABLE_KEY:
> + if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
> + wcn36xx_smd_remove_bsskey(wcn,
> + vif_priv->encrypt_type,
> + key_conf->keyidx);
> + } else {
> + sta_priv->is_data_encrypted = false;
> + /* do not remove key if disassociated */
> + if (sta_priv->aid)
> + wcn36xx_smd_remove_stakey(wcn,
> + vif_priv->encrypt_type,
> + key_conf->keyidx,
> + get_sta_index(vif, sta_priv));
> + }
> + break;
> + default:
> + wcn36xx_err("Unsupported key cmd 0x%x\n", cmd);
> + ret = -EOPNOTSUPP;
> + goto out;
> + break;
> + }
> +
> +out:
> + return ret;
> +}
> +
> +static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw)
> +{
> + struct wcn36xx *wcn = hw->priv;
> +
> + wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN);
> + wcn36xx_smd_start_scan(wcn);
> +}
> +
> +static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw)
> +{
> + struct wcn36xx *wcn = hw->priv;
> +
> + wcn36xx_smd_end_scan(wcn);
> + wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN);
> +}
> +
> +static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
> + enum ieee80211_band band)
> +{
> + int i, size;
> + u16 *rates_table;
> + struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> + u32 rates = sta->supp_rates[band];
> +
> + memset(&sta_priv->supported_rates, 0,
> + sizeof(sta_priv->supported_rates));
> + sta_priv->supported_rates.op_rate_mode = STA_11n;
> +
> + size = ARRAY_SIZE(sta_priv->supported_rates.dsss_rates);
> + rates_table = sta_priv->supported_rates.dsss_rates;
> + if (band == IEEE80211_BAND_2GHZ) {
> + for (i = 0; i < size; i++) {
> + if (rates & 0x01) {
> + rates_table[i] = wcn_2ghz_rates[i].hw_value;
> + rates = rates >> 1;
> + }
> + }
> + }
> +
> + size = ARRAY_SIZE(sta_priv->supported_rates.ofdm_rates);
> + rates_table = sta_priv->supported_rates.ofdm_rates;
> + for (i = 0; i < size; i++) {
> + if (rates & 0x01) {
> + rates_table[i] = wcn_5ghz_rates[i].hw_value;
> + rates = rates >> 1;
> + }
> + }
> +
> + if (sta->ht_cap.ht_supported) {
> + BUILD_BUG_ON(sizeof(sta->ht_cap.mcs.rx_mask) >
> + sizeof(sta_priv->supported_rates.supported_mcs_set));
> + memcpy(sta_priv->supported_rates.supported_mcs_set,
> + sta->ht_cap.mcs.rx_mask,
> + sizeof(sta->ht_cap.mcs.rx_mask));
> + }
> +}
> +void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates)
> +{
> + u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES] = {
> + HW_RATE_INDEX_6MBPS,
> + HW_RATE_INDEX_9MBPS,
> + HW_RATE_INDEX_12MBPS,
> + HW_RATE_INDEX_18MBPS,
> + HW_RATE_INDEX_24MBPS,
> + HW_RATE_INDEX_36MBPS,
> + HW_RATE_INDEX_48MBPS,
> + HW_RATE_INDEX_54MBPS
> + };
> + u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES] = {
> + HW_RATE_INDEX_1MBPS,
> + HW_RATE_INDEX_2MBPS,
> + HW_RATE_INDEX_5_5MBPS,
> + HW_RATE_INDEX_11MBPS
> + };
> +
> + rates->op_rate_mode = STA_11n;
> + memcpy(rates->dsss_rates, dsss_rates,
> + sizeof(*dsss_rates) * WCN36XX_HAL_NUM_DSSS_RATES);
> + memcpy(rates->ofdm_rates, ofdm_rates,
> + sizeof(*ofdm_rates) * WCN36XX_HAL_NUM_OFDM_RATES);
> + rates->supported_mcs_set[0] = 0xFF;
> +}
> +static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_bss_conf *bss_conf,
> + u32 changed)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct sk_buff *skb = NULL;
> + u16 tim_off, tim_len;
> + enum wcn36xx_hal_link_state link_state;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 0x%08x\n",
> + vif, changed);
> +
> + if (changed & BSS_CHANGED_BEACON_INFO) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "mac bss changed dtim period %d\n",
> + bss_conf->dtim_period);
> +
> + vif_priv->dtim_period = bss_conf->dtim_period;
> + }
> +
> + if (changed & BSS_CHANGED_PS) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "mac bss PS set %d\n",
> + bss_conf->ps);
> + if (bss_conf->ps) {
> + wcn36xx_pmc_enter_bmps_state(wcn, vif);
> + } else {
> + wcn36xx_pmc_exit_bmps_state(wcn, vif);
> + }
> + }
> +
> + if (changed & BSS_CHANGED_BSSID) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n",
> + bss_conf->bssid);
> +
> + if (!is_zero_ether_addr(bss_conf->bssid)) {
> + vif_priv->is_joining = true;
> + vif_priv->bss_index = 0xff;
> + wcn36xx_smd_join(wcn, bss_conf->bssid,
> + vif->addr, WCN36XX_HW_CHANNEL(wcn));
> + wcn36xx_smd_config_bss(wcn, vif, NULL,
> + bss_conf->bssid, false);
> + } else {
> + vif_priv->is_joining = false;
> + wcn36xx_smd_delete_bss(wcn, vif);
> + }
> + }
> +
> + if (changed & BSS_CHANGED_SSID) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "mac bss changed ssid\n");
> + wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "ssid ",
> + bss_conf->ssid, bss_conf->ssid_len);
> +
> + vif_priv->ssid.length = bss_conf->ssid_len;
> + memcpy(&vif_priv->ssid.ssid,
> + bss_conf->ssid,
> + bss_conf->ssid_len);
> + }
> +
> + if (changed & BSS_CHANGED_ASSOC) {
> + vif_priv->is_joining = false;
> + if (bss_conf->assoc) {
> + struct ieee80211_sta *sta;
> + struct wcn36xx_sta *sta_priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "mac assoc bss %pM vif %pM AID=%d\n",
> + bss_conf->bssid,
> + vif->addr,
> + bss_conf->aid);
> +
> + rcu_read_lock();
> + sta = ieee80211_find_sta(vif, bss_conf->bssid);
> + if (!sta) {
> + wcn36xx_err("sta %pM is not found\n",
> + bss_conf->bssid);
> + rcu_read_unlock();
> + goto out;
> + }
> + sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> +
> + wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
> +
> + wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
> + vif->addr,
> + WCN36XX_HAL_LINK_POSTASSOC_STATE);
> + wcn36xx_smd_config_bss(wcn, vif, sta,
> + bss_conf->bssid,
> + true);
> + sta_priv->aid = bss_conf->aid;
> + /*
> + * config_sta must be called from because this is the
> + * place where AID is available.
> + */
> + wcn36xx_smd_config_sta(wcn, vif, sta);
> + rcu_read_unlock();
> + } else {
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "disassociated bss %pM vif %pM AID=%d\n",
> + bss_conf->bssid,
> + vif->addr,
> + bss_conf->aid);
> + wcn36xx_smd_set_link_st(wcn,
> + bss_conf->bssid,
> + vif->addr,
> + WCN36XX_HAL_LINK_IDLE_STATE);
> + }
> + }
> +
> + if (changed & BSS_CHANGED_AP_PROBE_RESP) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed ap probe resp\n");
> + skb = ieee80211_proberesp_get(hw, vif);
> + if (!skb) {
> + wcn36xx_err("failed to alloc probereq skb\n");
> + goto out;
> + }
> +
> + wcn36xx_smd_update_proberesp_tmpl(wcn, vif, skb);
> + dev_kfree_skb(skb);
> + }
> +
> + if (changed & BSS_CHANGED_BEACON_ENABLED) {
> + wcn36xx_dbg(WCN36XX_DBG_MAC,
> + "mac bss changed beacon enabled %d\n",
> + bss_conf->enable_beacon);
> +
> + if (bss_conf->enable_beacon) {
> + vif_priv->bss_index = 0xff;
> + wcn36xx_smd_config_bss(wcn, vif, NULL,
> + vif->addr, false);
> + skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
> + &tim_len);
> + if (!skb) {
> + wcn36xx_err("failed to alloc beacon skb\n");
> + goto out;
> + }
> + wcn36xx_smd_send_beacon(wcn, vif, skb, tim_off, 0);
> + dev_kfree_skb(skb);
> +
> + if (vif->type == NL80211_IFTYPE_ADHOC ||
> + vif->type == NL80211_IFTYPE_MESH_POINT)
> + link_state = WCN36XX_HAL_LINK_IBSS_STATE;
> + else
> + link_state = WCN36XX_HAL_LINK_AP_STATE;
> +
> + wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
> + link_state);
> + } else {
> + wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
> + WCN36XX_HAL_LINK_IDLE_STATE);
> + wcn36xx_smd_delete_bss(wcn, vif);
> + }
> + }
> +out:
> + return;
> +}
> +
> +/* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
> +static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value);
> +
> + wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_RTS_THRESHOLD, value);
> + return 0;
> +}
> +
> +static void wcn36xx_remove_interface(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif);
> +
> + list_del(&vif_priv->list);
> + wcn36xx_smd_delete_sta_self(wcn, vif->addr);
> +}
> +
> +static int wcn36xx_add_interface(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d\n",
> + vif, vif->type);
> +
> + if (!(NL80211_IFTYPE_STATION == vif->type ||
> + NL80211_IFTYPE_AP == vif->type ||
> + NL80211_IFTYPE_ADHOC == vif->type ||
> + NL80211_IFTYPE_MESH_POINT == vif->type)) {
> + wcn36xx_warn("Unsupported interface type requested: %d\n",
> + vif->type);
> + return -EOPNOTSUPP;
> + }
> +
> + list_add(&vif_priv->list, &wcn->vif_list);
> + wcn36xx_smd_add_sta_self(wcn, vif);
> +
> + return 0;
> +}
> +
> +static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
> + vif, sta->addr);
> +
> + vif_priv->sta = sta_priv;
> + sta_priv->vif = vif_priv;
> + /*
> + * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
> + * at this stage AID is not available yet.
> + */
> + if (NL80211_IFTYPE_STATION != vif->type) {
> + wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
> + sta_priv->aid = sta->aid;
> + wcn36xx_smd_config_sta(wcn, vif, sta);
> + }
> + return 0;
> +}
> +
> +static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
> + vif, sta->addr, sta_priv->sta_index);
> +
> + wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index);
> + vif_priv->sta = NULL;
> + sta_priv->vif = NULL;
> + return 0;
> +}
> +
> +#ifdef CONFIG_PM
> +
> +static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
> +{
> + struct wcn36xx *wcn = hw->priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n");
> +
> + flush_workqueue(wcn->hal_ind_wq);
> + wcn36xx_smd_set_power_params(wcn, true);
> + return 0;
> +}
> +
> +static int wcn36xx_resume(struct ieee80211_hw *hw)
> +{
> + struct wcn36xx *wcn = hw->priv;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n");
> +
> + flush_workqueue(wcn->hal_ind_wq);
> + wcn36xx_smd_set_power_params(wcn, false);
> + return 0;
> +}
> +
> +#endif
> +
> +static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
> + struct ieee80211_vif *vif,
> + enum ieee80211_ampdu_mlme_action action,
> + struct ieee80211_sta *sta, u16 tid, u16 *ssn,
> + u8 buf_size)
> +{
> + struct wcn36xx *wcn = hw->priv;
> + struct wcn36xx_sta *sta_priv = NULL;
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
> + action, tid);
> +
> + sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> +
> + switch (action) {
> + case IEEE80211_AMPDU_RX_START:
> + sta_priv->tid = tid;
> + wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 0,
> + get_sta_index(vif, sta_priv));
> + wcn36xx_smd_add_ba(wcn);
> + wcn36xx_smd_trigger_ba(wcn, get_sta_index(vif, sta_priv));
> + ieee80211_start_tx_ba_session(sta, tid, 0);
> + break;
> + case IEEE80211_AMPDU_RX_STOP:
> + wcn36xx_smd_del_ba(wcn, tid, get_sta_index(vif, sta_priv));
> + break;
> + case IEEE80211_AMPDU_TX_START:
> + ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> + break;
> + case IEEE80211_AMPDU_TX_OPERATIONAL:
> + wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 1,
> + get_sta_index(vif, sta_priv));
> + break;
> + case IEEE80211_AMPDU_TX_STOP_FLUSH:
> + case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
> + case IEEE80211_AMPDU_TX_STOP_CONT:
> + ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
> + break;
> + default:
> + wcn36xx_err("Unknown AMPDU action\n");
> + }
> +
> + return 0;
> +}
> +
> +static const struct ieee80211_ops wcn36xx_ops = {
> + .start = wcn36xx_start,
> + .stop = wcn36xx_stop,
> + .add_interface = wcn36xx_add_interface,
> + .remove_interface = wcn36xx_remove_interface,
> +#ifdef CONFIG_PM
> + .suspend = wcn36xx_suspend,
> + .resume = wcn36xx_resume,
> +#endif
> + .config = wcn36xx_config,
> + .configure_filter = wcn36xx_configure_filter,
> + .tx = wcn36xx_tx,
> + .set_key = wcn36xx_set_key,
> + .sw_scan_start = wcn36xx_sw_scan_start,
> + .sw_scan_complete = wcn36xx_sw_scan_complete,
> + .bss_info_changed = wcn36xx_bss_info_changed,
> + .set_rts_threshold = wcn36xx_set_rts_threshold,
> + .sta_add = wcn36xx_sta_add,
> + .sta_remove = wcn36xx_sta_remove,
> + .ampdu_action = wcn36xx_ampdu_action,
> +};
> +
> +static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
> +{
> + int ret = 0;
> +
> + static const u32 cipher_suites[] = {
> + WLAN_CIPHER_SUITE_WEP40,
> + WLAN_CIPHER_SUITE_WEP104,
> + WLAN_CIPHER_SUITE_TKIP,
> + WLAN_CIPHER_SUITE_CCMP,
> + };
> +
> + wcn->hw->flags = IEEE80211_HW_SIGNAL_DBM |
> + IEEE80211_HW_HAS_RATE_CONTROL |
> + IEEE80211_HW_SUPPORTS_PS |
> + IEEE80211_HW_CONNECTION_MONITOR |
> + IEEE80211_HW_AMPDU_AGGREGATION |
> + IEEE80211_HW_TIMING_BEACON_ONLY;
> +
> + wcn->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
> + BIT(NL80211_IFTYPE_AP) |
> + BIT(NL80211_IFTYPE_ADHOC) |
> + BIT(NL80211_IFTYPE_MESH_POINT);
> +
> + wcn->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wcn_band_2ghz;
> + wcn->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wcn_band_5ghz;
> +
> + wcn->hw->wiphy->cipher_suites = cipher_suites;
> + wcn->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
> +
> + wcn->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
> +
> +#ifdef CONFIG_PM
> + wcn->hw->wiphy->wowlan = &wowlan_support;
> +#endif
> +
> + wcn->hw->max_listen_interval = 200;
> +
> + wcn->hw->queues = 4;
> +
> + SET_IEEE80211_DEV(wcn->hw, wcn->dev);
> +
> + wcn->hw->sta_data_size = sizeof(struct wcn36xx_sta);
> + wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
> +
> + return ret;
> +}
> +
> +static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
> + struct platform_device *pdev)
> +{
> + struct resource *res;
> + /* Set TX IRQ */
> + res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
> + "wcnss_wlantx_irq");
> + if (!res) {
> + wcn36xx_err("failed to get tx_irq\n");
> + return -ENOENT;
> + }
> + wcn->tx_irq = res->start;
> +
> + /* Set RX IRQ */
> + res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
> + "wcnss_wlanrx_irq");
> + if (!res) {
> + wcn36xx_err("failed to get rx_irq\n");
> + return -ENOENT;
> + }
> + wcn->rx_irq = res->start;
> +
> + /* Map the memory */
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> + "wcnss_mmio");
> + if (!res) {
> + wcn36xx_err("failed to get mmio\n");
> + return -ENOENT;
> + }
> + wcn->mmio = ioremap(res->start, resource_size(res));
> + if (!wcn->mmio) {
> + wcn36xx_err("failed to map io memory\n");
> + return -ENOMEM;
> + }
> + return 0;
> +}
> +
> +static int wcn36xx_probe(struct platform_device *pdev)
> +{
> + struct ieee80211_hw *hw;
> + struct wcn36xx *wcn;
> + int ret;
> + u8 addr[ETH_ALEN];
> +
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
> +
> + hw = ieee80211_alloc_hw(sizeof(struct wcn36xx), &wcn36xx_ops);
> + if (!hw) {
> + wcn36xx_err("failed to alloc hw\n");
> + ret = -ENOMEM;
> + goto out_err;
> + }
> + platform_set_drvdata(pdev, hw);
> + wcn = hw->priv;
> + wcn->hw = hw;
> + wcn->dev = &pdev->dev;
> + wcn->ctrl_ops = pdev->dev.platform_data;
> +
> + mutex_init(&wcn->hal_mutex);
> +
> + if (!wcn->ctrl_ops->get_hw_mac(addr)) {
> + wcn36xx_info("mac address: %pM\n", addr);
> + SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
> + }
> +
> + ret = wcn36xx_platform_get_resources(wcn, pdev);
> + if (ret)
> + goto out_wq;
> +
> + wcn36xx_init_ieee80211(wcn);
> + ret = ieee80211_register_hw(wcn->hw);
> + if (ret)
> + goto out_unmap;
> +
> + return 0;
> +
> +out_unmap:
> + iounmap(wcn->mmio);
> +out_wq:
> + ieee80211_free_hw(hw);
> +out_err:
> + return ret;
> +}
> +static int wcn36xx_remove(struct platform_device *pdev)
> +{
> + struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> + struct wcn36xx *wcn = hw->priv;
> + wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");
> +
> + mutex_destroy(&wcn->hal_mutex);
> +
> + ieee80211_unregister_hw(hw);
> + iounmap(wcn->mmio);
> + ieee80211_free_hw(hw);
> +
> + return 0;
> +}
> +static const struct platform_device_id wcn36xx_platform_id_table[] = {
> + {
> + .name = "wcn36xx",
> + .driver_data = 0
> + },
> + {}
> +};
> +MODULE_DEVICE_TABLE(platform, wcn36xx_platform_id_table);
> +
> +static struct platform_driver wcn36xx_driver = {
> + .probe = wcn36xx_probe,
> + .remove = wcn36xx_remove,
> + .driver = {
> + .name = "wcn36xx",
> + .owner = THIS_MODULE,
> + },
> + .id_table = wcn36xx_platform_id_table,
> +};
> +
> +static int __init wcn36xx_init(void)
> +{
> + platform_driver_register(&wcn36xx_driver);
> + return 0;
> +}
> +module_init(wcn36xx_init);
> +
> +static void __exit wcn36xx_exit(void)
> +{
> + platform_driver_unregister(&wcn36xx_driver);
> +}
> +module_exit(wcn36xx_exit);
> +
> +MODULE_LICENSE("Dual BSD/GPL");
> +MODULE_AUTHOR("Eugene Krasnikov k.eugene.e@gmail.com");
> +MODULE_FIRMWARE(WLAN_NV_FILE);
> diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c
> new file mode 100644
> index 0000000..28b515c
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include "wcn36xx.h"
> +
> +int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif)
> +{
> + int ret = 0;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + /* TODO: Make sure the TX chain clean */
> + ret = wcn36xx_smd_enter_bmps(wcn, vif);
> + if (!ret) {
> + wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
> + vif_priv->pw_state = WCN36XX_BMPS;
> + } else {
> + /*
> + * One of the reasons why HW will not enter BMPS is because
> + * driver is trying to enter bmps before first beacon was
> + * received just after auth complete
> + */
> + wcn36xx_err("Can not enter BMPS!\n");
> + }
> + return ret;
> +}
> +
> +int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif)
> +{
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> +
> + if (WCN36XX_BMPS != vif_priv->pw_state) {
> + wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n");
> + return -EINVAL;
> + }
> + wcn36xx_smd_exit_bmps(wcn, vif);
> + vif_priv->pw_state = WCN36XX_FULL_POWER;
> + return 0;
> +}
> +
> +int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif)
> +{
> + wcn36xx_dbg(WCN36XX_DBG_PMC, "%s\n", __func__);
> + return wcn36xx_smd_keep_alive_req(wcn, vif,
> + WCN36XX_HAL_KEEP_ALIVE_NULL_PKT);
> +}
> diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.h b/drivers/net/wireless/ath/wcn36xx/pmc.h
> new file mode 100644
> index 0000000..f72ed68
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/pmc.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _WCN36XX_PMC_H_
> +#define _WCN36XX_PMC_H_
> +
> +struct wcn36xx;
> +
> +enum wcn36xx_power_state {
> + WCN36XX_FULL_POWER,
> + WCN36XX_BMPS
> +};
> +
> +int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif);
> +int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif);
> +int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif);
> +#endif /* _WCN36XX_PMC_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> new file mode 100644
> index 0000000..f8c3a10
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -0,0 +1,2126 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include <linux/etherdevice.h>
> +#include <linux/firmware.h>
> +#include <linux/bitops.h>
> +#include "smd.h"
> +
> +static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value)
> +{
> + struct wcn36xx_hal_cfg *entry;
> + u32 *val;
> +
> + if (*len + sizeof(*entry) + sizeof(u32) >= WCN36XX_HAL_BUF_SIZE) {
> + wcn36xx_err("Not enough room for TLV entry\n");
> + return -ENOMEM;
> + }
> +
> + entry = (struct wcn36xx_hal_cfg *) (wcn->hal_buf + *len);
> + entry->id = id;
> + entry->len = sizeof(u32);
> + entry->pad_bytes = 0;
> + entry->reserve = 0;
> +
> + val = (u32 *) (entry + 1);
> + *val = value;
> +
> + *len += sizeof(*entry) + sizeof(u32);
> +
> + return 0;
> +}
> +
> +static void wcn36xx_smd_set_bss_nw_type(struct wcn36xx *wcn,
> + struct ieee80211_sta *sta,
> + struct wcn36xx_hal_config_bss_params *bss_params)
> +{
> + if (IEEE80211_BAND_5GHZ == WCN36XX_BAND(wcn))
> + bss_params->nw_type = WCN36XX_HAL_11A_NW_TYPE;
> + else if (sta && sta->ht_cap.ht_supported)
> + bss_params->nw_type = WCN36XX_HAL_11N_NW_TYPE;
> + else if (sta && (sta->supp_rates[IEEE80211_BAND_2GHZ] & 0x7f))
> + bss_params->nw_type = WCN36XX_HAL_11G_NW_TYPE;
> + else
> + bss_params->nw_type = WCN36XX_HAL_11B_NW_TYPE;
> +}
> +
> +static inline u8 is_cap_supported(unsigned long caps, unsigned long flag)
> +{
> + return caps & flag ? 1 : 0;
> +}
> +static void wcn36xx_smd_set_bss_ht_params(struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta,
> + struct wcn36xx_hal_config_bss_params *bss_params)
> +{
> + if (sta && sta->ht_cap.ht_supported) {
> + unsigned long caps = sta->ht_cap.cap;
> + bss_params->ht = sta->ht_cap.ht_supported;
> + bss_params->tx_channel_width_set = is_cap_supported(caps,
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40);
> + bss_params->lsig_tx_op_protection_full_support =
> + is_cap_supported(caps,
> + IEEE80211_HT_CAP_LSIG_TXOP_PROT);
> +
> + bss_params->ht_oper_mode = vif->bss_conf.ht_operation_mode;
> + bss_params->lln_non_gf_coexist =
> + !!(vif->bss_conf.ht_operation_mode &
> + IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
> + /* IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT */
> + bss_params->dual_cts_protection = 0;
> + /* IEEE80211_HT_OP_MODE_PROTECTION_20MHZ */
> + bss_params->ht20_coexist = 0;
> + }
> +}
> +
> +static void wcn36xx_smd_set_sta_ht_params(struct ieee80211_sta *sta,
> + struct wcn36xx_hal_config_sta_params *sta_params)
> +{
> + if (sta->ht_cap.ht_supported) {
> + unsigned long caps = sta->ht_cap.cap;
> + sta_params->ht_capable = sta->ht_cap.ht_supported;
> + sta_params->tx_channel_width_set = is_cap_supported(caps,
> + IEEE80211_HT_CAP_SUP_WIDTH_20_40);
> + sta_params->lsig_txop_protection = is_cap_supported(caps,
> + IEEE80211_HT_CAP_LSIG_TXOP_PROT);
> +
> + sta_params->max_ampdu_size = sta->ht_cap.ampdu_factor;
> + sta_params->max_ampdu_density = sta->ht_cap.ampdu_density;
> + sta_params->max_amsdu_size = is_cap_supported(caps,
> + IEEE80211_HT_CAP_MAX_AMSDU);
> + sta_params->sgi_20Mhz = is_cap_supported(caps,
> + IEEE80211_HT_CAP_SGI_20);
> + sta_params->sgi_40mhz = is_cap_supported(caps,
> + IEEE80211_HT_CAP_SGI_40);
> + sta_params->green_field_capable = is_cap_supported(caps,
> + IEEE80211_HT_CAP_GRN_FLD);
> + sta_params->delayed_ba_support = is_cap_supported(caps,
> + IEEE80211_HT_CAP_DELAY_BA);
> + sta_params->dsss_cck_mode_40mhz = is_cap_supported(caps,
> + IEEE80211_HT_CAP_DSSSCCK40);
> + }
> +}
> +
> +static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta,
> + struct wcn36xx_hal_config_sta_params *sta_params)
> +{
> + struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
> + struct wcn36xx_sta *priv_sta = NULL;
> + if (vif->type == NL80211_IFTYPE_ADHOC ||
> + vif->type == NL80211_IFTYPE_AP ||
> + vif->type == NL80211_IFTYPE_MESH_POINT) {
> + sta_params->type = 1;
> + sta_params->sta_index = 0xFF;
> + } else {
> + sta_params->type = 0;
> + sta_params->sta_index = 1;
> + }
> +
> + sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
> +
> + /*
> + * In STA mode ieee80211_sta contains bssid and ieee80211_vif
> + * contains our mac address. In AP mode we are bssid so vif
> + * contains bssid and ieee80211_sta contains mac.
> + */
> + if (NL80211_IFTYPE_STATION == vif->type)
> + memcpy(&sta_params->mac, vif->addr, ETH_ALEN);
> + else
> + memcpy(&sta_params->bssid, vif->addr, ETH_ALEN);
> +
> + sta_params->encrypt_type = priv_vif->encrypt_type;
> + sta_params->short_preamble_supported =
> + !(WCN36XX_FLAGS(wcn) &
> + IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE);
> +
> + sta_params->rifs_mode = 0;
> + sta_params->rmf = 0;
> + sta_params->action = 0;
> + sta_params->uapsd = 0;
> + sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
> + sta_params->max_ampdu_duration = 0;
> + sta_params->bssid_index = priv_vif->bss_index;
> + sta_params->p2p = 0;
> +
> + if (sta) {
> + priv_sta = (struct wcn36xx_sta *)sta->drv_priv;
> + if (NL80211_IFTYPE_STATION == vif->type)
> + memcpy(&sta_params->bssid, sta->addr, ETH_ALEN);
> + else
> + memcpy(&sta_params->mac, sta->addr, ETH_ALEN);
> + sta_params->wmm_enabled = sta->wme;
> + sta_params->max_sp_len = sta->max_sp;
> + sta_params->aid = priv_sta->aid;
> + wcn36xx_smd_set_sta_ht_params(sta, sta_params);
> + memcpy(&sta_params->supported_rates, &priv_sta->supported_rates,
> + sizeof(priv_sta->supported_rates));
> + } else {
> + wcn36xx_set_default_rates(&sta_params->supported_rates);
> + }
> +}
> +
> +static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
> +{
> + int ret = 0;
> + wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
> +
> + init_completion(&wcn->hal_rsp_compl);
> + ret = wcn->ctrl_ops->tx(wcn->hal_buf, len);
> + if (ret) {
> + wcn36xx_err("HAL TX failed\n");
> + goto out;
> + }
> + if (wait_for_completion_timeout(&wcn->hal_rsp_compl,
> + msecs_to_jiffies(HAL_MSG_TIMEOUT)) <= 0) {
> + wcn36xx_err("Timeout while waiting SMD response\n");
> + ret = -ETIME;
> + goto out;
> + }
> +out:
> + return ret;
> +}
> +
> +#define INIT_HAL_MSG(msg_body, type) \
> + do { \
> + memset(&msg_body, 0, sizeof(msg_body)); \
> + msg_body.header.msg_type = type; \
> + msg_body.header.msg_version = WCN36XX_HAL_MSG_VERSION0; \
> + msg_body.header.len = sizeof(msg_body); \
> + } while (0) \
> +
> +#define PREPARE_HAL_BUF(send_buf, msg_body) \
> + do { \
> + memset(send_buf, 0, msg_body.header.len); \
> + memcpy(send_buf, &msg_body, sizeof(msg_body)); \
> + } while (0) \
> +
> +static int wcn36xx_smd_rsp_status_check(void *buf, size_t len)
> +{
> + struct wcn36xx_fw_msg_status_rsp *rsp;
> +
> + if (len < sizeof(struct wcn36xx_hal_msg_header) +
> + sizeof(struct wcn36xx_fw_msg_status_rsp))
> + return -EIO;
> +
> + rsp = (struct wcn36xx_fw_msg_status_rsp *)
> + (buf + sizeof(struct wcn36xx_hal_msg_header));
> +
> + if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status)
> + return rsp->status;
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
> +{
> + const struct firmware *nv;
> + struct nv_data *nv_d;
> + struct wcn36xx_hal_nv_img_download_req_msg msg_body;
> + int fw_bytes_left;
> + int ret;
> + u16 fm_offset = 0;
> +
> + ret = request_firmware(&nv, WLAN_NV_FILE, wcn->dev);
> + if (ret) {
> + wcn36xx_err("Failed to load nv file %s: %d\n",
> + WLAN_NV_FILE, ret);
> + goto out_free_nv;
> + }
> +
> + nv_d = (struct nv_data *)nv->data;
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DOWNLOAD_NV_REQ);
> +
> + msg_body.header.len += WCN36XX_NV_FRAGMENT_SIZE;
> +
> + msg_body.frag_number = 0;
> + /* hal_buf must be protected with mutex */
> + mutex_lock(&wcn->hal_mutex);
> +
> + do {
> + fw_bytes_left = nv->size - fm_offset - 4;
> + if (fw_bytes_left > WCN36XX_NV_FRAGMENT_SIZE) {
> + msg_body.last_fragment = 0;
> + msg_body.nv_img_buffer_size = WCN36XX_NV_FRAGMENT_SIZE;
> + } else {
> + msg_body.last_fragment = 1;
> + msg_body.nv_img_buffer_size = fw_bytes_left;
> +
> + /* Do not forget update general message len */
> + msg_body.header.len = sizeof(msg_body) + fw_bytes_left;
> +
> + }
> +
> + /* Add load NV request message header */
> + memcpy(wcn->hal_buf, &msg_body, sizeof(msg_body));
> +
> + /* Add NV body itself */
> + memcpy(wcn->hal_buf + sizeof(msg_body),
> + &nv_d->table + fm_offset,
> + msg_body.nv_img_buffer_size);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret)
> + goto out_unlock;
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf,
> + wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_load_nv response failed err=%d\n",
> + ret);
> + goto out_unlock;
> + }
> + msg_body.frag_number++;
> + fm_offset += WCN36XX_NV_FRAGMENT_SIZE;
> +
> + } while (msg_body.last_fragment != 1);
> +
> +out_unlock:
> + mutex_unlock(&wcn->hal_mutex);
> +out_free_nv:
> + release_firmware(nv);
> +
> + return ret;
> +}
> +
> +static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len)
> +{
> + struct wcn36xx_hal_mac_start_rsp_msg *rsp;
> +
> + if (len < sizeof(*rsp))
> + return -EIO;
> +
> + rsp = (struct wcn36xx_hal_mac_start_rsp_msg *)buf;
> +
> + if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->start_rsp_params.status)
> + return -EIO;
> +
> + memcpy(wcn->crm_version, rsp->start_rsp_params.crm_version,
> + WCN36XX_HAL_VERSION_LENGTH);
> + memcpy(wcn->wlan_version, rsp->start_rsp_params.wlan_version,
> + WCN36XX_HAL_VERSION_LENGTH);
> +
> + /* null terminate the strings, just in case */
> + wcn->crm_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
> + wcn->wlan_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
> +
> + wcn->fw_revision = rsp->start_rsp_params.version.revision;
> + wcn->fw_version = rsp->start_rsp_params.version.version;
> + wcn->fw_minor = rsp->start_rsp_params.version.minor;
> + wcn->fw_major = rsp->start_rsp_params.version.major;
> +
> + wcn36xx_info("firmware WLAN version '%s' and CRM version '%s'\n",
> + wcn->wlan_version, wcn->crm_version);
> +
> + wcn36xx_info("firmware API %u.%u.%u.%u, %u stations, %u bssids\n",
> + wcn->fw_major, wcn->fw_minor,
> + wcn->fw_version, wcn->fw_revision,
> + rsp->start_rsp_params.stations,
> + rsp->start_rsp_params.bssids);
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_start(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_mac_start_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_REQ);
> +
> + msg_body.params.type = DRIVER_TYPE_PRODUCTION;
> + msg_body.params.len = 0;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start type %d\n",
> + msg_body.params.type);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_start failed\n");
> + goto out;
> + }
> +
> + ret = wcn36xx_smd_start_rsp(wcn, wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_start response failed err=%d\n", ret);
> + goto out;
> + }
> +
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_stop(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_mac_stop_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_STOP_REQ);
> +
> + msg_body.stop_req_params.reason = HAL_STOP_TYPE_RF_KILL;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_stop failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_stop response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode)
> +{
> + struct wcn36xx_hal_init_scan_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_INIT_SCAN_REQ);
> +
> + msg_body.mode = mode;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal init scan mode %d\n", msg_body.mode);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_init_scan failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_init_scan response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_start_scan(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_start_scan_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_SCAN_REQ);
> +
> + msg_body.scan_channel = WCN36XX_HW_CHANNEL(wcn);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start scan channel %d\n",
> + msg_body.scan_channel);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_start_scan failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_start_scan response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_end_scan(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_end_scan_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_END_SCAN_REQ);
> +
> + msg_body.scan_channel = WCN36XX_HW_CHANNEL(wcn);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal end scan channel %d\n",
> + msg_body.scan_channel);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_end_scan failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_end_scan response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_finish_scan(struct wcn36xx *wcn,
> + enum wcn36xx_hal_sys_mode mode)
> +{
> + struct wcn36xx_hal_finish_scan_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_FINISH_SCAN_REQ);
> +
> + msg_body.mode = mode;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal finish scan mode %d\n",
> + msg_body.mode);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_finish_scan failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_finish_scan response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_switch_channel_rsp(void *buf, size_t len)
> +{
> + struct wcn36xx_hal_switch_channel_rsp_msg *rsp;
> + int ret = 0;
> +
> + ret = wcn36xx_smd_rsp_status_check(buf, len);
> + if (ret)
> + return ret;
> + rsp = (struct wcn36xx_hal_switch_channel_rsp_msg *)buf;
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "channel switched to: %d, status: %d\n",
> + rsp->channel_number, rsp->status);
> + return ret;
> +}
> +
> +int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif, int ch)
> +{
> + struct wcn36xx_hal_switch_channel_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_CH_SWITCH_REQ);
> +
> + msg_body.channel_number = (u8)ch;
> + msg_body.tx_mgmt_power = 0xbf;
> + msg_body.max_tx_power = 0xbf;
> + memcpy(msg_body.self_sta_mac_addr, vif->addr, ETH_ALEN);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_switch_channel failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_switch_channel_rsp(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_switch_channel response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_update_scan_params_rsp(void *buf, size_t len)
> +{
> + struct wcn36xx_hal_update_scan_params_resp *rsp;
> +
> + rsp = (struct wcn36xx_hal_update_scan_params_resp *)buf;
> +
> + /* Remove the PNO version bit */
> + rsp->status &= (~(WCN36XX_FW_MSG_PNO_VERSION_MASK));
> +
> + if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status) {
> + wcn36xx_warn("error response from update scan\n");
> + return rsp->status;
> + }
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_update_scan_params_req msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_SCAN_PARAM_REQ);
> +
> + msg_body.dot11d_enabled = 0;
> + msg_body.dot11d_resolved = 0;
> + msg_body.channel_count = 26;
> + msg_body.active_min_ch_time = 60;
> + msg_body.active_max_ch_time = 120;
> + msg_body.passive_min_ch_time = 60;
> + msg_body.passive_max_ch_time = 110;
> + msg_body.state = 0;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal update scan params channel_count %d\n",
> + msg_body.channel_count);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_update_scan_params failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_update_scan_params_rsp(wcn->hal_buf,
> + wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_update_scan_params response failed err=%d\n",
> + ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + void *buf,
> + size_t len)
> +{
> + struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
> + struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
> +
> + if (len < sizeof(*rsp))
> + return -EINVAL;
> +
> + rsp = (struct wcn36xx_hal_add_sta_self_rsp_msg *)buf;
> +
> + if (rsp->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
> + wcn36xx_warn("hal add sta self failure: %d\n",
> + rsp->status);
> + return rsp->status;
> + }
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal add sta self status %d self_sta_index %d dpu_index %d\n",
> + rsp->status, rsp->self_sta_index, rsp->dpu_index);
> +
> + priv_vif->self_sta_index = rsp->self_sta_index;
> + priv_vif->self_dpu_desc_index = rsp->dpu_index;
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif)
> +{
> + struct wcn36xx_hal_add_sta_self_req msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_STA_SELF_REQ);
> +
> + memcpy(&msg_body.self_addr, vif->addr, ETH_ALEN);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal add sta self self_addr %pM status %d\n",
> + msg_body.self_addr, msg_body.status);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_add_sta_self failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_add_sta_self_rsp(wcn,
> + vif,
> + wcn->hal_buf,
> + wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_add_sta_self response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr)
> +{
> + struct wcn36xx_hal_del_sta_self_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DEL_STA_SELF_REQ);
> +
> + memcpy(&msg_body.self_addr, addr, ETH_ALEN);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_delete_sta_self failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_delete_sta_self response failed err=%d\n",
> + ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index)
> +{
> + struct wcn36xx_hal_delete_sta_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_STA_REQ);
> +
> + msg_body.sta_index = sta_index;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal delete sta sta_index %d\n",
> + msg_body.sta_index);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_delete_sta failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_delete_sta response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_join_rsp(void *buf, size_t len)
> +{
> + struct wcn36xx_hal_join_rsp_msg *rsp;
> +
> + if (wcn36xx_smd_rsp_status_check(buf, len))
> + return -EIO;
> +
> + rsp = (struct wcn36xx_hal_join_rsp_msg *)buf;
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal rsp join status %d tx_mgmt_power %d\n",
> + rsp->status, rsp->tx_mgmt_power);
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch)
> +{
> + struct wcn36xx_hal_join_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_JOIN_REQ);
> +
> + memcpy(&msg_body.bssid, bssid, ETH_ALEN);
> + memcpy(&msg_body.self_sta_mac_addr, vif, ETH_ALEN);
> + msg_body.channel = ch;
> +
> + if (conf_is_ht40_minus(&wcn->hw->conf))
> + msg_body.secondary_channel_offset =
> + PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
> + else if (conf_is_ht40_plus(&wcn->hw->conf))
> + msg_body.secondary_channel_offset =
> + PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
> + else
> + msg_body.secondary_channel_offset =
> + PHY_SINGLE_CHANNEL_CENTERED;
> +
> + msg_body.link_state = WCN36XX_HAL_LINK_PREASSOC_STATE;
> +
> + msg_body.max_tx_power = 0xbf;
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal join req bssid %pM self_sta_mac_addr %pM channel %d link_state %d\n",
> + msg_body.bssid, msg_body.self_sta_mac_addr,
> + msg_body.channel, msg_body.link_state);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_join failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_join_rsp(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_join response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
> + const u8 *sta_mac,
> + enum wcn36xx_hal_link_state state)
> +{
> + struct wcn36xx_hal_set_link_state_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_LINK_ST_REQ);
> +
> + memcpy(&msg_body.bssid, bssid, ETH_ALEN);
> + memcpy(&msg_body.self_mac_addr, sta_mac, ETH_ALEN);
> + msg_body.state = state;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal set link state bssid %pM self_mac_addr %pM state %d\n",
> + msg_body.bssid, msg_body.self_mac_addr, msg_body.state);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_set_link_st failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_set_link_st response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx *wcn,
> + const struct wcn36xx_hal_config_sta_params *orig,
> + struct wcn36xx_hal_config_sta_params_v1 *v1)
> +{
> + /* convert orig to v1 format */
> + memcpy(&v1->bssid, orig->bssid, ETH_ALEN);
> + memcpy(&v1->mac, orig->mac, ETH_ALEN);
> + v1->aid = orig->aid;
> + v1->type = orig->type;
> + v1->listen_interval = orig->listen_interval;
> + v1->ht_capable = orig->ht_capable;
> +
> + v1->max_ampdu_size = orig->max_ampdu_size;
> + v1->max_ampdu_density = orig->max_ampdu_density;
> + v1->sgi_40mhz = orig->sgi_40mhz;
> + v1->sgi_20Mhz = orig->sgi_20Mhz;
> +
> + memcpy(&v1->supported_rates, &orig->supported_rates,
> + sizeof(orig->supported_rates));
> + v1->sta_index = orig->sta_index;
> +}
> +
> +static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
> + struct ieee80211_sta *sta,
> + void *buf,
> + size_t len)
> +{
> + struct wcn36xx_hal_config_sta_rsp_msg *rsp;
> + struct config_sta_rsp_params *params;
> + struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
> +
> + if (len < sizeof(*rsp))
> + return -EINVAL;
> +
> + rsp = (struct wcn36xx_hal_config_sta_rsp_msg *)buf;
> + params = &rsp->params;
> +
> + if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
> + wcn36xx_warn("hal config sta response failure: %d\n",
> + params->status);
> + return -EIO;
> + }
> +
> + sta_priv->sta_index = params->sta_index;
> + sta_priv->dpu_desc_index = params->dpu_index;
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config sta rsp status %d sta_index %d bssid_index %d p2p %d\n",
> + params->status, params->sta_index, params->bssid_index,
> + params->p2p);
> +
> + return 0;
> +}
> +
> +static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
> + const struct wcn36xx_hal_config_sta_req_msg *orig)
> +{
> + struct wcn36xx_hal_config_sta_req_msg_v1 msg_body;
> + struct wcn36xx_hal_config_sta_params_v1 *sta = &msg_body.sta_params;
> +
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
> +
> + wcn36xx_smd_convert_sta_to_v1(wcn, &orig->sta_params,
> + &msg_body.sta_params);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config sta v1 action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
> + sta->action, sta->sta_index, sta->bssid_index,
> + sta->bssid, sta->type, sta->mac, sta->aid);
> +
> + return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> +}
> +
> +int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta)
> +{
> + struct wcn36xx_hal_config_sta_req_msg msg;
> + struct wcn36xx_hal_config_sta_params *sta_params;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_STA_REQ);
> +
> + sta_params = &msg.sta_params;
> +
> + wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
> +
> + if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
> + ret = wcn36xx_smd_config_sta_v1(wcn, &msg);
> + } else {
> + PREPARE_HAL_BUF(wcn->hal_buf, msg);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
> + sta_params->action, sta_params->sta_index,
> + sta_params->bssid_index, sta_params->bssid,
> + sta_params->type, sta_params->mac, sta_params->aid);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
> + }
> + if (ret) {
> + wcn36xx_err("Sending hal_config_sta failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_config_sta_rsp(wcn,
> + sta,
> + wcn->hal_buf,
> + wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_config_sta response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
> + const struct wcn36xx_hal_config_bss_req_msg *orig)
> +{
> + struct wcn36xx_hal_config_bss_req_msg_v1 msg_body;
> + struct wcn36xx_hal_config_bss_params_v1 *bss = &msg_body.bss_params;
> + struct wcn36xx_hal_config_sta_params_v1 *sta = &bss->sta;
> +
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_BSS_REQ);
> +
> + /* convert orig to v1 */
> + memcpy(&msg_body.bss_params.bssid,
> + &orig->bss_params.bssid, ETH_ALEN);
> + memcpy(&msg_body.bss_params.self_mac_addr,
> + &orig->bss_params.self_mac_addr, ETH_ALEN);
> +
> + msg_body.bss_params.bss_type = orig->bss_params.bss_type;
> + msg_body.bss_params.oper_mode = orig->bss_params.oper_mode;
> + msg_body.bss_params.nw_type = orig->bss_params.nw_type;
> +
> + msg_body.bss_params.short_slot_time_supported =
> + orig->bss_params.short_slot_time_supported;
> + msg_body.bss_params.lla_coexist = orig->bss_params.lla_coexist;
> + msg_body.bss_params.llb_coexist = orig->bss_params.llb_coexist;
> + msg_body.bss_params.llg_coexist = orig->bss_params.llg_coexist;
> + msg_body.bss_params.ht20_coexist = orig->bss_params.ht20_coexist;
> + msg_body.bss_params.lln_non_gf_coexist =
> + orig->bss_params.lln_non_gf_coexist;
> +
> + msg_body.bss_params.lsig_tx_op_protection_full_support =
> + orig->bss_params.lsig_tx_op_protection_full_support;
> + msg_body.bss_params.rifs_mode = orig->bss_params.rifs_mode;
> + msg_body.bss_params.beacon_interval = orig->bss_params.beacon_interval;
> + msg_body.bss_params.dtim_period = orig->bss_params.dtim_period;
> + msg_body.bss_params.tx_channel_width_set =
> + orig->bss_params.tx_channel_width_set;
> + msg_body.bss_params.oper_channel = orig->bss_params.oper_channel;
> + msg_body.bss_params.ext_channel = orig->bss_params.ext_channel;
> +
> + msg_body.bss_params.reserved = orig->bss_params.reserved;
> +
> + memcpy(&msg_body.bss_params.ssid,
> + &orig->bss_params.ssid,
> + sizeof(orig->bss_params.ssid));
> +
> + msg_body.bss_params.action = orig->bss_params.action;
> + msg_body.bss_params.rateset = orig->bss_params.rateset;
> + msg_body.bss_params.ht = orig->bss_params.ht;
> + msg_body.bss_params.obss_prot_enabled =
> + orig->bss_params.obss_prot_enabled;
> + msg_body.bss_params.rmf = orig->bss_params.rmf;
> + msg_body.bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode;
> + msg_body.bss_params.dual_cts_protection =
> + orig->bss_params.dual_cts_protection;
> +
> + msg_body.bss_params.max_probe_resp_retry_limit =
> + orig->bss_params.max_probe_resp_retry_limit;
> + msg_body.bss_params.hidden_ssid = orig->bss_params.hidden_ssid;
> + msg_body.bss_params.proxy_probe_resp =
> + orig->bss_params.proxy_probe_resp;
> + msg_body.bss_params.edca_params_valid =
> + orig->bss_params.edca_params_valid;
> +
> + memcpy(&msg_body.bss_params.acbe,
> + &orig->bss_params.acbe,
> + sizeof(orig->bss_params.acbe));
> + memcpy(&msg_body.bss_params.acbk,
> + &orig->bss_params.acbk,
> + sizeof(orig->bss_params.acbk));
> + memcpy(&msg_body.bss_params.acvi,
> + &orig->bss_params.acvi,
> + sizeof(orig->bss_params.acvi));
> + memcpy(&msg_body.bss_params.acvo,
> + &orig->bss_params.acvo,
> + sizeof(orig->bss_params.acvo));
> +
> + msg_body.bss_params.ext_set_sta_key_param_valid =
> + orig->bss_params.ext_set_sta_key_param_valid;
> +
> + memcpy(&msg_body.bss_params.ext_set_sta_key_param,
> + &orig->bss_params.ext_set_sta_key_param,
> + sizeof(orig->bss_params.acvo));
> +
> + msg_body.bss_params.wcn36xx_hal_persona =
> + orig->bss_params.wcn36xx_hal_persona;
> + msg_body.bss_params.spectrum_mgt_enable =
> + orig->bss_params.spectrum_mgt_enable;
> + msg_body.bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power;
> + msg_body.bss_params.max_tx_power = orig->bss_params.max_tx_power;
> +
> + wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta,
> + &msg_body.bss_params.sta);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config bss v1 bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n",
> + bss->bssid, bss->self_mac_addr, bss->bss_type,
> + bss->oper_mode, bss->nw_type);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n",
> + sta->bssid, sta->action, sta->sta_index,
> + sta->bssid_index, sta->aid, sta->type, sta->mac);
> +
> + return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> +}
> +
> +
> +static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + void *buf,
> + size_t len)
> +{
> + struct wcn36xx_hal_config_bss_rsp_msg *rsp;
> + struct wcn36xx_hal_config_bss_rsp_params *params;
> + struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
> +
> + if (len < sizeof(*rsp))
> + return -EINVAL;
> +
> + rsp = (struct wcn36xx_hal_config_bss_rsp_msg *)buf;
> + params = &rsp->bss_rsp_params;
> +
> + if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
> + wcn36xx_warn("hal config bss response failure: %d\n",
> + params->status);
> + return -EIO;
> + }
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config bss rsp status %d bss_idx %d dpu_desc_index %d"
> + " sta_idx %d self_idx %d bcast_idx %d mac %pM"
> + " power %d ucast_dpu_signature %d\n",
> + params->status, params->bss_index, params->dpu_desc_index,
> + params->bss_sta_index, params->bss_self_sta_index,
> + params->bss_bcast_sta_idx, params->mac,
> + params->tx_mgmt_power, params->ucast_dpu_signature);
> +
> + priv_vif->bss_index = params->bss_index;
> +
> + if (priv_vif->sta) {
> + priv_vif->sta->bss_sta_index = params->bss_sta_index;
> + priv_vif->sta->bss_dpu_desc_index = params->dpu_desc_index;
> + }
> +
> + priv_vif->ucast_dpu_signature = params->ucast_dpu_signature;
> +
> + return 0;
> +}
> +
> +int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta, const u8 *bssid,
> + bool update)
> +{
> + struct wcn36xx_hal_config_bss_req_msg msg;
> + struct wcn36xx_hal_config_bss_params *bss;
> + struct wcn36xx_hal_config_sta_params *sta_params;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_BSS_REQ);
> +
> + bss = &msg.bss_params;
> + sta_params = &bss->sta;
> +
> + WARN_ON(is_zero_ether_addr(bssid));
> +
> + memcpy(&bss->bssid, bssid, ETH_ALEN);
> +
> + memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN);
> +
> + if (vif->type == NL80211_IFTYPE_STATION) {
> + bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE;
> +
> + /* STA */
> + bss->oper_mode = 1;
> + bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_MODE;
> + } else if (vif->type == NL80211_IFTYPE_AP) {
> + bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE;
> +
> + /* AP */
> + bss->oper_mode = 0;
> + bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_SAP_MODE;
> + } else if (vif->type == NL80211_IFTYPE_ADHOC ||
> + vif->type == NL80211_IFTYPE_MESH_POINT) {
> + bss->bss_type = WCN36XX_HAL_IBSS_MODE;
> +
> + /* STA */
> + bss->oper_mode = 1;
> + } else {
> + wcn36xx_warn("Unknown type for bss config: %d\n", vif->type);
> + }
> +
> + if (vif->type == NL80211_IFTYPE_STATION)
> + wcn36xx_smd_set_bss_nw_type(wcn, sta, bss);
> + else
> + bss->nw_type = WCN36XX_HAL_11N_NW_TYPE;
> +
> + bss->short_slot_time_supported = vif->bss_conf.use_short_slot;
> + bss->lla_coexist = 0;
> + bss->llb_coexist = 0;
> + bss->llg_coexist = 0;
> + bss->rifs_mode = 0;
> + bss->beacon_interval = vif->bss_conf.beacon_int;
> + bss->dtim_period = vif_priv->dtim_period;
> +
> + wcn36xx_smd_set_bss_ht_params(vif, sta, bss);
> +
> + bss->oper_channel = WCN36XX_HW_CHANNEL(wcn);
> +
> + if (conf_is_ht40_minus(&wcn->hw->conf))
> + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_BELOW;
> + else if (conf_is_ht40_plus(&wcn->hw->conf))
> + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
> + else
> + bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE;
> +
> + bss->reserved = 0;
> + wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
> +
> + /* wcn->ssid is only valid in AP and IBSS mode */
> + bss->ssid.length = vif_priv->ssid.length;
> + memcpy(bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length);
> +
> + bss->obss_prot_enabled = 0;
> + bss->rmf = 0;
> + bss->max_probe_resp_retry_limit = 0;
> + bss->hidden_ssid = vif->bss_conf.hidden_ssid;
> + bss->proxy_probe_resp = 0;
> + bss->edca_params_valid = 0;
> +
> + /* FIXME: set acbe, acbk, acvi and acvo */
> +
> + bss->ext_set_sta_key_param_valid = 0;
> +
> + /* FIXME: set ext_set_sta_key_param */
> +
> + bss->spectrum_mgt_enable = 0;
> + bss->tx_mgmt_power = 0;
> + bss->max_tx_power = WCN36XX_MAX_POWER(wcn);
> +
> + bss->action = update;
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n",
> + bss->bssid, bss->self_mac_addr, bss->bss_type,
> + bss->oper_mode, bss->nw_type);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n",
> + sta_params->bssid, sta_params->action,
> + sta_params->sta_index, sta_params->bssid_index,
> + sta_params->aid, sta_params->type,
> + sta_params->mac);
> +
> + if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
> + ret = wcn36xx_smd_config_bss_v1(wcn, &msg);
> + } else {
> + PREPARE_HAL_BUF(wcn->hal_buf, msg);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
> + }
> + if (ret) {
> + wcn36xx_err("Sending hal_config_bss failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_config_bss_rsp(wcn,
> + vif,
> + wcn->hal_buf,
> + wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_config_bss response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif)
> +{
> + struct wcn36xx_hal_delete_bss_req_msg msg_body;
> + struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_BSS_REQ);
> +
> + msg_body.bss_index = priv_vif->bss_index;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "hal delete bss %d\n", msg_body.bss_index);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_delete_bss failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_delete_bss response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct sk_buff *skb_beacon, u16 tim_off,
> + u16 p2p_off)
> +{
> + struct wcn36xx_hal_send_beacon_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
> +
> + /* TODO need to find out why this is needed? */
> + msg_body.beacon_length = skb_beacon->len + 6;
> +
> + if (BEACON_TEMPLATE_SIZE > msg_body.beacon_length) {
> + memcpy(&msg_body.beacon, &skb_beacon->len, sizeof(u32));
> + memcpy(&(msg_body.beacon[4]), skb_beacon->data,
> + skb_beacon->len);
> + } else {
> + wcn36xx_err("Beacon is to big: beacon size=%d\n",
> + msg_body.beacon_length);
> + return -ENOMEM;
> + }
> + memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
> +
> + /* TODO need to find out why this is needed? */
> + msg_body.tim_ie_offset = tim_off+4;
> + msg_body.p2p_ie_offset = p2p_off;
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal send beacon beacon_length %d\n",
> + msg_body.beacon_length);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_send_beacon failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_send_beacon response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + struct sk_buff *skb)
> +{
> + struct wcn36xx_hal_send_probe_resp_req_msg msg;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg, WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ);
> +
> + if (skb->len > BEACON_TEMPLATE_SIZE) {
> + wcn36xx_warn("probe response template is too big: %d\n",
> + skb->len);
> + return -E2BIG;
> + }
> +
> + msg.probe_resp_template_len = skb->len;
> + memcpy(&msg.probe_resp_template, skb->data, skb->len);
> +
> + memcpy(msg.bssid, vif->addr, ETH_ALEN);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg);
> +
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "hal update probe rsp len %d bssid %pM\n",
> + msg.probe_resp_template_len, msg.bssid);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_update_proberesp_tmpl failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_update_proberesp_tmpl response failed err=%d\n",
> + ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 keylen,
> + u8 *key,
> + u8 sta_index)
> +{
> + struct wcn36xx_hal_set_sta_key_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_STAKEY_REQ);
> +
> + msg_body.set_sta_key_params.sta_index = sta_index;
> + msg_body.set_sta_key_params.enc_type = enc_type;
> +
> + msg_body.set_sta_key_params.key[0].id = keyidx;
> + msg_body.set_sta_key_params.key[0].unicast = 1;
> + msg_body.set_sta_key_params.key[0].direction = WCN36XX_HAL_TX_RX;
> + msg_body.set_sta_key_params.key[0].pae_role = 0;
> + msg_body.set_sta_key_params.key[0].length = keylen;
> + memcpy(msg_body.set_sta_key_params.key[0].key, key, keylen);
> + msg_body.set_sta_key_params.single_tid_rc = 1;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_set_stakey failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_set_stakey response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 keylen,
> + u8 *key)
> +{
> + struct wcn36xx_hal_set_bss_key_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_BSSKEY_REQ);
> + msg_body.bss_idx = 0;
> + msg_body.enc_type = enc_type;
> + msg_body.num_keys = 1;
> + msg_body.keys[0].id = keyidx;
> + msg_body.keys[0].unicast = 0;
> + msg_body.keys[0].direction = WCN36XX_HAL_RX_ONLY;
> + msg_body.keys[0].pae_role = 0;
> + msg_body.keys[0].length = keylen;
> + memcpy(msg_body.keys[0].key, key, keylen);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_set_bsskey failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_set_bsskey response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 sta_index)
> +{
> + struct wcn36xx_hal_remove_sta_key_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_STAKEY_REQ);
> +
> + msg_body.sta_idx = sta_index;
> + msg_body.enc_type = enc_type;
> + msg_body.key_id = keyidx;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_remove_stakey failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_remove_stakey response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx)
> +{
> + struct wcn36xx_hal_remove_bss_key_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_BSSKEY_REQ);
> + msg_body.bss_idx = 0;
> + msg_body.enc_type = enc_type;
> + msg_body.key_id = keyidx;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_remove_bsskey failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_remove_bsskey response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
> +{
> + struct wcn36xx_hal_enter_bmps_req_msg msg_body;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_ENTER_BMPS_REQ);
> +
> + msg_body.bss_index = vif_priv->bss_index;
> + msg_body.tbtt = vif->bss_conf.sync_tsf;
> + msg_body.dtim_period = vif_priv->dtim_period;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_enter_bmps failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_enter_bmps response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
> +{
> + struct wcn36xx_hal_enter_bmps_req_msg msg_body;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_EXIT_BMPS_REQ);
> +
> + msg_body.bss_index = vif_priv->bss_index;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_exit_bmps failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_exit_bmps response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim)
> +{
> + struct wcn36xx_hal_set_power_params_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_POWER_PARAMS_REQ);
> +
> + /*
> + * When host is down ignore every second dtim
> + */
> + if (ignore_dtim) {
> + msg_body.ignore_dtim = 1;
> + msg_body.dtim_period = 2;
> + }
> + msg_body.listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_set_power_params failed\n");
> + goto out;
> + }
> +
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +/* Notice: This function should be called after associated, or else it
> + * will be invalid
> + */
> +int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + int packet_type)
> +{
> + struct wcn36xx_hal_keep_alive_req_msg msg_body;
> + struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_KEEP_ALIVE_REQ);
> +
> + if (packet_type == WCN36XX_HAL_KEEP_ALIVE_NULL_PKT) {
> + msg_body.bss_index = vif_priv->bss_index;
> + msg_body.packet_type = WCN36XX_HAL_KEEP_ALIVE_NULL_PKT;
> + msg_body.time_period = WCN36XX_KEEP_ALIVE_TIME_PERIOD;
> + } else if (packet_type == WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP) {
> + /* TODO: it also support ARP response type */
> + } else {
> + wcn36xx_warn("unknow keep alive packet type %d\n", packet_type);
> + return -EINVAL;
> + }
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_exit_bmps failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_exit_bmps response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
> + u32 arg3, u32 arg4, u32 arg5)
> +{
> + struct wcn36xx_hal_dump_cmd_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DUMP_COMMAND_REQ);
> +
> + msg_body.arg1 = arg1;
> + msg_body.arg2 = arg2;
> + msg_body.arg3 = arg3;
> + msg_body.arg4 = arg4;
> + msg_body.arg5 = arg5;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_dump_cmd failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_dump_cmd response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static inline void set_feat_caps(u32 *bitmap,
> + enum place_holder_in_cap_bitmap cap)
> +{
> + int arr_idx, bit_idx;
> +
> + if (cap < 0 || cap > 127) {
> + wcn36xx_warn("error cap idx %d\n", cap);
> + return;
> + }
> +
> + arr_idx = cap / 32;
> + bit_idx = cap % 32;
> + bitmap[arr_idx] |= (1 << bit_idx);
> +}
> +
> +static inline int get_feat_caps(u32 *bitmap,
> + enum place_holder_in_cap_bitmap cap)
> +{
> + int arr_idx, bit_idx;
> + int ret = 0;
> +
> + if (cap < 0 || cap > 127) {
> + wcn36xx_warn("error cap idx %d\n", cap);
> + return -EINVAL;
> + }
> +
> + arr_idx = cap / 32;
> + bit_idx = cap % 32;
> + ret = (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0;
> + return ret;
> +}
> +
> +static inline void clear_feat_caps(u32 *bitmap,
> + enum place_holder_in_cap_bitmap cap)
> +{
> + int arr_idx, bit_idx;
> +
> + if (cap < 0 || cap > 127) {
> + wcn36xx_warn("error cap idx %d\n", cap);
> + return;
> + }
> +
> + arr_idx = cap / 32;
> + bit_idx = cap % 32;
> + bitmap[arr_idx] &= ~(1 << bit_idx);
> +}
> +
> +int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_feat_caps_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ);
> +
> + set_feat_caps(msg_body.feat_caps, STA_POWERSAVE);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_feature_caps_exchange failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_feature_caps_exchange response failed err=%d\n",
> + ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
> + struct ieee80211_sta *sta,
> + u16 tid,
> + u16 *ssn,
> + u8 direction,
> + u8 sta_index)
> +{
> + struct wcn36xx_hal_add_ba_session_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BA_SESSION_REQ);
> +
> + msg_body.sta_index = sta_index;
> + memcpy(&msg_body.mac_addr, sta->addr, ETH_ALEN);
> + msg_body.dialog_token = 0x10;
> + msg_body.tid = tid;
> +
> + /* Immediate BA because Delayed BA is not supported */
> + msg_body.policy = 1;
> + msg_body.buffer_size = WCN36XX_AGGR_BUFFER_SIZE;
> + msg_body.timeout = 0;
> + if (ssn)
> + msg_body.ssn = *ssn;
> + msg_body.direction = direction;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_add_ba_session failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_add_ba_session response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_add_ba(struct wcn36xx *wcn)
> +{
> + struct wcn36xx_hal_add_ba_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BA_REQ);
> +
> + msg_body.session_id = 0;
> + msg_body.win_size = WCN36XX_AGGR_BUFFER_SIZE;
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_add_ba failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_add_ba response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index)
> +{
> + struct wcn36xx_hal_del_ba_req_msg msg_body;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_DEL_BA_REQ);
> +
> + msg_body.sta_index = sta_index;
> + msg_body.tid = tid;
> + msg_body.direction = 0;
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_del_ba failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_del_ba response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index)
> +{
> + struct wcn36xx_hal_trigger_ba_req_msg msg_body;
> + struct wcn36xx_hal_trigget_ba_req_candidate *candidate;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_TRIGGER_BA_REQ);
> +
> + msg_body.session_id = 0;
> + msg_body.candidate_cnt = 1;
> + msg_body.header.len += sizeof(*candidate);
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + candidate = (struct wcn36xx_hal_trigget_ba_req_candidate *)
> + (wcn->hal_buf + sizeof(msg_body));
> + candidate->sta_index = sta_index;
> + candidate->tid_bitmap = 1;
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_trigger_ba failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_trigger_ba response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +
> +static int wcn36xx_smd_tx_compl_ind(struct wcn36xx *wcn, void *buf, size_t len)
> +{
> + struct wcn36xx_hal_tx_compl_ind_msg *rsp = buf;
> +
> + if (len != sizeof(*rsp)) {
> + wcn36xx_warn("Bad TX complete indication\n");
> + return -EIO;
> + }
> +
> + wcn36xx_dxe_tx_ack_ind(wcn, rsp->status);
> +
> + return 0;
> +}
> +
> +static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn,
> + void *buf,
> + size_t len)
> +{
> + struct wcn36xx_hal_missed_beacon_ind_msg *rsp = buf;
> + struct ieee80211_vif *vif = NULL;
> + struct wcn36xx_vif *tmp;
> +
> + /* Old FW does not have bss index */
> + if (wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
> + list_for_each_entry(tmp, &wcn->vif_list, list) {
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n",
> + tmp->bss_index);
> + vif = container_of((void *)tmp,
> + struct ieee80211_vif,
> + drv_priv);
> + ieee80211_connection_loss(vif);
> + }
> + return 0;
> + }
> +
> + if (len != sizeof(*rsp)) {
> + wcn36xx_warn("Corrupted missed beacon indication\n");
> + return -EIO;
> + }
> +
> + list_for_each_entry(tmp, &wcn->vif_list, list) {
> + if (tmp->bss_index == rsp->bss_index) {
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n",
> + rsp->bss_index);
> + vif = container_of((void *)tmp,
> + struct ieee80211_vif,
> + drv_priv);
> + ieee80211_connection_loss(vif);
> + return 0;
> + }
> + }
> +
> + wcn36xx_warn("BSS index %d not found\n", rsp->bss_index);
> + return -ENOENT;
> +}
> +
> +static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
> + void *buf,
> + size_t len)
> +{
> + struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
> + struct wcn36xx_vif *tmp;
> + struct ieee80211_sta *sta = NULL;
> +
> + if (len != sizeof(*rsp)) {
> + wcn36xx_warn("Corrupted delete sta indication\n");
> + return -EIO;
> + }
> +
> + list_for_each_entry(tmp, &wcn->vif_list, list) {
> + if (sta && (tmp->sta->sta_index == rsp->sta_id)) {
> + sta = container_of((void *)tmp->sta,
> + struct ieee80211_sta,
> + drv_priv);
> + wcn36xx_dbg(WCN36XX_DBG_HAL,
> + "delete station indication %pM index %d\n",
> + rsp->addr2,
> + rsp->sta_id);
> + ieee80211_report_low_ack(sta, 0);
> + return 0;
> + }
> + }
> +
> + wcn36xx_warn("STA with addr %pM and index %d not found\n",
> + rsp->addr2,
> + rsp->sta_id);
> + return -ENOENT;
> +}
> +
> +int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value)
> +{
> + struct wcn36xx_hal_update_cfg_req_msg msg_body, *body;
> + size_t len;
> + int ret = 0;
> +
> + mutex_lock(&wcn->hal_mutex);
> + INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_CFG_REQ);
> +
> + PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
> +
> + body = (struct wcn36xx_hal_update_cfg_req_msg *) wcn->hal_buf;
> + len = msg_body.header.len;
> +
> + put_cfg_tlv_u32(wcn, &len, cfg_id, value);
> + body->header.len = len;
> + body->len = len - sizeof(*body);
> +
> + ret = wcn36xx_smd_send_and_wait(wcn, body->header.len);
> + if (ret) {
> + wcn36xx_err("Sending hal_update_cfg failed\n");
> + goto out;
> + }
> + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
> + if (ret) {
> + wcn36xx_err("hal_update_cfg response failed err=%d\n", ret);
> + goto out;
> + }
> +out:
> + mutex_unlock(&wcn->hal_mutex);
> + return ret;
> +}
> +static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
> +{
> + struct wcn36xx_hal_msg_header *msg_header = buf;
> + struct wcn36xx_hal_ind_msg *msg_ind;
> + wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "SMD <<< ", buf, len);
> +
> + switch (msg_header->msg_type) {
> + case WCN36XX_HAL_START_RSP:
> + case WCN36XX_HAL_CONFIG_STA_RSP:
> + case WCN36XX_HAL_CONFIG_BSS_RSP:
> + case WCN36XX_HAL_ADD_STA_SELF_RSP:
> + case WCN36XX_HAL_STOP_RSP:
> + case WCN36XX_HAL_DEL_STA_SELF_RSP:
> + case WCN36XX_HAL_DELETE_STA_RSP:
> + case WCN36XX_HAL_INIT_SCAN_RSP:
> + case WCN36XX_HAL_START_SCAN_RSP:
> + case WCN36XX_HAL_END_SCAN_RSP:
> + case WCN36XX_HAL_FINISH_SCAN_RSP:
> + case WCN36XX_HAL_DOWNLOAD_NV_RSP:
> + case WCN36XX_HAL_DELETE_BSS_RSP:
> + case WCN36XX_HAL_SEND_BEACON_RSP:
> + case WCN36XX_HAL_SET_LINK_ST_RSP:
> + case WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_RSP:
> + case WCN36XX_HAL_SET_BSSKEY_RSP:
> + case WCN36XX_HAL_SET_STAKEY_RSP:
> + case WCN36XX_HAL_RMV_STAKEY_RSP:
> + case WCN36XX_HAL_RMV_BSSKEY_RSP:
> + case WCN36XX_HAL_ENTER_BMPS_RSP:
> + case WCN36XX_HAL_SET_POWER_PARAMS_RSP:
> + case WCN36XX_HAL_EXIT_BMPS_RSP:
> + case WCN36XX_HAL_KEEP_ALIVE_RSP:
> + case WCN36XX_HAL_DUMP_COMMAND_RSP:
> + case WCN36XX_HAL_ADD_BA_SESSION_RSP:
> + case WCN36XX_HAL_ADD_BA_RSP:
> + case WCN36XX_HAL_DEL_BA_RSP:
> + case WCN36XX_HAL_TRIGGER_BA_RSP:
> + case WCN36XX_HAL_UPDATE_CFG_RSP:
> + case WCN36XX_HAL_JOIN_RSP:
> + case WCN36XX_HAL_UPDATE_SCAN_PARAM_RSP:
> + case WCN36XX_HAL_CH_SWITCH_RSP:
> + case WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_RSP:
> + memcpy(wcn->hal_buf, buf, len);
> + wcn->hal_rsp_len = len;
> + complete(&wcn->hal_rsp_compl);
> + break;
> +
> + case WCN36XX_HAL_OTA_TX_COMPL_IND:
> + case WCN36XX_HAL_MISSED_BEACON_IND:
> + case WCN36XX_HAL_DELETE_STA_CONTEXT_IND:
> + mutex_lock(&wcn->hal_ind_mutex);
> + msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL);
> + msg_ind->msg_len = len;
> + msg_ind->msg = kmalloc(len, GFP_KERNEL);
> + memcpy(msg_ind->msg, buf, len);
> + list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
> + queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
> + wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n");
> + mutex_unlock(&wcn->hal_ind_mutex);
> + break;
> + default:
> + wcn36xx_err("SMD_EVENT (%d) not supported\n",
> + msg_header->msg_type);
> + }
> +}
> +static void wcn36xx_ind_smd_work(struct work_struct *work)
> +{
> + struct wcn36xx *wcn =
> + container_of(work, struct wcn36xx, hal_ind_work);
> + struct wcn36xx_hal_msg_header *msg_header;
> + struct wcn36xx_hal_ind_msg *hal_ind_msg;
> +
> + mutex_lock(&wcn->hal_ind_mutex);
> +
> + hal_ind_msg = list_first_entry(&wcn->hal_ind_queue,
> + struct wcn36xx_hal_ind_msg,
> + list);
> +
> + msg_header = (struct wcn36xx_hal_msg_header *)hal_ind_msg->msg;
> +
> + switch (msg_header->msg_type) {
> + case WCN36XX_HAL_OTA_TX_COMPL_IND:
> + wcn36xx_smd_tx_compl_ind(wcn,
> + hal_ind_msg->msg,
> + hal_ind_msg->msg_len);
> + break;
> + case WCN36XX_HAL_MISSED_BEACON_IND:
> + wcn36xx_smd_missed_beacon_ind(wcn,
> + hal_ind_msg->msg,
> + hal_ind_msg->msg_len);
> + break;
> + case WCN36XX_HAL_DELETE_STA_CONTEXT_IND:
> + wcn36xx_smd_delete_sta_context_ind(wcn,
> + hal_ind_msg->msg,
> + hal_ind_msg->msg_len);
> + break;
> + default:
> + wcn36xx_err("SMD_EVENT (%d) not supported\n",
> + msg_header->msg_type);
> + }
> + list_del(wcn->hal_ind_queue.next);
> + kfree(hal_ind_msg->msg);
> + kfree(hal_ind_msg);
> + mutex_unlock(&wcn->hal_ind_mutex);
> +}
> +int wcn36xx_smd_open(struct wcn36xx *wcn)
> +{
> + int ret = 0;
> + wcn->hal_ind_wq = create_freezable_workqueue("wcn36xx_smd_ind");
> + if (!wcn->hal_ind_wq) {
> + wcn36xx_err("failed to allocate wq\n");
> + ret = -ENOMEM;
> + goto out;
> + }
> + INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work);
> + INIT_LIST_HEAD(&wcn->hal_ind_queue);
> + mutex_init(&wcn->hal_ind_mutex);
> +
> + ret = wcn->ctrl_ops->open(wcn, wcn36xx_smd_rsp_process);
> + if (ret) {
> + wcn36xx_err("failed to open control channel\n");
> + goto free_wq;
> + }
> +
> + return ret;
> +
> +free_wq:
> + destroy_workqueue(wcn->hal_ind_wq);
> +out:
> + return ret;
> +}
> +
> +void wcn36xx_smd_close(struct wcn36xx *wcn)
> +{
> + wcn->ctrl_ops->close();
> + destroy_workqueue(wcn->hal_ind_wq);
> + mutex_destroy(&wcn->hal_ind_mutex);
> +}
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h
> new file mode 100644
> index 0000000..e7c3901
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.h
> @@ -0,0 +1,127 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _SMD_H_
> +#define _SMD_H_
> +
> +#include "wcn36xx.h"
> +
> +/* Max shared size is 4k but we take less.*/
> +#define WCN36XX_NV_FRAGMENT_SIZE 3072
> +
> +#define WCN36XX_HAL_BUF_SIZE 4096
> +
> +#define HAL_MSG_TIMEOUT 200
> +#define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400
> +#define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200
> +/* The PNO version info be contained in the rsp msg */
> +#define WCN36XX_FW_MSG_PNO_VERSION_MASK 0x8000
> +
> +enum wcn36xx_fw_msg_result {
> + WCN36XX_FW_MSG_RESULT_SUCCESS = 0,
> + WCN36XX_FW_MSG_RESULT_SUCCESS_SYNC = 1,
> +
> + WCN36XX_FW_MSG_RESULT_MEM_FAIL = 5,
> +};
> +
> +/******************************/
> +/* SMD requests and responses */
> +/******************************/
> +struct wcn36xx_fw_msg_status_rsp {
> + u32 status;
> +} __packed;
> +
> +struct wcn36xx_hal_ind_msg {
> + struct list_head list;
> + u8 *msg;
> + size_t msg_len;
> +};
> +
> +struct wcn36xx;
> +
> +int wcn36xx_smd_open(struct wcn36xx *wcn);
> +void wcn36xx_smd_close(struct wcn36xx *wcn);
> +
> +int wcn36xx_smd_load_nv(struct wcn36xx *wcn);
> +int wcn36xx_smd_start(struct wcn36xx *wcn);
> +int wcn36xx_smd_stop(struct wcn36xx *wcn);
> +int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode);
> +int wcn36xx_smd_start_scan(struct wcn36xx *wcn);
> +int wcn36xx_smd_end_scan(struct wcn36xx *wcn);
> +int wcn36xx_smd_finish_scan(struct wcn36xx *wcn,
> + enum wcn36xx_hal_sys_mode mode);
> +int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn);
> +int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif);
> +int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr);
> +int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index);
> +int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch);
> +int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
> + const u8 *sta_mac,
> + enum wcn36xx_hal_link_state state);
> +int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta, const u8 *bssid,
> + bool update);
> +int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif);
> +int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta);
> +int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
> + struct sk_buff *skb_beacon, u16 tim_off,
> + u16 p2p_off);
> +int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif, int ch);
> +int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + struct sk_buff *skb);
> +int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 keylen,
> + u8 *key,
> + u8 sta_index);
> +int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 keylen,
> + u8 *key);
> +int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx,
> + u8 sta_index);
> +int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
> + enum ani_ed_type enc_type,
> + u8 keyidx);
> +int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
> +int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
> +int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim);
> +int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
> + struct ieee80211_vif *vif,
> + int packet_type);
> +int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
> + u32 arg3, u32 arg4, u32 arg5);
> +int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn);
> +
> +int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
> + struct ieee80211_sta *sta,
> + u16 tid,
> + u16 *ssn,
> + u8 direction,
> + u8 sta_index);
> +int wcn36xx_smd_add_ba(struct wcn36xx *wcn);
> +int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index);
> +int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index);
> +
> +int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value);
> +#endif /* _SMD_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
> new file mode 100644
> index 0000000..b2b60e3
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
> @@ -0,0 +1,284 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include "txrx.h"
> +
> +static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
> +{
> + return 100 - ((bd->phy_stat0 >> 24) & 0xff);
> +}
> +
> +int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
> +{
> + struct ieee80211_rx_status status;
> + struct ieee80211_hdr *hdr;
> + struct wcn36xx_rx_bd *bd;
> + u16 fc, sn;
> +
> + /*
> + * All fields must be 0, otherwise it can lead to
> + * unexpected consequences.
> + */
> + memset(&status, 0, sizeof(status));
> +
> + bd = (struct wcn36xx_rx_bd *)skb->data;
> + buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
> + wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
> + "BD <<< ", (char *)bd,
> + sizeof(struct wcn36xx_rx_bd));
> +
> + skb_put(skb, bd->pdu.mpdu_header_off + bd->pdu.mpdu_len);
> + skb_pull(skb, bd->pdu.mpdu_header_off);
> +
> + status.mactime = 10;
> + status.freq = WCN36XX_CENTER_FREQ(wcn);
> + status.band = WCN36XX_BAND(wcn);
> + status.signal = -get_rssi0(bd);
> + status.antenna = 1;
> + status.rate_idx = 1;
> + status.flag = 0;
> + status.rx_flags = 0;
> + status.flag |= RX_FLAG_IV_STRIPPED |
> + RX_FLAG_MMIC_STRIPPED |
> + RX_FLAG_DECRYPTED;
> +
> + wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x status->vendor_radiotap_len=%x\n",
> + status.flag, status.vendor_radiotap_len);
> +
> + memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
> +
> + hdr = (struct ieee80211_hdr *) skb->data;
> + fc = __le16_to_cpu(hdr->frame_control);
> + sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl));
> +
> + if (ieee80211_is_beacon(hdr->frame_control)) {
> + wcn36xx_dbg(WCN36XX_DBG_BEACON, "beacon skb %p len %d fc %04x sn %d\n",
> + skb, skb->len, fc, sn);
> + wcn36xx_dbg_dump(WCN36XX_DBG_BEACON_DUMP, "SKB <<< ",
> + (char *)skb->data, skb->len);
> + } else {
> + wcn36xx_dbg(WCN36XX_DBG_RX, "rx skb %p len %d fc %04x sn %d\n",
> + skb, skb->len, fc, sn);
> + wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP, "SKB <<< ",
> + (char *)skb->data, skb->len);
> + }
> +
> + ieee80211_rx_irqsafe(wcn->hw, skb);
> +
> + return 0;
> +}
> +
> +static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd,
> + u32 mpdu_header_len,
> + u32 len,
> + u16 tid)
> +{
> + bd->pdu.mpdu_header_len = mpdu_header_len;
> + bd->pdu.mpdu_header_off = sizeof(*bd);
> + bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len +
> + bd->pdu.mpdu_header_off;
> + bd->pdu.mpdu_len = len;
> + bd->pdu.tid = tid;
> +}
> +
> +static inline struct wcn36xx_vif *get_vif_by_addr(struct wcn36xx *wcn,
> + u8 *addr)
> +{
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_vif *vif = NULL;
> + list_for_each_entry(vif_priv, &wcn->vif_list, list) {
> + vif = container_of((void *)vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> + if (memcmp(vif->addr, addr, ETH_ALEN) == 0)
> + return vif_priv;
> + }
> + wcn36xx_warn("vif %pM not found\n", addr);
> + return NULL;
> +}
> +static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
> + struct wcn36xx *wcn,
> + struct wcn36xx_vif **vif_priv,
> + struct wcn36xx_sta *sta_priv,
> + struct ieee80211_hdr *hdr,
> + bool bcast)
> +{
> + struct ieee80211_vif *vif = NULL;
> + struct wcn36xx_vif *__vif_priv = NULL;
> + bd->bd_rate = WCN36XX_BD_RATE_DATA;
> +
> + /*
> + * For not unicast frames mac80211 will not set sta pointer so use
> + * self_sta_index instead.
> + */
> + if (sta_priv) {
> + __vif_priv = sta_priv->vif;
> + vif = container_of((void *)__vif_priv,
> + struct ieee80211_vif,
> + drv_priv);
> +
> + if (vif->type == NL80211_IFTYPE_STATION) {
> + bd->sta_index = sta_priv->bss_sta_index;
> + bd->dpu_desc_idx = sta_priv->bss_dpu_desc_index;
> + } else if (vif->type == NL80211_IFTYPE_AP ||
> + vif->type == NL80211_IFTYPE_ADHOC ||
> + vif->type == NL80211_IFTYPE_MESH_POINT) {
> + bd->sta_index = sta_priv->sta_index;
> + bd->dpu_desc_idx = sta_priv->dpu_desc_index;
> + }
> + } else {
> + __vif_priv = get_vif_by_addr(wcn, hdr->addr2);
> + bd->sta_index = __vif_priv->self_sta_index;
> + bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
> + }
> +
> + bd->dpu_sign = __vif_priv->ucast_dpu_signature;
> +
> + if (ieee80211_is_nullfunc(hdr->frame_control) ||
> + (sta_priv && !sta_priv->is_data_encrypted))
> + bd->dpu_ne = 1;
> +
> + if (bcast) {
> + bd->ub = 1;
> + bd->ack_policy = 1;
> + }
> + *vif_priv = __vif_priv;
> +}
> +
> +static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
> + struct wcn36xx *wcn,
> + struct wcn36xx_vif **vif_priv,
> + struct ieee80211_hdr *hdr,
> + bool bcast)
> +{
> + struct wcn36xx_vif *__vif_priv =
> + get_vif_by_addr(wcn, hdr->addr2);
> + bd->sta_index = __vif_priv->self_sta_index;
> + bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
> + bd->dpu_ne = 1;
> +
> + /* default rate for unicast */
> + if (ieee80211_is_mgmt(hdr->frame_control))
> + bd->bd_rate = (WCN36XX_BAND(wcn) == IEEE80211_BAND_5GHZ) ?
> + WCN36XX_BD_RATE_CTRL :
> + WCN36XX_BD_RATE_MGMT;
> + else if (ieee80211_is_ctl(hdr->frame_control))
> + bd->bd_rate = WCN36XX_BD_RATE_CTRL;
> + else
> + wcn36xx_warn("frame control type unknown\n");
> +
> + /*
> + * In joining state trick hardware that probe is sent as
> + * unicast even if address is broadcast.
> + */
> + if (__vif_priv->is_joining &&
> + ieee80211_is_probe_req(hdr->frame_control))
> + bcast = false;
> +
> + if (bcast) {
> + /* broadcast */
> + bd->ub = 1;
> + /* No ack needed not unicast */
> + bd->ack_policy = 1;
> + bd->queue_id = WCN36XX_TX_B_WQ_ID;
> + } else
> + bd->queue_id = WCN36XX_TX_U_WQ_ID;
> + *vif_priv = __vif_priv;
> +}
> +
> +int wcn36xx_start_tx(struct wcn36xx *wcn,
> + struct wcn36xx_sta *sta_priv,
> + struct sk_buff *skb)
> +{
> + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
> + struct wcn36xx_vif *vif_priv = NULL;
> + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
> + unsigned long flags;
> + bool is_low = ieee80211_is_data(hdr->frame_control);
> + bool bcast = is_broadcast_ether_addr(hdr->addr1) ||
> + is_multicast_ether_addr(hdr->addr1);
> + struct wcn36xx_tx_bd *bd = wcn36xx_dxe_get_next_bd(wcn, is_low);
> +
> + if (!bd) {
> + /*
> + * TX DXE are used in pairs. One for the BD and one for the
> + * actual frame. The BD DXE's has a preallocated buffer while
> + * the skb ones does not. If this isn't true something is really
> + * wierd. TODO: Recover from this situation
> + */
> +
> + wcn36xx_err("bd address may not be NULL for BD DXE\n");
> + return -EINVAL;
> + }
> +
> + memset(bd, 0, sizeof(*bd));
> +
> + wcn36xx_dbg(WCN36XX_DBG_TX,
> + "tx skb %p len %d fc %04x sn %d %s %s\n",
> + skb, skb->len, __le16_to_cpu(hdr->frame_control),
> + IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)),
> + is_low ? "low" : "high", bcast ? "bcast" : "ucast");
> +
> + wcn36xx_dbg_dump(WCN36XX_DBG_TX_DUMP, "", skb->data, skb->len);
> +
> + bd->dpu_rf = WCN36XX_BMU_WQ_TX;
> +
> + bd->tx_comp = info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS;
> + if (bd->tx_comp) {
> + wcn36xx_dbg(WCN36XX_DBG_DXE, "TX_ACK status requested\n");
> + spin_lock_irqsave(&wcn->dxe_lock, flags);
> + if (wcn->tx_ack_skb) {
> + spin_unlock_irqrestore(&wcn->dxe_lock, flags);
> + wcn36xx_warn("tx_ack_skb already set\n");
> + return -EINVAL;
> + }
> +
> + wcn->tx_ack_skb = skb;
> + spin_unlock_irqrestore(&wcn->dxe_lock, flags);
> +
> + /* Only one at a time is supported by fw. Stop the TX queues
> + * until the ack status gets back.
> + *
> + * TODO: Add watchdog in case FW does not answer
> + */
> + ieee80211_stop_queues(wcn->hw);
> + }
> +
> + /* Data frames served first*/
> + if (is_low) {
> + wcn36xx_set_tx_data(bd, wcn, &vif_priv, sta_priv, hdr, bcast);
> + wcn36xx_set_tx_pdu(bd,
> + ieee80211_is_data_qos(hdr->frame_control) ?
> + sizeof(struct ieee80211_qos_hdr) :
> + sizeof(struct ieee80211_hdr_3addr),
> + skb->len, sta_priv ? sta_priv->tid : 0);
> + } else {
> + /* MGMT and CTRL frames are handeld here*/
> + wcn36xx_set_tx_mgmt(bd, wcn, &vif_priv, hdr, bcast);
> + wcn36xx_set_tx_pdu(bd,
> + ieee80211_is_data_qos(hdr->frame_control) ?
> + sizeof(struct ieee80211_qos_hdr) :
> + sizeof(struct ieee80211_hdr_3addr),
> + skb->len, WCN36XX_TID);
> + }
> +
> + buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
> + bd->tx_bd_sign = 0xbdbdbdbd;
> +
> + return wcn36xx_dxe_tx_frame(wcn, vif_priv, skb, is_low);
> +}
> diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.h b/drivers/net/wireless/ath/wcn36xx/txrx.h
> new file mode 100644
> index 0000000..bbfbcf8
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/txrx.h
> @@ -0,0 +1,160 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _TXRX_H_
> +#define _TXRX_H_
> +
> +#include <linux/etherdevice.h>
> +#include "wcn36xx.h"
> +
> +/* TODO describe all properties */
> +#define WCN36XX_802_11_HEADER_LEN 24
> +#define WCN36XX_BMU_WQ_TX 25
> +#define WCN36XX_TID 7
> +/* broadcast wq ID */
> +#define WCN36XX_TX_B_WQ_ID 0xA
> +#define WCN36XX_TX_U_WQ_ID 0x9
> +/* bd_rate */
> +#define WCN36XX_BD_RATE_DATA 0
> +#define WCN36XX_BD_RATE_MGMT 2
> +#define WCN36XX_BD_RATE_CTRL 3
> +
> +struct wcn36xx_pdu {
> + u32 dpu_fb:8;
> + u32 adu_fb:8;
> + u32 pdu_id:16;
> +
> + /* 0x04*/
> + u32 tail_pdu_idx:16;
> + u32 head_pdu_idx:16;
> +
> + /* 0x08*/
> + u32 pdu_count:7;
> + u32 mpdu_data_off:9;
> + u32 mpdu_header_off:8;
> + u32 mpdu_header_len:8;
> +
> + /* 0x0c*/
> + u32 reserved4:8;
> + u32 tid:4;
> + u32 reserved3:4;
> + u32 mpdu_len:16;
> +};
> +
> +struct wcn36xx_rx_bd {
> + u32 bdt:2;
> + u32 ft:1;
> + u32 dpu_ne:1;
> + u32 rx_key_id:3;
> + u32 ub:1;
> + u32 rmf:1;
> + u32 uma_bypass:1;
> + u32 csr11:1;
> + u32 reserved0:1;
> + u32 scan_learn:1;
> + u32 rx_ch:4;
> + u32 rtsf:1;
> + u32 bsf:1;
> + u32 a2hf:1;
> + u32 st_auf:1;
> + u32 dpu_sign:3;
> + u32 dpu_rf:8;
> +
> + struct wcn36xx_pdu pdu;
> +
> + /* 0x14*/
> + u32 addr3:8;
> + u32 addr2:8;
> + u32 addr1:8;
> + u32 dpu_desc_idx:8;
> +
> + /* 0x18*/
> + u32 rxp_flags:23;
> + u32 rate_id:9;
> +
> + u32 phy_stat0;
> + u32 phy_stat1;
> +
> + /* 0x24 */
> + u32 rx_times;
> +
> + u32 pmi_cmd[6];
> +
> + /* 0x40 */
> + u32 reserved7:4;
> + u32 reorder_slot_id:6;
> + u32 reorder_fwd_id:6;
> + u32 reserved6:12;
> + u32 reorder_code:4;
> +
> + /* 0x44 */
> + u32 exp_seq_num:12;
> + u32 cur_seq_num:12;
> + u32 fr_type_subtype:8;
> +
> + /* 0x48 */
> + u32 msdu_size:16;
> + u32 sub_fr_id:4;
> + u32 proc_order:4;
> + u32 reserved9:4;
> + u32 aef:1;
> + u32 lsf:1;
> + u32 esf:1;
> + u32 asf:1;
> +};
> +
> +struct wcn36xx_tx_bd {
> + u32 bdt:2;
> + u32 ft:1;
> + u32 dpu_ne:1;
> + u32 fw_tx_comp:1;
> + u32 tx_comp:1;
> + u32 reserved1:1;
> + u32 ub:1;
> + u32 rmf:1;
> + u32 reserved0:12;
> + u32 dpu_sign:3;
> + u32 dpu_rf:8;
> +
> + struct wcn36xx_pdu pdu;
> +
> + /* 0x14*/
> + u32 reserved5:7;
> + u32 queue_id:5;
> + u32 bd_rate:2;
> + u32 ack_policy:2;
> + u32 sta_index:8;
> + u32 dpu_desc_idx:8;
> +
> + u32 tx_bd_sign;
> + u32 reserved6;
> + u32 dxe_start_time;
> + u32 dxe_end_time;
> +
> + /*u32 tcp_udp_start_off:10;
> + u32 header_cks:16;
> + u32 reserved7:6;*/
> +};
> +
> +struct wcn36xx_sta;
> +struct wcn36xx;
> +
> +int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb);
> +int wcn36xx_start_tx(struct wcn36xx *wcn,
> + struct wcn36xx_sta *sta_priv,
> + struct sk_buff *skb);
> +
> +#endif /* _TXRX_H_ */
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> new file mode 100644
> index 0000000..58b6383
> --- /dev/null
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -0,0 +1,238 @@
> +/*
> + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
> + *
> + * Permission to use, copy, modify, and/or distribute this software for any
> + * purpose with or without fee is hereby granted, provided that the above
> + * copyright notice and this permission notice appear in all copies.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
> + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
> + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#ifndef _WCN36XX_H_
> +#define _WCN36XX_H_
> +
> +#include <linux/completion.h>
> +#include <linux/printk.h>
> +#include <linux/spinlock.h>
> +#include <net/mac80211.h>
> +
> +#include "hal.h"
> +#include "smd.h"
> +#include "txrx.h"
> +#include "dxe.h"
> +#include "pmc.h"
> +#include "debug.h"
> +
> +#define WLAN_NV_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin"
> +#define WCN36XX_AGGR_BUFFER_SIZE 64
> +
> +extern unsigned int wcn36xx_dbg_mask;
> +
> +enum wcn36xx_debug_mask {
> + WCN36XX_DBG_DXE = 0x00000001,
> + WCN36XX_DBG_DXE_DUMP = 0x00000002,
> + WCN36XX_DBG_SMD = 0x00000004,
> + WCN36XX_DBG_SMD_DUMP = 0x00000008,
> + WCN36XX_DBG_RX = 0x00000010,
> + WCN36XX_DBG_RX_DUMP = 0x00000020,
> + WCN36XX_DBG_TX = 0x00000040,
> + WCN36XX_DBG_TX_DUMP = 0x00000080,
> + WCN36XX_DBG_HAL = 0x00000100,
> + WCN36XX_DBG_HAL_DUMP = 0x00000200,
> + WCN36XX_DBG_MAC = 0x00000400,
> + WCN36XX_DBG_BEACON = 0x00000800,
> + WCN36XX_DBG_BEACON_DUMP = 0x00001000,
> + WCN36XX_DBG_PMC = 0x00002000,
> + WCN36XX_DBG_PMC_DUMP = 0x00004000,
> + WCN36XX_DBG_ANY = 0xffffffff,
> +};
> +
> +#define wcn36xx_err(fmt, arg...) \
> + printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg);
> +
> +#define wcn36xx_warn(fmt, arg...) \
> + printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg)
> +
> +#define wcn36xx_info(fmt, arg...) \
> + printk(KERN_INFO pr_fmt(fmt), ##arg)
> +
> +#define wcn36xx_dbg(mask, fmt, arg...) do { \
> + if (wcn36xx_dbg_mask & mask) \
> + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \
> +} while (0)
> +
> +#define wcn36xx_dbg_dump(mask, prefix_str, buf, len) do { \
> + if (wcn36xx_dbg_mask & mask) \
> + print_hex_dump(KERN_DEBUG, pr_fmt(prefix_str), \
> + DUMP_PREFIX_OFFSET, 32, 1, \
> + buf, len, false); \
> +} while (0)
> +
> +#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value)
> +#define WCN36XX_BAND(__wcn) (__wcn->hw->conf.chandef.chan->band)
> +#define WCN36XX_CENTER_FREQ(__wcn) (__wcn->hw->conf.chandef.chan->center_freq)
> +#define WCN36XX_LISTEN_INTERVAL(__wcn) (__wcn->hw->conf.listen_interval)
> +#define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags)
> +#define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
> +
> +static inline void buff_to_be(u32 *buf, size_t len)
> +{
> + int i;
> + for (i = 0; i < len; i++)
> + buf[i] = cpu_to_be32(buf[i]);
> +}
> +
> +struct nv_data {
> + int is_valid;
> + u8 table;
> +};
> +
> +/* Interface for platform control path
> + *
> + * @open: hook must be called when wcn36xx wants to open control channel.
> + * @tx: sends a buffer.
> + */
> +struct wcn36xx_platform_ctrl_ops {
> + int (*open)(void *drv_priv, void *rsp_cb);
> + void (*close)(void);
> + int (*tx)(char *buf, size_t len);
> + int (*get_hw_mac)(u8 *addr);
> + int (*smsm_change_state)(u32 clear_mask, u32 set_mask);
> +};
> +
> +/**
> + * struct wcn36xx_vif - holds VIF related fields
> + *
> + * @bss_index: bss_index is initially set to 0xFF. bss_index is received from
> + * HW after first config_bss call and must be used in delete_bss and
> + * enter/exit_bmps.
> + */
> +struct wcn36xx_vif {
> + struct list_head list;
> + struct wcn36xx_sta *sta;
> + u8 dtim_period;
> + enum ani_ed_type encrypt_type;
> + bool is_joining;
> + struct wcn36xx_hal_mac_ssid ssid;
> +
> + /* Power management */
> + enum wcn36xx_power_state pw_state;
> +
> + u8 bss_index;
> + u8 ucast_dpu_signature;
> + /* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */
> + u8 self_sta_index;
> + u8 self_dpu_desc_index;
> +};
> +
> +/**
> + * struct wcn36xx_sta - holds STA related fields
> + *
> + * @tid: traffic ID that is used during AMPDU and in TX BD.
> + * @sta_index: STA index is returned from HW after config_sta call and is
> + * used in both SMD channel and TX BD.
> + * @dpu_desc_index: DPU descriptor index is returned from HW after config_sta
> + * call and is used in TX BD.
> + * @bss_sta_index: STA index is returned from HW after config_bss call and is
> + * used in both SMD channel and TX BD. See table bellow when it is used.
> + * @bss_dpu_desc_index: DPU descriptor index is returned from HW after
> + * config_bss call and is used in TX BD.
> + * ______________________________________________
> + * | | STA | AP |
> + * |______________|_____________|_______________|
> + * | TX BD |bss_sta_index| sta_index |
> + * |______________|_____________|_______________|
> + * |all SMD calls |bss_sta_index| sta_index |
> + * |______________|_____________|_______________|
> + * |smd_delete_sta| sta_index | sta_index |
> + * |______________|_____________|_______________|
> + */
> +struct wcn36xx_sta {
> + struct wcn36xx_vif *vif;
> + u16 aid;
> + u16 tid;
> + u8 sta_index;
> + u8 dpu_desc_index;
> + u8 bss_sta_index;
> + u8 bss_dpu_desc_index;
> + bool is_data_encrypted;
> + /* Rates */
> + struct wcn36xx_hal_supported_rates supported_rates;
> +};
> +struct wcn36xx_dxe_ch;
> +struct wcn36xx {
> + struct ieee80211_hw *hw;
> + struct device *dev;
> + struct list_head vif_list;
> +
> + u8 fw_revision;
> + u8 fw_version;
> + u8 fw_minor;
> + u8 fw_major;
> +
> + /* extra byte for the NULL termination */
> + u8 crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];
> + u8 wlan_version[WCN36XX_HAL_VERSION_LENGTH + 1];
> +
> + /* IRQs */
> + int tx_irq;
> + int rx_irq;
> + void __iomem *mmio;
> +
> + struct wcn36xx_platform_ctrl_ops *ctrl_ops;
> + /*
> + * smd_buf must be protected with smd_mutex to garantee
> + * that all messages are sent one after another
> + */
> + u8 *hal_buf;
> + size_t hal_rsp_len;
> + struct mutex hal_mutex;
> + struct completion hal_rsp_compl;
> + struct workqueue_struct *hal_ind_wq;
> + struct work_struct hal_ind_work;
> + struct mutex hal_ind_mutex;
> + struct list_head hal_ind_queue;
> +
> + /* DXE channels */
> + struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */
> + struct wcn36xx_dxe_ch dxe_tx_h_ch; /* TX high */
> + struct wcn36xx_dxe_ch dxe_rx_l_ch; /* RX low */
> + struct wcn36xx_dxe_ch dxe_rx_h_ch; /* RX high */
> +
> + /* For synchronization of DXE resources from BH, IRQ and WQ contexts */
> + spinlock_t dxe_lock;
> + bool queues_stopped;
> +
> + /* Memory pools */
> + struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
> + struct wcn36xx_dxe_mem_pool data_mem_pool;
> +
> + struct sk_buff *tx_ack_skb;
> +
> +#ifdef CONFIG_WCN36XX_DEBUGFS
> + /* Debug file system entry */
> + struct wcn36xx_dfs_entry dfs;
> +#endif /* CONFIG_WCN36XX_DEBUGFS */
> +
> +};
> +
> +static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
> + u8 major,
> + u8 minor,
> + u8 version,
> + u8 revision)
> +{
> + return (wcn->fw_major == major &&
> + wcn->fw_minor == minor &&
> + wcn->fw_version == version &&
> + wcn->fw_revision == revision);
> +}
> +void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates);
> +
> +#endif /* _WCN36XX_H_ */
> --
> 1.8.1.2
>
--
Best regards,
Eugene
^ permalink raw reply
* Re: remove unneeded semicolons
From: Bjorn Helgaas @ 2013-10-08 20:28 UTC (permalink / raw)
To: Joe Perches
Cc: Kalle Valo, ath10k, Fengguang Wu, linux-wireless, Julia Lawall,
LKML
In-Reply-To: <1381260511.2081.250.camel@joe-AO722>
Thanks, Joe. I picked up the drivers/pci changes below and will merge
them in the v3.13 merge window if nobody else does it first.
Bjorn
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index cdc7836..46d1378 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -222,7 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file,
unsigned int cmd,
default:
ret = -EINVAL;
break;
- };
+ }
return ret;
}
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index e1c1ec5..24750a1 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -44,7 +44,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus,
unsigned long, dfn,
default:
err = -EINVAL;
goto error;
- };
+ }
err = -EIO;
if (cfg_ret != PCIBIOS_SUCCESSFUL)
^ permalink raw reply related
* [PATCH] wcn36xx: mac80211 driver for Qualcomm WCN3660/WCN3680 hardware
From: Eugene Krasnikov @ 2013-10-08 20:25 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, wcn36xx, Eugene Krasnikov
In-Reply-To: <CAB=NE6Xs=ebxpQapB4xXu7edWfMEkgZu8hTyO98zfam56og2Hg@mail.gmail.com>
This is a mac80211 driver for Qualcomm WCN3660/WCN3680 devices. So
far WCN3660/WCN3680 is available only on MSM platform.
Firmware can be found here:
https://www.codeaurora.org/cgit/external/hisense/platform/vendor/qcom-opensource/wlan/prima/tree/firmware_bin?h=8130_CS
Wiki page is available here:
http://wireless.kernel.org/en/users/Drivers/wcn36xx
A lot people made a contribution to this driver. Here is the list in
alphabetical order:
Eugene Krasnikov <k.eugene.e@gmail.com>
Kalle Valo <kvalo@qca.qualcomm.com>
Olof Johansson <dev@skyshaper.net>
Pontus Fuchs <pontus.fuchs@gmail.com>
Yanbo Li <yanbol@qti.qualcomm.com>
Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com>
---
MAINTAINERS | 8 +
drivers/net/wireless/ath/Kconfig | 1 +
drivers/net/wireless/ath/Makefile | 1 +
drivers/net/wireless/ath/wcn36xx/Kconfig | 16 +
drivers/net/wireless/ath/wcn36xx/Makefile | 7 +
drivers/net/wireless/ath/wcn36xx/debug.c | 188 ++
drivers/net/wireless/ath/wcn36xx/debug.h | 49 +
drivers/net/wireless/ath/wcn36xx/dxe.c | 805 +++++
drivers/net/wireless/ath/wcn36xx/dxe.h | 284 ++
drivers/net/wireless/ath/wcn36xx/hal.h | 4657 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/wcn36xx/main.c | 1036 +++++++
drivers/net/wireless/ath/wcn36xx/pmc.c | 62 +
drivers/net/wireless/ath/wcn36xx/pmc.h | 33 +
drivers/net/wireless/ath/wcn36xx/smd.c | 2126 +++++++++++++
drivers/net/wireless/ath/wcn36xx/smd.h | 127 +
drivers/net/wireless/ath/wcn36xx/txrx.c | 284 ++
drivers/net/wireless/ath/wcn36xx/txrx.h | 160 +
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 238 ++
18 files changed, 10082 insertions(+)
create mode 100644 drivers/net/wireless/ath/wcn36xx/Kconfig
create mode 100644 drivers/net/wireless/ath/wcn36xx/Makefile
create mode 100644 drivers/net/wireless/ath/wcn36xx/debug.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/debug.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/dxe.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/dxe.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/hal.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/main.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/pmc.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/pmc.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/smd.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/smd.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.c
create mode 100644 drivers/net/wireless/ath/wcn36xx/txrx.h
create mode 100644 drivers/net/wireless/ath/wcn36xx/wcn36xx.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 705bb96..5cf566d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6745,6 +6745,14 @@ L: linux-hexagon@vger.kernel.org
S: Supported
F: arch/hexagon/
+QUALCOMM WCN36XX WIRELESS DRIVER
+M: Eugene Krasnikov <k.eugene.e@gmail.com>
+L: wcn36xx@lists.infradead.org
+W: http://wireless.kernel.org/en/users/Drivers/wcn36xx
+T: git git://github.com/KrasnikovEugene/wcn36xx.git
+S: Supported
+F: drivers/net/wireless/ath/wcn36xx/
+
QUICKCAM PARALLEL PORT WEBCAMS
M: Hans Verkuil <hverkuil@xs4all.nl>
L: linux-media@vger.kernel.org
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index 1abf1d4..ba81d62 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -32,5 +32,6 @@ source "drivers/net/wireless/ath/ath6kl/Kconfig"
source "drivers/net/wireless/ath/ar5523/Kconfig"
source "drivers/net/wireless/ath/wil6210/Kconfig"
source "drivers/net/wireless/ath/ath10k/Kconfig"
+source "drivers/net/wireless/ath/wcn36xx/Kconfig"
endif
diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
index fb05cfd..363b056 100644
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATH6KL) += ath6kl/
obj-$(CONFIG_AR5523) += ar5523/
obj-$(CONFIG_WIL6210) += wil6210/
obj-$(CONFIG_ATH10K) += ath10k/
+obj-$(CONFIG_WCN36XX) += wcn36xx/
obj-$(CONFIG_ATH_COMMON) += ath.o
diff --git a/drivers/net/wireless/ath/wcn36xx/Kconfig b/drivers/net/wireless/ath/wcn36xx/Kconfig
new file mode 100644
index 0000000..591ebae
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/Kconfig
@@ -0,0 +1,16 @@
+config WCN36XX
+ tristate "Qualcomm Atheros WCN3660/3680 support"
+ depends on MAC80211 && HAS_DMA
+ ---help---
+ This module adds support for wireless adapters based on
+ Qualcomm Atheros WCN3660 and WCN3680 mobile chipsets.
+
+ If you choose to build a module, it'll be called wcn36xx.
+
+config WCN36XX_DEBUGFS
+ bool "WCN36XX debugfs support"
+ depends on WCN36XX
+ ---help---
+ Enabled debugfs support
+
+ If unsure, say Y to make it easier to debug problems.
diff --git a/drivers/net/wireless/ath/wcn36xx/Makefile b/drivers/net/wireless/ath/wcn36xx/Makefile
new file mode 100644
index 0000000..50c43b4
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/Makefile
@@ -0,0 +1,7 @@
+obj-$(CONFIG_WCN36XX) := wcn36xx.o
+wcn36xx-y += main.o \
+ dxe.o \
+ txrx.o \
+ smd.o \
+ pmc.o \
+ debug.o
diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c
new file mode 100644
index 0000000..682bcd6
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/debug.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/debugfs.h>
+#include <linux/uaccess.h>
+#include "wcn36xx.h"
+#include "debug.h"
+#include "pmc.h"
+
+#ifdef CONFIG_WCN36XX_DEBUGFS
+
+static int wcn36xx_debugfs_open(struct inode *inode, struct file *file)
+{
+ file->private_data = inode->i_private;
+
+ return 0;
+}
+
+static ssize_t read_file_bool_bmps(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wcn36xx *wcn = file->private_data;
+ struct wcn36xx_vif *vif_priv = NULL;
+ struct ieee80211_vif *vif = NULL;
+ char buf[3];
+
+ list_for_each_entry(vif_priv, &wcn->vif_list, list) {
+ vif = container_of((void *)vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+ if (NL80211_IFTYPE_STATION == vif->type) {
+ if (vif_priv->pw_state == WCN36XX_BMPS)
+ buf[0] = '1';
+ else
+ buf[0] = '0';
+ break;
+ }
+ }
+ buf[1] = '\n';
+ buf[2] = 0x00;
+
+ return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
+}
+
+static ssize_t write_file_bool_bmps(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wcn36xx *wcn = file->private_data;
+ struct wcn36xx_vif *vif_priv = NULL;
+ struct ieee80211_vif *vif = NULL;
+
+ char buf[32];
+ int buf_size;
+
+ buf_size = min(count, (sizeof(buf)-1));
+ if (copy_from_user(buf, user_buf, buf_size))
+ return -EFAULT;
+
+ switch (buf[0]) {
+ case 'y':
+ case 'Y':
+ case '1':
+ list_for_each_entry(vif_priv, &wcn->vif_list, list) {
+ vif = container_of((void *)vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+ if (NL80211_IFTYPE_STATION == vif->type) {
+ wcn36xx_enable_keep_alive_null_packet(wcn, vif);
+ wcn36xx_pmc_enter_bmps_state(wcn, vif);
+ }
+ }
+ break;
+ case 'n':
+ case 'N':
+ case '0':
+ list_for_each_entry(vif_priv, &wcn->vif_list, list) {
+ vif = container_of((void *)vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+ if (NL80211_IFTYPE_STATION == vif->type)
+ wcn36xx_pmc_exit_bmps_state(wcn, vif);
+ }
+ break;
+ }
+
+ return count;
+}
+
+static const struct file_operations fops_wcn36xx_bmps = {
+ .open = wcn36xx_debugfs_open,
+ .read = read_file_bool_bmps,
+ .write = write_file_bool_bmps,
+};
+
+static ssize_t write_file_dump(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wcn36xx *wcn = file->private_data;
+ char buf[255], *tmp;
+ int buf_size;
+ u32 arg[WCN36xx_MAX_DUMP_ARGS];
+ int i;
+
+ memset(buf, 0, sizeof(buf));
+ memset(arg, 0, sizeof(arg));
+
+ buf_size = min(count, (sizeof(buf) - 1));
+ if (copy_from_user(buf, user_buf, buf_size))
+ return -EFAULT;
+
+ tmp = buf;
+
+ for (i = 0; i < WCN36xx_MAX_DUMP_ARGS; i++) {
+ char *begin;
+ begin = strsep(&tmp, " ");
+ if (begin == NULL)
+ break;
+
+ if (kstrtoul(begin, 0, (unsigned long *)(arg + i)) != 0)
+ break;
+ }
+
+ wcn36xx_info("DUMP args is %d %d %d %d %d\n", arg[0], arg[1], arg[2],
+ arg[3], arg[4]);
+ wcn36xx_smd_dump_cmd_req(wcn, arg[0], arg[1], arg[2], arg[3], arg[4]);
+
+ return count;
+}
+
+static const struct file_operations fops_wcn36xx_dump = {
+ .open = wcn36xx_debugfs_open,
+ .write = write_file_dump,
+};
+
+#define ADD_FILE(name, mode, fop, priv_data) \
+ do { \
+ struct dentry *d; \
+ d = debugfs_create_file(__stringify(name), \
+ mode, dfs->rootdir, \
+ priv_data, fop); \
+ dfs->file_##name.dentry = d; \
+ if (IS_ERR(d)) { \
+ wcn36xx_warn("Create the debugfs entry failed");\
+ dfs->file_##name.dentry = NULL; \
+ } \
+ } while (0)
+
+
+void wcn36xx_debugfs_init(struct wcn36xx *wcn)
+{
+ struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
+
+ dfs->rootdir = debugfs_create_dir(KBUILD_MODNAME,
+ wcn->hw->wiphy->debugfsdir);
+ if (IS_ERR(dfs->rootdir)) {
+ wcn36xx_warn("Create the debugfs failed\n");
+ dfs->rootdir = NULL;
+ }
+
+ ADD_FILE(bmps_switcher, S_IRUSR | S_IWUSR,
+ &fops_wcn36xx_bmps, wcn);
+ ADD_FILE(dump, S_IWUSR, &fops_wcn36xx_dump, wcn);
+}
+
+void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
+{
+ struct wcn36xx_dfs_entry *dfs = &wcn->dfs;
+ debugfs_remove_recursive(dfs->rootdir);
+}
+
+#endif /* CONFIG_WCN36XX_DEBUGFS */
diff --git a/drivers/net/wireless/ath/wcn36xx/debug.h b/drivers/net/wireless/ath/wcn36xx/debug.h
new file mode 100644
index 0000000..46307aa
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/debug.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WCN36XX_DEBUG_H_
+#define _WCN36XX_DEBUG_H_
+
+#include <linux/kernel.h>
+
+#define WCN36xx_MAX_DUMP_ARGS 5
+
+#ifdef CONFIG_WCN36XX_DEBUGFS
+struct wcn36xx_dfs_file {
+ struct dentry *dentry;
+ u32 value;
+};
+
+struct wcn36xx_dfs_entry {
+ struct dentry *rootdir;
+ struct wcn36xx_dfs_file file_bmps_switcher;
+ struct wcn36xx_dfs_file file_dump;
+};
+
+void wcn36xx_debugfs_init(struct wcn36xx *wcn);
+void wcn36xx_debugfs_exit(struct wcn36xx *wcn);
+
+#else
+static inline void wcn36xx_debugfs_init(struct wcn36xx *wcn)
+{
+}
+static inline void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
+{
+}
+
+#endif /* CONFIG_WCN36XX_DEBUGFS */
+
+#endif /* _WCN36XX_DEBUG_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c b/drivers/net/wireless/ath/wcn36xx/dxe.c
new file mode 100644
index 0000000..ee25786
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
@@ -0,0 +1,805 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* DXE - DMA transfer engine
+ * we have 2 channels(High prio and Low prio) for TX and 2 channels for RX.
+ * through low channels data packets are transfered
+ * through high channels managment packets are transfered
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/interrupt.h>
+#include "wcn36xx.h"
+#include "txrx.h"
+
+void *wcn36xx_dxe_get_next_bd(struct wcn36xx *wcn, bool is_low)
+{
+ struct wcn36xx_dxe_ch *ch = is_low ?
+ &wcn->dxe_tx_l_ch :
+ &wcn->dxe_tx_h_ch;
+
+ return ch->head_blk_ctl->bd_cpu_addr;
+}
+
+static void wcn36xx_dxe_write_register(struct wcn36xx *wcn, int addr, int data)
+{
+ wcn36xx_dbg(WCN36XX_DBG_DXE,
+ "wcn36xx_dxe_write_register: addr=%x, data=%x\n",
+ addr, data);
+
+ writel(data, wcn->mmio + addr);
+}
+
+static void wcn36xx_dxe_read_register(struct wcn36xx *wcn, int addr, int *data)
+{
+ *data = readl(wcn->mmio + addr);
+
+ wcn36xx_dbg(WCN36XX_DBG_DXE,
+ "wcn36xx_dxe_read_register: addr=%x, data=%x\n",
+ addr, *data);
+}
+
+static void wcn36xx_dxe_free_ctl_block(struct wcn36xx_dxe_ch *ch)
+{
+ struct wcn36xx_dxe_ctl *ctl = ch->head_blk_ctl, *next;
+ int i;
+
+ for (i = 0; i < ch->desc_num && ctl; i++) {
+ next = ctl->next;
+ kfree(ctl);
+ ctl = next;
+ }
+}
+
+static int wcn36xx_dxe_allocate_ctl_block(struct wcn36xx_dxe_ch *ch)
+{
+ struct wcn36xx_dxe_ctl *prev_ctl = NULL;
+ struct wcn36xx_dxe_ctl *cur_ctl = NULL;
+ int i;
+
+ for (i = 0; i < ch->desc_num; i++) {
+ cur_ctl = kzalloc(sizeof(*cur_ctl), GFP_KERNEL);
+ if (!cur_ctl)
+ goto out_fail;
+
+ cur_ctl->ctl_blk_order = i;
+ if (i == 0) {
+ ch->head_blk_ctl = cur_ctl;
+ ch->tail_blk_ctl = cur_ctl;
+ } else if (ch->desc_num - 1 == i) {
+ prev_ctl->next = cur_ctl;
+ cur_ctl->next = ch->head_blk_ctl;
+ } else {
+ prev_ctl->next = cur_ctl;
+ }
+ prev_ctl = cur_ctl;
+ }
+
+ return 0;
+
+out_fail:
+ wcn36xx_dxe_free_ctl_block(ch);
+ return -ENOMEM;
+}
+
+int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn)
+{
+ int ret;
+
+ wcn->dxe_tx_l_ch.ch_type = WCN36XX_DXE_CH_TX_L;
+ wcn->dxe_tx_h_ch.ch_type = WCN36XX_DXE_CH_TX_H;
+ wcn->dxe_rx_l_ch.ch_type = WCN36XX_DXE_CH_RX_L;
+ wcn->dxe_rx_h_ch.ch_type = WCN36XX_DXE_CH_RX_H;
+
+ wcn->dxe_tx_l_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_TX_L;
+ wcn->dxe_tx_h_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_TX_H;
+ wcn->dxe_rx_l_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_L;
+ wcn->dxe_rx_h_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_H;
+
+ wcn->dxe_tx_l_ch.dxe_wq = WCN36XX_DXE_WQ_TX_L;
+ wcn->dxe_tx_h_ch.dxe_wq = WCN36XX_DXE_WQ_TX_H;
+
+ wcn->dxe_tx_l_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_L_BD;
+ wcn->dxe_tx_h_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_H_BD;
+
+ wcn->dxe_tx_l_ch.ctrl_skb = WCN36XX_DXE_CTRL_TX_L_SKB;
+ wcn->dxe_tx_h_ch.ctrl_skb = WCN36XX_DXE_CTRL_TX_H_SKB;
+
+ wcn->dxe_tx_l_ch.reg_ctrl = WCN36XX_DXE_REG_CTL_TX_L;
+ wcn->dxe_tx_h_ch.reg_ctrl = WCN36XX_DXE_REG_CTL_TX_H;
+
+ wcn->dxe_tx_l_ch.def_ctrl = WCN36XX_DXE_CH_DEFAULT_CTL_TX_L;
+ wcn->dxe_tx_h_ch.def_ctrl = WCN36XX_DXE_CH_DEFAULT_CTL_TX_H;
+
+ /* DXE control block allocation */
+ ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_tx_l_ch);
+ if (ret)
+ goto out_err;
+ ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_tx_h_ch);
+ if (ret)
+ goto out_err;
+ ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_rx_l_ch);
+ if (ret)
+ goto out_err;
+ ret = wcn36xx_dxe_allocate_ctl_block(&wcn->dxe_rx_h_ch);
+ if (ret)
+ goto out_err;
+
+ /* Initialize SMSM state Clear TX Enable RING EMPTY STATE */
+ ret = wcn->ctrl_ops->smsm_change_state(
+ WCN36XX_SMSM_WLAN_TX_ENABLE,
+ WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY);
+
+ return 0;
+
+out_err:
+ wcn36xx_err("Failed to allocate DXE control blocks\n");
+ wcn36xx_dxe_free_ctl_blks(wcn);
+ return -ENOMEM;
+}
+
+void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn)
+{
+ wcn36xx_dxe_free_ctl_block(&wcn->dxe_tx_l_ch);
+ wcn36xx_dxe_free_ctl_block(&wcn->dxe_tx_h_ch);
+ wcn36xx_dxe_free_ctl_block(&wcn->dxe_rx_l_ch);
+ wcn36xx_dxe_free_ctl_block(&wcn->dxe_rx_h_ch);
+}
+
+static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch *wcn_ch)
+{
+ struct wcn36xx_dxe_desc *cur_dxe = NULL;
+ struct wcn36xx_dxe_desc *prev_dxe = NULL;
+ struct wcn36xx_dxe_ctl *cur_ctl = NULL;
+ size_t size;
+ int i;
+
+ size = wcn_ch->desc_num * sizeof(struct wcn36xx_dxe_desc);
+ wcn_ch->cpu_addr = dma_alloc_coherent(NULL, size, &wcn_ch->dma_addr,
+ GFP_KERNEL);
+ if (!wcn_ch->cpu_addr)
+ return -ENOMEM;
+
+ memset(wcn_ch->cpu_addr, 0, size);
+
+ cur_dxe = (struct wcn36xx_dxe_desc *)wcn_ch->cpu_addr;
+ cur_ctl = wcn_ch->head_blk_ctl;
+
+ for (i = 0; i < wcn_ch->desc_num; i++) {
+ cur_ctl->desc = cur_dxe;
+ cur_ctl->desc_phy_addr = wcn_ch->dma_addr +
+ i * sizeof(struct wcn36xx_dxe_desc);
+
+ switch (wcn_ch->ch_type) {
+ case WCN36XX_DXE_CH_TX_L:
+ cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_L;
+ cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_L;
+ break;
+ case WCN36XX_DXE_CH_TX_H:
+ cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_H;
+ cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_H;
+ break;
+ case WCN36XX_DXE_CH_RX_L:
+ cur_dxe->ctrl = WCN36XX_DXE_CTRL_RX_L;
+ cur_dxe->src_addr_l = WCN36XX_DXE_WQ_RX_L;
+ break;
+ case WCN36XX_DXE_CH_RX_H:
+ cur_dxe->ctrl = WCN36XX_DXE_CTRL_RX_H;
+ cur_dxe->src_addr_l = WCN36XX_DXE_WQ_RX_H;
+ break;
+ }
+ if (0 == i) {
+ cur_dxe->phy_next_l = 0;
+ } else if ((0 < i) && (i < wcn_ch->desc_num - 1)) {
+ prev_dxe->phy_next_l =
+ cur_ctl->desc_phy_addr;
+ } else if (i == (wcn_ch->desc_num - 1)) {
+ prev_dxe->phy_next_l =
+ cur_ctl->desc_phy_addr;
+ cur_dxe->phy_next_l =
+ wcn_ch->head_blk_ctl->desc_phy_addr;
+ }
+ cur_ctl = cur_ctl->next;
+ prev_dxe = cur_dxe;
+ cur_dxe++;
+ }
+
+ return 0;
+}
+
+static void wcn36xx_dxe_init_tx_bd(struct wcn36xx_dxe_ch *ch,
+ struct wcn36xx_dxe_mem_pool *pool)
+{
+ int i, chunk_size = pool->chunk_size;
+ dma_addr_t bd_phy_addr = pool->phy_addr;
+ void *bd_cpu_addr = pool->virt_addr;
+ struct wcn36xx_dxe_ctl *cur = ch->head_blk_ctl;
+
+ for (i = 0; i < ch->desc_num; i++) {
+ /* Only every second dxe needs a bd pointer,
+ the other will point to the skb data */
+ if (!(i & 1)) {
+ cur->bd_phy_addr = bd_phy_addr;
+ cur->bd_cpu_addr = bd_cpu_addr;
+ bd_phy_addr += chunk_size;
+ bd_cpu_addr += chunk_size;
+ } else {
+ cur->bd_phy_addr = 0;
+ cur->bd_cpu_addr = NULL;
+ }
+ cur = cur->next;
+ }
+}
+
+static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, u16 wcn_ch)
+{
+ int reg_data = 0;
+
+ wcn36xx_dxe_read_register(wcn,
+ WCN36XX_DXE_INT_MASK_REG,
+ ®_data);
+
+ reg_data |= wcn_ch;
+
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_INT_MASK_REG,
+ (int)reg_data);
+ return 0;
+}
+
+static int wcn36xx_dxe_fill_skb(struct wcn36xx_dxe_ctl *ctl)
+{
+ struct wcn36xx_dxe_desc *dxe = ctl->desc;
+ struct sk_buff *skb;
+
+ skb = alloc_skb(WCN36XX_PKT_SIZE, GFP_ATOMIC);
+ if (skb == NULL)
+ return -ENOMEM;
+
+ dxe->dst_addr_l = dma_map_single(NULL,
+ skb_tail_pointer(skb),
+ WCN36XX_PKT_SIZE,
+ DMA_FROM_DEVICE);
+ ctl->skb = skb;
+
+ return 0;
+}
+
+static int wcn36xx_dxe_ch_alloc_skb(struct wcn36xx *wcn,
+ struct wcn36xx_dxe_ch *wcn_ch)
+{
+ int i;
+ struct wcn36xx_dxe_ctl *cur_ctl = NULL;
+
+ cur_ctl = wcn_ch->head_blk_ctl;
+
+ for (i = 0; i < wcn_ch->desc_num; i++) {
+ wcn36xx_dxe_fill_skb(cur_ctl);
+ cur_ctl = cur_ctl->next;
+ }
+
+ return 0;
+}
+
+static void wcn36xx_dxe_ch_free_skbs(struct wcn36xx *wcn,
+ struct wcn36xx_dxe_ch *wcn_ch)
+{
+ struct wcn36xx_dxe_ctl *cur = wcn_ch->head_blk_ctl;
+ int i;
+
+ for (i = 0; i < wcn_ch->desc_num; i++) {
+ kfree_skb(cur->skb);
+ cur = cur->next;
+ }
+}
+
+void wcn36xx_dxe_tx_ack_ind(struct wcn36xx *wcn, u32 status)
+{
+ struct ieee80211_tx_info *info;
+ struct sk_buff *skb;
+ unsigned long flags;
+
+ spin_lock_irqsave(&wcn->dxe_lock, flags);
+ skb = wcn->tx_ack_skb;
+ wcn->tx_ack_skb = NULL;
+ spin_unlock_irqrestore(&wcn->dxe_lock, flags);
+
+ if (!skb) {
+ wcn36xx_warn("Spurious TX complete indication\n");
+ return;
+ }
+
+ info = IEEE80211_SKB_CB(skb);
+
+ if (status == 1)
+ info->flags |= IEEE80211_TX_STAT_ACK;
+
+ wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ack status: %d\n", status);
+
+ ieee80211_tx_status_irqsafe(wcn->hw, skb);
+ ieee80211_wake_queues(wcn->hw);
+}
+
+static void reap_tx_dxes(struct wcn36xx *wcn, struct wcn36xx_dxe_ch *ch)
+{
+ struct wcn36xx_dxe_ctl *ctl = ch->tail_blk_ctl;
+ struct ieee80211_tx_info *info;
+ unsigned long flags;
+
+ /*
+ * Make at least one loop of do-while because in case ring is
+ * completely full head and tail are pointing to the same element
+ * and while-do will not make any cycles.
+ */
+ do {
+ if (ctl->skb) {
+ dma_unmap_single(NULL, ctl->desc->src_addr_l,
+ ctl->skb->len, DMA_TO_DEVICE);
+ info = IEEE80211_SKB_CB(ctl->skb);
+ if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
+ /* Keep frame until TX status comes */
+ ieee80211_free_txskb(wcn->hw, ctl->skb);
+ }
+ spin_lock_irqsave(&ctl->skb_lock, flags);
+ if (wcn->queues_stopped) {
+ wcn->queues_stopped = false;
+ ieee80211_wake_queues(wcn->hw);
+ }
+ spin_unlock_irqrestore(&ctl->skb_lock, flags);
+
+ ctl->skb = NULL;
+ }
+ ctl = ctl->next;
+ } while (ctl != ch->head_blk_ctl &&
+ !(ctl->desc->ctrl & WCN36XX_DXE_CTRL_VALID_MASK));
+
+ ch->tail_blk_ctl = ctl;
+}
+
+static irqreturn_t wcn36xx_irq_tx_complete(int irq, void *dev)
+{
+ struct wcn36xx *wcn = (struct wcn36xx *)dev;
+ int int_src, int_reason;
+
+ wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_INT_SRC_RAW_REG, &int_src);
+
+ if (int_src & WCN36XX_INT_MASK_CHAN_TX_H) {
+ wcn36xx_dxe_read_register(wcn,
+ WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_H,
+ &int_reason);
+
+ /* TODO: Check int_reason */
+
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_0_INT_CLR,
+ WCN36XX_INT_MASK_CHAN_TX_H);
+
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_ED_CLR,
+ WCN36XX_INT_MASK_CHAN_TX_H);
+ wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ready high\n");
+ reap_tx_dxes(wcn, &wcn->dxe_tx_h_ch);
+ }
+
+ if (int_src & WCN36XX_INT_MASK_CHAN_TX_L) {
+ wcn36xx_dxe_read_register(wcn,
+ WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_L,
+ &int_reason);
+ /* TODO: Check int_reason */
+
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_0_INT_CLR,
+ WCN36XX_INT_MASK_CHAN_TX_L);
+
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_ED_CLR,
+ WCN36XX_INT_MASK_CHAN_TX_L);
+ wcn36xx_dbg(WCN36XX_DBG_DXE, "dxe tx ready low\n");
+ reap_tx_dxes(wcn, &wcn->dxe_tx_l_ch);
+ }
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t wcn36xx_irq_rx_ready(int irq, void *dev)
+{
+ struct wcn36xx *wcn = (struct wcn36xx *)dev;
+
+ disable_irq_nosync(wcn->rx_irq);
+ wcn36xx_dxe_rx_frame(wcn);
+ enable_irq(wcn->rx_irq);
+ return IRQ_HANDLED;
+}
+
+static int wcn36xx_dxe_request_irqs(struct wcn36xx *wcn)
+{
+ int ret;
+
+ ret = request_irq(wcn->tx_irq, wcn36xx_irq_tx_complete,
+ IRQF_TRIGGER_HIGH, "wcn36xx_tx", wcn);
+ if (ret) {
+ wcn36xx_err("failed to alloc tx irq\n");
+ goto out_err;
+ }
+
+ ret = request_irq(wcn->rx_irq, wcn36xx_irq_rx_ready, IRQF_TRIGGER_HIGH,
+ "wcn36xx_rx", wcn);
+ if (ret) {
+ wcn36xx_err("failed to alloc rx irq\n");
+ goto out_txirq;
+ }
+
+ enable_irq_wake(wcn->rx_irq);
+
+ return 0;
+
+out_txirq:
+ free_irq(wcn->tx_irq, wcn);
+out_err:
+ return ret;
+
+}
+
+static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
+ struct wcn36xx_dxe_ch *ch)
+{
+ struct wcn36xx_dxe_ctl *ctl = ch->head_blk_ctl;
+ struct wcn36xx_dxe_desc *dxe = ctl->desc;
+ dma_addr_t dma_addr;
+ struct sk_buff *skb;
+
+ while (!(dxe->ctrl & WCN36XX_DXE_CTRL_VALID_MASK)) {
+ skb = ctl->skb;
+ dma_addr = dxe->dst_addr_l;
+ wcn36xx_dxe_fill_skb(ctl);
+
+ switch (ch->ch_type) {
+ case WCN36XX_DXE_CH_RX_L:
+ dxe->ctrl = WCN36XX_DXE_CTRL_RX_L;
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_ENCH_ADDR,
+ WCN36XX_DXE_INT_CH1_MASK);
+ break;
+ case WCN36XX_DXE_CH_RX_H:
+ dxe->ctrl = WCN36XX_DXE_CTRL_RX_H;
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_ENCH_ADDR,
+ WCN36XX_DXE_INT_CH3_MASK);
+ break;
+ default:
+ wcn36xx_warn("Unknown channel\n");
+ }
+
+ dma_unmap_single(NULL, dma_addr, WCN36XX_PKT_SIZE,
+ DMA_FROM_DEVICE);
+ wcn36xx_rx_skb(wcn, skb);
+ ctl = ctl->next;
+ dxe = ctl->desc;
+ }
+
+ ch->head_blk_ctl = ctl;
+
+ return 0;
+}
+
+void wcn36xx_dxe_rx_frame(struct wcn36xx *wcn)
+{
+ int int_src;
+
+ wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_INT_SRC_RAW_REG, &int_src);
+
+ /* RX_LOW_PRI */
+ if (int_src & WCN36XX_DXE_INT_CH1_MASK) {
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_CLR,
+ WCN36XX_DXE_INT_CH1_MASK);
+ wcn36xx_rx_handle_packets(wcn, &(wcn->dxe_rx_l_ch));
+ }
+
+ /* RX_HIGH_PRI */
+ if (int_src & WCN36XX_DXE_INT_CH3_MASK) {
+ /* Clean up all the INT within this channel */
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_CLR,
+ WCN36XX_DXE_INT_CH3_MASK);
+ wcn36xx_rx_handle_packets(wcn, &(wcn->dxe_rx_h_ch));
+ }
+
+ if (!int_src)
+ wcn36xx_warn("No DXE interrupt pending\n");
+}
+
+int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
+{
+ size_t s;
+ void *cpu_addr;
+
+ /* Allocate BD headers for MGMT frames */
+
+ /* Where this come from ask QC */
+ wcn->mgmt_mem_pool.chunk_size = WCN36XX_BD_CHUNK_SIZE +
+ 16 - (WCN36XX_BD_CHUNK_SIZE % 8);
+
+ s = wcn->mgmt_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_H;
+ cpu_addr = dma_alloc_coherent(NULL, s, &wcn->mgmt_mem_pool.phy_addr,
+ GFP_KERNEL);
+ if (!cpu_addr)
+ goto out_err;
+
+ wcn->mgmt_mem_pool.virt_addr = cpu_addr;
+ memset(cpu_addr, 0, s);
+
+ /* Allocate BD headers for DATA frames */
+
+ /* Where this come from ask QC */
+ wcn->data_mem_pool.chunk_size = WCN36XX_BD_CHUNK_SIZE +
+ 16 - (WCN36XX_BD_CHUNK_SIZE % 8);
+
+ s = wcn->data_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_L;
+ cpu_addr = dma_alloc_coherent(NULL, s, &wcn->data_mem_pool.phy_addr,
+ GFP_KERNEL);
+ if (!cpu_addr)
+ goto out_err;
+
+ wcn->data_mem_pool.virt_addr = cpu_addr;
+ memset(cpu_addr, 0, s);
+
+ return 0;
+
+out_err:
+ wcn36xx_dxe_free_mem_pools(wcn);
+ wcn36xx_err("Failed to allocate BD mempool\n");
+ return -ENOMEM;
+}
+
+void wcn36xx_dxe_free_mem_pools(struct wcn36xx *wcn)
+{
+ if (wcn->mgmt_mem_pool.virt_addr)
+ dma_free_coherent(NULL, wcn->mgmt_mem_pool.chunk_size *
+ WCN36XX_DXE_CH_DESC_NUMB_TX_H,
+ wcn->mgmt_mem_pool.virt_addr,
+ wcn->mgmt_mem_pool.phy_addr);
+
+ if (wcn->data_mem_pool.virt_addr) {
+ dma_free_coherent(NULL, wcn->data_mem_pool.chunk_size *
+ WCN36XX_DXE_CH_DESC_NUMB_TX_L,
+ wcn->data_mem_pool.virt_addr,
+ wcn->data_mem_pool.phy_addr);
+ }
+}
+
+int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
+ struct wcn36xx_vif *vif_priv,
+ struct sk_buff *skb,
+ bool is_low)
+{
+ struct wcn36xx_dxe_ctl *ctl = NULL;
+ struct wcn36xx_dxe_desc *desc = NULL;
+ struct wcn36xx_dxe_ch *ch = NULL;
+ unsigned long flags;
+
+ ch = is_low ? &wcn->dxe_tx_l_ch : &wcn->dxe_tx_h_ch;
+
+ ctl = ch->head_blk_ctl;
+
+ spin_lock_irqsave(&ctl->next->skb_lock, flags);
+
+ /*
+ * If skb is not null that means that we reached the tail of the ring
+ * hence ring is full. Stop queues to let mac80211 back off until ring
+ * has an empty slot again.
+ */
+ if (NULL != ctl->next->skb) {
+ ieee80211_stop_queues(wcn->hw);
+ wcn->queues_stopped = true;
+ spin_unlock_irqrestore(&ctl->next->skb_lock, flags);
+ return -EBUSY;
+ }
+ spin_unlock_irqrestore(&ctl->next->skb_lock, flags);
+
+ ctl->skb = NULL;
+ desc = ctl->desc;
+
+ /* Set source address of the BD we send */
+ desc->src_addr_l = ctl->bd_phy_addr;
+
+ desc->dst_addr_l = ch->dxe_wq;
+ desc->fr_len = sizeof(struct wcn36xx_tx_bd);
+ desc->ctrl = ch->ctrl_bd;
+
+ wcn36xx_dbg(WCN36XX_DBG_DXE, "DXE TX\n");
+
+ wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "DESC1 >>> ",
+ (char *)desc, sizeof(*desc));
+ wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP,
+ "BD >>> ", (char *)ctl->bd_cpu_addr,
+ sizeof(struct wcn36xx_tx_bd));
+
+ /* Set source address of the SKB we send */
+ ctl = ctl->next;
+ ctl->skb = skb;
+ desc = ctl->desc;
+ if (ctl->bd_cpu_addr) {
+ wcn36xx_err("bd_cpu_addr cannot be NULL for skb DXE\n");
+ return -EINVAL;
+ }
+
+ desc->src_addr_l = dma_map_single(NULL,
+ ctl->skb->data,
+ ctl->skb->len,
+ DMA_TO_DEVICE);
+
+ desc->dst_addr_l = ch->dxe_wq;
+ desc->fr_len = ctl->skb->len;
+
+ /* set dxe descriptor to VALID */
+ desc->ctrl = ch->ctrl_skb;
+
+ wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "DESC2 >>> ",
+ (char *)desc, sizeof(*desc));
+ wcn36xx_dbg_dump(WCN36XX_DBG_DXE_DUMP, "SKB >>> ",
+ (char *)ctl->skb->data, ctl->skb->len);
+
+ /* Move the head of the ring to the next empty descriptor */
+ ch->head_blk_ctl = ctl->next;
+
+ /*
+ * When connected and trying to send data frame chip can be in sleep
+ * mode and writing to the register will not wake up the chip. Instead
+ * notify chip about new frame through SMSM bus.
+ */
+ if (is_low && vif_priv->pw_state == WCN36XX_BMPS) {
+ wcn->ctrl_ops->smsm_change_state(
+ 0,
+ WCN36XX_SMSM_WLAN_TX_ENABLE);
+ } else {
+ /* indicate End Of Packet and generate interrupt on descriptor
+ * done.
+ */
+ wcn36xx_dxe_write_register(wcn,
+ ch->reg_ctrl, ch->def_ctrl);
+ }
+
+ return 0;
+}
+
+int wcn36xx_dxe_init(struct wcn36xx *wcn)
+{
+ int reg_data = 0, ret;
+
+ reg_data = WCN36XX_DXE_REG_RESET;
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CSR_RESET, reg_data);
+
+ /* Setting interrupt path */
+ reg_data = WCN36XX_DXE_CCU_INT;
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_REG_CCU_INT, reg_data);
+
+ /***************************************/
+ /* Init descriptors for TX LOW channel */
+ /***************************************/
+ wcn36xx_dxe_init_descs(&wcn->dxe_tx_l_ch);
+ wcn36xx_dxe_init_tx_bd(&wcn->dxe_tx_l_ch, &wcn->data_mem_pool);
+
+ /* Write channel head to a NEXT register */
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_L,
+ wcn->dxe_tx_l_ch.head_blk_ctl->desc_phy_addr);
+
+ /* Program DMA destination addr for TX LOW */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_DEST_ADDR_TX_L,
+ WCN36XX_DXE_WQ_TX_L);
+
+ wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data);
+ wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_L);
+
+ /***************************************/
+ /* Init descriptors for TX HIGH channel */
+ /***************************************/
+ wcn36xx_dxe_init_descs(&wcn->dxe_tx_h_ch);
+ wcn36xx_dxe_init_tx_bd(&wcn->dxe_tx_h_ch, &wcn->mgmt_mem_pool);
+
+ /* Write channel head to a NEXT register */
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_H,
+ wcn->dxe_tx_h_ch.head_blk_ctl->desc_phy_addr);
+
+ /* Program DMA destination addr for TX HIGH */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_DEST_ADDR_TX_H,
+ WCN36XX_DXE_WQ_TX_H);
+
+ wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, ®_data);
+
+ /* Enable channel interrupts */
+ wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_TX_H);
+
+ /***************************************/
+ /* Init descriptors for RX LOW channel */
+ /***************************************/
+ wcn36xx_dxe_init_descs(&wcn->dxe_rx_l_ch);
+
+ /* For RX we need to preallocated buffers */
+ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_l_ch);
+
+ /* Write channel head to a NEXT register */
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_L,
+ wcn->dxe_rx_l_ch.head_blk_ctl->desc_phy_addr);
+
+ /* Write DMA source address */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_SRC_ADDR_RX_L,
+ WCN36XX_DXE_WQ_RX_L);
+
+ /* Program preallocated destination address */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_DEST_ADDR_RX_L,
+ wcn->dxe_rx_l_ch.head_blk_ctl->desc->phy_next_l);
+
+ /* Enable default control registers */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_REG_CTL_RX_L,
+ WCN36XX_DXE_CH_DEFAULT_CTL_RX_L);
+
+ /* Enable channel interrupts */
+ wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_L);
+
+ /***************************************/
+ /* Init descriptors for RX HIGH channel */
+ /***************************************/
+ wcn36xx_dxe_init_descs(&wcn->dxe_rx_h_ch);
+
+ /* For RX we need to prealocat buffers */
+ wcn36xx_dxe_ch_alloc_skb(wcn, &wcn->dxe_rx_h_ch);
+
+ /* Write chanel head to a NEXT register */
+ wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_H,
+ wcn->dxe_rx_h_ch.head_blk_ctl->desc_phy_addr);
+
+ /* Write DMA source address */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_SRC_ADDR_RX_H,
+ WCN36XX_DXE_WQ_RX_H);
+
+ /* Program preallocated destination address */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_CH_DEST_ADDR_RX_H,
+ wcn->dxe_rx_h_ch.head_blk_ctl->desc->phy_next_l);
+
+ /* Enable default control registers */
+ wcn36xx_dxe_write_register(wcn,
+ WCN36XX_DXE_REG_CTL_RX_H,
+ WCN36XX_DXE_CH_DEFAULT_CTL_RX_H);
+
+ /* Enable channel interrupts */
+ wcn36xx_dxe_enable_ch_int(wcn, WCN36XX_INT_MASK_CHAN_RX_H);
+
+ ret = wcn36xx_dxe_request_irqs(wcn);
+ if (ret < 0)
+ goto out_err;
+
+ return 0;
+
+out_err:
+ return ret;
+}
+
+void wcn36xx_dxe_deinit(struct wcn36xx *wcn)
+{
+ free_irq(wcn->tx_irq, wcn);
+ free_irq(wcn->rx_irq, wcn);
+
+ if (wcn->tx_ack_skb) {
+ ieee80211_tx_status_irqsafe(wcn->hw, wcn->tx_ack_skb);
+ wcn->tx_ack_skb = NULL;
+ }
+
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_l_ch);
+ wcn36xx_dxe_ch_free_skbs(wcn, &wcn->dxe_rx_h_ch);
+}
diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.h b/drivers/net/wireless/ath/wcn36xx/dxe.h
new file mode 100644
index 0000000..c88562f
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/dxe.h
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _DXE_H_
+#define _DXE_H_
+
+#include "wcn36xx.h"
+
+/*
+TX_LOW = DMA0
+TX_HIGH = DMA4
+RX_LOW = DMA1
+RX_HIGH = DMA3
+H2H_TEST_RX_TX = DMA2
+*/
+
+/* DXE registers */
+#define WCN36XX_DXE_MEM_BASE 0x03000000
+#define WCN36XX_DXE_MEM_REG 0x202000
+
+#define WCN36XX_DXE_CCU_INT 0xA0011
+#define WCN36XX_DXE_REG_CCU_INT 0x200b10
+
+/* TODO This must calculated properly but not hardcoded */
+#define WCN36XX_DXE_CTRL_TX_L 0x328a44
+#define WCN36XX_DXE_CTRL_TX_H 0x32ce44
+#define WCN36XX_DXE_CTRL_RX_L 0x12ad2f
+#define WCN36XX_DXE_CTRL_RX_H 0x12d12f
+#define WCN36XX_DXE_CTRL_TX_H_BD 0x30ce45
+#define WCN36XX_DXE_CTRL_TX_H_SKB 0x32ce4d
+#define WCN36XX_DXE_CTRL_TX_L_BD 0x308a45
+#define WCN36XX_DXE_CTRL_TX_L_SKB 0x328a4d
+
+/* TODO This must calculated properly but not hardcoded */
+#define WCN36XX_DXE_WQ_TX_L 0x17
+#define WCN36XX_DXE_WQ_TX_H 0x17
+#define WCN36XX_DXE_WQ_RX_L 0xB
+#define WCN36XX_DXE_WQ_RX_H 0x4
+
+/* DXE descriptor control filed */
+#define WCN36XX_DXE_CTRL_VALID_MASK (0x00000001)
+
+/* TODO This must calculated properly but not hardcoded */
+/* DXE default control register values */
+#define WCN36XX_DXE_CH_DEFAULT_CTL_RX_L 0x847EAD2F
+#define WCN36XX_DXE_CH_DEFAULT_CTL_RX_H 0x84FED12F
+#define WCN36XX_DXE_CH_DEFAULT_CTL_TX_H 0x853ECF4D
+#define WCN36XX_DXE_CH_DEFAULT_CTL_TX_L 0x843e8b4d
+
+/* Common DXE registers */
+#define WCN36XX_DXE_MEM_CSR (WCN36XX_DXE_MEM_REG + 0x00)
+#define WCN36XX_DXE_REG_CSR_RESET (WCN36XX_DXE_MEM_REG + 0x00)
+#define WCN36XX_DXE_ENCH_ADDR (WCN36XX_DXE_MEM_REG + 0x04)
+#define WCN36XX_DXE_REG_CH_EN (WCN36XX_DXE_MEM_REG + 0x08)
+#define WCN36XX_DXE_REG_CH_DONE (WCN36XX_DXE_MEM_REG + 0x0C)
+#define WCN36XX_DXE_REG_CH_ERR (WCN36XX_DXE_MEM_REG + 0x10)
+#define WCN36XX_DXE_INT_MASK_REG (WCN36XX_DXE_MEM_REG + 0x18)
+#define WCN36XX_DXE_INT_SRC_RAW_REG (WCN36XX_DXE_MEM_REG + 0x20)
+ /* #define WCN36XX_DXE_INT_CH6_MASK 0x00000040 */
+ /* #define WCN36XX_DXE_INT_CH5_MASK 0x00000020 */
+ #define WCN36XX_DXE_INT_CH4_MASK 0x00000010
+ #define WCN36XX_DXE_INT_CH3_MASK 0x00000008
+ /* #define WCN36XX_DXE_INT_CH2_MASK 0x00000004 */
+ #define WCN36XX_DXE_INT_CH1_MASK 0x00000002
+ #define WCN36XX_DXE_INT_CH0_MASK 0x00000001
+#define WCN36XX_DXE_0_INT_CLR (WCN36XX_DXE_MEM_REG + 0x30)
+#define WCN36XX_DXE_0_INT_ED_CLR (WCN36XX_DXE_MEM_REG + 0x34)
+#define WCN36XX_DXE_0_INT_DONE_CLR (WCN36XX_DXE_MEM_REG + 0x38)
+#define WCN36XX_DXE_0_INT_ERR_CLR (WCN36XX_DXE_MEM_REG + 0x3C)
+
+#define WCN36XX_DXE_0_CH0_STATUS (WCN36XX_DXE_MEM_REG + 0x404)
+#define WCN36XX_DXE_0_CH1_STATUS (WCN36XX_DXE_MEM_REG + 0x444)
+#define WCN36XX_DXE_0_CH2_STATUS (WCN36XX_DXE_MEM_REG + 0x484)
+#define WCN36XX_DXE_0_CH3_STATUS (WCN36XX_DXE_MEM_REG + 0x4C4)
+#define WCN36XX_DXE_0_CH4_STATUS (WCN36XX_DXE_MEM_REG + 0x504)
+
+#define WCN36XX_DXE_REG_RESET 0x5c89
+
+/* Temporary BMU Workqueue 4 */
+#define WCN36XX_DXE_BMU_WQ_RX_LOW 0xB
+#define WCN36XX_DXE_BMU_WQ_RX_HIGH 0x4
+/* DMA channel offset */
+#define WCN36XX_DXE_TX_LOW_OFFSET 0x400
+#define WCN36XX_DXE_TX_HIGH_OFFSET 0x500
+#define WCN36XX_DXE_RX_LOW_OFFSET 0x440
+#define WCN36XX_DXE_RX_HIGH_OFFSET 0x4C0
+
+/* Address of the next DXE descriptor */
+#define WCN36XX_DXE_CH_NEXT_DESC_ADDR 0x001C
+#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_NEXT_DESC_ADDR)
+#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_NEXT_DESC_ADDR)
+#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_NEXT_DESC_ADDR)
+#define WCN36XX_DXE_CH_NEXT_DESC_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_NEXT_DESC_ADDR)
+
+/* DXE Descriptor source address */
+#define WCN36XX_DXE_CH_SRC_ADDR 0x000C
+#define WCN36XX_DXE_CH_SRC_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_SRC_ADDR)
+#define WCN36XX_DXE_CH_SRC_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_SRC_ADDR)
+
+/* DXE Descriptor address destination address */
+#define WCN36XX_DXE_CH_DEST_ADDR 0x0014
+#define WCN36XX_DXE_CH_DEST_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_DEST_ADDR)
+#define WCN36XX_DXE_CH_DEST_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_DEST_ADDR)
+#define WCN36XX_DXE_CH_DEST_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_DEST_ADDR)
+#define WCN36XX_DXE_CH_DEST_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_DEST_ADDR)
+
+/* Interrupt status */
+#define WCN36XX_DXE_CH_STATUS_REG_ADDR 0x0004
+#define WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_STATUS_REG_ADDR)
+#define WCN36XX_DXE_CH_STATUS_REG_ADDR_TX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_STATUS_REG_ADDR)
+#define WCN36XX_DXE_CH_STATUS_REG_ADDR_RX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_LOW_OFFSET + \
+ WCN36XX_DXE_CH_STATUS_REG_ADDR)
+#define WCN36XX_DXE_CH_STATUS_REG_ADDR_RX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_HIGH_OFFSET + \
+ WCN36XX_DXE_CH_STATUS_REG_ADDR)
+
+
+/* DXE default control register */
+#define WCN36XX_DXE_REG_CTL_RX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_LOW_OFFSET)
+#define WCN36XX_DXE_REG_CTL_RX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_RX_HIGH_OFFSET)
+#define WCN36XX_DXE_REG_CTL_TX_H (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_HIGH_OFFSET)
+#define WCN36XX_DXE_REG_CTL_TX_L (WCN36XX_DXE_MEM_REG + \
+ WCN36XX_DXE_TX_LOW_OFFSET)
+
+#define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400
+#define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200
+
+
+/* Interrupt control channel mask */
+#define WCN36XX_INT_MASK_CHAN_TX_L 0x00000001
+#define WCN36XX_INT_MASK_CHAN_RX_L 0x00000002
+#define WCN36XX_INT_MASK_CHAN_RX_H 0x00000008
+#define WCN36XX_INT_MASK_CHAN_TX_H 0x00000010
+
+#define WCN36XX_BD_CHUNK_SIZE 128
+
+#define WCN36XX_PKT_SIZE 0xF20
+enum wcn36xx_dxe_ch_type {
+ WCN36XX_DXE_CH_TX_L,
+ WCN36XX_DXE_CH_TX_H,
+ WCN36XX_DXE_CH_RX_L,
+ WCN36XX_DXE_CH_RX_H
+};
+
+/* amount of descriptors per channel */
+enum wcn36xx_dxe_ch_desc_num {
+ WCN36XX_DXE_CH_DESC_NUMB_TX_L = 128,
+ WCN36XX_DXE_CH_DESC_NUMB_TX_H = 10,
+ WCN36XX_DXE_CH_DESC_NUMB_RX_L = 512,
+ WCN36XX_DXE_CH_DESC_NUMB_RX_H = 40
+};
+
+/**
+ * struct wcn36xx_dxe_desc - describes descriptor of one DXE buffer
+ *
+ * @ctrl: is a union that consists of following bits:
+ * union {
+ * u32 valid :1; //0 = DMA stop, 1 = DMA continue with this
+ * //descriptor
+ * u32 transfer_type :2; //0 = Host to Host space
+ * u32 eop :1; //End of Packet
+ * u32 bd_handling :1; //if transferType = Host to BMU, then 0
+ * // means first 128 bytes contain BD, and 1
+ * // means create new empty BD
+ * u32 siq :1; // SIQ
+ * u32 diq :1; // DIQ
+ * u32 pdu_rel :1; //0 = don't release BD and PDUs when done,
+ * // 1 = release them
+ * u32 bthld_sel :4; //BMU Threshold Select
+ * u32 prio :3; //Specifies the priority level to use for
+ * // the transfer
+ * u32 stop_channel :1; //1 = DMA stops processing further, channel
+ * //requires re-enabling after this
+ * u32 intr :1; //Interrupt on Descriptor Done
+ * u32 rsvd :1; //reserved
+ * u32 size :14;//14 bits used - ignored for BMU transfers,
+ * //only used for host to host transfers?
+ * } ctrl;
+ */
+struct wcn36xx_dxe_desc {
+ u32 ctrl;
+ u32 fr_len;
+
+ u32 src_addr_l;
+ u32 dst_addr_l;
+ u32 phy_next_l;
+ u32 src_addr_h;
+ u32 dst_addr_h;
+ u32 phy_next_h;
+} __packed;
+
+/* DXE Control block */
+struct wcn36xx_dxe_ctl {
+ struct wcn36xx_dxe_ctl *next;
+ struct wcn36xx_dxe_desc *desc;
+ unsigned int desc_phy_addr;
+ int ctl_blk_order;
+ struct sk_buff *skb;
+ spinlock_t skb_lock;
+ void *bd_cpu_addr;
+ dma_addr_t bd_phy_addr;
+};
+
+struct wcn36xx_dxe_ch {
+ enum wcn36xx_dxe_ch_type ch_type;
+ void *cpu_addr;
+ dma_addr_t dma_addr;
+ enum wcn36xx_dxe_ch_desc_num desc_num;
+ /* DXE control block ring */
+ struct wcn36xx_dxe_ctl *head_blk_ctl;
+ struct wcn36xx_dxe_ctl *tail_blk_ctl;
+
+ /* DXE channel specific configs */
+ u32 dxe_wq;
+ u32 ctrl_bd;
+ u32 ctrl_skb;
+ u32 reg_ctrl;
+ u32 def_ctrl;
+};
+
+/* Memory Pool for BD headers */
+struct wcn36xx_dxe_mem_pool {
+ int chunk_size;
+ void *virt_addr;
+ dma_addr_t phy_addr;
+};
+
+struct wcn36xx_vif;
+int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn);
+void wcn36xx_dxe_free_mem_pools(struct wcn36xx *wcn);
+void wcn36xx_dxe_rx_frame(struct wcn36xx *wcn);
+int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn);
+void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn);
+int wcn36xx_dxe_init(struct wcn36xx *wcn);
+void wcn36xx_dxe_deinit(struct wcn36xx *wcn);
+int wcn36xx_dxe_init_channels(struct wcn36xx *wcn);
+int wcn36xx_dxe_tx_frame(struct wcn36xx *wcn,
+ struct wcn36xx_vif *vif_priv,
+ struct sk_buff *skb,
+ bool is_low);
+void wcn36xx_dxe_tx_ack_ind(struct wcn36xx *wcn, u32 status);
+void *wcn36xx_dxe_get_next_bd(struct wcn36xx *wcn, bool is_low);
+#endif /* _DXE_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h
new file mode 100644
index 0000000..c02dbc6
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -0,0 +1,4657 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _HAL_H_
+#define _HAL_H_
+
+/*---------------------------------------------------------------------------
+ API VERSIONING INFORMATION
+
+ The RIVA API is versioned as MAJOR.MINOR.VERSION.REVISION
+ The MAJOR is incremented for major product/architecture changes
+ (and then MINOR/VERSION/REVISION are zeroed)
+ The MINOR is incremented for minor product/architecture changes
+ (and then VERSION/REVISION are zeroed)
+ The VERSION is incremented if a significant API change occurs
+ (and then REVISION is zeroed)
+ The REVISION is incremented if an insignificant API change occurs
+ or if a new API is added
+ All values are in the range 0..255 (ie they are 8-bit values)
+ ---------------------------------------------------------------------------*/
+#define WCN36XX_HAL_VER_MAJOR 1
+#define WCN36XX_HAL_VER_MINOR 4
+#define WCN36XX_HAL_VER_VERSION 1
+#define WCN36XX_HAL_VER_REVISION 2
+
+/* This is to force compiler to use the maximum of an int ( 4 bytes ) */
+#define WCN36XX_HAL_MAX_ENUM_SIZE 0x7FFFFFFF
+#define WCN36XX_HAL_MSG_TYPE_MAX_ENUM_SIZE 0x7FFF
+
+/* Max no. of transmit categories */
+#define STACFG_MAX_TC 8
+
+/* The maximum value of access category */
+#define WCN36XX_HAL_MAX_AC 4
+
+#define WCN36XX_HAL_IPV4_ADDR_LEN 4
+
+#define WALN_HAL_STA_INVALID_IDX 0xFF
+#define WCN36XX_HAL_BSS_INVALID_IDX 0xFF
+
+/* Default Beacon template size */
+#define BEACON_TEMPLATE_SIZE 0x180
+
+/* Param Change Bitmap sent to HAL */
+#define PARAM_BCN_INTERVAL_CHANGED (1 << 0)
+#define PARAM_SHORT_PREAMBLE_CHANGED (1 << 1)
+#define PARAM_SHORT_SLOT_TIME_CHANGED (1 << 2)
+#define PARAM_llACOEXIST_CHANGED (1 << 3)
+#define PARAM_llBCOEXIST_CHANGED (1 << 4)
+#define PARAM_llGCOEXIST_CHANGED (1 << 5)
+#define PARAM_HT20MHZCOEXIST_CHANGED (1<<6)
+#define PARAM_NON_GF_DEVICES_PRESENT_CHANGED (1<<7)
+#define PARAM_RIFS_MODE_CHANGED (1<<8)
+#define PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED (1<<9)
+#define PARAM_OBSS_MODE_CHANGED (1<<10)
+#define PARAM_BEACON_UPDATE_MASK \
+ (PARAM_BCN_INTERVAL_CHANGED | \
+ PARAM_SHORT_PREAMBLE_CHANGED | \
+ PARAM_SHORT_SLOT_TIME_CHANGED | \
+ PARAM_llACOEXIST_CHANGED | \
+ PARAM_llBCOEXIST_CHANGED | \
+ PARAM_llGCOEXIST_CHANGED | \
+ PARAM_HT20MHZCOEXIST_CHANGED | \
+ PARAM_NON_GF_DEVICES_PRESENT_CHANGED | \
+ PARAM_RIFS_MODE_CHANGED | \
+ PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED | \
+ PARAM_OBSS_MODE_CHANGED)
+
+/* dump command response Buffer size */
+#define DUMPCMD_RSP_BUFFER 100
+
+/* version string max length (including NULL) */
+#define WCN36XX_HAL_VERSION_LENGTH 64
+
+/* message types for messages exchanged between WDI and HAL */
+enum wcn36xx_hal_host_msg_type {
+ /* Init/De-Init */
+ WCN36XX_HAL_START_REQ = 0,
+ WCN36XX_HAL_START_RSP = 1,
+ WCN36XX_HAL_STOP_REQ = 2,
+ WCN36XX_HAL_STOP_RSP = 3,
+
+ /* Scan */
+ WCN36XX_HAL_INIT_SCAN_REQ = 4,
+ WCN36XX_HAL_INIT_SCAN_RSP = 5,
+ WCN36XX_HAL_START_SCAN_REQ = 6,
+ WCN36XX_HAL_START_SCAN_RSP = 7,
+ WCN36XX_HAL_END_SCAN_REQ = 8,
+ WCN36XX_HAL_END_SCAN_RSP = 9,
+ WCN36XX_HAL_FINISH_SCAN_REQ = 10,
+ WCN36XX_HAL_FINISH_SCAN_RSP = 11,
+
+ /* HW STA configuration/deconfiguration */
+ WCN36XX_HAL_CONFIG_STA_REQ = 12,
+ WCN36XX_HAL_CONFIG_STA_RSP = 13,
+ WCN36XX_HAL_DELETE_STA_REQ = 14,
+ WCN36XX_HAL_DELETE_STA_RSP = 15,
+ WCN36XX_HAL_CONFIG_BSS_REQ = 16,
+ WCN36XX_HAL_CONFIG_BSS_RSP = 17,
+ WCN36XX_HAL_DELETE_BSS_REQ = 18,
+ WCN36XX_HAL_DELETE_BSS_RSP = 19,
+
+ /* Infra STA asscoiation */
+ WCN36XX_HAL_JOIN_REQ = 20,
+ WCN36XX_HAL_JOIN_RSP = 21,
+ WCN36XX_HAL_POST_ASSOC_REQ = 22,
+ WCN36XX_HAL_POST_ASSOC_RSP = 23,
+
+ /* Security */
+ WCN36XX_HAL_SET_BSSKEY_REQ = 24,
+ WCN36XX_HAL_SET_BSSKEY_RSP = 25,
+ WCN36XX_HAL_SET_STAKEY_REQ = 26,
+ WCN36XX_HAL_SET_STAKEY_RSP = 27,
+ WCN36XX_HAL_RMV_BSSKEY_REQ = 28,
+ WCN36XX_HAL_RMV_BSSKEY_RSP = 29,
+ WCN36XX_HAL_RMV_STAKEY_REQ = 30,
+ WCN36XX_HAL_RMV_STAKEY_RSP = 31,
+
+ /* Qos Related */
+ WCN36XX_HAL_ADD_TS_REQ = 32,
+ WCN36XX_HAL_ADD_TS_RSP = 33,
+ WCN36XX_HAL_DEL_TS_REQ = 34,
+ WCN36XX_HAL_DEL_TS_RSP = 35,
+ WCN36XX_HAL_UPD_EDCA_PARAMS_REQ = 36,
+ WCN36XX_HAL_UPD_EDCA_PARAMS_RSP = 37,
+ WCN36XX_HAL_ADD_BA_REQ = 38,
+ WCN36XX_HAL_ADD_BA_RSP = 39,
+ WCN36XX_HAL_DEL_BA_REQ = 40,
+ WCN36XX_HAL_DEL_BA_RSP = 41,
+
+ WCN36XX_HAL_CH_SWITCH_REQ = 42,
+ WCN36XX_HAL_CH_SWITCH_RSP = 43,
+ WCN36XX_HAL_SET_LINK_ST_REQ = 44,
+ WCN36XX_HAL_SET_LINK_ST_RSP = 45,
+ WCN36XX_HAL_GET_STATS_REQ = 46,
+ WCN36XX_HAL_GET_STATS_RSP = 47,
+ WCN36XX_HAL_UPDATE_CFG_REQ = 48,
+ WCN36XX_HAL_UPDATE_CFG_RSP = 49,
+
+ WCN36XX_HAL_MISSED_BEACON_IND = 50,
+ WCN36XX_HAL_UNKNOWN_ADDR2_FRAME_RX_IND = 51,
+ WCN36XX_HAL_MIC_FAILURE_IND = 52,
+ WCN36XX_HAL_FATAL_ERROR_IND = 53,
+ WCN36XX_HAL_SET_KEYDONE_MSG = 54,
+
+ /* NV Interface */
+ WCN36XX_HAL_DOWNLOAD_NV_REQ = 55,
+ WCN36XX_HAL_DOWNLOAD_NV_RSP = 56,
+
+ WCN36XX_HAL_ADD_BA_SESSION_REQ = 57,
+ WCN36XX_HAL_ADD_BA_SESSION_RSP = 58,
+ WCN36XX_HAL_TRIGGER_BA_REQ = 59,
+ WCN36XX_HAL_TRIGGER_BA_RSP = 60,
+ WCN36XX_HAL_UPDATE_BEACON_REQ = 61,
+ WCN36XX_HAL_UPDATE_BEACON_RSP = 62,
+ WCN36XX_HAL_SEND_BEACON_REQ = 63,
+ WCN36XX_HAL_SEND_BEACON_RSP = 64,
+
+ WCN36XX_HAL_SET_BCASTKEY_REQ = 65,
+ WCN36XX_HAL_SET_BCASTKEY_RSP = 66,
+ WCN36XX_HAL_DELETE_STA_CONTEXT_IND = 67,
+ WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ = 68,
+ WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_RSP = 69,
+
+ /* PTT interface support */
+ WCN36XX_HAL_PROCESS_PTT_REQ = 70,
+ WCN36XX_HAL_PROCESS_PTT_RSP = 71,
+
+ /* BTAMP related events */
+ WCN36XX_HAL_SIGNAL_BTAMP_EVENT_REQ = 72,
+ WCN36XX_HAL_SIGNAL_BTAMP_EVENT_RSP = 73,
+ WCN36XX_HAL_TL_HAL_FLUSH_AC_REQ = 74,
+ WCN36XX_HAL_TL_HAL_FLUSH_AC_RSP = 75,
+
+ WCN36XX_HAL_ENTER_IMPS_REQ = 76,
+ WCN36XX_HAL_EXIT_IMPS_REQ = 77,
+ WCN36XX_HAL_ENTER_BMPS_REQ = 78,
+ WCN36XX_HAL_EXIT_BMPS_REQ = 79,
+ WCN36XX_HAL_ENTER_UAPSD_REQ = 80,
+ WCN36XX_HAL_EXIT_UAPSD_REQ = 81,
+ WCN36XX_HAL_UPDATE_UAPSD_PARAM_REQ = 82,
+ WCN36XX_HAL_CONFIGURE_RXP_FILTER_REQ = 83,
+ WCN36XX_HAL_ADD_BCN_FILTER_REQ = 84,
+ WCN36XX_HAL_REM_BCN_FILTER_REQ = 85,
+ WCN36XX_HAL_ADD_WOWL_BCAST_PTRN = 86,
+ WCN36XX_HAL_DEL_WOWL_BCAST_PTRN = 87,
+ WCN36XX_HAL_ENTER_WOWL_REQ = 88,
+ WCN36XX_HAL_EXIT_WOWL_REQ = 89,
+ WCN36XX_HAL_HOST_OFFLOAD_REQ = 90,
+ WCN36XX_HAL_SET_RSSI_THRESH_REQ = 91,
+ WCN36XX_HAL_GET_RSSI_REQ = 92,
+ WCN36XX_HAL_SET_UAPSD_AC_PARAMS_REQ = 93,
+ WCN36XX_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_REQ = 94,
+
+ WCN36XX_HAL_ENTER_IMPS_RSP = 95,
+ WCN36XX_HAL_EXIT_IMPS_RSP = 96,
+ WCN36XX_HAL_ENTER_BMPS_RSP = 97,
+ WCN36XX_HAL_EXIT_BMPS_RSP = 98,
+ WCN36XX_HAL_ENTER_UAPSD_RSP = 99,
+ WCN36XX_HAL_EXIT_UAPSD_RSP = 100,
+ WCN36XX_HAL_SET_UAPSD_AC_PARAMS_RSP = 101,
+ WCN36XX_HAL_UPDATE_UAPSD_PARAM_RSP = 102,
+ WCN36XX_HAL_CONFIGURE_RXP_FILTER_RSP = 103,
+ WCN36XX_HAL_ADD_BCN_FILTER_RSP = 104,
+ WCN36XX_HAL_REM_BCN_FILTER_RSP = 105,
+ WCN36XX_HAL_SET_RSSI_THRESH_RSP = 106,
+ WCN36XX_HAL_HOST_OFFLOAD_RSP = 107,
+ WCN36XX_HAL_ADD_WOWL_BCAST_PTRN_RSP = 108,
+ WCN36XX_HAL_DEL_WOWL_BCAST_PTRN_RSP = 109,
+ WCN36XX_HAL_ENTER_WOWL_RSP = 110,
+ WCN36XX_HAL_EXIT_WOWL_RSP = 111,
+ WCN36XX_HAL_RSSI_NOTIFICATION_IND = 112,
+ WCN36XX_HAL_GET_RSSI_RSP = 113,
+ WCN36XX_HAL_CONFIGURE_APPS_CPU_WAKEUP_STATE_RSP = 114,
+
+ /* 11k related events */
+ WCN36XX_HAL_SET_MAX_TX_POWER_REQ = 115,
+ WCN36XX_HAL_SET_MAX_TX_POWER_RSP = 116,
+
+ /* 11R related msgs */
+ WCN36XX_HAL_AGGR_ADD_TS_REQ = 117,
+ WCN36XX_HAL_AGGR_ADD_TS_RSP = 118,
+
+ /* P2P WLAN_FEATURE_P2P */
+ WCN36XX_HAL_SET_P2P_GONOA_REQ = 119,
+ WCN36XX_HAL_SET_P2P_GONOA_RSP = 120,
+
+ /* WLAN Dump commands */
+ WCN36XX_HAL_DUMP_COMMAND_REQ = 121,
+ WCN36XX_HAL_DUMP_COMMAND_RSP = 122,
+
+ /* OEM_DATA FEATURE SUPPORT */
+ WCN36XX_HAL_START_OEM_DATA_REQ = 123,
+ WCN36XX_HAL_START_OEM_DATA_RSP = 124,
+
+ /* ADD SELF STA REQ and RSP */
+ WCN36XX_HAL_ADD_STA_SELF_REQ = 125,
+ WCN36XX_HAL_ADD_STA_SELF_RSP = 126,
+
+ /* DEL SELF STA SUPPORT */
+ WCN36XX_HAL_DEL_STA_SELF_REQ = 127,
+ WCN36XX_HAL_DEL_STA_SELF_RSP = 128,
+
+ /* Coex Indication */
+ WCN36XX_HAL_COEX_IND = 129,
+
+ /* Tx Complete Indication */
+ WCN36XX_HAL_OTA_TX_COMPL_IND = 130,
+
+ /* Host Suspend/resume messages */
+ WCN36XX_HAL_HOST_SUSPEND_IND = 131,
+ WCN36XX_HAL_HOST_RESUME_REQ = 132,
+ WCN36XX_HAL_HOST_RESUME_RSP = 133,
+
+ WCN36XX_HAL_SET_TX_POWER_REQ = 134,
+ WCN36XX_HAL_SET_TX_POWER_RSP = 135,
+ WCN36XX_HAL_GET_TX_POWER_REQ = 136,
+ WCN36XX_HAL_GET_TX_POWER_RSP = 137,
+
+ WCN36XX_HAL_P2P_NOA_ATTR_IND = 138,
+
+ WCN36XX_HAL_ENABLE_RADAR_DETECT_REQ = 139,
+ WCN36XX_HAL_ENABLE_RADAR_DETECT_RSP = 140,
+ WCN36XX_HAL_GET_TPC_REPORT_REQ = 141,
+ WCN36XX_HAL_GET_TPC_REPORT_RSP = 142,
+ WCN36XX_HAL_RADAR_DETECT_IND = 143,
+ WCN36XX_HAL_RADAR_DETECT_INTR_IND = 144,
+ WCN36XX_HAL_KEEP_ALIVE_REQ = 145,
+ WCN36XX_HAL_KEEP_ALIVE_RSP = 146,
+
+ /* PNO messages */
+ WCN36XX_HAL_SET_PREF_NETWORK_REQ = 147,
+ WCN36XX_HAL_SET_PREF_NETWORK_RSP = 148,
+ WCN36XX_HAL_SET_RSSI_FILTER_REQ = 149,
+ WCN36XX_HAL_SET_RSSI_FILTER_RSP = 150,
+ WCN36XX_HAL_UPDATE_SCAN_PARAM_REQ = 151,
+ WCN36XX_HAL_UPDATE_SCAN_PARAM_RSP = 152,
+ WCN36XX_HAL_PREF_NETW_FOUND_IND = 153,
+
+ WCN36XX_HAL_SET_TX_PER_TRACKING_REQ = 154,
+ WCN36XX_HAL_SET_TX_PER_TRACKING_RSP = 155,
+ WCN36XX_HAL_TX_PER_HIT_IND = 156,
+
+ WCN36XX_HAL_8023_MULTICAST_LIST_REQ = 157,
+ WCN36XX_HAL_8023_MULTICAST_LIST_RSP = 158,
+
+ WCN36XX_HAL_SET_PACKET_FILTER_REQ = 159,
+ WCN36XX_HAL_SET_PACKET_FILTER_RSP = 160,
+ WCN36XX_HAL_PACKET_FILTER_MATCH_COUNT_REQ = 161,
+ WCN36XX_HAL_PACKET_FILTER_MATCH_COUNT_RSP = 162,
+ WCN36XX_HAL_CLEAR_PACKET_FILTER_REQ = 163,
+ WCN36XX_HAL_CLEAR_PACKET_FILTER_RSP = 164,
+
+ /*
+ * This is temp fix. Should be removed once Host and Riva code is
+ * in sync.
+ */
+ WCN36XX_HAL_INIT_SCAN_CON_REQ = 165,
+
+ WCN36XX_HAL_SET_POWER_PARAMS_REQ = 166,
+ WCN36XX_HAL_SET_POWER_PARAMS_RSP = 167,
+
+ WCN36XX_HAL_TSM_STATS_REQ = 168,
+ WCN36XX_HAL_TSM_STATS_RSP = 169,
+
+ /* wake reason indication (WOW) */
+ WCN36XX_HAL_WAKE_REASON_IND = 170,
+
+ /* GTK offload support */
+ WCN36XX_HAL_GTK_OFFLOAD_REQ = 171,
+ WCN36XX_HAL_GTK_OFFLOAD_RSP = 172,
+ WCN36XX_HAL_GTK_OFFLOAD_GETINFO_REQ = 173,
+ WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP = 174,
+
+ WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ = 175,
+ WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_RSP = 176,
+ WCN36XX_HAL_EXCLUDE_UNENCRYPTED_IND = 177,
+
+ WCN36XX_HAL_SET_THERMAL_MITIGATION_REQ = 178,
+ WCN36XX_HAL_SET_THERMAL_MITIGATION_RSP = 179,
+
+ WCN36XX_HAL_UPDATE_VHT_OP_MODE_REQ = 182,
+ WCN36XX_HAL_UPDATE_VHT_OP_MODE_RSP = 183,
+
+ WCN36XX_HAL_P2P_NOA_START_IND = 184,
+
+ WCN36XX_HAL_GET_ROAM_RSSI_REQ = 185,
+ WCN36XX_HAL_GET_ROAM_RSSI_RSP = 186,
+
+ WCN36XX_HAL_CLASS_B_STATS_IND = 187,
+ WCN36XX_HAL_DEL_BA_IND = 188,
+ WCN36XX_HAL_DHCP_START_IND = 189,
+ WCN36XX_HAL_DHCP_STOP_IND = 190,
+
+ WCN36XX_HAL_MSG_MAX = WCN36XX_HAL_MSG_TYPE_MAX_ENUM_SIZE
+};
+
+/* Enumeration for Version */
+enum wcn36xx_hal_host_msg_version {
+ WCN36XX_HAL_MSG_VERSION0 = 0,
+ WCN36XX_HAL_MSG_VERSION1 = 1,
+ /* define as 2 bytes data */
+ WCN36XX_HAL_MSG_WCNSS_CTRL_VERSION = 0x7FFF,
+ WCN36XX_HAL_MSG_VERSION_MAX_FIELD = WCN36XX_HAL_MSG_WCNSS_CTRL_VERSION
+};
+
+enum driver_type {
+ DRIVER_TYPE_PRODUCTION = 0,
+ DRIVER_TYPE_MFG = 1,
+ DRIVER_TYPE_DVT = 2,
+ DRIVER_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_stop_type {
+ HAL_STOP_TYPE_SYS_RESET,
+ HAL_STOP_TYPE_SYS_DEEP_SLEEP,
+ HAL_STOP_TYPE_RF_KILL,
+ HAL_STOP_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_sys_mode {
+ HAL_SYS_MODE_NORMAL,
+ HAL_SYS_MODE_LEARN,
+ HAL_SYS_MODE_SCAN,
+ HAL_SYS_MODE_PROMISC,
+ HAL_SYS_MODE_SUSPEND_LINK,
+ HAL_SYS_MODE_ROAM_SCAN,
+ HAL_SYS_MODE_ROAM_SUSPEND_LINK,
+ HAL_SYS_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum phy_chan_bond_state {
+ /* 20MHz IF bandwidth centered on IF carrier */
+ PHY_SINGLE_CHANNEL_CENTERED = 0,
+
+ /* 40MHz IF bandwidth with lower 20MHz supporting the primary channel */
+ PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1,
+
+ /* 40MHz IF bandwidth centered on IF carrier */
+ PHY_DOUBLE_CHANNEL_CENTERED = 2,
+
+ /* 40MHz IF bandwidth with higher 20MHz supporting the primary ch */
+ PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3,
+
+ /* 20/40MHZ offset LOW 40/80MHZ offset CENTERED */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED = 4,
+
+ /* 20/40MHZ offset CENTERED 40/80MHZ offset CENTERED */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED = 5,
+
+ /* 20/40MHZ offset HIGH 40/80MHZ offset CENTERED */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED = 6,
+
+ /* 20/40MHZ offset LOW 40/80MHZ offset LOW */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW = 7,
+
+ /* 20/40MHZ offset HIGH 40/80MHZ offset LOW */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW = 8,
+
+ /* 20/40MHZ offset LOW 40/80MHZ offset HIGH */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH = 9,
+
+ /* 20/40MHZ offset-HIGH 40/80MHZ offset HIGH */
+ PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH = 10,
+
+ PHY_CHANNEL_BONDING_STATE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* Spatial Multiplexing(SM) Power Save mode */
+enum wcn36xx_hal_ht_mimo_state {
+ /* Static SM Power Save mode */
+ WCN36XX_HAL_HT_MIMO_PS_STATIC = 0,
+
+ /* Dynamic SM Power Save mode */
+ WCN36XX_HAL_HT_MIMO_PS_DYNAMIC = 1,
+
+ /* reserved */
+ WCN36XX_HAL_HT_MIMO_PS_NA = 2,
+
+ /* SM Power Save disabled */
+ WCN36XX_HAL_HT_MIMO_PS_NO_LIMIT = 3,
+
+ WCN36XX_HAL_HT_MIMO_PS_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* each station added has a rate mode which specifies the sta attributes */
+enum sta_rate_mode {
+ STA_TAURUS = 0,
+ STA_TITAN,
+ STA_POLARIS,
+ STA_11b,
+ STA_11bg,
+ STA_11a,
+ STA_11n,
+ STA_11ac,
+ STA_INVALID_RATE_MODE = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* 1,2,5.5,11 */
+#define WCN36XX_HAL_NUM_DSSS_RATES 4
+
+/* 6,9,12,18,24,36,48,54 */
+#define WCN36XX_HAL_NUM_OFDM_RATES 8
+
+/* 72,96,108 */
+#define WCN36XX_HAL_NUM_POLARIS_RATES 3
+
+#define WCN36XX_HAL_MAC_MAX_SUPPORTED_MCS_SET 16
+
+enum wcn36xx_hal_bss_type {
+ WCN36XX_HAL_INFRASTRUCTURE_MODE,
+
+ /* Added for softAP support */
+ WCN36XX_HAL_INFRA_AP_MODE,
+
+ WCN36XX_HAL_IBSS_MODE,
+
+ /* Added for BT-AMP support */
+ WCN36XX_HAL_BTAMP_STA_MODE,
+
+ /* Added for BT-AMP support */
+ WCN36XX_HAL_BTAMP_AP_MODE,
+
+ WCN36XX_HAL_AUTO_MODE,
+
+ WCN36XX_HAL_DONOT_USE_BSS_TYPE = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_nw_type {
+ WCN36XX_HAL_11A_NW_TYPE,
+ WCN36XX_HAL_11B_NW_TYPE,
+ WCN36XX_HAL_11G_NW_TYPE,
+ WCN36XX_HAL_11N_NW_TYPE,
+ WCN36XX_HAL_DONOT_USE_NW_TYPE = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+#define WCN36XX_HAL_MAC_RATESET_EID_MAX 12
+
+enum wcn36xx_hal_ht_operating_mode {
+ /* No Protection */
+ WCN36XX_HAL_HT_OP_MODE_PURE,
+
+ /* Overlap Legacy device present, protection is optional */
+ WCN36XX_HAL_HT_OP_MODE_OVERLAP_LEGACY,
+
+ /* No legacy device, but 20 MHz HT present */
+ WCN36XX_HAL_HT_OP_MODE_NO_LEGACY_20MHZ_HT,
+
+ /* Protection is required */
+ WCN36XX_HAL_HT_OP_MODE_MIXED,
+
+ WCN36XX_HAL_HT_OP_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* Encryption type enum used with peer */
+enum ani_ed_type {
+ WCN36XX_HAL_ED_NONE,
+ WCN36XX_HAL_ED_WEP40,
+ WCN36XX_HAL_ED_WEP104,
+ WCN36XX_HAL_ED_TKIP,
+ WCN36XX_HAL_ED_CCMP,
+ WCN36XX_HAL_ED_WPI,
+ WCN36XX_HAL_ED_AES_128_CMAC,
+ WCN36XX_HAL_ED_NOT_IMPLEMENTED = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+#define WLAN_MAX_KEY_RSC_LEN 16
+#define WLAN_WAPI_KEY_RSC_LEN 16
+
+/* MAX key length when ULA is used */
+#define WCN36XX_HAL_MAC_MAX_KEY_LENGTH 32
+#define WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS 4
+
+/*
+ * Enum to specify whether key is used for TX only, RX only or both.
+ */
+enum ani_key_direction {
+ WCN36XX_HAL_TX_ONLY,
+ WCN36XX_HAL_RX_ONLY,
+ WCN36XX_HAL_TX_RX,
+ WCN36XX_HAL_TX_DEFAULT,
+ WCN36XX_HAL_DONOT_USE_KEY_DIRECTION = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum ani_wep_type {
+ WCN36XX_HAL_WEP_STATIC,
+ WCN36XX_HAL_WEP_DYNAMIC,
+ WCN36XX_HAL_WEP_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_link_state {
+
+ WCN36XX_HAL_LINK_IDLE_STATE = 0,
+ WCN36XX_HAL_LINK_PREASSOC_STATE = 1,
+ WCN36XX_HAL_LINK_POSTASSOC_STATE = 2,
+ WCN36XX_HAL_LINK_AP_STATE = 3,
+ WCN36XX_HAL_LINK_IBSS_STATE = 4,
+
+ /* BT-AMP Case */
+ WCN36XX_HAL_LINK_BTAMP_PREASSOC_STATE = 5,
+ WCN36XX_HAL_LINK_BTAMP_POSTASSOC_STATE = 6,
+ WCN36XX_HAL_LINK_BTAMP_AP_STATE = 7,
+ WCN36XX_HAL_LINK_BTAMP_STA_STATE = 8,
+
+ /* Reserved for HAL Internal Use */
+ WCN36XX_HAL_LINK_LEARN_STATE = 9,
+ WCN36XX_HAL_LINK_SCAN_STATE = 10,
+ WCN36XX_HAL_LINK_FINISH_SCAN_STATE = 11,
+ WCN36XX_HAL_LINK_INIT_CAL_STATE = 12,
+ WCN36XX_HAL_LINK_FINISH_CAL_STATE = 13,
+ WCN36XX_HAL_LINK_LISTEN_STATE = 14,
+
+ WCN36XX_HAL_LINK_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_stats_mask {
+ HAL_SUMMARY_STATS_INFO = 0x00000001,
+ HAL_GLOBAL_CLASS_A_STATS_INFO = 0x00000002,
+ HAL_GLOBAL_CLASS_B_STATS_INFO = 0x00000004,
+ HAL_GLOBAL_CLASS_C_STATS_INFO = 0x00000008,
+ HAL_GLOBAL_CLASS_D_STATS_INFO = 0x00000010,
+ HAL_PER_STA_STATS_INFO = 0x00000020
+};
+
+/* BT-AMP events type */
+enum bt_amp_event_type {
+ BTAMP_EVENT_CONNECTION_START,
+ BTAMP_EVENT_CONNECTION_STOP,
+ BTAMP_EVENT_CONNECTION_TERMINATED,
+
+ /* This and beyond are invalid values */
+ BTAMP_EVENT_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
+};
+
+/* PE Statistics */
+enum pe_stats_mask {
+ PE_SUMMARY_STATS_INFO = 0x00000001,
+ PE_GLOBAL_CLASS_A_STATS_INFO = 0x00000002,
+ PE_GLOBAL_CLASS_B_STATS_INFO = 0x00000004,
+ PE_GLOBAL_CLASS_C_STATS_INFO = 0x00000008,
+ PE_GLOBAL_CLASS_D_STATS_INFO = 0x00000010,
+ PE_PER_STA_STATS_INFO = 0x00000020,
+
+ /* This and beyond are invalid values */
+ PE_STATS_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/*
+ * Configuration Parameter IDs
+ */
+#define WCN36XX_HAL_CFG_STA_ID 0
+#define WCN36XX_HAL_CFG_CURRENT_TX_ANTENNA 1
+#define WCN36XX_HAL_CFG_CURRENT_RX_ANTENNA 2
+#define WCN36XX_HAL_CFG_LOW_GAIN_OVERRIDE 3
+#define WCN36XX_HAL_CFG_POWER_STATE_PER_CHAIN 4
+#define WCN36XX_HAL_CFG_CAL_PERIOD 5
+#define WCN36XX_HAL_CFG_CAL_CONTROL 6
+#define WCN36XX_HAL_CFG_PROXIMITY 7
+#define WCN36XX_HAL_CFG_NETWORK_DENSITY 8
+#define WCN36XX_HAL_CFG_MAX_MEDIUM_TIME 9
+#define WCN36XX_HAL_CFG_MAX_MPDUS_IN_AMPDU 10
+#define WCN36XX_HAL_CFG_RTS_THRESHOLD 11
+#define WCN36XX_HAL_CFG_SHORT_RETRY_LIMIT 12
+#define WCN36XX_HAL_CFG_LONG_RETRY_LIMIT 13
+#define WCN36XX_HAL_CFG_FRAGMENTATION_THRESHOLD 14
+#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_ZERO 15
+#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_ONE 16
+#define WCN36XX_HAL_CFG_DYNAMIC_THRESHOLD_TWO 17
+#define WCN36XX_HAL_CFG_FIXED_RATE 18
+#define WCN36XX_HAL_CFG_RETRYRATE_POLICY 19
+#define WCN36XX_HAL_CFG_RETRYRATE_SECONDARY 20
+#define WCN36XX_HAL_CFG_RETRYRATE_TERTIARY 21
+#define WCN36XX_HAL_CFG_FORCE_POLICY_PROTECTION 22
+#define WCN36XX_HAL_CFG_FIXED_RATE_MULTICAST_24GHZ 23
+#define WCN36XX_HAL_CFG_FIXED_RATE_MULTICAST_5GHZ 24
+#define WCN36XX_HAL_CFG_DEFAULT_RATE_INDEX_24GHZ 25
+#define WCN36XX_HAL_CFG_DEFAULT_RATE_INDEX_5GHZ 26
+#define WCN36XX_HAL_CFG_MAX_BA_SESSIONS 27
+#define WCN36XX_HAL_CFG_PS_DATA_INACTIVITY_TIMEOUT 28
+#define WCN36XX_HAL_CFG_PS_ENABLE_BCN_FILTER 29
+#define WCN36XX_HAL_CFG_PS_ENABLE_RSSI_MONITOR 30
+#define WCN36XX_HAL_CFG_NUM_BEACON_PER_RSSI_AVERAGE 31
+#define WCN36XX_HAL_CFG_STATS_PERIOD 32
+#define WCN36XX_HAL_CFG_CFP_MAX_DURATION 33
+#define WCN36XX_HAL_CFG_FRAME_TRANS_ENABLED 34
+#define WCN36XX_HAL_CFG_DTIM_PERIOD 35
+#define WCN36XX_HAL_CFG_EDCA_WMM_ACBK 36
+#define WCN36XX_HAL_CFG_EDCA_WMM_ACBE 37
+#define WCN36XX_HAL_CFG_EDCA_WMM_ACVO 38
+#define WCN36XX_HAL_CFG_EDCA_WMM_ACVI 39
+#define WCN36XX_HAL_CFG_BA_THRESHOLD_HIGH 40
+#define WCN36XX_HAL_CFG_MAX_BA_BUFFERS 41
+#define WCN36XX_HAL_CFG_RPE_POLLING_THRESHOLD 42
+#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC0_REG 43
+#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC1_REG 44
+#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC2_REG 45
+#define WCN36XX_HAL_CFG_RPE_AGING_THRESHOLD_FOR_AC3_REG 46
+#define WCN36XX_HAL_CFG_NO_OF_ONCHIP_REORDER_SESSIONS 47
+#define WCN36XX_HAL_CFG_PS_LISTEN_INTERVAL 48
+#define WCN36XX_HAL_CFG_PS_HEART_BEAT_THRESHOLD 49
+#define WCN36XX_HAL_CFG_PS_NTH_BEACON_FILTER 50
+#define WCN36XX_HAL_CFG_PS_MAX_PS_POLL 51
+#define WCN36XX_HAL_CFG_PS_MIN_RSSI_THRESHOLD 52
+#define WCN36XX_HAL_CFG_PS_RSSI_FILTER_PERIOD 53
+#define WCN36XX_HAL_CFG_PS_BROADCAST_FRAME_FILTER_ENABLE 54
+#define WCN36XX_HAL_CFG_PS_IGNORE_DTIM 55
+#define WCN36XX_HAL_CFG_PS_ENABLE_BCN_EARLY_TERM 56
+#define WCN36XX_HAL_CFG_DYNAMIC_PS_POLL_VALUE 57
+#define WCN36XX_HAL_CFG_PS_NULLDATA_AP_RESP_TIMEOUT 58
+#define WCN36XX_HAL_CFG_TELE_BCN_WAKEUP_EN 59
+#define WCN36XX_HAL_CFG_TELE_BCN_TRANS_LI 60
+#define WCN36XX_HAL_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS 61
+#define WCN36XX_HAL_CFG_TELE_BCN_MAX_LI 62
+#define WCN36XX_HAL_CFG_TELE_BCN_MAX_LI_IDLE_BCNS 63
+#define WCN36XX_HAL_CFG_TX_PWR_CTRL_ENABLE 64
+#define WCN36XX_HAL_CFG_VALID_RADAR_CHANNEL_LIST 65
+#define WCN36XX_HAL_CFG_TX_POWER_24_20 66
+#define WCN36XX_HAL_CFG_TX_POWER_24_40 67
+#define WCN36XX_HAL_CFG_TX_POWER_50_20 68
+#define WCN36XX_HAL_CFG_TX_POWER_50_40 69
+#define WCN36XX_HAL_CFG_MCAST_BCAST_FILTER_SETTING 70
+#define WCN36XX_HAL_CFG_BCN_EARLY_TERM_WAKEUP_INTERVAL 71
+#define WCN36XX_HAL_CFG_MAX_TX_POWER_2_4 72
+#define WCN36XX_HAL_CFG_MAX_TX_POWER_5 73
+#define WCN36XX_HAL_CFG_INFRA_STA_KEEP_ALIVE_PERIOD 74
+#define WCN36XX_HAL_CFG_ENABLE_CLOSE_LOOP 75
+#define WCN36XX_HAL_CFG_BTC_EXECUTION_MODE 76
+#define WCN36XX_HAL_CFG_BTC_DHCP_BT_SLOTS_TO_BLOCK 77
+#define WCN36XX_HAL_CFG_BTC_A2DP_DHCP_BT_SUB_INTERVALS 78
+#define WCN36XX_HAL_CFG_PS_TX_INACTIVITY_TIMEOUT 79
+#define WCN36XX_HAL_CFG_WCNSS_API_VERSION 80
+#define WCN36XX_HAL_CFG_AP_KEEPALIVE_TIMEOUT 81
+#define WCN36XX_HAL_CFG_GO_KEEPALIVE_TIMEOUT 82
+#define WCN36XX_HAL_CFG_ENABLE_MC_ADDR_LIST 83
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_INQ_BT 84
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_PAGE_BT 85
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_CONN_BT 86
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_LE_BT 87
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_INQ_WLAN 88
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_PAGE_WLAN 89
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_CONN_WLAN 90
+#define WCN36XX_HAL_CFG_BTC_STATIC_LEN_LE_WLAN 91
+#define WCN36XX_HAL_CFG_BTC_DYN_MAX_LEN_BT 92
+#define WCN36XX_HAL_CFG_BTC_DYN_MAX_LEN_WLAN 93
+#define WCN36XX_HAL_CFG_BTC_MAX_SCO_BLOCK_PERC 94
+#define WCN36XX_HAL_CFG_BTC_DHCP_PROT_ON_A2DP 95
+#define WCN36XX_HAL_CFG_BTC_DHCP_PROT_ON_SCO 96
+#define WCN36XX_HAL_CFG_ENABLE_UNICAST_FILTER 97
+#define WCN36XX_HAL_CFG_MAX_ASSOC_LIMIT 98
+#define WCN36XX_HAL_CFG_ENABLE_LPWR_IMG_TRANSITION 99
+#define WCN36XX_HAL_CFG_ENABLE_MCC_ADAPTIVE_SCHEDULER 100
+#define WCN36XX_HAL_CFG_ENABLE_DETECT_PS_SUPPORT 101
+#define WCN36XX_HAL_CFG_AP_LINK_MONITOR_TIMEOUT 102
+#define WCN36XX_HAL_CFG_BTC_DWELL_TIME_MULTIPLIER 103
+#define WCN36XX_HAL_CFG_ENABLE_TDLS_OXYGEN_MODE 104
+#define WCN36XX_HAL_CFG_MAX_PARAMS 105
+
+/* Message definitons - All the messages below need to be packed */
+
+/* Definition for HAL API Version. */
+struct wcnss_wlan_version {
+ u8 revision;
+ u8 version;
+ u8 minor;
+ u8 major;
+} __packed;
+
+/* Definition for Encryption Keys */
+struct wcn36xx_hal_keys {
+ u8 id;
+
+ /* 0 for multicast */
+ u8 unicast;
+
+ enum ani_key_direction direction;
+
+ /* Usage is unknown */
+ u8 rsc[WLAN_MAX_KEY_RSC_LEN];
+
+ /* =1 for authenticator,=0 for supplicant */
+ u8 pae_role;
+
+ u16 length;
+ u8 key[WCN36XX_HAL_MAC_MAX_KEY_LENGTH];
+} __packed;
+
+/*
+ * set_sta_key_params Moving here since it is shared by
+ * configbss/setstakey msgs
+ */
+struct wcn36xx_hal_set_sta_key_params {
+ /* STA Index */
+ u16 sta_index;
+
+ /* Encryption Type used with peer */
+ enum ani_ed_type enc_type;
+
+ /* STATIC/DYNAMIC - valid only for WEP */
+ enum ani_wep_type wep_type;
+
+ /* Default WEP key, valid only for static WEP, must between 0 and 3. */
+ u8 def_wep_idx;
+
+ /* valid only for non-static WEP encyrptions */
+ struct wcn36xx_hal_keys key[WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS];
+
+ /*
+ * Control for Replay Count, 1= Single TID based replay count on Tx
+ * 0 = Per TID based replay count on TX
+ */
+ u8 single_tid_rc;
+
+} __packed;
+
+/* 4-byte control message header used by HAL*/
+struct wcn36xx_hal_msg_header {
+ enum wcn36xx_hal_host_msg_type msg_type:16;
+ enum wcn36xx_hal_host_msg_version msg_version:16;
+ u32 len;
+} __packed;
+
+/* Config format required by HAL for each CFG item*/
+struct wcn36xx_hal_cfg {
+ /* Cfg Id. The Id required by HAL is exported by HAL
+ * in shared header file between UMAC and HAL.*/
+ u16 id;
+
+ /* Length of the Cfg. This parameter is used to go to next cfg
+ * in the TLV format.*/
+ u16 len;
+
+ /* Padding bytes for unaligned address's */
+ u16 pad_bytes;
+
+ /* Reserve bytes for making cfgVal to align address */
+ u16 reserve;
+
+ /* Following the uCfgLen field there should be a 'uCfgLen' bytes
+ * containing the uCfgValue ; u8 uCfgValue[uCfgLen] */
+} __packed;
+
+struct wcn36xx_hal_mac_start_parameters {
+ /* Drive Type - Production or FTM etc */
+ enum driver_type type;
+
+ /* Length of the config buffer */
+ u32 len;
+
+ /* Following this there is a TLV formatted buffer of length
+ * "len" bytes containing all config values.
+ * The TLV is expected to be formatted like this:
+ * 0 15 31 31+CFG_LEN-1 length-1
+ * | CFG_ID | CFG_LEN | CFG_BODY | CFG_ID |......|
+ */
+} __packed;
+
+struct wcn36xx_hal_mac_start_req_msg {
+ /* config buffer must start in TLV format just here */
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_mac_start_parameters params;
+} __packed;
+
+struct wcn36xx_hal_mac_start_rsp_params {
+ /* success or failure */
+ u16 status;
+
+ /* Max number of STA supported by the device */
+ u8 stations;
+
+ /* Max number of BSS supported by the device */
+ u8 bssids;
+
+ /* API Version */
+ struct wcnss_wlan_version version;
+
+ /* CRM build information */
+ u8 crm_version[WCN36XX_HAL_VERSION_LENGTH];
+
+ /* hardware/chipset/misc version information */
+ u8 wlan_version[WCN36XX_HAL_VERSION_LENGTH];
+
+} __packed;
+
+struct wcn36xx_hal_mac_start_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_mac_start_rsp_params start_rsp_params;
+} __packed;
+
+struct wcn36xx_hal_mac_stop_req_params {
+ /* The reason for which the device is being stopped */
+ enum wcn36xx_hal_stop_type reason;
+
+} __packed;
+
+struct wcn36xx_hal_mac_stop_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_mac_stop_req_params stop_req_params;
+} __packed;
+
+struct wcn36xx_hal_mac_stop_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_update_cfg_req_msg {
+ /*
+ * Note: The length specified in tHalUpdateCfgReqMsg messages should be
+ * header.msgLen = sizeof(tHalUpdateCfgReqMsg) + uConfigBufferLen
+ */
+ struct wcn36xx_hal_msg_header header;
+
+ /* Length of the config buffer. Allows UMAC to update multiple CFGs */
+ u32 len;
+
+ /*
+ * Following this there is a TLV formatted buffer of length
+ * "uConfigBufferLen" bytes containing all config values.
+ * The TLV is expected to be formatted like this:
+ * 0 15 31 31+CFG_LEN-1 length-1
+ * | CFG_ID | CFG_LEN | CFG_BODY | CFG_ID |......|
+ */
+
+} __packed;
+
+struct wcn36xx_hal_update_cfg_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+} __packed;
+
+/* Frame control field format (2 bytes) */
+struct wcn36xx_hal_mac_frame_ctl {
+
+#ifndef ANI_LITTLE_BIT_ENDIAN
+
+ u8 subType:4;
+ u8 type:2;
+ u8 protVer:2;
+
+ u8 order:1;
+ u8 wep:1;
+ u8 moreData:1;
+ u8 powerMgmt:1;
+ u8 retry:1;
+ u8 moreFrag:1;
+ u8 fromDS:1;
+ u8 toDS:1;
+
+#else
+
+ u8 protVer:2;
+ u8 type:2;
+ u8 subType:4;
+
+ u8 toDS:1;
+ u8 fromDS:1;
+ u8 moreFrag:1;
+ u8 retry:1;
+ u8 powerMgmt:1;
+ u8 moreData:1;
+ u8 wep:1;
+ u8 order:1;
+
+#endif
+
+};
+
+/* Sequence control field */
+struct wcn36xx_hal_mac_seq_ctl {
+ u8 fragNum:4;
+ u8 seqNumLo:4;
+ u8 seqNumHi:8;
+};
+
+/* Management header format */
+struct wcn36xx_hal_mac_mgmt_hdr {
+ struct wcn36xx_hal_mac_frame_ctl fc;
+ u8 durationLo;
+ u8 durationHi;
+ u8 da[6];
+ u8 sa[6];
+ u8 bssId[6];
+ struct wcn36xx_hal_mac_seq_ctl seqControl;
+};
+
+/* FIXME: pronto v1 apparently has 4 */
+#define WCN36XX_HAL_NUM_BSSID 2
+
+/* Scan Entry to hold active BSS idx's */
+struct wcn36xx_hal_scan_entry {
+ u8 bss_index[WCN36XX_HAL_NUM_BSSID];
+ u8 active_bss_count;
+};
+
+struct wcn36xx_hal_init_scan_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* LEARN - AP Role
+ SCAN - STA Role */
+ enum wcn36xx_hal_sys_mode mode;
+
+ /* BSSID of the BSS */
+ u8 bssid[ETH_ALEN];
+
+ /* Whether BSS needs to be notified */
+ u8 notify;
+
+ /* Kind of frame to be used for notifying the BSS (Data Null, QoS
+ * Null, or CTS to Self). Must always be a valid frame type. */
+ u8 frame_type;
+
+ /* UMAC has the option of passing the MAC frame to be used for
+ * notifying the BSS. If non-zero, HAL will use the MAC frame
+ * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
+ * appropriate MAC frame based on frameType. */
+ u8 frame_len;
+
+ /* Following the framelength there is a MAC frame buffer if
+ * frameLength is non-zero. */
+ struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
+
+ /* Entry to hold number of active BSS idx's */
+ struct wcn36xx_hal_scan_entry scan_entry;
+};
+
+struct wcn36xx_hal_init_scan_con_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* LEARN - AP Role
+ SCAN - STA Role */
+ enum wcn36xx_hal_sys_mode mode;
+
+ /* BSSID of the BSS */
+ u8 bssid[ETH_ALEN];
+
+ /* Whether BSS needs to be notified */
+ u8 notify;
+
+ /* Kind of frame to be used for notifying the BSS (Data Null, QoS
+ * Null, or CTS to Self). Must always be a valid frame type. */
+ u8 frame_type;
+
+ /* UMAC has the option of passing the MAC frame to be used for
+ * notifying the BSS. If non-zero, HAL will use the MAC frame
+ * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
+ * appropriate MAC frame based on frameType. */
+ u8 frame_length;
+
+ /* Following the framelength there is a MAC frame buffer if
+ * frameLength is non-zero. */
+ struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
+
+ /* Entry to hold number of active BSS idx's */
+ struct wcn36xx_hal_scan_entry scan_entry;
+
+ /* Single NoA usage in Scanning */
+ u8 use_noa;
+
+ /* Indicates the scan duration (in ms) */
+ u16 scan_duration;
+
+};
+
+struct wcn36xx_hal_init_scan_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+} __packed;
+
+struct wcn36xx_hal_start_scan_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Indicates the channel to scan */
+ u8 scan_channel;
+} __packed;
+
+struct wcn36xx_hal_start_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u32 start_tsf[2];
+ u8 tx_mgmt_power;
+
+} __packed;
+
+struct wcn36xx_hal_end_scan_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Indicates the channel to stop scanning. Not used really. But
+ * retained for symmetry with "start Scan" message. It can also
+ * help in error check if needed. */
+ u8 scan_channel;
+} __packed;
+
+struct wcn36xx_hal_end_scan_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_finish_scan_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Identifies the operational state of the AP/STA
+ * LEARN - AP Role SCAN - STA Role */
+ enum wcn36xx_hal_sys_mode mode;
+
+ /* Operating channel to tune to. */
+ u8 oper_channel;
+
+ /* Channel Bonding state If 20/40 MHz is operational, this will
+ * indicate the 40 MHz extension channel in combination with the
+ * control channel */
+ enum phy_chan_bond_state cb_state;
+
+ /* BSSID of the BSS */
+ u8 bssid[ETH_ALEN];
+
+ /* Whether BSS needs to be notified */
+ u8 notify;
+
+ /* Kind of frame to be used for notifying the BSS (Data Null, QoS
+ * Null, or CTS to Self). Must always be a valid frame type. */
+ u8 frame_type;
+
+ /* UMAC has the option of passing the MAC frame to be used for
+ * notifying the BSS. If non-zero, HAL will use the MAC frame
+ * buffer pointed to by macMgmtHdr. If zero, HAL will generate the
+ * appropriate MAC frame based on frameType. */
+ u8 frame_length;
+
+ /* Following the framelength there is a MAC frame buffer if
+ * frameLength is non-zero. */
+ struct wcn36xx_hal_mac_mgmt_hdr mac_mgmt_hdr;
+
+ /* Entry to hold number of active BSS idx's */
+ struct wcn36xx_hal_scan_entry scan_entry;
+
+} __packed;
+
+struct wcn36xx_hal_finish_scan_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+} __packed;
+
+enum wcn36xx_hal_rate_index {
+ HW_RATE_INDEX_1MBPS = 0x82,
+ HW_RATE_INDEX_2MBPS = 0x84,
+ HW_RATE_INDEX_5_5MBPS = 0x8B,
+ HW_RATE_INDEX_6MBPS = 0x0C,
+ HW_RATE_INDEX_9MBPS = 0x12,
+ HW_RATE_INDEX_11MBPS = 0x96,
+ HW_RATE_INDEX_12MBPS = 0x18,
+ HW_RATE_INDEX_18MBPS = 0x24,
+ HW_RATE_INDEX_24MBPS = 0x30,
+ HW_RATE_INDEX_36MBPS = 0x48,
+ HW_RATE_INDEX_48MBPS = 0x60,
+ HW_RATE_INDEX_54MBPS = 0x6C
+};
+
+struct wcn36xx_hal_supported_rates {
+ /*
+ * For Self STA Entry: this represents Self Mode.
+ * For Peer Stations, this represents the mode of the peer.
+ * On Station:
+ *
+ * --this mode is updated when PE adds the Self Entry.
+ *
+ * -- OR when PE sends 'ADD_BSS' message and station context in BSS
+ * is used to indicate the mode of the AP.
+ *
+ * ON AP:
+ *
+ * -- this mode is updated when PE sends 'ADD_BSS' and Sta entry
+ * for that BSS is used to indicate the self mode of the AP.
+ *
+ * -- OR when a station is associated, PE sends 'ADD_STA' message
+ * with this mode updated.
+ */
+
+ enum sta_rate_mode op_rate_mode;
+
+ /* 11b, 11a and aniLegacyRates are IE rates which gives rate in
+ * unit of 500Kbps */
+ u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES];
+ u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES];
+ u16 legacy_rates[WCN36XX_HAL_NUM_POLARIS_RATES];
+ u16 reserved;
+
+ /* Taurus only supports 26 Titan Rates(no ESF/concat Rates will be
+ * supported) First 26 bits are reserved for those Titan rates and
+ * the last 4 bits(bit28-31) for Taurus, 2(bit26-27) bits are
+ * reserved. */
+ /* Titan and Taurus Rates */
+ u32 enhanced_rate_bitmap;
+
+ /*
+ * 0-76 bits used, remaining reserved
+ * bits 0-15 and 32 should be set.
+ */
+ u8 supported_mcs_set[WCN36XX_HAL_MAC_MAX_SUPPORTED_MCS_SET];
+
+ /*
+ * RX Highest Supported Data Rate defines the highest data
+ * rate that the STA is able to receive, in unites of 1Mbps.
+ * This value is derived from "Supported MCS Set field" inside
+ * the HT capability element.
+ */
+ u16 rx_highest_data_rate;
+
+} __packed;
+
+struct wcn36xx_hal_config_sta_params {
+ /* BSSID of STA */
+ u8 bssid[ETH_ALEN];
+
+ /* ASSOC ID, as assigned by UMAC */
+ u16 aid;
+
+ /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
+ u8 type;
+
+ /* Short Preamble Supported. */
+ u8 short_preamble_supported;
+
+ /* MAC Address of STA */
+ u8 mac[ETH_ALEN];
+
+ /* Listen interval of the STA */
+ u16 listen_interval;
+
+ /* Support for 11e/WMM */
+ u8 wmm_enabled;
+
+ /* 11n HT capable STA */
+ u8 ht_capable;
+
+ /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
+ u8 tx_channel_width_set;
+
+ /* RIFS mode 0 - NA, 1 - Allowed */
+ u8 rifs_mode;
+
+ /* L-SIG TXOP Protection mechanism
+ 0 - No Support, 1 - Supported
+ SG - there is global field */
+ u8 lsig_txop_protection;
+
+ /* Max Ampdu Size supported by STA. TPE programming.
+ 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
+ u8 max_ampdu_size;
+
+ /* Max Ampdu density. Used by RA. 3 : 0~7 : 2^(11nAMPDUdensity -4) */
+ u8 max_ampdu_density;
+
+ /* Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes */
+ u8 max_amsdu_size;
+
+ /* Short GI support for 40Mhz packets */
+ u8 sgi_40mhz;
+
+ /* Short GI support for 20Mhz packets */
+ u8 sgi_20Mhz;
+
+ /* TODO move this parameter to the end for 3680 */
+ /* These rates are the intersection of peer and self capabilities. */
+ struct wcn36xx_hal_supported_rates supported_rates;
+
+ /* Robust Management Frame (RMF) enabled/disabled */
+ u8 rmf;
+
+ /* The unicast encryption type in the association */
+ u32 encrypt_type;
+
+ /* HAL should update the existing STA entry, if this flag is set. UMAC
+ will set this flag in case of RE-ASSOC, where we want to reuse the
+ old STA ID. 0 = Add, 1 = Update */
+ u8 action;
+
+ /* U-APSD Flags: 1b per AC. Encoded as follows:
+ b7 b6 b5 b4 b3 b2 b1 b0 =
+ X X X X BE BK VI VO */
+ u8 uapsd;
+
+ /* Max SP Length */
+ u8 max_sp_len;
+
+ /* 11n Green Field preamble support
+ 0 - Not supported, 1 - Supported */
+ u8 green_field_capable;
+
+ /* MIMO Power Save mode */
+ enum wcn36xx_hal_ht_mimo_state mimo_ps;
+
+ /* Delayed BA Support */
+ u8 delayed_ba_support;
+
+ /* Max AMPDU duration in 32us */
+ u8 max_ampdu_duration;
+
+ /* HT STA should set it to 1 if it is enabled in BSS. HT STA should
+ * set it to 0 if AP does not support it. This indication is sent
+ * to HAL and HAL uses this flag to pickup up appropriate 40Mhz
+ * rates. */
+ u8 dsss_cck_mode_40mhz;
+
+ /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
+ * Retained for backward compalibity with existing HAL code */
+ u8 sta_index;
+
+ /* BSSID of BSS to which station is associated. Set to 0xFF when
+ * invalid. Retained for backward compalibity with existing HAL
+ * code */
+ u8 bssid_index;
+
+ u8 p2p;
+
+ /* TODO add this parameter for 3680. */
+ /* Reserved to align next field on a dword boundary */
+ /* u8 reserved; */
+} __packed;
+
+struct wcn36xx_hal_config_sta_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_config_sta_params sta_params;
+} __packed;
+
+struct wcn36xx_hal_config_sta_params_v1 {
+ /* BSSID of STA */
+ u8 bssid[ETH_ALEN];
+
+ /* ASSOC ID, as assigned by UMAC */
+ u16 aid;
+
+ /* STA entry Type: 0 - Self, 1 - Other/Peer, 2 - BSSID, 3 - BCAST */
+ u8 type;
+
+ /* Short Preamble Supported. */
+ u8 short_preamble_supported;
+
+ /* MAC Address of STA */
+ u8 mac[ETH_ALEN];
+
+ /* Listen interval of the STA */
+ u16 listen_interval;
+
+ /* Support for 11e/WMM */
+ u8 wmm_enabled;
+
+ /* 11n HT capable STA */
+ u8 ht_capable;
+
+ /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
+ u8 tx_channel_width_set;
+
+ /* RIFS mode 0 - NA, 1 - Allowed */
+ u8 rifs_mode;
+
+ /* L-SIG TXOP Protection mechanism
+ 0 - No Support, 1 - Supported
+ SG - there is global field */
+ u8 lsig_txop_protection;
+
+ /* Max Ampdu Size supported by STA. TPE programming.
+ 0 : 8k , 1 : 16k, 2 : 32k, 3 : 64k */
+ u8 max_ampdu_size;
+
+ /* Max Ampdu density. Used by RA. 3 : 0~7 : 2^(11nAMPDUdensity -4) */
+ u8 max_ampdu_density;
+
+ /* Max AMSDU size 1 : 3839 bytes, 0 : 7935 bytes */
+ u8 max_amsdu_size;
+
+ /* Short GI support for 40Mhz packets */
+ u8 sgi_40mhz;
+
+ /* Short GI support for 20Mhz packets */
+ u8 sgi_20Mhz;
+
+ /* Robust Management Frame (RMF) enabled/disabled */
+ u8 rmf;
+
+ /* The unicast encryption type in the association */
+ u32 encrypt_type;
+
+ /* HAL should update the existing STA entry, if this flag is set. UMAC
+ will set this flag in case of RE-ASSOC, where we want to reuse the
+ old STA ID. 0 = Add, 1 = Update */
+ u8 action;
+
+ /* U-APSD Flags: 1b per AC. Encoded as follows:
+ b7 b6 b5 b4 b3 b2 b1 b0 =
+ X X X X BE BK VI VO */
+ u8 uapsd;
+
+ /* Max SP Length */
+ u8 max_sp_len;
+
+ /* 11n Green Field preamble support
+ 0 - Not supported, 1 - Supported */
+ u8 green_field_capable;
+
+ /* MIMO Power Save mode */
+ enum wcn36xx_hal_ht_mimo_state mimo_ps;
+
+ /* Delayed BA Support */
+ u8 delayed_ba_support;
+
+ /* Max AMPDU duration in 32us */
+ u8 max_ampdu_duration;
+
+ /* HT STA should set it to 1 if it is enabled in BSS. HT STA should
+ * set it to 0 if AP does not support it. This indication is sent
+ * to HAL and HAL uses this flag to pickup up appropriate 40Mhz
+ * rates. */
+ u8 dsss_cck_mode_40mhz;
+
+ /* Valid STA Idx when action=Update. Set to 0xFF when invalid!
+ * Retained for backward compalibity with existing HAL code */
+ u8 sta_index;
+
+ /* BSSID of BSS to which station is associated. Set to 0xFF when
+ * invalid. Retained for backward compalibity with existing HAL
+ * code */
+ u8 bssid_index;
+
+ u8 p2p;
+
+ /* Reserved to align next field on a dword boundary */
+ u8 reserved;
+
+ /* These rates are the intersection of peer and self capabilities. */
+ struct wcn36xx_hal_supported_rates supported_rates;
+} __packed;
+
+struct wcn36xx_hal_config_sta_req_msg_v1 {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_config_sta_params_v1 sta_params;
+} __packed;
+
+struct config_sta_rsp_params {
+ /* success or failure */
+ u32 status;
+
+ /* Station index; valid only when 'status' field value SUCCESS */
+ u8 sta_index;
+
+ /* BSSID Index of BSS to which the station is associated */
+ u8 bssid_index;
+
+ /* DPU Index for PTK */
+ u8 dpu_index;
+
+ /* DPU Index for GTK */
+ u8 bcast_dpu_index;
+
+ /* DPU Index for IGTK */
+ u8 bcast_mgmt_dpu_idx;
+
+ /* PTK DPU signature */
+ u8 uc_ucast_sig;
+
+ /* GTK DPU isignature */
+ u8 uc_bcast_sig;
+
+ /* IGTK DPU signature */
+ u8 uc_mgmt_sig;
+
+ u8 p2p;
+
+} __packed;
+
+struct wcn36xx_hal_config_sta_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ struct config_sta_rsp_params params;
+} __packed;
+
+/* Delete STA Request message */
+struct wcn36xx_hal_delete_sta_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Index of STA to delete */
+ u8 sta_index;
+
+} __packed;
+
+/* Delete STA Response message */
+struct wcn36xx_hal_delete_sta_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* Index of STA deleted */
+ u8 sta_id;
+} __packed;
+
+/* 12 Bytes long because this structure can be used to represent rate and
+ * extended rate set IEs. The parser assume this to be at least 12 */
+struct wcn36xx_hal_rate_set {
+ u8 num_rates;
+ u8 rate[WCN36XX_HAL_MAC_RATESET_EID_MAX];
+} __packed;
+
+/* access category record */
+struct wcn36xx_hal_aci_aifsn {
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ u8 rsvd:1;
+ u8 aci:2;
+ u8 acm:1;
+ u8 aifsn:4;
+#else
+ u8 aifsn:4;
+ u8 acm:1;
+ u8 aci:2;
+ u8 rsvd:1;
+#endif
+} __packed;
+
+/* contention window size */
+struct wcn36xx_hal_mac_cw {
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ u8 max:4;
+ u8 min:4;
+#else
+ u8 min:4;
+ u8 max:4;
+#endif
+} __packed;
+
+struct wcn36xx_hal_edca_param_record {
+ struct wcn36xx_hal_aci_aifsn aci;
+ struct wcn36xx_hal_mac_cw cw;
+ u16 txop_limit;
+} __packed;
+
+struct wcn36xx_hal_mac_ssid {
+ u8 length;
+ u8 ssid[32];
+} __packed;
+
+/* Concurrency role. These are generic IDs that identify the various roles
+ * in the software system. */
+enum wcn36xx_hal_con_mode {
+ WCN36XX_HAL_STA_MODE = 0,
+
+ /* to support softAp mode . This is misleading.
+ It means AP MODE only. */
+ WCN36XX_HAL_STA_SAP_MODE = 1,
+
+ WCN36XX_HAL_P2P_CLIENT_MODE,
+ WCN36XX_HAL_P2P_GO_MODE,
+ WCN36XX_HAL_MONITOR_MODE,
+};
+
+/* This is a bit pattern to be set for each mode
+ * bit 0 - sta mode
+ * bit 1 - ap mode
+ * bit 2 - p2p client mode
+ * bit 3 - p2p go mode */
+enum wcn36xx_hal_concurrency_mode {
+ HAL_STA = 1,
+ HAL_SAP = 2,
+
+ /* to support sta, softAp mode . This means STA+AP mode */
+ HAL_STA_SAP = 3,
+
+ HAL_P2P_CLIENT = 4,
+ HAL_P2P_GO = 8,
+ HAL_MAX_CONCURRENCY_PERSONA = 4
+};
+
+struct wcn36xx_hal_config_bss_params {
+ /* BSSID */
+ u8 bssid[ETH_ALEN];
+
+ /* Self Mac Address */
+ u8 self_mac_addr[ETH_ALEN];
+
+ /* BSS type */
+ enum wcn36xx_hal_bss_type bss_type;
+
+ /* Operational Mode: AP =0, STA = 1 */
+ u8 oper_mode;
+
+ /* Network Type */
+ enum wcn36xx_hal_nw_type nw_type;
+
+ /* Used to classify PURE_11G/11G_MIXED to program MTU */
+ u8 short_slot_time_supported;
+
+ /* Co-exist with 11a STA */
+ u8 lla_coexist;
+
+ /* Co-exist with 11b STA */
+ u8 llb_coexist;
+
+ /* Co-exist with 11g STA */
+ u8 llg_coexist;
+
+ /* Coexistence with 11n STA */
+ u8 ht20_coexist;
+
+ /* Non GF coexist flag */
+ u8 lln_non_gf_coexist;
+
+ /* TXOP protection support */
+ u8 lsig_tx_op_protection_full_support;
+
+ /* RIFS mode */
+ u8 rifs_mode;
+
+ /* Beacon Interval in TU */
+ u16 beacon_interval;
+
+ /* DTIM period */
+ u8 dtim_period;
+
+ /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
+ u8 tx_channel_width_set;
+
+ /* Operating channel */
+ u8 oper_channel;
+
+ /* Extension channel for channel bonding */
+ u8 ext_channel;
+
+ /* Reserved to align next field on a dword boundary */
+ u8 reserved;
+
+ /* TODO move sta to the end for 3680 */
+ /* Context of the station being added in HW
+ * Add a STA entry for "itself" -
+ *
+ * On AP - Add the AP itself in an "STA context"
+ *
+ * On STA - Add the AP to which this STA is joining in an
+ * "STA context"
+ */
+ struct wcn36xx_hal_config_sta_params sta;
+ /* SSID of the BSS */
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* HAL should update the existing BSS entry, if this flag is set.
+ * UMAC will set this flag in case of reassoc, where we want to
+ * resue the the old BSSID and still return success 0 = Add, 1 =
+ * Update */
+ u8 action;
+
+ /* MAC Rate Set */
+ struct wcn36xx_hal_rate_set rateset;
+
+ /* Enable/Disable HT capabilities of the BSS */
+ u8 ht;
+
+ /* Enable/Disable OBSS protection */
+ u8 obss_prot_enabled;
+
+ /* RMF enabled/disabled */
+ u8 rmf;
+
+ /* HT Operating Mode operating mode of the 802.11n STA */
+ enum wcn36xx_hal_ht_operating_mode ht_oper_mode;
+
+ /* Dual CTS Protection: 0 - Unused, 1 - Used */
+ u8 dual_cts_protection;
+
+ /* Probe Response Max retries */
+ u8 max_probe_resp_retry_limit;
+
+ /* To Enable Hidden ssid */
+ u8 hidden_ssid;
+
+ /* To Enable Disable FW Proxy Probe Resp */
+ u8 proxy_probe_resp;
+
+ /* Boolean to indicate if EDCA params are valid. UMAC might not
+ * have valid EDCA params or might not desire to apply EDCA params
+ * during config BSS. 0 implies Not Valid ; Non-Zero implies
+ * valid */
+ u8 edca_params_valid;
+
+ /* EDCA Parameters for Best Effort Access Category */
+ struct wcn36xx_hal_edca_param_record acbe;
+
+ /* EDCA Parameters forBackground Access Category */
+ struct wcn36xx_hal_edca_param_record acbk;
+
+ /* EDCA Parameters for Video Access Category */
+ struct wcn36xx_hal_edca_param_record acvi;
+
+ /* EDCA Parameters for Voice Access Category */
+ struct wcn36xx_hal_edca_param_record acvo;
+
+ /* Ext Bss Config Msg if set */
+ u8 ext_set_sta_key_param_valid;
+
+ /* SetStaKeyParams for ext bss msg */
+ struct wcn36xx_hal_set_sta_key_params ext_set_sta_key_param;
+
+ /* Persona for the BSS can be STA,AP,GO,CLIENT value same as enum
+ * wcn36xx_hal_con_mode */
+ u8 wcn36xx_hal_persona;
+
+ u8 spectrum_mgt_enable;
+
+ /* HAL fills in the tx power used for mgmt frames in txMgmtPower */
+ s8 tx_mgmt_power;
+
+ /* maxTxPower has max power to be used after applying the power
+ * constraint if any */
+ s8 max_tx_power;
+} __packed;
+
+struct wcn36xx_hal_config_bss_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_config_bss_params bss_params;
+} __packed;
+
+struct wcn36xx_hal_config_bss_params_v1 {
+ /* BSSID */
+ u8 bssid[ETH_ALEN];
+
+ /* Self Mac Address */
+ u8 self_mac_addr[ETH_ALEN];
+
+ /* BSS type */
+ enum wcn36xx_hal_bss_type bss_type;
+
+ /* Operational Mode: AP =0, STA = 1 */
+ u8 oper_mode;
+
+ /* Network Type */
+ enum wcn36xx_hal_nw_type nw_type;
+
+ /* Used to classify PURE_11G/11G_MIXED to program MTU */
+ u8 short_slot_time_supported;
+
+ /* Co-exist with 11a STA */
+ u8 lla_coexist;
+
+ /* Co-exist with 11b STA */
+ u8 llb_coexist;
+
+ /* Co-exist with 11g STA */
+ u8 llg_coexist;
+
+ /* Coexistence with 11n STA */
+ u8 ht20_coexist;
+
+ /* Non GF coexist flag */
+ u8 lln_non_gf_coexist;
+
+ /* TXOP protection support */
+ u8 lsig_tx_op_protection_full_support;
+
+ /* RIFS mode */
+ u8 rifs_mode;
+
+ /* Beacon Interval in TU */
+ u16 beacon_interval;
+
+ /* DTIM period */
+ u8 dtim_period;
+
+ /* TX Width Set: 0 - 20 MHz only, 1 - 20/40 MHz */
+ u8 tx_channel_width_set;
+
+ /* Operating channel */
+ u8 oper_channel;
+
+ /* Extension channel for channel bonding */
+ u8 ext_channel;
+
+ /* Reserved to align next field on a dword boundary */
+ u8 reserved;
+
+ /* SSID of the BSS */
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* HAL should update the existing BSS entry, if this flag is set.
+ * UMAC will set this flag in case of reassoc, where we want to
+ * resue the the old BSSID and still return success 0 = Add, 1 =
+ * Update */
+ u8 action;
+
+ /* MAC Rate Set */
+ struct wcn36xx_hal_rate_set rateset;
+
+ /* Enable/Disable HT capabilities of the BSS */
+ u8 ht;
+
+ /* Enable/Disable OBSS protection */
+ u8 obss_prot_enabled;
+
+ /* RMF enabled/disabled */
+ u8 rmf;
+
+ /* HT Operating Mode operating mode of the 802.11n STA */
+ enum wcn36xx_hal_ht_operating_mode ht_oper_mode;
+
+ /* Dual CTS Protection: 0 - Unused, 1 - Used */
+ u8 dual_cts_protection;
+
+ /* Probe Response Max retries */
+ u8 max_probe_resp_retry_limit;
+
+ /* To Enable Hidden ssid */
+ u8 hidden_ssid;
+
+ /* To Enable Disable FW Proxy Probe Resp */
+ u8 proxy_probe_resp;
+
+ /* Boolean to indicate if EDCA params are valid. UMAC might not
+ * have valid EDCA params or might not desire to apply EDCA params
+ * during config BSS. 0 implies Not Valid ; Non-Zero implies
+ * valid */
+ u8 edca_params_valid;
+
+ /* EDCA Parameters for Best Effort Access Category */
+ struct wcn36xx_hal_edca_param_record acbe;
+
+ /* EDCA Parameters forBackground Access Category */
+ struct wcn36xx_hal_edca_param_record acbk;
+
+ /* EDCA Parameters for Video Access Category */
+ struct wcn36xx_hal_edca_param_record acvi;
+
+ /* EDCA Parameters for Voice Access Category */
+ struct wcn36xx_hal_edca_param_record acvo;
+
+ /* Ext Bss Config Msg if set */
+ u8 ext_set_sta_key_param_valid;
+
+ /* SetStaKeyParams for ext bss msg */
+ struct wcn36xx_hal_set_sta_key_params ext_set_sta_key_param;
+
+ /* Persona for the BSS can be STA,AP,GO,CLIENT value same as enum
+ * wcn36xx_hal_con_mode */
+ u8 wcn36xx_hal_persona;
+
+ u8 spectrum_mgt_enable;
+
+ /* HAL fills in the tx power used for mgmt frames in txMgmtPower */
+ s8 tx_mgmt_power;
+
+ /* maxTxPower has max power to be used after applying the power
+ * constraint if any */
+ s8 max_tx_power;
+
+ /* Context of the station being added in HW
+ * Add a STA entry for "itself" -
+ *
+ * On AP - Add the AP itself in an "STA context"
+ *
+ * On STA - Add the AP to which this STA is joining in an
+ * "STA context"
+ */
+ struct wcn36xx_hal_config_sta_params_v1 sta;
+} __packed;
+
+struct wcn36xx_hal_config_bss_req_msg_v1 {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_config_bss_params_v1 bss_params;
+} __packed;
+
+struct wcn36xx_hal_config_bss_rsp_params {
+ /* Success or Failure */
+ u32 status;
+
+ /* BSS index allocated by HAL */
+ u8 bss_index;
+
+ /* DPU descriptor index for PTK */
+ u8 dpu_desc_index;
+
+ /* PTK DPU signature */
+ u8 ucast_dpu_signature;
+
+ /* DPU descriptor index for GTK */
+ u8 bcast_dpu_desc_indx;
+
+ /* GTK DPU signature */
+ u8 bcast_dpu_signature;
+
+ /* DPU descriptor for IGTK */
+ u8 mgmt_dpu_desc_index;
+
+ /* IGTK DPU signature */
+ u8 mgmt_dpu_signature;
+
+ /* Station Index for BSS entry */
+ u8 bss_sta_index;
+
+ /* Self station index for this BSS */
+ u8 bss_self_sta_index;
+
+ /* Bcast station for buffering bcast frames in AP role */
+ u8 bss_bcast_sta_idx;
+
+ /* MAC Address of STA(PEER/SELF) in staContext of configBSSReq */
+ u8 mac[ETH_ALEN];
+
+ /* HAL fills in the tx power used for mgmt frames in this field. */
+ s8 tx_mgmt_power;
+
+} __packed;
+
+struct wcn36xx_hal_config_bss_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_config_bss_rsp_params bss_rsp_params;
+} __packed;
+
+struct wcn36xx_hal_delete_bss_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* BSS index to be deleted */
+ u8 bss_index;
+
+} __packed;
+
+struct wcn36xx_hal_delete_bss_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Success or Failure */
+ u32 status;
+
+ /* BSS index that has been deleted */
+ u8 bss_index;
+
+} __packed;
+
+struct wcn36xx_hal_join_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Indicates the BSSID to which STA is going to associate */
+ u8 bssid[ETH_ALEN];
+
+ /* Indicates the channel to switch to. */
+ u8 channel;
+
+ /* Self STA MAC */
+ u8 self_sta_mac_addr[ETH_ALEN];
+
+ /* Local power constraint */
+ u8 local_power_constraint;
+
+ /* Secondary channel offset */
+ enum phy_chan_bond_state secondary_channel_offset;
+
+ /* link State */
+ enum wcn36xx_hal_link_state link_state;
+
+ /* Max TX power */
+ s8 max_tx_power;
+} __packed;
+
+struct wcn36xx_hal_join_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* HAL fills in the tx power used for mgmt frames in this field */
+ u8 tx_mgmt_power;
+} __packed;
+
+struct post_assoc_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ struct wcn36xx_hal_config_sta_params sta_params;
+ struct wcn36xx_hal_config_bss_params bss_params;
+};
+
+struct post_assoc_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct config_sta_rsp_params sta_rsp_params;
+ struct wcn36xx_hal_config_bss_rsp_params bss_rsp_params;
+};
+
+/* This is used to create a set of WEP keys for a given BSS. */
+struct wcn36xx_hal_set_bss_key_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* BSS Index of the BSS */
+ u8 bss_idx;
+
+ /* Encryption Type used with peer */
+ enum ani_ed_type enc_type;
+
+ /* Number of keys */
+ u8 num_keys;
+
+ /* Array of keys. */
+ struct wcn36xx_hal_keys keys[WCN36XX_HAL_MAC_MAX_NUM_OF_DEFAULT_KEYS];
+
+ /* Control for Replay Count, 1= Single TID based replay count on Tx
+ * 0 = Per TID based replay count on TX */
+ u8 single_tid_rc;
+} __packed;
+
+/* tagged version of set bss key */
+struct wcn36xx_hal_set_bss_key_req_msg_tagged {
+ struct wcn36xx_hal_set_bss_key_req_msg Msg;
+ u32 tag;
+} __packed;
+
+struct wcn36xx_hal_set_bss_key_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+/*
+ * This is used configure the key information on a given station.
+ * When the sec_type is WEP40 or WEP104, the def_wep_idx is used to locate
+ * a preconfigured key from a BSS the station assoicated with; otherwise
+ * a new key descriptor is created based on the key field.
+ */
+struct wcn36xx_hal_set_sta_key_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_set_sta_key_params set_sta_key_params;
+} __packed;
+
+struct wcn36xx_hal_set_sta_key_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_remove_bss_key_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* BSS Index of the BSS */
+ u8 bss_idx;
+
+ /* Encryption Type used with peer */
+ enum ani_ed_type enc_type;
+
+ /* Key Id */
+ u8 key_id;
+
+ /* STATIC/DYNAMIC. Used in Nullifying in Key Descriptors for
+ * Static/Dynamic keys */
+ enum ani_wep_type wep_type;
+} __packed;
+
+struct wcn36xx_hal_remove_bss_key_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+/*
+ * This is used by PE to Remove the key information on a given station.
+ */
+struct wcn36xx_hal_remove_sta_key_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* STA Index */
+ u16 sta_idx;
+
+ /* Encryption Type used with peer */
+ enum ani_ed_type enc_type;
+
+ /* Key Id */
+ u8 key_id;
+
+ /* Whether to invalidate the Broadcast key or Unicast key. In case
+ * of WEP, the same key is used for both broadcast and unicast. */
+ u8 unicast;
+
+} __packed;
+
+struct wcn36xx_hal_remove_sta_key_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /*success or failure */
+ u32 status;
+
+} __packed;
+
+#ifdef FEATURE_OEM_DATA_SUPPORT
+
+#ifndef OEM_DATA_REQ_SIZE
+#define OEM_DATA_REQ_SIZE 134
+#endif
+
+#ifndef OEM_DATA_RSP_SIZE
+#define OEM_DATA_RSP_SIZE 1968
+#endif
+
+struct start_oem_data_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 status;
+ tSirMacAddr self_mac_addr;
+ u8 oem_data_req[OEM_DATA_REQ_SIZE];
+
+};
+
+struct start_oem_data_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 oem_data_rsp[OEM_DATA_RSP_SIZE];
+};
+
+#endif
+
+struct wcn36xx_hal_switch_channel_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Channel number */
+ u8 channel_number;
+
+ /* Local power constraint */
+ u8 local_power_constraint;
+
+ /* Secondary channel offset */
+ enum phy_chan_bond_state secondary_channel_offset;
+
+ /* HAL fills in the tx power used for mgmt frames in this field. */
+ u8 tx_mgmt_power;
+
+ /* Max TX power */
+ u8 max_tx_power;
+
+ /* Self STA MAC */
+ u8 self_sta_mac_addr[ETH_ALEN];
+
+ /* VO WIFI comment: BSSID needed to identify session. As the
+ * request has power constraints, this should be applied only to
+ * that session Since MTU timing and EDCA are sessionized, this
+ * struct needs to be sessionized and bssid needs to be out of the
+ * VOWifi feature flag V IMP: Keep bssId field at the end of this
+ * msg. It is used to mantain backward compatbility by way of
+ * ignoring if using new host/old FW or old host/new FW since it is
+ * at the end of this struct
+ */
+ u8 bssid[ETH_ALEN];
+} __packed;
+
+struct wcn36xx_hal_switch_channel_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Status */
+ u32 status;
+
+ /* Channel number - same as in request */
+ u8 channel_number;
+
+ /* HAL fills in the tx power used for mgmt frames in this field */
+ u8 tx_mgmt_power;
+
+ /* BSSID needed to identify session - same as in request */
+ u8 bssid[ETH_ALEN];
+
+} __packed;
+
+struct update_edca_params_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /*BSS Index */
+ u16 bss_index;
+
+ /* Best Effort */
+ struct wcn36xx_hal_edca_param_record acbe;
+
+ /* Background */
+ struct wcn36xx_hal_edca_param_record acbk;
+
+ /* Video */
+ struct wcn36xx_hal_edca_param_record acvi;
+
+ /* Voice */
+ struct wcn36xx_hal_edca_param_record acvo;
+};
+
+struct update_edca_params_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct dpu_stats_params {
+ /* Index of STA to which the statistics */
+ u16 sta_index;
+
+ /* Encryption mode */
+ u8 enc_mode;
+
+ /* status */
+ u32 status;
+
+ /* Statistics */
+ u32 send_blocks;
+ u32 recv_blocks;
+ u32 replays;
+ u8 mic_error_cnt;
+ u32 prot_excl_cnt;
+ u16 format_err_cnt;
+ u16 un_decryptable_cnt;
+ u32 decrypt_err_cnt;
+ u32 decrypt_ok_cnt;
+};
+
+struct wcn36xx_hal_stats_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Valid STA Idx for per STA stats request */
+ u32 sta_id;
+
+ /* Categories of stats requested as specified in eHalStatsMask */
+ u32 stats_mask;
+};
+
+struct ani_summary_stats_info {
+ /* Total number of packets(per AC) that were successfully
+ * transmitted with retries */
+ u32 retry_cnt[4];
+
+ /* The number of MSDU packets and MMPDU frames per AC that the
+ * 802.11 station successfully transmitted after more than one
+ * retransmission attempt */
+ u32 multiple_retry_cnt[4];
+
+ /* Total number of packets(per AC) that were successfully
+ * transmitted (with and without retries, including multi-cast,
+ * broadcast) */
+ u32 tx_frm_cnt[4];
+
+ /* Total number of packets that were successfully received (after
+ * appropriate filter rules including multi-cast, broadcast) */
+ u32 rx_frm_cnt;
+
+ /* Total number of duplicate frames received successfully */
+ u32 frm_dup_cnt;
+
+ /* Total number packets(per AC) failed to transmit */
+ u32 fail_cnt[4];
+
+ /* Total number of RTS/CTS sequence failures for transmission of a
+ * packet */
+ u32 rts_fail_cnt;
+
+ /* Total number packets failed transmit because of no ACK from the
+ * remote entity */
+ u32 ack_fail_cnt;
+
+ /* Total number of RTS/CTS sequence success for transmission of a
+ * packet */
+ u32 rts_succ_cnt;
+
+ /* The sum of the receive error count and dropped-receive-buffer
+ * error count. HAL will provide this as a sum of (FCS error) +
+ * (Fail get BD/PDU in HW) */
+ u32 rx_discard_cnt;
+
+ /*
+ * The receive error count. HAL will provide the RxP FCS error
+ * global counter. */
+ u32 rx_error_cnt;
+
+ /* The sum of the transmit-directed byte count, transmit-multicast
+ * byte count and transmit-broadcast byte count. HAL will sum TPE
+ * UC/MC/BCAST global counters to provide this. */
+ u32 tx_byte_cnt;
+};
+
+/* defines tx_rate_flags */
+enum tx_rate_info {
+ /* Legacy rates */
+ HAL_TX_RATE_LEGACY = 0x1,
+
+ /* HT20 rates */
+ HAL_TX_RATE_HT20 = 0x2,
+
+ /* HT40 rates */
+ HAL_TX_RATE_HT40 = 0x4,
+
+ /* Rate with Short guard interval */
+ HAL_TX_RATE_SGI = 0x8,
+
+ /* Rate with Long guard interval */
+ HAL_TX_RATE_LGI = 0x10
+};
+
+struct ani_global_class_a_stats_info {
+ /* The number of MPDU frames received by the 802.11 station for
+ * MSDU packets or MMPDU frames */
+ u32 rx_frag_cnt;
+
+ /* The number of MPDU frames received by the 802.11 station for
+ * MSDU packets or MMPDU frames when a promiscuous packet filter
+ * was enabled */
+ u32 promiscuous_rx_frag_cnt;
+
+ /* The receiver input sensitivity referenced to a FER of 8% at an
+ * MPDU length of 1024 bytes at the antenna connector. Each element
+ * of the array shall correspond to a supported rate and the order
+ * shall be the same as the supporteRates parameter. */
+ u32 rx_input_sensitivity;
+
+ /* The maximum transmit power in dBm upto one decimal. for eg: if
+ * it is 10.5dBm, the value would be 105 */
+ u32 max_pwr;
+
+ /* Number of times the receiver failed to synchronize with the
+ * incoming signal after detecting the sync in the preamble of the
+ * transmitted PLCP protocol data unit. */
+ u32 sync_fail_cnt;
+
+ /* Legacy transmit rate, in units of 500 kbit/sec, for the most
+ * recently transmitted frame */
+ u32 tx_rate;
+
+ /* mcs index for HT20 and HT40 rates */
+ u32 mcs_index;
+
+ /* to differentiate between HT20 and HT40 rates; short and long
+ * guard interval */
+ u32 tx_rate_flags;
+};
+
+struct ani_global_security_stats {
+ /* The number of unencrypted received MPDU frames that the MAC
+ * layer discarded when the IEEE 802.11 dot11ExcludeUnencrypted
+ * management information base (MIB) object is enabled */
+ u32 rx_wep_unencrypted_frm_cnt;
+
+ /* The number of received MSDU packets that that the 802.11 station
+ * discarded because of MIC failures */
+ u32 rx_mic_fail_cnt;
+
+ /* The number of encrypted MPDU frames that the 802.11 station
+ * failed to decrypt because of a TKIP ICV error */
+ u32 tkip_icv_err;
+
+ /* The number of received MPDU frames that the 802.11 discarded
+ * because of an invalid AES-CCMP format */
+ u32 aes_ccmp_format_err;
+
+ /* The number of received MPDU frames that the 802.11 station
+ * discarded because of the AES-CCMP replay protection procedure */
+ u32 aes_ccmp_replay_cnt;
+
+ /* The number of received MPDU frames that the 802.11 station
+ * discarded because of errors detected by the AES-CCMP decryption
+ * algorithm */
+ u32 aes_ccmp_decrpt_err;
+
+ /* The number of encrypted MPDU frames received for which a WEP
+ * decryption key was not available on the 802.11 station */
+ u32 wep_undecryptable_cnt;
+
+ /* The number of encrypted MPDU frames that the 802.11 station
+ * failed to decrypt because of a WEP ICV error */
+ u32 wep_icv_err;
+
+ /* The number of received encrypted packets that the 802.11 station
+ * successfully decrypted */
+ u32 rx_decrypt_succ_cnt;
+
+ /* The number of encrypted packets that the 802.11 station failed
+ * to decrypt */
+ u32 rx_decrypt_fail_cnt;
+};
+
+struct ani_global_class_b_stats_info {
+ struct ani_global_security_stats uc_stats;
+ struct ani_global_security_stats mc_bc_stats;
+};
+
+struct ani_global_class_c_stats_info {
+ /* This counter shall be incremented for a received A-MSDU frame
+ * with the stations MAC address in the address 1 field or an
+ * A-MSDU frame with a group address in the address 1 field */
+ u32 rx_amsdu_cnt;
+
+ /* This counter shall be incremented when the MAC receives an AMPDU
+ * from the PHY */
+ u32 rx_ampdu_cnt;
+
+ /* This counter shall be incremented when a Frame is transmitted
+ * only on the primary channel */
+ u32 tx_20_frm_cnt;
+
+ /* This counter shall be incremented when a Frame is received only
+ * on the primary channel */
+ u32 rx_20_frm_cnt;
+
+ /* This counter shall be incremented by the number of MPDUs
+ * received in the A-MPDU when an A-MPDU is received */
+ u32 rx_mpdu_in_ampdu_cnt;
+
+ /* This counter shall be incremented when an MPDU delimiter has a
+ * CRC error when this is the first CRC error in the received AMPDU
+ * or when the previous delimiter has been decoded correctly */
+ u32 ampdu_delimiter_crc_err;
+};
+
+struct ani_per_sta_stats_info {
+ /* The number of MPDU frames that the 802.11 station transmitted
+ * and acknowledged through a received 802.11 ACK frame */
+ u32 tx_frag_cnt[4];
+
+ /* This counter shall be incremented when an A-MPDU is transmitted */
+ u32 tx_ampdu_cnt;
+
+ /* This counter shall increment by the number of MPDUs in the AMPDU
+ * when an A-MPDU is transmitted */
+ u32 tx_mpdu_in_ampdu_cnt;
+};
+
+struct wcn36xx_hal_stats_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Success or Failure */
+ u32 status;
+
+ /* STA Idx */
+ u32 sta_index;
+
+ /* Categories of STATS being returned as per eHalStatsMask */
+ u32 stats_mask;
+
+ /* message type is same as the request type */
+ u16 msg_type;
+
+ /* length of the entire request, includes the pStatsBuf length too */
+ u16 msg_len;
+};
+
+struct wcn36xx_hal_set_link_state_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bssid[ETH_ALEN];
+ enum wcn36xx_hal_link_state state;
+ u8 self_mac_addr[ETH_ALEN];
+
+} __packed;
+
+struct set_link_state_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+/* TSPEC Params */
+struct wcn36xx_hal_ts_info_tfc {
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ u16 ackPolicy:2;
+ u16 userPrio:3;
+ u16 psb:1;
+ u16 aggregation:1;
+ u16 accessPolicy:2;
+ u16 direction:2;
+ u16 tsid:4;
+ u16 trafficType:1;
+#else
+ u16 trafficType:1;
+ u16 tsid:4;
+ u16 direction:2;
+ u16 accessPolicy:2;
+ u16 aggregation:1;
+ u16 psb:1;
+ u16 userPrio:3;
+ u16 ackPolicy:2;
+#endif
+};
+
+/* Flag to schedule the traffic type */
+struct wcn36xx_hal_ts_info_sch {
+#ifndef ANI_LITTLE_BIT_ENDIAN
+ u8 rsvd:7;
+ u8 schedule:1;
+#else
+ u8 schedule:1;
+ u8 rsvd:7;
+#endif
+};
+
+/* Traffic and scheduling info */
+struct wcn36xx_hal_ts_info {
+ struct wcn36xx_hal_ts_info_tfc traffic;
+ struct wcn36xx_hal_ts_info_sch schedule;
+};
+
+/* Information elements */
+struct wcn36xx_hal_tspec_ie {
+ u8 type;
+ u8 length;
+ struct wcn36xx_hal_ts_info ts_info;
+ u16 nom_msdu_size;
+ u16 max_msdu_size;
+ u32 min_svc_interval;
+ u32 max_svc_interval;
+ u32 inact_interval;
+ u32 suspend_interval;
+ u32 svc_start_time;
+ u32 min_data_rate;
+ u32 mean_data_rate;
+ u32 peak_data_rate;
+ u32 max_burst_sz;
+ u32 delay_bound;
+ u32 min_phy_rate;
+ u16 surplus_bw;
+ u16 medium_time;
+};
+
+struct add_ts_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index */
+ u16 sta_index;
+
+ /* TSPEC handler uniquely identifying a TSPEC for a STA in a BSS */
+ u16 tspec_index;
+
+ /* To program TPE with required parameters */
+ struct wcn36xx_hal_tspec_ie tspec;
+
+ /* U-APSD Flags: 1b per AC. Encoded as follows:
+ b7 b6 b5 b4 b3 b2 b1 b0 =
+ X X X X BE BK VI VO */
+ u8 uapsd;
+
+ /* These parameters are for all the access categories */
+
+ /* Service Interval */
+ u32 service_interval[WCN36XX_HAL_MAX_AC];
+
+ /* Suspend Interval */
+ u32 suspend_interval[WCN36XX_HAL_MAX_AC];
+
+ /* Delay Interval */
+ u32 delay_interval[WCN36XX_HAL_MAX_AC];
+};
+
+struct add_rs_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct del_ts_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index */
+ u16 sta_index;
+
+ /* TSPEC identifier uniquely identifying a TSPEC for a STA in a BSS */
+ u16 tspec_index;
+
+ /* To lookup station id using the mac address */
+ u8 bssid[ETH_ALEN];
+};
+
+struct del_ts_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+/* End of TSpec Parameters */
+
+/* Start of BLOCK ACK related Parameters */
+
+struct wcn36xx_hal_add_ba_session_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index */
+ u16 sta_index;
+
+ /* Peer MAC Address */
+ u8 mac_addr[ETH_ALEN];
+
+ /* ADDBA Action Frame dialog token
+ HAL will not interpret this object */
+ u8 dialog_token;
+
+ /* TID for which the BA is being setup
+ This identifies the TC or TS of interest */
+ u8 tid;
+
+ /* 0 - Delayed BA (Not supported)
+ 1 - Immediate BA */
+ u8 policy;
+
+ /* Indicates the number of buffers for this TID (baTID)
+ NOTE - This is the requested buffer size. When this
+ is processed by HAL and subsequently by HDD, it is
+ possible that HDD may change this buffer size. Any
+ change in the buffer size should be noted by PE and
+ advertized appropriately in the ADDBA response */
+ u16 buffer_size;
+
+ /* BA timeout in TU's 0 means no timeout will occur */
+ u16 timeout;
+
+ /* b0..b3 - Fragment Number - Always set to 0
+ b4..b15 - Starting Sequence Number of first MSDU
+ for which this BA is setup */
+ u16 ssn;
+
+ /* ADDBA direction
+ 1 - Originator
+ 0 - Recipient */
+ u8 direction;
+} __packed;
+
+struct wcn36xx_hal_add_ba_session_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* Dialog token */
+ u8 dialog_token;
+
+ /* TID for which the BA session has been setup */
+ u8 ba_tid;
+
+ /* BA Buffer Size allocated for the current BA session */
+ u8 ba_buffer_size;
+
+ u8 ba_session_id;
+
+ /* Reordering Window buffer */
+ u8 win_size;
+
+ /* Station Index to id the sta */
+ u8 sta_index;
+
+ /* Starting Sequence Number */
+ u16 ssn;
+} __packed;
+
+struct wcn36xx_hal_add_ba_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Session Id */
+ u8 session_id;
+
+ /* Reorder Window Size */
+ u8 win_size;
+/* Old FW 1.2.2.4 does not support this*/
+#ifdef FEATURE_ON_CHIP_REORDERING
+ u8 reordering_done_on_chip;
+#endif
+} __packed;
+
+struct wcn36xx_hal_add_ba_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* Dialog token */
+ u8 dialog_token;
+} __packed;
+
+struct add_ba_info {
+ u16 ba_enable:1;
+ u16 starting_seq_num:12;
+ u16 reserved:3;
+};
+
+struct wcn36xx_hal_trigger_ba_rsp_candidate {
+ u8 sta_addr[ETH_ALEN];
+ struct add_ba_info ba_info[STACFG_MAX_TC];
+} __packed;
+
+struct wcn36xx_hal_trigget_ba_req_candidate {
+ u8 sta_index;
+ u8 tid_bitmap;
+} __packed;
+
+struct wcn36xx_hal_trigger_ba_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Session Id */
+ u8 session_id;
+
+ /* baCandidateCnt is followed by trigger BA
+ * Candidate List(tTriggerBaCandidate)
+ */
+ u16 candidate_cnt;
+
+} __packed;
+
+struct wcn36xx_hal_trigger_ba_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* TO SUPPORT BT-AMP */
+ u8 bssid[ETH_ALEN];
+
+ /* success or failure */
+ u32 status;
+
+ /* baCandidateCnt is followed by trigger BA
+ * Rsp Candidate List(tTriggerRspBaCandidate)
+ */
+ u16 candidate_cnt;
+} __packed;
+
+struct wcn36xx_hal_del_ba_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index */
+ u16 sta_index;
+
+ /* TID for which the BA session is being deleted */
+ u8 tid;
+
+ /* DELBA direction
+ 1 - Originator
+ 0 - Recipient */
+ u8 direction;
+} __packed;
+
+struct wcn36xx_hal_del_ba_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+} __packed;
+
+struct tsm_stats_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Traffic Id */
+ u8 tid;
+
+ u8 bssid[ETH_ALEN];
+};
+
+struct tsm_stats_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /*success or failure */
+ u32 status;
+
+ /* Uplink Packet Queue delay */
+ u16 uplink_pkt_queue_delay;
+
+ /* Uplink Packet Queue delay histogram */
+ u16 uplink_pkt_queue_delay_hist[4];
+
+ /* Uplink Packet Transmit delay */
+ u32 uplink_pkt_tx_delay;
+
+ /* Uplink Packet loss */
+ u16 uplink_pkt_loss;
+
+ /* Uplink Packet count */
+ u16 uplink_pkt_count;
+
+ /* Roaming count */
+ u8 roaming_count;
+
+ /* Roaming Delay */
+ u16 roaming_delay;
+};
+
+struct set_key_done_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /*bssid of the keys */
+ u8 bssidx;
+ u8 enc_type;
+};
+
+struct wcn36xx_hal_nv_img_download_req_msg {
+ /* Note: The length specified in wcn36xx_hal_nv_img_download_req_msg
+ * messages should be
+ * header.len = sizeof(wcn36xx_hal_nv_img_download_req_msg) +
+ * nv_img_buffer_size */
+ struct wcn36xx_hal_msg_header header;
+
+ /* Fragment sequence number of the NV Image. Note that NV Image
+ * might not fit into one message due to size limitation of the SMD
+ * channel FIFO. UMAC can hence choose to chop the NV blob into
+ * multiple fragments starting with seqeunce number 0, 1, 2 etc.
+ * The last fragment MUST be indicated by marking the
+ * isLastFragment field to 1. Note that all the NV blobs would be
+ * concatenated together by HAL without any padding bytes in
+ * between.*/
+ u16 frag_number;
+
+ /* Is this the last fragment? When set to 1 it indicates that no
+ * more fragments will be sent by UMAC and HAL can concatenate all
+ * the NV blobs rcvd & proceed with the parsing. HAL would generate
+ * a WCN36XX_HAL_DOWNLOAD_NV_RSP to the WCN36XX_HAL_DOWNLOAD_NV_REQ
+ * after it receives each fragment */
+ u16 last_fragment;
+
+ /* NV Image size (number of bytes) */
+ u32 nv_img_buffer_size;
+
+ /* Following the 'nv_img_buffer_size', there should be
+ * nv_img_buffer_size bytes of NV Image i.e.
+ * u8[nv_img_buffer_size] */
+} __packed;
+
+struct wcn36xx_hal_nv_img_download_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Success or Failure. HAL would generate a
+ * WCN36XX_HAL_DOWNLOAD_NV_RSP after each fragment */
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_nv_store_ind {
+ /* Note: The length specified in tHalNvStoreInd messages should be
+ * header.msgLen = sizeof(tHalNvStoreInd) + nvBlobSize */
+ struct wcn36xx_hal_msg_header header;
+
+ /* NV Item */
+ u32 table_id;
+
+ /* Size of NV Blob */
+ u32 nv_blob_size;
+
+ /* Following the 'nvBlobSize', there should be nvBlobSize bytes of
+ * NV blob i.e. u8[nvBlobSize] */
+};
+
+/* End of Block Ack Related Parameters */
+
+#define WCN36XX_HAL_CIPHER_SEQ_CTR_SIZE 6
+
+/* Definition for MIC failure indication MAC reports this each time a MIC
+ * failure occures on Rx TKIP packet
+ */
+struct mic_failure_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bssid[ETH_ALEN];
+
+ /* address used to compute MIC */
+ u8 src_addr[ETH_ALEN];
+
+ /* transmitter address */
+ u8 ta_addr[ETH_ALEN];
+
+ u8 dst_addr[ETH_ALEN];
+
+ u8 multicast;
+
+ /* first byte of IV */
+ u8 iv1;
+
+ /* second byte of IV */
+ u8 key_id;
+
+ /* sequence number */
+ u8 tsc[WCN36XX_HAL_CIPHER_SEQ_CTR_SIZE];
+
+ /* receive address */
+ u8 rx_addr[ETH_ALEN];
+};
+
+struct update_vht_op_mode_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u16 op_mode;
+ u16 sta_id;
+};
+
+struct update_vht_op_mode_params_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 status;
+};
+
+struct update_beacon_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bss_index;
+
+ /* shortPreamble mode. HAL should update all the STA rates when it
+ * receives this message */
+ u8 short_preamble;
+
+ /* short Slot time. */
+ u8 short_slot_time;
+
+ /* Beacon Interval */
+ u16 beacon_interval;
+
+ /* Protection related */
+ u8 lla_coexist;
+ u8 llb_coexist;
+ u8 llg_coexist;
+ u8 ht20_coexist;
+ u8 lln_non_gf_coexist;
+ u8 lsig_tx_op_protection_full_support;
+ u8 rifs_mode;
+
+ u16 param_change_bitmap;
+};
+
+struct update_beacon_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ u32 status;
+};
+
+struct wcn36xx_hal_send_beacon_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* length of the template. */
+ u32 beacon_length;
+
+ /* Beacon data. */
+ u8 beacon[BEACON_TEMPLATE_SIZE];
+
+ u8 bssid[ETH_ALEN];
+
+ /* TIM IE offset from the beginning of the template. */
+ u32 tim_ie_offset;
+
+ /* P2P IE offset from the begining of the template */
+ u16 p2p_ie_offset;
+} __packed;
+
+struct send_beacon_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ u32 status;
+} __packed;
+
+struct enable_radar_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bssid[ETH_ALEN];
+ u8 channel;
+};
+
+struct enable_radar_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Link Parameters */
+ u8 bssid[ETH_ALEN];
+
+ /* success or failure */
+ u32 status;
+};
+
+struct radar_detect_intr_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 radar_det_channel;
+};
+
+struct radar_detect_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* channel number in which the RADAR detected */
+ u8 channel_number;
+
+ /* RADAR pulse width in usecond */
+ u16 radar_pulse_width;
+
+ /* Number of RADAR pulses */
+ u16 num_radar_pulse;
+};
+
+struct wcn36xx_hal_get_tpc_report_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 sta[ETH_ALEN];
+ u8 dialog_token;
+ u8 txpower;
+};
+
+struct wcn36xx_hal_get_tpc_report_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_send_probe_resp_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 probe_resp_template[BEACON_TEMPLATE_SIZE];
+ u32 probe_resp_template_len;
+ u32 proxy_probe_req_valid_ie_bmap[8];
+ u8 bssid[ETH_ALEN];
+};
+
+struct send_probe_resp_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct send_unknown_frame_rx_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_delete_sta_context_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u16 aid;
+ u16 sta_id;
+
+ /* TO SUPPORT BT-AMP */
+ u8 bssid[ETH_ALEN];
+
+ /* HAL copies bssid from the sta table. */
+ u8 addr2[ETH_ALEN];
+
+ /* To unify the keepalive / unknown A2 / tim-based disa */
+ u16 reason_code;
+} __packed;
+
+struct indicate_del_sta {
+ struct wcn36xx_hal_msg_header header;
+ u8 aid;
+ u8 sta_index;
+ u8 bss_index;
+ u8 reason_code;
+ u32 status;
+};
+
+struct bt_amp_event_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ enum bt_amp_event_type btAmpEventType;
+};
+
+struct bt_amp_event_rsp {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct tl_hal_flush_ac_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index. originates from HAL */
+ u8 sta_id;
+
+ /* TID for which the transmit queue is being flushed */
+ u8 tid;
+};
+
+struct tl_hal_flush_ac_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index. originates from HAL */
+ u8 sta_id;
+
+ /* TID for which the transmit queue is being flushed */
+ u8 tid;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_enter_imps_req_msg {
+ struct wcn36xx_hal_msg_header header;
+};
+
+struct wcn36xx_hal_exit_imps_req {
+ struct wcn36xx_hal_msg_header header;
+};
+
+struct wcn36xx_hal_enter_bmps_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bss_index;
+
+ /* TBTT value derived from the last beacon */
+#ifndef BUILD_QWPTTSTATIC
+ u64 tbtt;
+#endif
+ u8 dtim_count;
+
+ /* DTIM period given to HAL during association may not be valid, if
+ * association is based on ProbeRsp instead of beacon. */
+ u8 dtim_period;
+
+ /* For CCX and 11R Roaming */
+ u32 rssi_filter_period;
+
+ u32 num_beacon_per_rssi_average;
+ u8 rssi_filter_enable;
+} __packed;
+
+struct wcn36xx_hal_exit_bmps_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 send_data_null;
+ u8 bss_index;
+} __packed;
+
+struct wcn36xx_hal_missed_beacon_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bss_index;
+} __packed;
+
+/* Beacon Filtering data structures */
+
+/* The above structure would be followed by multiple of below mentioned
+ * structure
+ */
+struct beacon_filter_ie {
+ u8 element_id;
+ u8 check_ie_presence;
+ u8 offset;
+ u8 value;
+ u8 bitmask;
+ u8 ref;
+};
+
+struct wcn36xx_hal_add_bcn_filter_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u16 capability_info;
+ u16 capability_mask;
+ u16 beacon_interval;
+ u16 ie_num;
+ u8 bss_index;
+ u8 reserved;
+};
+
+struct wcn36xx_hal_rem_bcn_filter_req {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 ie_Count;
+ u8 rem_ie_id[1];
+};
+
+#define WCN36XX_HAL_IPV4_ARP_REPLY_OFFLOAD 0
+#define WCN36XX_HAL_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD 1
+#define WCN36XX_HAL_IPV6_NS_OFFLOAD 2
+#define WCN36XX_HAL_IPV6_ADDR_LEN 16
+#define WCN36XX_HAL_OFFLOAD_DISABLE 0
+#define WCN36XX_HAL_OFFLOAD_ENABLE 1
+#define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2
+#define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \
+ (HAL_OFFLOAD_ENABLE|HAL_OFFLOAD_BCAST_FILTER_ENABLE)
+
+struct wcn36xx_hal_ns_offload_params {
+ u8 src_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
+ u8 self_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
+
+ /* Only support 2 possible Network Advertisement IPv6 address */
+ u8 target_ipv6_addr1[WCN36XX_HAL_IPV6_ADDR_LEN];
+ u8 target_ipv6_addr2[WCN36XX_HAL_IPV6_ADDR_LEN];
+
+ u8 self_addr[ETH_ALEN];
+ u8 src_ipv6_addr_valid:1;
+ u8 target_ipv6_addr1_valid:1;
+ u8 target_ipv6_addr2_valid:1;
+ u8 reserved1:5;
+
+ /* make it DWORD aligned */
+ u8 reserved2;
+
+ /* slot index for this offload */
+ u32 slot_index;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_host_offload_req {
+ u8 offload_Type;
+
+ /* enable or disable */
+ u8 enable;
+
+ union {
+ u8 host_ipv4_addr[4];
+ u8 host_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN];
+ } u;
+};
+
+struct wcn36xx_hal_host_offload_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_host_offload_req host_offload_params;
+ struct wcn36xx_hal_ns_offload_params ns_offload_params;
+};
+
+/* Packet Types. */
+#define WCN36XX_HAL_KEEP_ALIVE_NULL_PKT 1
+#define WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP 2
+
+/* Enable or disable keep alive */
+#define WCN36XX_HAL_KEEP_ALIVE_DISABLE 0
+#define WCN36XX_HAL_KEEP_ALIVE_ENABLE 1
+#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 30 /* unit: s */
+
+/* Keep Alive request. */
+struct wcn36xx_hal_keep_alive_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 packet_type;
+ u32 time_period;
+ u8 host_ipv4_addr[WCN36XX_HAL_IPV4_ADDR_LEN];
+ u8 dest_ipv4_addr[WCN36XX_HAL_IPV4_ADDR_LEN];
+ u8 dest_addr[ETH_ALEN];
+ u8 bss_index;
+} __packed;
+
+struct wcn36xx_hal_rssi_threshold_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ s8 threshold1:8;
+ s8 threshold2:8;
+ s8 threshold3:8;
+ u8 thres1_pos_notify:1;
+ u8 thres1_neg_notify:1;
+ u8 thres2_pos_notify:1;
+ u8 thres2_neg_notify:1;
+ u8 thres3_pos_notify:1;
+ u8 thres3_neg_notify:1;
+ u8 reserved10:2;
+};
+
+struct wcn36xx_hal_enter_uapsd_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bk_delivery:1;
+ u8 be_delivery:1;
+ u8 vi_delivery:1;
+ u8 vo_delivery:1;
+ u8 bk_trigger:1;
+ u8 be_trigger:1;
+ u8 vi_trigger:1;
+ u8 vo_trigger:1;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_exit_uapsd_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ u8 bss_index;
+};
+
+#define WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE 128
+#define WCN36XX_HAL_WOWL_BCAST_MAX_NUM_PATTERNS 16
+
+struct wcn36xx_hal_wowl_add_bcast_ptrn_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Pattern ID */
+ u8 id;
+
+ /* Pattern byte offset from beginning of the 802.11 packet to start
+ * of the wake-up pattern */
+ u8 byte_Offset;
+
+ /* Non-Zero Pattern size */
+ u8 size;
+
+ /* Pattern */
+ u8 pattern[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
+
+ /* Non-zero pattern mask size */
+ u8 mask_size;
+
+ /* Pattern mask */
+ u8 mask[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
+
+ /* Extra pattern */
+ u8 extra[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
+
+ /* Extra pattern mask */
+ u8 mask_extra[WCN36XX_HAL_WOWL_BCAST_PATTERN_MAX_SIZE];
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_wow_del_bcast_ptrn_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Pattern ID of the wakeup pattern to be deleted */
+ u8 id;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_wowl_enter_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Enables/disables magic packet filtering */
+ u8 magic_packet_enable;
+
+ /* Magic pattern */
+ u8 magic_pattern[ETH_ALEN];
+
+ /* Enables/disables packet pattern filtering in firmware. Enabling
+ * this flag enables broadcast pattern matching in Firmware. If
+ * unicast pattern matching is also desired,
+ * ucUcastPatternFilteringEnable flag must be set tot true as well
+ */
+ u8 pattern_filtering_enable;
+
+ /* Enables/disables unicast packet pattern filtering. This flag
+ * specifies whether we want to do pattern match on unicast packets
+ * as well and not just broadcast packets. This flag has no effect
+ * if the ucPatternFilteringEnable (main controlling flag) is set
+ * to false
+ */
+ u8 ucast_pattern_filtering_enable;
+
+ /* This configuration is valid only when magicPktEnable=1. It
+ * requests hardware to wake up when it receives the Channel Switch
+ * Action Frame.
+ */
+ u8 wow_channel_switch_receive;
+
+ /* This configuration is valid only when magicPktEnable=1. It
+ * requests hardware to wake up when it receives the
+ * Deauthentication Frame.
+ */
+ u8 wow_deauth_receive;
+
+ /* This configuration is valid only when magicPktEnable=1. It
+ * requests hardware to wake up when it receives the Disassociation
+ * Frame.
+ */
+ u8 wow_disassoc_receive;
+
+ /* This configuration is valid only when magicPktEnable=1. It
+ * requests hardware to wake up when it has missed consecutive
+ * beacons. This is a hardware register configuration (NOT a
+ * firmware configuration).
+ */
+ u8 wow_max_missed_beacons;
+
+ /* This configuration is valid only when magicPktEnable=1. This is
+ * a timeout value in units of microsec. It requests hardware to
+ * unconditionally wake up after it has stayed in WoWLAN mode for
+ * some time. Set 0 to disable this feature.
+ */
+ u8 wow_max_sleep;
+
+ /* This configuration directs the WoW packet filtering to look for
+ * EAP-ID requests embedded in EAPOL frames and use this as a wake
+ * source.
+ */
+ u8 wow_eap_id_request_enable;
+
+ /* This configuration directs the WoW packet filtering to look for
+ * EAPOL-4WAY requests and use this as a wake source.
+ */
+ u8 wow_eapol_4way_enable;
+
+ /* This configuration allows a host wakeup on an network scan
+ * offload match.
+ */
+ u8 wow_net_scan_offload_match;
+
+ /* This configuration allows a host wakeup on any GTK rekeying
+ * error.
+ */
+ u8 wow_gtk_rekey_error;
+
+ /* This configuration allows a host wakeup on BSS connection loss.
+ */
+ u8 wow_bss_connection_loss;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_wowl_exit_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_get_rssi_req_msg {
+ struct wcn36xx_hal_msg_header header;
+};
+
+struct wcn36xx_hal_get_roam_rssi_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Valid STA Idx for per STA stats request */
+ u32 sta_id;
+};
+
+struct wcn36xx_hal_set_uapsd_ac_params_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* STA index */
+ u8 sta_idx;
+
+ /* Access Category */
+ u8 ac;
+
+ /* User Priority */
+ u8 up;
+
+ /* Service Interval */
+ u32 service_interval;
+
+ /* Suspend Interval */
+ u32 suspend_interval;
+
+ /* Delay Interval */
+ u32 delay_interval;
+};
+
+struct wcn36xx_hal_configure_rxp_filter_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 set_mcst_bcst_filter_setting;
+ u8 set_mcst_bcst_filter;
+};
+
+struct wcn36xx_hal_enter_imps_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_exit_imps_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_enter_bmps_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+} __packed;
+
+struct wcn36xx_hal_exit_bmps_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+} __packed;
+
+struct wcn36xx_hal_enter_uapsd_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_exit_uapsd_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_rssi_notification_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 rssi_thres1_pos_cross:1;
+ u32 rssi_thres1_neg_cross:1;
+ u32 rssi_thres2_pos_cross:1;
+ u32 rssi_thres2_neg_cross:1;
+ u32 rssi_thres3_pos_cross:1;
+ u32 rssi_thres3_neg_cross:1;
+ u32 avg_rssi:8;
+ u32 reserved:18;
+
+};
+
+struct wcn36xx_hal_get_rssio_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+ s8 rssi;
+
+};
+
+struct wcn36xx_hal_get_roam_rssi_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 sta_id;
+ s8 rssi;
+};
+
+struct wcn36xx_hal_wowl_enter_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_wowl_exit_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_add_bcn_filter_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_rem_bcn_filter_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_add_wowl_bcast_ptrn_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_del_wowl_bcast_ptrn_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_host_offload_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_keep_alive_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_set_rssi_thresh_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_set_uapsd_ac_params_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_configure_rxp_filter_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct set_max_tx_pwr_req {
+ struct wcn36xx_hal_msg_header header;
+
+ /* BSSID is needed to identify which session issued this request.
+ * As the request has power constraints, this should be applied
+ * only to that session */
+ u8 bssid[ETH_ALEN];
+
+ u8 self_addr[ETH_ALEN];
+
+ /* In request, power == MaxTx power to be used. */
+ u8 power;
+};
+
+struct set_max_tx_pwr_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* power == tx power used for management frames */
+ u8 power;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct set_tx_pwr_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* TX Power in milli watts */
+ u32 tx_power;
+
+ u8 bss_index;
+};
+
+struct set_tx_pwr_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct get_tx_pwr_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 sta_id;
+};
+
+struct get_tx_pwr_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* TX Power in milli watts */
+ u32 tx_power;
+};
+
+struct set_p2p_gonoa_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 opp_ps;
+ u32 ct_window;
+ u8 count;
+ u32 duration;
+ u32 interval;
+ u32 single_noa_duration;
+ u8 ps_selection;
+};
+
+struct set_p2p_gonoa_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_add_sta_self_req {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 self_addr[ETH_ALEN];
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_add_sta_self_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* Self STA Index */
+ u8 self_sta_index;
+
+ /* DPU Index (IGTK, PTK, GTK all same) */
+ u8 dpu_index;
+
+ /* DPU Signature */
+ u8 dpu_signature;
+} __packed;
+
+struct wcn36xx_hal_del_sta_self_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 self_addr[ETH_ALEN];
+} __packed;
+
+struct wcn36xx_hal_del_sta_self_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /*success or failure */
+ u32 status;
+
+ u8 self_addr[ETH_ALEN];
+} __packed;
+
+struct aggr_add_ts_req {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Station Index */
+ u16 sta_idx;
+
+ /* TSPEC handler uniquely identifying a TSPEC for a STA in a BSS.
+ * This will carry the bitmap with the bit positions representing
+ * different AC.s */
+ u16 tspec_index;
+
+ /* Tspec info per AC To program TPE with required parameters */
+ struct wcn36xx_hal_tspec_ie tspec[WCN36XX_HAL_MAX_AC];
+
+ /* U-APSD Flags: 1b per AC. Encoded as follows:
+ b7 b6 b5 b4 b3 b2 b1 b0 =
+ X X X X BE BK VI VO */
+ u8 uapsd;
+
+ /* These parameters are for all the access categories */
+
+ /* Service Interval */
+ u32 service_interval[WCN36XX_HAL_MAX_AC];
+
+ /* Suspend Interval */
+ u32 suspend_interval[WCN36XX_HAL_MAX_AC];
+
+ /* Delay Interval */
+ u32 delay_interval[WCN36XX_HAL_MAX_AC];
+};
+
+struct aggr_add_ts_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status0;
+
+ /* FIXME PRIMA for future use for 11R */
+ u32 status1;
+};
+
+struct wcn36xx_hal_configure_apps_cpu_wakeup_state_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 is_apps_cpu_awake;
+};
+
+struct wcn36xx_hal_configure_apps_cpu_wakeup_state_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_dump_cmd_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 arg1;
+ u32 arg2;
+ u32 arg3;
+ u32 arg4;
+ u32 arg5;
+} __packed;
+
+struct wcn36xx_hal_dump_cmd_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* Length of the responce message */
+ u32 rsp_length;
+
+ /* FIXME: Currently considering the the responce will be less than
+ * 100bytes */
+ u8 rsp_buffer[DUMPCMD_RSP_BUFFER];
+} __packed;
+
+#define WLAN_COEX_IND_DATA_SIZE (4)
+#define WLAN_COEX_IND_TYPE_DISABLE_HB_MONITOR (0)
+#define WLAN_COEX_IND_TYPE_ENABLE_HB_MONITOR (1)
+
+struct coex_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Coex Indication Type */
+ u32 type;
+
+ /* Coex Indication Data */
+ u32 data[WLAN_COEX_IND_DATA_SIZE];
+};
+
+struct wcn36xx_hal_tx_compl_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Tx Complete Indication Success or Failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_wlan_host_suspend_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 configured_mcst_bcst_filter_setting;
+ u32 active_session_count;
+};
+
+struct wcn36xx_hal_wlan_exclude_unencrpted_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 dot11_exclude_unencrypted;
+ u8 bssid[ETH_ALEN];
+};
+
+struct noa_attr_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 index;
+ u8 opp_ps_flag;
+ u16 ctwin;
+
+ u16 noa1_interval_count;
+ u16 bss_index;
+ u32 noa1_duration;
+ u32 noa1_interval;
+ u32 noa1_starttime;
+
+ u16 noa2_interval_count;
+ u16 reserved2;
+ u32 noa2_duration;
+ u32 noa2_interval;
+ u32 noa2_start_time;
+
+ u32 status;
+};
+
+struct noa_start_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u32 status;
+ u32 bss_index;
+};
+
+struct wcn36xx_hal_wlan_host_resume_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 configured_mcst_bcst_filter_setting;
+};
+
+struct wcn36xx_hal_host_resume_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+struct wcn36xx_hal_del_ba_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u16 sta_idx;
+
+ /* Peer MAC Address, whose BA session has timed out */
+ u8 peer_addr[ETH_ALEN];
+
+ /* TID for which a BA session timeout is being triggered */
+ u8 ba_tid;
+
+ /* DELBA direction
+ * 1 - Originator
+ * 0 - Recipient
+ */
+ u8 direction;
+
+ u32 reason_code;
+
+ /* TO SUPPORT BT-AMP */
+ u8 bssid[ETH_ALEN];
+};
+
+/* PNO Messages */
+
+/* Max number of channels that a network can be found on */
+#define WCN36XX_HAL_PNO_MAX_NETW_CHANNELS 26
+
+/* Max number of channels that a network can be found on */
+#define WCN36XX_HAL_PNO_MAX_NETW_CHANNELS_EX 60
+
+/* Maximum numbers of networks supported by PNO */
+#define WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS 16
+
+/* The number of scan time intervals that can be programmed into PNO */
+#define WCN36XX_HAL_PNO_MAX_SCAN_TIMERS 10
+
+/* Maximum size of the probe template */
+#define WCN36XX_HAL_PNO_MAX_PROBE_SIZE 450
+
+/* Type of PNO enabling:
+ *
+ * Immediate - scanning will start immediately and PNO procedure will be
+ * repeated based on timer
+ *
+ * Suspend - scanning will start at suspend
+ *
+ * Resume - scanning will start on system resume
+ */
+enum pno_mode {
+ PNO_MODE_IMMEDIATE,
+ PNO_MODE_ON_SUSPEND,
+ PNO_MODE_ON_RESUME,
+ PNO_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* Authentication type */
+enum auth_type {
+ AUTH_TYPE_ANY = 0,
+ AUTH_TYPE_OPEN_SYSTEM = 1,
+
+ /* Upper layer authentication types */
+ AUTH_TYPE_WPA = 2,
+ AUTH_TYPE_WPA_PSK = 3,
+
+ AUTH_TYPE_RSN = 4,
+ AUTH_TYPE_RSN_PSK = 5,
+ AUTH_TYPE_FT_RSN = 6,
+ AUTH_TYPE_FT_RSN_PSK = 7,
+ AUTH_TYPE_WAPI_WAI_CERTIFICATE = 8,
+ AUTH_TYPE_WAPI_WAI_PSK = 9,
+
+ AUTH_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* Encryption type */
+enum ed_type {
+ ED_ANY = 0,
+ ED_NONE = 1,
+ ED_WEP = 2,
+ ED_TKIP = 3,
+ ED_CCMP = 4,
+ ED_WPI = 5,
+
+ ED_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* SSID broadcast type */
+enum ssid_bcast_type {
+ BCAST_UNKNOWN = 0,
+ BCAST_NORMAL = 1,
+ BCAST_HIDDEN = 2,
+
+ BCAST_TYPE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE
+};
+
+/* The network description for which PNO will have to look for */
+struct network_type {
+ /* SSID of the BSS */
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* Authentication type for the network */
+ enum auth_type authentication;
+
+ /* Encryption type for the network */
+ enum ed_type encryption;
+
+ /* Indicate the channel on which the Network can be found 0 - if
+ * all channels */
+ u8 channel_count;
+ u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
+
+ /* Indicates the RSSI threshold for the network to be considered */
+ u8 rssi_threshold;
+};
+
+struct scan_timer {
+ /* How much it should wait */
+ u32 value;
+
+ /* How many times it should repeat that wait value 0 - keep using
+ * this timer until PNO is disabled */
+ u32 repeat;
+
+ /* e.g: 2 3 4 0 - it will wait 2s between consecutive scans for 3
+ * times - after that it will wait 4s between consecutive scans
+ * until disabled */
+};
+
+/* The network parameters to be sent to the PNO algorithm */
+struct scan_timers_type {
+ /* set to 0 if you wish for PNO to use its default telescopic timer */
+ u8 count;
+
+ /* A set value represents the amount of time that PNO will wait
+ * between two consecutive scan procedures If the desired is for a
+ * uniform timer that fires always at the exact same interval - one
+ * single value is to be set If there is a desire for a more
+ * complex - telescopic like timer multiple values can be set -
+ * once PNO reaches the end of the array it will continue scanning
+ * at intervals presented by the last value */
+ struct scan_timer values[WCN36XX_HAL_PNO_MAX_SCAN_TIMERS];
+};
+
+/* Preferred network list request */
+struct set_pref_netw_list_req {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Enable PNO */
+ u32 enable;
+
+ /* Immediate, On Suspend, On Resume */
+ enum pno_mode mode;
+
+ /* Number of networks sent for PNO */
+ u32 networks_count;
+
+ /* The networks that PNO needs to look for */
+ struct network_type networks[WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS];
+
+ /* The scan timers required for PNO */
+ struct scan_timers_type scan_timers;
+
+ /* Probe template for 2.4GHz band */
+ u16 band_24g_probe_size;
+ u8 band_24g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
+
+ /* Probe template for 5GHz band */
+ u16 band_5g_probe_size;
+ u8 band_5g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
+};
+
+/* The network description for which PNO will have to look for */
+struct network_type_new {
+ /* SSID of the BSS */
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* Authentication type for the network */
+ enum auth_type authentication;
+
+ /* Encryption type for the network */
+ enum ed_type encryption;
+
+ /* SSID broadcast type, normal, hidden or unknown */
+ enum ssid_bcast_type bcast_network_type;
+
+ /* Indicate the channel on which the Network can be found 0 - if
+ * all channels */
+ u8 channel_count;
+ u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
+
+ /* Indicates the RSSI threshold for the network to be considered */
+ u8 rssi_threshold;
+};
+
+/* Preferred network list request new */
+struct set_pref_netw_list_req_new {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Enable PNO */
+ u32 enable;
+
+ /* Immediate, On Suspend, On Resume */
+ enum pno_mode mode;
+
+ /* Number of networks sent for PNO */
+ u32 networks_count;
+
+ /* The networks that PNO needs to look for */
+ struct network_type_new networks[WCN36XX_HAL_PNO_MAX_SUPP_NETWORKS];
+
+ /* The scan timers required for PNO */
+ struct scan_timers_type scan_timers;
+
+ /* Probe template for 2.4GHz band */
+ u16 band_24g_probe_size;
+ u8 band_24g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
+
+ /* Probe template for 5GHz band */
+ u16 band_5g_probe_size;
+ u8 band_5g_probe_template[WCN36XX_HAL_PNO_MAX_PROBE_SIZE];
+};
+
+/* Preferred network list response */
+struct set_pref_netw_list_resp {
+ struct wcn36xx_hal_msg_header header;
+
+ /* status of the request - just to indicate that PNO has
+ * acknowledged the request and will start scanning */
+ u32 status;
+};
+
+/* Preferred network found indication */
+struct pref_netw_found_ind {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* Network that was found with the highest RSSI */
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* Indicates the RSSI */
+ u8 rssi;
+};
+
+/* RSSI Filter request */
+struct set_rssi_filter_req {
+ struct wcn36xx_hal_msg_header header;
+
+ /* RSSI Threshold */
+ u8 rssi_threshold;
+};
+
+/* Set RSSI filter resp */
+struct set_rssi_filter_resp {
+ struct wcn36xx_hal_msg_header header;
+
+ /* status of the request */
+ u32 status;
+};
+
+/* Update scan params - sent from host to PNO to be used during PNO
+ * scanningx */
+struct wcn36xx_hal_update_scan_params_req {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* Host setting for 11d */
+ u8 dot11d_enabled;
+
+ /* Lets PNO know that host has determined the regulatory domain */
+ u8 dot11d_resolved;
+
+ /* Channels on which PNO is allowed to scan */
+ u8 channel_count;
+ u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS];
+
+ /* Minimum channel time */
+ u16 active_min_ch_time;
+
+ /* Maximum channel time */
+ u16 active_max_ch_time;
+
+ /* Minimum channel time */
+ u16 passive_min_ch_time;
+
+ /* Maximum channel time */
+ u16 passive_max_ch_time;
+
+ /* Cb State */
+ enum phy_chan_bond_state state;
+} __packed;
+
+/* Update scan params - sent from host to PNO to be used during PNO
+ * scanningx */
+struct update_scan_params_req_ex {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* Host setting for 11d */
+ u8 dot11d_enabled;
+
+ /* Lets PNO know that host has determined the regulatory domain */
+ u8 dot11d_resolved;
+
+ /* Channels on which PNO is allowed to scan */
+ u8 channel_count;
+ u8 channels[WCN36XX_HAL_PNO_MAX_NETW_CHANNELS_EX];
+
+ /* Minimum channel time */
+ u16 active_min_ch_time;
+
+ /* Maximum channel time */
+ u16 active_max_ch_time;
+
+ /* Minimum channel time */
+ u16 passive_min_ch_time;
+
+ /* Maximum channel time */
+ u16 passive_max_ch_time;
+
+ /* Cb State */
+ enum phy_chan_bond_state state;
+};
+
+/* Update scan params - sent from host to PNO to be used during PNO
+ * scanningx */
+struct wcn36xx_hal_update_scan_params_resp {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* status of the request */
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_set_tx_per_tracking_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* 0: disable, 1:enable */
+ u8 tx_per_tracking_enable;
+
+ /* Check period, unit is sec. */
+ u8 tx_per_tracking_period;
+
+ /* (Fail TX packet)/(Total TX packet) ratio, the unit is 10%. */
+ u8 tx_per_tracking_ratio;
+
+ /* A watermark of check number, once the tx packet exceed this
+ * number, we do the check, default is 5 */
+ u32 tx_per_tracking_watermark;
+};
+
+struct wcn36xx_hal_set_tx_per_tracking_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+};
+
+struct tx_per_hit_ind_msg {
+ struct wcn36xx_hal_msg_header header;
+};
+
+/* Packet Filtering Definitions Begin */
+#define WCN36XX_HAL_PROTOCOL_DATA_LEN 8
+#define WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS 240
+#define WCN36XX_HAL_MAX_NUM_FILTERS 20
+#define WCN36XX_HAL_MAX_CMP_PER_FILTER 10
+
+enum wcn36xx_hal_receive_packet_filter_type {
+ HAL_RCV_FILTER_TYPE_INVALID,
+ HAL_RCV_FILTER_TYPE_FILTER_PKT,
+ HAL_RCV_FILTER_TYPE_BUFFER_PKT,
+ HAL_RCV_FILTER_TYPE_MAX_ENUM_SIZE
+};
+
+enum wcn36xx_hal_rcv_pkt_flt_protocol_type {
+ HAL_FILTER_PROTO_TYPE_INVALID,
+ HAL_FILTER_PROTO_TYPE_MAC,
+ HAL_FILTER_PROTO_TYPE_ARP,
+ HAL_FILTER_PROTO_TYPE_IPV4,
+ HAL_FILTER_PROTO_TYPE_IPV6,
+ HAL_FILTER_PROTO_TYPE_UDP,
+ HAL_FILTER_PROTO_TYPE_MAX
+};
+
+enum wcn36xx_hal_rcv_pkt_flt_cmp_flag_type {
+ HAL_FILTER_CMP_TYPE_INVALID,
+ HAL_FILTER_CMP_TYPE_EQUAL,
+ HAL_FILTER_CMP_TYPE_MASK_EQUAL,
+ HAL_FILTER_CMP_TYPE_NOT_EQUAL,
+ HAL_FILTER_CMP_TYPE_MAX
+};
+
+struct wcn36xx_hal_rcv_pkt_filter_params {
+ u8 protocol_layer;
+ u8 cmp_flag;
+
+ /* Length of the data to compare */
+ u16 data_length;
+
+ /* from start of the respective frame header */
+ u8 data_offset;
+
+ /* Reserved field */
+ u8 reserved;
+
+ /* Data to compare */
+ u8 compare_data[WCN36XX_HAL_PROTOCOL_DATA_LEN];
+
+ /* Mask to be applied on the received packet data before compare */
+ u8 data_mask[WCN36XX_HAL_PROTOCOL_DATA_LEN];
+};
+
+struct wcn36xx_hal_sessionized_rcv_pkt_filter_cfg_type {
+ u8 id;
+ u8 type;
+ u8 params_count;
+ u32 coleasce_time;
+ u8 bss_index;
+ struct wcn36xx_hal_rcv_pkt_filter_params params[1];
+};
+
+struct wcn36xx_hal_set_rcv_pkt_filter_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 id;
+ u8 type;
+ u8 params_count;
+ u32 coalesce_time;
+ struct wcn36xx_hal_rcv_pkt_filter_params params[1];
+};
+
+struct wcn36xx_hal_rcv_flt_mc_addr_list_type {
+ /* from start of the respective frame header */
+ u8 data_offset;
+
+ u32 mc_addr_count;
+ u8 mc_addr[ETH_ALEN][WCN36XX_HAL_MAX_NUM_MULTICAST_ADDRESS];
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_set_pkt_filter_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_match_cnt_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_match_cnt {
+ u8 id;
+ u32 match_cnt;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_match_cnt_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Success or Failure */
+ u32 status;
+
+ u32 match_count;
+ struct wcn36xx_hal_rcv_flt_pkt_match_cnt
+ matches[WCN36XX_HAL_MAX_NUM_FILTERS];
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_clear_param {
+ /* only valid for response message */
+ u32 status;
+ u8 id;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_clear_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_rcv_flt_pkt_clear_param param;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_clear_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_rcv_flt_pkt_clear_param param;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ struct wcn36xx_hal_rcv_flt_mc_addr_list_type mc_addr_list;
+};
+
+struct wcn36xx_hal_rcv_flt_pkt_set_mc_list_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+ u32 status;
+ u8 bss_index;
+};
+
+/* Packet Filtering Definitions End */
+
+struct wcn36xx_hal_set_power_params_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Ignore DTIM */
+ u32 ignore_dtim;
+
+ /* DTIM Period */
+ u32 dtim_period;
+
+ /* Listen Interval */
+ u32 listen_interval;
+
+ /* Broadcast Multicast Filter */
+ u32 bcast_mcast_filter;
+
+ /* Beacon Early Termination */
+ u32 enable_bet;
+
+ /* Beacon Early Termination Interval */
+ u32 bet_interval;
+} __packed;
+
+struct wcn36xx_hal_set_power_params_resp {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* status of the request */
+ u32 status;
+} __packed;
+
+/* Capability bitmap exchange definitions and macros starts */
+
+enum place_holder_in_cap_bitmap {
+ MCC = 0,
+ P2P = 1,
+ DOT11AC = 2,
+ SLM_SESSIONIZATION = 3,
+ DOT11AC_OPMODE = 4,
+ SAP32STA = 5,
+ TDLS = 6,
+ P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7,
+ WLANACTIVE_OFFLOAD = 8,
+ BEACON_OFFLOAD = 9,
+ SCAN_OFFLOAD = 10,
+ ROAM_OFFLOAD = 11,
+ BCN_MISS_OFFLOAD = 12,
+ STA_POWERSAVE = 13,
+ STA_ADVANCED_PWRSAVE = 14,
+ AP_UAPSD = 15,
+ AP_DFS = 16,
+ BLOCKACK = 17,
+ PHY_ERR = 18,
+ BCN_FILTER = 19,
+ RTT = 20,
+ RATECTRL = 21,
+ WOW = 22,
+ MAX_FEATURE_SUPPORTED = 128,
+};
+
+struct wcn36xx_hal_feat_caps_msg {
+
+ struct wcn36xx_hal_msg_header header;
+
+ u32 feat_caps[4];
+} __packed;
+
+/* status codes to help debug rekey failures */
+enum gtk_rekey_status {
+ WCN36XX_HAL_GTK_REKEY_STATUS_SUCCESS = 0,
+
+ /* rekey detected, but not handled */
+ WCN36XX_HAL_GTK_REKEY_STATUS_NOT_HANDLED = 1,
+
+ /* MIC check error on M1 */
+ WCN36XX_HAL_GTK_REKEY_STATUS_MIC_ERROR = 2,
+
+ /* decryption error on M1 */
+ WCN36XX_HAL_GTK_REKEY_STATUS_DECRYPT_ERROR = 3,
+
+ /* M1 replay detected */
+ WCN36XX_HAL_GTK_REKEY_STATUS_REPLAY_ERROR = 4,
+
+ /* missing GTK key descriptor in M1 */
+ WCN36XX_HAL_GTK_REKEY_STATUS_MISSING_KDE = 5,
+
+ /* missing iGTK key descriptor in M1 */
+ WCN36XX_HAL_GTK_REKEY_STATUS_MISSING_IGTK_KDE = 6,
+
+ /* key installation error */
+ WCN36XX_HAL_GTK_REKEY_STATUS_INSTALL_ERROR = 7,
+
+ /* iGTK key installation error */
+ WCN36XX_HAL_GTK_REKEY_STATUS_IGTK_INSTALL_ERROR = 8,
+
+ /* GTK rekey M2 response TX error */
+ WCN36XX_HAL_GTK_REKEY_STATUS_RESP_TX_ERROR = 9,
+
+ /* non-specific general error */
+ WCN36XX_HAL_GTK_REKEY_STATUS_GEN_ERROR = 255
+};
+
+/* wake reason types */
+enum wake_reason_type {
+ WCN36XX_HAL_WAKE_REASON_NONE = 0,
+
+ /* magic packet match */
+ WCN36XX_HAL_WAKE_REASON_MAGIC_PACKET = 1,
+
+ /* host defined pattern match */
+ WCN36XX_HAL_WAKE_REASON_PATTERN_MATCH = 2,
+
+ /* EAP-ID frame detected */
+ WCN36XX_HAL_WAKE_REASON_EAPID_PACKET = 3,
+
+ /* start of EAPOL 4-way handshake detected */
+ WCN36XX_HAL_WAKE_REASON_EAPOL4WAY_PACKET = 4,
+
+ /* network scan offload match */
+ WCN36XX_HAL_WAKE_REASON_NETSCAN_OFFL_MATCH = 5,
+
+ /* GTK rekey status wakeup (see status) */
+ WCN36XX_HAL_WAKE_REASON_GTK_REKEY_STATUS = 6,
+
+ /* BSS connection lost */
+ WCN36XX_HAL_WAKE_REASON_BSS_CONN_LOST = 7,
+};
+
+/*
+ Wake Packet which is saved at tWakeReasonParams.DataStart
+ This data is sent for any wake reasons that involve a packet-based wakeup :
+
+ WCN36XX_HAL_WAKE_REASON_TYPE_MAGIC_PACKET
+ WCN36XX_HAL_WAKE_REASON_TYPE_PATTERN_MATCH
+ WCN36XX_HAL_WAKE_REASON_TYPE_EAPID_PACKET
+ WCN36XX_HAL_WAKE_REASON_TYPE_EAPOL4WAY_PACKET
+ WCN36XX_HAL_WAKE_REASON_TYPE_GTK_REKEY_STATUS
+
+ The information is provided to the host for auditing and debug purposes
+
+*/
+
+/* Wake reason indication */
+struct wcn36xx_hal_wake_reason_ind {
+ struct wcn36xx_hal_msg_header header;
+
+ /* see tWakeReasonType */
+ u32 reason;
+
+ /* argument specific to the reason type */
+ u32 reason_arg;
+
+ /* length of optional data stored in this message, in case HAL
+ * truncates the data (i.e. data packets) this length will be less
+ * than the actual length */
+ u32 stored_data_len;
+
+ /* actual length of data */
+ u32 actual_data_len;
+
+ /* variable length start of data (length == storedDataLen) see
+ * specific wake type */
+ u8 data_start[1];
+
+ u32 bss_index:8;
+ u32 reserved:24;
+};
+
+#define WCN36XX_HAL_GTK_KEK_BYTES 16
+#define WCN36XX_HAL_GTK_KCK_BYTES 16
+
+#define WCN36XX_HAL_GTK_OFFLOAD_FLAGS_DISABLE (1 << 0)
+
+#define GTK_SET_BSS_KEY_TAG 0x1234AA55
+
+struct wcn36xx_hal_gtk_offload_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* optional flags */
+ u32 flags;
+
+ /* Key confirmation key */
+ u8 kck[WCN36XX_HAL_GTK_KCK_BYTES];
+
+ /* key encryption key */
+ u8 kek[WCN36XX_HAL_GTK_KEK_BYTES];
+
+ /* replay counter */
+ u64 key_replay_counter;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_gtk_offload_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_gtk_offload_get_info_req_msg {
+ struct wcn36xx_hal_msg_header header;
+ u8 bss_index;
+};
+
+struct wcn36xx_hal_gtk_offload_get_info_rsp_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+
+ /* last rekey status when the rekey was offloaded */
+ u32 last_rekey_status;
+
+ /* current replay counter value */
+ u64 key_replay_counter;
+
+ /* total rekey attempts */
+ u32 total_rekey_count;
+
+ /* successful GTK rekeys */
+ u32 gtk_rekey_count;
+
+ /* successful iGTK rekeys */
+ u32 igtk_rekey_count;
+
+ u8 bss_index;
+};
+
+struct dhcp_info {
+ /* Indicates the device mode which indicates about the DHCP activity */
+ u8 device_mode;
+
+ u8 addr[ETH_ALEN];
+};
+
+struct dhcp_ind_status {
+ struct wcn36xx_hal_msg_header header;
+
+ /* success or failure */
+ u32 status;
+};
+
+/*
+ * Thermal Mitigation mode of operation.
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_MODE_0 - Based on AMPDU disabling aggregation
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_MODE_1 - Based on AMPDU disabling aggregation
+ * and reducing transmit power
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_MODE_2 - Not supported */
+enum wcn36xx_hal_thermal_mitigation_mode_type {
+ HAL_THERMAL_MITIGATION_MODE_INVALID = -1,
+ HAL_THERMAL_MITIGATION_MODE_0,
+ HAL_THERMAL_MITIGATION_MODE_1,
+ HAL_THERMAL_MITIGATION_MODE_2,
+ HAL_THERMAL_MITIGATION_MODE_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
+};
+
+
+/*
+ * Thermal Mitigation level.
+ * Note the levels are incremental i.e WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_2 =
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_0 +
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_1
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_0 - lowest level of thermal mitigation.
+ * This level indicates normal mode of operation
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_1 - 1st level of thermal mitigation
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_2 - 2nd level of thermal mitigation
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_3 - 3rd level of thermal mitigation
+ *
+ * WCN36XX_HAL_THERMAL_MITIGATION_LEVEL_4 - 4th level of thermal mitigation
+ */
+enum wcn36xx_hal_thermal_mitigation_level_type {
+ HAL_THERMAL_MITIGATION_LEVEL_INVALID = -1,
+ HAL_THERMAL_MITIGATION_LEVEL_0,
+ HAL_THERMAL_MITIGATION_LEVEL_1,
+ HAL_THERMAL_MITIGATION_LEVEL_2,
+ HAL_THERMAL_MITIGATION_LEVEL_3,
+ HAL_THERMAL_MITIGATION_LEVEL_4,
+ HAL_THERMAL_MITIGATION_LEVEL_MAX = WCN36XX_HAL_MAX_ENUM_SIZE,
+};
+
+
+/* WCN36XX_HAL_SET_THERMAL_MITIGATION_REQ */
+struct set_thermal_mitigation_req_msg {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Thermal Mitigation Operation Mode */
+ enum wcn36xx_hal_thermal_mitigation_mode_type mode;
+
+ /* Thermal Mitigation Level */
+ enum wcn36xx_hal_thermal_mitigation_level_type level;
+};
+
+struct set_thermal_mitigation_resp {
+
+ struct wcn36xx_hal_msg_header header;
+
+ /* status of the request */
+ u32 status;
+};
+
+/* Per STA Class B Statistics. Class B statistics are STA TX/RX stats
+ * provided to FW from Host via periodic messages */
+struct stats_class_b_ind {
+ struct wcn36xx_hal_msg_header header;
+
+ /* Duration over which this stats was collected */
+ u32 duration;
+
+ /* Per STA Stats */
+
+ /* TX stats */
+ u32 tx_bytes_pushed;
+ u32 tx_packets_pushed;
+
+ /* RX stats */
+ u32 rx_bytes_rcvd;
+ u32 rx_packets_rcvd;
+ u32 rx_time_total;
+};
+
+#endif /* _HAL_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
new file mode 100644
index 0000000..7839b31
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -0,0 +1,1036 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include "wcn36xx.h"
+
+unsigned int wcn36xx_dbg_mask;
+module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644);
+MODULE_PARM_DESC(debug_mask, "Debugging mask");
+
+#define CHAN2G(_freq, _idx) { \
+ .band = IEEE80211_BAND_2GHZ, \
+ .center_freq = (_freq), \
+ .hw_value = (_idx), \
+ .max_power = 25, \
+}
+
+#define CHAN5G(_freq, _idx) { \
+ .band = IEEE80211_BAND_5GHZ, \
+ .center_freq = (_freq), \
+ .hw_value = (_idx), \
+ .max_power = 25, \
+}
+
+/* The wcn firmware expects channel values to matching
+ * their mnemonic values. So use these for .hw_value. */
+static struct ieee80211_channel wcn_2ghz_channels[] = {
+ CHAN2G(2412, 1), /* Channel 1 */
+ CHAN2G(2417, 2), /* Channel 2 */
+ CHAN2G(2422, 3), /* Channel 3 */
+ CHAN2G(2427, 4), /* Channel 4 */
+ CHAN2G(2432, 5), /* Channel 5 */
+ CHAN2G(2437, 6), /* Channel 6 */
+ CHAN2G(2442, 7), /* Channel 7 */
+ CHAN2G(2447, 8), /* Channel 8 */
+ CHAN2G(2452, 9), /* Channel 9 */
+ CHAN2G(2457, 10), /* Channel 10 */
+ CHAN2G(2462, 11), /* Channel 11 */
+ CHAN2G(2467, 12), /* Channel 12 */
+ CHAN2G(2472, 13), /* Channel 13 */
+ CHAN2G(2484, 14) /* Channel 14 */
+
+};
+
+static struct ieee80211_channel wcn_5ghz_channels[] = {
+ CHAN5G(5180, 36),
+ CHAN5G(5200, 40),
+ CHAN5G(5220, 44),
+ CHAN5G(5240, 48),
+ CHAN5G(5260, 52),
+ CHAN5G(5280, 56),
+ CHAN5G(5300, 60),
+ CHAN5G(5320, 64),
+ CHAN5G(5500, 100),
+ CHAN5G(5520, 104),
+ CHAN5G(5540, 108),
+ CHAN5G(5560, 112),
+ CHAN5G(5580, 116),
+ CHAN5G(5600, 120),
+ CHAN5G(5620, 124),
+ CHAN5G(5640, 128),
+ CHAN5G(5660, 132),
+ CHAN5G(5700, 140),
+ CHAN5G(5745, 149),
+ CHAN5G(5765, 153),
+ CHAN5G(5785, 157),
+ CHAN5G(5805, 161),
+ CHAN5G(5825, 165)
+};
+
+#define RATE(_bitrate, _hw_rate, _flags) { \
+ .bitrate = (_bitrate), \
+ .flags = (_flags), \
+ .hw_value = (_hw_rate), \
+ .hw_value_short = (_hw_rate) \
+}
+
+static struct ieee80211_rate wcn_2ghz_rates[] = {
+ RATE(10, HW_RATE_INDEX_1MBPS, 0),
+ RATE(20, HW_RATE_INDEX_2MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
+ RATE(55, HW_RATE_INDEX_5_5MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
+ RATE(110, HW_RATE_INDEX_11MBPS, IEEE80211_RATE_SHORT_PREAMBLE),
+ RATE(60, HW_RATE_INDEX_6MBPS, 0),
+ RATE(90, HW_RATE_INDEX_9MBPS, 0),
+ RATE(120, HW_RATE_INDEX_12MBPS, 0),
+ RATE(180, HW_RATE_INDEX_18MBPS, 0),
+ RATE(240, HW_RATE_INDEX_24MBPS, 0),
+ RATE(360, HW_RATE_INDEX_36MBPS, 0),
+ RATE(480, HW_RATE_INDEX_48MBPS, 0),
+ RATE(540, HW_RATE_INDEX_54MBPS, 0)
+};
+
+static struct ieee80211_rate wcn_5ghz_rates[] = {
+ RATE(60, HW_RATE_INDEX_6MBPS, 0),
+ RATE(90, HW_RATE_INDEX_9MBPS, 0),
+ RATE(120, HW_RATE_INDEX_12MBPS, 0),
+ RATE(180, HW_RATE_INDEX_18MBPS, 0),
+ RATE(240, HW_RATE_INDEX_24MBPS, 0),
+ RATE(360, HW_RATE_INDEX_36MBPS, 0),
+ RATE(480, HW_RATE_INDEX_48MBPS, 0),
+ RATE(540, HW_RATE_INDEX_54MBPS, 0)
+};
+
+static struct ieee80211_supported_band wcn_band_2ghz = {
+ .channels = wcn_2ghz_channels,
+ .n_channels = ARRAY_SIZE(wcn_2ghz_channels),
+ .bitrates = wcn_2ghz_rates,
+ .n_bitrates = ARRAY_SIZE(wcn_2ghz_rates),
+ .ht_cap = {
+ .cap = IEEE80211_HT_CAP_GRN_FLD |
+ IEEE80211_HT_CAP_SGI_20 |
+ IEEE80211_HT_CAP_DSSSCCK40 |
+ IEEE80211_HT_CAP_LSIG_TXOP_PROT,
+ .ht_supported = true,
+ .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
+ .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
+ .mcs = {
+ .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+ .rx_highest = cpu_to_le16(72),
+ .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
+ }
+ }
+};
+
+static struct ieee80211_supported_band wcn_band_5ghz = {
+ .channels = wcn_5ghz_channels,
+ .n_channels = ARRAY_SIZE(wcn_5ghz_channels),
+ .bitrates = wcn_5ghz_rates,
+ .n_bitrates = ARRAY_SIZE(wcn_5ghz_rates),
+ .ht_cap = {
+ .cap = IEEE80211_HT_CAP_GRN_FLD |
+ IEEE80211_HT_CAP_SGI_20 |
+ IEEE80211_HT_CAP_DSSSCCK40 |
+ IEEE80211_HT_CAP_LSIG_TXOP_PROT |
+ IEEE80211_HT_CAP_SGI_40 |
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40,
+ .ht_supported = true,
+ .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K,
+ .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16,
+ .mcs = {
+ .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
+ .rx_highest = cpu_to_le16(72),
+ .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
+ }
+ }
+};
+
+#ifdef CONFIG_PM
+
+static const struct wiphy_wowlan_support wowlan_support = {
+ .flags = WIPHY_WOWLAN_ANY
+};
+
+#endif
+
+static inline u8 get_sta_index(struct ieee80211_vif *vif,
+ struct wcn36xx_sta *sta_priv)
+{
+ return NL80211_IFTYPE_STATION == vif->type ?
+ sta_priv->bss_sta_index :
+ sta_priv->sta_index;
+}
+
+static int wcn36xx_start(struct ieee80211_hw *hw)
+{
+ struct wcn36xx *wcn = hw->priv;
+ int ret;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac start\n");
+
+ /* SMD initialization */
+ ret = wcn36xx_smd_open(wcn);
+ if (ret) {
+ wcn36xx_err("Failed to open smd channel: %d\n", ret);
+ goto out_err;
+ }
+
+ /* Allocate memory pools for Mgmt BD headers and Data BD headers */
+ ret = wcn36xx_dxe_allocate_mem_pools(wcn);
+ if (ret) {
+ wcn36xx_err("Failed to alloc DXE mempool: %d\n", ret);
+ goto out_smd_close;
+ }
+
+ ret = wcn36xx_dxe_alloc_ctl_blks(wcn);
+ if (ret) {
+ wcn36xx_err("Failed to alloc DXE ctl blocks: %d\n", ret);
+ goto out_free_dxe_pool;
+ }
+
+ wcn->hal_buf = kmalloc(WCN36XX_HAL_BUF_SIZE, GFP_KERNEL);
+ if (!wcn->hal_buf) {
+ wcn36xx_err("Failed to allocate smd buf\n");
+ ret = -ENOMEM;
+ goto out_free_dxe_ctl;
+ }
+
+ ret = wcn36xx_smd_load_nv(wcn);
+ if (ret) {
+ wcn36xx_err("Failed to push NV to chip\n");
+ goto out_free_smd_buf;
+ }
+
+ ret = wcn36xx_smd_start(wcn);
+ if (ret) {
+ wcn36xx_err("Failed to start chip\n");
+ goto out_free_smd_buf;
+ }
+
+ /* DMA channel initialization */
+ ret = wcn36xx_dxe_init(wcn);
+ if (ret) {
+ wcn36xx_err("DXE init failed\n");
+ goto out_smd_stop;
+ }
+
+ wcn36xx_debugfs_init(wcn);
+
+ if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
+ ret = wcn36xx_smd_feature_caps_exchange(wcn);
+ if (ret)
+ wcn36xx_warn("Exchange feature caps failed\n");
+ }
+ INIT_LIST_HEAD(&wcn->vif_list);
+ return 0;
+
+out_smd_stop:
+ wcn36xx_smd_stop(wcn);
+out_free_smd_buf:
+ kfree(wcn->hal_buf);
+out_free_dxe_pool:
+ wcn36xx_dxe_free_mem_pools(wcn);
+out_free_dxe_ctl:
+ wcn36xx_dxe_free_ctl_blks(wcn);
+out_smd_close:
+ wcn36xx_smd_close(wcn);
+out_err:
+ return ret;
+}
+
+static void wcn36xx_stop(struct ieee80211_hw *hw)
+{
+ struct wcn36xx *wcn = hw->priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac stop\n");
+
+ wcn36xx_debugfs_exit(wcn);
+ wcn36xx_smd_stop(wcn);
+ wcn36xx_dxe_deinit(wcn);
+ wcn36xx_smd_close(wcn);
+
+ wcn36xx_dxe_free_mem_pools(wcn);
+ wcn36xx_dxe_free_ctl_blks(wcn);
+
+ kfree(wcn->hal_buf);
+}
+
+static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct ieee80211_vif *vif = NULL;
+ struct wcn36xx_vif *tmp;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed);
+
+ if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+ int ch = WCN36XX_HW_CHANNEL(wcn);
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
+ ch);
+ list_for_each_entry(tmp, &wcn->vif_list, list) {
+ vif = container_of((void *)tmp,
+ struct ieee80211_vif,
+ drv_priv);
+ wcn36xx_smd_switch_channel(wcn, vif, ch);
+ }
+ }
+
+ return 0;
+}
+
+#define WCN36XX_SUPPORTED_FILTERS (0)
+
+static void wcn36xx_configure_filter(struct ieee80211_hw *hw,
+ unsigned int changed,
+ unsigned int *total, u64 multicast)
+{
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac configure filter\n");
+
+ *total &= WCN36XX_SUPPORTED_FILTERS;
+}
+
+static void wcn36xx_tx(struct ieee80211_hw *hw,
+ struct ieee80211_tx_control *control,
+ struct sk_buff *skb)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_sta *sta_priv = NULL;
+
+ if (control->sta)
+ sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv;
+
+ if (wcn36xx_start_tx(wcn, sta_priv, skb))
+ ieee80211_free_txskb(wcn->hw, skb);
+}
+
+static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct ieee80211_key_conf *key_conf)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ struct wcn36xx_sta *sta_priv = vif_priv->sta;
+ int ret = 0;
+ u8 key[WLAN_MAX_KEY_LEN];
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 set key\n");
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "Key: cmd=0x%x algo:0x%x, id:%d, len:%d flags 0x%x\n",
+ cmd, key_conf->cipher, key_conf->keyidx,
+ key_conf->keylen, key_conf->flags);
+ wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "KEY: ",
+ key_conf->key,
+ key_conf->keylen);
+
+ switch (key_conf->cipher) {
+ case WLAN_CIPHER_SUITE_WEP40:
+ vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
+ break;
+ case WLAN_CIPHER_SUITE_WEP104:
+ vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
+ break;
+ case WLAN_CIPHER_SUITE_CCMP:
+ vif_priv->encrypt_type = WCN36XX_HAL_ED_CCMP;
+ break;
+ case WLAN_CIPHER_SUITE_TKIP:
+ vif_priv->encrypt_type = WCN36XX_HAL_ED_TKIP;
+ break;
+ default:
+ wcn36xx_err("Unsupported key type 0x%x\n",
+ key_conf->cipher);
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
+ switch (cmd) {
+ case SET_KEY:
+ if (WCN36XX_HAL_ED_TKIP == vif_priv->encrypt_type) {
+ /*
+ * Supplicant is sending key in the wrong order:
+ * Temporal Key (16 b) - TX MIC (8 b) - RX MIC (8 b)
+ * but HW expects it to be in the order as described in
+ * IEEE 802.11 spec (see chapter 11.7) like this:
+ * Temporal Key (16 b) - RX MIC (8 b) - TX MIC (8 b)
+ */
+ memcpy(key, key_conf->key, 16);
+ memcpy(key + 16, key_conf->key + 24, 8);
+ memcpy(key + 24, key_conf->key + 16, 8);
+ } else {
+ memcpy(key, key_conf->key, key_conf->keylen);
+ }
+
+ if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
+ sta_priv->is_data_encrypted = true;
+ /* Reconfigure bss with encrypt_type */
+ if (NL80211_IFTYPE_STATION == vif->type)
+ wcn36xx_smd_config_bss(wcn,
+ vif,
+ sta,
+ sta->addr,
+ true);
+
+ wcn36xx_smd_set_stakey(wcn,
+ vif_priv->encrypt_type,
+ key_conf->keyidx,
+ key_conf->keylen,
+ key,
+ get_sta_index(vif, sta_priv));
+ } else {
+ wcn36xx_smd_set_bsskey(wcn,
+ vif_priv->encrypt_type,
+ key_conf->keyidx,
+ key_conf->keylen,
+ key);
+ if ((WLAN_CIPHER_SUITE_WEP40 == key_conf->cipher) ||
+ (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) {
+ sta_priv->is_data_encrypted = true;
+ wcn36xx_smd_set_stakey(wcn,
+ vif_priv->encrypt_type,
+ key_conf->keyidx,
+ key_conf->keylen,
+ key,
+ get_sta_index(vif, sta_priv));
+ }
+ }
+ break;
+ case DISABLE_KEY:
+ if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
+ wcn36xx_smd_remove_bsskey(wcn,
+ vif_priv->encrypt_type,
+ key_conf->keyidx);
+ } else {
+ sta_priv->is_data_encrypted = false;
+ /* do not remove key if disassociated */
+ if (sta_priv->aid)
+ wcn36xx_smd_remove_stakey(wcn,
+ vif_priv->encrypt_type,
+ key_conf->keyidx,
+ get_sta_index(vif, sta_priv));
+ }
+ break;
+ default:
+ wcn36xx_err("Unsupported key cmd 0x%x\n", cmd);
+ ret = -EOPNOTSUPP;
+ goto out;
+ break;
+ }
+
+out:
+ return ret;
+}
+
+static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw)
+{
+ struct wcn36xx *wcn = hw->priv;
+
+ wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN);
+ wcn36xx_smd_start_scan(wcn);
+}
+
+static void wcn36xx_sw_scan_complete(struct ieee80211_hw *hw)
+{
+ struct wcn36xx *wcn = hw->priv;
+
+ wcn36xx_smd_end_scan(wcn);
+ wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN);
+}
+
+static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
+ enum ieee80211_band band)
+{
+ int i, size;
+ u16 *rates_table;
+ struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+ u32 rates = sta->supp_rates[band];
+
+ memset(&sta_priv->supported_rates, 0,
+ sizeof(sta_priv->supported_rates));
+ sta_priv->supported_rates.op_rate_mode = STA_11n;
+
+ size = ARRAY_SIZE(sta_priv->supported_rates.dsss_rates);
+ rates_table = sta_priv->supported_rates.dsss_rates;
+ if (band == IEEE80211_BAND_2GHZ) {
+ for (i = 0; i < size; i++) {
+ if (rates & 0x01) {
+ rates_table[i] = wcn_2ghz_rates[i].hw_value;
+ rates = rates >> 1;
+ }
+ }
+ }
+
+ size = ARRAY_SIZE(sta_priv->supported_rates.ofdm_rates);
+ rates_table = sta_priv->supported_rates.ofdm_rates;
+ for (i = 0; i < size; i++) {
+ if (rates & 0x01) {
+ rates_table[i] = wcn_5ghz_rates[i].hw_value;
+ rates = rates >> 1;
+ }
+ }
+
+ if (sta->ht_cap.ht_supported) {
+ BUILD_BUG_ON(sizeof(sta->ht_cap.mcs.rx_mask) >
+ sizeof(sta_priv->supported_rates.supported_mcs_set));
+ memcpy(sta_priv->supported_rates.supported_mcs_set,
+ sta->ht_cap.mcs.rx_mask,
+ sizeof(sta->ht_cap.mcs.rx_mask));
+ }
+}
+void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates)
+{
+ u16 ofdm_rates[WCN36XX_HAL_NUM_OFDM_RATES] = {
+ HW_RATE_INDEX_6MBPS,
+ HW_RATE_INDEX_9MBPS,
+ HW_RATE_INDEX_12MBPS,
+ HW_RATE_INDEX_18MBPS,
+ HW_RATE_INDEX_24MBPS,
+ HW_RATE_INDEX_36MBPS,
+ HW_RATE_INDEX_48MBPS,
+ HW_RATE_INDEX_54MBPS
+ };
+ u16 dsss_rates[WCN36XX_HAL_NUM_DSSS_RATES] = {
+ HW_RATE_INDEX_1MBPS,
+ HW_RATE_INDEX_2MBPS,
+ HW_RATE_INDEX_5_5MBPS,
+ HW_RATE_INDEX_11MBPS
+ };
+
+ rates->op_rate_mode = STA_11n;
+ memcpy(rates->dsss_rates, dsss_rates,
+ sizeof(*dsss_rates) * WCN36XX_HAL_NUM_DSSS_RATES);
+ memcpy(rates->ofdm_rates, ofdm_rates,
+ sizeof(*ofdm_rates) * WCN36XX_HAL_NUM_OFDM_RATES);
+ rates->supported_mcs_set[0] = 0xFF;
+}
+static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *bss_conf,
+ u32 changed)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct sk_buff *skb = NULL;
+ u16 tim_off, tim_len;
+ enum wcn36xx_hal_link_state link_state;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 0x%08x\n",
+ vif, changed);
+
+ if (changed & BSS_CHANGED_BEACON_INFO) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "mac bss changed dtim period %d\n",
+ bss_conf->dtim_period);
+
+ vif_priv->dtim_period = bss_conf->dtim_period;
+ }
+
+ if (changed & BSS_CHANGED_PS) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "mac bss PS set %d\n",
+ bss_conf->ps);
+ if (bss_conf->ps) {
+ wcn36xx_pmc_enter_bmps_state(wcn, vif);
+ } else {
+ wcn36xx_pmc_exit_bmps_state(wcn, vif);
+ }
+ }
+
+ if (changed & BSS_CHANGED_BSSID) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n",
+ bss_conf->bssid);
+
+ if (!is_zero_ether_addr(bss_conf->bssid)) {
+ vif_priv->is_joining = true;
+ vif_priv->bss_index = 0xff;
+ wcn36xx_smd_join(wcn, bss_conf->bssid,
+ vif->addr, WCN36XX_HW_CHANNEL(wcn));
+ wcn36xx_smd_config_bss(wcn, vif, NULL,
+ bss_conf->bssid, false);
+ } else {
+ vif_priv->is_joining = false;
+ wcn36xx_smd_delete_bss(wcn, vif);
+ }
+ }
+
+ if (changed & BSS_CHANGED_SSID) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "mac bss changed ssid\n");
+ wcn36xx_dbg_dump(WCN36XX_DBG_MAC, "ssid ",
+ bss_conf->ssid, bss_conf->ssid_len);
+
+ vif_priv->ssid.length = bss_conf->ssid_len;
+ memcpy(&vif_priv->ssid.ssid,
+ bss_conf->ssid,
+ bss_conf->ssid_len);
+ }
+
+ if (changed & BSS_CHANGED_ASSOC) {
+ vif_priv->is_joining = false;
+ if (bss_conf->assoc) {
+ struct ieee80211_sta *sta;
+ struct wcn36xx_sta *sta_priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "mac assoc bss %pM vif %pM AID=%d\n",
+ bss_conf->bssid,
+ vif->addr,
+ bss_conf->aid);
+
+ rcu_read_lock();
+ sta = ieee80211_find_sta(vif, bss_conf->bssid);
+ if (!sta) {
+ wcn36xx_err("sta %pM is not found\n",
+ bss_conf->bssid);
+ rcu_read_unlock();
+ goto out;
+ }
+ sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+
+ wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
+
+ wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
+ vif->addr,
+ WCN36XX_HAL_LINK_POSTASSOC_STATE);
+ wcn36xx_smd_config_bss(wcn, vif, sta,
+ bss_conf->bssid,
+ true);
+ sta_priv->aid = bss_conf->aid;
+ /*
+ * config_sta must be called from because this is the
+ * place where AID is available.
+ */
+ wcn36xx_smd_config_sta(wcn, vif, sta);
+ rcu_read_unlock();
+ } else {
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "disassociated bss %pM vif %pM AID=%d\n",
+ bss_conf->bssid,
+ vif->addr,
+ bss_conf->aid);
+ wcn36xx_smd_set_link_st(wcn,
+ bss_conf->bssid,
+ vif->addr,
+ WCN36XX_HAL_LINK_IDLE_STATE);
+ }
+ }
+
+ if (changed & BSS_CHANGED_AP_PROBE_RESP) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed ap probe resp\n");
+ skb = ieee80211_proberesp_get(hw, vif);
+ if (!skb) {
+ wcn36xx_err("failed to alloc probereq skb\n");
+ goto out;
+ }
+
+ wcn36xx_smd_update_proberesp_tmpl(wcn, vif, skb);
+ dev_kfree_skb(skb);
+ }
+
+ if (changed & BSS_CHANGED_BEACON_ENABLED) {
+ wcn36xx_dbg(WCN36XX_DBG_MAC,
+ "mac bss changed beacon enabled %d\n",
+ bss_conf->enable_beacon);
+
+ if (bss_conf->enable_beacon) {
+ vif_priv->bss_index = 0xff;
+ wcn36xx_smd_config_bss(wcn, vif, NULL,
+ vif->addr, false);
+ skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
+ &tim_len);
+ if (!skb) {
+ wcn36xx_err("failed to alloc beacon skb\n");
+ goto out;
+ }
+ wcn36xx_smd_send_beacon(wcn, vif, skb, tim_off, 0);
+ dev_kfree_skb(skb);
+
+ if (vif->type == NL80211_IFTYPE_ADHOC ||
+ vif->type == NL80211_IFTYPE_MESH_POINT)
+ link_state = WCN36XX_HAL_LINK_IBSS_STATE;
+ else
+ link_state = WCN36XX_HAL_LINK_AP_STATE;
+
+ wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
+ link_state);
+ } else {
+ wcn36xx_smd_set_link_st(wcn, vif->addr, vif->addr,
+ WCN36XX_HAL_LINK_IDLE_STATE);
+ wcn36xx_smd_delete_bss(wcn, vif);
+ }
+ }
+out:
+ return;
+}
+
+/* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
+static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+{
+ struct wcn36xx *wcn = hw->priv;
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value);
+
+ wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_RTS_THRESHOLD, value);
+ return 0;
+}
+
+static void wcn36xx_remove_interface(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac remove interface vif %p\n", vif);
+
+ list_del(&vif_priv->list);
+ wcn36xx_smd_delete_sta_self(wcn, vif->addr);
+}
+
+static int wcn36xx_add_interface(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d\n",
+ vif, vif->type);
+
+ if (!(NL80211_IFTYPE_STATION == vif->type ||
+ NL80211_IFTYPE_AP == vif->type ||
+ NL80211_IFTYPE_ADHOC == vif->type ||
+ NL80211_IFTYPE_MESH_POINT == vif->type)) {
+ wcn36xx_warn("Unsupported interface type requested: %d\n",
+ vif->type);
+ return -EOPNOTSUPP;
+ }
+
+ list_add(&vif_priv->list, &wcn->vif_list);
+ wcn36xx_smd_add_sta_self(wcn, vif);
+
+ return 0;
+}
+
+static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
+ vif, sta->addr);
+
+ vif_priv->sta = sta_priv;
+ sta_priv->vif = vif_priv;
+ /*
+ * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
+ * at this stage AID is not available yet.
+ */
+ if (NL80211_IFTYPE_STATION != vif->type) {
+ wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
+ sta_priv->aid = sta->aid;
+ wcn36xx_smd_config_sta(wcn, vif, sta);
+ }
+ return 0;
+}
+
+static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
+ vif, sta->addr, sta_priv->sta_index);
+
+ wcn36xx_smd_delete_sta(wcn, sta_priv->sta_index);
+ vif_priv->sta = NULL;
+ sta_priv->vif = NULL;
+ return 0;
+}
+
+#ifdef CONFIG_PM
+
+static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
+{
+ struct wcn36xx *wcn = hw->priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n");
+
+ flush_workqueue(wcn->hal_ind_wq);
+ wcn36xx_smd_set_power_params(wcn, true);
+ return 0;
+}
+
+static int wcn36xx_resume(struct ieee80211_hw *hw)
+{
+ struct wcn36xx *wcn = hw->priv;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n");
+
+ flush_workqueue(wcn->hal_ind_wq);
+ wcn36xx_smd_set_power_params(wcn, false);
+ return 0;
+}
+
+#endif
+
+static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ enum ieee80211_ampdu_mlme_action action,
+ struct ieee80211_sta *sta, u16 tid, u16 *ssn,
+ u8 buf_size)
+{
+ struct wcn36xx *wcn = hw->priv;
+ struct wcn36xx_sta *sta_priv = NULL;
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
+ action, tid);
+
+ sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+
+ switch (action) {
+ case IEEE80211_AMPDU_RX_START:
+ sta_priv->tid = tid;
+ wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 0,
+ get_sta_index(vif, sta_priv));
+ wcn36xx_smd_add_ba(wcn);
+ wcn36xx_smd_trigger_ba(wcn, get_sta_index(vif, sta_priv));
+ ieee80211_start_tx_ba_session(sta, tid, 0);
+ break;
+ case IEEE80211_AMPDU_RX_STOP:
+ wcn36xx_smd_del_ba(wcn, tid, get_sta_index(vif, sta_priv));
+ break;
+ case IEEE80211_AMPDU_TX_START:
+ ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ break;
+ case IEEE80211_AMPDU_TX_OPERATIONAL:
+ wcn36xx_smd_add_ba_session(wcn, sta, tid, ssn, 1,
+ get_sta_index(vif, sta_priv));
+ break;
+ case IEEE80211_AMPDU_TX_STOP_FLUSH:
+ case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
+ case IEEE80211_AMPDU_TX_STOP_CONT:
+ ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
+ break;
+ default:
+ wcn36xx_err("Unknown AMPDU action\n");
+ }
+
+ return 0;
+}
+
+static const struct ieee80211_ops wcn36xx_ops = {
+ .start = wcn36xx_start,
+ .stop = wcn36xx_stop,
+ .add_interface = wcn36xx_add_interface,
+ .remove_interface = wcn36xx_remove_interface,
+#ifdef CONFIG_PM
+ .suspend = wcn36xx_suspend,
+ .resume = wcn36xx_resume,
+#endif
+ .config = wcn36xx_config,
+ .configure_filter = wcn36xx_configure_filter,
+ .tx = wcn36xx_tx,
+ .set_key = wcn36xx_set_key,
+ .sw_scan_start = wcn36xx_sw_scan_start,
+ .sw_scan_complete = wcn36xx_sw_scan_complete,
+ .bss_info_changed = wcn36xx_bss_info_changed,
+ .set_rts_threshold = wcn36xx_set_rts_threshold,
+ .sta_add = wcn36xx_sta_add,
+ .sta_remove = wcn36xx_sta_remove,
+ .ampdu_action = wcn36xx_ampdu_action,
+};
+
+static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
+{
+ int ret = 0;
+
+ static const u32 cipher_suites[] = {
+ WLAN_CIPHER_SUITE_WEP40,
+ WLAN_CIPHER_SUITE_WEP104,
+ WLAN_CIPHER_SUITE_TKIP,
+ WLAN_CIPHER_SUITE_CCMP,
+ };
+
+ wcn->hw->flags = IEEE80211_HW_SIGNAL_DBM |
+ IEEE80211_HW_HAS_RATE_CONTROL |
+ IEEE80211_HW_SUPPORTS_PS |
+ IEEE80211_HW_CONNECTION_MONITOR |
+ IEEE80211_HW_AMPDU_AGGREGATION |
+ IEEE80211_HW_TIMING_BEACON_ONLY;
+
+ wcn->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
+ BIT(NL80211_IFTYPE_AP) |
+ BIT(NL80211_IFTYPE_ADHOC) |
+ BIT(NL80211_IFTYPE_MESH_POINT);
+
+ wcn->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wcn_band_2ghz;
+ wcn->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wcn_band_5ghz;
+
+ wcn->hw->wiphy->cipher_suites = cipher_suites;
+ wcn->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
+
+ wcn->hw->wiphy->flags |= WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
+
+#ifdef CONFIG_PM
+ wcn->hw->wiphy->wowlan = &wowlan_support;
+#endif
+
+ wcn->hw->max_listen_interval = 200;
+
+ wcn->hw->queues = 4;
+
+ SET_IEEE80211_DEV(wcn->hw, wcn->dev);
+
+ wcn->hw->sta_data_size = sizeof(struct wcn36xx_sta);
+ wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
+
+ return ret;
+}
+
+static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
+ struct platform_device *pdev)
+{
+ struct resource *res;
+ /* Set TX IRQ */
+ res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+ "wcnss_wlantx_irq");
+ if (!res) {
+ wcn36xx_err("failed to get tx_irq\n");
+ return -ENOENT;
+ }
+ wcn->tx_irq = res->start;
+
+ /* Set RX IRQ */
+ res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
+ "wcnss_wlanrx_irq");
+ if (!res) {
+ wcn36xx_err("failed to get rx_irq\n");
+ return -ENOENT;
+ }
+ wcn->rx_irq = res->start;
+
+ /* Map the memory */
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+ "wcnss_mmio");
+ if (!res) {
+ wcn36xx_err("failed to get mmio\n");
+ return -ENOENT;
+ }
+ wcn->mmio = ioremap(res->start, resource_size(res));
+ if (!wcn->mmio) {
+ wcn36xx_err("failed to map io memory\n");
+ return -ENOMEM;
+ }
+ return 0;
+}
+
+static int wcn36xx_probe(struct platform_device *pdev)
+{
+ struct ieee80211_hw *hw;
+ struct wcn36xx *wcn;
+ int ret;
+ u8 addr[ETH_ALEN];
+
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "platform probe\n");
+
+ hw = ieee80211_alloc_hw(sizeof(struct wcn36xx), &wcn36xx_ops);
+ if (!hw) {
+ wcn36xx_err("failed to alloc hw\n");
+ ret = -ENOMEM;
+ goto out_err;
+ }
+ platform_set_drvdata(pdev, hw);
+ wcn = hw->priv;
+ wcn->hw = hw;
+ wcn->dev = &pdev->dev;
+ wcn->ctrl_ops = pdev->dev.platform_data;
+
+ mutex_init(&wcn->hal_mutex);
+
+ if (!wcn->ctrl_ops->get_hw_mac(addr)) {
+ wcn36xx_info("mac address: %pM\n", addr);
+ SET_IEEE80211_PERM_ADDR(wcn->hw, addr);
+ }
+
+ ret = wcn36xx_platform_get_resources(wcn, pdev);
+ if (ret)
+ goto out_wq;
+
+ wcn36xx_init_ieee80211(wcn);
+ ret = ieee80211_register_hw(wcn->hw);
+ if (ret)
+ goto out_unmap;
+
+ return 0;
+
+out_unmap:
+ iounmap(wcn->mmio);
+out_wq:
+ ieee80211_free_hw(hw);
+out_err:
+ return ret;
+}
+static int wcn36xx_remove(struct platform_device *pdev)
+{
+ struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+ struct wcn36xx *wcn = hw->priv;
+ wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");
+
+ mutex_destroy(&wcn->hal_mutex);
+
+ ieee80211_unregister_hw(hw);
+ iounmap(wcn->mmio);
+ ieee80211_free_hw(hw);
+
+ return 0;
+}
+static const struct platform_device_id wcn36xx_platform_id_table[] = {
+ {
+ .name = "wcn36xx",
+ .driver_data = 0
+ },
+ {}
+};
+MODULE_DEVICE_TABLE(platform, wcn36xx_platform_id_table);
+
+static struct platform_driver wcn36xx_driver = {
+ .probe = wcn36xx_probe,
+ .remove = wcn36xx_remove,
+ .driver = {
+ .name = "wcn36xx",
+ .owner = THIS_MODULE,
+ },
+ .id_table = wcn36xx_platform_id_table,
+};
+
+static int __init wcn36xx_init(void)
+{
+ platform_driver_register(&wcn36xx_driver);
+ return 0;
+}
+module_init(wcn36xx_init);
+
+static void __exit wcn36xx_exit(void)
+{
+ platform_driver_unregister(&wcn36xx_driver);
+}
+module_exit(wcn36xx_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Eugene Krasnikov k.eugene.e@gmail.com");
+MODULE_FIRMWARE(WLAN_NV_FILE);
diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c
new file mode 100644
index 0000000..28b515c
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/pmc.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include "wcn36xx.h"
+
+int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif)
+{
+ int ret = 0;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ /* TODO: Make sure the TX chain clean */
+ ret = wcn36xx_smd_enter_bmps(wcn, vif);
+ if (!ret) {
+ wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
+ vif_priv->pw_state = WCN36XX_BMPS;
+ } else {
+ /*
+ * One of the reasons why HW will not enter BMPS is because
+ * driver is trying to enter bmps before first beacon was
+ * received just after auth complete
+ */
+ wcn36xx_err("Can not enter BMPS!\n");
+ }
+ return ret;
+}
+
+int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif)
+{
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+
+ if (WCN36XX_BMPS != vif_priv->pw_state) {
+ wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n");
+ return -EINVAL;
+ }
+ wcn36xx_smd_exit_bmps(wcn, vif);
+ vif_priv->pw_state = WCN36XX_FULL_POWER;
+ return 0;
+}
+
+int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif)
+{
+ wcn36xx_dbg(WCN36XX_DBG_PMC, "%s\n", __func__);
+ return wcn36xx_smd_keep_alive_req(wcn, vif,
+ WCN36XX_HAL_KEEP_ALIVE_NULL_PKT);
+}
diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.h b/drivers/net/wireless/ath/wcn36xx/pmc.h
new file mode 100644
index 0000000..f72ed68
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/pmc.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WCN36XX_PMC_H_
+#define _WCN36XX_PMC_H_
+
+struct wcn36xx;
+
+enum wcn36xx_power_state {
+ WCN36XX_FULL_POWER,
+ WCN36XX_BMPS
+};
+
+int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif);
+int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif);
+int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif);
+#endif /* _WCN36XX_PMC_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
new file mode 100644
index 0000000..f8c3a10
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -0,0 +1,2126 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/etherdevice.h>
+#include <linux/firmware.h>
+#include <linux/bitops.h>
+#include "smd.h"
+
+static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value)
+{
+ struct wcn36xx_hal_cfg *entry;
+ u32 *val;
+
+ if (*len + sizeof(*entry) + sizeof(u32) >= WCN36XX_HAL_BUF_SIZE) {
+ wcn36xx_err("Not enough room for TLV entry\n");
+ return -ENOMEM;
+ }
+
+ entry = (struct wcn36xx_hal_cfg *) (wcn->hal_buf + *len);
+ entry->id = id;
+ entry->len = sizeof(u32);
+ entry->pad_bytes = 0;
+ entry->reserve = 0;
+
+ val = (u32 *) (entry + 1);
+ *val = value;
+
+ *len += sizeof(*entry) + sizeof(u32);
+
+ return 0;
+}
+
+static void wcn36xx_smd_set_bss_nw_type(struct wcn36xx *wcn,
+ struct ieee80211_sta *sta,
+ struct wcn36xx_hal_config_bss_params *bss_params)
+{
+ if (IEEE80211_BAND_5GHZ == WCN36XX_BAND(wcn))
+ bss_params->nw_type = WCN36XX_HAL_11A_NW_TYPE;
+ else if (sta && sta->ht_cap.ht_supported)
+ bss_params->nw_type = WCN36XX_HAL_11N_NW_TYPE;
+ else if (sta && (sta->supp_rates[IEEE80211_BAND_2GHZ] & 0x7f))
+ bss_params->nw_type = WCN36XX_HAL_11G_NW_TYPE;
+ else
+ bss_params->nw_type = WCN36XX_HAL_11B_NW_TYPE;
+}
+
+static inline u8 is_cap_supported(unsigned long caps, unsigned long flag)
+{
+ return caps & flag ? 1 : 0;
+}
+static void wcn36xx_smd_set_bss_ht_params(struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct wcn36xx_hal_config_bss_params *bss_params)
+{
+ if (sta && sta->ht_cap.ht_supported) {
+ unsigned long caps = sta->ht_cap.cap;
+ bss_params->ht = sta->ht_cap.ht_supported;
+ bss_params->tx_channel_width_set = is_cap_supported(caps,
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40);
+ bss_params->lsig_tx_op_protection_full_support =
+ is_cap_supported(caps,
+ IEEE80211_HT_CAP_LSIG_TXOP_PROT);
+
+ bss_params->ht_oper_mode = vif->bss_conf.ht_operation_mode;
+ bss_params->lln_non_gf_coexist =
+ !!(vif->bss_conf.ht_operation_mode &
+ IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
+ /* IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT */
+ bss_params->dual_cts_protection = 0;
+ /* IEEE80211_HT_OP_MODE_PROTECTION_20MHZ */
+ bss_params->ht20_coexist = 0;
+ }
+}
+
+static void wcn36xx_smd_set_sta_ht_params(struct ieee80211_sta *sta,
+ struct wcn36xx_hal_config_sta_params *sta_params)
+{
+ if (sta->ht_cap.ht_supported) {
+ unsigned long caps = sta->ht_cap.cap;
+ sta_params->ht_capable = sta->ht_cap.ht_supported;
+ sta_params->tx_channel_width_set = is_cap_supported(caps,
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40);
+ sta_params->lsig_txop_protection = is_cap_supported(caps,
+ IEEE80211_HT_CAP_LSIG_TXOP_PROT);
+
+ sta_params->max_ampdu_size = sta->ht_cap.ampdu_factor;
+ sta_params->max_ampdu_density = sta->ht_cap.ampdu_density;
+ sta_params->max_amsdu_size = is_cap_supported(caps,
+ IEEE80211_HT_CAP_MAX_AMSDU);
+ sta_params->sgi_20Mhz = is_cap_supported(caps,
+ IEEE80211_HT_CAP_SGI_20);
+ sta_params->sgi_40mhz = is_cap_supported(caps,
+ IEEE80211_HT_CAP_SGI_40);
+ sta_params->green_field_capable = is_cap_supported(caps,
+ IEEE80211_HT_CAP_GRN_FLD);
+ sta_params->delayed_ba_support = is_cap_supported(caps,
+ IEEE80211_HT_CAP_DELAY_BA);
+ sta_params->dsss_cck_mode_40mhz = is_cap_supported(caps,
+ IEEE80211_HT_CAP_DSSSCCK40);
+ }
+}
+
+static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ struct wcn36xx_hal_config_sta_params *sta_params)
+{
+ struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
+ struct wcn36xx_sta *priv_sta = NULL;
+ if (vif->type == NL80211_IFTYPE_ADHOC ||
+ vif->type == NL80211_IFTYPE_AP ||
+ vif->type == NL80211_IFTYPE_MESH_POINT) {
+ sta_params->type = 1;
+ sta_params->sta_index = 0xFF;
+ } else {
+ sta_params->type = 0;
+ sta_params->sta_index = 1;
+ }
+
+ sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
+
+ /*
+ * In STA mode ieee80211_sta contains bssid and ieee80211_vif
+ * contains our mac address. In AP mode we are bssid so vif
+ * contains bssid and ieee80211_sta contains mac.
+ */
+ if (NL80211_IFTYPE_STATION == vif->type)
+ memcpy(&sta_params->mac, vif->addr, ETH_ALEN);
+ else
+ memcpy(&sta_params->bssid, vif->addr, ETH_ALEN);
+
+ sta_params->encrypt_type = priv_vif->encrypt_type;
+ sta_params->short_preamble_supported =
+ !(WCN36XX_FLAGS(wcn) &
+ IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE);
+
+ sta_params->rifs_mode = 0;
+ sta_params->rmf = 0;
+ sta_params->action = 0;
+ sta_params->uapsd = 0;
+ sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
+ sta_params->max_ampdu_duration = 0;
+ sta_params->bssid_index = priv_vif->bss_index;
+ sta_params->p2p = 0;
+
+ if (sta) {
+ priv_sta = (struct wcn36xx_sta *)sta->drv_priv;
+ if (NL80211_IFTYPE_STATION == vif->type)
+ memcpy(&sta_params->bssid, sta->addr, ETH_ALEN);
+ else
+ memcpy(&sta_params->mac, sta->addr, ETH_ALEN);
+ sta_params->wmm_enabled = sta->wme;
+ sta_params->max_sp_len = sta->max_sp;
+ sta_params->aid = priv_sta->aid;
+ wcn36xx_smd_set_sta_ht_params(sta, sta_params);
+ memcpy(&sta_params->supported_rates, &priv_sta->supported_rates,
+ sizeof(priv_sta->supported_rates));
+ } else {
+ wcn36xx_set_default_rates(&sta_params->supported_rates);
+ }
+}
+
+static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
+{
+ int ret = 0;
+ wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "HAL >>> ", wcn->hal_buf, len);
+
+ init_completion(&wcn->hal_rsp_compl);
+ ret = wcn->ctrl_ops->tx(wcn->hal_buf, len);
+ if (ret) {
+ wcn36xx_err("HAL TX failed\n");
+ goto out;
+ }
+ if (wait_for_completion_timeout(&wcn->hal_rsp_compl,
+ msecs_to_jiffies(HAL_MSG_TIMEOUT)) <= 0) {
+ wcn36xx_err("Timeout while waiting SMD response\n");
+ ret = -ETIME;
+ goto out;
+ }
+out:
+ return ret;
+}
+
+#define INIT_HAL_MSG(msg_body, type) \
+ do { \
+ memset(&msg_body, 0, sizeof(msg_body)); \
+ msg_body.header.msg_type = type; \
+ msg_body.header.msg_version = WCN36XX_HAL_MSG_VERSION0; \
+ msg_body.header.len = sizeof(msg_body); \
+ } while (0) \
+
+#define PREPARE_HAL_BUF(send_buf, msg_body) \
+ do { \
+ memset(send_buf, 0, msg_body.header.len); \
+ memcpy(send_buf, &msg_body, sizeof(msg_body)); \
+ } while (0) \
+
+static int wcn36xx_smd_rsp_status_check(void *buf, size_t len)
+{
+ struct wcn36xx_fw_msg_status_rsp *rsp;
+
+ if (len < sizeof(struct wcn36xx_hal_msg_header) +
+ sizeof(struct wcn36xx_fw_msg_status_rsp))
+ return -EIO;
+
+ rsp = (struct wcn36xx_fw_msg_status_rsp *)
+ (buf + sizeof(struct wcn36xx_hal_msg_header));
+
+ if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status)
+ return rsp->status;
+
+ return 0;
+}
+
+int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
+{
+ const struct firmware *nv;
+ struct nv_data *nv_d;
+ struct wcn36xx_hal_nv_img_download_req_msg msg_body;
+ int fw_bytes_left;
+ int ret;
+ u16 fm_offset = 0;
+
+ ret = request_firmware(&nv, WLAN_NV_FILE, wcn->dev);
+ if (ret) {
+ wcn36xx_err("Failed to load nv file %s: %d\n",
+ WLAN_NV_FILE, ret);
+ goto out_free_nv;
+ }
+
+ nv_d = (struct nv_data *)nv->data;
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DOWNLOAD_NV_REQ);
+
+ msg_body.header.len += WCN36XX_NV_FRAGMENT_SIZE;
+
+ msg_body.frag_number = 0;
+ /* hal_buf must be protected with mutex */
+ mutex_lock(&wcn->hal_mutex);
+
+ do {
+ fw_bytes_left = nv->size - fm_offset - 4;
+ if (fw_bytes_left > WCN36XX_NV_FRAGMENT_SIZE) {
+ msg_body.last_fragment = 0;
+ msg_body.nv_img_buffer_size = WCN36XX_NV_FRAGMENT_SIZE;
+ } else {
+ msg_body.last_fragment = 1;
+ msg_body.nv_img_buffer_size = fw_bytes_left;
+
+ /* Do not forget update general message len */
+ msg_body.header.len = sizeof(msg_body) + fw_bytes_left;
+
+ }
+
+ /* Add load NV request message header */
+ memcpy(wcn->hal_buf, &msg_body, sizeof(msg_body));
+
+ /* Add NV body itself */
+ memcpy(wcn->hal_buf + sizeof(msg_body),
+ &nv_d->table + fm_offset,
+ msg_body.nv_img_buffer_size);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret)
+ goto out_unlock;
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf,
+ wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_load_nv response failed err=%d\n",
+ ret);
+ goto out_unlock;
+ }
+ msg_body.frag_number++;
+ fm_offset += WCN36XX_NV_FRAGMENT_SIZE;
+
+ } while (msg_body.last_fragment != 1);
+
+out_unlock:
+ mutex_unlock(&wcn->hal_mutex);
+out_free_nv:
+ release_firmware(nv);
+
+ return ret;
+}
+
+static int wcn36xx_smd_start_rsp(struct wcn36xx *wcn, void *buf, size_t len)
+{
+ struct wcn36xx_hal_mac_start_rsp_msg *rsp;
+
+ if (len < sizeof(*rsp))
+ return -EIO;
+
+ rsp = (struct wcn36xx_hal_mac_start_rsp_msg *)buf;
+
+ if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->start_rsp_params.status)
+ return -EIO;
+
+ memcpy(wcn->crm_version, rsp->start_rsp_params.crm_version,
+ WCN36XX_HAL_VERSION_LENGTH);
+ memcpy(wcn->wlan_version, rsp->start_rsp_params.wlan_version,
+ WCN36XX_HAL_VERSION_LENGTH);
+
+ /* null terminate the strings, just in case */
+ wcn->crm_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
+ wcn->wlan_version[WCN36XX_HAL_VERSION_LENGTH] = '\0';
+
+ wcn->fw_revision = rsp->start_rsp_params.version.revision;
+ wcn->fw_version = rsp->start_rsp_params.version.version;
+ wcn->fw_minor = rsp->start_rsp_params.version.minor;
+ wcn->fw_major = rsp->start_rsp_params.version.major;
+
+ wcn36xx_info("firmware WLAN version '%s' and CRM version '%s'\n",
+ wcn->wlan_version, wcn->crm_version);
+
+ wcn36xx_info("firmware API %u.%u.%u.%u, %u stations, %u bssids\n",
+ wcn->fw_major, wcn->fw_minor,
+ wcn->fw_version, wcn->fw_revision,
+ rsp->start_rsp_params.stations,
+ rsp->start_rsp_params.bssids);
+
+ return 0;
+}
+
+int wcn36xx_smd_start(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_mac_start_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_REQ);
+
+ msg_body.params.type = DRIVER_TYPE_PRODUCTION;
+ msg_body.params.len = 0;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start type %d\n",
+ msg_body.params.type);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_start failed\n");
+ goto out;
+ }
+
+ ret = wcn36xx_smd_start_rsp(wcn, wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_start response failed err=%d\n", ret);
+ goto out;
+ }
+
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_stop(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_mac_stop_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_STOP_REQ);
+
+ msg_body.stop_req_params.reason = HAL_STOP_TYPE_RF_KILL;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_stop failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_stop response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode)
+{
+ struct wcn36xx_hal_init_scan_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_INIT_SCAN_REQ);
+
+ msg_body.mode = mode;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal init scan mode %d\n", msg_body.mode);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_init_scan failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_init_scan response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_start_scan(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_start_scan_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_START_SCAN_REQ);
+
+ msg_body.scan_channel = WCN36XX_HW_CHANNEL(wcn);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal start scan channel %d\n",
+ msg_body.scan_channel);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_start_scan failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_start_scan response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_end_scan(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_end_scan_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_END_SCAN_REQ);
+
+ msg_body.scan_channel = WCN36XX_HW_CHANNEL(wcn);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal end scan channel %d\n",
+ msg_body.scan_channel);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_end_scan failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_end_scan response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_finish_scan(struct wcn36xx *wcn,
+ enum wcn36xx_hal_sys_mode mode)
+{
+ struct wcn36xx_hal_finish_scan_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_FINISH_SCAN_REQ);
+
+ msg_body.mode = mode;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal finish scan mode %d\n",
+ msg_body.mode);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_finish_scan failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_finish_scan response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_switch_channel_rsp(void *buf, size_t len)
+{
+ struct wcn36xx_hal_switch_channel_rsp_msg *rsp;
+ int ret = 0;
+
+ ret = wcn36xx_smd_rsp_status_check(buf, len);
+ if (ret)
+ return ret;
+ rsp = (struct wcn36xx_hal_switch_channel_rsp_msg *)buf;
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "channel switched to: %d, status: %d\n",
+ rsp->channel_number, rsp->status);
+ return ret;
+}
+
+int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif, int ch)
+{
+ struct wcn36xx_hal_switch_channel_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_CH_SWITCH_REQ);
+
+ msg_body.channel_number = (u8)ch;
+ msg_body.tx_mgmt_power = 0xbf;
+ msg_body.max_tx_power = 0xbf;
+ memcpy(msg_body.self_sta_mac_addr, vif->addr, ETH_ALEN);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_switch_channel failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_switch_channel_rsp(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_switch_channel response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_update_scan_params_rsp(void *buf, size_t len)
+{
+ struct wcn36xx_hal_update_scan_params_resp *rsp;
+
+ rsp = (struct wcn36xx_hal_update_scan_params_resp *)buf;
+
+ /* Remove the PNO version bit */
+ rsp->status &= (~(WCN36XX_FW_MSG_PNO_VERSION_MASK));
+
+ if (WCN36XX_FW_MSG_RESULT_SUCCESS != rsp->status) {
+ wcn36xx_warn("error response from update scan\n");
+ return rsp->status;
+ }
+
+ return 0;
+}
+
+int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_update_scan_params_req msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_SCAN_PARAM_REQ);
+
+ msg_body.dot11d_enabled = 0;
+ msg_body.dot11d_resolved = 0;
+ msg_body.channel_count = 26;
+ msg_body.active_min_ch_time = 60;
+ msg_body.active_max_ch_time = 120;
+ msg_body.passive_min_ch_time = 60;
+ msg_body.passive_max_ch_time = 110;
+ msg_body.state = 0;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal update scan params channel_count %d\n",
+ msg_body.channel_count);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_update_scan_params failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_update_scan_params_rsp(wcn->hal_buf,
+ wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_update_scan_params response failed err=%d\n",
+ ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
+ struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
+
+ if (len < sizeof(*rsp))
+ return -EINVAL;
+
+ rsp = (struct wcn36xx_hal_add_sta_self_rsp_msg *)buf;
+
+ if (rsp->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
+ wcn36xx_warn("hal add sta self failure: %d\n",
+ rsp->status);
+ return rsp->status;
+ }
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal add sta self status %d self_sta_index %d dpu_index %d\n",
+ rsp->status, rsp->self_sta_index, rsp->dpu_index);
+
+ priv_vif->self_sta_index = rsp->self_sta_index;
+ priv_vif->self_dpu_desc_index = rsp->dpu_index;
+
+ return 0;
+}
+
+int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif)
+{
+ struct wcn36xx_hal_add_sta_self_req msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_STA_SELF_REQ);
+
+ memcpy(&msg_body.self_addr, vif->addr, ETH_ALEN);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal add sta self self_addr %pM status %d\n",
+ msg_body.self_addr, msg_body.status);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_add_sta_self failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_add_sta_self_rsp(wcn,
+ vif,
+ wcn->hal_buf,
+ wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_add_sta_self response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr)
+{
+ struct wcn36xx_hal_del_sta_self_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DEL_STA_SELF_REQ);
+
+ memcpy(&msg_body.self_addr, addr, ETH_ALEN);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_delete_sta_self failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_delete_sta_self response failed err=%d\n",
+ ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index)
+{
+ struct wcn36xx_hal_delete_sta_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_STA_REQ);
+
+ msg_body.sta_index = sta_index;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal delete sta sta_index %d\n",
+ msg_body.sta_index);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_delete_sta failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_delete_sta response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_join_rsp(void *buf, size_t len)
+{
+ struct wcn36xx_hal_join_rsp_msg *rsp;
+
+ if (wcn36xx_smd_rsp_status_check(buf, len))
+ return -EIO;
+
+ rsp = (struct wcn36xx_hal_join_rsp_msg *)buf;
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal rsp join status %d tx_mgmt_power %d\n",
+ rsp->status, rsp->tx_mgmt_power);
+
+ return 0;
+}
+
+int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch)
+{
+ struct wcn36xx_hal_join_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_JOIN_REQ);
+
+ memcpy(&msg_body.bssid, bssid, ETH_ALEN);
+ memcpy(&msg_body.self_sta_mac_addr, vif, ETH_ALEN);
+ msg_body.channel = ch;
+
+ if (conf_is_ht40_minus(&wcn->hw->conf))
+ msg_body.secondary_channel_offset =
+ PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ else if (conf_is_ht40_plus(&wcn->hw->conf))
+ msg_body.secondary_channel_offset =
+ PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else
+ msg_body.secondary_channel_offset =
+ PHY_SINGLE_CHANNEL_CENTERED;
+
+ msg_body.link_state = WCN36XX_HAL_LINK_PREASSOC_STATE;
+
+ msg_body.max_tx_power = 0xbf;
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal join req bssid %pM self_sta_mac_addr %pM channel %d link_state %d\n",
+ msg_body.bssid, msg_body.self_sta_mac_addr,
+ msg_body.channel, msg_body.link_state);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_join failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_join_rsp(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_join response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac,
+ enum wcn36xx_hal_link_state state)
+{
+ struct wcn36xx_hal_set_link_state_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_LINK_ST_REQ);
+
+ memcpy(&msg_body.bssid, bssid, ETH_ALEN);
+ memcpy(&msg_body.self_mac_addr, sta_mac, ETH_ALEN);
+ msg_body.state = state;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal set link state bssid %pM self_mac_addr %pM state %d\n",
+ msg_body.bssid, msg_body.self_mac_addr, msg_body.state);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_set_link_st failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_set_link_st response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static void wcn36xx_smd_convert_sta_to_v1(struct wcn36xx *wcn,
+ const struct wcn36xx_hal_config_sta_params *orig,
+ struct wcn36xx_hal_config_sta_params_v1 *v1)
+{
+ /* convert orig to v1 format */
+ memcpy(&v1->bssid, orig->bssid, ETH_ALEN);
+ memcpy(&v1->mac, orig->mac, ETH_ALEN);
+ v1->aid = orig->aid;
+ v1->type = orig->type;
+ v1->listen_interval = orig->listen_interval;
+ v1->ht_capable = orig->ht_capable;
+
+ v1->max_ampdu_size = orig->max_ampdu_size;
+ v1->max_ampdu_density = orig->max_ampdu_density;
+ v1->sgi_40mhz = orig->sgi_40mhz;
+ v1->sgi_20Mhz = orig->sgi_20Mhz;
+
+ memcpy(&v1->supported_rates, &orig->supported_rates,
+ sizeof(orig->supported_rates));
+ v1->sta_index = orig->sta_index;
+}
+
+static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
+ struct ieee80211_sta *sta,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_config_sta_rsp_msg *rsp;
+ struct config_sta_rsp_params *params;
+ struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
+
+ if (len < sizeof(*rsp))
+ return -EINVAL;
+
+ rsp = (struct wcn36xx_hal_config_sta_rsp_msg *)buf;
+ params = &rsp->params;
+
+ if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
+ wcn36xx_warn("hal config sta response failure: %d\n",
+ params->status);
+ return -EIO;
+ }
+
+ sta_priv->sta_index = params->sta_index;
+ sta_priv->dpu_desc_index = params->dpu_index;
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config sta rsp status %d sta_index %d bssid_index %d p2p %d\n",
+ params->status, params->sta_index, params->bssid_index,
+ params->p2p);
+
+ return 0;
+}
+
+static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
+ const struct wcn36xx_hal_config_sta_req_msg *orig)
+{
+ struct wcn36xx_hal_config_sta_req_msg_v1 msg_body;
+ struct wcn36xx_hal_config_sta_params_v1 *sta = &msg_body.sta_params;
+
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
+
+ wcn36xx_smd_convert_sta_to_v1(wcn, &orig->sta_params,
+ &msg_body.sta_params);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config sta v1 action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
+ sta->action, sta->sta_index, sta->bssid_index,
+ sta->bssid, sta->type, sta->mac, sta->aid);
+
+ return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
+
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+{
+ struct wcn36xx_hal_config_sta_req_msg msg;
+ struct wcn36xx_hal_config_sta_params *sta_params;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_STA_REQ);
+
+ sta_params = &msg.sta_params;
+
+ wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
+
+ if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
+ ret = wcn36xx_smd_config_sta_v1(wcn, &msg);
+ } else {
+ PREPARE_HAL_BUF(wcn->hal_buf, msg);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
+ sta_params->action, sta_params->sta_index,
+ sta_params->bssid_index, sta_params->bssid,
+ sta_params->type, sta_params->mac, sta_params->aid);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
+ }
+ if (ret) {
+ wcn36xx_err("Sending hal_config_sta failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_config_sta_rsp(wcn,
+ sta,
+ wcn->hal_buf,
+ wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_config_sta response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
+ const struct wcn36xx_hal_config_bss_req_msg *orig)
+{
+ struct wcn36xx_hal_config_bss_req_msg_v1 msg_body;
+ struct wcn36xx_hal_config_bss_params_v1 *bss = &msg_body.bss_params;
+ struct wcn36xx_hal_config_sta_params_v1 *sta = &bss->sta;
+
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_BSS_REQ);
+
+ /* convert orig to v1 */
+ memcpy(&msg_body.bss_params.bssid,
+ &orig->bss_params.bssid, ETH_ALEN);
+ memcpy(&msg_body.bss_params.self_mac_addr,
+ &orig->bss_params.self_mac_addr, ETH_ALEN);
+
+ msg_body.bss_params.bss_type = orig->bss_params.bss_type;
+ msg_body.bss_params.oper_mode = orig->bss_params.oper_mode;
+ msg_body.bss_params.nw_type = orig->bss_params.nw_type;
+
+ msg_body.bss_params.short_slot_time_supported =
+ orig->bss_params.short_slot_time_supported;
+ msg_body.bss_params.lla_coexist = orig->bss_params.lla_coexist;
+ msg_body.bss_params.llb_coexist = orig->bss_params.llb_coexist;
+ msg_body.bss_params.llg_coexist = orig->bss_params.llg_coexist;
+ msg_body.bss_params.ht20_coexist = orig->bss_params.ht20_coexist;
+ msg_body.bss_params.lln_non_gf_coexist =
+ orig->bss_params.lln_non_gf_coexist;
+
+ msg_body.bss_params.lsig_tx_op_protection_full_support =
+ orig->bss_params.lsig_tx_op_protection_full_support;
+ msg_body.bss_params.rifs_mode = orig->bss_params.rifs_mode;
+ msg_body.bss_params.beacon_interval = orig->bss_params.beacon_interval;
+ msg_body.bss_params.dtim_period = orig->bss_params.dtim_period;
+ msg_body.bss_params.tx_channel_width_set =
+ orig->bss_params.tx_channel_width_set;
+ msg_body.bss_params.oper_channel = orig->bss_params.oper_channel;
+ msg_body.bss_params.ext_channel = orig->bss_params.ext_channel;
+
+ msg_body.bss_params.reserved = orig->bss_params.reserved;
+
+ memcpy(&msg_body.bss_params.ssid,
+ &orig->bss_params.ssid,
+ sizeof(orig->bss_params.ssid));
+
+ msg_body.bss_params.action = orig->bss_params.action;
+ msg_body.bss_params.rateset = orig->bss_params.rateset;
+ msg_body.bss_params.ht = orig->bss_params.ht;
+ msg_body.bss_params.obss_prot_enabled =
+ orig->bss_params.obss_prot_enabled;
+ msg_body.bss_params.rmf = orig->bss_params.rmf;
+ msg_body.bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode;
+ msg_body.bss_params.dual_cts_protection =
+ orig->bss_params.dual_cts_protection;
+
+ msg_body.bss_params.max_probe_resp_retry_limit =
+ orig->bss_params.max_probe_resp_retry_limit;
+ msg_body.bss_params.hidden_ssid = orig->bss_params.hidden_ssid;
+ msg_body.bss_params.proxy_probe_resp =
+ orig->bss_params.proxy_probe_resp;
+ msg_body.bss_params.edca_params_valid =
+ orig->bss_params.edca_params_valid;
+
+ memcpy(&msg_body.bss_params.acbe,
+ &orig->bss_params.acbe,
+ sizeof(orig->bss_params.acbe));
+ memcpy(&msg_body.bss_params.acbk,
+ &orig->bss_params.acbk,
+ sizeof(orig->bss_params.acbk));
+ memcpy(&msg_body.bss_params.acvi,
+ &orig->bss_params.acvi,
+ sizeof(orig->bss_params.acvi));
+ memcpy(&msg_body.bss_params.acvo,
+ &orig->bss_params.acvo,
+ sizeof(orig->bss_params.acvo));
+
+ msg_body.bss_params.ext_set_sta_key_param_valid =
+ orig->bss_params.ext_set_sta_key_param_valid;
+
+ memcpy(&msg_body.bss_params.ext_set_sta_key_param,
+ &orig->bss_params.ext_set_sta_key_param,
+ sizeof(orig->bss_params.acvo));
+
+ msg_body.bss_params.wcn36xx_hal_persona =
+ orig->bss_params.wcn36xx_hal_persona;
+ msg_body.bss_params.spectrum_mgt_enable =
+ orig->bss_params.spectrum_mgt_enable;
+ msg_body.bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power;
+ msg_body.bss_params.max_tx_power = orig->bss_params.max_tx_power;
+
+ wcn36xx_smd_convert_sta_to_v1(wcn, &orig->bss_params.sta,
+ &msg_body.bss_params.sta);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config bss v1 bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n",
+ bss->bssid, bss->self_mac_addr, bss->bss_type,
+ bss->oper_mode, bss->nw_type);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n",
+ sta->bssid, sta->action, sta->sta_index,
+ sta->bssid_index, sta->aid, sta->type, sta->mac);
+
+ return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
+
+
+static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_config_bss_rsp_msg *rsp;
+ struct wcn36xx_hal_config_bss_rsp_params *params;
+ struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
+
+ if (len < sizeof(*rsp))
+ return -EINVAL;
+
+ rsp = (struct wcn36xx_hal_config_bss_rsp_msg *)buf;
+ params = &rsp->bss_rsp_params;
+
+ if (params->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
+ wcn36xx_warn("hal config bss response failure: %d\n",
+ params->status);
+ return -EIO;
+ }
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config bss rsp status %d bss_idx %d dpu_desc_index %d"
+ " sta_idx %d self_idx %d bcast_idx %d mac %pM"
+ " power %d ucast_dpu_signature %d\n",
+ params->status, params->bss_index, params->dpu_desc_index,
+ params->bss_sta_index, params->bss_self_sta_index,
+ params->bss_bcast_sta_idx, params->mac,
+ params->tx_mgmt_power, params->ucast_dpu_signature);
+
+ priv_vif->bss_index = params->bss_index;
+
+ if (priv_vif->sta) {
+ priv_vif->sta->bss_sta_index = params->bss_sta_index;
+ priv_vif->sta->bss_dpu_desc_index = params->dpu_desc_index;
+ }
+
+ priv_vif->ucast_dpu_signature = params->ucast_dpu_signature;
+
+ return 0;
+}
+
+int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, const u8 *bssid,
+ bool update)
+{
+ struct wcn36xx_hal_config_bss_req_msg msg;
+ struct wcn36xx_hal_config_bss_params *bss;
+ struct wcn36xx_hal_config_sta_params *sta_params;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_BSS_REQ);
+
+ bss = &msg.bss_params;
+ sta_params = &bss->sta;
+
+ WARN_ON(is_zero_ether_addr(bssid));
+
+ memcpy(&bss->bssid, bssid, ETH_ALEN);
+
+ memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN);
+
+ if (vif->type == NL80211_IFTYPE_STATION) {
+ bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE;
+
+ /* STA */
+ bss->oper_mode = 1;
+ bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_MODE;
+ } else if (vif->type == NL80211_IFTYPE_AP) {
+ bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE;
+
+ /* AP */
+ bss->oper_mode = 0;
+ bss->wcn36xx_hal_persona = WCN36XX_HAL_STA_SAP_MODE;
+ } else if (vif->type == NL80211_IFTYPE_ADHOC ||
+ vif->type == NL80211_IFTYPE_MESH_POINT) {
+ bss->bss_type = WCN36XX_HAL_IBSS_MODE;
+
+ /* STA */
+ bss->oper_mode = 1;
+ } else {
+ wcn36xx_warn("Unknown type for bss config: %d\n", vif->type);
+ }
+
+ if (vif->type == NL80211_IFTYPE_STATION)
+ wcn36xx_smd_set_bss_nw_type(wcn, sta, bss);
+ else
+ bss->nw_type = WCN36XX_HAL_11N_NW_TYPE;
+
+ bss->short_slot_time_supported = vif->bss_conf.use_short_slot;
+ bss->lla_coexist = 0;
+ bss->llb_coexist = 0;
+ bss->llg_coexist = 0;
+ bss->rifs_mode = 0;
+ bss->beacon_interval = vif->bss_conf.beacon_int;
+ bss->dtim_period = vif_priv->dtim_period;
+
+ wcn36xx_smd_set_bss_ht_params(vif, sta, bss);
+
+ bss->oper_channel = WCN36XX_HW_CHANNEL(wcn);
+
+ if (conf_is_ht40_minus(&wcn->hw->conf))
+ bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_BELOW;
+ else if (conf_is_ht40_plus(&wcn->hw->conf))
+ bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
+ else
+ bss->ext_channel = IEEE80211_HT_PARAM_CHA_SEC_NONE;
+
+ bss->reserved = 0;
+ wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
+
+ /* wcn->ssid is only valid in AP and IBSS mode */
+ bss->ssid.length = vif_priv->ssid.length;
+ memcpy(bss->ssid.ssid, vif_priv->ssid.ssid, vif_priv->ssid.length);
+
+ bss->obss_prot_enabled = 0;
+ bss->rmf = 0;
+ bss->max_probe_resp_retry_limit = 0;
+ bss->hidden_ssid = vif->bss_conf.hidden_ssid;
+ bss->proxy_probe_resp = 0;
+ bss->edca_params_valid = 0;
+
+ /* FIXME: set acbe, acbk, acvi and acvo */
+
+ bss->ext_set_sta_key_param_valid = 0;
+
+ /* FIXME: set ext_set_sta_key_param */
+
+ bss->spectrum_mgt_enable = 0;
+ bss->tx_mgmt_power = 0;
+ bss->max_tx_power = WCN36XX_MAX_POWER(wcn);
+
+ bss->action = update;
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal config bss bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n",
+ bss->bssid, bss->self_mac_addr, bss->bss_type,
+ bss->oper_mode, bss->nw_type);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "- sta bssid %pM action %d sta_index %d bssid_index %d aid %d type %d mac %pM\n",
+ sta_params->bssid, sta_params->action,
+ sta_params->sta_index, sta_params->bssid_index,
+ sta_params->aid, sta_params->type,
+ sta_params->mac);
+
+ if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
+ ret = wcn36xx_smd_config_bss_v1(wcn, &msg);
+ } else {
+ PREPARE_HAL_BUF(wcn->hal_buf, msg);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
+ }
+ if (ret) {
+ wcn36xx_err("Sending hal_config_bss failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_config_bss_rsp(wcn,
+ vif,
+ wcn->hal_buf,
+ wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_config_bss response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif)
+{
+ struct wcn36xx_hal_delete_bss_req_msg msg_body;
+ struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_BSS_REQ);
+
+ msg_body.bss_index = priv_vif->bss_index;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal delete bss %d\n", msg_body.bss_index);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_delete_bss failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_delete_bss response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct sk_buff *skb_beacon, u16 tim_off,
+ u16 p2p_off)
+{
+ struct wcn36xx_hal_send_beacon_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
+
+ /* TODO need to find out why this is needed? */
+ msg_body.beacon_length = skb_beacon->len + 6;
+
+ if (BEACON_TEMPLATE_SIZE > msg_body.beacon_length) {
+ memcpy(&msg_body.beacon, &skb_beacon->len, sizeof(u32));
+ memcpy(&(msg_body.beacon[4]), skb_beacon->data,
+ skb_beacon->len);
+ } else {
+ wcn36xx_err("Beacon is to big: beacon size=%d\n",
+ msg_body.beacon_length);
+ return -ENOMEM;
+ }
+ memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
+
+ /* TODO need to find out why this is needed? */
+ msg_body.tim_ie_offset = tim_off+4;
+ msg_body.p2p_ie_offset = p2p_off;
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal send beacon beacon_length %d\n",
+ msg_body.beacon_length);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_send_beacon failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_send_beacon response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ struct sk_buff *skb)
+{
+ struct wcn36xx_hal_send_probe_resp_req_msg msg;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg, WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_REQ);
+
+ if (skb->len > BEACON_TEMPLATE_SIZE) {
+ wcn36xx_warn("probe response template is too big: %d\n",
+ skb->len);
+ return -E2BIG;
+ }
+
+ msg.probe_resp_template_len = skb->len;
+ memcpy(&msg.probe_resp_template, skb->data, skb->len);
+
+ memcpy(msg.bssid, vif->addr, ETH_ALEN);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg);
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "hal update probe rsp len %d bssid %pM\n",
+ msg.probe_resp_template_len, msg.bssid);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_update_proberesp_tmpl failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_update_proberesp_tmpl response failed err=%d\n",
+ ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 keylen,
+ u8 *key,
+ u8 sta_index)
+{
+ struct wcn36xx_hal_set_sta_key_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_STAKEY_REQ);
+
+ msg_body.set_sta_key_params.sta_index = sta_index;
+ msg_body.set_sta_key_params.enc_type = enc_type;
+
+ msg_body.set_sta_key_params.key[0].id = keyidx;
+ msg_body.set_sta_key_params.key[0].unicast = 1;
+ msg_body.set_sta_key_params.key[0].direction = WCN36XX_HAL_TX_RX;
+ msg_body.set_sta_key_params.key[0].pae_role = 0;
+ msg_body.set_sta_key_params.key[0].length = keylen;
+ memcpy(msg_body.set_sta_key_params.key[0].key, key, keylen);
+ msg_body.set_sta_key_params.single_tid_rc = 1;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_set_stakey failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_set_stakey response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 keylen,
+ u8 *key)
+{
+ struct wcn36xx_hal_set_bss_key_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_BSSKEY_REQ);
+ msg_body.bss_idx = 0;
+ msg_body.enc_type = enc_type;
+ msg_body.num_keys = 1;
+ msg_body.keys[0].id = keyidx;
+ msg_body.keys[0].unicast = 0;
+ msg_body.keys[0].direction = WCN36XX_HAL_RX_ONLY;
+ msg_body.keys[0].pae_role = 0;
+ msg_body.keys[0].length = keylen;
+ memcpy(msg_body.keys[0].key, key, keylen);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_set_bsskey failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_set_bsskey response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 sta_index)
+{
+ struct wcn36xx_hal_remove_sta_key_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_STAKEY_REQ);
+
+ msg_body.sta_idx = sta_index;
+ msg_body.enc_type = enc_type;
+ msg_body.key_id = keyidx;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_remove_stakey failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_remove_stakey response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx)
+{
+ struct wcn36xx_hal_remove_bss_key_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_BSSKEY_REQ);
+ msg_body.bss_idx = 0;
+ msg_body.enc_type = enc_type;
+ msg_body.key_id = keyidx;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_remove_bsskey failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_remove_bsskey response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
+{
+ struct wcn36xx_hal_enter_bmps_req_msg msg_body;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_ENTER_BMPS_REQ);
+
+ msg_body.bss_index = vif_priv->bss_index;
+ msg_body.tbtt = vif->bss_conf.sync_tsf;
+ msg_body.dtim_period = vif_priv->dtim_period;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_enter_bmps failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_enter_bmps response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif)
+{
+ struct wcn36xx_hal_enter_bmps_req_msg msg_body;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_EXIT_BMPS_REQ);
+
+ msg_body.bss_index = vif_priv->bss_index;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_exit_bmps failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_exit_bmps response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim)
+{
+ struct wcn36xx_hal_set_power_params_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_POWER_PARAMS_REQ);
+
+ /*
+ * When host is down ignore every second dtim
+ */
+ if (ignore_dtim) {
+ msg_body.ignore_dtim = 1;
+ msg_body.dtim_period = 2;
+ }
+ msg_body.listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_set_power_params failed\n");
+ goto out;
+ }
+
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+/* Notice: This function should be called after associated, or else it
+ * will be invalid
+ */
+int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ int packet_type)
+{
+ struct wcn36xx_hal_keep_alive_req_msg msg_body;
+ struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_KEEP_ALIVE_REQ);
+
+ if (packet_type == WCN36XX_HAL_KEEP_ALIVE_NULL_PKT) {
+ msg_body.bss_index = vif_priv->bss_index;
+ msg_body.packet_type = WCN36XX_HAL_KEEP_ALIVE_NULL_PKT;
+ msg_body.time_period = WCN36XX_KEEP_ALIVE_TIME_PERIOD;
+ } else if (packet_type == WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP) {
+ /* TODO: it also support ARP response type */
+ } else {
+ wcn36xx_warn("unknow keep alive packet type %d\n", packet_type);
+ return -EINVAL;
+ }
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_exit_bmps failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_exit_bmps response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
+ u32 arg3, u32 arg4, u32 arg5)
+{
+ struct wcn36xx_hal_dump_cmd_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DUMP_COMMAND_REQ);
+
+ msg_body.arg1 = arg1;
+ msg_body.arg2 = arg2;
+ msg_body.arg3 = arg3;
+ msg_body.arg4 = arg4;
+ msg_body.arg5 = arg5;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_dump_cmd failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_dump_cmd response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static inline void set_feat_caps(u32 *bitmap,
+ enum place_holder_in_cap_bitmap cap)
+{
+ int arr_idx, bit_idx;
+
+ if (cap < 0 || cap > 127) {
+ wcn36xx_warn("error cap idx %d\n", cap);
+ return;
+ }
+
+ arr_idx = cap / 32;
+ bit_idx = cap % 32;
+ bitmap[arr_idx] |= (1 << bit_idx);
+}
+
+static inline int get_feat_caps(u32 *bitmap,
+ enum place_holder_in_cap_bitmap cap)
+{
+ int arr_idx, bit_idx;
+ int ret = 0;
+
+ if (cap < 0 || cap > 127) {
+ wcn36xx_warn("error cap idx %d\n", cap);
+ return -EINVAL;
+ }
+
+ arr_idx = cap / 32;
+ bit_idx = cap % 32;
+ ret = (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0;
+ return ret;
+}
+
+static inline void clear_feat_caps(u32 *bitmap,
+ enum place_holder_in_cap_bitmap cap)
+{
+ int arr_idx, bit_idx;
+
+ if (cap < 0 || cap > 127) {
+ wcn36xx_warn("error cap idx %d\n", cap);
+ return;
+ }
+
+ arr_idx = cap / 32;
+ bit_idx = cap % 32;
+ bitmap[arr_idx] &= ~(1 << bit_idx);
+}
+
+int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_feat_caps_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ);
+
+ set_feat_caps(msg_body.feat_caps, STA_POWERSAVE);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_feature_caps_exchange failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_feature_caps_exchange response failed err=%d\n",
+ ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
+ struct ieee80211_sta *sta,
+ u16 tid,
+ u16 *ssn,
+ u8 direction,
+ u8 sta_index)
+{
+ struct wcn36xx_hal_add_ba_session_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BA_SESSION_REQ);
+
+ msg_body.sta_index = sta_index;
+ memcpy(&msg_body.mac_addr, sta->addr, ETH_ALEN);
+ msg_body.dialog_token = 0x10;
+ msg_body.tid = tid;
+
+ /* Immediate BA because Delayed BA is not supported */
+ msg_body.policy = 1;
+ msg_body.buffer_size = WCN36XX_AGGR_BUFFER_SIZE;
+ msg_body.timeout = 0;
+ if (ssn)
+ msg_body.ssn = *ssn;
+ msg_body.direction = direction;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_add_ba_session failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_add_ba_session response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_add_ba(struct wcn36xx *wcn)
+{
+ struct wcn36xx_hal_add_ba_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BA_REQ);
+
+ msg_body.session_id = 0;
+ msg_body.win_size = WCN36XX_AGGR_BUFFER_SIZE;
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_add_ba failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_add_ba response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index)
+{
+ struct wcn36xx_hal_del_ba_req_msg msg_body;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_DEL_BA_REQ);
+
+ msg_body.sta_index = sta_index;
+ msg_body.tid = tid;
+ msg_body.direction = 0;
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_del_ba failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_del_ba response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index)
+{
+ struct wcn36xx_hal_trigger_ba_req_msg msg_body;
+ struct wcn36xx_hal_trigget_ba_req_candidate *candidate;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_TRIGGER_BA_REQ);
+
+ msg_body.session_id = 0;
+ msg_body.candidate_cnt = 1;
+ msg_body.header.len += sizeof(*candidate);
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ candidate = (struct wcn36xx_hal_trigget_ba_req_candidate *)
+ (wcn->hal_buf + sizeof(msg_body));
+ candidate->sta_index = sta_index;
+ candidate->tid_bitmap = 1;
+
+ ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_trigger_ba failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_trigger_ba response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+
+static int wcn36xx_smd_tx_compl_ind(struct wcn36xx *wcn, void *buf, size_t len)
+{
+ struct wcn36xx_hal_tx_compl_ind_msg *rsp = buf;
+
+ if (len != sizeof(*rsp)) {
+ wcn36xx_warn("Bad TX complete indication\n");
+ return -EIO;
+ }
+
+ wcn36xx_dxe_tx_ack_ind(wcn, rsp->status);
+
+ return 0;
+}
+
+static int wcn36xx_smd_missed_beacon_ind(struct wcn36xx *wcn,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_missed_beacon_ind_msg *rsp = buf;
+ struct ieee80211_vif *vif = NULL;
+ struct wcn36xx_vif *tmp;
+
+ /* Old FW does not have bss index */
+ if (wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
+ list_for_each_entry(tmp, &wcn->vif_list, list) {
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n",
+ tmp->bss_index);
+ vif = container_of((void *)tmp,
+ struct ieee80211_vif,
+ drv_priv);
+ ieee80211_connection_loss(vif);
+ }
+ return 0;
+ }
+
+ if (len != sizeof(*rsp)) {
+ wcn36xx_warn("Corrupted missed beacon indication\n");
+ return -EIO;
+ }
+
+ list_for_each_entry(tmp, &wcn->vif_list, list) {
+ if (tmp->bss_index == rsp->bss_index) {
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "beacon missed bss_index %d\n",
+ rsp->bss_index);
+ vif = container_of((void *)tmp,
+ struct ieee80211_vif,
+ drv_priv);
+ ieee80211_connection_loss(vif);
+ return 0;
+ }
+ }
+
+ wcn36xx_warn("BSS index %d not found\n", rsp->bss_index);
+ return -ENOENT;
+}
+
+static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
+ struct wcn36xx_vif *tmp;
+ struct ieee80211_sta *sta = NULL;
+
+ if (len != sizeof(*rsp)) {
+ wcn36xx_warn("Corrupted delete sta indication\n");
+ return -EIO;
+ }
+
+ list_for_each_entry(tmp, &wcn->vif_list, list) {
+ if (sta && (tmp->sta->sta_index == rsp->sta_id)) {
+ sta = container_of((void *)tmp->sta,
+ struct ieee80211_sta,
+ drv_priv);
+ wcn36xx_dbg(WCN36XX_DBG_HAL,
+ "delete station indication %pM index %d\n",
+ rsp->addr2,
+ rsp->sta_id);
+ ieee80211_report_low_ack(sta, 0);
+ return 0;
+ }
+ }
+
+ wcn36xx_warn("STA with addr %pM and index %d not found\n",
+ rsp->addr2,
+ rsp->sta_id);
+ return -ENOENT;
+}
+
+int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value)
+{
+ struct wcn36xx_hal_update_cfg_req_msg msg_body, *body;
+ size_t len;
+ int ret = 0;
+
+ mutex_lock(&wcn->hal_mutex);
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_CFG_REQ);
+
+ PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+ body = (struct wcn36xx_hal_update_cfg_req_msg *) wcn->hal_buf;
+ len = msg_body.header.len;
+
+ put_cfg_tlv_u32(wcn, &len, cfg_id, value);
+ body->header.len = len;
+ body->len = len - sizeof(*body);
+
+ ret = wcn36xx_smd_send_and_wait(wcn, body->header.len);
+ if (ret) {
+ wcn36xx_err("Sending hal_update_cfg failed\n");
+ goto out;
+ }
+ ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+ if (ret) {
+ wcn36xx_err("hal_update_cfg response failed err=%d\n", ret);
+ goto out;
+ }
+out:
+ mutex_unlock(&wcn->hal_mutex);
+ return ret;
+}
+static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
+{
+ struct wcn36xx_hal_msg_header *msg_header = buf;
+ struct wcn36xx_hal_ind_msg *msg_ind;
+ wcn36xx_dbg_dump(WCN36XX_DBG_SMD_DUMP, "SMD <<< ", buf, len);
+
+ switch (msg_header->msg_type) {
+ case WCN36XX_HAL_START_RSP:
+ case WCN36XX_HAL_CONFIG_STA_RSP:
+ case WCN36XX_HAL_CONFIG_BSS_RSP:
+ case WCN36XX_HAL_ADD_STA_SELF_RSP:
+ case WCN36XX_HAL_STOP_RSP:
+ case WCN36XX_HAL_DEL_STA_SELF_RSP:
+ case WCN36XX_HAL_DELETE_STA_RSP:
+ case WCN36XX_HAL_INIT_SCAN_RSP:
+ case WCN36XX_HAL_START_SCAN_RSP:
+ case WCN36XX_HAL_END_SCAN_RSP:
+ case WCN36XX_HAL_FINISH_SCAN_RSP:
+ case WCN36XX_HAL_DOWNLOAD_NV_RSP:
+ case WCN36XX_HAL_DELETE_BSS_RSP:
+ case WCN36XX_HAL_SEND_BEACON_RSP:
+ case WCN36XX_HAL_SET_LINK_ST_RSP:
+ case WCN36XX_HAL_UPDATE_PROBE_RSP_TEMPLATE_RSP:
+ case WCN36XX_HAL_SET_BSSKEY_RSP:
+ case WCN36XX_HAL_SET_STAKEY_RSP:
+ case WCN36XX_HAL_RMV_STAKEY_RSP:
+ case WCN36XX_HAL_RMV_BSSKEY_RSP:
+ case WCN36XX_HAL_ENTER_BMPS_RSP:
+ case WCN36XX_HAL_SET_POWER_PARAMS_RSP:
+ case WCN36XX_HAL_EXIT_BMPS_RSP:
+ case WCN36XX_HAL_KEEP_ALIVE_RSP:
+ case WCN36XX_HAL_DUMP_COMMAND_RSP:
+ case WCN36XX_HAL_ADD_BA_SESSION_RSP:
+ case WCN36XX_HAL_ADD_BA_RSP:
+ case WCN36XX_HAL_DEL_BA_RSP:
+ case WCN36XX_HAL_TRIGGER_BA_RSP:
+ case WCN36XX_HAL_UPDATE_CFG_RSP:
+ case WCN36XX_HAL_JOIN_RSP:
+ case WCN36XX_HAL_UPDATE_SCAN_PARAM_RSP:
+ case WCN36XX_HAL_CH_SWITCH_RSP:
+ case WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_RSP:
+ memcpy(wcn->hal_buf, buf, len);
+ wcn->hal_rsp_len = len;
+ complete(&wcn->hal_rsp_compl);
+ break;
+
+ case WCN36XX_HAL_OTA_TX_COMPL_IND:
+ case WCN36XX_HAL_MISSED_BEACON_IND:
+ case WCN36XX_HAL_DELETE_STA_CONTEXT_IND:
+ mutex_lock(&wcn->hal_ind_mutex);
+ msg_ind = kmalloc(sizeof(*msg_ind), GFP_KERNEL);
+ msg_ind->msg_len = len;
+ msg_ind->msg = kmalloc(len, GFP_KERNEL);
+ memcpy(msg_ind->msg, buf, len);
+ list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
+ queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n");
+ mutex_unlock(&wcn->hal_ind_mutex);
+ break;
+ default:
+ wcn36xx_err("SMD_EVENT (%d) not supported\n",
+ msg_header->msg_type);
+ }
+}
+static void wcn36xx_ind_smd_work(struct work_struct *work)
+{
+ struct wcn36xx *wcn =
+ container_of(work, struct wcn36xx, hal_ind_work);
+ struct wcn36xx_hal_msg_header *msg_header;
+ struct wcn36xx_hal_ind_msg *hal_ind_msg;
+
+ mutex_lock(&wcn->hal_ind_mutex);
+
+ hal_ind_msg = list_first_entry(&wcn->hal_ind_queue,
+ struct wcn36xx_hal_ind_msg,
+ list);
+
+ msg_header = (struct wcn36xx_hal_msg_header *)hal_ind_msg->msg;
+
+ switch (msg_header->msg_type) {
+ case WCN36XX_HAL_OTA_TX_COMPL_IND:
+ wcn36xx_smd_tx_compl_ind(wcn,
+ hal_ind_msg->msg,
+ hal_ind_msg->msg_len);
+ break;
+ case WCN36XX_HAL_MISSED_BEACON_IND:
+ wcn36xx_smd_missed_beacon_ind(wcn,
+ hal_ind_msg->msg,
+ hal_ind_msg->msg_len);
+ break;
+ case WCN36XX_HAL_DELETE_STA_CONTEXT_IND:
+ wcn36xx_smd_delete_sta_context_ind(wcn,
+ hal_ind_msg->msg,
+ hal_ind_msg->msg_len);
+ break;
+ default:
+ wcn36xx_err("SMD_EVENT (%d) not supported\n",
+ msg_header->msg_type);
+ }
+ list_del(wcn->hal_ind_queue.next);
+ kfree(hal_ind_msg->msg);
+ kfree(hal_ind_msg);
+ mutex_unlock(&wcn->hal_ind_mutex);
+}
+int wcn36xx_smd_open(struct wcn36xx *wcn)
+{
+ int ret = 0;
+ wcn->hal_ind_wq = create_freezable_workqueue("wcn36xx_smd_ind");
+ if (!wcn->hal_ind_wq) {
+ wcn36xx_err("failed to allocate wq\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+ INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work);
+ INIT_LIST_HEAD(&wcn->hal_ind_queue);
+ mutex_init(&wcn->hal_ind_mutex);
+
+ ret = wcn->ctrl_ops->open(wcn, wcn36xx_smd_rsp_process);
+ if (ret) {
+ wcn36xx_err("failed to open control channel\n");
+ goto free_wq;
+ }
+
+ return ret;
+
+free_wq:
+ destroy_workqueue(wcn->hal_ind_wq);
+out:
+ return ret;
+}
+
+void wcn36xx_smd_close(struct wcn36xx *wcn)
+{
+ wcn->ctrl_ops->close();
+ destroy_workqueue(wcn->hal_ind_wq);
+ mutex_destroy(&wcn->hal_ind_mutex);
+}
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h
new file mode 100644
index 0000000..e7c3901
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _SMD_H_
+#define _SMD_H_
+
+#include "wcn36xx.h"
+
+/* Max shared size is 4k but we take less.*/
+#define WCN36XX_NV_FRAGMENT_SIZE 3072
+
+#define WCN36XX_HAL_BUF_SIZE 4096
+
+#define HAL_MSG_TIMEOUT 200
+#define WCN36XX_SMSM_WLAN_TX_ENABLE 0x00000400
+#define WCN36XX_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200
+/* The PNO version info be contained in the rsp msg */
+#define WCN36XX_FW_MSG_PNO_VERSION_MASK 0x8000
+
+enum wcn36xx_fw_msg_result {
+ WCN36XX_FW_MSG_RESULT_SUCCESS = 0,
+ WCN36XX_FW_MSG_RESULT_SUCCESS_SYNC = 1,
+
+ WCN36XX_FW_MSG_RESULT_MEM_FAIL = 5,
+};
+
+/******************************/
+/* SMD requests and responses */
+/******************************/
+struct wcn36xx_fw_msg_status_rsp {
+ u32 status;
+} __packed;
+
+struct wcn36xx_hal_ind_msg {
+ struct list_head list;
+ u8 *msg;
+ size_t msg_len;
+};
+
+struct wcn36xx;
+
+int wcn36xx_smd_open(struct wcn36xx *wcn);
+void wcn36xx_smd_close(struct wcn36xx *wcn);
+
+int wcn36xx_smd_load_nv(struct wcn36xx *wcn);
+int wcn36xx_smd_start(struct wcn36xx *wcn);
+int wcn36xx_smd_stop(struct wcn36xx *wcn);
+int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode);
+int wcn36xx_smd_start_scan(struct wcn36xx *wcn);
+int wcn36xx_smd_end_scan(struct wcn36xx *wcn);
+int wcn36xx_smd_finish_scan(struct wcn36xx *wcn,
+ enum wcn36xx_hal_sys_mode mode);
+int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn);
+int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif);
+int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr);
+int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index);
+int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch);
+int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
+ const u8 *sta_mac,
+ enum wcn36xx_hal_link_state state);
+int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, const u8 *bssid,
+ bool update);
+int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif);
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta);
+int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+ struct sk_buff *skb_beacon, u16 tim_off,
+ u16 p2p_off);
+int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif, int ch);
+int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ struct sk_buff *skb);
+int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 keylen,
+ u8 *key,
+ u8 sta_index);
+int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 keylen,
+ u8 *key);
+int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx,
+ u8 sta_index);
+int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
+ enum ani_ed_type enc_type,
+ u8 keyidx);
+int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
+int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
+int wcn36xx_smd_set_power_params(struct wcn36xx *wcn, bool ignore_dtim);
+int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn,
+ struct ieee80211_vif *vif,
+ int packet_type);
+int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
+ u32 arg3, u32 arg4, u32 arg5);
+int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn);
+
+int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
+ struct ieee80211_sta *sta,
+ u16 tid,
+ u16 *ssn,
+ u8 direction,
+ u8 sta_index);
+int wcn36xx_smd_add_ba(struct wcn36xx *wcn);
+int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index);
+int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index);
+
+int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value);
+#endif /* _SMD_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
new file mode 100644
index 0000000..b2b60e3
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include "txrx.h"
+
+static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
+{
+ return 100 - ((bd->phy_stat0 >> 24) & 0xff);
+}
+
+int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
+{
+ struct ieee80211_rx_status status;
+ struct ieee80211_hdr *hdr;
+ struct wcn36xx_rx_bd *bd;
+ u16 fc, sn;
+
+ /*
+ * All fields must be 0, otherwise it can lead to
+ * unexpected consequences.
+ */
+ memset(&status, 0, sizeof(status));
+
+ bd = (struct wcn36xx_rx_bd *)skb->data;
+ buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+ wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
+ "BD <<< ", (char *)bd,
+ sizeof(struct wcn36xx_rx_bd));
+
+ skb_put(skb, bd->pdu.mpdu_header_off + bd->pdu.mpdu_len);
+ skb_pull(skb, bd->pdu.mpdu_header_off);
+
+ status.mactime = 10;
+ status.freq = WCN36XX_CENTER_FREQ(wcn);
+ status.band = WCN36XX_BAND(wcn);
+ status.signal = -get_rssi0(bd);
+ status.antenna = 1;
+ status.rate_idx = 1;
+ status.flag = 0;
+ status.rx_flags = 0;
+ status.flag |= RX_FLAG_IV_STRIPPED |
+ RX_FLAG_MMIC_STRIPPED |
+ RX_FLAG_DECRYPTED;
+
+ wcn36xx_dbg(WCN36XX_DBG_RX, "status.flags=%x status->vendor_radiotap_len=%x\n",
+ status.flag, status.vendor_radiotap_len);
+
+ memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status));
+
+ hdr = (struct ieee80211_hdr *) skb->data;
+ fc = __le16_to_cpu(hdr->frame_control);
+ sn = IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl));
+
+ if (ieee80211_is_beacon(hdr->frame_control)) {
+ wcn36xx_dbg(WCN36XX_DBG_BEACON, "beacon skb %p len %d fc %04x sn %d\n",
+ skb, skb->len, fc, sn);
+ wcn36xx_dbg_dump(WCN36XX_DBG_BEACON_DUMP, "SKB <<< ",
+ (char *)skb->data, skb->len);
+ } else {
+ wcn36xx_dbg(WCN36XX_DBG_RX, "rx skb %p len %d fc %04x sn %d\n",
+ skb, skb->len, fc, sn);
+ wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP, "SKB <<< ",
+ (char *)skb->data, skb->len);
+ }
+
+ ieee80211_rx_irqsafe(wcn->hw, skb);
+
+ return 0;
+}
+
+static void wcn36xx_set_tx_pdu(struct wcn36xx_tx_bd *bd,
+ u32 mpdu_header_len,
+ u32 len,
+ u16 tid)
+{
+ bd->pdu.mpdu_header_len = mpdu_header_len;
+ bd->pdu.mpdu_header_off = sizeof(*bd);
+ bd->pdu.mpdu_data_off = bd->pdu.mpdu_header_len +
+ bd->pdu.mpdu_header_off;
+ bd->pdu.mpdu_len = len;
+ bd->pdu.tid = tid;
+}
+
+static inline struct wcn36xx_vif *get_vif_by_addr(struct wcn36xx *wcn,
+ u8 *addr)
+{
+ struct wcn36xx_vif *vif_priv = NULL;
+ struct ieee80211_vif *vif = NULL;
+ list_for_each_entry(vif_priv, &wcn->vif_list, list) {
+ vif = container_of((void *)vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+ if (memcmp(vif->addr, addr, ETH_ALEN) == 0)
+ return vif_priv;
+ }
+ wcn36xx_warn("vif %pM not found\n", addr);
+ return NULL;
+}
+static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
+ struct wcn36xx *wcn,
+ struct wcn36xx_vif **vif_priv,
+ struct wcn36xx_sta *sta_priv,
+ struct ieee80211_hdr *hdr,
+ bool bcast)
+{
+ struct ieee80211_vif *vif = NULL;
+ struct wcn36xx_vif *__vif_priv = NULL;
+ bd->bd_rate = WCN36XX_BD_RATE_DATA;
+
+ /*
+ * For not unicast frames mac80211 will not set sta pointer so use
+ * self_sta_index instead.
+ */
+ if (sta_priv) {
+ __vif_priv = sta_priv->vif;
+ vif = container_of((void *)__vif_priv,
+ struct ieee80211_vif,
+ drv_priv);
+
+ if (vif->type == NL80211_IFTYPE_STATION) {
+ bd->sta_index = sta_priv->bss_sta_index;
+ bd->dpu_desc_idx = sta_priv->bss_dpu_desc_index;
+ } else if (vif->type == NL80211_IFTYPE_AP ||
+ vif->type == NL80211_IFTYPE_ADHOC ||
+ vif->type == NL80211_IFTYPE_MESH_POINT) {
+ bd->sta_index = sta_priv->sta_index;
+ bd->dpu_desc_idx = sta_priv->dpu_desc_index;
+ }
+ } else {
+ __vif_priv = get_vif_by_addr(wcn, hdr->addr2);
+ bd->sta_index = __vif_priv->self_sta_index;
+ bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
+ }
+
+ bd->dpu_sign = __vif_priv->ucast_dpu_signature;
+
+ if (ieee80211_is_nullfunc(hdr->frame_control) ||
+ (sta_priv && !sta_priv->is_data_encrypted))
+ bd->dpu_ne = 1;
+
+ if (bcast) {
+ bd->ub = 1;
+ bd->ack_policy = 1;
+ }
+ *vif_priv = __vif_priv;
+}
+
+static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
+ struct wcn36xx *wcn,
+ struct wcn36xx_vif **vif_priv,
+ struct ieee80211_hdr *hdr,
+ bool bcast)
+{
+ struct wcn36xx_vif *__vif_priv =
+ get_vif_by_addr(wcn, hdr->addr2);
+ bd->sta_index = __vif_priv->self_sta_index;
+ bd->dpu_desc_idx = __vif_priv->self_dpu_desc_index;
+ bd->dpu_ne = 1;
+
+ /* default rate for unicast */
+ if (ieee80211_is_mgmt(hdr->frame_control))
+ bd->bd_rate = (WCN36XX_BAND(wcn) == IEEE80211_BAND_5GHZ) ?
+ WCN36XX_BD_RATE_CTRL :
+ WCN36XX_BD_RATE_MGMT;
+ else if (ieee80211_is_ctl(hdr->frame_control))
+ bd->bd_rate = WCN36XX_BD_RATE_CTRL;
+ else
+ wcn36xx_warn("frame control type unknown\n");
+
+ /*
+ * In joining state trick hardware that probe is sent as
+ * unicast even if address is broadcast.
+ */
+ if (__vif_priv->is_joining &&
+ ieee80211_is_probe_req(hdr->frame_control))
+ bcast = false;
+
+ if (bcast) {
+ /* broadcast */
+ bd->ub = 1;
+ /* No ack needed not unicast */
+ bd->ack_policy = 1;
+ bd->queue_id = WCN36XX_TX_B_WQ_ID;
+ } else
+ bd->queue_id = WCN36XX_TX_U_WQ_ID;
+ *vif_priv = __vif_priv;
+}
+
+int wcn36xx_start_tx(struct wcn36xx *wcn,
+ struct wcn36xx_sta *sta_priv,
+ struct sk_buff *skb)
+{
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct wcn36xx_vif *vif_priv = NULL;
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ unsigned long flags;
+ bool is_low = ieee80211_is_data(hdr->frame_control);
+ bool bcast = is_broadcast_ether_addr(hdr->addr1) ||
+ is_multicast_ether_addr(hdr->addr1);
+ struct wcn36xx_tx_bd *bd = wcn36xx_dxe_get_next_bd(wcn, is_low);
+
+ if (!bd) {
+ /*
+ * TX DXE are used in pairs. One for the BD and one for the
+ * actual frame. The BD DXE's has a preallocated buffer while
+ * the skb ones does not. If this isn't true something is really
+ * wierd. TODO: Recover from this situation
+ */
+
+ wcn36xx_err("bd address may not be NULL for BD DXE\n");
+ return -EINVAL;
+ }
+
+ memset(bd, 0, sizeof(*bd));
+
+ wcn36xx_dbg(WCN36XX_DBG_TX,
+ "tx skb %p len %d fc %04x sn %d %s %s\n",
+ skb, skb->len, __le16_to_cpu(hdr->frame_control),
+ IEEE80211_SEQ_TO_SN(__le16_to_cpu(hdr->seq_ctrl)),
+ is_low ? "low" : "high", bcast ? "bcast" : "ucast");
+
+ wcn36xx_dbg_dump(WCN36XX_DBG_TX_DUMP, "", skb->data, skb->len);
+
+ bd->dpu_rf = WCN36XX_BMU_WQ_TX;
+
+ bd->tx_comp = info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS;
+ if (bd->tx_comp) {
+ wcn36xx_dbg(WCN36XX_DBG_DXE, "TX_ACK status requested\n");
+ spin_lock_irqsave(&wcn->dxe_lock, flags);
+ if (wcn->tx_ack_skb) {
+ spin_unlock_irqrestore(&wcn->dxe_lock, flags);
+ wcn36xx_warn("tx_ack_skb already set\n");
+ return -EINVAL;
+ }
+
+ wcn->tx_ack_skb = skb;
+ spin_unlock_irqrestore(&wcn->dxe_lock, flags);
+
+ /* Only one at a time is supported by fw. Stop the TX queues
+ * until the ack status gets back.
+ *
+ * TODO: Add watchdog in case FW does not answer
+ */
+ ieee80211_stop_queues(wcn->hw);
+ }
+
+ /* Data frames served first*/
+ if (is_low) {
+ wcn36xx_set_tx_data(bd, wcn, &vif_priv, sta_priv, hdr, bcast);
+ wcn36xx_set_tx_pdu(bd,
+ ieee80211_is_data_qos(hdr->frame_control) ?
+ sizeof(struct ieee80211_qos_hdr) :
+ sizeof(struct ieee80211_hdr_3addr),
+ skb->len, sta_priv ? sta_priv->tid : 0);
+ } else {
+ /* MGMT and CTRL frames are handeld here*/
+ wcn36xx_set_tx_mgmt(bd, wcn, &vif_priv, hdr, bcast);
+ wcn36xx_set_tx_pdu(bd,
+ ieee80211_is_data_qos(hdr->frame_control) ?
+ sizeof(struct ieee80211_qos_hdr) :
+ sizeof(struct ieee80211_hdr_3addr),
+ skb->len, WCN36XX_TID);
+ }
+
+ buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+ bd->tx_bd_sign = 0xbdbdbdbd;
+
+ return wcn36xx_dxe_tx_frame(wcn, vif_priv, skb, is_low);
+}
diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.h b/drivers/net/wireless/ath/wcn36xx/txrx.h
new file mode 100644
index 0000000..bbfbcf8
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _TXRX_H_
+#define _TXRX_H_
+
+#include <linux/etherdevice.h>
+#include "wcn36xx.h"
+
+/* TODO describe all properties */
+#define WCN36XX_802_11_HEADER_LEN 24
+#define WCN36XX_BMU_WQ_TX 25
+#define WCN36XX_TID 7
+/* broadcast wq ID */
+#define WCN36XX_TX_B_WQ_ID 0xA
+#define WCN36XX_TX_U_WQ_ID 0x9
+/* bd_rate */
+#define WCN36XX_BD_RATE_DATA 0
+#define WCN36XX_BD_RATE_MGMT 2
+#define WCN36XX_BD_RATE_CTRL 3
+
+struct wcn36xx_pdu {
+ u32 dpu_fb:8;
+ u32 adu_fb:8;
+ u32 pdu_id:16;
+
+ /* 0x04*/
+ u32 tail_pdu_idx:16;
+ u32 head_pdu_idx:16;
+
+ /* 0x08*/
+ u32 pdu_count:7;
+ u32 mpdu_data_off:9;
+ u32 mpdu_header_off:8;
+ u32 mpdu_header_len:8;
+
+ /* 0x0c*/
+ u32 reserved4:8;
+ u32 tid:4;
+ u32 reserved3:4;
+ u32 mpdu_len:16;
+};
+
+struct wcn36xx_rx_bd {
+ u32 bdt:2;
+ u32 ft:1;
+ u32 dpu_ne:1;
+ u32 rx_key_id:3;
+ u32 ub:1;
+ u32 rmf:1;
+ u32 uma_bypass:1;
+ u32 csr11:1;
+ u32 reserved0:1;
+ u32 scan_learn:1;
+ u32 rx_ch:4;
+ u32 rtsf:1;
+ u32 bsf:1;
+ u32 a2hf:1;
+ u32 st_auf:1;
+ u32 dpu_sign:3;
+ u32 dpu_rf:8;
+
+ struct wcn36xx_pdu pdu;
+
+ /* 0x14*/
+ u32 addr3:8;
+ u32 addr2:8;
+ u32 addr1:8;
+ u32 dpu_desc_idx:8;
+
+ /* 0x18*/
+ u32 rxp_flags:23;
+ u32 rate_id:9;
+
+ u32 phy_stat0;
+ u32 phy_stat1;
+
+ /* 0x24 */
+ u32 rx_times;
+
+ u32 pmi_cmd[6];
+
+ /* 0x40 */
+ u32 reserved7:4;
+ u32 reorder_slot_id:6;
+ u32 reorder_fwd_id:6;
+ u32 reserved6:12;
+ u32 reorder_code:4;
+
+ /* 0x44 */
+ u32 exp_seq_num:12;
+ u32 cur_seq_num:12;
+ u32 fr_type_subtype:8;
+
+ /* 0x48 */
+ u32 msdu_size:16;
+ u32 sub_fr_id:4;
+ u32 proc_order:4;
+ u32 reserved9:4;
+ u32 aef:1;
+ u32 lsf:1;
+ u32 esf:1;
+ u32 asf:1;
+};
+
+struct wcn36xx_tx_bd {
+ u32 bdt:2;
+ u32 ft:1;
+ u32 dpu_ne:1;
+ u32 fw_tx_comp:1;
+ u32 tx_comp:1;
+ u32 reserved1:1;
+ u32 ub:1;
+ u32 rmf:1;
+ u32 reserved0:12;
+ u32 dpu_sign:3;
+ u32 dpu_rf:8;
+
+ struct wcn36xx_pdu pdu;
+
+ /* 0x14*/
+ u32 reserved5:7;
+ u32 queue_id:5;
+ u32 bd_rate:2;
+ u32 ack_policy:2;
+ u32 sta_index:8;
+ u32 dpu_desc_idx:8;
+
+ u32 tx_bd_sign;
+ u32 reserved6;
+ u32 dxe_start_time;
+ u32 dxe_end_time;
+
+ /*u32 tcp_udp_start_off:10;
+ u32 header_cks:16;
+ u32 reserved7:6;*/
+};
+
+struct wcn36xx_sta;
+struct wcn36xx;
+
+int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb);
+int wcn36xx_start_tx(struct wcn36xx *wcn,
+ struct wcn36xx_sta *sta_priv,
+ struct sk_buff *skb);
+
+#endif /* _TXRX_H_ */
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
new file mode 100644
index 0000000..58b6383
--- /dev/null
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WCN36XX_H_
+#define _WCN36XX_H_
+
+#include <linux/completion.h>
+#include <linux/printk.h>
+#include <linux/spinlock.h>
+#include <net/mac80211.h>
+
+#include "hal.h"
+#include "smd.h"
+#include "txrx.h"
+#include "dxe.h"
+#include "pmc.h"
+#include "debug.h"
+
+#define WLAN_NV_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin"
+#define WCN36XX_AGGR_BUFFER_SIZE 64
+
+extern unsigned int wcn36xx_dbg_mask;
+
+enum wcn36xx_debug_mask {
+ WCN36XX_DBG_DXE = 0x00000001,
+ WCN36XX_DBG_DXE_DUMP = 0x00000002,
+ WCN36XX_DBG_SMD = 0x00000004,
+ WCN36XX_DBG_SMD_DUMP = 0x00000008,
+ WCN36XX_DBG_RX = 0x00000010,
+ WCN36XX_DBG_RX_DUMP = 0x00000020,
+ WCN36XX_DBG_TX = 0x00000040,
+ WCN36XX_DBG_TX_DUMP = 0x00000080,
+ WCN36XX_DBG_HAL = 0x00000100,
+ WCN36XX_DBG_HAL_DUMP = 0x00000200,
+ WCN36XX_DBG_MAC = 0x00000400,
+ WCN36XX_DBG_BEACON = 0x00000800,
+ WCN36XX_DBG_BEACON_DUMP = 0x00001000,
+ WCN36XX_DBG_PMC = 0x00002000,
+ WCN36XX_DBG_PMC_DUMP = 0x00004000,
+ WCN36XX_DBG_ANY = 0xffffffff,
+};
+
+#define wcn36xx_err(fmt, arg...) \
+ printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg);
+
+#define wcn36xx_warn(fmt, arg...) \
+ printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg)
+
+#define wcn36xx_info(fmt, arg...) \
+ printk(KERN_INFO pr_fmt(fmt), ##arg)
+
+#define wcn36xx_dbg(mask, fmt, arg...) do { \
+ if (wcn36xx_dbg_mask & mask) \
+ printk(KERN_DEBUG pr_fmt(fmt), ##arg); \
+} while (0)
+
+#define wcn36xx_dbg_dump(mask, prefix_str, buf, len) do { \
+ if (wcn36xx_dbg_mask & mask) \
+ print_hex_dump(KERN_DEBUG, pr_fmt(prefix_str), \
+ DUMP_PREFIX_OFFSET, 32, 1, \
+ buf, len, false); \
+} while (0)
+
+#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value)
+#define WCN36XX_BAND(__wcn) (__wcn->hw->conf.chandef.chan->band)
+#define WCN36XX_CENTER_FREQ(__wcn) (__wcn->hw->conf.chandef.chan->center_freq)
+#define WCN36XX_LISTEN_INTERVAL(__wcn) (__wcn->hw->conf.listen_interval)
+#define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags)
+#define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
+
+static inline void buff_to_be(u32 *buf, size_t len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ buf[i] = cpu_to_be32(buf[i]);
+}
+
+struct nv_data {
+ int is_valid;
+ u8 table;
+};
+
+/* Interface for platform control path
+ *
+ * @open: hook must be called when wcn36xx wants to open control channel.
+ * @tx: sends a buffer.
+ */
+struct wcn36xx_platform_ctrl_ops {
+ int (*open)(void *drv_priv, void *rsp_cb);
+ void (*close)(void);
+ int (*tx)(char *buf, size_t len);
+ int (*get_hw_mac)(u8 *addr);
+ int (*smsm_change_state)(u32 clear_mask, u32 set_mask);
+};
+
+/**
+ * struct wcn36xx_vif - holds VIF related fields
+ *
+ * @bss_index: bss_index is initially set to 0xFF. bss_index is received from
+ * HW after first config_bss call and must be used in delete_bss and
+ * enter/exit_bmps.
+ */
+struct wcn36xx_vif {
+ struct list_head list;
+ struct wcn36xx_sta *sta;
+ u8 dtim_period;
+ enum ani_ed_type encrypt_type;
+ bool is_joining;
+ struct wcn36xx_hal_mac_ssid ssid;
+
+ /* Power management */
+ enum wcn36xx_power_state pw_state;
+
+ u8 bss_index;
+ u8 ucast_dpu_signature;
+ /* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */
+ u8 self_sta_index;
+ u8 self_dpu_desc_index;
+};
+
+/**
+ * struct wcn36xx_sta - holds STA related fields
+ *
+ * @tid: traffic ID that is used during AMPDU and in TX BD.
+ * @sta_index: STA index is returned from HW after config_sta call and is
+ * used in both SMD channel and TX BD.
+ * @dpu_desc_index: DPU descriptor index is returned from HW after config_sta
+ * call and is used in TX BD.
+ * @bss_sta_index: STA index is returned from HW after config_bss call and is
+ * used in both SMD channel and TX BD. See table bellow when it is used.
+ * @bss_dpu_desc_index: DPU descriptor index is returned from HW after
+ * config_bss call and is used in TX BD.
+ * ______________________________________________
+ * | | STA | AP |
+ * |______________|_____________|_______________|
+ * | TX BD |bss_sta_index| sta_index |
+ * |______________|_____________|_______________|
+ * |all SMD calls |bss_sta_index| sta_index |
+ * |______________|_____________|_______________|
+ * |smd_delete_sta| sta_index | sta_index |
+ * |______________|_____________|_______________|
+ */
+struct wcn36xx_sta {
+ struct wcn36xx_vif *vif;
+ u16 aid;
+ u16 tid;
+ u8 sta_index;
+ u8 dpu_desc_index;
+ u8 bss_sta_index;
+ u8 bss_dpu_desc_index;
+ bool is_data_encrypted;
+ /* Rates */
+ struct wcn36xx_hal_supported_rates supported_rates;
+};
+struct wcn36xx_dxe_ch;
+struct wcn36xx {
+ struct ieee80211_hw *hw;
+ struct device *dev;
+ struct list_head vif_list;
+
+ u8 fw_revision;
+ u8 fw_version;
+ u8 fw_minor;
+ u8 fw_major;
+
+ /* extra byte for the NULL termination */
+ u8 crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];
+ u8 wlan_version[WCN36XX_HAL_VERSION_LENGTH + 1];
+
+ /* IRQs */
+ int tx_irq;
+ int rx_irq;
+ void __iomem *mmio;
+
+ struct wcn36xx_platform_ctrl_ops *ctrl_ops;
+ /*
+ * smd_buf must be protected with smd_mutex to garantee
+ * that all messages are sent one after another
+ */
+ u8 *hal_buf;
+ size_t hal_rsp_len;
+ struct mutex hal_mutex;
+ struct completion hal_rsp_compl;
+ struct workqueue_struct *hal_ind_wq;
+ struct work_struct hal_ind_work;
+ struct mutex hal_ind_mutex;
+ struct list_head hal_ind_queue;
+
+ /* DXE channels */
+ struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */
+ struct wcn36xx_dxe_ch dxe_tx_h_ch; /* TX high */
+ struct wcn36xx_dxe_ch dxe_rx_l_ch; /* RX low */
+ struct wcn36xx_dxe_ch dxe_rx_h_ch; /* RX high */
+
+ /* For synchronization of DXE resources from BH, IRQ and WQ contexts */
+ spinlock_t dxe_lock;
+ bool queues_stopped;
+
+ /* Memory pools */
+ struct wcn36xx_dxe_mem_pool mgmt_mem_pool;
+ struct wcn36xx_dxe_mem_pool data_mem_pool;
+
+ struct sk_buff *tx_ack_skb;
+
+#ifdef CONFIG_WCN36XX_DEBUGFS
+ /* Debug file system entry */
+ struct wcn36xx_dfs_entry dfs;
+#endif /* CONFIG_WCN36XX_DEBUGFS */
+
+};
+
+static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
+ u8 major,
+ u8 minor,
+ u8 version,
+ u8 revision)
+{
+ return (wcn->fw_major == major &&
+ wcn->fw_minor == minor &&
+ wcn->fw_version == version &&
+ wcn->fw_revision == revision);
+}
+void wcn36xx_set_default_rates(struct wcn36xx_hal_supported_rates *rates);
+
+#endif /* _WCN36XX_H_ */
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCH] mac80211: port CCMP to cryptoapi's CCM driver
From: Ard Biesheuvel @ 2013-10-08 20:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, netdev, Patch Tracking, linville
In-Reply-To: <1381259316.13359.17.camel@jlt4.sipsolutions.net>
On 8 October 2013 21:08, Johannes Berg <johannes@sipsolutions.net> wrote:
> I'm not too familiar with the aead API, so here's another question:
>
>> + sg_init_one(&pt, data, data_len);
>> + sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
>> + sg_init_table(ct, 2);
>> + sg_set_buf(&ct[0], cdata, data_len);
>> + sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
>
> Is it guaranteed to be allowed that the input and output are the same
> buffer? It seems we rely on that for encrypt_one(), but is it true here
> as well?
>
Yes, the crypto layer handles all of that without issue.
> (Btw - why pass in data/cdata as separate pointers into the function?)
>
That is just a leftover of the old implementation. I will remove that
in v2, that will cut down the number of function args as well.
>> @@ -343,7 +337,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
>> data_len -= IEEE80211_CCMP_MIC_LEN;
>>
>> /* First block, b_0 */
>> - b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
>> + b_0[0] = 0x1; /* set L := 1, M and Adata flags are implied */
>
> Hmm. I don't think I understand, can you explain this to me?
>
Well M is implied by the setauthsize() in init() [M := (MIC_LEN-2)/2
== 3], and the set_assoc() call in en/decrypt() indicates the presence
of assoc (A) data. Instead of setting the flags here, and clearing
them by anding with ~0x7 (as in the old implementation), this lets the
CCM layer handle that.
--
Ard.
^ permalink raw reply
* Re: remove unneeded semicolons
From: Joe Perches @ 2013-10-08 19:28 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath10k, Fengguang Wu, linux-wireless, Julia Lawall, LKML
In-Reply-To: <20131008184815.3778.52129.stgit@localhost6.localdomain6>
On Tue, 2013-10-08 at 21:48 +0300, Kalle Valo wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
>
> drivers/net/wireless/ath/ath10k/core.c:507:2-3: Unneeded semicolon
>
> Removes unneeded semicolon.
>
> Generated by: coccinelle/misc/semicolon.cocci
There are _many_ of these.
With a perl script, basically:
$count += $text =~ s@\b((?:switch|for|while|if)\s*${match_balanced_parentheses}\s*)${match_balanced_braces}\s*;@"$1$3"@egx;
I get:
(there's at least one false positive in
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
where there's a quoted semicolon like "\n;")
arch/alpha/kernel/osf_sys.c | 2 +-
arch/alpha/kernel/sys_eiger.c | 2 +-
arch/arm/kernel/psci.c | 2 +-
arch/arm/mach-at91/gpio.c | 2 +-
arch/arm/mach-imx/clk-imx6q.c | 2 +-
arch/arm64/kernel/psci.c | 2 +-
arch/cris/arch-v32/drivers/cryptocop.c | 4 +-
arch/ia64/kvm/vcpu.c | 2 +-
arch/ia64/kvm/vtlb.c | 4 +-
arch/m68k/sun3/prom/console.c | 10 ++--
arch/mips/netlogic/xlr/fmn.c | 2 +-
arch/mips/oprofile/common.c | 2 +-
arch/powerpc/boot/cuboot-c2k.c | 2 +-
arch/powerpc/kernel/eeh.c | 2 +-
arch/powerpc/kernel/prom_init.c | 2 +-
arch/powerpc/kvm/booke.c | 2 +-
arch/powerpc/platforms/ps3/system-bus.c | 4 +-
arch/powerpc/sysdev/tsi108_dev.c | 2 +-
arch/s390/mm/extmem.c | 2 +-
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 6 +--
crypto/af_alg.c | 2 +-
drivers/acpi/acpica/nsalloc.c | 2 +-
drivers/acpi/apei/erst.c | 2 +-
drivers/ata/pata_bf54x.c | 2 +-
drivers/atm/firestream.c | 2 +-
drivers/atm/horizon.c | 4 +-
drivers/block/amiflop.c | 4 +-
drivers/block/drbd/drbd_req.c | 2 +-
drivers/block/sunvdc.c | 2 +-
drivers/bluetooth/bfusb.c | 2 +-
drivers/bluetooth/bt3c_cs.c | 2 +-
drivers/bluetooth/dtl1_cs.c | 2 +-
drivers/char/hw_random/omap-rng.c | 2 +-
drivers/clk/clk.c | 2 +-
drivers/clk/mvebu/common.c | 2 +-
drivers/clk/samsung/clk-pll.c | 2 +-
drivers/clocksource/metag_generic.c | 2 +-
drivers/cpufreq/longhaul.c | 2 +-
drivers/cpufreq/pcc-cpufreq.c | 2 +-
drivers/cpufreq/speedstep-lib.c | 2 +-
drivers/gpu/drm/ast/ast_post.c | 4 +-
drivers/gpu/drm/exynos/exynos_drm_g2d.c | 2 +-
drivers/gpu/drm/i915/dvo_ch7xxx.c | 2 +-
drivers/gpu/drm/i915/dvo_ivch.c | 2 +-
drivers/gpu/drm/i915/dvo_ns2501.c | 2 +-
drivers/gpu/drm/i915/dvo_sil164.c | 2 +-
drivers/gpu/drm/i915/dvo_tfp410.c | 2 +-
drivers/gpu/drm/nouveau/core/engine/graph/nv50.c | 2 +-
drivers/gpu/drm/radeon/radeon_bios.c | 2 +-
drivers/hwmon/adm1026.c | 6 +--
drivers/hwmon/asc7621.c | 12 ++---
drivers/ide/ide-taskfile.c | 2 +-
drivers/infiniband/hw/amso1100/c2_ae.c | 2 +-
drivers/infiniband/hw/mthca/mthca_eq.c | 2 +-
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 +--
drivers/infiniband/hw/ocrdma/ocrdma_main.c | 2 +-
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 +--
drivers/input/touchscreen/mms114.c | 4 +-
drivers/iommu/fsl_pamu_domain.c | 4 +-
drivers/isdn/hisax/netjet.c | 2 +-
drivers/isdn/hisax/q931.c | 2 +-
drivers/isdn/i4l/isdn_net.c | 2 +-
drivers/isdn/pcbit/drv.c | 4 +-
drivers/media/common/b2c2/flexcop-sram.c | 6 +--
drivers/media/dvb-frontends/cx24110.c | 2 +-
drivers/media/dvb-frontends/cx24123.c | 2 +-
drivers/media/dvb-frontends/tda8083.c | 4 +-
drivers/media/i2c/soc_camera/ov9640.c | 2 +-
drivers/media/platform/exynos4-is/fimc-isp.c | 2 +-
drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c | 2 +-
drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c | 2 +-
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 2 +-
drivers/media/platform/s5p-tv/mixer_grp_layer.c | 2 +-
drivers/media/platform/s5p-tv/mixer_vp_layer.c | 2 +-
drivers/media/radio/si470x/radio-si470x-common.c | 2 +-
drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c | 2 +-
drivers/media/v4l2-core/v4l2-ctrls.c | 2 +-
drivers/memstick/core/mspro_block.c | 2 +-
drivers/memstick/host/jmb38x_ms.c | 2 +-
drivers/memstick/host/tifm_ms.c | 2 +-
drivers/message/i2o/iop.c | 2 +-
drivers/mfd/stmpe.c | 2 +-
drivers/mfd/tps65010.c | 2 +-
drivers/misc/ti-st/st_core.c | 2 +-
drivers/mmc/host/davinci_mmc.c | 2 +-
drivers/mmc/host/vub300.c | 6 +--
drivers/mmc/host/wbsd.c | 2 +-
drivers/mtd/nand/mpc5121_nfc.c | 2 +-
drivers/mtd/ubi/cdev.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/cmd.c | 2 +-
drivers/net/ethernet/mellanox/mlx4/eq.c | 2 +-
.../net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +-
drivers/net/usb/sr9700.c | 2 +-
drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +-
drivers/net/wireless/ath/ath6kl/init.c | 2 +-
drivers/net/wireless/iwlwifi/mvm/d3.c | 2 +-
drivers/net/wireless/iwlwifi/mvm/led.c | 2 +-
drivers/net/wireless/iwlwifi/mvm/scan.c | 2 +-
drivers/pci/proc.c | 2 +-
drivers/pci/syscall.c | 2 +-
drivers/pcmcia/db1xxx_ss.c | 2 +-
drivers/pcmcia/m8xx_pcmcia.c | 2 +-
drivers/pinctrl/pinctrl-exynos5440.c | 2 +-
drivers/pinctrl/pinctrl-samsung.c | 2 +-
drivers/pinctrl/pinctrl-sunxi.c | 2 +-
drivers/pinctrl/pinctrl-tz1090-pdc.c | 4 +-
drivers/pinctrl/pinctrl-tz1090.c | 4 +-
drivers/power/ab8500_charger.c | 6 +--
drivers/power/ab8500_fg.c | 14 +++---
drivers/power/abx500_chargalg.c | 2 +-
drivers/power/reset/vexpress-poweroff.c | 2 +-
drivers/regulator/da9063-regulator.c | 2 +-
drivers/rpmsg/virtio_rpmsg_bus.c | 2 +-
drivers/rtc/rtc-rs5c372.c | 2 +-
drivers/s390/char/monreader.c | 2 +-
drivers/s390/scsi/zfcp_fsf.c | 2 +-
drivers/sbus/char/openprom.c | 2 +-
drivers/scsi/aha1542.c | 24 +++++-----
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c | 2 +-
drivers/scsi/bfa/bfa_fcs_lport.c | 2 +-
drivers/scsi/bfa/bfa_fcs_rport.c | 2 +-
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 6 +--
drivers/scsi/fcoe/fcoe.c | 6 +--
drivers/scsi/fcoe/fcoe_sysfs.c | 4 +-
drivers/scsi/fnic/fnic_main.c | 2 +-
drivers/scsi/ibmvscsi/ibmvfc.c | 38 +++++++--------
drivers/scsi/ibmvscsi/ibmvstgt.c | 2 +-
drivers/scsi/ipr.c | 4 +-
drivers/scsi/nsp32.c | 4 +-
drivers/scsi/pmcraid.c | 2 +-
drivers/scsi/qlogicpti.c | 2 +-
drivers/scsi/scsi_tgt_if.c | 2 +-
drivers/scsi/sgiwd93.c | 2 +-
drivers/scsi/sym53c8xx_2/sym_fw.c | 6 +--
drivers/scsi/ultrastor.c | 2 +-
drivers/staging/iio/adc/ad7291.c | 2 +-
drivers/staging/iio/cdc/ad7150.c | 2 +-
drivers/staging/imx-drm/imx-tve.c | 2 +-
drivers/staging/lustre/lustre/lvfs/lvfs_linux.c | 2 +-
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +-
drivers/staging/rtl8188eu/core/rtw_recv.c | 2 +-
drivers/staging/rtl8188eu/hal/hal_com.c | 4 +-
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 +-
drivers/target/sbp/sbp_target.c | 2 +-
drivers/tty/nozomi.c | 6 +--
drivers/tty/serial/bfin_uart.c | 4 +-
drivers/tty/serial/ip22zilog.c | 2 +-
drivers/tty/serial/max310x.c | 2 +-
drivers/tty/serial/pmac_zilog.c | 2 +-
drivers/tty/serial/sunsab.c | 2 +-
drivers/tty/serial/sunsu.c | 2 +-
drivers/tty/serial/sunzilog.c | 6 +--
drivers/tty/serial/ucc_uart.c | 2 +-
drivers/usb/core/hcd.c | 2 +-
drivers/usb/core/hub.c | 2 +-
drivers/usb/dwc3/ep0.c | 6 +--
drivers/usb/gadget/composite.c | 2 +-
drivers/usb/gadget/dummy_hcd.c | 6 +--
drivers/usb/gadget/goku_udc.c | 2 +-
drivers/usb/gadget/net2280.c | 4 +-
drivers/usb/gadget/rndis.c | 2 +-
drivers/usb/gadget/tcm_usb_gadget.c | 4 +-
drivers/usb/host/ehci-dbg.c | 2 +-
drivers/usb/host/fotg210-hcd.c | 2 +-
drivers/usb/host/fusbh200-hcd.c | 2 +-
drivers/usb/host/isp1362-hcd.c | 2 +-
drivers/usb/host/ohci-dbg.c | 2 +-
drivers/usb/host/sl811-hcd.c | 4 +-
drivers/usb/host/uhci-pci.c | 2 +-
drivers/usb/host/whci/hcd.c | 4 +-
drivers/usb/musb/musb_core.c | 2 +-
drivers/usb/musb/musb_dsps.c | 2 +-
drivers/usb/musb/musb_gadget.c | 2 +-
drivers/usb/musb/musb_host.c | 2 +-
drivers/usb/phy/phy-twl4030-usb.c | 2 +-
drivers/usb/phy/phy-ulpi-viewport.c | 2 +-
drivers/usb/wusbcore/cbaf.c | 4 +-
drivers/usb/wusbcore/devconnect.c | 2 +-
drivers/usb/wusbcore/wa-xfer.c | 4 +-
drivers/uwb/i1480/dfu/mac.c | 2 +-
drivers/uwb/ie.c | 2 +-
drivers/video/cfbimgblt.c | 2 +-
drivers/video/cg14.c | 4 +-
drivers/video/cg6.c | 2 +-
drivers/video/exynos/exynos_mipi_dsi_common.c | 2 +-
drivers/video/fsl-diu-fb.c | 2 +-
drivers/video/leo.c | 2 +-
drivers/video/matrox/matroxfb_DAC1064.c | 4 +-
drivers/video/matrox/matroxfb_Ti3026.c | 2 +-
drivers/video/nvidia/nv_hw.c | 2 +-
drivers/video/omap2/displays-new/panel-dsi-cm.c | 2 +-
drivers/video/omap2/dss/dispc.c | 2 +-
drivers/video/omap2/dss/dsi.c | 2 +-
drivers/video/sbuslib.c | 2 +-
drivers/video/sysimgblt.c | 2 +-
drivers/video/tcx.c | 4 +-
drivers/video/vt8500lcdfb.c | 2 +-
drivers/watchdog/riowd.c | 2 +-
fs/9p/vfs_inode.c | 2 +-
fs/befs/btree.c | 2 +-
fs/btrfs/print-tree.c | 2 +-
fs/dlm/rcom.c | 2 +-
fs/gfs2/glops.c | 2 +-
fs/gfs2/inode.c | 2 +-
fs/gfs2/recovery.c | 2 +-
fs/hpfs/buffer.c | 2 +-
fs/jffs2/wbuf.c | 2 +-
fs/lockd/clnt4xdr.c | 4 +-
fs/lockd/clntxdr.c | 4 +-
fs/nfs/nfs2xdr.c | 10 ++--
fs/nfs/nfs3xdr.c | 56 +++++++++++-----------
fs/nfs/nfs4proc.c | 2 +-
fs/nfs/nfs4state.c | 2 +-
fs/nfs/super.c | 6 +--
fs/nfsd/nfs4callback.c | 2 +-
fs/nfsd/nfs4state.c | 2 +-
fs/nfsd/nfs4xdr.c | 2 +-
fs/notify/fanotify/fanotify.c | 2 +-
fs/notify/inotify/inotify_fsnotify.c | 2 +-
fs/ntfs/lcnalloc.c | 2 +-
fs/ntfs/super.c | 4 +-
fs/ocfs2/cluster/quorum.c | 2 +-
fs/ocfs2/dlmglue.c | 2 +-
fs/reiserfs/bitmap.c | 2 +-
fs/ubifs/sb.c | 2 +-
kernel/audit_watch.c | 2 +-
kernel/auditfilter.c | 4 +-
kernel/res_counter.c | 2 +-
kernel/smp.c | 2 +-
lib/decompress_bunzip2.c | 2 +-
mm/memcontrol.c | 2 +-
mm/oom_kill.c | 2 +-
net/sunrpc/auth_gss/auth_gss.c | 2 +-
scripts/conmakehash.c | 4 +-
scripts/dtc/fdtdump.c | 2 +-
security/apparmor/path.c | 2 +-
security/selinux/hooks.c | 2 +-
sound/oss/sb_ess.c | 2 +-
sound/pci/au88x0/au88x0_pcm.c | 2 +-
sound/soc/atmel/atmel_ssc_dai.c | 2 +-
sound/soc/codecs/ak4641.c | 2 +-
sound/soc/codecs/mc13783.c | 2 +-
sound/soc/codecs/tas5086.c | 2 +-
sound/soc/codecs/twl6040.c | 4 +-
sound/soc/fsl/fsl_spdif.c | 4 +-
sound/soc/tegra/tegra20_i2s.c | 6 +--
sound/soc/tegra/tegra20_spdif.c | 6 +--
sound/soc/tegra/tegra30_ahub.c | 4 +-
sound/soc/tegra/tegra30_i2s.c | 4 +-
tools/lib/traceevent/kbuffer-parse.c | 2 +-
tools/perf/builtin-diff.c | 2 +-
tools/perf/builtin-lock.c | 2 +-
tools/perf/tests/code-reading.c | 2 +-
tools/perf/util/trace-event-read.c | 2 +-
tools/power/cpupower/utils/cpupower-info.c | 2 +-
tools/power/cpupower/utils/cpupower-set.c | 2 +-
.../cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
.../cpupower/utils/idle_monitor/cpuidle_sysfs.c | 6 +--
.../cpupower/utils/idle_monitor/hsw_ext_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/nhm_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/snb_idle.c | 2 +-
tools/testing/selftests/ipc/msgque.c | 6 +--
tools/virtio/virtio-trace/trace-agent-ctl.c | 2 +-
263 files changed, 411 insertions(+), 413 deletions(-)
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 1402fcc..b25c952 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -683,7 +683,7 @@ SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code,
default:
error = -EOPNOTSUPP;
break;
- };
+ }
return error;
}
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 79d69d7..d282d77 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -176,7 +176,7 @@ eiger_swizzle(struct pci_dev *dev, u8 *pinp)
case 0x03: bridge_count = 2; break; /* 2 */
case 0x07: bridge_count = 3; break; /* 3 */
case 0x0f: bridge_count = 4; break; /* 4 */
- };
+ }
slot = PCI_SLOT(dev->devfn);
while (dev->bus->self) {
diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
index 4693188..4322b0d 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -54,7 +54,7 @@ static int psci_to_linux_errno(int errno)
return -EINVAL;
case PSCI_RET_EPERM:
return -EPERM;
- };
+ }
return -EINVAL;
}
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index a5afcf7..393c92a 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -659,7 +659,7 @@ static int at91_gpio_show(struct seq_file *s, void *unused)
seq_printf(s, "Pin\t");
for (bank = 0; bank < gpio_banks; bank++) {
seq_printf(s, "PIO%c\t\t", 'A' + bank);
- };
+ }
seq_printf(s, "\n\n");
/* print pin status */
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 9181a24..e8bb151 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -305,7 +305,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
post_div_table[2].div = 1;
video_div_table[1].div = 1;
video_div_table[2].div = 1;
- };
+ }
/* type name parent_name base div_mask */
clk[pll1_sys] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 14f73c4..a96b1e2 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -52,7 +52,7 @@ static int psci_to_linux_errno(int errno)
return -EINVAL;
case PSCI_RET_EPERM:
return -EPERM;
- };
+ }
return -EINVAL;
}
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index 877da19..17a5682c 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -1773,7 +1773,7 @@ static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned char *ke
break;
default:
panic("stream co-processor: bad aes key length in get_aes_decrypt_key\n");
- };
+ }
/* Need to do host byte order correction here since key is byte oriented and the
* kx algorithm is word (u32) oriented. */
@@ -3012,7 +3012,7 @@ static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp
default:
DEBUG_API(printk("create session, bad cipher algorithm %d\n", sop.cipher));
return -EINVAL;
- };
+ }
DEBUG(printk("setting cipher transform %d\n", ti_cipher.alg));
copy_from_user(ti_cipher.key, sop.key, sop.keylen/8);
ti_cipher.keylen = sop.keylen;
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index 958815c..fc77c2e 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -2026,7 +2026,7 @@ void kvm_emulate(struct kvm_vcpu *vcpu, struct kvm_pt_regs *regs)
break;
default:
break;
- };
+ }
/*Assume all status is NO_FAULT ?*/
if (status == IA64_NO_FAULT && cause != EVENT_RFI)
vcpu_increment_iip(vcpu);
diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
index a7869f8..4ab156f 100644
--- a/arch/ia64/kvm/vtlb.c
+++ b/arch/ia64/kvm/vtlb.c
@@ -489,7 +489,7 @@ void thash_purge_all(struct kvm_vcpu *v)
head->itir = 0;
head->next = 0;
head++;
- };
+ }
head = vhpt->hash;
for (i = 0; i < vhpt->num; i++) {
@@ -498,7 +498,7 @@ void thash_purge_all(struct kvm_vcpu *v)
head->itir = 0;
head->next = 0;
head++;
- };
+ }
local_flush_tlb_all();
}
diff --git a/arch/m68k/sun3/prom/console.c b/arch/m68k/sun3/prom/console.c
index e9236437..f1bf92e 100644
--- a/arch/m68k/sun3/prom/console.c
+++ b/arch/m68k/sun3/prom/console.c
@@ -79,7 +79,7 @@ prom_query_input_device()
case PROMDEV_TTYB: return PROMDEV_ITTYB;
default:
return PROMDEV_I_UNK;
- };
+ }
case PROM_V3:
case PROM_P1275:
local_irq_save(flags);
@@ -103,7 +103,7 @@ prom_query_input_device()
return PROMDEV_ITTYB;
}
return PROMDEV_I_UNK;
- };
+ }
}
#endif
@@ -125,7 +125,7 @@ prom_query_output_device()
case PROMDEV_SCREEN: return PROMDEV_OSCREEN;
case PROMDEV_TTYA: return PROMDEV_OTTYA;
case PROMDEV_TTYB: return PROMDEV_OTTYB;
- };
+ }
break;
case PROM_V2:
case PROM_V3:
@@ -160,10 +160,10 @@ prom_query_output_device()
switch(*romvec->pv_stdin) {
case PROMDEV_TTYA: return PROMDEV_OTTYA;
case PROMDEV_TTYB: return PROMDEV_OTTYB;
- };
+ }
}
break;
- };
+ }
return PROMDEV_O_UNK;
}
#endif
diff --git a/arch/mips/netlogic/xlr/fmn.c b/arch/mips/netlogic/xlr/fmn.c
index d428e84..7469243 100644
--- a/arch/mips/netlogic/xlr/fmn.c
+++ b/arch/mips/netlogic/xlr/fmn.c
@@ -103,7 +103,7 @@ static irqreturn_t fmn_message_handler(int irq, void *data)
mflags = nlm_cop2_enable_irqsave();
}
}
- };
+ }
/* Enable message ring intr, to any thread in core */
nlm_fmn_setup_intr(irq, (1 << nlm_threads_per_core) - 1);
nlm_cop2_disable_irqrestore(mflags);
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index 4d1736f..86d9f3f 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -99,7 +99,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
case CPU_LOONGSON2:
lmodel = &op_model_loongson2_ops;
break;
- };
+ }
if (!lmodel)
return -ENODEV;
diff --git a/arch/powerpc/boot/cuboot-c2k.c b/arch/powerpc/boot/cuboot-c2k.c
index e435949..b60032b 100644
--- a/arch/powerpc/boot/cuboot-c2k.c
+++ b/arch/powerpc/boot/cuboot-c2k.c
@@ -116,7 +116,7 @@ static void c2k_bridge_setup(u32 mem_size)
cpu->pci<bus> mem0 */
out_le32((u32 *)(bridge_base + MV64x60_CPU_BAR_ENABLE),
enables);
- };
+ }
}
static void c2k_fixups(void)
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 55593ee..431ea4b 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -561,7 +561,7 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
break;
default:
return -EINVAL;
- };
+ }
return 0;
}
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5fe2842..3ba95a3 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2701,7 +2701,7 @@ static void __init fixup_device_tree_efika_add_phy(void)
" 0x3 encode-int encode+"
" s\" interrupts\" property"
" finish-device");
- };
+ }
/* Check for a PHY device node - if missing then create one and
* give it's phandle to the ethernet node */
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 17722d8..c844ecc 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -621,7 +621,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
r = 1;
- };
+ }
return r;
}
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 5606fe3..25150c5 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -614,7 +614,7 @@ static dma_addr_t ps3_ioc0_map_page(struct device *_dev, struct page *page,
default:
/* not happned */
BUG();
- };
+ }
result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size,
&bus_addr, iopte_flag);
@@ -772,7 +772,7 @@ int ps3_system_bus_device_register(struct ps3_system_bus_device *dev)
break;
default:
BUG();
- };
+ }
dev->core.of_node = NULL;
set_dev_node(&dev->core, 0);
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index 1fd0717..1f1af12 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -51,7 +51,7 @@ phys_addr_t get_csrbase(void)
const void *prop = of_get_property(tsi, "reg", &size);
tsi108_csr_base = of_translate_address(tsi, prop);
of_node_put(tsi);
- };
+ }
return tsi108_csr_base;
}
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 519bba7..755c0f4 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -158,7 +158,7 @@ dcss_mkname(char *name, char *dcss_name)
if (name[i] == '\0')
break;
dcss_name[i] = toupper(name[i]);
- };
+ }
for (; i < 8; i++)
dcss_name[i] = ' ';
ASCEBC(dcss_name, 8);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 4118f9f..c07309a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2365,7 +2365,7 @@ static void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event
/* shift the 0~7 bits to the 8~15 bits */
reg1->config <<= 8;
break;
- };
+ }
}
/*
@@ -2507,7 +2507,7 @@ static int nhmex_rbox_hw_config(struct intel_uncore_box *box, struct perf_event
hwc->config |= event->attr.config & (~0ULL << 32);
reg2->config = event->attr.config2;
break;
- };
+ }
return 0;
}
@@ -2545,7 +2545,7 @@ static void nhmex_rbox_msr_enable_event(struct intel_uncore_box *box, struct per
wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET2_MATCH(port), reg1->config);
wrmsrl(NHMEX_R_MSR_PORTN_XBR_SET2_MASK(port), reg2->config);
break;
- };
+ }
wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0 |
(hwc->config & NHMEX_R_PMON_CTL_EV_SEL_MASK));
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index ac33d5f..d331ada 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -437,7 +437,7 @@ int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
INIT_COMPLETION(completion->completion);
err = completion->err;
break;
- };
+ }
return err;
}
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 2437373..9e4dd67 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -316,7 +316,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
node_to_delete = next_node;
next_node = next_node->peer;
acpi_ns_delete_node(node_to_delete);
- };
+ }
/* Clear the parent's child pointer */
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 26311f2..f2cf2e0 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -704,7 +704,7 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
break;
if (erst_timedout(&timeout, SPIN_UNIT))
return -EIO;
- };
+ }
rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS);
if (rc)
return rc;
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index ba0d8a2..d535ca0 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1678,7 +1678,7 @@ static int __init bfin_atapi_init(void)
break;
default:
bfin_port_info[0].udma_mask = ATA_UDMA5;
- };
+ }
return platform_driver_register(&bfin_atapi_driver);
}
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index b41c948..435790f 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1081,7 +1081,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
RC_FLAGS_BFPS_BFP * bfp |
RC_FLAGS_RXBM_PSB, 0, 0);
break;
- };
+ }
if (IS_FS50 (dev)) {
submit_command (dev, &dev->hp_txq,
QE_CMD_REG_WR | QE_CMD_IMM_INQ,
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 1dc0519..7081352 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2579,7 +2579,7 @@ static int hrz_getsockopt (struct atm_vcc * atm_vcc, int level, int optname,
// break;
default:
return -ENOPROTOOPT;
- };
+ }
break;
}
return -EINVAL;
@@ -2598,7 +2598,7 @@ static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname,
// break;
default:
return -ENOPROTOOPT;
- };
+ }
break;
}
return -EINVAL;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 4ff85b8..b67f890 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -911,9 +911,7 @@ struct dos_header {
; c = *data++ + crchi;
; crchi = (@ c) >> 8 + crclo;
; crclo = @ c;
-; }
-;
-; Remember, + is done with EOR, the @ operator is in two tables (high
+; } Remember, + is done with EOR, the @ operator is in two tables (high
; and low byte separately), which is calculated as
;
; $1021 * (c & $F0)
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index c24379f..51b4d6a 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -759,7 +759,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
start_new_tl_epoch(mdev->tconn);
mod_rq_state(req, m, 0, RQ_NET_OK|RQ_NET_DONE);
break;
- };
+ }
return rv;
}
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 5814deb..3c38717 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -519,7 +519,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len)
case VD_OP_SET_EFI:
return -EOPNOTSUPP;
break;
- };
+ }
map_perm |= LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_IO;
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 995aee9..2c31ef8 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -495,7 +495,7 @@ static int bfusb_send_frame(struct sk_buff *skb)
case HCI_SCODATA_PKT:
hdev->stat.sco_tx++;
break;
- };
+ }
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index a1aaa3b..8a0f1cc 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -439,7 +439,7 @@ static int bt3c_hci_send_frame(struct sk_buff *skb)
case HCI_SCODATA_PKT:
hdev->stat.sco_tx++;
break;
- };
+ }
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 33f3a69..adb6b5a 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -412,7 +412,7 @@ static int dtl1_hci_send_frame(struct sk_buff *skb)
break;
default:
return -EILSEQ;
- };
+ }
nsh.zero = 0;
nsh.len = skb->len;
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 9b89ff4..17423bd 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -372,7 +372,7 @@ static int omap_rng_probe(struct platform_device *pdev)
if (!priv) {
dev_err(&pdev->dev, "could not allocate memory\n");
return -ENOMEM;
- };
+ }
omap_rng_ops.priv = (unsigned long)priv;
platform_set_drvdata(pdev, priv);
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a004769..c0dd795 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1520,7 +1520,7 @@ static struct clk *__clk_init_parent(struct clk *clk)
"%s: multi-parent clocks must implement .get_parent\n",
__func__);
goto out;
- };
+ }
/*
* Do our best to cache parent clocks in clk->parents. This prevents
diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
index 25ceccf..e655cf0 100644
--- a/drivers/clk/mvebu/common.c
+++ b/drivers/clk/mvebu/common.c
@@ -77,7 +77,7 @@ void __init mvebu_coreclk_setup(struct device_node *np,
clk_data.clks[2+n] = clk_register_fixed_factor(NULL, rclk_name,
cpuclk_name, 0, mult, div);
WARN_ON(IS_ERR(clk_data.clks[2+n]));
- };
+ }
/* SAR register isn't needed anymore */
iounmap(base);
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 529e11d..81e6d2f 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -375,7 +375,7 @@ static int samsung_pll45xx_set_rate(struct clk_hw *hw, unsigned long drate,
break;
default:
break;
- };
+ }
/* Set new configuration. */
__raw_writel(con1, pll->con_reg + 0x4);
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index 9e4db41..b481895 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -72,7 +72,7 @@ static void metag_timer_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_UNUSED:
WARN_ON(1);
break;
- };
+ }
}
static cycle_t metag_clocksource_read(struct clocksource *cs)
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index 4ada1cc..387187e 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -874,7 +874,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy)
case TYPE_POWERSAVER:
printk(KERN_CONT "Powersaver supported.\n");
break;
- };
+ }
/* Doesn't hurt */
longhaul_setup_southbridge();
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index d81c4e5..bad124c 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -273,7 +273,7 @@ static int pcc_get_offset(int cpu)
if (!pccp || pccp->type != ACPI_TYPE_PACKAGE) {
ret = -ENODEV;
goto out_free;
- };
+ }
offset = &(pccp->package.elements[0]);
if (!offset || offset->type != ACPI_TYPE_INTEGER) {
diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821..2a4a04a 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -239,7 +239,7 @@ unsigned int speedstep_get_frequency(enum speedstep_processor processor)
return pentium3_get_frequency(processor);
default:
return 0;
- };
+ }
return 0;
}
EXPORT_SYMBOL_GPL(speedstep_get_frequency);
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 977cfb3..df84d1b 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -1196,7 +1196,7 @@ static void get_ddr3_info(struct ast_private *ast, struct ast2300_dram_param *pa
case AST_DRAM_4Gx16:
param->dram_config = 0x133;
break;
- }; /* switch size */
+ } /* switch size */
switch (param->vram_size) {
default:
@@ -1567,7 +1567,7 @@ static void get_ddr2_info(struct ast_private *ast, struct ast2300_dram_param *pa
case AST_DRAM_4Gx16:
param->dram_config = 0x123;
break;
- }; /* switch size */
+ } /* switch size */
switch (param->vram_size) {
default:
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 3271fd4..35ddd80 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -605,7 +605,7 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset)
reg_type = REG_TYPE_NONE;
DRM_ERROR("Unknown register offset![%d]\n", reg_offset);
break;
- };
+ }
return reg_type;
}
diff --git a/drivers/gpu/drm/i915/dvo_ch7xxx.c b/drivers/gpu/drm/i915/dvo_ch7xxx.c
index af42e94..e638363 100644
--- a/drivers/gpu/drm/i915/dvo_ch7xxx.c
+++ b/drivers/gpu/drm/i915/dvo_ch7xxx.c
@@ -160,7 +160,7 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
if (i2c_transfer(adapter, msgs, 2) == 2) {
*ch = in_buf[0];
return true;
- };
+ }
if (!ch7xxx->quiet) {
DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/i915/dvo_ivch.c b/drivers/gpu/drm/i915/dvo_ivch.c
index baaf65b..c34a2c72 100644
--- a/drivers/gpu/drm/i915/dvo_ivch.c
+++ b/drivers/gpu/drm/i915/dvo_ivch.c
@@ -195,7 +195,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
if (i2c_transfer(adapter, msgs, 3) == 3) {
*data = (in_buf[1] << 8) | in_buf[0];
return true;
- };
+ }
if (!priv->quiet) {
DRM_DEBUG_KMS("Unable to read register 0x%02x from "
diff --git a/drivers/gpu/drm/i915/dvo_ns2501.c b/drivers/gpu/drm/i915/dvo_ns2501.c
index c4a255b..30473c9 100644
--- a/drivers/gpu/drm/i915/dvo_ns2501.c
+++ b/drivers/gpu/drm/i915/dvo_ns2501.c
@@ -164,7 +164,7 @@ static bool ns2501_readb(struct intel_dvo_device *dvo, int addr, uint8_t * ch)
if (i2c_transfer(adapter, msgs, 2) == 2) {
*ch = in_buf[0];
return true;
- };
+ }
if (!ns->quiet) {
DRM_DEBUG_KMS
diff --git a/drivers/gpu/drm/i915/dvo_sil164.c b/drivers/gpu/drm/i915/dvo_sil164.c
index 4debd32..e4fa67a 100644
--- a/drivers/gpu/drm/i915/dvo_sil164.c
+++ b/drivers/gpu/drm/i915/dvo_sil164.c
@@ -93,7 +93,7 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
if (i2c_transfer(adapter, msgs, 2) == 2) {
*ch = in_buf[0];
return true;
- };
+ }
if (!sil->quiet) {
DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/i915/dvo_tfp410.c b/drivers/gpu/drm/i915/dvo_tfp410.c
index e17f1b0..52e6fd0 100644
--- a/drivers/gpu/drm/i915/dvo_tfp410.c
+++ b/drivers/gpu/drm/i915/dvo_tfp410.c
@@ -118,7 +118,7 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
if (i2c_transfer(adapter, msgs, 2) == 2) {
*ch = in_buf[0];
return true;
- };
+ }
if (!tfp->quiet) {
DRM_DEBUG_KMS("Unable to read register 0x%02x from %s:%02x.\n",
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
index 03de517..431d963 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
@@ -850,7 +850,7 @@ nv50_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
nv_engine(priv)->sclass = nvaf_graph_sclass;
break;
- };
+ }
/* unfortunate hw bug workaround... */
if (nv_device(priv)->chipset != 0x50 &&
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 061b227..aba77d2 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -612,7 +612,7 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
vhdr->DeviceID != rdev->pdev->device) {
DRM_INFO("ACPI VFCT table is not for this card\n");
goto out_unmap;
- };
+ }
if (vfct->VBIOSImageOffset + sizeof(VFCT_IMAGE_HEADER) + vhdr->ImageLength > tbl_size) {
DRM_ERROR("ACPI VFCT image truncated\n");
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 3a6d9ef..3588f72 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -616,7 +616,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
data->gpio = gpio;
data->last_reading = jiffies;
- }; /* last_reading */
+ } /* last_reading */
if (!data->valid ||
time_after(jiffies, data->last_config + ADM1026_CONFIG_INTERVAL)) {
@@ -700,7 +700,7 @@ static struct adm1026_data *adm1026_update_device(struct device *dev)
}
data->last_config = jiffies;
- }; /* last_config */
+ } /* last_config */
data->valid = 1;
mutex_unlock(&data->update_lock);
@@ -1791,7 +1791,7 @@ static int adm1026_detect(struct i2c_client *client,
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
/* We need to be able to do byte I/O */
return -ENODEV;
- };
+ }
/* Now, we do the remaining detection. */
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index 3ad9d84..8d9f2a0 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -138,7 +138,7 @@ static inline u8 read_byte(struct i2c_client *client, u8 reg)
dev_err(&client->dev,
"Unable to read from register 0x%02x.\n", reg);
return 0;
- };
+ }
return res & 0xff;
}
@@ -149,7 +149,7 @@ static inline int write_byte(struct i2c_client *client, u8 reg, u8 data)
dev_err(&client->dev,
"Unable to write value 0x%02x to register 0x%02x.\n",
data, reg);
- };
+ }
return res;
}
@@ -1030,7 +1030,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev)
}
}
data->last_high_reading = jiffies;
- }; /* last_reading */
+ } /* last_reading */
/* Read all the low priority registers. */
@@ -1044,7 +1044,7 @@ static struct asc7621_data *asc7621_update_device(struct device *dev)
}
}
data->last_low_reading = jiffies;
- }; /* last_reading */
+ } /* last_reading */
data->valid = 1;
@@ -1084,11 +1084,11 @@ static void asc7621_init_client(struct i2c_client *client)
dev_err(&client->dev,
"Client (%d,0x%02x) config is locked.\n",
i2c_adapter_id(client->adapter), client->addr);
- };
+ }
if (!(value & 0x04)) {
dev_err(&client->dev, "Client (%d,0x%02x) is not ready.\n",
i2c_adapter_id(client->adapter), client->addr);
- };
+ }
/*
* Start monitoring
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index dabb88b..fca1f7e 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -161,7 +161,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
if ((stat & ATA_BUSY) == 0 || retries-- == 0)
break;
udelay(10);
- };
+ }
if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
if (custom && tf->command == ATA_CMD_SET_MULTI) {
diff --git a/drivers/infiniband/hw/amso1100/c2_ae.c b/drivers/infiniband/hw/amso1100/c2_ae.c
index d5d1929..cedda25 100644
--- a/drivers/infiniband/hw/amso1100/c2_ae.c
+++ b/drivers/infiniband/hw/amso1100/c2_ae.c
@@ -141,7 +141,7 @@ static const char *to_qp_state_str(int state)
return "C2_QP_STATE_ERROR";
default:
return "<invalid QP state>";
- };
+ }
}
void c2_ae_event(struct c2_dev *c2dev, u32 mq_index)
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index 7c9d35f..6902017 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -357,7 +357,7 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
mthca_warn(dev, "Unhandled event %02x(%02x) on EQ %d\n",
eqe->type, eqe->subtype, eq->eqn);
break;
- };
+ }
set_eqe_hw(eqe);
++eq->cons_index;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 4ed8235..50219ab 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -150,7 +150,7 @@ enum ib_qp_state get_ibqp_state(enum ocrdma_qp_state qps)
return IB_QPS_SQE;
case OCRDMA_QPS_ERR:
return IB_QPS_ERR;
- };
+ }
return IB_QPS_ERR;
}
@@ -171,7 +171,7 @@ static enum ocrdma_qp_state get_ocrdma_qp_state(enum ib_qp_state qps)
return OCRDMA_QPS_SQE;
case IB_QPS_ERR:
return OCRDMA_QPS_ERR;
- };
+ }
return OCRDMA_QPS_ERR;
}
@@ -1982,7 +1982,7 @@ int ocrdma_mbx_create_qp(struct ocrdma_qp *qp, struct ib_qp_init_attr *attrs,
break;
default:
return -EINVAL;
- };
+ }
cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_QP, sizeof(*cmd));
if (!cmd)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 56e0049..0ce7674 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -531,7 +531,7 @@ static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event)
case BE_DEV_DOWN:
ocrdma_close(dev);
break;
- };
+ }
}
static struct ocrdma_driver ocrdma_drv = {
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 6e982bb..69f1d12 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -141,7 +141,7 @@ static inline void get_link_speed_and_width(struct ocrdma_dev *dev,
/* Unsupported */
*ib_speed = IB_SPEED_SDR;
*ib_width = IB_WIDTH_1X;
- };
+ }
}
@@ -2331,7 +2331,7 @@ static enum ib_wc_status ocrdma_to_ibwc_err(u16 status)
default:
ibwc_status = IB_WC_GENERAL_ERR;
break;
- };
+ }
return ibwc_status;
}
@@ -2370,7 +2370,7 @@ static void ocrdma_update_wc(struct ocrdma_qp *qp, struct ib_wc *ibwc,
pr_err("%s() invalid opcode received = 0x%x\n",
__func__, hdr->cw & OCRDMA_WQE_OPCODE_MASK);
break;
- };
+ }
}
static void ocrdma_set_cqe_status_flushed(struct ocrdma_qp *qp,
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 1443532..345d91d 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -395,12 +395,12 @@ static struct mms114_platform_data *mms114_parse_dt(struct device *dev)
if (of_property_read_u32(np, "x-size", &pdata->x_size)) {
dev_err(dev, "failed to get x-size property\n");
return NULL;
- };
+ }
if (of_property_read_u32(np, "y-size", &pdata->y_size)) {
dev_err(dev, "failed to get y-size property\n");
return NULL;
- };
+ }
of_property_read_u32(np, "contact-threshold",
&pdata->contact_threshold);
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index c857c30..bc77425 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -860,7 +860,7 @@ static int fsl_pamu_set_domain_attr(struct iommu_domain *domain,
pr_debug("Unsupported attribute type\n");
ret = -EINVAL;
break;
- };
+ }
return ret;
}
@@ -887,7 +887,7 @@ static int fsl_pamu_get_domain_attr(struct iommu_domain *domain,
pr_debug("Unsupported attribute type\n");
ret = -EINVAL;
break;
- };
+ }
return ret;
}
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index 233e432..6912303 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -332,7 +332,7 @@ static int make_raw_data_56k(struct BCState *bcs) {
bitcnt = 0;
}
val >>= 1;
- };
+ }
fcs = PPP_INITFCS;
for (i = 0; i < bcs->tx_skb->len; i++) {
val = bcs->tx_skb->data[i];
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index af1b020..4dd88a5 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -598,7 +598,7 @@ prcalling(char *dest, u_char *p)
dp += prbits(dp, *++p, 8, 8);
*dp++ = '\n';
l--;
- };
+ }
p++;
dp += sprintf(dp, " number digits ");
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 8b98d53..8f5a2bc 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1857,7 +1857,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
if (cprot->pops->data_ind) {
cprot->pops->data_ind(cprot, skb);
return;
- };
+ }
#endif /* CONFIG_ISDN_X25 */
printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
lp->netdev->dev->name);
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index 1eaf622..75f1d4d 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -284,7 +284,7 @@ static int pcbit_command(isdn_ctrl *ctl)
default:
printk(KERN_DEBUG "pcbit_command: unknown command\n");
break;
- };
+ }
return 0;
}
@@ -968,7 +968,7 @@ static int pcbit_ioctl(isdn_ctrl *ctl)
default:
printk("error: unknown ioctl\n");
break;
- };
+ }
return 0;
}
diff --git a/drivers/media/common/b2c2/flexcop-sram.c b/drivers/media/common/b2c2/flexcop-sram.c
index f2199e4..185c285 100644
--- a/drivers/media/common/b2c2/flexcop-sram.c
+++ b/drivers/media/common/b2c2/flexcop-sram.c
@@ -85,7 +85,7 @@ static void flexcop_sram_write(struct adapter *adapter, u32 bank, u32 addr, u8 *
while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
mdelay(1);
retries--;
- };
+ }
if (retries == 0)
printk("%s: SRAM timeout\n", __func__);
@@ -110,7 +110,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf,
while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
mdelay(1);
retries--;
- };
+ }
if (retries == 0)
printk("%s: SRAM timeout\n", __func__);
@@ -122,7 +122,7 @@ static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 *buf,
while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) {
mdelay(1);
retries--;
- };
+ }
if (retries == 0)
printk("%s: SRAM timeout\n", __func__);
diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c
index 0cd6927..95b981c 100644
--- a/drivers/media/dvb-frontends/cx24110.c
+++ b/drivers/media/dvb-frontends/cx24110.c
@@ -378,7 +378,7 @@ static int cx24110_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
return cx24110_writereg(state,0x76,(cx24110_readreg(state,0x76)&0x3b)|0x40);
default:
return -EINVAL;
- };
+ }
}
static int cx24110_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t burst)
diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c
index a771da3..72fb583 100644
--- a/drivers/media/dvb-frontends/cx24123.c
+++ b/drivers/media/dvb-frontends/cx24123.c
@@ -739,7 +739,7 @@ static int cx24123_set_voltage(struct dvb_frontend *fe,
return 0;
default:
return -EINVAL;
- };
+ }
return 0;
}
diff --git a/drivers/media/dvb-frontends/tda8083.c b/drivers/media/dvb-frontends/tda8083.c
index 9d08350..69e62f4 100644
--- a/drivers/media/dvb-frontends/tda8083.c
+++ b/drivers/media/dvb-frontends/tda8083.c
@@ -189,7 +189,7 @@ static int tda8083_set_tone (struct tda8083_state* state, fe_sec_tone_mode_t ton
return tda8083_writereg (state, 0x29, 0x80);
default:
return -EINVAL;
- };
+ }
}
static int tda8083_set_voltage (struct tda8083_state* state, fe_sec_voltage_t voltage)
@@ -201,7 +201,7 @@ static int tda8083_set_voltage (struct tda8083_state* state, fe_sec_voltage_t vo
return tda8083_writereg (state, 0x20, 0x11);
default:
return -EINVAL;
- };
+ }
}
static int tda8083_send_diseqc_burst (struct tda8083_state* state, fe_sec_mini_cmd_t burst)
diff --git a/drivers/media/i2c/soc_camera/ov9640.c b/drivers/media/i2c/soc_camera/ov9640.c
index e968c3f..bc74224 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -371,7 +371,7 @@ static void ov9640_alter_regs(enum v4l2_mbus_pixelcode code,
alt->com13 = OV9640_COM13_RGB_AVG;
alt->com15 = OV9640_COM15_RGB_565;
break;
- };
+ }
}
/* Setup registers according to resolution and color encoding */
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c
index d2e6cba..f3c6136 100644
--- a/drivers/media/platform/exynos4-is/fimc-isp.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp.c
@@ -511,7 +511,7 @@ static int __ctrl_set_metering(struct fimc_is *is, unsigned int value)
break;
default:
return -EINVAL;
- };
+ }
__is_set_isp_metering(is, IS_METERING_CONFIG_CMD, val);
return 0;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
index ad4f1df..9a6efd6 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
@@ -111,7 +111,7 @@ static int s5p_mfc_open_inst_cmd_v5(struct s5p_mfc_ctx *ctx)
break;
default:
h2r_args.arg[0] = S5P_FIMV_CODEC_NONE;
- };
+ }
h2r_args.arg[1] = 0; /* no crc & no pixelcache */
h2r_args.arg[2] = ctx->ctx.ofs;
h2r_args.arg[3] = ctx->ctx.size;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index db796c8..ec1a594 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -113,7 +113,7 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
break;
default:
codec_type = S5P_FIMV_CODEC_NONE_V6;
- };
+ }
mfc_write(dev, codec_type, S5P_FIMV_CODEC_TYPE_V6);
mfc_write(dev, ctx->ctx.dma, S5P_FIMV_CONTEXT_MEM_ADDR_V6);
mfc_write(dev, ctx->ctx.size, S5P_FIMV_CONTEXT_MEM_SIZE_V6);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
index 368582b..58ec7bb 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
@@ -1582,7 +1582,7 @@ static int s5p_mfc_get_int_reason_v5(struct s5p_mfc_dev *dev)
break;
default:
reason = S5P_MFC_R2H_CMD_EMPTY;
- };
+ }
return reason;
}
diff --git a/drivers/media/platform/s5p-tv/mixer_grp_layer.c b/drivers/media/platform/s5p-tv/mixer_grp_layer.c
index b93a21f..74344c7 100644
--- a/drivers/media/platform/s5p-tv/mixer_grp_layer.c
+++ b/drivers/media/platform/s5p-tv/mixer_grp_layer.c
@@ -226,7 +226,7 @@ static void mxr_graph_fix_geometry(struct mxr_layer *layer,
src->width + src->x_offset, 32767);
src->full_height = clamp_val(src->full_height,
src->height + src->y_offset, 2047);
- };
+ }
}
/* PUBLIC API */
diff --git a/drivers/media/platform/s5p-tv/mixer_vp_layer.c b/drivers/media/platform/s5p-tv/mixer_vp_layer.c
index 3d13a63..c9388c4 100644
--- a/drivers/media/platform/s5p-tv/mixer_vp_layer.c
+++ b/drivers/media/platform/s5p-tv/mixer_vp_layer.c
@@ -197,7 +197,7 @@ static void mxr_vp_fix_geometry(struct mxr_layer *layer,
ALIGN(src->width + src->x_offset, 8), 8192U);
src->full_height = clamp(src->full_height,
src->height + src->y_offset, 8192U);
- };
+ }
}
/* PUBLIC API */
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index 5c57e5b..4a7a1cc 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -254,7 +254,7 @@ static unsigned int si470x_get_step(struct si470x_device *radio)
/* 2: 50 kHz */
default:
return 50 * 16;
- };
+ }
}
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
index 515a9e1..28a64b8 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx_st6422.c
@@ -202,7 +202,7 @@ static int st6422_init(struct sd *sd)
{ 0x143f, 0x01 }, /* commit settings */
- };
+ }
for (i = 0; i < ARRAY_SIZE(st6422_bridge_init) && !err; i++) {
err = stv06xx_write_bridge(sd, st6422_bridge_init[i][0],
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index c3f0803..df3a67b 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -583,7 +583,7 @@ const s64 const *v4l2_ctrl_get_int_menu(u32 id, u32 *len)
default:
*len = 0;
return NULL;
- };
+ }
}
EXPORT_SYMBOL(v4l2_ctrl_get_int_menu);
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index f4176ca..c1d143d 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -280,7 +280,7 @@ static const char *mspro_block_attr_name(unsigned char tag)
return "attr_devinfo";
default:
return NULL;
- };
+ }
}
typedef ssize_t (*sysfs_show_t)(struct device *dev,
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index aeabaa5..3895e3a 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -755,7 +755,7 @@ static int jmb38x_ms_set_param(struct memstick_host *msh,
clock_delay);
host->ifmode = value;
break;
- };
+ }
return 0;
}
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index 7bafa72..8becb21 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -533,7 +533,7 @@ static int tifm_ms_set_param(struct memstick_host *msh,
} else
return -EINVAL;
break;
- };
+ }
return 0;
}
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index a8c08f3..6a0ecca 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -1063,7 +1063,7 @@ struct i2o_controller *i2o_iop_alloc(void)
I2O_MSG_INPOOL_MIN)) {
kfree(c);
return ERR_PTR(-ENOMEM);
- };
+ }
INIT_LIST_HEAD(&c->devices);
spin_lock_init(&c->lock);
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index fff63a4..a1d5942 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -706,7 +706,7 @@ static int stmpe1801_reset(struct stmpe *stmpe)
if (!(ret & STMPE1801_MSK_SYS_CTRL_RESET))
return 0;
usleep_range(100, 200);
- };
+ }
return -EIO;
}
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 743fb52..c881e99 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -147,7 +147,7 @@ static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
case 2: p = 75; break;
case 1: p = 50; break;
default: p = 25; break;
- }; p; }),
+ } p; }),
(chgconfig & TPS_VBUS_CHARGING)
? ((chgconfig & TPS_VBUS_500MA) ? 500 : 100)
: 0,
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 8d64b68..c619f64 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -366,7 +366,7 @@ void st_int_recv(void *disc_data,
st_gdata->rx_state = ST_W4_HEADER;
st_gdata->rx_count = st_gdata->list[type]->hdr_len;
pr_debug("rx_count %ld\n", st_gdata->rx_count);
- };
+ }
ptr++;
count--;
}
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index e9fa87d..2582997 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -305,7 +305,7 @@ static void mmc_davinci_start_command(struct mmc_davinci_host *host,
default:
s = ", (R? response)";
break;
- }; s; }));
+ } s; }));
host->cmd = cmd;
switch (mmc_resp_type(cmd)) {
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index e9028ad..6dc0bdb 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -563,7 +563,7 @@ static void add_offloaded_reg(struct vub300_mmc_host *vub300,
i += 1;
continue;
}
- };
+ }
__add_offloaded_reg_to_fifo(vub300, register_access, func);
}
@@ -1374,7 +1374,7 @@ static void download_offload_pseudocode(struct vub300_mmc_host *vub300)
l += snprintf(vub300->vub_name + l,
sizeof(vub300->vub_name) - l, "_%04X%04X",
sf->vendor, sf->device);
- };
+ }
snprintf(vub300->vub_name + l, sizeof(vub300->vub_name) - l, ".bin");
dev_info(&vub300->udev->dev, "requesting offload firmware %s\n",
vub300->vub_name);
@@ -1895,7 +1895,7 @@ static int satisfy_request_from_offloaded_data(struct vub300_mmc_host *vub300,
i += 1;
continue;
}
- };
+ }
if (vub300->total_offload_count == 0)
return 0;
else if (vub300->fn[func].offload_count == 0)
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index e954b77..27821f1 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -810,7 +810,7 @@ static void wbsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
cmd->error = -EINVAL;
goto done;
- };
+ }
}
/*
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 3c60a00..be14f61 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -450,7 +450,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
buffer += blksize;
offset += blksize;
size -= blksize;
- };
+ }
}
/* Copy data from/to NFC main and spare buffers */
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 8ca49f2..92be3e4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -924,7 +924,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
if (!req) {
err = -ENOMEM;
break;
- };
+ }
err = copy_from_user(req, argp, sizeof(struct ubi_rnvol_req));
if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index ea20182..8d85b97 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2372,7 +2372,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat
mlx4_warn(dev, "unknown value for link_state %02x on slave %d port %d\n",
link_state, slave, port);
return -EINVAL;
- };
+ }
s_info = &priv->mfunc.master.vf_admin[slave].vport[port];
s_info->link_state = link_state;
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 0416c5b..cdfc406 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -725,7 +725,7 @@ static int mlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq)
!!(eqe->owner & 0x80) ^
!!(eq->cons_index & eq->nent) ? "HW" : "SW");
break;
- };
+ }
++eq->cons_index;
eqes_found = 1;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index dd68763..dfba79c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -271,7 +271,7 @@ static const char *ResourceType(enum mlx4_resource rt)
case RES_FS_RULE: return "RES_FS_RULE";
case RES_XRCD: return "RES_XRCD";
default: return "Unknown resource type !!!";
- };
+ }
}
int mlx4_init_resource_tracker(struct mlx4_dev *dev)
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
index 7ec3e0e..184d440 100644
--- a/drivers/net/usb/sr9700.c
+++ b/drivers/net/usb/sr9700.c
@@ -434,7 +434,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
usbnet_skb_return(dev, sr_skb);
skb_pull(skb, len + SR_RX_OVERHEAD);
- };
+ }
return 0;
}
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index e784c40..4910958 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1201,7 +1201,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
ath10k_dbg_dump(ATH10K_DBG_HTT_DUMP, NULL, "htt event: ",
skb->data, skb->len);
break;
- };
+ }
/* Free the indication buffer */
dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 4f316bd..343a6e1 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1091,7 +1091,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
len -= ie_len;
data += ie_len;
- };
+ }
ret = 0;
out:
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 417639f..412885a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -569,7 +569,7 @@ static void iwl_mvm_build_tcp_packet(struct ieee80211_vif *vif,
mask[5] = 0x80; /* match tcp flags */
/* leave rest (0 or set for MVM_TCP_RX_WAKE) */
break;
- };
+ }
*pseudo_hdr_csum = pseudo_hdr_check(ip_tot_len - sizeof(struct iphdr),
pkt->ip.saddr, pkt->ip.daddr);
diff --git a/drivers/net/wireless/iwlwifi/mvm/led.c b/drivers/net/wireless/iwlwifi/mvm/led.c
index 2269a9e..2f66a3e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/led.c
+++ b/drivers/net/wireless/iwlwifi/mvm/led.c
@@ -103,7 +103,7 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm)
return 0;
default:
return -EINVAL;
- };
+ }
mvm->led.name = kasprintf(GFP_KERNEL, "%s-led",
wiphy_name(mvm->hw->wiphy));
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 9a7ab84..96d3e8d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -407,7 +407,7 @@ static bool iwl_mvm_scan_abort_notif(struct iwl_notif_wait_data *notif_wait,
default:
WARN_ON(1);
return false;
- };
+ }
}
void iwl_mvm_cancel_scan(struct iwl_mvm *mvm)
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index cdc7836..46d1378 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -222,7 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
default:
ret = -EINVAL;
break;
- };
+ }
return ret;
}
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index e1c1ec5..24750a1 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -44,7 +44,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
default:
err = -EINVAL;
goto error;
- };
+ }
err = -EIO;
if (cfg_ret != PCIBIOS_SUCCESSFUL)
diff --git a/drivers/pcmcia/db1xxx_ss.c b/drivers/pcmcia/db1xxx_ss.c
index a31e69e..631d37b 100644
--- a/drivers/pcmcia/db1xxx_ss.c
+++ b/drivers/pcmcia/db1xxx_ss.c
@@ -441,7 +441,7 @@ static int db1x_pcmcia_socket_probe(struct platform_device *pdev)
printk(KERN_INFO "db1xxx-ss: unknown board %d!\n", bid);
ret = -ENODEV;
goto out0;
- };
+ }
/*
* gather resources necessary and optional nice-to-haves to
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 18c0d8d..840a2c1 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -660,7 +660,7 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value)
case 2:
*value |= SS_XVCARD;
break; /* NC. GND - x.xV only */
- };
+ }
}
pr_debug("m8xx_pcmcia: GetStatus(%d) = %#2.2x\n", lsock, *value);
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index 544d469..1041683 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -296,7 +296,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev,
if (!idx)
kfree(map[idx].data.configs.group_or_pin);
}
- };
+ }
kfree(map);
}
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 92a9d6c..b5d7703 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -213,7 +213,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev,
if (!idx)
kfree(map[idx].data.configs.group_or_pin);
}
- };
+ }
kfree(map);
}
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index 119d2dd..4eb1a7f 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -901,7 +901,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
irq_set_chip_and_handler(irqno, &sunxi_pinctrl_irq_chip,
handle_simple_irq);
irq_set_chip_data(irqno, pctl);
- };
+ }
irq_set_chained_handler(pctl->irq, sunxi_pinctrl_irq_handler);
irq_set_handler_data(pctl->irq, pctl);
diff --git a/drivers/pinctrl/pinctrl-tz1090-pdc.c b/drivers/pinctrl/pinctrl-tz1090-pdc.c
index 5bf01c2..bf4b533 100644
--- a/drivers/pinctrl/pinctrl-tz1090-pdc.c
+++ b/drivers/pinctrl/pinctrl-tz1090-pdc.c
@@ -695,7 +695,7 @@ static int tz1090_pdc_pinconf_reg(struct pinctrl_dev *pctldev,
break;
default:
return -ENOTSUPP;
- };
+ }
/* Only input bias parameters supported */
*reg = REG_GPIO_CONTROL2;
@@ -828,7 +828,7 @@ static int tz1090_pdc_pinconf_group_reg(struct pinctrl_dev *pctldev,
break;
default:
return -ENOTSUPP;
- };
+ }
/* Calculate field information */
*mask = (BIT(*width) - 1) << *shift;
diff --git a/drivers/pinctrl/pinctrl-tz1090.c b/drivers/pinctrl/pinctrl-tz1090.c
index bc9cd7a..34a5391 100644
--- a/drivers/pinctrl/pinctrl-tz1090.c
+++ b/drivers/pinctrl/pinctrl-tz1090.c
@@ -1719,7 +1719,7 @@ static int tz1090_pinconf_reg(struct pinctrl_dev *pctldev,
break;
default:
return -ENOTSUPP;
- };
+ }
/* Only input bias parameters supported */
pu = &tz1090_pinconf_pullup[pin];
@@ -1848,7 +1848,7 @@ static int tz1090_pinconf_group_reg(struct pinctrl_dev *pctldev,
break;
default:
return -ENOTSUPP;
- };
+ }
/* Calculate field information */
*shift = g->slw_bit * *width;
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index a4c4a10..29ca420 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -785,7 +785,7 @@ static int ab8500_charger_max_usb_curr(struct ab8500_charger *di,
di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
ret = -ENXIO;
break;
- };
+ }
di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max;
dev_dbg(di->dev, "USB Type - 0x%02x MaxCurr: %d",
@@ -1075,7 +1075,7 @@ static int ab8500_charger_get_usb_cur(struct ab8500_charger *di)
di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
ret = -EPERM;
break;
- };
+ }
di->max_usb_in_curr.set_max = di->max_usb_in_curr.usb_type_max;
return ret;
}
@@ -2485,7 +2485,7 @@ static void ab8500_charger_usb_state_changed_work(struct work_struct *work)
default:
break;
- };
+ }
}
/**
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index 7549707..53b5690 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -2237,10 +2237,10 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
ab8500_fg_update_cap_scalers(di);
queue_work(di->fg_wq, &di->fg_work);
break;
- };
+ }
default:
break;
- };
+ }
break;
case POWER_SUPPLY_PROP_TECHNOLOGY:
switch (ext->type) {
@@ -2349,7 +2349,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
if (ret) {
dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_MAX_TIME_REG\n", __func__);
goto out;
- };
+ }
ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
AB8505_RTC_PCUT_FLAG_TIME_REG, di->bm->fg_params->pcut_flag_time);
@@ -2357,7 +2357,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
if (ret) {
dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_FLAG_TIME_REG\n", __func__);
goto out;
- };
+ }
ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
AB8505_RTC_PCUT_RESTART_REG, di->bm->fg_params->pcut_max_restart);
@@ -2365,7 +2365,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
if (ret) {
dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_RESTART_REG\n", __func__);
goto out;
- };
+ }
ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
AB8505_RTC_PCUT_DEBOUNCE_REG, di->bm->fg_params->pcut_debounce_time);
@@ -2373,7 +2373,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
if (ret) {
dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_DEBOUNCE_REG\n", __func__);
goto out;
- };
+ }
ret = abx500_set_register_interruptible(di->dev, AB8500_RTC,
AB8505_RTC_PCUT_CTL_STATUS_REG, di->bm->fg_params->pcut_enable);
@@ -2381,7 +2381,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di)
if (ret) {
dev_err(di->dev, "%s write failed AB8505_RTC_PCUT_CTL_STATUS_REG\n", __func__);
goto out;
- };
+ }
}
out:
return ret;
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 6d27236..6b44e1a 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -1892,7 +1892,7 @@ static ssize_t abx500_chargalg_en_store(struct abx500_chargalg *di,
"Enter 0. Disable AC/USB Charging\n"
"1. Enable AC charging\n"
"2. Enable USB Charging\n");
- };
+ }
return strlen(buf);
}
diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c
index 476aa49..0a056a6 100644
--- a/drivers/power/reset/vexpress-poweroff.c
+++ b/drivers/power/reset/vexpress-poweroff.c
@@ -118,7 +118,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
arm_pm_restart = vexpress_restart;
device_create_file(&pdev->dev, &dev_attr_active);
break;
- };
+ }
return 0;
}
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index b9f2653..b6a0661 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -698,7 +698,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
rdata->initdata = da9063_matches[i].init_data;
n++;
- };
+ }
*da9063_reg_matches = da9063_matches;
return pdata;
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index b6135d4..132aea0 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -861,7 +861,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)
msgs_received++;
msg = virtqueue_get_buf(rvq, &len);
- };
+ }
dev_dbg(dev, "Received %u messages\n", msgs_received);
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index ccf54f0..27666cf 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -650,7 +650,7 @@ static int rs5c372_probe(struct i2c_client *client,
case rtc_rv5c386: s = "rv5c386"; break;
case rtc_rv5c387a: s = "rv5c387a"; break;
default: s = "chip"; break;
- }; s;}),
+ } s;}),
rs5c372->time24 ? "24hr" : "am/pm"
);
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index 0da3ae3..b7d6030 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -95,7 +95,7 @@ static void dcss_mkname(char *ascii_name, char *ebcdic_name)
if (ascii_name[i] == '\0')
break;
ebcdic_name[i] = toupper(ascii_name[i]);
- };
+ }
for (; i < 8; i++)
ebcdic_name[i] = ' ';
ASCEBC(ebcdic_name, 8);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 0fe8d5d..308d5e4 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -204,7 +204,7 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
break;
case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
zfcp_fsf_link_down_info_eval(req, NULL);
- };
+ }
}
static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 5843288..a598d77 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -654,7 +654,7 @@ static long openprom_ioctl(struct file * file,
default:
return -EINVAL;
- };
+ }
}
static long openprom_compat_ioctl(struct file *file, unsigned int cmd,
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 770c48d..203b0a5 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -472,7 +472,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost)
if (needs_restart)
aha1542_restart(shost);
return;
- };
+ }
mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_BUF_PA(&ccb[0]))) / sizeof(struct ccb);
mbistatus = mb[mbi].status;
@@ -552,7 +552,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost)
far as queuecommand is concerned */
my_done(SCtmp);
number_serviced++;
- };
+ }
}
static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
@@ -732,7 +732,7 @@ static void setup_mailboxes(int bse, struct Scsi_Host *shpnt)
for (i = 0; i < AHA1542_MAILBOXES; i++) {
mb[i].status = mb[AHA1542_MAILBOXES + i].status = 0;
any2scsi(mb[i].ccbptr, SCSI_BUF_PA(&ccb[i]));
- };
+ }
aha1542_intr_reset(bse); /* reset interrupts, so they don't block */
any2scsi((cmd + 2), SCSI_BUF_PA(mb));
aha1542_out(bse, cmd, 5);
@@ -752,7 +752,7 @@ static int __init aha1542_getconfig(int base_io, unsigned char *irq_level, unsig
i = inb(STATUS(base_io));
if (i & DF) {
i = inb(DATA(base_io));
- };
+ }
aha1542_out(base_io, inquiry_cmd, 1);
aha1542_in(base_io, inquiry_result, 3);
WAIT(INTRFLAGS(base_io), INTRMASK, HACC, 0);
@@ -782,7 +782,7 @@ fail:
default:
printk(KERN_ERR "Unable to determine Adaptec DMA priority. Disabling board\n");
return -1;
- };
+ }
switch (inquiry_result[1]) {
case 0x40:
*irq_level = 15;
@@ -805,7 +805,7 @@ fail:
default:
printk(KERN_ERR "Unable to determine Adaptec IRQ level. Disabling board\n");
return -1;
- };
+ }
*scsi_id = inquiry_result[2] & 7;
return 0;
}
@@ -838,7 +838,7 @@ static int __init aha1542_mbenable(int base)
aha1542_out(base, mbenable_cmd, 3);
WAIT(INTRFLAGS(base), INTRMASK, HACC, 0);
- };
+ }
while (0) {
fail:
printk(KERN_ERR "aha1542_mbenable: Mailbox init failed\n");
@@ -856,7 +856,7 @@ static int __init aha1542_query(int base_io, int *transl)
i = inb(STATUS(base_io));
if (i & DF) {
i = inb(DATA(base_io));
- };
+ }
aha1542_out(base_io, inquiry_cmd, 1);
aha1542_in(base_io, inquiry_result, 4);
WAIT(INTRFLAGS(base_io), INTRMASK, HACC, 0);
@@ -877,7 +877,7 @@ fail:
if (inquiry_result[0] == 0x43) {
printk(KERN_INFO "aha1542.c: Emulation mode not supported for AHA 174N hardware.\n");
return 1;
- };
+ }
/* Always call this - boards that do not support extended bios translation
will ignore the command, and we will set the proper default */
@@ -1001,7 +1001,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
case 10:
atbt = 0x03;
break;
- };
+ }
setup_dmaspeed[0] = atbt;
}
#endif
@@ -1177,7 +1177,7 @@ unregister:
scsi_unregister(shpnt);
continue;
- };
+ }
return count;
}
@@ -1498,7 +1498,7 @@ static int aha1542_old_abort(Scsi_Cmnd * SCpnt)
if (HOSTDATA(SCpnt->host)->mb[i].status) {
printk(KERN_ERR "OGMB still full - restarting\n");
aha1542_out(SCpnt->host->io_port, &ahacmd, 1);
- };
+ }
} else
printk(KERN_ERR "Other pending command %s\n",
SCpnt->request->rq_disk ?
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
index 232aff1..24678d5 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
@@ -400,7 +400,7 @@ aic_print_reg_dump_end(FILE *ofile, FILE *dfile,
if (num_entries != 0)
fprintf(dfile,
"\n"
-"};\n"
+"}\n"
"\n");
fprintf(dfile,
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 2f61a5a..bc9a22f 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -4330,7 +4330,7 @@ bfa_fcs_lport_ns_sm_online(struct bfa_fcs_lport_ns_s *ns,
bfa_sm_set_state(ns,
bfa_fcs_lport_ns_sm_sending_gid_ft);
bfa_fcs_lport_ns_send_gid_ft(ns, NULL);
- };
+ }
break;
default:
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index 2035b0d..90fbb00 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -2461,7 +2461,7 @@ bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport)
bfa_fcs_itnim_brp_online(rport->itnim);
if (!BFA_FCS_PID_IS_WKA(rport->pid))
bfa_fcs_rpf_rport_online(rport);
- };
+ }
wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
wwn2str(rpwwn_buf, rport->pwwn);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 69ac554..2ff684c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -889,7 +889,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
*/
if (interface->enabled)
fcoe_ctlr_link_up(ctlr);
- };
+ }
} else if (fcoe_ctlr_link_down(ctlr)) {
switch (cdev->enabled) {
case FCOE_CTLR_DISABLED:
@@ -909,7 +909,7 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
put_cpu();
fcoe_clean_pending_queue(lport);
wait_for_upload = 1;
- };
+ }
}
}
mutex_unlock(&bnx2fc_dev_lock);
@@ -2083,7 +2083,7 @@ static int bnx2fc_ctlr_enabled(struct fcoe_ctlr_device *cdev)
case FCOE_CTLR_UNUSED:
default:
return -ENOTSUPP;
- };
+ }
}
enum bnx2fc_create_link_state {
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 07453bb..514a6f3 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -2047,7 +2047,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
case FCOE_CTLR_ENABLED:
case FCOE_CTLR_UNUSED:
fcoe_ctlr_link_up(ctlr);
- };
+ }
} else if (fcoe_ctlr_link_down(ctlr)) {
switch (cdev->enabled) {
case FCOE_CTLR_DISABLED:
@@ -2059,7 +2059,7 @@ static int fcoe_device_notification(struct notifier_block *notifier,
stats->LinkFailureCount++;
put_cpu();
fcoe_clean_pending_queue(lport);
- };
+ }
}
out:
return rc;
@@ -2156,7 +2156,7 @@ static int fcoe_ctlr_enabled(struct fcoe_ctlr_device *cdev)
case FCOE_CTLR_UNUSED:
default:
return -ENOTSUPP;
- };
+ }
}
/**
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index c9382d6..d4ad9e3 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -324,7 +324,7 @@ static ssize_t store_ctlr_mode(struct device *dev,
default:
LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.");
return -ENOTSUPP;
- };
+ }
}
static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
@@ -350,7 +350,7 @@ static ssize_t store_ctlr_enabled(struct device *dev,
break;
case FCOE_CTLR_UNUSED:
return -ENOTSUPP;
- };
+ }
rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr);
if (rc)
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index bbf81ea..f232f62 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -422,7 +422,7 @@ static void fnic_notify_timer_start(struct fnic *fnic)
default:
/* Using intr for notification for INTx/MSI-X */
break;
- };
+ }
}
static int fnic_dev_wait(struct vnic_dev *vdev,
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 23f5ba5..59f68b1 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -176,7 +176,7 @@ static void ibmvfc_trc_start(struct ibmvfc_event *evt)
break;
default:
break;
- };
+ }
}
/**
@@ -215,7 +215,7 @@ static void ibmvfc_trc_end(struct ibmvfc_event *evt)
default:
break;
- };
+ }
}
#else
@@ -459,7 +459,7 @@ static int ibmvfc_set_host_state(struct ibmvfc_host *vhost,
default:
vhost->state = state;
break;
- };
+ }
return rc;
}
@@ -495,7 +495,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
break;
default:
break;
- };
+ }
break;
case IBMVFC_HOST_ACTION_TGT_INIT:
if (vhost->action == IBMVFC_HOST_ACTION_ALLOC_TGTS)
@@ -510,7 +510,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
default:
vhost->action = action;
break;
- };
+ }
break;
case IBMVFC_HOST_ACTION_LOGO:
case IBMVFC_HOST_ACTION_QUERY_TGTS:
@@ -521,7 +521,7 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,
default:
vhost->action = action;
break;
- };
+ }
}
/**
@@ -1593,7 +1593,7 @@ static inline int ibmvfc_host_chkready(struct ibmvfc_host *vhost)
case IBMVFC_ACTIVE:
result = 0;
break;
- };
+ }
return result;
}
@@ -1653,7 +1653,7 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
case MSG_ORDERED_TAG:
vfc_cmd->iu.pri_task_attr = IBMVFC_ORDERED_TASK;
break;
- };
+ }
}
if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev))))
@@ -1857,7 +1857,7 @@ static int ibmvfc_bsg_request(struct fc_bsg_job *job)
break;
default:
return -ENOTSUPP;
- };
+ }
if (port_id == -1)
return -EINVAL;
@@ -2232,7 +2232,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type)
return 0;
default:
return -EIO;
- };
+ }
}
sdev_printk(KERN_INFO, sdev, "Successfully cancelled outstanding commands\n");
@@ -2664,7 +2664,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
vhost->delay_init = 1;
__ibmvfc_reset_host(vhost);
break;
- };
+ }
break;
case IBMVFC_AE_LINK_UP:
@@ -2718,7 +2718,7 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq,
default:
dev_err(vhost->dev, "Unknown async event received: %lld\n", crq->event);
break;
- };
+ }
}
/**
@@ -3386,7 +3386,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt)
ibmvfc_get_cmd_error(rsp->status, rsp->error),
rsp->status, rsp->error, status);
break;
- };
+ }
kref_put(&tgt->kref, ibmvfc_release_tgt);
ibmvfc_free_event(evt);
@@ -3482,7 +3482,7 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt)
ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type,
ibmvfc_get_ls_explain(rsp->fc_explain), rsp->fc_explain, status);
break;
- };
+ }
kref_put(&tgt->kref, ibmvfc_release_tgt);
ibmvfc_free_event(evt);
@@ -3553,7 +3553,7 @@ static void ibmvfc_tgt_implicit_logout_done(struct ibmvfc_event *evt)
default:
tgt_err(tgt, "Implicit Logout failed: rc=0x%02X\n", status);
break;
- };
+ }
if (vhost->action == IBMVFC_HOST_ACTION_TGT_INIT)
ibmvfc_init_tgt(tgt, ibmvfc_tgt_send_plogi);
@@ -3657,7 +3657,7 @@ static void ibmvfc_tgt_adisc_done(struct ibmvfc_event *evt)
ibmvfc_get_fc_type(fc_reason), fc_reason,
ibmvfc_get_ls_explain(fc_explain), fc_explain, status);
break;
- };
+ }
kref_put(&tgt->kref, ibmvfc_release_tgt);
ibmvfc_free_event(evt);
@@ -3869,7 +3869,7 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt)
ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type,
ibmvfc_get_gs_explain(rsp->fc_explain), rsp->fc_explain, status);
break;
- };
+ }
kref_put(&tgt->kref, ibmvfc_release_tgt);
ibmvfc_free_event(evt);
@@ -4270,7 +4270,7 @@ static int __ibmvfc_work_to_do(struct ibmvfc_host *vhost)
case IBMVFC_HOST_ACTION_REENABLE:
default:
break;
- };
+ }
return 1;
}
@@ -4498,7 +4498,7 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
break;
default:
break;
- };
+ }
spin_unlock_irqrestore(vhost->host->host_lock, flags);
}
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index bf9eca8..234a307 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -275,7 +275,7 @@ static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
return -EIO;
}
}
- };
+ }
rest -= mlen;
}
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 36ac1c3..4fda95d 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1119,7 +1119,7 @@ static void ipr_update_ata_class(struct ipr_resource_entry *res, unsigned int pr
default:
res->ata_class = ATA_DEV_UNKNOWN;
break;
- };
+ }
}
/**
@@ -5647,7 +5647,7 @@ static u8 ipr_get_task_attributes(struct scsi_cmnd *scsi_cmd)
case MSG_ORDERED_TAG:
rc = IPR_FLAGS_LO_ORDERED_TASK;
break;
- };
+ }
}
return rc;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 0665f9c..da0bec2 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -1260,7 +1260,7 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
* ---> AutoSCSI with MSGOUTreg is processed.
*/
data->msgout_len = 0;
- };
+ }
nsp32_dbg(NSP32_DEBUG_INTR, "MsgOut phase processed");
}
@@ -1855,7 +1855,7 @@ static void nsp32_msgout_occur(struct scsi_cmnd *SCpnt)
nsp32_dbg(NSP32_DEBUG_MSGOUTOCCUR, "bus: 0x%x\n",
nsp32_read1(base, SCSI_BUS_MONITOR));
- };
+ }
data->msgout_len = 0;
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 1eb7b028..66ebbe1 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3186,7 +3186,7 @@ static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
case MSG_ORDERED_TAG:
rc = TASK_TAG_ORDERED;
break;
- };
+ }
}
return rc;
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 6d48d30..96794c4 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1139,7 +1139,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
case COMMAND_ERROR:
case COMMAND_PARAM_ERROR:
break;
- };
+ }
sbus_writew(0, qpti->qregs + SBUS_SEMAPHORE);
}
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c
index 6209110..878c96b 100644
--- a/drivers/scsi/scsi_tgt_if.c
+++ b/drivers/scsi/scsi_tgt_if.c
@@ -253,7 +253,7 @@ static ssize_t tgt_write(struct file *file, const char __user * buffer,
tgt_ring_idx_inc(ring);
event_recv_msg(ev);
ev->hdr.status = 0;
- };
+ }
return count;
}
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index a464d95..50666c5 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -187,7 +187,7 @@ static inline void init_hpc_chain(struct ip22_hostdata *hdata)
hcp++;
dma += sizeof(struct hpc_chunk);
start += sizeof(struct hpc_chunk);
- };
+ }
hcp--;
hcp->desc.pnext = hdata->dma;
}
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c b/drivers/scsi/sym53c8xx_2/sym_fw.c
index 190770b..a804179 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -386,7 +386,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
sym_name(np), (int) (cur-start));
++cur;
continue;
- };
+ }
/*
* We use the bogus value 0xf00ff00f ;-)
@@ -494,7 +494,7 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
default:
relocs = 0;
break;
- };
+ }
/*
* Scriptify:) the opcode.
@@ -550,5 +550,5 @@ void sym_fw_bind_script(struct sym_hcb *np, u32 *start, int len)
*cur++ = cpu_to_scr(new);
}
- };
+ }
}
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 14e0c40..7fafe77 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -379,7 +379,7 @@ static int ultrastor_14f_detect(struct scsi_host_template * tpnt)
if(!request_region(PORT_OVERRIDE, 0xc, "ultrastor")) {
printk("Ultrastor I/O space already in use\n");
return FALSE;
- };
+ }
config.port_address = PORT_OVERRIDE;
#else
for (i = 0; i < ARRAY_SIZE(ultrastor_ports_14f); i++) {
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
index a2e61c2..61ac167 100644
--- a/drivers/staging/iio/adc/ad7291.c
+++ b/drivers/staging/iio/adc/ad7291.c
@@ -290,7 +290,7 @@ static int ad7291_read_event_value(struct iio_dev *indio_dev,
return 0;
default:
return -EINVAL;
- };
+ }
}
static int ad7291_write_event_value(struct iio_dev *indio_dev,
diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c
index f4a0341..618d820 100644
--- a/drivers/staging/iio/cdc/ad7150.c
+++ b/drivers/staging/iio/cdc/ad7150.c
@@ -300,7 +300,7 @@ static int ad7150_read_event_value(struct iio_dev *indio_dev,
default:
return -EINVAL;
- };
+ }
}
static int ad7150_write_event_value(struct iio_dev *indio_dev,
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index 33d6525..59dd4d5 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -696,7 +696,7 @@ static int imx_tve_probe(struct platform_device *pdev)
if (val != 0x00100000) {
dev_err(&pdev->dev, "configuration register default value indicates this is not a TVEv2\n");
return -ENODEV;
- };
+ }
/* disable cable detection for VGA mode */
ret = regmap_write(tve->regmap, TVE_CD_CONT_REG, 0);
diff --git a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
index 18e1b47..5e10720 100644
--- a/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
+++ b/drivers/staging/lustre/lustre/lvfs/lvfs_linux.c
@@ -278,7 +278,7 @@ __s64 lprocfs_read_helper(struct lprocfs_counter *lc,
break;
default:
break;
- };
+ }
return ret;
}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
index 6547f46..316103a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c
@@ -207,7 +207,7 @@ static void enc_pools_release_free_pages(long npages)
p_idx++;
g_idx = 0;
}
- };
+ }
/* free unused pools */
while (p_idx_max1 < p_idx_max2) {
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 2011657..40b7290 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1583,7 +1583,7 @@ _func_enter_;
pfhdr->attrib.icv_len = pnfhdr->attrib.icv_len;
plist = get_next(plist);
- };
+ }
/* free the defrag_q queue and return the prframe */
rtw_free_recvframe_queue(defrag_q, pfree_recv_queue);
diff --git a/drivers/staging/rtl8188eu/hal/hal_com.c b/drivers/staging/rtl8188eu/hal/hal_com.c
index 829b900..e05a45a 100644
--- a/drivers/staging/rtl8188eu/hal/hal_com.c
+++ b/drivers/staging/rtl8188eu/hal/hal_com.c
@@ -225,7 +225,7 @@ static void two_out_pipe(struct adapter *adapter, bool wifi_cfg)
if (wifi_cfg) { /* WMM */
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
- /* 0, 1, 0, 1, 0, 0, 0, 0, 0}; */
+ /* 0, 1, 0, 1, 0, 0, 0, 0, 0} */
/* 0:H, 1:L */
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
@@ -261,7 +261,7 @@ static void three_out_pipe(struct adapter *adapter, bool wifi_cfg)
if (wifi_cfg) {/* for WMM */
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
- /* 1, 2, 1, 0, 0, 0, 0, 0, 0}; */
+ /* 1, 2, 1, 0, 0, 0, 0, 0, 0} */
/* 0:H, 1:N, 2:L */
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index e068443..68d60aa 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1890,7 +1890,7 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
ret = rtl8192_tx(dev, skb);
if (ret != 0) {
kfree_skb(skb);
- };
+ }
if (queue_index != MGNT_QUEUE) {
priv->rtllib->stats.tx_bytes += (skb->len -
@@ -1932,7 +1932,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
ret = rtl8192_tx(dev, skb);
if (ret != 0) {
kfree_skb(skb);
- };
+ }
}
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index e51b09a..6438371 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1025,7 +1025,7 @@ static void tgt_agent_fetch_work(struct work_struct *work)
agent->state = AGENT_STATE_SUSPENDED;
spin_unlock_bh(&agent->lock);
- };
+ }
}
static struct sbp_target_agent *sbp_target_agent_register(
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index d6080c3..cd04293 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -959,7 +959,7 @@ static int receive_flow_control(struct nozomi *dc)
dev_err(&dc->pdev->dev,
"ERROR: flow control received for non-existing port\n");
return 0;
- };
+ }
DBG1("0x%04X->0x%04X", *((u16 *)&dc->port[port].ctrl_dl),
*((u16 *)&ctrl_dl));
@@ -1025,7 +1025,7 @@ static enum ctrl_port_type port2ctrl(enum port_type port,
dev_err(&dc->pdev->dev,
"ERROR: send flow control " \
"received for non-existing port\n");
- };
+ }
return CTRL_ERROR;
}
@@ -1805,7 +1805,7 @@ static int ntty_ioctl(struct tty_struct *tty,
default:
DBG1("ERR: 0x%08X, %d", cmd, cmd);
break;
- };
+ }
return rval;
}
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 3c75e8e..99653e7 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -680,7 +680,7 @@ static int bfin_serial_startup(struct uart_port *port)
default:
uart_dma_ch_rx = uart_dma_ch_tx = 0;
break;
- };
+ }
if (uart_dma_ch_rx &&
request_dma(uart_dma_ch_rx, "BFIN_UART_RX") < 0) {
@@ -765,7 +765,7 @@ static void bfin_serial_shutdown(struct uart_port *port)
break;
default:
break;
- };
+ }
#endif
free_irq(uart->rx_irq, uart);
free_irq(uart->tx_irq, uart);
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index cb3c81e..1d94205 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -832,7 +832,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag,
up->curregs[5] |= Tx8;
up->parity_mask = 0xff;
break;
- };
+ }
up->curregs[4] &= ~0x0c;
if (cflag & CSTOPB)
up->curregs[4] |= SB2;
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index b2e707a..8d71e40 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -690,7 +690,7 @@ static void max310x_handle_tx(struct uart_port *port)
max310x_port_write(port, MAX310X_THR_REG,
xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
- };
+ }
}
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index f87f1a0..95917ce 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1072,7 +1072,7 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag,
uap->curregs[5] |= Tx8;
uap->parity_mask = 0xff;
break;
- };
+ }
uap->curregs[4] &= ~(SB_MASK);
if (cflag & CSTOPB)
uap->curregs[4] |= SB2;
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5d6136b..380fb53 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -894,7 +894,7 @@ static int sunsab_console_setup(struct console *con, char *options)
case B115200: baud = 115200; break;
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
- };
+ }
/*
* Temporary fix.
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 699cc1b..db79b76 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -522,7 +522,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, int is_break)
serio_interrupt(&up->serio, ch, 0);
#endif
break;
- };
+ }
}
} while (serial_in(up, UART_LSR) & UART_LSR_DR);
}
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index 135a152..45a8c6a 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -319,7 +319,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up,
serio_interrupt(&up->serio, ch, 0);
#endif
break;
- };
+ }
}
}
@@ -897,7 +897,7 @@ sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag,
up->curregs[R5] |= Tx8;
up->parity_mask = 0xff;
break;
- };
+ }
up->curregs[R4] &= ~0x0c;
if (cflag & CSTOPB)
up->curregs[R4] |= SB2;
@@ -1239,7 +1239,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
default: case B9600: baud = 9600; break;
case B19200: baud = 19200; break;
case B38400: baud = 38400; break;
- };
+ }
brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 8831748..2fd1e17 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -269,7 +269,7 @@ static unsigned int qe_uart_tx_empty(struct uart_port *port)
return 1;
bdp++;
- };
+ }
}
/*
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d6a8d23..b915cac 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1813,7 +1813,7 @@ rescan:
s = "-intr"; break;
default:
s = "-iso"; break;
- };
+ }
s;
}));
usb_put_urb (urb);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e6b682c..c95e2fc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -433,7 +433,7 @@ static void set_port_led(
case HUB_LED_OFF: s = "off"; break;
case HUB_LED_AUTO: s = "auto"; break;
default: s = "??"; break;
- }; s; }),
+ } s; }),
status);
}
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 7fa93f4..95f7649 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -352,7 +352,7 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc,
break;
default:
return -EINVAL;
- };
+ }
response_pkt = (__le16 *) dwc->setup_buf;
*response_pkt = cpu_to_le16(usb_status);
@@ -470,7 +470,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
default:
return -EINVAL;
- };
+ }
return 0;
}
@@ -709,7 +709,7 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
dev_vdbg(dwc->dev, "Forwarding to gadget driver\n");
ret = dwc3_ep0_delegate_req(dwc, ctrl);
break;
- };
+ }
return ret;
}
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index d4f0f33..3e7ae70 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -354,7 +354,7 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,
return DIV_ROUND_UP(val, 8);
default:
return DIV_ROUND_UP(val, 2);
- };
+ }
}
static int config_buf(struct usb_configuration *config,
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index b8a2376..8f4dae3 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -544,7 +544,7 @@ static int dummy_enable(struct usb_ep *_ep,
default:
val = "ctrl";
break;
- }; val; }),
+ } val; }),
max, ep->stream_en ? "enabled" : "disabled");
/* at this point real hardware should be NAKing transfers
@@ -2271,7 +2271,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb)
default:
s = "?";
break;
- }; s; }),
+ } s; }),
ep, ep ? (usb_pipein(urb->pipe) ? "in" : "out") : "",
({ char *s; \
switch (usb_pipetype(urb->pipe)) { \
@@ -2287,7 +2287,7 @@ static inline ssize_t show_urb(char *buf, size_t size, struct urb *urb)
default: \
s = "-iso"; \
break; \
- }; s; }),
+ } s; }),
urb->actual_length, urb->transfer_buffer_length);
}
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index c64deb9..ef7ba00 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1165,7 +1165,7 @@ static int udc_proc_read(struct seq_file *m, void *v)
s = "invalid"; break;
default:
s = "?"; break;
- }; s; }),
+ } s; }),
(tmp & EPxSTATUS_TOGGLE) ? "data1" : "data0",
(tmp & EPxSTATUS_SUSPEND) ? " suspend" : "",
(tmp & EPxSTATUS_FIFO_DISABLE) ? " disable" : "",
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 0781bff..80d527f 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -129,7 +129,7 @@ static char *type_string (u8 bmAttributes)
case USB_ENDPOINT_XFER_BULK: return "bulk";
case USB_ENDPOINT_XFER_ISOC: return "iso";
case USB_ENDPOINT_XFER_INT: return "intr";
- };
+ }
return "control";
}
#endif
@@ -1630,7 +1630,7 @@ static ssize_t queues_show(struct device *_dev, struct device_attribute *attr,
val = "intr"; break;
default:
val = "iso"; break;
- }; val; }),
+ } val; }),
usb_endpoint_maxp (d) & 0x1fff,
ep->dma ? "dma" : "pio", ep->fifo_size
);
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index 9575085..a3ad732 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -1068,7 +1068,7 @@ static int rndis_proc_show(struct seq_file *m, void *v)
s = "RNDIS_INITIALIZED"; break;
case RNDIS_DATA_INITIALIZED:
s = "RNDIS_DATA_INITIALIZED"; break;
- }; s; }),
+ } s; }),
param->medium,
(param->media_state) ? 0 : param->speed*100,
(param->media_state) ? "disconnected" : "connected",
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 0ff3339..eccea1d 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -472,7 +472,7 @@ static int usbg_bot_setup(struct usb_function *f,
bot_enqueue_cmd_cbw(fu);
return 0;
break;
- };
+ }
return -ENOTSUPP;
}
@@ -617,7 +617,7 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req)
default:
BUG();
- };
+ }
return;
cleanup:
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index aa5b603..da7d7fc 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -379,7 +379,7 @@ struct debug_buffer {
case QH_LOW_SPEED: tmp = 'l'; break; \
case QH_HIGH_SPEED: tmp = 'h'; break; \
default: tmp = '?'; break; \
- }; tmp; })
+ } tmp; })
static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
{
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index fce13bc..55486bd 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -412,7 +412,7 @@ struct debug_buffer {
tmp = 'h'; break; \
default: \
tmp = '?'; break; \
- }; tmp; })
+ } tmp; })
static inline char token_mark(struct fotg210_hcd *fotg210, __hc32 token)
{
diff --git a/drivers/usb/host/fusbh200-hcd.c b/drivers/usb/host/fusbh200-hcd.c
index 299253c..e1c6d85 100644
--- a/drivers/usb/host/fusbh200-hcd.c
+++ b/drivers/usb/host/fusbh200-hcd.c
@@ -402,7 +402,7 @@ struct debug_buffer {
case QH_LOW_SPEED: tmp = 'l'; break; \
case QH_HIGH_SPEED: tmp = 'h'; break; \
default: tmp = '?'; break; \
- }; tmp; })
+ } tmp; })
static inline char token_mark(struct fusbh200_hcd *fusbh200, __hc32 token)
{
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 6f29aba..935a2dd 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -2108,7 +2108,7 @@ static int isp1362_show(struct seq_file *s, void *unused)
default:
s = "?";
break;
- };
+ }
s;}), ep->maxpacket) ;
list_for_each_entry(urb, &ep->hep->urb_list, urb_list) {
seq_printf(s, " urb%p, %d/%d\n", urb,
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 31b81f9..3fca52e 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -17,7 +17,7 @@
case PIPE_BULK: temp = "bulk"; break; \
case PIPE_INTERRUPT: temp = "intr"; break; \
default: temp = "isoc"; break; \
- }; temp;})
+ } temp;})
#define pipestring(pipe) edstring(usb_pipetype(pipe))
/* debug| print the main components of an URB
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 5477bf5..79620c3 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1413,7 +1413,7 @@ static int sl811h_show(struct seq_file *s, void *unused)
case SL11H_CTL1MASK_SE0: s = " se0/reset"; break;
case SL11H_CTL1MASK_K: s = " k/resume"; break;
default: s = "j"; break;
- }; s; }),
+ } s; }),
(t & SL11H_CTL1MASK_LSPD) ? " lowspeed" : "",
(t & SL11H_CTL1MASK_SUSPEND) ? " suspend" : "");
@@ -1446,7 +1446,7 @@ static int sl811h_show(struct seq_file *s, void *unused)
case USB_PID_SETUP: s = "setup"; break;
case USB_PID_ACK: s = "status"; break;
default: s = "?"; break;
- }; s;}),
+ } s;}),
ep->maxpacket,
ep->nak_count, ep->error_count);
list_for_each_entry (urb, &ep->hep->urb_list, urb_list) {
diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
index 0f228c4..66edbb2 100644
--- a/drivers/usb/host/uhci-pci.c
+++ b/drivers/usb/host/uhci-pci.c
@@ -178,7 +178,7 @@ static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n");
rc = -EBUSY;
goto done;
- };
+ }
/* All PCI host controllers are required to disable IRQ generation
* at the source, so we must turn off PIRQ.
diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c
index ecc88db..1b0888f 100644
--- a/drivers/usb/host/whci/hcd.c
+++ b/drivers/usb/host/whci/hcd.c
@@ -134,7 +134,7 @@ static int whc_urb_enqueue(struct usb_hcd *usb_hcd, struct urb *urb,
default:
ret = asl_urb_enqueue(whc, urb, mem_flags);
break;
- };
+ }
return ret;
}
@@ -160,7 +160,7 @@ static int whc_urb_dequeue(struct usb_hcd *usb_hcd, struct urb *urb, int status)
default:
ret = asl_urb_dequeue(whc, urb, status);
break;
- };
+ }
return ret;
}
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 18e877f..093982a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -617,7 +617,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
/* case 3 << MUSB_DEVCTL_VBUS_SHIFT: */
default:
s = "VALID"; break;
- }; s; }),
+ } s; }),
VBUSERR_RETRY_COUNT - musb->vbuserr_retry,
musb->port1_status);
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index bd4138d..1a5574c 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -443,7 +443,7 @@ static int get_musb_port_mode(struct device *dev)
case USB_DR_MODE_OTG:
default:
return MUSB_PORT_MODE_DUAL_ROLE;
- };
+ }
}
static int dsps_create_musb_pdev(struct dsps_glue *glue,
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index b19ed21..b806698 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1121,7 +1121,7 @@ static int musb_gadget_enable(struct usb_ep *ep,
case USB_ENDPOINT_XFER_BULK: s = "bulk"; break;
case USB_ENDPOINT_XFER_INT: s = "int"; break;
default: s = "iso"; break;
- }; s; }),
+ } s; }),
musb_ep->is_in ? "IN" : "OUT",
musb_ep->dma ? "dma, " : "",
musb_ep->packet_sz);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 9a2b8c8..6582a20 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -253,7 +253,7 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh)
case USB_ENDPOINT_XFER_BULK: s = "-bulk"; break;
case USB_ENDPOINT_XFER_ISOC: s = "-iso"; break;
default: s = "-intr"; break;
- }; s; }),
+ } s; }),
epnum, buf + offset, len);
/* Configure endpoint */
diff --git a/drivers/usb/phy/phy-twl4030-usb.c b/drivers/usb/phy/phy-twl4030-usb.c
index 90730c8..2da8b2f 100644
--- a/drivers/usb/phy/phy-twl4030-usb.c
+++ b/drivers/usb/phy/phy-twl4030-usb.c
@@ -337,7 +337,7 @@ static void twl4030_usb_set_mode(struct twl4030_usb *twl, int mode)
dev_err(twl->dev, "unsupported T2 transceiver mode %d\n",
mode);
break;
- };
+ }
}
static void twl4030_i2c_access(struct twl4030_usb *twl, int on)
diff --git a/drivers/usb/phy/phy-ulpi-viewport.c b/drivers/usb/phy/phy-ulpi-viewport.c
index 7c22a539..18bb826 100644
--- a/drivers/usb/phy/phy-ulpi-viewport.c
+++ b/drivers/usb/phy/phy-ulpi-viewport.c
@@ -36,7 +36,7 @@ static int ulpi_viewport_wait(void __iomem *view, u32 mask)
return 0;
udelay(1);
- };
+ }
return -ETIMEDOUT;
}
diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
index 7f78f30..010f990 100644
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -208,9 +208,9 @@ static int cbaf_check(struct cbaf *cbaf)
ar_name = "ASSOCIATE";
ar_assoc = 1;
break;
- };
+ }
break;
- };
+ }
dev_dbg(dev, "Association request #%02u: 0x%04x/%04x "
"(%zu bytes): %s\n",
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 33a1278..e538b72 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -973,7 +973,7 @@ int wusb_usb_ncb(struct notifier_block *nb, unsigned long val,
default:
WARN_ON(1);
result = NOTIFY_BAD;
- };
+ }
return result;
}
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c
index 6ad02f5..8ac7712 100644
--- a/drivers/usb/wusbcore/wa-xfer.c
+++ b/drivers/usb/wusbcore/wa-xfer.c
@@ -429,7 +429,7 @@ static ssize_t __wa_xfer_setup_sizes(struct wa_xfer *xfer,
/* never happens */
BUG();
result = -EINVAL; /* shut gcc up */
- };
+ }
xfer->is_inbound = urb->pipe & USB_DIR_IN ? 1 : 0;
xfer->is_dma = urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP ? 1 : 0;
xfer->seg_size = le16_to_cpu(rpipe->descr.wBlocks)
@@ -488,7 +488,7 @@ static void __wa_xfer_setup_hdr0(struct wa_xfer *xfer,
printk(KERN_ERR "FIXME: ISOC not implemented\n");
default:
BUG();
- };
+ }
}
/*
diff --git a/drivers/uwb/i1480/dfu/mac.c b/drivers/uwb/i1480/dfu/mac.c
index 6ec14f5..e347981f4 100644
--- a/drivers/uwb/i1480/dfu/mac.c
+++ b/drivers/uwb/i1480/dfu/mac.c
@@ -138,7 +138,7 @@ int fw_hdrs_load(struct i1480 *i1480, struct fw_hdr **phdr,
*prev_hdr = hdr;
prev_hdr = &hdr->next;
hdr_cnt++;
- };
+ }
*prev_hdr = NULL;
return 0;
diff --git a/drivers/uwb/ie.c b/drivers/uwb/ie.c
index 902b0f2..c1e8c1a 100644
--- a/drivers/uwb/ie.c
+++ b/drivers/uwb/ie.c
@@ -91,7 +91,7 @@ int uwb_ie_dump_hex(const struct uwb_ie_hdr *ies, size_t len,
r += scnprintf(buf + r, size - r, " %02x", (unsigned)*d++);
if (r < size)
buf[r++] = '\n';
- };
+ }
return r;
}
diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c
index baed57d..a2bb276 100644
--- a/drivers/video/cfbimgblt.c
+++ b/drivers/video/cfbimgblt.c
@@ -181,7 +181,7 @@ static inline void slow_imageblit(const struct fb_image *image, struct fb_info *
}
shift += bpp;
shift &= (32 - 1);
- if (!l) { l = 8; s++; };
+ if (!l) { l = 8; s++; }
}
/* write trailing bits */
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index ed3b889..e220e69 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -330,7 +330,7 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
default:
ret = -ENOSYS;
break;
- };
+ }
if (!ret) {
sbus_writeb(cur_mode, ®s->mcr);
par->mode = mode;
@@ -343,7 +343,7 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
FBTYPE_MDICOLOR, 8,
info->fix.smem_len);
break;
- };
+ }
return ret;
}
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 3545dec..f50f61c 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -624,7 +624,7 @@ static void cg6_init_fix(struct fb_info *info, int linebytes)
default:
cg6_cpu_name = "i386";
break;
- };
+ }
if (((conf >> CG6_FHC_REV_SHIFT) & CG6_FHC_REV_MASK) >= 11) {
if (info->fix.smem_len <= 0x100000)
cg6_card_name = "TGX";
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c
index 520fc9b..9b32165 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -667,7 +667,7 @@ int exynos_mipi_dsi_init_dsim(struct mipi_dsim_device *dsim)
default:
dev_info(dsim->dev, "data lane is invalid.\n");
return -EINVAL;
- };
+ }
exynos_mipi_dsi_sw_reset(dsim);
exynos_mipi_dsi_func_reset(dsim);
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 6dd7225..6c71bb6 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1102,7 +1102,7 @@ static int fsl_diu_cursor(struct fb_info *info, struct fb_cursor *cursor)
fsl_diu_load_cursor_image(info, image, bg, fg,
cursor->image.width, cursor->image.height);
- };
+ }
/*
* Show or hide the cursor. The cursor data is always stored in the
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index b17f500..c36f013 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -469,7 +469,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
default:
continue;
- };
+ }
sbus_writel(0x5800 + j, &lx_krn->krn_type);
sbus_writel(wi->wi_values[0], &lx_krn->krn_value);
}
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c
index 1717623..a01147f 100644
--- a/drivers/video/matrox/matroxfb_DAC1064.c
+++ b/drivers/video/matrox/matroxfb_DAC1064.c
@@ -494,7 +494,7 @@ static int m1064_compute(void* out, struct my_timming* m) {
if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40)
break;
udelay(10);
- };
+ }
CRITEND
@@ -639,7 +639,7 @@ static void MGAG100_progPixClock(const struct matrox_fb_info *minfo, int flags,
if (inDAC1064(minfo, M1064_XPIXPLLSTAT) & 0x40)
break;
udelay(10);
- };
+ }
if (!clk)
printk(KERN_ERR "matroxfb: Pixel PLL%c not locked after usual time\n", (reg-M1064_XPIXPLLAM-2)/4 + 'A');
selClk = inDAC1064(minfo, M1064_XPIXCLKCTRL) & ~M1064_XPIXCLKCTRL_SRC_MASK;
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c
index 9a44cec..195ad7c 100644
--- a/drivers/video/matrox/matroxfb_Ti3026.c
+++ b/drivers/video/matrox/matroxfb_Ti3026.c
@@ -473,7 +473,7 @@ static void ti3026_setMCLK(struct matrox_fb_info *minfo, int fout)
if (inTi3026(minfo, TVP3026_XPIXPLLDATA) & 0x40)
break;
udelay(10);
- };
+ }
if (!tmout)
printk(KERN_ERR "matroxfb: Temporary pixel PLL not locked after 5 secs\n");
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c
index ed20a98..81c80ac 100644
--- a/drivers/video/nvidia/nv_hw.c
+++ b/drivers/video/nvidia/nv_hw.c
@@ -1300,7 +1300,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state)
break;
default:
break;
- };
+ }
NV_WR32(par->PGRAPH, 0x0b38, 0x2ffff800);
NV_WR32(par->PGRAPH, 0x0b3c, 0x00006000);
diff --git a/drivers/video/omap2/displays-new/panel-dsi-cm.c b/drivers/video/omap2/displays-new/panel-dsi-cm.c
index aaaea64..b7baafe 100644
--- a/drivers/video/omap2/displays-new/panel-dsi-cm.c
+++ b/drivers/video/omap2/displays-new/panel-dsi-cm.c
@@ -599,7 +599,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r) {
dev_err(&ddata->pdev->dev, "failed to configure DSI pins\n");
goto err0;
- };
+ }
r = in->ops.dsi->set_config(in, &dsi_config);
if (r) {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 4779750..96a1ea3 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2918,7 +2918,7 @@ static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
break;
default:
BUG();
- };
+ }
l = dispc_read_reg(DISPC_POL_FREQ(channel));
l |= FLD_VAL(onoff, 17, 17);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a598b58..b79f2aa 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4066,7 +4066,7 @@ static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
default:
r = -EINVAL;
goto err_pix_fmt;
- };
+ }
dsi_if_enable(dsidev, false);
dsi_vc_enable(dsidev, channel, false);
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 296afae..a350209 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -186,7 +186,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
}
default:
return -EINVAL;
- };
+ }
}
EXPORT_SYMBOL(sbusfb_ioctl_helper);
diff --git a/drivers/video/sysimgblt.c b/drivers/video/sysimgblt.c
index 186c6f6..a4d05b1 100644
--- a/drivers/video/sysimgblt.c
+++ b/drivers/video/sysimgblt.c
@@ -152,7 +152,7 @@ static void slow_imageblit(const struct fb_image *image, struct fb_info *p,
}
shift += bpp;
shift &= (32 - 1);
- if (!l) { l = 8; s++; };
+ if (!l) { l = 8; s++; }
}
/* write trailing bits */
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index c000852..634f60e 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -232,7 +232,7 @@ tcx_blank(int blank, struct fb_info *info)
case FB_BLANK_POWERDOWN: /* Poweroff */
break;
- };
+ }
sbus_writel(val, &thc->thc_misc);
@@ -434,7 +434,7 @@ static int tcx_probe(struct platform_device *op)
default:
j = i;
break;
- };
+ }
par->mmap_map[i].poff = op->resource[j].start;
}
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index 897484903..b30e5a4 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -365,7 +365,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
if (!fb_mem_virt) {
pr_err("%s: Failed to allocate framebuffer\n", __func__);
return -ENOMEM;
- };
+ }
fbi->fb.fix.smem_start = fb_mem_phys;
fbi->fb.fix.smem_len = fb_mem_len;
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 3dd8ed2..c341630 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -141,7 +141,7 @@ static long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
default:
return -EINVAL;
- };
+ }
return 0;
}
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 94de6d1..0573986 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -158,7 +158,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,
default:
p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
type, stat->extension);
- };
+ }
*rdev = MKDEV(major, minor);
} else
res |= S_IFREG;
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 74e397d..a04aecd 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -499,7 +499,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
"for key of size %d", bufsize, keylen);
brelse(this_node->bh);
goto error_alloc;
- };
+ }
strncpy(keybuf, keystart, keylen);
*value = fs64_to_cpu(sb, valarray[cur_key]);
diff --git a/fs/btrfs/print-tree.c b/fs/btrfs/print-tree.c
index 0088bed..9328b1e 100644
--- a/fs/btrfs/print-tree.c
+++ b/fs/btrfs/print-tree.c
@@ -305,7 +305,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
print_uuid_item(l, btrfs_item_ptr_offset(l, i),
btrfs_item_size_nr(l, i));
break;
- };
+ }
}
}
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 9d61947..73d3715 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -577,7 +577,7 @@ void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
lock = 1;
reply = 1;
break;
- };
+ }
spin_lock(&ls->ls_recover_lock);
status = ls->ls_recover_status;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index e2e0a90..a58b014 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -320,7 +320,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major),
be32_to_cpu(str->di_minor));
break;
- };
+ }
i_uid_write(&ip->i_inode, be32_to_cpu(str->di_uid));
i_gid_write(&ip->i_inode, be32_to_cpu(str->di_gid));
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index ced3257..dbe0346 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1351,7 +1351,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
error = -EEXIST;
default:
goto out_gunlock;
- };
+ }
if (odip != ndip) {
if (!ndip->i_inode.i_nlink) {
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 963b2d7..c1530b9 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -482,7 +482,7 @@ void gfs2_recover_func(struct work_struct *work)
default:
goto fail;
- };
+ }
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
LM_FLAG_NOEXP | GL_NOCACHE, &ji_gh);
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c
index 4d0a1af..24406c3 100644
--- a/fs/hpfs/buffer.c
+++ b/fs/hpfs/buffer.c
@@ -25,7 +25,7 @@ void hpfs_prefetch_sectors(struct super_block *s, unsigned secno, int n)
return;
}
brelse(bh);
- };
+ }
blk_start_plug(&plug);
while (n > 0) {
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index a6597d6..bea0487 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1275,7 +1275,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
if ((c->flash_size % c->sector_size) != 0) {
c->flash_size = (c->flash_size / c->sector_size) * c->sector_size;
pr_warn("flash size adjusted to %dKiB\n", c->flash_size);
- };
+ }
c->wbuf_ofs = 0xFFFFFFFF;
c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 00ec0b9..33ed56b 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -468,7 +468,7 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
* struct nlm4_holder holder;
* default:
* void;
- * };
+ * }
*
* struct nlm4_testres {
* netobj cookie;
@@ -500,7 +500,7 @@ static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
* struct nlm4_holder holder;
* default:
* void;
- * };
+ * }
*
* struct nlm4_testres {
* netobj cookie;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 9a55797..5629a8e 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -461,7 +461,7 @@ static void nlm_xdr_enc_res(struct rpc_rqst *req,
* struct nlm_holder holder;
* default:
* void;
- * };
+ * }
*
* struct nlm_testres {
* netobj cookie;
@@ -498,7 +498,7 @@ static void nlm_xdr_enc_testres(struct rpc_rqst *req,
* struct nlm_holder holder;
* default:
* void;
- * };
+ * }
*
* struct nlm_testres {
* netobj cookie;
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 62db136..910b1ef 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -479,7 +479,7 @@ out_overflow:
* fattr attributes;
* default:
* void;
- * };
+ * }
*/
static int decode_attrstat(struct xdr_stream *xdr, struct nfs_fattr *result)
{
@@ -524,7 +524,7 @@ static void encode_diropargs(struct xdr_stream *xdr, const struct nfs_fh *fh,
* } diropok;
* default:
* void;
- * };
+ * }
*/
static int decode_diropok(struct xdr_stream *xdr, struct nfs_diropok *result)
{
@@ -825,7 +825,7 @@ static int nfs2_xdr_dec_diropres(struct rpc_rqst *req, struct xdr_stream *xdr,
* path data;
* default:
* void;
- * };
+ * }
*/
static int nfs2_xdr_dec_readlinkres(struct rpc_rqst *req,
struct xdr_stream *xdr, void *__unused)
@@ -854,7 +854,7 @@ out_default:
* nfsdata data;
* default:
* void;
- * };
+ * }
*/
static int nfs2_xdr_dec_readres(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_readres *result)
@@ -966,7 +966,7 @@ out_overflow:
* } readdirok;
* default:
* void;
- * };
+ * }
*
* Read the directory contents into the page cache, but don't
* touch them. The actual decoding is done by nfs2_decode_dirent()
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index fa6d721..1809447 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -512,42 +512,42 @@ static __be32 *xdr_decode_nfstime3(__be32 *p, struct timespec *timep)
* mode3 mode;
* default:
* void;
- * };
+ * }
*
* union set_uid3 switch (bool set_it) {
* case TRUE:
* uid3 uid;
* default:
* void;
- * };
+ * }
*
* union set_gid3 switch (bool set_it) {
* case TRUE:
* gid3 gid;
* default:
* void;
- * };
+ * }
*
* union set_size3 switch (bool set_it) {
* case TRUE:
* size3 size;
* default:
* void;
- * };
+ * }
*
* union set_atime switch (time_how set_it) {
* case SET_TO_CLIENT_TIME:
* nfstime3 atime;
* default:
* void;
- * };
+ * }
*
* union set_mtime switch (time_how set_it) {
* case SET_TO_CLIENT_TIME:
* nfstime3 mtime;
* default:
* void;
- * };
+ * }
*
* struct sattr3 {
* set_mode3 mode;
@@ -698,7 +698,7 @@ out_overflow:
* fattr3 attributes;
* case FALSE:
* void;
- * };
+ * }
*/
static int decode_post_op_attr(struct xdr_stream *xdr, struct nfs_fattr *fattr)
{
@@ -754,7 +754,7 @@ out_overflow:
* wcc_attr attributes;
* case FALSE:
* void;
- * };
+ * }
*
* wcc_data
*
@@ -798,7 +798,7 @@ out:
* nfs_fh3 handle;
* case FALSE:
* void;
- * };
+ * }
*/
static int decode_post_op_fh3(struct xdr_stream *xdr, struct nfs_fh *fh)
{
@@ -859,7 +859,7 @@ static void nfs3_xdr_enc_getattr3args(struct rpc_rqst *req,
* nfstime3 obj_ctime;
* case FALSE:
* void;
- * };
+ * }
*
* struct SETATTR3args {
* nfs_fh3 object;
@@ -1029,7 +1029,7 @@ static void nfs3_xdr_enc_write3args(struct rpc_rqst *req,
* sattr3 obj_attributes;
* case EXCLUSIVE:
* createverf3 verf;
- * };
+ * }
*
* struct CREATE3args {
* diropargs3 where;
@@ -1122,7 +1122,7 @@ static void nfs3_xdr_enc_symlink3args(struct rpc_rqst *req,
* sattr3 pipe_attributes;
* default:
* void;
- * };
+ * }
*
* struct MKNOD3args {
* diropargs3 where;
@@ -1377,7 +1377,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
* GETATTR3resok resok;
* default:
* void;
- * };
+ * }
*/
static int nfs3_xdr_dec_getattr3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1414,7 +1414,7 @@ out_default:
* SETATTR3resok resok;
* default:
* SETATTR3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_setattr3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1455,7 +1455,7 @@ out_status:
* LOOKUP3resok resok;
* default:
* LOOKUP3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_lookup3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1502,7 +1502,7 @@ out_default:
* ACCESS3resok resok;
* default:
* ACCESS3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_access3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1543,7 +1543,7 @@ out_default:
* READLINK3resok resok;
* default:
* READLINK3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_readlink3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1586,7 +1586,7 @@ out_default:
* READ3resok resok;
* default:
* READ3resfail resfail;
- * };
+ * }
*/
static int decode_read3resok(struct xdr_stream *xdr,
struct nfs_readres *result)
@@ -1670,7 +1670,7 @@ out_status:
* WRITE3resok resok;
* default:
* WRITE3resfail resfail;
- * };
+ * }
*/
static int decode_write3resok(struct xdr_stream *xdr,
struct nfs_writeres *result)
@@ -1735,7 +1735,7 @@ out_status:
* CREATE3resok resok;
* default:
* CREATE3resfail resfail;
- * };
+ * }
*/
static int decode_create3resok(struct xdr_stream *xdr,
struct nfs3_diropres *result)
@@ -1797,7 +1797,7 @@ out_default:
* REMOVE3resok resok;
* default:
* REMOVE3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_remove3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1838,7 +1838,7 @@ out_status:
* RENAME3resok resok;
* default:
* RENAME3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_rename3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
@@ -1882,7 +1882,7 @@ out_status:
* LINK3resok resok;
* default:
* LINK3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs3_linkres *result)
@@ -2034,7 +2034,7 @@ out_truncated:
* READDIR3resok resok;
* default:
* READDIR3resfail resfail;
- * };
+ * }
*
* Read the directory contents into the page cache, but otherwise
* don't touch them. The actual decoding is done by nfs3_decode_entry()
@@ -2107,7 +2107,7 @@ out_default:
* FSSTAT3resok resok;
* default:
* FSSTAT3resfail resfail;
- * };
+ * }
*/
static int decode_fsstat3resok(struct xdr_stream *xdr,
struct nfs_fsstat *result)
@@ -2178,7 +2178,7 @@ out_status:
* FSINFO3resok resok;
* default:
* FSINFO3resfail resfail;
- * };
+ * }
*/
static int decode_fsinfo3resok(struct xdr_stream *xdr,
struct nfs_fsinfo *result)
@@ -2250,7 +2250,7 @@ out_status:
* PATHCONF3resok resok;
* default:
* PATHCONF3resfail resfail;
- * };
+ * }
*/
static int decode_pathconf3resok(struct xdr_stream *xdr,
struct nfs_pathconf *result)
@@ -2308,7 +2308,7 @@ out_status:
* COMMIT3resok resok;
* default:
* COMMIT3resfail resfail;
- * };
+ * }
*/
static int nfs3_xdr_dec_commit3res(struct rpc_rqst *req,
struct xdr_stream *xdr,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d53d678..a252fcf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5477,7 +5477,7 @@ static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_
lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED;
case -NFS4ERR_EXPIRED:
nfs4_schedule_lease_recovery(server->nfs_client);
- };
+ }
}
static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int recovery_type)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index cc14cbb..2fe8ea6 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1093,7 +1093,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
case -NFS4ERR_NOFILEHANDLE:
/* Non-seqid mutating errors */
return;
- };
+ }
/*
* Note: no locking needed as we are guaranteed to be first
* on the sequence list
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a03b9c6..b6e9f1e 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1506,7 +1506,7 @@ static int nfs_parse_mount_options(char *raw,
dfprintk(MOUNT, "NFS: invalid "
"lookupcache argument\n");
return 0;
- };
+ }
break;
case Opt_fscache_uniq:
if (nfs_get_option_str(args, &mnt->fscache_uniq))
@@ -1539,7 +1539,7 @@ static int nfs_parse_mount_options(char *raw,
dfprintk(MOUNT, "NFS: invalid "
"local_lock argument\n");
return 0;
- };
+ }
break;
/*
@@ -2439,7 +2439,7 @@ static void nfs_get_cache_cookie(struct super_block *sb,
if (mnt_s->fscache_key) {
uniq = mnt_s->fscache_key->key.uniquifier;
ulen = mnt_s->fscache_key->key.uniq_len;
- };
+ }
} else
return;
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 7f05cd1..d266a77 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -392,7 +392,7 @@ static void encode_cb_sequence4args(struct xdr_stream *xdr,
* CB_SEQUENCE4resok csr_resok4;
* default:
* void;
- * };
+ * }
*
* Our current back channel implmentation supports a single backchannel
* with a single slot.
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 0874998..a0535df 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2001,7 +2001,7 @@ static __be32 nfsd4_map_bcts_dir(u32 *dir)
case NFS4_CDFC4_BACK_OR_BOTH:
*dir = NFS4_CDFC4_BOTH;
return nfs_ok;
- };
+ }
return nfserr_inval;
}
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d9454fe..d1e149d 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1937,7 +1937,7 @@ static u32 nfs4_file_type(umode_t mode)
case S_IFREG: return NF4REG;
case S_IFSOCK: return NF4SOCK;
default: return NF4BAD;
- };
+ }
}
static __be32
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 0c2f912..89876d2 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -32,7 +32,7 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
return true;
default:
BUG();
- };
+ }
}
return false;
}
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 4216308..cb55f0d 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -63,7 +63,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
else if (old->mask & FS_IN_IGNORED)
return false;
return true;
- };
+ }
}
return false;
}
diff --git a/fs/ntfs/lcnalloc.c b/fs/ntfs/lcnalloc.c
index 1711b71..c6db5d1 100644
--- a/fs/ntfs/lcnalloc.c
+++ b/fs/ntfs/lcnalloc.c
@@ -913,7 +913,7 @@ s64 __ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count,
}
/* We have freed @to_free real clusters. */
real_freed = to_free;
- };
+ }
/* Go to the next run and adjust the number of clusters left to free. */
++rl;
if (count >= 0)
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 82650d5..30f260b 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1623,7 +1623,7 @@ read_partial_attrdef_page:
memcpy((u8*)vol->attrdef + (index++ << PAGE_CACHE_SHIFT),
page_address(page), size);
ntfs_unmap_page(page);
- };
+ }
if (size == PAGE_CACHE_SIZE) {
size = i_size & ~PAGE_CACHE_MASK;
if (size)
@@ -1692,7 +1692,7 @@ read_partial_upcase_page:
memcpy((char*)vol->upcase + (index++ << PAGE_CACHE_SHIFT),
page_address(page), size);
ntfs_unmap_page(page);
- };
+ }
if (size == PAGE_CACHE_SIZE) {
size = i_size & ~PAGE_CACHE_MASK;
if (size)
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c
index 1ec141e..e6ba7dd 100644
--- a/fs/ocfs2/cluster/quorum.c
+++ b/fs/ocfs2/cluster/quorum.c
@@ -86,7 +86,7 @@ static void o2quo_fence_self(void)
"system by restarting ***\n");
emergency_restart();
break;
- };
+ }
}
/* Indicate that a timeout occurred on a hearbeat region write. The
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 3a44a64..799efed 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -554,7 +554,7 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
mlog_bug_on_msg(1, "type: %d\n", type);
ops = NULL; /* thanks, gcc */
break;
- };
+ }
ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno,
generation, res->l_name);
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index dc9a682..2b7a737 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -562,7 +562,7 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options)
if (!strcmp(this_char, "displacing_new_packing_localities")) {
SET_OPTION(displacing_new_packing_localities);
continue;
- };
+ }
if (!strcmp(this_char, "old_hashed_relocation")) {
SET_OPTION(old_hashed_relocation);
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 4c37607..9d0ce84 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -584,7 +584,7 @@ int ubifs_read_superblock(struct ubifs_info *c)
c->key_hash = key_test_hash;
c->key_hash_type = UBIFS_KEY_HASH_TEST;
break;
- };
+ }
c->key_fmt = sup->key_fmt;
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 22831c4..3031a64 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -499,7 +499,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
BUG();
inode = NULL;
break;
- };
+ }
if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index f7aee8b..6a3d51f 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -319,7 +319,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
entry->rule.listnr != AUDIT_FILTER_USER)
return -EINVAL;
break;
- };
+ }
switch(f->type) {
default:
@@ -385,7 +385,7 @@ static int audit_field_valid(struct audit_entry *entry, struct audit_field *f)
if (f->val > AUDIT_MAX_FIELD_COMPARE)
return -EINVAL;
break;
- };
+ }
return 0;
}
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 4aa8a30..2bd6cae 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -135,7 +135,7 @@ res_counter_member(struct res_counter *counter, int member)
return &counter->failcnt;
case RES_SOFT_LIMIT:
return &counter->soft_limit;
- };
+ }
BUG();
return NULL;
diff --git a/kernel/smp.c b/kernel/smp.c
index 0564571..f0eff5d 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -71,7 +71,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
free_percpu(cfd->csd);
break;
#endif
- };
+ }
return NOTIFY_OK;
}
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
index 31c5f76..9a45a7f 100644
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -384,7 +384,7 @@ static int INIT get_next_block(struct bunzip_data *bd)
bd->inbufBits =
(bd->inbufBits << 8)|bd->inbuf[bd->inbufPos++];
bd->inbufBitCount += 8;
- };
+ }
bd->inbufBitCount -= hufGroup->maxLen;
j = (bd->inbufBits >> bd->inbufBitCount)&
((1 << hufGroup->maxLen)-1);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1c52ddb..2e3152a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1798,7 +1798,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
return;
case OOM_SCAN_OK:
break;
- };
+ }
points = oom_badness(task, memcg, NULL, totalpages);
if (points > chosen_points) {
if (chosen)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 314e9d2..7439223 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -317,7 +317,7 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
return (struct task_struct *)(-1UL);
case OOM_SCAN_OK:
break;
- };
+ }
points = oom_badness(p, NULL, nodemask, totalpages);
if (points > chosen_points) {
chosen = p;
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 0846566..27e3bca 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -484,7 +484,7 @@ gss_alloc_msg(struct gss_auth *gss_auth,
gss_encode_v0_msg(gss_msg);
default:
gss_encode_v1_msg(gss_msg, service_name, gss_auth->target_name);
- };
+ }
return gss_msg;
}
diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c
index 263a44d..f7e844d 100644
--- a/scripts/conmakehash.c
+++ b/scripts/conmakehash.c
@@ -262,7 +262,7 @@ u8 dfont_unicount[%d] = \n\
{
printf("%3d", unicount[i]);
if ( i == fontlen-1 )
- printf("\n};\n");
+ printf("\n}\n");
else if ( i % 8 == 7 )
printf(",\n\t");
else
@@ -282,7 +282,7 @@ u8 dfont_unicount[%d] = \n\
}
printf("0x%04x", unitable[fp0][nent++]);
if ( i == nuni-1 )
- printf("\n};\n");
+ printf("\n}\n");
else if ( i % 8 == 7 )
printf(",\n\t");
else
diff --git a/scripts/dtc/fdtdump.c b/scripts/dtc/fdtdump.c
index 207a46d..b09fa01 100644
--- a/scripts/dtc/fdtdump.c
+++ b/scripts/dtc/fdtdump.c
@@ -115,7 +115,7 @@ static void dump_blob(void *blob)
if (tag == FDT_END_NODE) {
depth--;
- printf("%*s};\n", depth * shift, "");
+ printf("%*s}\n", depth * shift, "");
continue;
}
diff --git a/security/apparmor/path.c b/security/apparmor/path.c
index 35b394a..de45a40 100644
--- a/security/apparmor/path.c
+++ b/security/apparmor/path.c
@@ -102,7 +102,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen,
error = PTR_ERR(res);
*name = buf;
goto out;
- };
+ }
} else if (!our_mnt(path->mnt))
connected = 0;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 5b52310..22b5058 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1044,7 +1044,7 @@ static void selinux_write_opts(struct seq_file *m,
default:
BUG();
return;
- };
+ }
/* we need a comma before each option */
seq_putc(m, ',');
seq_puts(m, prefix);
diff --git a/sound/oss/sb_ess.c b/sound/oss/sb_ess.c
index c0be085..0e7254b 100644
--- a/sound/oss/sb_ess.c
+++ b/sound/oss/sb_ess.c
@@ -1544,7 +1544,7 @@ static int ess_has_rec_mixer (int submodel)
return 1;
default:
return 0;
- };
+ }
};
#ifdef FKS_LOGGING
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index b46dc9b..9fb03b4 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -671,7 +671,7 @@ static int snd_vortex_new_pcm(vortex_t *chip, int idx, int nr)
return err;
break;
#endif
- };
+ }
if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {
for (i = 0; i < ARRAY_SIZE(snd_vortex_mixer_spdif); i++) {
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index bb53dea..8697ced 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -777,7 +777,7 @@ static int asoc_ssc_init(struct device *dev)
if (ret) {
dev_err(dev, "Could not register PCM: %d\n", ret);
goto err_unregister_dai;
- };
+ }
return 0;
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 5f9af1f..49cc5f6 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -328,7 +328,7 @@ static int ak4641_i2s_hw_params(struct snd_pcm_substream *substream,
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
ak4641->playback_fs = rate;
ak4641_set_deemph(codec);
- };
+ }
return 0;
}
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index ea141e1..1544330 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -382,7 +382,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai,
break;
default:
return -EINVAL;
- };
+ }
snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val);
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 6d31d88..e29cdb7 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -429,7 +429,7 @@ static int tas5086_hw_params(struct snd_pcm_substream *substream,
default:
dev_err(codec->dev, "Invalid bit width\n");
return -EINVAL;
- };
+ }
ret = regmap_write(priv->regmap, TAS5086_SERIAL_DATA_IF, val);
if (ret < 0)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 3c79dbb..35059a2 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -246,7 +246,7 @@ static bool twl6040_is_path_unmuted(struct snd_soc_codec *codec,
return priv->dl2_unmuted;
default:
return 1;
- };
+ }
}
/*
@@ -1100,7 +1100,7 @@ static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id i
break;
default:
break;
- };
+ }
}
static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 3920c3e..c0fea02 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -963,7 +963,7 @@ static bool fsl_spdif_readable_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg)
@@ -982,7 +982,7 @@ static bool fsl_spdif_writeable_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static const struct regmap_config fsl_spdif_regmap_config = {
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index 52af7f6..364bf6a 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -297,7 +297,7 @@ static bool tegra20_i2s_wr_rd_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool tegra20_i2s_volatile_reg(struct device *dev, unsigned int reg)
@@ -310,7 +310,7 @@ static bool tegra20_i2s_volatile_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool tegra20_i2s_precious_reg(struct device *dev, unsigned int reg)
@@ -321,7 +321,7 @@ static bool tegra20_i2s_precious_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static const struct regmap_config tegra20_i2s_regmap_config = {
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 551b3c9..08bc693 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -213,7 +213,7 @@ static bool tegra20_spdif_wr_rd_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool tegra20_spdif_volatile_reg(struct device *dev, unsigned int reg)
@@ -234,7 +234,7 @@ static bool tegra20_spdif_volatile_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool tegra20_spdif_precious_reg(struct device *dev, unsigned int reg)
@@ -247,7 +247,7 @@ static bool tegra20_spdif_precious_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static const struct regmap_config tegra20_spdif_regmap_config = {
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index d554d46..805b1f3 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -346,7 +346,7 @@ static bool tegra30_ahub_apbif_wr_rd_reg(struct device *dev, unsigned int reg)
return true;
default:
break;
- };
+ }
if (REG_IN_ARRAY(reg, CHANNEL_CTRL) ||
REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
@@ -381,7 +381,7 @@ static bool tegra30_ahub_apbif_volatile_reg(struct device *dev,
return true;
default:
break;
- };
+ }
if (REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
REG_IN_ARRAY(reg, CHANNEL_STATUS) ||
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 47565fd04..bd71145 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -369,7 +369,7 @@ static bool tegra30_i2s_wr_rd_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static bool tegra30_i2s_volatile_reg(struct device *dev, unsigned int reg)
@@ -382,7 +382,7 @@ static bool tegra30_i2s_volatile_reg(struct device *dev, unsigned int reg)
return true;
default:
return false;
- };
+ }
}
static const struct regmap_config tegra30_i2s_regmap_config = {
diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c
index dcc6652..f0172a3 100644
--- a/tools/lib/traceevent/kbuffer-parse.c
+++ b/tools/lib/traceevent/kbuffer-parse.c
@@ -453,7 +453,7 @@ void *kbuffer_translate_data(int swap, void *data, unsigned int *size)
case KBUFFER_TYPE_TIME_EXTEND:
case KBUFFER_TYPE_TIME_STAMP:
return NULL;
- };
+ }
*size = length;
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index f28799e..c629738 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -837,7 +837,7 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair,
default:
BUG_ON(1);
- };
+ }
}
static void
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ee33ba2..961775c 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -764,7 +764,7 @@ static void dump_threads(void)
t = perf_session__findnew(session, st->tid);
pr_info("%10d: %s\n", st->tid, t->comm);
node = rb_next(node);
- };
+ }
}
static void dump_map(void)
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 6fb781d..5f364f5 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -568,5 +568,5 @@ int test__code_reading(void)
return 0;
default:
return -1;
- };
+ }
}
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index f211227..85860a8 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -94,7 +94,7 @@ static void skip(int size)
r = size > BUFSIZ ? BUFSIZ : size;
do_read(buf, r);
size -= r;
- };
+ }
}
static unsigned int read4(struct pevent *pevent)
diff --git a/tools/power/cpupower/utils/cpupower-info.c b/tools/power/cpupower/utils/cpupower-info.c
index 3f68632..2ca338a 100644
--- a/tools/power/cpupower/utils/cpupower-info.c
+++ b/tools/power/cpupower/utils/cpupower-info.c
@@ -69,7 +69,7 @@ int cmd_info(int argc, char **argv)
default:
print_wrong_arg_exit();
}
- };
+ }
if (!params.params)
params.params = 0x7;
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index dc4de37..12f0e47 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -91,7 +91,7 @@ int cmd_set(int argc, char **argv)
default:
print_wrong_arg_exit();
}
- };
+ }
if (!params.params)
print_wrong_arg_exit();
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 2116df9..596e1bc 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -118,7 +118,7 @@ static int amd_fam14h_get_pci_info(struct cstate *state,
break;
default:
return -1;
- };
+ }
return 0;
}
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index bcd22a1..6989f6c 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -55,7 +55,7 @@ static int cpuidle_start(void)
dprint("CPU %d - State: %d - Val: %llu\n",
cpu, state, previous_count[cpu][state]);
}
- };
+ }
return 0;
}
@@ -74,7 +74,7 @@ static int cpuidle_stop(void)
dprint("CPU %d - State: %d - Val: %llu\n",
cpu, state, previous_count[cpu][state]);
}
- };
+ }
return 0;
}
@@ -156,7 +156,7 @@ static struct cpuidle_monitor *cpuidle_register(void)
cpuidle_cstates[num].id = num;
cpuidle_cstates[num].get_count_percent =
cpuidle_get_count_percent;
- };
+ }
/* Free this at program termination */
previous_count = malloc(sizeof(long long *) * cpu_count);
diff --git a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
index ebeaba6..0fa489a 100644
--- a/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c
@@ -81,7 +81,7 @@ static int hsw_ext_get_count(enum intel_hsw_ext_id id, unsigned long long *val,
break;
default:
return -1;
- };
+ }
if (read_msr(cpu, msr, val))
return -1;
return 0;
diff --git a/tools/power/cpupower/utils/idle_monitor/nhm_idle.c b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
index d2a91dd..9f4bdaf 100644
--- a/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/nhm_idle.c
@@ -92,7 +92,7 @@ static int nhm_get_count(enum intel_nhm_id id, unsigned long long *val,
break;
default:
return -1;
- };
+ }
if (read_msr(cpu, msr, val))
return -1;
diff --git a/tools/power/cpupower/utils/idle_monitor/snb_idle.c b/tools/power/cpupower/utils/idle_monitor/snb_idle.c
index efc8a69..3dd9da6 100644
--- a/tools/power/cpupower/utils/idle_monitor/snb_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/snb_idle.c
@@ -78,7 +78,7 @@ static int snb_get_count(enum intel_snb_id id, unsigned long long *val,
break;
default:
return -1;
- };
+ }
if (read_msr(cpu, msr, val))
return -1;
return 0;
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index d664182..2f32f9e 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -65,7 +65,7 @@ int restore_queue(struct msgque_data *msgque)
printf("msgsnd failed (%m)\n");
ret = -errno;
goto destroy;
- };
+ }
}
return 0;
@@ -176,7 +176,7 @@ int fill_msgque(struct msgque_data *msgque)
IPC_NOWAIT) != 0) {
printf("First message send failed (%m)\n");
return -errno;
- };
+ }
msgbuf.mtype = ANOTHER_MSG_TYPE;
memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING));
@@ -184,7 +184,7 @@ int fill_msgque(struct msgque_data *msgque)
IPC_NOWAIT) != 0) {
printf("Second message send failed (%m)\n");
return -errno;
- };
+ }
return 0;
}
diff --git a/tools/virtio/virtio-trace/trace-agent-ctl.c b/tools/virtio/virtio-trace/trace-agent-ctl.c
index a2d0403..b2ca55c 100644
--- a/tools/virtio/virtio-trace/trace-agent-ctl.c
+++ b/tools/virtio/virtio-trace/trace-agent-ctl.c
@@ -77,7 +77,7 @@ static int wait_order(int ctl_fd)
if (ret)
break;
- };
+ }
return ret;
^ permalink raw reply related
* Re: pci-half-mini 7206 ac/bluetooth issues
From: Emmanuel Grumbach @ 2013-10-08 19:21 UTC (permalink / raw)
To: Tim Nelson, linux-wireless
In-Reply-To: <CAOAOC6YGEphx+qo43hSWd=24knae_UC=JViTuiEUTT4TuGix4g@mail.gmail.com>
On Tue, Oct 8, 2013 at 10:06 PM, Tim Nelson <tim.l.nelson@gmail.com> wrote:
>
> The first step works, I tested it for a couple of days with no issues.
> I will test the power statement on it's own later today and let you
> know the results of it.
>
This is really weird... Please notice that new BT FW was published in
the last few days to linux-firmware.git. Can you please also try with
the new BT FW and without bt_coex_active=0?
Do you have the ability to use trace-cmd?
How long does it take to have wifi / bt die?
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox