#ifndef RTLLIB_H
#define RTLLIB_H
#include <linux/if_ether.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/wireless.h>
#include "rtl819x_HT.h"
#include "rtl819x_BA.h"
#include "rtl819x_TS.h"
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <net/cfg80211.h>
#include <net/lib80211.h>
#define MAX_PRECMD_CNT …
#define MAX_RFDEPENDCMD_CNT …
#define MAX_POSTCMD_CNT …
#ifndef WIRELESS_SPY
#define WIRELESS_SPY
#endif
#include <net/iw_handler.h>
#ifndef IW_MODE_MONITOR
#define IW_MODE_MONITOR …
#endif
#ifndef IWEVCUSTOM
#define IWEVCUSTOM …
#endif
#ifndef IW_CUSTOM_MAX
#define IW_CUSTOM_MAX …
#endif
#define container_of_dwork_rsl(x, y, z) …
static inline void *netdev_priv_rsl(struct net_device *dev)
{ … }
#define KEY_TYPE_NA …
#define KEY_TYPE_WEP40 …
#define KEY_TYPE_TKIP …
#define KEY_TYPE_CCMP …
#define KEY_TYPE_WEP104 …
#define MAX_QUEUE_SIZE …
#define BK_QUEUE …
#define BE_QUEUE …
#define VI_QUEUE …
#define VO_QUEUE …
#define HCCA_QUEUE …
#define TXCMD_QUEUE …
#define MGNT_QUEUE …
#define HIGH_QUEUE …
#define BEACON_QUEUE …
#define IE_CISCO_FLAG_POSITION …
#define SUPPORT_CKIP_MIC …
#define SUPPORT_CKIP_PK …
#define RT_RF_OFF_LEVL_HALT_NIC …
#define RT_IN_PS_LEVEL(psc, _PS_FLAG) …
#define RT_CLEAR_PS_LEVEL(psc, _PS_FLAG) …
struct cb_desc { … };
enum sw_chnl_cmd_id { … };
struct sw_chnl_cmd { … };
#define MGN_1M …
#define MGN_2M …
#define MGN_5_5M …
#define MGN_11M …
#define MGN_6M …
#define MGN_9M …
#define MGN_12M …
#define MGN_18M …
#define MGN_24M …
#define MGN_36M …
#define MGN_48M …
#define MGN_54M …
#define MGN_MCS0 …
#define MGN_MCS1 …
#define MGN_MCS2 …
#define MGN_MCS3 …
#define MGN_MCS4 …
#define MGN_MCS5 …
#define MGN_MCS6 …
#define MGN_MCS7 …
#define MGN_MCS8 …
#define MGN_MCS9 …
#define MGN_MCS10 …
#define MGN_MCS11 …
#define MGN_MCS12 …
#define MGN_MCS13 …
#define MGN_MCS14 …
#define MGN_MCS15 …
enum hw_variables { … };
enum rt_op_mode { … };
#define asifs_time …
#define MGMT_QUEUE_NUM …
#define MAX_IE_LEN …
#define msleep_interruptible_rsl …
#define RTLLIB_1ADDR_LEN …
#define RTLLIB_2ADDR_LEN …
#define RTLLIB_3ADDR_LEN …
#define RTLLIB_4ADDR_LEN …
#define RTLLIB_FCS_LEN …
#define RTLLIB_SKBBUFFER_SIZE …
#define MIN_FRAG_THRESHOLD …
#define MAX_FRAG_THRESHOLD …
#define RTLLIB_FTYPE_MGMT …
#define RTLLIB_FTYPE_CTL …
#define RTLLIB_FTYPE_DATA …
#define RTLLIB_SCTL_FRAG …
#define RTLLIB_SCTL_SEQ …
#define RTLLIB_QCTL_TID …
#define FC_QOS_BIT …
#define is_data_frame(pdu) …
#define is_legacy_data_frame(pdu) …
#define is_qos_data_frame(pframe) …
#define frame_order(pframe) …
#define SN_LESS(a, b) …
#define SN_EQUAL(a, b) …
#define MAX_DEV_ADDR_SIZE …
enum act_category { … };
enum ba_action { … };
enum init_gain_op_type { … };
enum wireless_mode { … };
#ifndef ETH_P_PAE
#define ETH_P_PAE …
#define ETH_P_IP …
#define ETH_P_ARP …
#endif
#ifndef ETH_P_80211_RAW
#define ETH_P_80211_RAW …
#endif
#define P80211_OUI_LEN …
struct rtllib_snap_hdr { … } __packed;
enum _REG_PREAMBLE_MODE { … };
#define SNAP_SIZE …
#define WLAN_FC_GET_TYPE(fc) …
#define WLAN_FC_GET_STYPE(fc) …
#define WLAN_FC_MORE_DATA(fc) …
#define WLAN_GET_SEQ_FRAG(seq) …
#define WLAN_GET_SEQ_SEQ(seq) …
#define RTLLIB_STATMASK_SIGNAL …
#define RTLLIB_STATMASK_RSSI …
#define RTLLIB_STATMASK_NOISE …
#define RTLLIB_STATMASK_WEMASK …
#define RTLLIB_CCK_MODULATION …
#define RTLLIB_OFDM_MODULATION …
#define RTLLIB_CCK_RATE_LEN …
#define RTLLIB_CCK_RATE_1MB …
#define RTLLIB_CCK_RATE_2MB …
#define RTLLIB_CCK_RATE_5MB …
#define RTLLIB_CCK_RATE_11MB …
#define RTLLIB_OFDM_RATE_LEN …
#define RTLLIB_OFDM_RATE_6MB …
#define RTLLIB_OFDM_RATE_9MB …
#define RTLLIB_OFDM_RATE_12MB …
#define RTLLIB_OFDM_RATE_18MB …
#define RTLLIB_OFDM_RATE_24MB …
#define RTLLIB_OFDM_RATE_36MB …
#define RTLLIB_OFDM_RATE_48MB …
#define RTLLIB_OFDM_RATE_54MB …
#define RTLLIB_BASIC_RATE_MASK …
#define RTLLIB_FC0_TYPE_MASK …
#define RTLLIB_FC0_TYPE_DATA …
#define RTLLIB_FC0_SUBTYPE_MASK …
#define RTLLIB_FC0_SUBTYPE_QOS …
#define RTLLIB_QOS_HAS_SEQ(fc) …
#define IEEE_IBSS_MAC_HASH_SIZE …
struct rtllib_rx_stats { … };
#define RTLLIB_FRAG_CACHE_LEN …
struct rtllib_frag_entry { … };
struct rtllib_device;
#define SEC_ACTIVE_KEY …
#define SEC_AUTH_MODE …
#define SEC_UNICAST_GROUP …
#define SEC_LEVEL …
#define SEC_ENABLED …
#define SEC_LEVEL_0 …
#define SEC_LEVEL_1 …
#define SEC_LEVEL_2 …
#define SEC_LEVEL_2_CKIP …
#define SEC_LEVEL_3 …
#define SEC_ALG_NONE …
#define SEC_ALG_WEP …
#define SEC_ALG_TKIP …
#define SEC_ALG_CCMP …
#define WEP_KEY_LEN …
#define SCM_KEY_LEN …
struct rtllib_security { … } __packed;
enum rtllib_mfie { … };
struct rtllib_info_element { … } __packed;
struct rtllib_authentication { … } __packed __aligned(…);
struct rtllib_disauth { … } __packed __aligned(…);
struct rtllib_disassoc { … } __packed __aligned(…);
struct rtllib_probe_request { … } __packed __aligned(…);
struct rtllib_probe_response { … } __packed __aligned(…);
#define rtllib_beacon …
struct rtllib_assoc_request_frame { … } __packed __aligned(…);
struct rtllib_assoc_response_frame { … } __packed __aligned(…);
struct rtllib_txb { … };
#define MAX_SUBFRAME_COUNT …
struct rtllib_rxb { … };
frameqos;
#define MAX_RATES_LENGTH …
#define MAX_RATES_EX_LENGTH …
#define MAX_NETWORK_COUNT …
#define MAX_CHANNEL_NUMBER …
#define RTLLIB_SOFTMAC_SCAN_TIME …
#define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME …
#define MAX_WPA_IE_LEN …
#define MAX_WZC_IE_LEN …
#define NETWORK_EMPTY_ESSID …
#define NETWORK_HAS_OFDM …
#define NETWORK_HAS_CCK …
#define NETWORK_HAS_QOS_PARAMETERS …
#define NETWORK_HAS_QOS_INFORMATION …
#define NETWORK_HAS_QOS_MASK …
#define NETWORK_HAS_ERP_VALUE …
#define QOS_QUEUE_NUM …
#define QOS_OUI_LEN …
#define QOS_OUI_TYPE …
#define QOS_ELEMENT_ID …
#define QOS_OUI_INFO_SUB_TYPE …
#define QOS_OUI_PARAM_SUB_TYPE …
#define QOS_VERSION_1 …
struct rtllib_qos_information_element { … } __packed;
struct rtllib_qos_ac_parameter { … } __packed;
struct rtllib_qos_parameter_info { … } __packed;
struct rtllib_qos_parameters { … } __packed;
struct rtllib_qos_data { … };
struct rtllib_tim_parameters { … } __packed;
struct rtllib_wmm_ac_param { … };
enum eap_type { … };
static const char * const eap_types[] = …;
static inline const char *eap_get_type(int type)
{ … }
static inline u8 frame_qos_tid(u8 *buf)
{ … }
struct eapol { … } __packed;
struct rtllib_softmac_stats { … };
#define RTLLIB_DEFAULT_TX_ESSID …
#define RTLLIB_DEFAULT_BASIC_RATE …
enum { … };
#define MAX_SP_Len …
#define RTLLIB_QOS_TID …
#define QOS_CTL_NOTCONTAIN_ACK …
#define RTLLIB_DTIM_MBCAST …
#define RTLLIB_DTIM_UCAST …
#define RTLLIB_DTIM_VALID …
#define RTLLIB_DTIM_INVALID …
#define RTLLIB_PS_DISABLED …
#define RTLLIB_PS_UNICAST …
#define RTLLIB_PS_MBCAST …
#define WME_AC_BK …
#define WME_AC_BE …
#define WME_AC_VI …
#define WME_AC_VO …
#define WME_AC_PRAM_LEN …
#define MAX_RECEIVE_BUFFER_SIZE …
#define UP2AC(up) …
#define ETHERNET_HEADER_SIZE …
enum erp_t { … };
struct rtllib_network { … };
enum rtl_link_state { … };
#define DEFAULT_MAX_SCAN_AGE …
#define DEFAULT_FTS …
#define CFG_RTLLIB_RESERVE_FCS …
#define CFG_RTLLIB_COMPUTE_FCS …
struct tx_pending { … };
struct bandwidth_autoswitch { … };
#define REORDER_WIN_SIZE …
#define REORDER_ENTRY_NUM …
struct rx_reorder_entry { … };
enum fsync_state { … };
enum ips_callback_function { … };
enum rt_rf_power_state { … };
struct rt_pwr_save_ctrl { … };
#define RT_RF_CHANGE_SOURCE …
#define RF_CHANGE_BY_SW …
#define RF_CHANGE_BY_HW …
#define RF_CHANGE_BY_PS …
#define RF_CHANGE_BY_IPS …
#define RF_CHANGE_BY_INIT …
enum country_code_type { … };
enum scan_op_backup_opt { … };
#define RT_MAX_LD_SLOT_NUM …
struct rt_link_detect { … };
struct sw_cam_table { … };
#define TOTAL_CAM_ENTRY …
struct rate_adaptive { … };
#define NUM_PMKID_CACHE …
struct rt_pmkid_list { … };
#define STATUS_SCANNING …
enum { … };
struct rtllib_device { … };
#define IEEE_MODE_MASK …
#define IEEE_SOFTMAC_SCAN …
#define IEEE_SOFTMAC_ASSOCIATE …
#define IEEE_SOFTMAC_PROBERQ …
#define IEEE_SOFTMAC_PROBERS …
#define IEEE_SOFTMAC_TX_QUEUE …
#define IEEE_SOFTMAC_SINGLE_QUEUE …
#define IEEE_SOFTMAC_BEACONS …
static inline void *rtllib_priv(struct net_device *dev)
{ … }
static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
{ … }
static inline int rtllib_get_hdrlen(u16 fc)
{ … }
static inline int rtllib_is_ofdm_rate(u8 rate)
{ … }
static inline int rtllib_is_cck_rate(u8 rate)
{ … }
void free_rtllib(struct net_device *dev);
struct net_device *alloc_rtllib(int sizeof_priv);
int rtllib_encrypt_fragment(struct rtllib_device *ieee,
struct sk_buff *frag,
int hdr_len);
netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
void rtllib_txb_free(struct rtllib_txb *txb);
int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_rx_stats *rx_stats);
int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel);
int rtllib_wx_get_scan(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
int rtllib_wx_set_encode(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
int rtllib_wx_get_encode(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *key);
int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_set_auth(struct rtllib_device *ieee,
struct iw_request_info *info,
struct iw_param *data, char *extra);
int rtllib_wx_set_mlme(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb,
struct rtllib_rx_stats *rx_stats, u16 type,
u16 stype);
void rtllib_softmac_new_net(struct rtllib_device *ieee,
struct rtllib_network *net);
void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn);
void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee);
int rtllib_softmac_init(struct rtllib_device *ieee);
void rtllib_softmac_free(struct rtllib_device *ieee);
void rtllib_disassociate(struct rtllib_device *ieee);
void rtllib_stop_scan(struct rtllib_device *ieee);
bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
void rtllib_start_scan_syncro(struct rtllib_device *ieee);
void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr);
void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
void rtllib_start_protocol(struct rtllib_device *ieee);
void rtllib_stop_protocol(struct rtllib_device *ieee);
void rtllib_enable_net_monitor_mode(struct net_device *dev, bool init_state);
void rtllib_disable_net_monitor_mode(struct net_device *dev, bool init_state);
void rtllib_softmac_stop_protocol(struct rtllib_device *ieee);
void rtllib_softmac_start_protocol(struct rtllib_device *ieee);
void rtllib_reset_queue(struct rtllib_device *ieee);
void rtllib_wake_all_queues(struct rtllib_device *ieee);
void rtllib_stop_all_queues(struct rtllib_device *ieee);
void notify_wx_assoc_event(struct rtllib_device *ieee);
void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee);
u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *ext);
int rtllib_wx_set_wap(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *awrq, char *extra);
int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
union iwreq_data *wrqu, char *b);
void rtllib_wx_sync_scan_wq(void *data);
int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_set_power(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_get_power(struct rtllib_device *ieee,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_set_rts(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra);
#define MAX_RECEIVE_BUFFER_SIZE …
void ht_set_connect_bw_mode(struct rtllib_device *ieee,
enum ht_channel_width bandwidth,
enum ht_extchnl_offset Offset);
void ht_update_default_setting(struct rtllib_device *ieee);
void ht_construct_capability_element(struct rtllib_device *ieee,
u8 *pos_ht_cap, u8 *len,
u8 is_encrypt, bool assoc);
void ht_construct_rt2rt_agg_element(struct rtllib_device *ieee,
u8 *posRT2RTAgg, u8 *len);
void ht_on_assoc_rsp(struct rtllib_device *ieee);
void ht_initialize_ht_info(struct rtllib_device *ieee);
void ht_initialize_bss_desc(struct bss_ht *bss_ht);
void ht_reset_self_and_save_peer_setting(struct rtllib_device *ieee,
struct rtllib_network *network);
void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
struct rtllib_network *network);
u8 ht_get_highest_mcs_rate(struct rtllib_device *ieee, u8 *pMCSRateSet,
u8 *pMCSFilter);
extern u8 MCS_FILTER_ALL[];
extern u16 MCS_DATA_RATE[2][2][77];
u8 ht_c_check(struct rtllib_device *ieee, u8 *frame);
void ht_reset_iot_setting(struct rt_hi_throughput *ht_info);
bool is_ht_half_nmode_aps(struct rtllib_device *ieee);
u16 tx_count_to_data_rate(struct rtllib_device *ieee, u8 nDataRate);
int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb);
int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb);
int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb);
void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts,
u8 policy, u8 overwrite_pending);
void rtllib_ts_init_del_ba(struct rtllib_device *ieee,
struct ts_common_info *ts_common_info,
enum tr_select tx_rx_select);
void rtllib_ba_setup_timeout(struct timer_list *t);
void rtllib_tx_ba_inact_timeout(struct timer_list *t);
void rtllib_rx_ba_inact_timeout(struct timer_list *t);
void rtllib_reset_ba_entry(struct ba_record *ba);
bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *addr,
u8 TID, enum tr_select tx_rx_select, bool add_new_ts);
void rtllib_ts_init(struct rtllib_device *ieee);
void rtllib_ts_start_add_ba_process(struct rtllib_device *ieee,
struct tx_ts_record *pTxTS);
void remove_peer_ts(struct rtllib_device *ieee, u8 *addr);
void remove_all_ts(struct rtllib_device *ieee);
static inline const char *escape_essid(const char *essid, u8 essid_len)
{ … }
bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn);
void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee,
struct rx_ts_record *ts);
int rtllib_parse_info_param(struct rtllib_device *ieee,
struct rtllib_info_element *info_element,
u16 length,
struct rtllib_network *network,
struct rtllib_rx_stats *stats);
void rtllib_indicate_packets(struct rtllib_device *ieee,
struct rtllib_rxb **prxb_indicate_array, u8 index);
#define RT_ASOC_RETRY_LIMIT …
u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee);
#endif