18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> 48c2ecf20Sopenharmony_ci Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> 58c2ecf20Sopenharmony_ci <http://rt2x00.serialmonkey.com> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* 108c2ecf20Sopenharmony_ci Module: rt2x00lib 118c2ecf20Sopenharmony_ci Abstract: Data structures and definitions for the rt2x00lib module. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#ifndef RT2X00LIB_H 158c2ecf20Sopenharmony_ci#define RT2X00LIB_H 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci/* 188c2ecf20Sopenharmony_ci * Interval defines 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_ci#define WATCHDOG_INTERVAL round_jiffies_relative(HZ) 218c2ecf20Sopenharmony_ci#define LINK_TUNE_SECONDS 1 228c2ecf20Sopenharmony_ci#define LINK_TUNE_INTERVAL round_jiffies_relative(LINK_TUNE_SECONDS * HZ) 238c2ecf20Sopenharmony_ci#define AGC_SECONDS 4 248c2ecf20Sopenharmony_ci#define VCO_SECONDS 10 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* 278c2ecf20Sopenharmony_ci * rt2x00_rate: Per rate device information 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_cistruct rt2x00_rate { 308c2ecf20Sopenharmony_ci unsigned short flags; 318c2ecf20Sopenharmony_ci#define DEV_RATE_CCK 0x0001 328c2ecf20Sopenharmony_ci#define DEV_RATE_OFDM 0x0002 338c2ecf20Sopenharmony_ci#define DEV_RATE_SHORT_PREAMBLE 0x0004 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci unsigned short bitrate; /* In 100kbit/s */ 368c2ecf20Sopenharmony_ci unsigned short ratemask; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci unsigned short plcp; 398c2ecf20Sopenharmony_ci unsigned short mcs; 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciextern const struct rt2x00_rate rt2x00_supported_rates[12]; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci return &rt2x00_supported_rates[hw_value & 0xff]; 478c2ecf20Sopenharmony_ci} 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define RATE_MCS(__mode, __mcs) \ 508c2ecf20Sopenharmony_ci ((((__mode) & 0x00ff) << 8) | ((__mcs) & 0x00ff)) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistatic inline int rt2x00_get_rate_mcs(const u16 mcs_value) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci return (mcs_value & 0x00ff); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* 588c2ecf20Sopenharmony_ci * Radio control handlers. 598c2ecf20Sopenharmony_ci */ 608c2ecf20Sopenharmony_ciint rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev); 618c2ecf20Sopenharmony_civoid rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev); 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * Initialization handlers. 658c2ecf20Sopenharmony_ci */ 668c2ecf20Sopenharmony_ciint rt2x00lib_start(struct rt2x00_dev *rt2x00dev); 678c2ecf20Sopenharmony_civoid rt2x00lib_stop(struct rt2x00_dev *rt2x00dev); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* 708c2ecf20Sopenharmony_ci * Configuration handlers. 718c2ecf20Sopenharmony_ci */ 728c2ecf20Sopenharmony_civoid rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev, 738c2ecf20Sopenharmony_ci struct rt2x00_intf *intf, 748c2ecf20Sopenharmony_ci enum nl80211_iftype type, 758c2ecf20Sopenharmony_ci const u8 *mac, const u8 *bssid); 768c2ecf20Sopenharmony_civoid rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, 778c2ecf20Sopenharmony_ci struct rt2x00_intf *intf, 788c2ecf20Sopenharmony_ci struct ieee80211_bss_conf *conf, 798c2ecf20Sopenharmony_ci u32 changed); 808c2ecf20Sopenharmony_civoid rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, 818c2ecf20Sopenharmony_ci struct antenna_setup ant); 828c2ecf20Sopenharmony_civoid rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 838c2ecf20Sopenharmony_ci struct ieee80211_conf *conf, 848c2ecf20Sopenharmony_ci const unsigned int changed_flags); 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci/** 878c2ecf20Sopenharmony_ci * DOC: Queue handlers 888c2ecf20Sopenharmony_ci */ 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/** 918c2ecf20Sopenharmony_ci * rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. 928c2ecf20Sopenharmony_ci * @entry: The entry for which the skb will be applicable. 938c2ecf20Sopenharmony_ci */ 948c2ecf20Sopenharmony_cistruct sk_buff *rt2x00queue_alloc_rxskb(struct queue_entry *entry, gfp_t gfp); 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/** 978c2ecf20Sopenharmony_ci * rt2x00queue_free_skb - free a skb 988c2ecf20Sopenharmony_ci * @entry: The entry for which the skb will be applicable. 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_civoid rt2x00queue_free_skb(struct queue_entry *entry); 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/** 1038c2ecf20Sopenharmony_ci * rt2x00queue_align_frame - Align 802.11 frame to 4-byte boundary 1048c2ecf20Sopenharmony_ci * @skb: The skb to align 1058c2ecf20Sopenharmony_ci * 1068c2ecf20Sopenharmony_ci * Align the start of the 802.11 frame to a 4-byte boundary, this could 1078c2ecf20Sopenharmony_ci * mean the payload is not aligned properly though. 1088c2ecf20Sopenharmony_ci */ 1098c2ecf20Sopenharmony_civoid rt2x00queue_align_frame(struct sk_buff *skb); 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/** 1128c2ecf20Sopenharmony_ci * rt2x00queue_insert_l2pad - Align 802.11 header & payload to 4-byte boundary 1138c2ecf20Sopenharmony_ci * @skb: The skb to align 1148c2ecf20Sopenharmony_ci * @header_length: Length of 802.11 header 1158c2ecf20Sopenharmony_ci * 1168c2ecf20Sopenharmony_ci * Apply L2 padding to align both header and payload to 4-byte boundary 1178c2ecf20Sopenharmony_ci */ 1188c2ecf20Sopenharmony_civoid rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length); 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/** 1218c2ecf20Sopenharmony_ci * rt2x00queue_insert_l2pad - Remove L2 padding from 802.11 frame 1228c2ecf20Sopenharmony_ci * @skb: The skb to align 1238c2ecf20Sopenharmony_ci * @header_length: Length of 802.11 header 1248c2ecf20Sopenharmony_ci * 1258c2ecf20Sopenharmony_ci * Remove L2 padding used to align both header and payload to 4-byte boundary, 1268c2ecf20Sopenharmony_ci * by removing the L2 padding the header will no longer be 4-byte aligned. 1278c2ecf20Sopenharmony_ci */ 1288c2ecf20Sopenharmony_civoid rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length); 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/** 1318c2ecf20Sopenharmony_ci * rt2x00queue_write_tx_frame - Write TX frame to hardware 1328c2ecf20Sopenharmony_ci * @queue: Queue over which the frame should be send 1338c2ecf20Sopenharmony_ci * @skb: The skb to send 1348c2ecf20Sopenharmony_ci * @local: frame is not from mac80211 1358c2ecf20Sopenharmony_ci */ 1368c2ecf20Sopenharmony_ciint rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb, 1378c2ecf20Sopenharmony_ci struct ieee80211_sta *sta, bool local); 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci/** 1408c2ecf20Sopenharmony_ci * rt2x00queue_update_beacon - Send new beacon from mac80211 1418c2ecf20Sopenharmony_ci * to hardware. Handles locking by itself (mutex). 1428c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 1438c2ecf20Sopenharmony_ci * @vif: Interface for which the beacon should be updated. 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ciint rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev, 1468c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci/** 1498c2ecf20Sopenharmony_ci * rt2x00queue_update_beacon_locked - Send new beacon from mac80211 1508c2ecf20Sopenharmony_ci * to hardware. Caller needs to ensure locking. 1518c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 1528c2ecf20Sopenharmony_ci * @vif: Interface for which the beacon should be updated. 1538c2ecf20Sopenharmony_ci */ 1548c2ecf20Sopenharmony_ciint rt2x00queue_update_beacon_locked(struct rt2x00_dev *rt2x00dev, 1558c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/** 1588c2ecf20Sopenharmony_ci * rt2x00queue_clear_beacon - Clear beacon in hardware 1598c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 1608c2ecf20Sopenharmony_ci * @vif: Interface for which the beacon should be updated. 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ciint rt2x00queue_clear_beacon(struct rt2x00_dev *rt2x00dev, 1638c2ecf20Sopenharmony_ci struct ieee80211_vif *vif); 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci/** 1668c2ecf20Sopenharmony_ci * rt2x00queue_index_inc - Index incrementation function 1678c2ecf20Sopenharmony_ci * @entry: Queue entry (&struct queue_entry) to perform the action on. 1688c2ecf20Sopenharmony_ci * @index: Index type (&enum queue_index) to perform the action on. 1698c2ecf20Sopenharmony_ci * 1708c2ecf20Sopenharmony_ci * This function will increase the requested index on the entry's queue, 1718c2ecf20Sopenharmony_ci * it will grab the appropriate locks and handle queue overflow events by 1728c2ecf20Sopenharmony_ci * resetting the index to the start of the queue. 1738c2ecf20Sopenharmony_ci */ 1748c2ecf20Sopenharmony_civoid rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci/** 1778c2ecf20Sopenharmony_ci * rt2x00queue_init_queues - Initialize all data queues 1788c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 1798c2ecf20Sopenharmony_ci * 1808c2ecf20Sopenharmony_ci * This function will loop through all available queues to clear all 1818c2ecf20Sopenharmony_ci * index numbers and set the queue entry to the correct initialization 1828c2ecf20Sopenharmony_ci * state. 1838c2ecf20Sopenharmony_ci */ 1848c2ecf20Sopenharmony_civoid rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev); 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ciint rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev); 1878c2ecf20Sopenharmony_civoid rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev); 1888c2ecf20Sopenharmony_ciint rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev); 1898c2ecf20Sopenharmony_civoid rt2x00queue_free(struct rt2x00_dev *rt2x00dev); 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci/** 1928c2ecf20Sopenharmony_ci * rt2x00link_update_stats - Update link statistics from RX frame 1938c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 1948c2ecf20Sopenharmony_ci * @skb: Received frame 1958c2ecf20Sopenharmony_ci * @rxdesc: Received frame descriptor 1968c2ecf20Sopenharmony_ci * 1978c2ecf20Sopenharmony_ci * Update link statistics based on the information from the 1988c2ecf20Sopenharmony_ci * received frame descriptor. 1998c2ecf20Sopenharmony_ci */ 2008c2ecf20Sopenharmony_civoid rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev, 2018c2ecf20Sopenharmony_ci struct sk_buff *skb, 2028c2ecf20Sopenharmony_ci struct rxdone_entry_desc *rxdesc); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci/** 2058c2ecf20Sopenharmony_ci * rt2x00link_start_tuner - Start periodic link tuner work 2068c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2078c2ecf20Sopenharmony_ci * 2088c2ecf20Sopenharmony_ci * This start the link tuner periodic work, this work will 2098c2ecf20Sopenharmony_ci * be executed periodically until &rt2x00link_stop_tuner has 2108c2ecf20Sopenharmony_ci * been called. 2118c2ecf20Sopenharmony_ci */ 2128c2ecf20Sopenharmony_civoid rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev); 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/** 2158c2ecf20Sopenharmony_ci * rt2x00link_stop_tuner - Stop periodic link tuner work 2168c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2178c2ecf20Sopenharmony_ci * 2188c2ecf20Sopenharmony_ci * After this function completed the link tuner will not 2198c2ecf20Sopenharmony_ci * be running until &rt2x00link_start_tuner is called. 2208c2ecf20Sopenharmony_ci */ 2218c2ecf20Sopenharmony_civoid rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev); 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/** 2248c2ecf20Sopenharmony_ci * rt2x00link_reset_tuner - Reset periodic link tuner work 2258c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2268c2ecf20Sopenharmony_ci * @antenna: Should the antenna tuning also be reset 2278c2ecf20Sopenharmony_ci * 2288c2ecf20Sopenharmony_ci * The VGC limit configured in the hardware will be reset to 0 2298c2ecf20Sopenharmony_ci * which forces the driver to rediscover the correct value for 2308c2ecf20Sopenharmony_ci * the current association. This is needed when configuration 2318c2ecf20Sopenharmony_ci * options have changed which could drastically change the 2328c2ecf20Sopenharmony_ci * SNR level or link quality (i.e. changing the antenna setting). 2338c2ecf20Sopenharmony_ci * 2348c2ecf20Sopenharmony_ci * Resetting the link tuner will also cause the periodic work counter 2358c2ecf20Sopenharmony_ci * to be reset. Any driver which has a fixed limit on the number 2368c2ecf20Sopenharmony_ci * of rounds the link tuner is supposed to work will accept the 2378c2ecf20Sopenharmony_ci * tuner actions again if this limit was previously reached. 2388c2ecf20Sopenharmony_ci * 2398c2ecf20Sopenharmony_ci * If @antenna is set to true a the software antenna diversity 2408c2ecf20Sopenharmony_ci * tuning will also be reset. 2418c2ecf20Sopenharmony_ci */ 2428c2ecf20Sopenharmony_civoid rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna); 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci/** 2458c2ecf20Sopenharmony_ci * rt2x00link_start_watchdog - Start periodic watchdog monitoring 2468c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2478c2ecf20Sopenharmony_ci * 2488c2ecf20Sopenharmony_ci * This start the watchdog periodic work, this work will 2498c2ecf20Sopenharmony_ci *be executed periodically until &rt2x00link_stop_watchdog has 2508c2ecf20Sopenharmony_ci * been called. 2518c2ecf20Sopenharmony_ci */ 2528c2ecf20Sopenharmony_civoid rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev); 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci/** 2558c2ecf20Sopenharmony_ci * rt2x00link_stop_watchdog - Stop periodic watchdog monitoring 2568c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2578c2ecf20Sopenharmony_ci * 2588c2ecf20Sopenharmony_ci * After this function completed the watchdog monitoring will not 2598c2ecf20Sopenharmony_ci * be running until &rt2x00link_start_watchdog is called. 2608c2ecf20Sopenharmony_ci */ 2618c2ecf20Sopenharmony_civoid rt2x00link_stop_watchdog(struct rt2x00_dev *rt2x00dev); 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci/** 2648c2ecf20Sopenharmony_ci * rt2x00link_register - Initialize link tuning & watchdog functionality 2658c2ecf20Sopenharmony_ci * @rt2x00dev: Pointer to &struct rt2x00_dev. 2668c2ecf20Sopenharmony_ci * 2678c2ecf20Sopenharmony_ci * Initialize work structure and all link tuning and watchdog related 2688c2ecf20Sopenharmony_ci * parameters. This will not start the periodic work itself. 2698c2ecf20Sopenharmony_ci */ 2708c2ecf20Sopenharmony_civoid rt2x00link_register(struct rt2x00_dev *rt2x00dev); 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci/* 2738c2ecf20Sopenharmony_ci * Firmware handlers. 2748c2ecf20Sopenharmony_ci */ 2758c2ecf20Sopenharmony_ci#ifdef CONFIG_RT2X00_LIB_FIRMWARE 2768c2ecf20Sopenharmony_ciint rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev); 2778c2ecf20Sopenharmony_civoid rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev); 2788c2ecf20Sopenharmony_ci#else 2798c2ecf20Sopenharmony_cistatic inline int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev) 2808c2ecf20Sopenharmony_ci{ 2818c2ecf20Sopenharmony_ci return 0; 2828c2ecf20Sopenharmony_ci} 2838c2ecf20Sopenharmony_cistatic inline void rt2x00lib_free_firmware(struct rt2x00_dev *rt2x00dev) 2848c2ecf20Sopenharmony_ci{ 2858c2ecf20Sopenharmony_ci} 2868c2ecf20Sopenharmony_ci#endif /* CONFIG_RT2X00_LIB_FIRMWARE */ 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci/* 2898c2ecf20Sopenharmony_ci * Debugfs handlers. 2908c2ecf20Sopenharmony_ci */ 2918c2ecf20Sopenharmony_ci#ifdef CONFIG_RT2X00_LIB_DEBUGFS 2928c2ecf20Sopenharmony_civoid rt2x00debug_register(struct rt2x00_dev *rt2x00dev); 2938c2ecf20Sopenharmony_civoid rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev); 2948c2ecf20Sopenharmony_civoid rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, 2958c2ecf20Sopenharmony_ci struct rxdone_entry_desc *rxdesc); 2968c2ecf20Sopenharmony_ci#else 2978c2ecf20Sopenharmony_cistatic inline void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) 2988c2ecf20Sopenharmony_ci{ 2998c2ecf20Sopenharmony_ci} 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_cistatic inline void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) 3028c2ecf20Sopenharmony_ci{ 3038c2ecf20Sopenharmony_ci} 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_cistatic inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev, 3068c2ecf20Sopenharmony_ci struct rxdone_entry_desc *rxdesc) 3078c2ecf20Sopenharmony_ci{ 3088c2ecf20Sopenharmony_ci} 3098c2ecf20Sopenharmony_ci#endif /* CONFIG_RT2X00_LIB_DEBUGFS */ 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci/* 3128c2ecf20Sopenharmony_ci * Crypto handlers. 3138c2ecf20Sopenharmony_ci */ 3148c2ecf20Sopenharmony_ci#ifdef CONFIG_RT2X00_LIB_CRYPTO 3158c2ecf20Sopenharmony_cienum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key); 3168c2ecf20Sopenharmony_civoid rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, 3178c2ecf20Sopenharmony_ci struct sk_buff *skb, 3188c2ecf20Sopenharmony_ci struct txentry_desc *txdesc); 3198c2ecf20Sopenharmony_ciunsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev, 3208c2ecf20Sopenharmony_ci struct sk_buff *skb); 3218c2ecf20Sopenharmony_civoid rt2x00crypto_tx_copy_iv(struct sk_buff *skb, 3228c2ecf20Sopenharmony_ci struct txentry_desc *txdesc); 3238c2ecf20Sopenharmony_civoid rt2x00crypto_tx_remove_iv(struct sk_buff *skb, 3248c2ecf20Sopenharmony_ci struct txentry_desc *txdesc); 3258c2ecf20Sopenharmony_civoid rt2x00crypto_tx_insert_iv(struct sk_buff *skb, unsigned int header_length); 3268c2ecf20Sopenharmony_civoid rt2x00crypto_rx_insert_iv(struct sk_buff *skb, 3278c2ecf20Sopenharmony_ci unsigned int header_length, 3288c2ecf20Sopenharmony_ci struct rxdone_entry_desc *rxdesc); 3298c2ecf20Sopenharmony_ci#else 3308c2ecf20Sopenharmony_cistatic inline enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key) 3318c2ecf20Sopenharmony_ci{ 3328c2ecf20Sopenharmony_ci return CIPHER_NONE; 3338c2ecf20Sopenharmony_ci} 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_cistatic inline void rt2x00crypto_create_tx_descriptor(struct rt2x00_dev *rt2x00dev, 3368c2ecf20Sopenharmony_ci struct sk_buff *skb, 3378c2ecf20Sopenharmony_ci struct txentry_desc *txdesc) 3388c2ecf20Sopenharmony_ci{ 3398c2ecf20Sopenharmony_ci} 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_cistatic inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev, 3428c2ecf20Sopenharmony_ci struct sk_buff *skb) 3438c2ecf20Sopenharmony_ci{ 3448c2ecf20Sopenharmony_ci return 0; 3458c2ecf20Sopenharmony_ci} 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistatic inline void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, 3488c2ecf20Sopenharmony_ci struct txentry_desc *txdesc) 3498c2ecf20Sopenharmony_ci{ 3508c2ecf20Sopenharmony_ci} 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_cistatic inline void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, 3538c2ecf20Sopenharmony_ci struct txentry_desc *txdesc) 3548c2ecf20Sopenharmony_ci{ 3558c2ecf20Sopenharmony_ci} 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_cistatic inline void rt2x00crypto_tx_insert_iv(struct sk_buff *skb, 3588c2ecf20Sopenharmony_ci unsigned int header_length) 3598c2ecf20Sopenharmony_ci{ 3608c2ecf20Sopenharmony_ci} 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_cistatic inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, 3638c2ecf20Sopenharmony_ci unsigned int header_length, 3648c2ecf20Sopenharmony_ci struct rxdone_entry_desc *rxdesc) 3658c2ecf20Sopenharmony_ci{ 3668c2ecf20Sopenharmony_ci} 3678c2ecf20Sopenharmony_ci#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_ci/* 3708c2ecf20Sopenharmony_ci * RFkill handlers. 3718c2ecf20Sopenharmony_ci */ 3728c2ecf20Sopenharmony_cistatic inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) 3738c2ecf20Sopenharmony_ci{ 3748c2ecf20Sopenharmony_ci if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags)) 3758c2ecf20Sopenharmony_ci wiphy_rfkill_start_polling(rt2x00dev->hw->wiphy); 3768c2ecf20Sopenharmony_ci} 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_cistatic inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) 3798c2ecf20Sopenharmony_ci{ 3808c2ecf20Sopenharmony_ci if (test_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags)) 3818c2ecf20Sopenharmony_ci wiphy_rfkill_stop_polling(rt2x00dev->hw->wiphy); 3828c2ecf20Sopenharmony_ci} 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* 3858c2ecf20Sopenharmony_ci * LED handlers 3868c2ecf20Sopenharmony_ci */ 3878c2ecf20Sopenharmony_ci#ifdef CONFIG_RT2X00_LIB_LEDS 3888c2ecf20Sopenharmony_civoid rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi); 3898c2ecf20Sopenharmony_civoid rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, bool enabled); 3908c2ecf20Sopenharmony_civoid rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, bool enabled); 3918c2ecf20Sopenharmony_civoid rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, bool enabled); 3928c2ecf20Sopenharmony_civoid rt2x00leds_register(struct rt2x00_dev *rt2x00dev); 3938c2ecf20Sopenharmony_civoid rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev); 3948c2ecf20Sopenharmony_civoid rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev); 3958c2ecf20Sopenharmony_civoid rt2x00leds_resume(struct rt2x00_dev *rt2x00dev); 3968c2ecf20Sopenharmony_ci#else 3978c2ecf20Sopenharmony_cistatic inline void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, 3988c2ecf20Sopenharmony_ci int rssi) 3998c2ecf20Sopenharmony_ci{ 4008c2ecf20Sopenharmony_ci} 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_cistatic inline void rt2x00led_led_activity(struct rt2x00_dev *rt2x00dev, 4038c2ecf20Sopenharmony_ci bool enabled) 4048c2ecf20Sopenharmony_ci{ 4058c2ecf20Sopenharmony_ci} 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_cistatic inline void rt2x00leds_led_assoc(struct rt2x00_dev *rt2x00dev, 4088c2ecf20Sopenharmony_ci bool enabled) 4098c2ecf20Sopenharmony_ci{ 4108c2ecf20Sopenharmony_ci} 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_cistatic inline void rt2x00leds_led_radio(struct rt2x00_dev *rt2x00dev, 4138c2ecf20Sopenharmony_ci bool enabled) 4148c2ecf20Sopenharmony_ci{ 4158c2ecf20Sopenharmony_ci} 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_cistatic inline void rt2x00leds_register(struct rt2x00_dev *rt2x00dev) 4188c2ecf20Sopenharmony_ci{ 4198c2ecf20Sopenharmony_ci} 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_cistatic inline void rt2x00leds_unregister(struct rt2x00_dev *rt2x00dev) 4228c2ecf20Sopenharmony_ci{ 4238c2ecf20Sopenharmony_ci} 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_cistatic inline void rt2x00leds_suspend(struct rt2x00_dev *rt2x00dev) 4268c2ecf20Sopenharmony_ci{ 4278c2ecf20Sopenharmony_ci} 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_cistatic inline void rt2x00leds_resume(struct rt2x00_dev *rt2x00dev) 4308c2ecf20Sopenharmony_ci{ 4318c2ecf20Sopenharmony_ci} 4328c2ecf20Sopenharmony_ci#endif /* CONFIG_RT2X00_LIB_LEDS */ 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci#endif /* RT2X00LIB_H */ 435