summaryrefslogtreecommitdiff
path: root/fwcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fwcmd.c')
-rw-r--r--fwcmd.c1300
1 files changed, 231 insertions, 1069 deletions
diff --git a/fwcmd.c b/fwcmd.c
index 9b91752..35da765 100644
--- a/fwcmd.c
+++ b/fwcmd.c
@@ -1,12 +1,20 @@
/*
* Copyright (C) 2006-2015, Marvell International Ltd.
*
- * 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.
+ * This software file (the "File") is distributed by Marvell International
+ * Ltd. under the terms of the GNU General Public License Version 2, June 1991
+ * (the "License"). You may use, redistribute and/or modify this File in
+ * accordance with the terms and conditions of the License, a copy of which
+ * is available by writing to the Free Software Foundation, Inc.
+ *
+ * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
+ * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
+ * this warranty disclaimer.
*/
-/* Description: This file implements frimware host command related functions.
+/* Description: This file implements firmware host command related
+ * functions.
*/
#include <linux/etherdevice.h>
@@ -14,740 +22,11 @@
#include "sysadpt.h"
#include "dev.h"
#include "fwcmd.h"
+#include "hostcmd.h"
-#define MAX_WAIT_FW_COMPLETE_ITERATIONS 10000
+#define MAX_WAIT_FW_COMPLETE_ITERATIONS 500
#define MAX_WAIT_GET_HW_SPECS_ITERATONS 3
-/* 16 bit host command code */
-#define HOSTCMD_CMD_GET_HW_SPEC 0x0003
-#define HOSTCMD_CMD_SET_HW_SPEC 0x0004
-#define HOSTCMD_CMD_802_11_GET_STAT 0x0014
-#define HOSTCMD_CMD_802_11_RADIO_CONTROL 0x001c
-#define HOSTCMD_CMD_802_11_TX_POWER 0x001f
-#define HOSTCMD_CMD_802_11_RF_ANTENNA 0x0020
-#define HOSTCMD_CMD_BROADCAST_SSID_ENABLE 0x0050 /* per-vif */
-#define HOSTCMD_CMD_SET_RF_CHANNEL 0x010a
-#define HOSTCMD_CMD_SET_AID 0x010d /* per-vif */
-#define HOSTCMD_CMD_SET_INFRA_MODE 0x010e /* per-vif */
-#define HOSTCMD_CMD_802_11_RTS_THSD 0x0113
-#define HOSTCMD_CMD_SET_EDCA_PARAMS 0x0115
-#define HOSTCMD_CMD_SET_WMM_MODE 0x0123
-#define HOSTCMD_CMD_SET_FIXED_RATE 0x0126
-#define HOSTCMD_CMD_SET_IES 0x0127
-#define HOSTCMD_CMD_SET_MAC_ADDR 0x0202 /* per-vif */
-#define HOSTCMD_CMD_SET_RATE_ADAPT_MODE 0x0203
-#define HOSTCMD_CMD_GET_WATCHDOG_BITMAP 0x0205
-#define HOSTCMD_CMD_DEL_MAC_ADDR 0x0206 /* pre-vif */
-#define HOSTCMD_CMD_BSS_START 0x1100 /* per-vif */
-#define HOSTCMD_CMD_AP_BEACON 0x1101 /* per-vif */
-#define HOSTCMD_CMD_SET_NEW_STN 0x1111 /* per-vif */
-#define HOSTCMD_CMD_SET_APMODE 0x1114
-#define HOSTCMD_CMD_UPDATE_ENCRYPTION 0x1122 /* per-vif */
-#define HOSTCMD_CMD_BASTREAM 0x1125
-#define HOSTCMD_CMD_DWDS_ENABLE 0x1144
-#define HOSTCMD_CMD_FW_FLUSH_TIMER 0x1148
-#define HOSTCMD_CMD_SET_CDD 0x1150
-
-/* Define general result code for each command */
-#define HOSTCMD_RESULT_OK 0x0000
-/* General error */
-#define HOSTCMD_RESULT_ERROR 0x0001
-/* Command is not valid */
-#define HOSTCMD_RESULT_NOT_SUPPORT 0x0002
-/* Command is pending (will be processed) */
-#define HOSTCMD_RESULT_PENDING 0x0003
-/* System is busy (command ignored) */
-#define HOSTCMD_RESULT_BUSY 0x0004
-/* Data buffer is not big enough */
-#define HOSTCMD_RESULT_PARTIAL_DATA 0x0005
-
-/* Define channel related constants */
-#define FREQ_BAND_2DOT4GHZ 0x1
-#define FREQ_BAND_4DOT9GHZ 0x2
-#define FREQ_BAND_5GHZ 0x4
-#define FREQ_BAND_5DOT2GHZ 0x8
-#define CH_AUTO_WIDTH 0
-#define CH_10_MHZ_WIDTH 0x1
-#define CH_20_MHZ_WIDTH 0x2
-#define CH_40_MHZ_WIDTH 0x4
-#define CH_80_MHZ_WIDTH 0x5
-#define EXT_CH_ABOVE_CTRL_CH 0x1
-#define EXT_CH_AUTO 0x2
-#define EXT_CH_BELOW_CTRL_CH 0x3
-#define NO_EXT_CHANNEL 0x0
-
-#define ACT_PRIMARY_CHAN_0 0
-#define ACT_PRIMARY_CHAN_1 1
-#define ACT_PRIMARY_CHAN_2 2
-#define ACT_PRIMARY_CHAN_3 3
-
-/* Define rate related constants */
-#define HOSTCMD_ACT_NOT_USE_FIXED_RATE 0x0002
-
-/* Define station related constants */
-#define HOSTCMD_ACT_STA_ACTION_ADD 0
-#define HOSTCMD_ACT_STA_ACTION_REMOVE 2
-
-/* Define key related constants */
-#define MAX_ENCR_KEY_LENGTH 16
-#define MIC_KEY_LENGTH 8
-
-#define KEY_TYPE_ID_WEP 0x00
-#define KEY_TYPE_ID_TKIP 0x01
-#define KEY_TYPE_ID_AES 0x02
-
-#define ENCR_KEY_FLAG_TXGROUPKEY 0x00000004
-#define ENCR_KEY_FLAG_PAIRWISE 0x00000008
-#define ENCR_KEY_FLAG_TSC_VALID 0x00000040
-#define ENCR_KEY_FLAG_WEP_TXKEY 0x01000000
-#define ENCR_KEY_FLAG_MICKEY_VALID 0x02000000
-
-/* Define block ack related constants */
-#define BASTREAM_FLAG_IMMEDIATE_TYPE 1
-#define BASTREAM_FLAG_DIRECTION_UPSTREAM 0
-
-/* Define general purpose action */
-#define HOSTCMD_ACT_GEN_SET 0x0001
-#define HOSTCMD_ACT_GEN_SET_LIST 0x0002
-#define HOSTCMD_ACT_GEN_GET_LIST 0x0003
-
-/* Misc */
-#define MAX_ENCR_KEY_LENGTH 16
-#define MIC_KEY_LENGTH 8
-
-enum {
- WL_DISABLE = 0,
- WL_ENABLE = 1,
- WL_DISABLE_VMAC = 0x80,
-};
-
-enum {
- WL_GET = 0,
- WL_SET = 1,
- WL_RESET = 2,
-};
-
-enum {
- WL_LONG_PREAMBLE = 1,
- WL_SHORT_PREAMBLE = 3,
- WL_AUTO_PREAMBLE = 5,
-};
-
-enum encr_action_type {
- /* request to enable/disable HW encryption */
- ENCR_ACTION_ENABLE_HW_ENCR,
- /* request to set encryption key */
- ENCR_ACTION_TYPE_SET_KEY,
- /* request to remove one or more keys */
- ENCR_ACTION_TYPE_REMOVE_KEY,
- ENCR_ACTION_TYPE_SET_GROUP_KEY,
-};
-
-enum ba_action_type {
- BA_CREATE_STREAM,
- BA_UPDATE_STREAM,
- BA_DESTROY_STREAM,
- BA_FLUSH_STREAM,
- BA_CHECK_STREAM,
-};
-
-enum mac_type {
- WL_MAC_TYPE_PRIMARY_CLIENT,
- WL_MAC_TYPE_SECONDARY_CLIENT,
- WL_MAC_TYPE_PRIMARY_AP,
- WL_MAC_TYPE_SECONDARY_AP,
-};
-
-/* General host command header */
-struct hostcmd_header {
- __le16 cmd;
- __le16 len;
- u8 seq_num;
- u8 macid;
- __le16 result;
-} __packed;
-
-/* HOSTCMD_CMD_GET_HW_SPEC */
-struct hostcmd_cmd_get_hw_spec {
- struct hostcmd_header cmd_hdr;
- u8 version; /* version of the HW */
- u8 host_if; /* host interface */
- __le16 num_wcb; /* Max. number of WCB FW can handle */
- __le16 num_mcast_addr; /* MaxNbr of MC addresses FW can handle */
- u8 permanent_addr[ETH_ALEN]; /* MAC address programmed in HW */
- __le16 region_code;
- __le16 num_antenna; /* Number of antenna used */
- __le32 fw_release_num; /* 4 byte of FW release number */
- __le32 wcb_base0;
- __le32 rxpd_wr_ptr;
- __le32 rxpd_rd_ptr;
- __le32 fw_awake_cookie;
- __le32 wcb_base[SYSADPT_TOTAL_TX_QUEUES - 1];
-} __packed;
-
-/* HOSTCMD_CMD_SET_HW_SPEC */
-struct hostcmd_cmd_set_hw_spec {
- struct hostcmd_header cmd_hdr;
- /* HW revision */
- u8 version;
- /* Host interface */
- u8 host_if;
- /* Max. number of Multicast address FW can handle */
- __le16 num_mcast_addr;
- /* MAC address */
- u8 permanent_addr[ETH_ALEN];
- /* Region Code */
- __le16 region_code;
- /* 4 byte of FW release number, example 0x1234=1.2.3.4 */
- __le32 fw_release_num;
- /* Firmware awake cookie - used to ensure that the device
- * is not in sleep mode
- */
- __le32 fw_awake_cookie;
- /* Device capabilities (see above) */
- __le32 device_caps;
- /* Rx shared memory queue */
- __le32 rxpd_wr_ptr;
- /* Actual number of TX queues in WcbBase array */
- __le32 num_tx_queues;
- /* TX WCB Rings */
- __le32 wcb_base[SYSADPT_NUM_OF_DESC_DATA];
- /* Max AMSDU size (00 - AMSDU Disabled,
- * 01 - 4K, 10 - 8K, 11 - not defined)
- */
- __le32 features;
- __le32 tx_wcb_num_per_queue;
- __le32 total_rx_wcb;
-} __packed;
-
-/* HOSTCMD_CMD_802_11_GET_STAT */
-struct hostcmd_cmd_802_11_get_stat {
- struct hostcmd_header cmd_hdr;
- __le32 tx_retry_successes;
- __le32 tx_multiple_retry_successes;
- __le32 tx_failures;
- __le32 rts_successes;
- __le32 rts_failures;
- __le32 ack_failures;
- __le32 rx_duplicate_frames;
- __le32 rx_fcs_errors;
- __le32 tx_watchdog_timeouts;
- __le32 rx_overflows;
- __le32 rx_frag_errors;
- __le32 rx_mem_errors;
- __le32 pointer_errors;
- __le32 tx_underflows;
- __le32 tx_done;
- __le32 tx_done_buf_try_put;
- __le32 tx_done_buf_put;
- /* Put size of requested buffer in here */
- __le32 wait_for_tx_buf;
- __le32 tx_attempts;
- __le32 tx_successes;
- __le32 tx_fragments;
- __le32 tx_multicasts;
- __le32 rx_non_ctl_pkts;
- __le32 rx_multicasts;
- __le32 rx_undecryptable_frames;
- __le32 rx_icv_errors;
- __le32 rx_excluded_frames;
- __le32 rx_weak_iv_count;
- __le32 rx_unicasts;
- __le32 rx_bytes;
- __le32 rx_errors;
- __le32 rx_rts_count;
- __le32 tx_cts_count;
-} __packed;
-
-/* HOSTCMD_CMD_802_11_RADIO_CONTROL */
-struct hostcmd_cmd_802_11_radio_control {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- /* @bit0: 1/0,on/off, @bit1: 1/0, long/short @bit2: 1/0,auto/fix */
- __le16 control;
- __le16 radio_on;
-} __packed;
-
-/* HOSTCMD_CMD_802_11_TX_POWER */
-struct hostcmd_cmd_802_11_tx_power {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- __le16 band;
- __le16 ch;
- __le16 bw;
- __le16 sub_ch;
- __le16 power_level_list[SYSADPT_TX_POWER_LEVEL_TOTAL];
-} __packed;
-
-/* HOSTCMD_CMD_802_11_RF_ANTENNA */
-struct hostcmd_cmd_802_11_rf_antenna {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- __le16 antenna_mode; /* Number of antennas or 0xffff(diversity) */
-} __packed;
-
-/* HOSTCMD_CMD_BROADCAST_SSID_ENABLE */
-struct hostcmd_cmd_broadcast_ssid_enable {
- struct hostcmd_header cmd_hdr;
- __le32 enable;
-} __packed;
-
-/* HOSTCMD_CMD_SET_RF_CHANNEL */
-#define FREQ_BAND_MASK 0x0000003f
-#define CHNL_WIDTH_MASK 0x000007c0
-#define CHNL_WIDTH_SHIFT 6
-#define ACT_PRIMARY_MASK 0x00003800
-#define ACT_PRIMARY_SHIFT 11
-
-struct hostcmd_cmd_set_rf_channel {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- u8 curr_chnl;
- __le32 chnl_flags;
-} __packed;
-
-/* HOSTCMD_CMD_SET_AID */
-struct hostcmd_cmd_set_aid {
- struct hostcmd_header cmd_hdr;
- __le16 aid;
- u8 mac_addr[ETH_ALEN]; /* AP's Mac Address(BSSID) */
- __le32 gprotect;
- u8 ap_rates[SYSADPT_MAX_DATA_RATES_G];
-} __packed;
-
-/* HOSTCMD_CMD_SET_INFRA_MODE */
-struct hostcmd_cmd_set_infra_mode {
- struct hostcmd_header cmd_hdr;
-} __packed;
-
-/* HOSTCMD_CMD_802_11_RTS_THSD */
-struct hostcmd_cmd_802_11_rts_thsd {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- __le16 threshold;
-} __packed;
-
-/* HOSTCMD_CMD_SET_EDCA_PARAMS */
-struct hostcmd_cmd_set_edca_params {
- struct hostcmd_header cmd_hdr;
- /* 0 = get all, 0x1 =set CWMin/Max, 0x2 = set TXOP , 0x4 =set AIFSN */
- __le16 action;
- __le16 txop; /* in unit of 32 us */
- __le32 cw_max; /* 0~15 */
- __le32 cw_min; /* 0~15 */
- u8 aifsn;
- u8 txq_num; /* Tx Queue number. */
-} __packed;
-
-/* HOSTCMD_CMD_SET_WMM_MODE */
-struct hostcmd_cmd_set_wmm_mode {
- struct hostcmd_header cmd_hdr;
- __le16 action; /* 0->unset, 1->set */
-} __packed;
-
-/* HOSTCMD_CMD_SET_FIXED_RATE */
-struct fix_rate_flag { /* lower rate after the retry count */
- /* 0: legacy, 1: HT */
- __le32 fix_rate_type;
- /* 0: retry count is not valid, 1: use retry count specified */
- __le32 retry_count_valid;
-} __packed;
-
-struct fix_rate_entry {
- struct fix_rate_flag fix_rate_type_flags;
- /* depending on the flags above, this can be either a legacy
- * rate(not index) or an MCS code.
- */
- __le32 fixed_rate;
- __le32 retry_count;
-} __packed;
-
-struct hostcmd_cmd_set_fixed_rate {
- struct hostcmd_header cmd_hdr;
- /* HOSTCMD_ACT_NOT_USE_FIXED_RATE 0x0002 */
- __le32 action;
- /* use fixed rate specified but firmware can drop to */
- __le32 allow_rate_drop;
- __le32 entry_count;
- struct fix_rate_entry fixed_rate_table[4];
- u8 multicast_rate;
- u8 multi_rate_tx_type;
- u8 management_rate;
-} __packed;
-
-/* HOSTCMD_CMD_SET_IES */
-struct hostcmd_cmd_set_ies {
- struct hostcmd_header cmd_hdr;
- __le16 action; /* 0->unset, 1->set */
- __le16 ie_list_len_ht;
- __le16 ie_list_len_vht;
- __le16 ie_list_len_proprietary;
- /*Buffer size same as Generic_Beacon*/
- u8 ie_list_ht[148];
- u8 ie_list_vht[24];
- u8 ie_list_proprietary[112];
-} __packed;
-
-/* HOSTCMD_CMD_SET_RATE_ADAPT_MODE */
-struct hostcmd_cmd_set_rate_adapt_mode {
- struct hostcmd_header cmd_hdr;
- __le16 action;
- __le16 rate_adapt_mode; /* 0:Indoor, 1:Outdoor */
-} __packed;
-
-/* HOSTCMD_CMD_SET_MAC_ADDR, HOSTCMD_CMD_DEL_MAC_ADDR */
-struct hostcmd_cmd_set_mac_addr {
- struct hostcmd_header cmd_hdr;
- __le16 mac_type;
- u8 mac_addr[ETH_ALEN];
-} __packed;
-
-/* HOSTCMD_CMD_GET_WATCHDOG_BITMAP */
-struct hostcmd_cmd_get_watchdog_bitmap {
- struct hostcmd_header cmd_hdr;
- u8 watchdog_bitmap; /* for SW/BA */
-} __packed;
-
-/* HOSTCMD_CMD_BSS_START */
-struct hostcmd_cmd_bss_start {
- struct hostcmd_header cmd_hdr;
- __le32 enable; /* FALSE: Disable or TRUE: Enable */
-} __packed;
-
-/* HOSTCMD_CMD_AP_BEACON */
-struct cf_params {
- u8 elem_id;
- u8 len;
- u8 cfp_cnt;
- u8 cfp_period;
- __le16 cfp_max_duration;
- __le16 cfp_duration_remaining;
-} __packed;
-
-struct ibss_params {
- u8 elem_id;
- u8 len;
- __le16 atim_window;
-} __packed;
-
-union ss_params {
- struct cf_params cf_param_set;
- struct ibss_params ibss_param_set;
-} __packed;
-
-struct fh_params {
- u8 elem_id;
- u8 len;
- __le16 dwell_time;
- u8 hop_set;
- u8 hop_pattern;
- u8 hop_index;
-} __packed;
-
-struct ds_params {
- u8 elem_id;
- u8 len;
- u8 current_chnl;
-} __packed;
-
-union phy_params {
- struct fh_params fh_param_set;
- struct ds_params ds_param_set;
-} __packed;
-
-struct rsn_ie {
- u8 elem_id;
- u8 len;
- u8 oui_type[4]; /* 00:50:f2:01 */
- u8 ver[2];
- u8 grp_key_cipher[4];
- u8 pws_key_cnt[2];
- u8 pws_key_cipher_list[4];
- u8 auth_key_cnt[2];
- u8 auth_key_list[4];
-} __packed;
-
-struct rsn48_ie {
- u8 elem_id;
- u8 len;
- u8 ver[2];
- u8 grp_key_cipher[4];
- u8 pws_key_cnt[2];
- u8 pws_key_cipher_list[4];
- u8 auth_key_cnt[2];
- u8 auth_key_list[4];
- u8 rsn_cap[2];
- u8 pmk_id_cnt[2];
- u8 pmk_id_list[16]; /* Should modify to 16 * S */
- u8 reserved[8];
-} __packed;
-
-struct ac_param_rcd {
- u8 aci_aifsn;
- u8 ecw_min_max;
- __le16 txop_lim;
-} __packed;
-
-struct wmm_param_elem {
- u8 elem_id;
- u8 len;
- u8 oui[3];
- u8 type;
- u8 sub_type;
- u8 version;
- u8 rsvd;
- struct ac_param_rcd ac_be;
- struct ac_param_rcd ac_bk;
- struct ac_param_rcd ac_vi;
- struct ac_param_rcd ac_vo;
-} __packed;
-
-struct channel_info {
- u8 first_channel_num;
- u8 num_channels;
- u8 max_tx_pwr_level;
-} __packed;
-
-struct country {
- u8 elem_id;
- u8 len;
- u8 country_str[3];
- struct channel_info channel_info[40];
-} __packed;
-
-struct start_cmd {
- u8 sta_mac_addr[ETH_ALEN];
- u8 ssid[IEEE80211_MAX_SSID_LEN];
- u8 bss_type;
- __le16 bcn_period;
- u8 dtim_period;
- union ss_params ss_param_set;
- union phy_params phy_param_set;
- __le16 probe_delay;
- __le16 cap_info;
- u8 b_rate_set[SYSADPT_MAX_DATA_RATES_G];
- u8 op_rate_set[SYSADPT_MAX_DATA_RATES_G];
- struct rsn_ie rsn_ie;
- struct rsn48_ie rsn48_ie;
- struct wmm_param_elem wmm_param;
- struct country country;
- __le32 ap_rf_type; /* 0->B, 1->G, 2->Mixed, 3->A, 4->11J */
-} __packed;
-
-struct hostcmd_cmd_ap_beacon {
- struct hostcmd_header cmd_hdr;
- struct start_cmd start_cmd;
-} __packed;
-
-/* HOSTCMD_CMD_SET_NEW_STN */
-struct add_ht_info {
- u8 control_chnl;
- u8 add_chnl;
- __le16 op_mode;
- __le16 stbc;
-} __packed;
-
-struct peer_info {
- __le32 legacy_rate_bitmap;
- u8 ht_rates[4];
- __le16 cap_info;
- __le16 ht_cap_info;
- u8 mac_ht_param_info;
- u8 mrvl_sta;
- struct add_ht_info add_ht_info;
- __le32 tx_bf_capabilities; /* EXBF_SUPPORT */
- __le32 vht_max_rx_mcs;
- __le32 vht_cap;
- /* 0:20Mhz, 1:40Mhz, 2:80Mhz, 3:160 or 80+80Mhz */
- u8 vht_rx_channel_width;
-} __packed;
-
-struct hostcmd_cmd_set_new_stn {
- struct hostcmd_header cmd_hdr;
- __le16 aid;
- u8 mac_addr[ETH_ALEN];
- __le16 stn_id;
- __le16 action;
- __le16 reserved;
- struct peer_info peer_info;
- /* UAPSD_SUPPORT */
- u8 qos_info;
- u8 is_qos_sta;
- __le32 fw_sta_ptr;
-} __packed;
-
-/* HOSTCMD_CMD_SET_APMODE */
-struct hostcmd_cmd_set_apmode {
- struct hostcmd_header cmd_hdr;
- u8 apmode;
-} __packed;
-
-/* HOSTCMD_CMD_UPDATE_ENCRYPTION */
-struct hostcmd_cmd_update_encryption {
- struct hostcmd_header cmd_hdr;
- /* Action type - see encr_action_type */
- __le32 action_type; /* encr_action_type */
- /* size of the data buffer attached. */
- __le32 data_length;
- u8 mac_addr[ETH_ALEN];
- u8 action_data[1];
-} __packed;
-
-struct wep_type_key {
- /* WEP key material (max 128bit) */
- u8 key_material[MAX_ENCR_KEY_LENGTH];
-} __packed;
-
-struct encr_tkip_seqcnt {
- __le16 low;
- __le32 high;
-} __packed;
-
-struct tkip_type_key {
- /* TKIP Key material. Key type (group or pairwise key) is
- * determined by flags
- */
- /* in KEY_PARAM_SET structure. */
- u8 key_material[MAX_ENCR_KEY_LENGTH];
- /* MIC keys */
- u8 tkip_tx_mic_key[MIC_KEY_LENGTH];
- u8 tkip_rx_mic_key[MIC_KEY_LENGTH];
- struct encr_tkip_seqcnt tkip_rsc;
- struct encr_tkip_seqcnt tkip_tsc;
-} __packed;
-
-struct aes_type_key {
- /* AES Key material */
- u8 key_material[MAX_ENCR_KEY_LENGTH];
-} __packed;
-
-union mwl_key_type {
- struct wep_type_key wep_key;
- struct tkip_type_key tkip_key;
- struct aes_type_key aes_key;
-} __packed;
-
-struct key_param_set {
- /* Total length of this structure (Key is variable size array) */
- __le16 length;
- /* Key type - WEP, TKIP or AES-CCMP. */
- /* See definitions above */
- __le16 key_type_id;
- /* key flags (ENCR_KEY_FLAG_XXX_ */
- __le32 key_info;
- /* For WEP only - actual key index */
- __le32 key_index;
- /* Size of the key */
- __le16 key_len;
- /* Key material (variable size array) */
- union mwl_key_type key;
- u8 mac_addr[ETH_ALEN];
-} __packed;
-
-struct hostcmd_cmd_set_key {
- struct hostcmd_header cmd_hdr;
- /* Action type - see encr_action_type */
- __le32 action_type; /* encr_action_type */
- /* size of the data buffer attached. */
- __le32 data_length;
- /* data buffer - maps to one KEY_PARAM_SET structure */
- struct key_param_set key_param;
-} __packed;
-
-/* HOSTCMD_CMD_BASTREAM */
-#define BA_TYPE_MASK 0x00000001
-#define BA_DIRECTION_MASK 0x00000006
-#define BA_DIRECTION_SHIFT 1
-
-struct ba_context {
- __le32 context;
-} __packed;
-
-/* parameters for block ack creation */
-struct create_ba_params {
- /* BA Creation flags - see above */
- __le32 flags;
- /* idle threshold */
- __le32 idle_thrs;
- /* block ack transmit threshold (after how many pkts should we
- * send BAR?)
- */
- __le32 bar_thrs;
- /* receiver window size */
- __le32 window_size;
- /* MAC Address of the BA partner */
- u8 peer_mac_addr[ETH_ALEN];
- /* Dialog Token */
- u8 dialog_token;
- /* TID for the traffic stream in this BA */
- u8 tid;
- /* shared memory queue ID (not sure if this is required) */
- u8 queue_id;
- u8 param_info;
- /* returned by firmware - firmware context pointer. */
- /* this context pointer will be passed to firmware for all
- * future commands.
- */
- struct ba_context fw_ba_context;
- u8 reset_seq_no; /** 0 or 1**/
- __le16 current_seq;
- /* This is for virtual station in Sta proxy mode for V6FW */
- u8 sta_src_mac_addr[ETH_ALEN];
-} __packed;
-
-/* new transmit sequence number information */
-struct ba_update_seq_num {
- /* BA flags - see above */
- __le32 flags;
- /* returned by firmware in the create ba stream response */
- struct ba_context fw_ba_context;
- /* new sequence number for this block ack stream */
- __le16 ba_seq_num;
-} __packed;
-
-struct ba_stream_context {
- /* BA Stream flags */
- __le32 flags;
- /* returned by firmware in the create ba stream response */
- struct ba_context fw_ba_context;
-} __packed;
-
-union ba_info {
- /* information required to create BA Stream... */
- struct create_ba_params create_params;
- /* update starting/new sequence number etc. */
- struct ba_update_seq_num updt_seq_num;
- /* destroy an existing stream... */
- struct ba_stream_context destroy_params;
- /* destroy an existing stream... */
- struct ba_stream_context flush_params;
-} __packed;
-
-struct hostcmd_cmd_bastream {
- struct hostcmd_header cmd_hdr;
- __le32 action_type;
- union ba_info ba_info;
-} __packed;
-
-/* HOSTCMD_CMD_DWDS_ENABLE */
-struct hostcmd_cmd_dwds_enable {
- struct hostcmd_header cmd_hdr;
- __le32 enable; /* 0 -- Disable. or 1 -- Enable. */
-} __packed;
-
-/* HOSTCMD_CMD_FW_FLUSH_TIMER */
-struct hostcmd_cmd_fw_flush_timer {
- struct hostcmd_header cmd_hdr;
- /* 0 -- Disable. > 0 -- holds time value in usecs. */
- __le32 value;
-} __packed;
-
-/* HOSTCMD_CMD_SET_CDD */
-struct hostcmd_cmd_set_cdd {
- struct hostcmd_header cmd_hdr;
- __le32 enable;
-} __packed;
-
static bool mwl_fwcmd_chk_adapter(struct mwl_priv *priv)
{
u32 regval;
@@ -755,7 +34,7 @@ static bool mwl_fwcmd_chk_adapter(struct mwl_priv *priv)
regval = readl(priv->iobase1 + MACREG_REG_INT_CODE);
if (regval == 0xffffffff) {
- wiphy_err(priv->hw->wiphy, "adapter is not existed");
+ wiphy_err(priv->hw->wiphy, "adapter does not exist\n");
return false;
}
@@ -829,7 +108,7 @@ static int mwl_fwcmd_wait_complete(struct mwl_priv *priv, unsigned short cmd)
} while ((int_code != cmd) && (--curr_iteration));
if (curr_iteration == 0) {
- wiphy_err(priv->hw->wiphy, "cmd 0x%04x=%s timed out",
+ wiphy_err(priv->hw->wiphy, "cmd 0x%04x=%s timed out\n",
cmd, mwl_fwcmd_get_cmd_string(cmd));
return -EIO;
}
@@ -844,7 +123,7 @@ static int mwl_fwcmd_exec_cmd(struct mwl_priv *priv, unsigned short cmd)
bool busy = false;
if (!mwl_fwcmd_chk_adapter(priv)) {
- wiphy_err(priv->hw->wiphy, "no adapter existed");
+ wiphy_err(priv->hw->wiphy, "adapter does not exist\n");
priv->in_send_cmd = false;
return -EIO;
}
@@ -853,13 +132,13 @@ static int mwl_fwcmd_exec_cmd(struct mwl_priv *priv, unsigned short cmd)
priv->in_send_cmd = true;
mwl_fwcmd_send_cmd(priv);
if (mwl_fwcmd_wait_complete(priv, 0x8000 | cmd)) {
- wiphy_err(priv->hw->wiphy, "timeout");
+ wiphy_err(priv->hw->wiphy, "timeout\n");
priv->in_send_cmd = false;
return -EIO;
}
} else {
wiphy_warn(priv->hw->wiphy,
- "previous command is still running");
+ "previous command is still running\n");
busy = true;
}
@@ -873,14 +152,13 @@ static int mwl_fwcmd_802_11_radio_control(struct mwl_priv *priv,
bool enable, bool force)
{
struct hostcmd_cmd_802_11_radio_control *pcmd;
- unsigned long flags;
if (enable == priv->radio_on && !force)
return 0;
pcmd = (struct hostcmd_cmd_802_11_radio_control *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_RADIO_CONTROL);
@@ -891,14 +169,14 @@ static int mwl_fwcmd_802_11_radio_control(struct mwl_priv *priv,
pcmd->radio_on = cpu_to_le16(enable ? WL_ENABLE : WL_DISABLE);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_RADIO_CONTROL)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(priv->hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(priv->hw->wiphy, "failed execution\n");
return -EIO;
}
priv->radio_on = enable;
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -907,12 +185,11 @@ static int mwl_fwcmd_get_tx_powers(struct mwl_priv *priv, u16 *powlist, u16 ch,
u16 band, u16 width, u16 sub_ch)
{
struct hostcmd_cmd_802_11_tx_power *pcmd;
- unsigned long flags;
int i;
pcmd = (struct hostcmd_cmd_802_11_tx_power *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_TX_POWER);
@@ -924,15 +201,15 @@ static int mwl_fwcmd_get_tx_powers(struct mwl_priv *priv, u16 *powlist, u16 ch,
pcmd->sub_ch = cpu_to_le16(sub_ch);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_TX_POWER)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(priv->hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(priv->hw->wiphy, "failed execution\n");
return -EIO;
}
for (i = 0; i < SYSADPT_TX_POWER_LEVEL_TOTAL; i++)
powlist[i] = le16_to_cpu(pcmd->power_level_list[i]);
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -942,12 +219,11 @@ static int mwl_fwcmd_set_tx_powers(struct mwl_priv *priv, u16 txpow[],
u16 width, u16 sub_ch)
{
struct hostcmd_cmd_802_11_tx_power *pcmd;
- unsigned long flags;
int i;
pcmd = (struct hostcmd_cmd_802_11_tx_power *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_TX_POWER);
@@ -962,12 +238,12 @@ static int mwl_fwcmd_set_tx_powers(struct mwl_priv *priv, u16 txpow[],
pcmd->power_level_list[i] = cpu_to_le16(txpow[i]);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_TX_POWER)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(priv->hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(priv->hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1200,7 +476,6 @@ static void mwl_fwcmd_parse_beacon(struct mwl_priv *priv,
static int mwl_fwcmd_set_ies(struct mwl_priv *priv, struct mwl_vif *mwl_vif)
{
struct hostcmd_cmd_set_ies *pcmd;
- unsigned long flags;
if (!mwl_vif->beacon_info.valid)
return -EINVAL;
@@ -1213,7 +488,7 @@ static int mwl_fwcmd_set_ies(struct mwl_priv *priv, struct mwl_vif *mwl_vif)
pcmd = (struct hostcmd_cmd_set_ies *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_IES);
@@ -1239,18 +514,18 @@ static int mwl_fwcmd_set_ies(struct mwl_priv *priv, struct mwl_vif *mwl_vif)
}
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_IES)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(priv->hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(priv->hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
einval:
- wiphy_err(priv->hw->wiphy, "length of IE is too long");
+ wiphy_err(priv->hw->wiphy, "length of IE is too long\n");
return -EINVAL;
}
@@ -1260,7 +535,6 @@ static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv,
struct ieee80211_bss_conf *bss_conf)
{
struct hostcmd_cmd_ap_beacon *pcmd;
- unsigned long flags;
struct ds_params *phy_ds_param_set;
if (!mwl_vif->beacon_info.valid)
@@ -1283,7 +557,7 @@ static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv,
pcmd = (struct hostcmd_cmd_ap_beacon *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_AP_BEACON);
@@ -1320,18 +594,18 @@ static int mwl_fwcmd_set_ap_beacon(struct mwl_priv *priv,
SYSADPT_MAX_DATA_RATES_G);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_AP_BEACON)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(priv->hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(priv->hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
ielenerr:
- wiphy_err(priv->hw->wiphy, "length of IE is too long");
+ wiphy_err(priv->hw->wiphy, "length of IE is too long\n");
return -EINVAL;
}
@@ -1382,9 +656,7 @@ static int mwl_fwcmd_encryption_set_cmd_info(struct hostcmd_cmd_set_key *cmd,
void mwl_fwcmd_reset(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
-
- priv = hw->priv;
+ struct mwl_priv *priv = hw->priv;
if (mwl_fwcmd_chk_adapter(priv))
writel(ISR_RESET,
@@ -1393,9 +665,7 @@ void mwl_fwcmd_reset(struct ieee80211_hw *hw)
void mwl_fwcmd_int_enable(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
-
- priv = hw->priv;
+ struct mwl_priv *priv = hw->priv;
if (mwl_fwcmd_chk_adapter(priv)) {
writel(0x00,
@@ -1407,9 +677,7 @@ void mwl_fwcmd_int_enable(struct ieee80211_hw *hw)
void mwl_fwcmd_int_disable(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
-
- priv = hw->priv;
+ struct mwl_priv *priv = hw->priv;
if (mwl_fwcmd_chk_adapter(priv))
writel(0x00,
@@ -1418,19 +686,16 @@ void mwl_fwcmd_int_disable(struct ieee80211_hw *hw)
int mwl_fwcmd_get_hw_specs(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_get_hw_spec *pcmd;
- unsigned long flags;
int retry;
int i;
- priv = hw->priv;
-
pcmd = (struct hostcmd_cmd_get_hw_spec *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
- wiphy_debug(hw->wiphy, "pcmd = %x", (unsigned int)pcmd);
+ wiphy_debug(hw->wiphy, "pcmd = %p\n", pcmd);
memset(pcmd, 0x00, sizeof(*pcmd));
memset(&pcmd->permanent_addr[0], 0xff, ETH_ALEN);
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_GET_HW_SPEC);
@@ -1440,24 +705,22 @@ int mwl_fwcmd_get_hw_specs(struct ieee80211_hw *hw)
retry = 0;
while (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_GET_HW_SPEC)) {
if (retry++ > MAX_WAIT_GET_HW_SPECS_ITERATONS) {
- wiphy_err(hw->wiphy, "can't get hw specs");
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ wiphy_err(hw->wiphy, "can't get hw specs\n");
+ spin_unlock_bh(&priv->fwcmd_lock);
return -EIO;
}
mdelay(1000);
wiphy_debug(hw->wiphy,
- "repeat command = %x", (unsigned int)pcmd);
+ "repeat command = %p\n", pcmd);
}
ether_addr_copy(&priv->hw_data.mac_addr[0], pcmd->permanent_addr);
priv->desc_data[0].wcb_base =
le32_to_cpu(pcmd->wcb_base0) & 0x0000ffff;
-#if SYSADPT_NUM_OF_DESC_DATA > 3
for (i = 1; i < SYSADPT_TOTAL_TX_QUEUES; i++)
priv->desc_data[i].wcb_base =
le32_to_cpu(pcmd->wcb_base[i - 1]) & 0x0000ffff;
-#endif
priv->desc_data[0].rx_desc_read =
le32_to_cpu(pcmd->rxpd_rd_ptr) & 0x0000ffff;
priv->desc_data[0].rx_desc_write =
@@ -1470,51 +733,28 @@ int mwl_fwcmd_get_hw_specs(struct ieee80211_hw *hw)
priv->hw_data.hw_version = pcmd->version;
priv->hw_data.host_interface = pcmd->host_if;
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_hw_specs(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_hw_spec *pcmd;
- unsigned long flags;
int i;
- priv = hw->priv;
-
- /* Info for debugging
- */
- wiphy_info(hw->wiphy, "%s ...", __func__);
- wiphy_info(hw->wiphy, " -->pPhysTxRing[0] = %x",
- priv->desc_data[0].pphys_tx_ring);
- wiphy_info(hw->wiphy, " -->pPhysTxRing[1] = %x",
- priv->desc_data[1].pphys_tx_ring);
- wiphy_info(hw->wiphy, " -->pPhysTxRing[2] = %x",
- priv->desc_data[2].pphys_tx_ring);
- wiphy_info(hw->wiphy, " -->pPhysTxRing[3] = %x",
- priv->desc_data[3].pphys_tx_ring);
- wiphy_info(hw->wiphy, " -->pPhysRxRing = %x",
- priv->desc_data[0].pphys_rx_ring);
- wiphy_info(hw->wiphy, " -->numtxq %d wcbperq %d totalrxwcb %d",
- SYSADPT_NUM_OF_DESC_DATA,
- SYSADPT_MAX_NUM_TX_DESC,
- SYSADPT_MAX_NUM_RX_DESC);
-
pcmd = (struct hostcmd_cmd_set_hw_spec *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_HW_SPEC);
pcmd->cmd_hdr.len = cpu_to_le16(sizeof(*pcmd));
pcmd->wcb_base[0] = cpu_to_le32(priv->desc_data[0].pphys_tx_ring);
-#if SYSADPT_NUM_OF_DESC_DATA > 3
for (i = 1; i < SYSADPT_TOTAL_TX_QUEUES; i++)
pcmd->wcb_base[i] =
cpu_to_le32(priv->desc_data[i].pphys_tx_ring);
-#endif
pcmd->tx_wcb_num_per_queue = cpu_to_le32(SYSADPT_MAX_NUM_TX_DESC);
pcmd->num_tx_queues = cpu_to_le32(SYSADPT_NUM_OF_DESC_DATA);
pcmd->total_rx_wcb = cpu_to_le32(SYSADPT_MAX_NUM_RX_DESC);
@@ -1522,12 +762,12 @@ int mwl_fwcmd_set_hw_specs(struct ieee80211_hw *hw)
pcmd->features = 0;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_HW_SPEC)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1535,23 +775,20 @@ int mwl_fwcmd_set_hw_specs(struct ieee80211_hw *hw)
int mwl_fwcmd_get_stat(struct ieee80211_hw *hw,
struct ieee80211_low_level_stats *stats)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_802_11_get_stat *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_802_11_get_stat *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_GET_STAT);
pcmd->cmd_hdr.len = cpu_to_le16(sizeof(*pcmd));
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_GET_STAT)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
@@ -1564,7 +801,7 @@ int mwl_fwcmd_get_stat(struct ieee80211_hw *hw,
stats->dot11RTSSuccessCount =
le32_to_cpu(pcmd->rts_successes);
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1581,11 +818,9 @@ int mwl_fwcmd_radio_disable(struct ieee80211_hw *hw)
int mwl_fwcmd_set_radio_preamble(struct ieee80211_hw *hw, bool short_preamble)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
int rc;
- priv = hw->priv;
-
priv->radio_short_preamble = short_preamble;
rc = mwl_fwcmd_802_11_radio_control(priv, true, true);
@@ -1596,15 +831,13 @@ int mwl_fwcmd_max_tx_power(struct ieee80211_hw *hw,
struct ieee80211_conf *conf, u8 fraction)
{
struct ieee80211_channel *channel = conf->chandef.chan;
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
int reduce_val = 0;
u16 band = 0, width = 0, sub_ch = 0;
u16 maxtxpow[SYSADPT_TX_POWER_LEVEL_TOTAL];
int i, tmp;
int rc;
- priv = hw->priv;
-
switch (fraction) {
case 0:
reduce_val = 0; /* Max */
@@ -1683,7 +916,7 @@ int mwl_fwcmd_tx_power(struct ieee80211_hw *hw,
struct ieee80211_conf *conf, u8 fraction)
{
struct ieee80211_channel *channel = conf->chandef.chan;
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
int reduce_val = 0;
u16 band = 0, width = 0, sub_ch = 0;
u16 txpow[SYSADPT_TX_POWER_LEVEL_TOTAL];
@@ -1691,8 +924,6 @@ int mwl_fwcmd_tx_power(struct ieee80211_hw *hw,
int i, tmp;
int rc;
- priv = hw->priv;
-
switch (fraction) {
case 0:
reduce_val = 0; /* Max */
@@ -1814,15 +1045,12 @@ int mwl_fwcmd_tx_power(struct ieee80211_hw *hw,
int mwl_fwcmd_rf_antenna(struct ieee80211_hw *hw, int dir, int antenna)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_802_11_rf_antenna *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_802_11_rf_antenna *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_RF_ANTENNA);
@@ -1847,12 +1075,12 @@ int mwl_fwcmd_rf_antenna(struct ieee80211_hw *hw, int dir, int antenna)
}
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_RF_ANTENNA)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1860,17 +1088,15 @@ int mwl_fwcmd_rf_antenna(struct ieee80211_hw *hw, int dir, int antenna)
int mwl_fwcmd_broadcast_ssid_enable(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, bool enable)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_broadcast_ssid_enable *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_broadcast_ssid_enable *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_BROADCAST_SSID_ENABLE);
@@ -1879,12 +1105,12 @@ int mwl_fwcmd_broadcast_ssid_enable(struct ieee80211_hw *hw,
pcmd->enable = cpu_to_le32(enable);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_BROADCAST_SSID_ENABLE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1893,16 +1119,13 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
struct ieee80211_conf *conf)
{
struct ieee80211_channel *channel = conf->chandef.chan;
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_rf_channel *pcmd;
- unsigned long flags;
u32 chnl_flags, freq_band, chnl_width, act_primary;
- priv = hw->priv;
-
pcmd = (struct hostcmd_cmd_set_rf_channel *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_RF_CHANNEL);
@@ -1910,12 +1133,14 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
pcmd->action = cpu_to_le16(WL_SET);
pcmd->curr_chnl = channel->hw_value;
- if (channel->band == IEEE80211_BAND_2GHZ)
+ if (channel->band == IEEE80211_BAND_2GHZ) {
freq_band = FREQ_BAND_2DOT4GHZ;
- else if (channel->band == IEEE80211_BAND_5GHZ)
+ } else if (channel->band == IEEE80211_BAND_5GHZ) {
freq_band = FREQ_BAND_5GHZ;
- else
+ } else {
+ spin_unlock_bh(&priv->fwcmd_lock);
return -EINVAL;
+ }
switch (conf->chandef.width) {
case NL80211_CHAN_WIDTH_20_NOHT:
@@ -1936,6 +1161,7 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
mwl_fwcmd_get_80m_pri_chnl_offset(pcmd->curr_chnl);
break;
default:
+ spin_unlock_bh(&priv->fwcmd_lock);
return -EINVAL;
}
@@ -1946,12 +1172,12 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
pcmd->chnl_flags = cpu_to_le32(chnl_flags);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_RF_CHANNEL)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1959,17 +1185,15 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
int mwl_fwcmd_set_aid(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *bssid, u16 aid)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_aid *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_aid *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_AID);
@@ -1979,12 +1203,12 @@ int mwl_fwcmd_set_aid(struct ieee80211_hw *hw,
ether_addr_copy(pcmd->mac_addr, bssid);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_AID)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -1992,17 +1216,15 @@ int mwl_fwcmd_set_aid(struct ieee80211_hw *hw,
int mwl_fwcmd_set_infra_mode(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_infra_mode *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_infra_mode *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_INFRA_MODE);
@@ -2010,27 +1232,24 @@ int mwl_fwcmd_set_infra_mode(struct ieee80211_hw *hw,
pcmd->cmd_hdr.macid = mwl_vif->macid;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_INFRA_MODE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_rts_threshold(struct ieee80211_hw *hw, int threshold)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_802_11_rts_thsd *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_802_11_rts_thsd *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_802_11_RTS_THSD);
@@ -2039,12 +1258,12 @@ int mwl_fwcmd_set_rts_threshold(struct ieee80211_hw *hw, int threshold)
pcmd->threshold = cpu_to_le16(threshold);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_802_11_RTS_THSD)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2052,15 +1271,12 @@ int mwl_fwcmd_set_rts_threshold(struct ieee80211_hw *hw, int threshold)
int mwl_fwcmd_set_edca_params(struct ieee80211_hw *hw, u8 index,
u16 cw_min, u16 cw_max, u8 aifs, u16 txop)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_edca_params *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_edca_params *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_EDCA_PARAMS);
@@ -2083,27 +1299,24 @@ int mwl_fwcmd_set_edca_params(struct ieee80211_hw *hw, u8 index,
pcmd->txq_num = 0;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_EDCA_PARAMS)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_wmm_mode *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_wmm_mode *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_WMM_MODE);
@@ -2111,27 +1324,24 @@ int mwl_fwcmd_set_wmm_mode(struct ieee80211_hw *hw, bool enable)
pcmd->action = cpu_to_le16(enable ? WL_ENABLE : WL_DISABLE);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_WMM_MODE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_use_fixed_rate(struct ieee80211_hw *hw, int mcast, int mgmt)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_fixed_rate *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_fixed_rate *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_FIXED_RATE);
@@ -2142,27 +1352,24 @@ int mwl_fwcmd_use_fixed_rate(struct ieee80211_hw *hw, int mcast, int mgmt)
pcmd->management_rate = mgmt;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_FIXED_RATE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_rate_adapt_mode(struct ieee80211_hw *hw, u16 mode)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_rate_adapt_mode *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_rate_adapt_mode *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_RATE_ADAPT_MODE);
@@ -2171,12 +1378,12 @@ int mwl_fwcmd_set_rate_adapt_mode(struct ieee80211_hw *hw, u16 mode)
pcmd->rate_adapt_mode = cpu_to_le16(mode);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_RATE_ADAPT_MODE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2184,17 +1391,15 @@ int mwl_fwcmd_set_rate_adapt_mode(struct ieee80211_hw *hw, u16 mode)
int mwl_fwcmd_set_mac_addr_client(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *mac_addr)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_mac_addr *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_mac_addr *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_MAC_ADDR);
@@ -2204,41 +1409,38 @@ int mwl_fwcmd_set_mac_addr_client(struct ieee80211_hw *hw,
ether_addr_copy(pcmd->mac_addr, mac_addr);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_MAC_ADDR)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_get_watchdog_bitmap(struct ieee80211_hw *hw, u8 *bitmap)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_get_watchdog_bitmap *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_get_watchdog_bitmap *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_GET_WATCHDOG_BITMAP);
pcmd->cmd_hdr.len = cpu_to_le16(sizeof(*pcmd));
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_GET_WATCHDOG_BITMAP)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
*bitmap = pcmd->watchdog_bitmap;
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2246,17 +1448,15 @@ int mwl_fwcmd_get_watchdog_bitmap(struct ieee80211_hw *hw, u8 *bitmap)
int mwl_fwcmd_remove_mac_addr(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *mac_addr)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_mac_addr *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_mac_addr *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_DEL_MAC_ADDR);
@@ -2265,12 +1465,12 @@ int mwl_fwcmd_remove_mac_addr(struct ieee80211_hw *hw,
ether_addr_copy(pcmd->mac_addr, mac_addr);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_DEL_MAC_ADDR)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2278,12 +1478,10 @@ int mwl_fwcmd_remove_mac_addr(struct ieee80211_hw *hw,
int mwl_fwcmd_bss_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, bool enable)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_bss_start *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
if (enable && (priv->running_bsses & (1 << mwl_vif->macid)))
@@ -2294,7 +1492,7 @@ int mwl_fwcmd_bss_start(struct ieee80211_hw *hw,
pcmd = (struct hostcmd_cmd_bss_start *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_BSS_START);
@@ -2311,8 +1509,8 @@ int mwl_fwcmd_bss_start(struct ieee80211_hw *hw,
}
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_BSS_START)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
@@ -2321,7 +1519,7 @@ int mwl_fwcmd_bss_start(struct ieee80211_hw *hw,
else
priv->running_bsses &= ~(1 << mwl_vif->macid);
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2329,10 +1527,9 @@ int mwl_fwcmd_bss_start(struct ieee80211_hw *hw,
int mwl_fwcmd_set_beacon(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *beacon, int len)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
mwl_fwcmd_parse_beacon(priv, mwl_vif, beacon, len);
@@ -2358,18 +1555,16 @@ int mwl_fwcmd_set_new_stn_add(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_new_stn *pcmd;
- unsigned long flags;
u32 rates;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_new_stn *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_NEW_STN);
@@ -2377,7 +1572,7 @@ int mwl_fwcmd_set_new_stn_add(struct ieee80211_hw *hw,
pcmd->cmd_hdr.macid = mwl_vif->macid;
pcmd->action = cpu_to_le16(HOSTCMD_ACT_STA_ACTION_ADD);
- if (mwl_vif->is_sta) {
+ if (vif->type == NL80211_IFTYPE_STATION) {
pcmd->aid = 0;
pcmd->stn_id = 0;
} else {
@@ -2415,22 +1610,22 @@ int mwl_fwcmd_set_new_stn_add(struct ieee80211_hw *hw,
pcmd->qos_info = ((sta->uapsd_queues << 4) | (sta->max_sp << 1));
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_NEW_STN)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- if (mwl_vif->is_sta) {
+ if (vif->type == NL80211_IFTYPE_STATION) {
ether_addr_copy(pcmd->mac_addr, mwl_vif->sta_mac);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_NEW_STN)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2438,17 +1633,15 @@ int mwl_fwcmd_set_new_stn_add(struct ieee80211_hw *hw,
int mwl_fwcmd_set_new_stn_add_self(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_new_stn *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_new_stn *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_NEW_STN);
@@ -2459,12 +1652,12 @@ int mwl_fwcmd_set_new_stn_add_self(struct ieee80211_hw *hw,
ether_addr_copy(pcmd->mac_addr, vif->addr);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_NEW_STN)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2472,17 +1665,15 @@ int mwl_fwcmd_set_new_stn_add_self(struct ieee80211_hw *hw,
int mwl_fwcmd_set_new_stn_del(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *addr)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_new_stn *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_new_stn *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_NEW_STN);
@@ -2493,37 +1684,34 @@ int mwl_fwcmd_set_new_stn_del(struct ieee80211_hw *hw,
ether_addr_copy(pcmd->mac_addr, addr);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_NEW_STN)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- if (mwl_vif->is_sta) {
+ if (vif->type == NL80211_IFTYPE_STATION) {
ether_addr_copy(pcmd->mac_addr, mwl_vif->sta_mac);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_NEW_STN)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_apmode(struct ieee80211_hw *hw, u8 apmode)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_apmode *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_apmode *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_APMODE);
@@ -2531,12 +1719,12 @@ int mwl_fwcmd_set_apmode(struct ieee80211_hw *hw, u8 apmode)
pcmd->apmode = apmode;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_APMODE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2545,17 +1733,15 @@ int mwl_fwcmd_update_encryption_enable(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 *addr, u8 encr_type)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_update_encryption *pcmd;
- unsigned long flags;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_update_encryption *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_UPDATE_ENCRYPTION);
@@ -2567,25 +1753,25 @@ int mwl_fwcmd_update_encryption_enable(struct ieee80211_hw *hw,
pcmd->action_data[0] = encr_type;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_UPDATE_ENCRYPTION)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- if (mwl_vif->is_sta) {
+ if (vif->type == NL80211_IFTYPE_STATION) {
if (memcmp(mwl_vif->bssid, addr, ETH_ALEN) == 0)
ether_addr_copy(pcmd->mac_addr, mwl_vif->sta_mac);
else
ether_addr_copy(pcmd->mac_addr, mwl_vif->bssid);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_UPDATE_ENCRYPTION)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2594,21 +1780,19 @@ int mwl_fwcmd_encryption_set_key(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *addr,
struct ieee80211_key_conf *key)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_key *pcmd;
- unsigned long flags;
int rc;
int keymlen;
u32 action;
u8 idx;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_key *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_UPDATE_ENCRYPTION);
@@ -2617,8 +1801,8 @@ int mwl_fwcmd_encryption_set_key(struct ieee80211_hw *hw,
rc = mwl_fwcmd_encryption_set_cmd_info(pcmd, addr, key);
if (rc) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "encryption not support");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "encryption not support\n");
return rc;
}
@@ -2648,8 +1832,8 @@ int mwl_fwcmd_encryption_set_key(struct ieee80211_hw *hw,
keymlen = key->keylen;
break;
default:
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "encryption not support");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "encryption not support\n");
return -ENOTSUPP;
}
@@ -2657,12 +1841,12 @@ int mwl_fwcmd_encryption_set_key(struct ieee80211_hw *hw,
pcmd->action_type = cpu_to_le32(action);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_UPDATE_ENCRYPTION)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- if (mwl_vif->is_sta) {
+ if (vif->type == NL80211_IFTYPE_STATION) {
if (memcmp(mwl_vif->bssid, addr, ETH_ALEN) == 0)
ether_addr_copy(pcmd->key_param.mac_addr,
mwl_vif->sta_mac);
@@ -2671,13 +1855,13 @@ int mwl_fwcmd_encryption_set_key(struct ieee80211_hw *hw,
mwl_vif->bssid);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_UPDATE_ENCRYPTION)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2686,18 +1870,16 @@ int mwl_fwcmd_encryption_remove_key(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u8 *addr,
struct ieee80211_key_conf *key)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_set_key *pcmd;
- unsigned long flags;
int rc;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_set_key *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_UPDATE_ENCRYPTION);
@@ -2706,8 +1888,8 @@ int mwl_fwcmd_encryption_remove_key(struct ieee80211_hw *hw,
rc = mwl_fwcmd_encryption_set_cmd_info(pcmd, addr, key);
if (rc) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "encryption not support");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "encryption not support\n");
return rc;
}
@@ -2718,12 +1900,12 @@ int mwl_fwcmd_encryption_remove_key(struct ieee80211_hw *hw,
mwl_vif->wep_key_conf[key->keyidx].enabled = 0;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_UPDATE_ENCRYPTION)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2732,18 +1914,16 @@ int mwl_fwcmd_check_ba(struct ieee80211_hw *hw,
struct mwl_ampdu_stream *stream,
struct ieee80211_vif *vif)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_bastream *pcmd;
- unsigned long flags;
u32 ba_flags, ba_type, ba_direction;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_bastream *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_BASTREAM);
@@ -2763,18 +1943,18 @@ int mwl_fwcmd_check_ba(struct ieee80211_hw *hw,
pcmd->ba_info.create_params.queue_id = stream->idx;
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_BASTREAM)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
if (pcmd->cmd_hdr.result != 0) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "result error");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "check ba result error\n");
return -EINVAL;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2783,18 +1963,16 @@ int mwl_fwcmd_create_ba(struct ieee80211_hw *hw,
struct mwl_ampdu_stream *stream,
u8 buf_size, struct ieee80211_vif *vif)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_vif *mwl_vif;
struct hostcmd_cmd_bastream *pcmd;
- unsigned long flags;
u32 ba_flags, ba_type, ba_direction;
- priv = hw->priv;
mwl_vif = mwl_dev_get_vif(vif);
pcmd = (struct hostcmd_cmd_bastream *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_BASTREAM);
@@ -2823,18 +2001,18 @@ int mwl_fwcmd_create_ba(struct ieee80211_hw *hw,
pcmd->ba_info.create_params.current_seq = cpu_to_le16(0);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_BASTREAM)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
if (pcmd->cmd_hdr.result != 0) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "result error");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "create ba result error\n");
return -EINVAL;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2842,16 +2020,13 @@ int mwl_fwcmd_create_ba(struct ieee80211_hw *hw,
int mwl_fwcmd_destroy_ba(struct ieee80211_hw *hw,
u8 idx)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_bastream *pcmd;
- unsigned long flags;
u32 ba_flags, ba_type, ba_direction;
- priv = hw->priv;
-
pcmd = (struct hostcmd_cmd_bastream *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_BASTREAM);
@@ -2866,12 +2041,12 @@ int mwl_fwcmd_destroy_ba(struct ieee80211_hw *hw,
pcmd->ba_info.destroy_params.fw_ba_context.context = cpu_to_le32(idx);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_BASTREAM)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
@@ -2881,12 +2056,10 @@ struct mwl_ampdu_stream *mwl_fwcmd_add_stream(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
u8 tid)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_ampdu_stream *stream;
int i;
- priv = hw->priv;
-
for (i = 0; i < SYSADPT_TX_AMPDU_QUEUES; i++) {
stream = &priv->ampdu[i];
@@ -2921,12 +2094,10 @@ void mwl_fwcmd_remove_stream(struct ieee80211_hw *hw,
struct mwl_ampdu_stream *mwl_fwcmd_lookup_stream(struct ieee80211_hw *hw,
u8 *addr, u8 tid)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct mwl_ampdu_stream *stream;
int i;
- priv = hw->priv;
-
for (i = 0; i < SYSADPT_TX_AMPDU_QUEUES; i++) {
stream = &priv->ampdu[i];
@@ -2958,15 +2129,12 @@ bool mwl_fwcmd_ampdu_allowed(struct ieee80211_sta *sta, u8 tid)
int mwl_fwcmd_set_dwds_stamode(struct ieee80211_hw *hw, bool enable)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_dwds_enable *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_dwds_enable *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_DWDS_ENABLE);
@@ -2974,27 +2142,24 @@ int mwl_fwcmd_set_dwds_stamode(struct ieee80211_hw *hw, bool enable)
pcmd->enable = cpu_to_le32(enable);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_DWDS_ENABLE)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_fw_flush_timer(struct ieee80211_hw *hw, u32 value)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_fw_flush_timer *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_fw_flush_timer *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_FW_FLUSH_TIMER);
@@ -3002,27 +2167,24 @@ int mwl_fwcmd_set_fw_flush_timer(struct ieee80211_hw *hw, u32 value)
pcmd->value = cpu_to_le32(value);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_FW_FLUSH_TIMER)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}
int mwl_fwcmd_set_cdd(struct ieee80211_hw *hw)
{
- struct mwl_priv *priv;
+ struct mwl_priv *priv = hw->priv;
struct hostcmd_cmd_set_cdd *pcmd;
- unsigned long flags;
-
- priv = hw->priv;
pcmd = (struct hostcmd_cmd_set_cdd *)&priv->pcmd_buf[0];
- spin_lock_irqsave(&priv->fwcmd_lock, flags);
+ spin_lock_bh(&priv->fwcmd_lock);
memset(pcmd, 0x00, sizeof(*pcmd));
pcmd->cmd_hdr.cmd = cpu_to_le16(HOSTCMD_CMD_SET_CDD);
@@ -3030,12 +2192,12 @@ int mwl_fwcmd_set_cdd(struct ieee80211_hw *hw)
pcmd->enable = cpu_to_le32(priv->cdd);
if (mwl_fwcmd_exec_cmd(priv, HOSTCMD_CMD_SET_CDD)) {
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
- wiphy_err(hw->wiphy, "failed execution");
+ spin_unlock_bh(&priv->fwcmd_lock);
+ wiphy_err(hw->wiphy, "failed execution\n");
return -EIO;
}
- spin_unlock_irqrestore(&priv->fwcmd_lock, flags);
+ spin_unlock_bh(&priv->fwcmd_lock);
return 0;
}