forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/realtek/rtlwifi/wifi.h
....@@ -1,27 +1,5 @@
1
-/******************************************************************************
2
- *
3
- * Copyright(c) 2009-2012 Realtek Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of version 2 of the GNU General Public License as
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * The full GNU General Public License is included in this distribution in the
15
- * file called LICENSE.
16
- *
17
- * Contact Information:
18
- * wlanfae <wlanfae@realtek.com>
19
- * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20
- * Hsinchu 300, Taiwan.
21
- *
22
- * Larry Finger <Larry.Finger@lwfinger.net>
23
- *
24
- *****************************************************************************/
1
+/* SPDX-License-Identifier: GPL-2.0 */
2
+/* Copyright(c) 2009-2012 Realtek Corporation.*/
253
264 #ifndef __RTL_WIFI_H__
275 #define __RTL_WIFI_H__
....@@ -35,6 +13,7 @@
3513 #include <linux/usb.h>
3614 #include <net/mac80211.h>
3715 #include <linux/completion.h>
16
+#include <linux/bitfield.h>
3817 #include "debug.h"
3918
4019 #define MASKBYTE0 0xff
....@@ -263,7 +242,7 @@
263242 u8 date;
264243 u8 hour;
265244 u8 minute;
266
- __le16 ramcodeSize;
245
+ __le16 ramcodesize;
267246 __le16 rsvd2;
268247 __le32 svnindex;
269248 __le32 rsvd3;
....@@ -435,8 +414,8 @@
435414 HW_VAR_MULTICAST_REG = 0x1,
436415 HW_VAR_BASIC_RATE = 0x2,
437416 HW_VAR_BSSID = 0x3,
438
- HW_VAR_MEDIA_STATUS= 0x4,
439
- HW_VAR_SECURITY_CONF= 0x5,
417
+ HW_VAR_MEDIA_STATUS = 0x4,
418
+ HW_VAR_SECURITY_CONF = 0x5,
440419 HW_VAR_BEACON_INTERVAL = 0x6,
441420 HW_VAR_ATIM_WINDOW = 0x7,
442421 HW_VAR_LISTEN_INTERVAL = 0x8,
....@@ -453,7 +432,7 @@
453432 HW_VAR_ACK_PREAMBLE = 0x13,
454433 HW_VAR_CW_CONFIG = 0x14,
455434 HW_VAR_CW_VALUES = 0x15,
456
- HW_VAR_RATE_FALLBACK_CONTROL= 0x16,
435
+ HW_VAR_RATE_FALLBACK_CONTROL = 0x16,
457436 HW_VAR_CONTENTION_WINDOW = 0x17,
458437 HW_VAR_RETRY_COUNT = 0x18,
459438 HW_VAR_TR_SWITCH = 0x19,
....@@ -465,11 +444,11 @@
465444 HW_VAR_MCS_RATE_AVAILABLE = 0x1f,
466445 HW_VAR_AC_PARAM = 0x20,
467446 HW_VAR_ACM_CTRL = 0x21,
468
- HW_VAR_DIS_Req_Qsize = 0x22,
447
+ HW_VAR_DIS_REQ_QSIZE = 0x22,
469448 HW_VAR_CCX_CHNL_LOAD = 0x23,
470449 HW_VAR_CCX_NOISE_HISTOGRAM = 0x24,
471450 HW_VAR_CCX_CLM_NHM = 0x25,
472
- HW_VAR_TxOPLimit = 0x26,
451
+ HW_VAR_TXOPLIMIT = 0x26,
473452 HW_VAR_TURBO_MODE = 0x27,
474453 HW_VAR_RF_STATE = 0x28,
475454 HW_VAR_RF_OFF_BY_HW = 0x29,
....@@ -522,7 +501,7 @@
522501 HW_VAR_BCN_VALID = 0x55,
523502 HW_VAR_FWLPS_RF_ON = 0x56,
524503 HW_VAR_DUAL_TSF_RST = 0x57,
525
- HW_VAR_SWITCH_EPHY_WoWLAN = 0x58,
504
+ HW_VAR_SWITCH_EPHY_WOWLAN = 0x58,
526505 HW_VAR_INT_MIGRATION = 0x59,
527506 HW_VAR_INT_AC = 0x5a,
528507 HW_VAR_RF_TIMING = 0x5b,
....@@ -619,8 +598,9 @@
619598 HT_CHANNEL_WIDTH_MAX,
620599 };
621600
622
-/* Ref: 802.11i sepc D10.0 7.3.2.25.1
623
-Cipher Suites Encryption Algorithms */
601
+/* Ref: 802.11i spec D10.0 7.3.2.25.1
602
+ * Cipher Suites Encryption Algorithms
603
+ */
624604 enum rt_enc_alg {
625605 NO_ENCRYPTION = 0,
626606 WEP40_ENCRYPTION = 1,
....@@ -770,7 +750,8 @@
770750 RTL_IMR_ROK, /*Receive DMA OK Interrupt */
771751 RTL_IMR_HSISR_IND, /*HSISR Interrupt*/
772752 RTL_IBSS_INT_MASKS, /*(RTL_IMR_BCNINT | RTL_IMR_TBDOK |
773
- * RTL_IMR_TBDER) */
753
+ * RTL_IMR_TBDER)
754
+ */
774755 RTL_IMR_C2HCMD, /*fw interrupt*/
775756
776757 /*CCK Rates, TxHT = 0 */
....@@ -814,8 +795,8 @@
814795 FW_PS_UAPSD_MODE = 6,
815796 FW_PS_IBSS_MODE = 7,
816797 FW_PS_WWLAN_MODE = 8,
817
- FW_PS_PM_Radio_Off = 9,
818
- FW_PS_PM_Card_Disable = 10,
798
+ FW_PS_PM_RADIO_OFF = 9,
799
+ FW_PS_PM_CARD_DISABLE = 10,
819800 };
820801
821802 enum rt_psmode {
....@@ -849,8 +830,8 @@
849830 /*QoS related.*/
850831 /*acm implementation method.*/
851832 enum acm_method {
852
- eAcmWay0_SwAndHw = 0,
853
- eAcmWay1_HW = 1,
833
+ EACMWAY0_SWANDHW = 0,
834
+ EACMWAY1_HW = 1,
854835 EACMWAY2_SW = 2,
855836 };
856837
....@@ -867,8 +848,9 @@
867848 BANDMAX
868849 };
869850
870
-/*aci/aifsn Field.
871
-Ref: WMM spec 2.2.2: WME Parameter Element, p.12.*/
851
+/* aci/aifsn Field.
852
+ * Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
853
+ */
872854 union aci_aifsn {
873855 u8 char_data;
874856
....@@ -1069,13 +1051,13 @@
10691051 u8 addr2[ETH_ALEN];
10701052 u8 addr3[ETH_ALEN];
10711053 __le16 seq_ctl;
1072
- u8 payload[0];
1054
+ u8 payload[];
10731055 } __packed;
10741056
10751057 struct rtl_info_element {
10761058 u8 id;
10771059 u8 len;
1078
- u8 data[0];
1060
+ u8 data[];
10791061 } __packed;
10801062
10811063 struct rtl_probe_rsp {
....@@ -1084,8 +1066,9 @@
10841066 __le16 beacon_interval;
10851067 __le16 capability;
10861068 /*SSID, supported rates, FH params, DS params,
1087
- CF params, IBSS params, TIM (if beacon), RSN */
1088
- struct rtl_info_element info_element[0];
1069
+ * CF params, IBSS params, TIM (if beacon), RSN
1070
+ */
1071
+ struct rtl_info_element info_element[];
10891072 } __packed;
10901073
10911074 /*LED related.*/
....@@ -1158,7 +1141,8 @@
11581141
11591142 long rx_snr_db[4];
11601143 /*Correct smoothed ss in Dbm, only used
1161
- in driver to report real power now. */
1144
+ * in driver to report real power now.
1145
+ */
11621146 long recv_signal_power;
11631147 long signal_quality;
11641148 long last_sigstrength_inpercent;
....@@ -1166,8 +1150,9 @@
11661150 u32 rssi_calculate_cnt;
11671151 u32 pwdb_all_cnt;
11681152
1169
- /*Transformed, in dbm. Beautified signal
1170
- strength for UI, not correct. */
1153
+ /* Transformed, in dbm. Beautified signal
1154
+ * strength for UI, not correct.
1155
+ */
11711156 long signal_strength;
11721157
11731158 u8 rx_rssi_percentage[4];
....@@ -1478,15 +1463,15 @@
14781463 /*PCI IO map */
14791464 unsigned long pci_base_addr; /*device I/O address */
14801465
1481
- void (*write8_async) (struct rtl_priv *rtlpriv, u32 addr, u8 val);
1482
- void (*write16_async) (struct rtl_priv *rtlpriv, u32 addr, u16 val);
1483
- void (*write32_async) (struct rtl_priv *rtlpriv, u32 addr, u32 val);
1484
- void (*writeN_sync) (struct rtl_priv *rtlpriv, u32 addr, void *buf,
1485
- u16 len);
1466
+ void (*write8_async)(struct rtl_priv *rtlpriv, u32 addr, u8 val);
1467
+ void (*write16_async)(struct rtl_priv *rtlpriv, u32 addr, u16 val);
1468
+ void (*write32_async)(struct rtl_priv *rtlpriv, u32 addr, u32 val);
1469
+ void (*writen_sync)(struct rtl_priv *rtlpriv, u32 addr, void *buf,
1470
+ u16 len);
14861471
1487
- u8(*read8_sync) (struct rtl_priv *rtlpriv, u32 addr);
1488
- u16(*read16_sync) (struct rtl_priv *rtlpriv, u32 addr);
1489
- u32(*read32_sync) (struct rtl_priv *rtlpriv, u32 addr);
1472
+ u8 (*read8_sync)(struct rtl_priv *rtlpriv, u32 addr);
1473
+ u16 (*read16_sync)(struct rtl_priv *rtlpriv, u32 addr);
1474
+ u32 (*read32_sync)(struct rtl_priv *rtlpriv, u32 addr);
14901475
14911476 };
14921477
....@@ -1711,7 +1696,8 @@
17111696 bool during_mac1init_radioa;
17121697 bool reloadtxpowerindex;
17131698 /* True if IMR or IQK have done
1714
- for 2.4G in scan progress */
1699
+ * for 2.4G in scan progress
1700
+ */
17151701 bool load_imrandiqk_setting_for2g;
17161702
17171703 bool disable_amsdu_8k;
....@@ -1750,12 +1736,14 @@
17501736 u32 hwsec_cam_bitmap;
17511737 u8 hwsec_cam_sta_addr[TOTAL_CAM_ENTRY][ETH_ALEN];
17521738 /*local Key buffer, indx 0 is for
1753
- pairwise key 1-4 is for agoup key. */
1739
+ * pairwise key 1-4 is for agoup key.
1740
+ */
17541741 u8 key_buf[KEY_BUF_SIZE][MAX_KEY_LEN];
17551742 u8 key_len[KEY_BUF_SIZE];
17561743
17571744 /*The pointer of Pairwise Key,
1758
- it always points to KeyBuf[4] */
1745
+ * it always points to KeyBuf[4]
1746
+ */
17591747 u8 *pairwise_key;
17601748 };
17611749
....@@ -1898,17 +1886,13 @@
18981886
18991887 struct rtl_efuse {
19001888 const struct rtl_efuse_ops *efuse_ops;
1901
- bool autoLoad_ok;
1889
+ bool autoload_ok;
19021890 bool bootfromefuse;
19031891 u16 max_physical_size;
19041892
19051893 u8 efuse_map[2][EFUSE_MAX_LOGICAL_SIZE];
19061894 u16 efuse_usedbytes;
19071895 u8 efuse_usedpercentage;
1908
-#ifdef EFUSE_REPG_WORKAROUND
1909
- bool efuse_re_pg_sec1flag;
1910
- u8 efuse_re_pg_data[8];
1911
-#endif
19121896
19131897 u8 autoload_failflag;
19141898 u8 autoload_status;
....@@ -1982,7 +1966,6 @@
19821966
19831967 u8 txpwr_safetyflag; /* Band edge enable flag */
19841968 u16 eeprom_txpowerdiff;
1985
- u8 legacy_httxpowerdiff; /* Legacy to HT rate power diff */
19861969 u8 antenna_txpwdiff[3];
19871970
19881971 u8 eeprom_regulatory;
....@@ -2023,11 +2006,10 @@
20232006 bool rfchange_inprogress;
20242007 bool swrf_processing;
20252008 bool hwradiooff;
2026
- /*
2027
- * just for PCIE ASPM
2009
+ /* just for PCIE ASPM
20282010 * If it supports ASPM, Offset[560h] = 0x40,
20292011 * otherwise Offset[560h] = 0x00.
2030
- * */
2012
+ */
20312013 bool support_aspm;
20322014 bool support_backdoor;
20332015
....@@ -2107,10 +2089,9 @@
21072089 u8 nic_type;
21082090 u16 length;
21092091 u8 signalquality; /*in 0-100 index. */
2110
- /*
2111
- * Real power in dBm for this packet,
2092
+ /* Real power in dBm for this packet,
21122093 * no beautification and aggregation.
2113
- * */
2094
+ */
21142095 s32 recvsignalpower;
21152096 s8 rxpower; /*in dBm Translate from PWdB */
21162097 u8 signalstrength; /*in 0-100 index. */
....@@ -2129,7 +2110,7 @@
21292110 u8 rx_bufshift;
21302111 bool isampdu;
21312112 bool isfirst_ampdu;
2132
- bool rx_is40Mhzpacket;
2113
+ bool rx_is40mhzpacket;
21332114 u8 rx_packet_bw;
21342115 u32 rx_pwdb_all;
21352116 u8 rx_mimo_signalstrength[4]; /*in 0~100 index */
....@@ -2157,11 +2138,9 @@
21572138 u8 packet_report_type;
21582139
21592140 u32 macid;
2160
- u8 wake_match;
21612141 u32 bt_rx_rssi_percentage;
21622142 u32 macid_valid_entry[2];
21632143 };
2164
-
21652144
21662145 struct rt_link_detect {
21672146 /* count for roaming */
....@@ -2236,114 +2215,114 @@
22362215 };
22372216
22382217 struct rtl_hal_ops {
2239
- int (*init_sw_vars) (struct ieee80211_hw *hw);
2240
- void (*deinit_sw_vars) (struct ieee80211_hw *hw);
2218
+ int (*init_sw_vars)(struct ieee80211_hw *hw);
2219
+ void (*deinit_sw_vars)(struct ieee80211_hw *hw);
22412220 void (*read_chip_version)(struct ieee80211_hw *hw);
2242
- void (*read_eeprom_info) (struct ieee80211_hw *hw);
2243
- void (*interrupt_recognized) (struct ieee80211_hw *hw,
2244
- struct rtl_int *intvec);
2245
- int (*hw_init) (struct ieee80211_hw *hw);
2246
- void (*hw_disable) (struct ieee80211_hw *hw);
2247
- void (*hw_suspend) (struct ieee80211_hw *hw);
2248
- void (*hw_resume) (struct ieee80211_hw *hw);
2249
- void (*enable_interrupt) (struct ieee80211_hw *hw);
2250
- void (*disable_interrupt) (struct ieee80211_hw *hw);
2251
- int (*set_network_type) (struct ieee80211_hw *hw,
2252
- enum nl80211_iftype type);
2221
+ void (*read_eeprom_info)(struct ieee80211_hw *hw);
2222
+ void (*interrupt_recognized)(struct ieee80211_hw *hw,
2223
+ struct rtl_int *intvec);
2224
+ int (*hw_init)(struct ieee80211_hw *hw);
2225
+ void (*hw_disable)(struct ieee80211_hw *hw);
2226
+ void (*hw_suspend)(struct ieee80211_hw *hw);
2227
+ void (*hw_resume)(struct ieee80211_hw *hw);
2228
+ void (*enable_interrupt)(struct ieee80211_hw *hw);
2229
+ void (*disable_interrupt)(struct ieee80211_hw *hw);
2230
+ int (*set_network_type)(struct ieee80211_hw *hw,
2231
+ enum nl80211_iftype type);
22532232 void (*set_chk_bssid)(struct ieee80211_hw *hw,
2254
- bool check_bssid);
2255
- void (*set_bw_mode) (struct ieee80211_hw *hw,
2256
- enum nl80211_channel_type ch_type);
2257
- u8(*switch_channel) (struct ieee80211_hw *hw);
2258
- void (*set_qos) (struct ieee80211_hw *hw, int aci);
2259
- void (*set_bcn_reg) (struct ieee80211_hw *hw);
2260
- void (*set_bcn_intv) (struct ieee80211_hw *hw);
2261
- void (*update_interrupt_mask) (struct ieee80211_hw *hw,
2262
- u32 add_msr, u32 rm_msr);
2263
- void (*get_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val);
2264
- void (*set_hw_reg) (struct ieee80211_hw *hw, u8 variable, u8 *val);
2265
- void (*update_rate_tbl) (struct ieee80211_hw *hw,
2266
- struct ieee80211_sta *sta, u8 rssi_leve,
2267
- bool update_bw);
2233
+ bool check_bssid);
2234
+ void (*set_bw_mode)(struct ieee80211_hw *hw,
2235
+ enum nl80211_channel_type ch_type);
2236
+ u8 (*switch_channel)(struct ieee80211_hw *hw);
2237
+ void (*set_qos)(struct ieee80211_hw *hw, int aci);
2238
+ void (*set_bcn_reg)(struct ieee80211_hw *hw);
2239
+ void (*set_bcn_intv)(struct ieee80211_hw *hw);
2240
+ void (*update_interrupt_mask)(struct ieee80211_hw *hw,
2241
+ u32 add_msr, u32 rm_msr);
2242
+ void (*get_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val);
2243
+ void (*set_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val);
2244
+ void (*update_rate_tbl)(struct ieee80211_hw *hw,
2245
+ struct ieee80211_sta *sta, u8 rssi_leve,
2246
+ bool update_bw);
22682247 void (*pre_fill_tx_bd_desc)(struct ieee80211_hw *hw, u8 *tx_bd_desc,
22692248 u8 *desc, u8 queue_index,
22702249 struct sk_buff *skb, dma_addr_t addr);
2271
- void (*update_rate_mask) (struct ieee80211_hw *hw, u8 rssi_level);
2250
+ void (*update_rate_mask)(struct ieee80211_hw *hw, u8 rssi_level);
22722251 u16 (*rx_desc_buff_remained_cnt)(struct ieee80211_hw *hw,
22732252 u8 queue_index);
22742253 void (*rx_check_dma_ok)(struct ieee80211_hw *hw, u8 *header_desc,
22752254 u8 queue_index);
2276
- void (*fill_tx_desc) (struct ieee80211_hw *hw,
2277
- struct ieee80211_hdr *hdr, u8 *pdesc_tx,
2278
- u8 *pbd_desc_tx,
2279
- struct ieee80211_tx_info *info,
2280
- struct ieee80211_sta *sta,
2281
- struct sk_buff *skb, u8 hw_queue,
2282
- struct rtl_tcb_desc *ptcb_desc);
2283
- void (*fill_fake_txdesc) (struct ieee80211_hw *hw, u8 *pDesc,
2284
- u32 buffer_len, bool bIsPsPoll);
2285
- void (*fill_tx_cmddesc) (struct ieee80211_hw *hw, u8 *pdesc,
2286
- bool firstseg, bool lastseg,
2287
- struct sk_buff *skb);
2255
+ void (*fill_tx_desc)(struct ieee80211_hw *hw,
2256
+ struct ieee80211_hdr *hdr, u8 *pdesc_tx,
2257
+ u8 *pbd_desc_tx,
2258
+ struct ieee80211_tx_info *info,
2259
+ struct ieee80211_sta *sta,
2260
+ struct sk_buff *skb, u8 hw_queue,
2261
+ struct rtl_tcb_desc *ptcb_desc);
2262
+ void (*fill_fake_txdesc)(struct ieee80211_hw *hw, u8 *pdesc,
2263
+ u32 buffer_len, bool bsspspoll);
2264
+ void (*fill_tx_cmddesc)(struct ieee80211_hw *hw, u8 *pdesc,
2265
+ bool firstseg, bool lastseg,
2266
+ struct sk_buff *skb);
22882267 void (*fill_tx_special_desc)(struct ieee80211_hw *hw,
22892268 u8 *pdesc, u8 *pbd_desc,
22902269 struct sk_buff *skb, u8 hw_queue);
2291
- bool (*query_rx_desc) (struct ieee80211_hw *hw,
2292
- struct rtl_stats *stats,
2293
- struct ieee80211_rx_status *rx_status,
2294
- u8 *pdesc, struct sk_buff *skb);
2295
- void (*set_channel_access) (struct ieee80211_hw *hw);
2296
- bool (*radio_onoff_checking) (struct ieee80211_hw *hw, u8 *valid);
2297
- void (*dm_watchdog) (struct ieee80211_hw *hw);
2298
- void (*scan_operation_backup) (struct ieee80211_hw *hw, u8 operation);
2299
- bool (*set_rf_power_state) (struct ieee80211_hw *hw,
2300
- enum rf_pwrstate rfpwr_state);
2301
- void (*led_control) (struct ieee80211_hw *hw,
2302
- enum led_ctl_mode ledaction);
2270
+ bool (*query_rx_desc)(struct ieee80211_hw *hw,
2271
+ struct rtl_stats *stats,
2272
+ struct ieee80211_rx_status *rx_status,
2273
+ u8 *pdesc, struct sk_buff *skb);
2274
+ void (*set_channel_access)(struct ieee80211_hw *hw);
2275
+ bool (*radio_onoff_checking)(struct ieee80211_hw *hw, u8 *valid);
2276
+ void (*dm_watchdog)(struct ieee80211_hw *hw);
2277
+ void (*scan_operation_backup)(struct ieee80211_hw *hw, u8 operation);
2278
+ bool (*set_rf_power_state)(struct ieee80211_hw *hw,
2279
+ enum rf_pwrstate rfpwr_state);
2280
+ void (*led_control)(struct ieee80211_hw *hw,
2281
+ enum led_ctl_mode ledaction);
23032282 void (*set_desc)(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
23042283 u8 desc_name, u8 *val);
23052284 u64 (*get_desc)(struct ieee80211_hw *hw, u8 *pdesc, bool istx,
23062285 u8 desc_name);
2307
- bool (*is_tx_desc_closed) (struct ieee80211_hw *hw,
2308
- u8 hw_queue, u16 index);
2309
- void (*tx_polling) (struct ieee80211_hw *hw, u8 hw_queue);
2310
- void (*enable_hw_sec) (struct ieee80211_hw *hw);
2311
- void (*set_key) (struct ieee80211_hw *hw, u32 key_index,
2312
- u8 *macaddr, bool is_group, u8 enc_algo,
2313
- bool is_wepkey, bool clear_all);
2314
- void (*init_sw_leds) (struct ieee80211_hw *hw);
2315
- void (*deinit_sw_leds) (struct ieee80211_hw *hw);
2316
- u32 (*get_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
2317
- void (*set_bbreg) (struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
2318
- u32 data);
2319
- u32 (*get_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath,
2320
- u32 regaddr, u32 bitmask);
2321
- void (*set_rfreg) (struct ieee80211_hw *hw, enum radio_path rfpath,
2322
- u32 regaddr, u32 bitmask, u32 data);
2323
- void (*linked_set_reg) (struct ieee80211_hw *hw);
2324
- void (*chk_switch_dmdp) (struct ieee80211_hw *hw);
2325
- void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw);
2326
- void (*dualmac_switch_to_dmdp) (struct ieee80211_hw *hw);
2327
- bool (*phy_rf6052_config) (struct ieee80211_hw *hw);
2328
- void (*phy_rf6052_set_cck_txpower) (struct ieee80211_hw *hw,
2329
- u8 *powerlevel);
2330
- void (*phy_rf6052_set_ofdm_txpower) (struct ieee80211_hw *hw,
2331
- u8 *ppowerlevel, u8 channel);
2332
- bool (*config_bb_with_headerfile) (struct ieee80211_hw *hw,
2333
- u8 configtype);
2334
- bool (*config_bb_with_pgheaderfile) (struct ieee80211_hw *hw,
2335
- u8 configtype);
2336
- void (*phy_lc_calibrate) (struct ieee80211_hw *hw, bool is2t);
2337
- void (*phy_set_bw_mode_callback) (struct ieee80211_hw *hw);
2338
- void (*dm_dynamic_txpower) (struct ieee80211_hw *hw);
2339
- void (*c2h_command_handle) (struct ieee80211_hw *hw);
2340
- void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw,
2341
- bool mstate);
2342
- void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw);
2343
- void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id,
2344
- u32 cmd_len, u8 *p_cmdbuffer);
2286
+ bool (*is_tx_desc_closed)(struct ieee80211_hw *hw,
2287
+ u8 hw_queue, u16 index);
2288
+ void (*tx_polling)(struct ieee80211_hw *hw, u8 hw_queue);
2289
+ void (*enable_hw_sec)(struct ieee80211_hw *hw);
2290
+ void (*set_key)(struct ieee80211_hw *hw, u32 key_index,
2291
+ u8 *macaddr, bool is_group, u8 enc_algo,
2292
+ bool is_wepkey, bool clear_all);
2293
+ void (*init_sw_leds)(struct ieee80211_hw *hw);
2294
+ void (*deinit_sw_leds)(struct ieee80211_hw *hw);
2295
+ u32 (*get_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
2296
+ void (*set_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
2297
+ u32 data);
2298
+ u32 (*get_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath,
2299
+ u32 regaddr, u32 bitmask);
2300
+ void (*set_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath,
2301
+ u32 regaddr, u32 bitmask, u32 data);
2302
+ void (*linked_set_reg)(struct ieee80211_hw *hw);
2303
+ void (*chk_switch_dmdp)(struct ieee80211_hw *hw);
2304
+ void (*dualmac_easy_concurrent)(struct ieee80211_hw *hw);
2305
+ void (*dualmac_switch_to_dmdp)(struct ieee80211_hw *hw);
2306
+ bool (*phy_rf6052_config)(struct ieee80211_hw *hw);
2307
+ void (*phy_rf6052_set_cck_txpower)(struct ieee80211_hw *hw,
2308
+ u8 *powerlevel);
2309
+ void (*phy_rf6052_set_ofdm_txpower)(struct ieee80211_hw *hw,
2310
+ u8 *ppowerlevel, u8 channel);
2311
+ bool (*config_bb_with_headerfile)(struct ieee80211_hw *hw,
2312
+ u8 configtype);
2313
+ bool (*config_bb_with_pgheaderfile)(struct ieee80211_hw *hw,
2314
+ u8 configtype);
2315
+ void (*phy_lc_calibrate)(struct ieee80211_hw *hw, bool is2t);
2316
+ void (*phy_set_bw_mode_callback)(struct ieee80211_hw *hw);
2317
+ void (*dm_dynamic_txpower)(struct ieee80211_hw *hw);
2318
+ void (*c2h_command_handle)(struct ieee80211_hw *hw);
2319
+ void (*bt_wifi_media_status_notify)(struct ieee80211_hw *hw,
2320
+ bool mstate);
2321
+ void (*bt_coex_off_before_lps)(struct ieee80211_hw *hw);
2322
+ void (*fill_h2c_cmd)(struct ieee80211_hw *hw, u8 element_id,
2323
+ u32 cmd_len, u8 *p_cmdbuffer);
23452324 void (*set_default_port_id_cmd)(struct ieee80211_hw *hw);
2346
- bool (*get_btc_status) (void);
2325
+ bool (*get_btc_status)(void);
23472326 bool (*is_fw_header)(struct rtlwifi_firmware_header *hdr);
23482327 void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
23492328 struct rtl_wow_pattern *rtl_pattern,
....@@ -2356,24 +2335,24 @@
23562335 struct rtl_intf_ops {
23572336 /*com */
23582337 void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
2359
- int (*adapter_start) (struct ieee80211_hw *hw);
2360
- void (*adapter_stop) (struct ieee80211_hw *hw);
2338
+ int (*adapter_start)(struct ieee80211_hw *hw);
2339
+ void (*adapter_stop)(struct ieee80211_hw *hw);
23612340 bool (*check_buddy_priv)(struct ieee80211_hw *hw,
23622341 struct rtl_priv **buddy_priv);
23632342
2364
- int (*adapter_tx) (struct ieee80211_hw *hw,
2365
- struct ieee80211_sta *sta,
2366
- struct sk_buff *skb,
2367
- struct rtl_tcb_desc *ptcb_desc);
2343
+ int (*adapter_tx)(struct ieee80211_hw *hw,
2344
+ struct ieee80211_sta *sta,
2345
+ struct sk_buff *skb,
2346
+ struct rtl_tcb_desc *ptcb_desc);
23682347 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2369
- int (*reset_trx_ring) (struct ieee80211_hw *hw);
2370
- bool (*waitq_insert) (struct ieee80211_hw *hw,
2371
- struct ieee80211_sta *sta,
2372
- struct sk_buff *skb);
2348
+ int (*reset_trx_ring)(struct ieee80211_hw *hw);
2349
+ bool (*waitq_insert)(struct ieee80211_hw *hw,
2350
+ struct ieee80211_sta *sta,
2351
+ struct sk_buff *skb);
23732352
23742353 /*pci */
2375
- void (*disable_aspm) (struct ieee80211_hw *hw);
2376
- void (*enable_aspm) (struct ieee80211_hw *hw);
2354
+ void (*disable_aspm)(struct ieee80211_hw *hw);
2355
+ void (*enable_aspm)(struct ieee80211_hw *hw);
23772356
23782357 /*usb */
23792358 };
....@@ -2451,7 +2430,8 @@
24512430 enum rtl_spec_ver spec_ver;
24522431
24532432 /*this map used for some registers or vars
2454
- defined int HAL but used in MAIN */
2433
+ * defined int HAL but used in MAIN
2434
+ */
24552435 u32 maps[RTL_VAR_MAP_MAX];
24562436
24572437 };
....@@ -2613,7 +2593,8 @@
26132593
26142594 struct rtl_global_var {
26152595 /* from this list we can get
2616
- * other adapter's rtl_priv */
2596
+ * other adapter's rtl_priv
2597
+ */
26172598 struct list_head glb_priv_list;
26182599 spinlock_t glb_list_lock;
26192600 };
....@@ -2692,30 +2673,30 @@
26922673 };
26932674
26942675 struct rtl_btc_ops {
2695
- void (*btc_init_variables) (struct rtl_priv *rtlpriv);
2676
+ void (*btc_init_variables)(struct rtl_priv *rtlpriv);
26962677 void (*btc_init_variables_wifi_only)(struct rtl_priv *rtlpriv);
26972678 void (*btc_deinit_variables)(struct rtl_priv *rtlpriv);
2698
- void (*btc_init_hal_vars) (struct rtl_priv *rtlpriv);
2679
+ void (*btc_init_hal_vars)(struct rtl_priv *rtlpriv);
26992680 void (*btc_power_on_setting)(struct rtl_priv *rtlpriv);
2700
- void (*btc_init_hw_config) (struct rtl_priv *rtlpriv);
2681
+ void (*btc_init_hw_config)(struct rtl_priv *rtlpriv);
27012682 void (*btc_init_hw_config_wifi_only)(struct rtl_priv *rtlpriv);
2702
- void (*btc_ips_notify) (struct rtl_priv *rtlpriv, u8 type);
2683
+ void (*btc_ips_notify)(struct rtl_priv *rtlpriv, u8 type);
27032684 void (*btc_lps_notify)(struct rtl_priv *rtlpriv, u8 type);
2704
- void (*btc_scan_notify) (struct rtl_priv *rtlpriv, u8 scantype);
2685
+ void (*btc_scan_notify)(struct rtl_priv *rtlpriv, u8 scantype);
27052686 void (*btc_scan_notify_wifi_only)(struct rtl_priv *rtlpriv,
27062687 u8 scantype);
2707
- void (*btc_connect_notify) (struct rtl_priv *rtlpriv, u8 action);
2708
- void (*btc_mediastatus_notify) (struct rtl_priv *rtlpriv,
2709
- enum rt_media_status mstatus);
2710
- void (*btc_periodical) (struct rtl_priv *rtlpriv);
2688
+ void (*btc_connect_notify)(struct rtl_priv *rtlpriv, u8 action);
2689
+ void (*btc_mediastatus_notify)(struct rtl_priv *rtlpriv,
2690
+ enum rt_media_status mstatus);
2691
+ void (*btc_periodical)(struct rtl_priv *rtlpriv);
27112692 void (*btc_halt_notify)(struct rtl_priv *rtlpriv);
2712
- void (*btc_btinfo_notify) (struct rtl_priv *rtlpriv,
2713
- u8 *tmp_buf, u8 length);
2693
+ void (*btc_btinfo_notify)(struct rtl_priv *rtlpriv,
2694
+ u8 *tmp_buf, u8 length);
27142695 void (*btc_btmpinfo_notify)(struct rtl_priv *rtlpriv,
27152696 u8 *tmp_buf, u8 length);
2716
- bool (*btc_is_limited_dig) (struct rtl_priv *rtlpriv);
2717
- bool (*btc_is_disable_edca_turbo) (struct rtl_priv *rtlpriv);
2718
- bool (*btc_is_bt_disabled) (struct rtl_priv *rtlpriv);
2697
+ bool (*btc_is_limited_dig)(struct rtl_priv *rtlpriv);
2698
+ bool (*btc_is_disable_edca_turbo)(struct rtl_priv *rtlpriv);
2699
+ bool (*btc_is_bt_disabled)(struct rtl_priv *rtlpriv);
27192700 void (*btc_special_packet_notify)(struct rtl_priv *rtlpriv,
27202701 u8 pkt_type);
27212702 void (*btc_switch_band_notify)(struct rtl_priv *rtlpriv, u8 type,
....@@ -2801,16 +2782,16 @@
28012782 struct rtl_debug dbg;
28022783 int max_fw_size;
28032784
2804
- /*
2805
- *hal_cfg : for diff cards
2806
- *intf_ops : for diff interrface usb/pcie
2785
+ /* hal_cfg : for diff cards
2786
+ * intf_ops : for diff interrface usb/pcie
28072787 */
28082788 struct rtl_hal_cfg *cfg;
28092789 const struct rtl_intf_ops *intf_ops;
28102790
2811
- /*this var will be set by set_bit,
2812
- and was used to indicate status of
2813
- interface or hardware */
2791
+ /* this var will be set by set_bit,
2792
+ * and was used to indicate status of
2793
+ * interface or hardware
2794
+ */
28142795 unsigned long status;
28152796
28162797 /* tables for dm */
....@@ -2846,10 +2827,11 @@
28462827 #ifdef CONFIG_PM
28472828 struct wiphy_wowlan_support wowlan;
28482829 #endif
2849
- /*This must be the last item so
2850
- that it points to the data allocated
2851
- beyond this structure like:
2852
- rtl_pci_priv or rtl_usb_priv */
2830
+ /* This must be the last item so
2831
+ * that it points to the data allocated
2832
+ * beyond this structure like:
2833
+ * rtl_pci_priv or rtl_usb_priv
2834
+ */
28532835 u8 priv[0] __aligned(sizeof(void *));
28542836 };
28552837
....@@ -2859,10 +2841,7 @@
28592841 #define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse))
28602842 #define rtl_psc(rtlpriv) (&((rtlpriv)->psc))
28612843
2862
-
2863
-/***************************************
2864
- Bluetooth Co-existence Related
2865
-****************************************/
2844
+/* Bluetooth Co-existence Related */
28662845
28672846 enum bt_ant_num {
28682847 ANT_X2 = 0,
....@@ -2911,135 +2890,18 @@
29112890 BT_RADIO_INDIVIDUAL = 1,
29122891 };
29132892
2914
-
29152893 /****************************************
2916
- mem access macro define start
2917
- Call endian free function when
2918
- 1. Read/write packet content.
2919
- 2. Before write integer to IO.
2920
- 3. After read integer from IO.
2921
-****************************************/
2922
-/* Convert little data endian to host ordering */
2923
-#define EF1BYTE(_val) \
2924
- ((u8)(_val))
2925
-#define EF2BYTE(_val) \
2926
- (le16_to_cpu(_val))
2927
-#define EF4BYTE(_val) \
2928
- (le32_to_cpu(_val))
2929
-
2930
-/* Read data from memory */
2931
-#define READEF1BYTE(_ptr) \
2932
- EF1BYTE(*((u8 *)(_ptr)))
2933
-/* Read le16 data from memory and convert to host ordering */
2934
-#define READEF2BYTE(_ptr) \
2935
- EF2BYTE(*(_ptr))
2936
-#define READEF4BYTE(_ptr) \
2937
- EF4BYTE(*(_ptr))
2938
-
2939
-/* Create a bit mask
2940
- * Examples:
2941
- * BIT_LEN_MASK_32(0) => 0x00000000
2942
- * BIT_LEN_MASK_32(1) => 0x00000001
2943
- * BIT_LEN_MASK_32(2) => 0x00000003
2944
- * BIT_LEN_MASK_32(32) => 0xFFFFFFFF
2945
- */
2946
-#define BIT_LEN_MASK_32(__bitlen) \
2947
- (0xFFFFFFFF >> (32 - (__bitlen)))
2948
-#define BIT_LEN_MASK_16(__bitlen) \
2949
- (0xFFFF >> (16 - (__bitlen)))
2950
-#define BIT_LEN_MASK_8(__bitlen) \
2951
- (0xFF >> (8 - (__bitlen)))
2952
-
2953
-/* Create an offset bit mask
2954
- * Examples:
2955
- * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
2956
- * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
2957
- */
2958
-#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \
2959
- (BIT_LEN_MASK_32(__bitlen) << (__bitoffset))
2960
-#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \
2961
- (BIT_LEN_MASK_16(__bitlen) << (__bitoffset))
2962
-#define BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen) \
2963
- (BIT_LEN_MASK_8(__bitlen) << (__bitoffset))
2964
-
2965
-/*Description:
2966
- * Return 4-byte value in host byte ordering from
2967
- * 4-byte pointer in little-endian system.
2968
- */
2969
-#define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \
2970
- (EF4BYTE(*((__le32 *)(__pstart))))
2971
-#define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \
2972
- (EF2BYTE(*((__le16 *)(__pstart))))
2973
-#define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \
2974
- (EF1BYTE(*((u8 *)(__pstart))))
2975
-
2976
-/*Description:
2977
-Translate subfield (continuous bits in little-endian) of 4-byte
2978
-value to host byte ordering.*/
2979
-#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
2980
- ( \
2981
- (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \
2982
- BIT_LEN_MASK_32(__bitlen) \
2983
- )
2984
-#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
2985
- ( \
2986
- (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \
2987
- BIT_LEN_MASK_16(__bitlen) \
2988
- )
2989
-#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
2990
- ( \
2991
- (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \
2992
- BIT_LEN_MASK_8(__bitlen) \
2993
- )
2994
-
2995
-/* Description:
2996
- * Mask subfield (continuous bits in little-endian) of 4-byte value
2997
- * and return the result in 4-byte value in host byte ordering.
2998
- */
2999
-#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
3000
- ( \
3001
- LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \
3002
- (~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)) \
3003
- )
3004
-#define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
3005
- ( \
3006
- LE_P2BYTE_TO_HOST_2BYTE(__pstart) & \
3007
- (~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)) \
3008
- )
3009
-#define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
3010
- ( \
3011
- LE_P1BYTE_TO_HOST_1BYTE(__pstart) & \
3012
- (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \
3013
- )
3014
-
3015
-/* Description:
3016
- * Set subfield of little-endian 4-byte value to specified value.
3017
- */
3018
-#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
3019
- *((__le32 *)(__pstart)) = \
3020
- cpu_to_le32( \
3021
- LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
3022
- ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
3023
- )
3024
-#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
3025
- *((__le16 *)(__pstart)) = \
3026
- cpu_to_le16( \
3027
- LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
3028
- ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
3029
- )
3030
-#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
3031
- *((u8 *)(__pstart)) = EF1BYTE \
3032
- ( \
3033
- LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
3034
- ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
3035
- )
2894
+ * mem access macro define start
2895
+ * Call endian free function when
2896
+ * 1. Read/write packet content.
2897
+ * 2. Before write integer to IO.
2898
+ * 3. After read integer from IO.
2899
+ ****************************************/
30362900
30372901 #define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
30382902 (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
30392903
3040
-/****************************************
3041
- mem access macro define end
3042
-****************************************/
2904
+/* mem access macro define end */
30432905
30442906 #define byte(x, n) ((x >> (8 * n)) & 0xff)
30452907
....@@ -3072,9 +2934,6 @@
30722934 (ppsc->cur_ps_level &= (~(_ps_flg)))
30732935 #define RT_SET_PS_LEVEL(ppsc, _ps_flg) \
30742936 (ppsc->cur_ps_level |= _ps_flg)
3075
-
3076
-#define container_of_dwork_rtl(x, y, z) \
3077
- container_of(to_delayed_work(x), y, z)
30782937
30792938 #define FILL_OCTET_STRING(_os, _octet, _len) \
30802939 (_os).octet = (u8 *)(_octet); \
....@@ -3174,7 +3033,7 @@
31743033 }
31753034
31763035 static inline void rtl_set_bbreg_with_dwmask(struct ieee80211_hw *hw,
3177
- u32 regaddr, u32 data)
3036
+ u32 regaddr, u32 data)
31783037 {
31793038 rtl_set_bbreg(hw, regaddr, 0xffffffff, data);
31803039 }
....@@ -3245,9 +3104,10 @@
32453104 }
32463105
32473106 static inline struct ieee80211_sta *rtl_find_sta(struct ieee80211_hw *hw,
3248
- u8 *mac_addr)
3107
+ u8 *mac_addr)
32493108 {
32503109 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
3110
+
32513111 return ieee80211_find_sta(mac->vif, mac_addr);
32523112 }
32533113