Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources
This commit is contained in:
425
sdk/include/lib/umac/ieee80211.h
Normal file
425
sdk/include/lib/umac/ieee80211.h
Normal file
@@ -0,0 +1,425 @@
|
||||
#ifndef _HGIC_IEEE80211_H_
|
||||
#define _HGIC_IEEE80211_H_
|
||||
|
||||
#include "lib/lmac/hgic.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAE) || defined(CONFIG_OWE)
|
||||
#define CONFIG_ECC
|
||||
#define sae_dbg(fmt, ...) //os_printf("%s:%d:: __SAE:"fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define sae_dbg(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* IEEE 802.11r */
|
||||
#define MOBILITY_DOMAIN_ID_LEN 2
|
||||
#define FT_R0KH_ID_MAX_LEN 48
|
||||
#define FT_R1KH_ID_LEN 6
|
||||
#define WPA_PMK_NAME_LEN 16
|
||||
|
||||
#define WPA_KEY_MGMT_PSK BIT(1)
|
||||
#define WPA_KEY_MGMT_NONE BIT(2)
|
||||
#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
|
||||
#define WPA_KEY_MGMT_SAE BIT(10)
|
||||
#define WPA_KEY_MGMT_OWE BIT(22)
|
||||
|
||||
#define WPA_CIPHER_NONE BIT(0)
|
||||
#define WPA_CIPHER_TKIP BIT(3)
|
||||
#define WPA_CIPHER_CCMP BIT(4)
|
||||
#define WPA_CIPHER_CCMP_256 BIT(9)
|
||||
|
||||
#define WPA_PROTO_WPA BIT(0)
|
||||
#define WPA_PROTO_RSN BIT(1)
|
||||
|
||||
enum IEEE80211_BAND {
|
||||
IEEE80211_BAND_2GHZ,
|
||||
IEEE80211_BAND_5GHZ,
|
||||
IEEE80211_BAND_60GHZ,
|
||||
IEEE80211_BAND_S1GHZ,
|
||||
|
||||
NUM_IEEE80211_BANDS,
|
||||
};
|
||||
|
||||
enum ieee80211_hwmode {
|
||||
IEEE80211_HWMODE_NONE,
|
||||
IEEE80211_HWMODE_11B, // b only
|
||||
IEEE80211_HWMODE_11G, // bg mix
|
||||
IEEE80211_HWMODE_11N, // bgn mix
|
||||
IEEE80211_HWMODE_11AH, // ah only
|
||||
};
|
||||
|
||||
enum country_code {
|
||||
COUNTRY_US,
|
||||
COUNTRY_EU,
|
||||
COUNTRY_JP,
|
||||
COUNTRY_CN,
|
||||
COUNTRY_KR,
|
||||
COUNTRY_SG,
|
||||
COUNTRY_AU,
|
||||
COUNTRY_NZ,
|
||||
|
||||
NUM_COUNTRIES,
|
||||
};
|
||||
|
||||
enum ieee80211_event {
|
||||
IEEE80211_EVENT_PAIR_START = 1, // 1 - start pairing, param1:0, param2:0
|
||||
IEEE80211_EVENT_PAIR_SUCCESS, // 2 - pairing success, param1: pairing peer's MAC, param2:6
|
||||
IEEE80211_EVENT_PAIR_FAIL, // 3 - pairing fail. param1:1, param2:2
|
||||
IEEE80211_EVENT_PAIR_DONE, // 4 - paring complete. param1: pairing peer's MAC, param2:6
|
||||
IEEE80211_EVENT_SCAN_START, // 5 - start scanning. param1:0, param2:0
|
||||
IEEE80211_EVENT_SCAN_DONE, // 6 - stop scanning. param1:0, param2:0
|
||||
IEEE80211_EVENT_CONNECT_START, // 7 - start connect. param1:AP's MAC, param2:0
|
||||
IEEE80211_EVENT_CONNECTED, // 8 - connect success. param1: AP/STA MAC, param2:0
|
||||
IEEE80211_EVENT_CONNECT_FAIL, // 9 - connect fail. param1: status code, param2:0
|
||||
IEEE80211_EVENT_DISCONNECTED, // 10 - disconnect. param1: AP/STA MAC, param2: reason code.
|
||||
IEEE80211_EVENT_RX_FRAME, // 11 - recieve wifi frames. param1: the pointer of frame, type: uint8 *, param2: rx status, type: struct ieee80211_rx_status *
|
||||
IEEE80211_EVENT_RSSI, // 12 - RSSI changed. param1: new rssi, param2: sta's MAC.
|
||||
IEEE80211_EVENT_STATE_CHANGE, // 13 - <ignore>.
|
||||
IEEE80211_EVENT_NEW_BSS, // 14 - find a new BSS. param1: BSS's bssid, param2: BSS's ssid.
|
||||
IEEE80211_EVENT_UPDATE_BSS, // 15 - <ignore>.
|
||||
IEEE80211_EVENT_PS_START, // 16 - <ignore>.
|
||||
IEEE80211_EVENT_PS_END, // 17 - <ignore>.
|
||||
IEEE80211_EVENT_STA_PS_START, // 18 - STA enter ps mode. param1: STA's MAC, param2:0
|
||||
IEEE80211_EVENT_STA_PS_END, // 19 - STA exit ps mode. param1: STA's MAC, param2:0
|
||||
IEEE80211_EVENT_INTERFACE_ENABLE, // 20 - wifi stack interface enabled. param1:0, param2:0
|
||||
IEEE80211_EVENT_INTERFACE_DISABLE, // 21 - wifi stack interface disabled. param1:0, param2:0
|
||||
IEEE80211_EVENT_ADD_CUSTOMER_IE, // 22 - notify to add customer IE data. param1: the pointer of wifi frame, param2:customer IE data, output parameter, type: uint8 **, return value: length of customer IE data.
|
||||
IEEE80211_EVENT_MAC_CHANGE, // 23 - mac changed. param1: new MAC, param2:0
|
||||
IEEE80211_EVENT_EVM, // 24 - EVM changed. param1: new evm, param2:sta's MAC.
|
||||
IEEE80211_EVENT_UNKNOWN_STA, // 25 - <ignore>
|
||||
IEEE80211_EVENT_PRE_AUTH, // 26 - STA request to AUTH, you can check blacklist. param1: sta's MAC, param2:0
|
||||
IEEE80211_EVENT_PRE_ASSOC, // 27 - STA request to ASSOC, you can check blacklist. param1: sta's MAC, param2:0
|
||||
IEEE80211_EVENT_UNPAIR_SUCCESS, // 28 - unpaired. param1: peer sta's MAC, param2:0
|
||||
IEEE80211_EVENT_TX_BITRATE, // 29 - <ignore>.
|
||||
IEEE80211_EVENT_EXCEPTION_INFO, // 30 - <ignore>.
|
||||
IEEE80211_EVENT_ACS_DONE, // 31 - <ignore>.
|
||||
IEEE80211_EVENT_TX_FRAME, // 32 - events before WiFi stack sends data. param1: wifi frame data, param2: 0, return value: 0:contuine tx, else stop tx.
|
||||
IEEE80211_EVENT_RX_CUSTMGMT, // 33 - received custom management frame, from the peer sta executed the ieee80211_tx_custmgmt API. param1: struct ieee80211_custmgmt_data *, param2:0.
|
||||
IEEE80211_EVENT_FT_START, // 34
|
||||
IEEE80211_EVENT_WRONG_KEY, // 35
|
||||
IEEE80211_EVENT_CHANNEL_CHANGE, // 36
|
||||
IEEE80211_EVENT_P2P_NGO_DONE, // 37
|
||||
IEEE80211_EVENT_WSC_DONE, // 38
|
||||
IEEE80211_EVENT_TX_STATUS, // 39
|
||||
IEEE80211_EVENT_P2P_FOUND, // 40
|
||||
IEEE80211_EVENT_AP_CSA_DONE, // 41
|
||||
IEEE80211_EVENT_SCAN_IDLE, // 42
|
||||
IEEE80211_EVENT_GEN_BEACON, // 43
|
||||
IEEE80211_EVENT_BEACON_IDLE, // 44
|
||||
IEEE80211_EVENT_RELAY_UPDATE, // 45
|
||||
IEEE80211_EVENT_RELAY_ERROR, // 46
|
||||
IEEE80211_EVENT_PAIR_NGO, // 47
|
||||
IEEE80211_EVENT_ROMAING_FAIL, // 48
|
||||
IEEE80211_EVENT_REQ_PAIR_AID, // 49
|
||||
};
|
||||
|
||||
/* txsemi custom reason code */
|
||||
enum IEEE80211_TXREASON{
|
||||
WLAN_REASON_AP_NOT_FOUND = 60000,
|
||||
WLAN_REASON_ASSOC_TIMEOUT,
|
||||
WLAN_REASON_PAIR_START,
|
||||
WLAN_REASON_UNPAIR,
|
||||
WLAN_REASON_RELAY_DISCONNECT,
|
||||
};
|
||||
|
||||
enum wpa_states {
|
||||
WPA_DISCONNECTED, //0
|
||||
WPA_INTERFACE_DISABLED, //1
|
||||
WPA_INACTIVE, //2
|
||||
WPA_SCANNING, //3
|
||||
WPA_AUTHENTICATING, //4
|
||||
WPA_ASSOCIATING, //5
|
||||
WPA_ASSOCIATED, //6
|
||||
WPA_4WAY_HANDSHAKE, //7
|
||||
WPA_GROUP_HANDSHAKE, //8
|
||||
WPA_COMPLETED, //9
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
IEEE80211_PKTHDL_CONTINUE = 0,
|
||||
IEEE80211_PKTHDL_CONSUMED = 1,
|
||||
} ieee80211_pkthdl_res;
|
||||
|
||||
struct ieee80211_custmgmt_data{
|
||||
uint8 *from;
|
||||
uint8 *data;
|
||||
uint8 len;
|
||||
};
|
||||
|
||||
struct ieee80211_csa_param{
|
||||
uint8 mode, chan, count;
|
||||
};
|
||||
|
||||
struct ieee80211_hookdata{
|
||||
uint8 *data;
|
||||
uint16 len;
|
||||
uint16 ext: 1, recv: 15;
|
||||
uint32 hdl;
|
||||
};
|
||||
struct ieee80211_pkthook;
|
||||
typedef ieee80211_pkthdl_res(*ieee80211_pkthdl)(struct ieee80211_pkthook *hook, uint8 ifidx, struct ieee80211_hookdata *data);
|
||||
struct ieee80211_pkthook_const{
|
||||
const char *name;
|
||||
void *priv;
|
||||
uint16 protocol;
|
||||
uint16 mcast: 1, ucast:1, rev: 14;
|
||||
ieee80211_pkthdl tx;
|
||||
ieee80211_pkthdl rx;
|
||||
};
|
||||
struct ieee80211_pkthook {
|
||||
struct ieee80211_pkthook *next;
|
||||
uint32 time_max, consume_data;
|
||||
const struct ieee80211_pkthook_const *c_data;
|
||||
};
|
||||
|
||||
typedef int32(*ieee80211_evt_cb)(uint8 ifidx, uint16 evt, uint32 param1, uint32 param2);
|
||||
struct ieee80211_initparam {
|
||||
uint8 vif_maxcnt;
|
||||
uint8 bss_maxcnt;
|
||||
uint8 headroom, tailroom;
|
||||
uint16 sta_maxcnt;
|
||||
uint16 bss_lifetime;
|
||||
uint16 stack_size;
|
||||
uint16 no_rxtask:1, ssid_fuzzy_match:4, rev: 11;
|
||||
ieee80211_evt_cb evt_cb;
|
||||
};
|
||||
|
||||
struct ieee80211_scandata {
|
||||
uint32 chan_bitmap; //scan channel bitmap
|
||||
uint8 ssid[SSID_MAX_LEN+1];
|
||||
uint8 scan_time, scan_cnt; //scan time & count at every channel
|
||||
uint8 passive_scan: 1, flush: 1, rev: 6;
|
||||
};
|
||||
|
||||
struct ieee80211_stainfo {
|
||||
uint16 aid;
|
||||
uint8 addr[6];
|
||||
int8 rssi, evm;
|
||||
uint8 wake_reason;
|
||||
uint8 ps: 1, connected: 1, wmm: 1;
|
||||
uint32 tx_mcs, rx_mcs;
|
||||
uint64 tx_bytes, rx_bytes;
|
||||
};
|
||||
|
||||
struct ieee80211_wmm_param {
|
||||
uint16 txop;
|
||||
uint16 cw_min;
|
||||
uint16 cw_max;
|
||||
uint8 aifsn;
|
||||
uint8 acm;
|
||||
};
|
||||
|
||||
struct ieee80211_tx_info {
|
||||
uint8 band;
|
||||
uint8 ifidx;
|
||||
uint16 no_ack: 1, rev:15;
|
||||
uint32 tag;
|
||||
};
|
||||
|
||||
struct ieee80211_rx_status {
|
||||
uint32 freq;
|
||||
uint8 band, ifidx;
|
||||
int8 rssi, evm;
|
||||
uint8 mcs;
|
||||
uint8 rx_flags;
|
||||
uint16 rxlen;
|
||||
};
|
||||
|
||||
enum ieee80211_rx_flag{
|
||||
IEEE80211_RX_FLAG_MORE_DATA = BIT(0),
|
||||
IEEE80211_RX_FLAG_AMSDU = BIT(1),
|
||||
};
|
||||
|
||||
struct ieee80211_roaming_param {
|
||||
uint8 start: 1, ft_en: 1;
|
||||
uint8 state;
|
||||
uint8 old_chan;
|
||||
int8 rssi_avg, rssi_check;
|
||||
uint16 roaming_tmo;
|
||||
int16 rssi_sum;
|
||||
uint8 bssid_new[6];
|
||||
uint8 bssid_old[6];
|
||||
uint8 ssid[SSID_MAX_LEN + 1];
|
||||
struct ieee80211_bss_info *newbss;
|
||||
};
|
||||
|
||||
struct ieee80211_bss_wpadata {
|
||||
uint32 proto;
|
||||
uint32 group_cipher;
|
||||
uint32 pairwise_cipher;
|
||||
uint32 key_mgmt;
|
||||
};
|
||||
|
||||
/*MLME frame expand size*/
|
||||
struct ieee80211_mlme_size{
|
||||
uint16 probe_req, probe_resp;
|
||||
uint16 beacon, vendor_spec_action;
|
||||
uint16 assoc_req, assoc_resp;
|
||||
uint8 auth, deauth, disassoc, addba_resp;
|
||||
uint16 p2p_neg;
|
||||
};
|
||||
|
||||
struct ieee80211_linkcost_param{
|
||||
//各项指标的上限或下限
|
||||
int8 rssi_min;
|
||||
int8 evm_min;
|
||||
uint8 stas_max;
|
||||
uint8 loading_max;
|
||||
uint16 txdelay_max;
|
||||
uint16 datarate_max;
|
||||
|
||||
//权重系统:百分比
|
||||
uint8 rssi_weight;
|
||||
uint8 evm_weight;
|
||||
uint8 txdelay_weight;
|
||||
uint8 loading_weight;
|
||||
uint8 stas_weight;
|
||||
uint8 per_weight;
|
||||
uint8 datarate_weight;
|
||||
|
||||
//各项指标的等级划分:差,中等,优,(百分比)
|
||||
uint8 rssi_poor, rssi_maiginal, rssi_good;
|
||||
uint8 evm_poor, evm_maiginal, evm_good;
|
||||
uint8 loading_poor, loading_maiginal, loading_good;
|
||||
uint8 stas_poor, stas_maiginal, stas_good;
|
||||
uint8 per_poor, per_maiginal, per_good;
|
||||
uint8 txdelay_poor, txdelay_maiginal, txdelay_good;
|
||||
uint8 datarate_poor, datarate_maiginal, datarate_good;
|
||||
};
|
||||
|
||||
extern int32 wpa_passphrase(uint8 *ssid, char *passwd, uint8 psk[32]);
|
||||
extern int32 ieee80211_init(struct ieee80211_initparam *param);
|
||||
extern int32 ieee80211_deliver_init(int32 max, uint32 lifetime);
|
||||
extern int32 ieee80211_support_txw830x(void *ops);
|
||||
extern int32 ieee80211_support_txw80x(void *ops);
|
||||
extern int32 ieee80211_support_txw81x(void *ops);
|
||||
extern int32 ieee80211_iface_create_ap(uint8 ifidx, uint8 band);
|
||||
extern int32 ieee80211_iface_create_sta(uint8 ifidx, uint8 band);
|
||||
extern int32 ieee80211_iface_create_p2pdev(uint8 ifidx, uint8 band, uint8 go, uint8 gc);
|
||||
extern int32 ieee80211_iface_start(uint8 ifidx);
|
||||
extern int32 ieee80211_iface_stop(uint8 ifidx);
|
||||
extern int32 ieee80211_pair_enable(uint8 ifidx, uint16 pair_magic);
|
||||
extern int32 ieee80211_pairing(uint8 ifidx, uint16 pair_magic);
|
||||
extern int32 ieee80211_unpair(uint8 ifidx, uint8 *mac);
|
||||
extern void ieee80211_status(uint8 *buff, uint32 size);
|
||||
extern int32 ieee80211_scan(uint8 index, uint8 start, struct ieee80211_scandata *scan_param);
|
||||
extern int32 ieee80211_scatter_tx(uint8 ifidx, scatter_data *data, uint32 count);
|
||||
extern int32 ieee80211_tx(uint8 ifidx, uint8 *data, uint32 len);
|
||||
extern void ieee80211_input(uint8 ifidx, uint8 *data, uint32 len);
|
||||
extern int32 ieee80211_tx_mgmt(uint8 ifidx, uint8 *mgmt, uint32 len);
|
||||
extern int32 ieee80211_tx_custmgmt(uint8 ifidx, uint8 *dest, uint8 *data, uint32 len);
|
||||
extern int32 ieee80211_tx_ether(uint8 ifidx, uint8 *dest, uint16 proto, uint8 *data, uint32 len);
|
||||
extern int32 ieee80211_disassoc(uint8 ifidx, uint8 *addr);
|
||||
extern int32 ieee80211_disassoc_all(uint8 ifidx);
|
||||
extern int32 ieee80211_register_pkthook(struct ieee80211_pkthook *hook);
|
||||
extern int32 ieee80211_hook_ext_data(uint8 ifidx, uint8 tx, uint8 *data, uint32 len);
|
||||
extern ieee80211_evt_cb ieee80211_event_cb(ieee80211_evt_cb cb);
|
||||
extern void ieee80211_cleanup_bsslist(void);
|
||||
extern int32 ieee80211_get_bsslist(struct hgic_bss_info *bsslist, int32 list_size, int8 ignore_dis);
|
||||
extern int32 ieee80211_get_stalist(uint8 ifidx, struct hgic_sta_info *stalist, int32 list_size);
|
||||
extern int32 ieee80211_conf_stabr_table(uint8 ifidx, uint16 max, int32 lifetime);
|
||||
extern int32 ieee80211_conf_set_bssbw(uint8 ifidx, uint8 bssbw);
|
||||
extern int32 ieee80211_conf_get_bssbw(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_set_chanlist(uint8 ifidx, uint16 *chan_list, uint32 count);
|
||||
extern int32 ieee80211_conf_set_ssid(uint8 ifidx, uint8 *ssid);
|
||||
extern int32 ieee80211_conf_get_ssid(uint8 ifidx, uint8 *ssid);
|
||||
extern int32 ieee80211_conf_set_keymgmt(uint8 ifidx, uint32 keymgmt);
|
||||
extern int32 ieee80211_conf_get_keymgmt(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_set_psk(uint8 ifidx, uint8 psk[32]);
|
||||
extern int32 ieee80211_conf_set_passwd(uint8 ifidx, char *passwd);
|
||||
extern int32 ieee80211_conf_get_psk(uint8 ifidx, uint8 psk[32]);
|
||||
extern int32 ieee80211_conf_set_beacon_int(uint8 ifidx, uint32 beacon_int);
|
||||
extern int32 ieee80211_conf_set_dtim_int(uint8 ifidx, uint16 dtim_int);
|
||||
extern int32 ieee80211_conf_set_bssid(uint8 ifidx, uint8 *bssid);
|
||||
extern int32 ieee80211_conf_get_bssid(uint8 ifidx, uint8 *bssid);
|
||||
extern int32 ieee80211_conf_set_channel(uint8 ifidx, uint8 channel);
|
||||
extern int32 ieee80211_conf_get_channel(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_mac(uint8 ifidx, uint8 *mac);
|
||||
extern int32 ieee80211_conf_set_mac(uint8 ifidx, uint8 *mac);
|
||||
extern int32 ieee80211_conf_set_bss_max_idle(uint8 ifidx, uint16 max_idle_period);
|
||||
extern int32 ieee80211_conf_get_connstate(uint8 ifidx);
|
||||
extern uint8 ieee80211_conf_get_wkreason(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_wakeup_sta(uint8 ifidx, uint8 *addr, uint16 aid, uint32 reason);
|
||||
extern int32 ieee80211_conf_get_txpower(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_set_heartbeat_int(uint8 ifidx, uint32 heartbeat_int);
|
||||
extern int32 ieee80211_conf_set_heartbeat_data(uint8 ifidx, void *data, uint8 retry);
|
||||
extern int32 ieee80211_conf_set_aplost_time(uint8 ifidx, uint32 time);
|
||||
extern int32 ieee80211_conf_set_acs(uint8 ifidx, uint8 acs, uint8 tmo);
|
||||
extern int32 ieee80211_conf_set_wmm_enable(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_set_use4addr(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_get_use4addr(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_stainfo(uint8 ifidx, uint16 aid, uint8 *mac, struct ieee80211_stainfo *sta);
|
||||
extern int32 ieee80211_conf_get_stalist(uint8 ifidx, struct ieee80211_stainfo *sta, uint32 count);
|
||||
extern int32 ieee80211_conf_get_sta_snr(uint8 ifidx, uint8 aid, int8 *snr);
|
||||
extern int32 ieee80211_conf_get_stacnt(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_set_aphide(uint8 ifidx, uint8 hide);
|
||||
extern int32 ieee80211_conf_get_bgrssi(uint8 ifidx, uint8 channel, uint8 *bgr);
|
||||
extern int32 ieee80211_conf_set_mcast_txrate(uint8 ifidx, uint32 txrate);
|
||||
extern int32 ieee80211_conf_set_hwmode(uint8 ifidx, enum ieee80211_hwmode mode);
|
||||
extern int32 ieee80211_conf_set_psdata_cnt(uint8 ifidx, uint8 max_cnt);
|
||||
extern int32 ieee80211_conf_set_wmm_param(uint8 ifidx, uint8 ac, struct ieee80211_wmm_param *param);
|
||||
extern int32 ieee80211_conf_get_wmm_param(uint8 ifidx, uint8 ac, struct ieee80211_wmm_param *param);
|
||||
extern int32 ieee80211_conf_set_wpa_group_rekey(uint8 ifidx, uint32 wpa_group_rekey);
|
||||
extern int32 ieee80211_deliver_status(uint8 *buff, uint32 size);
|
||||
extern int32 ieee80211_stabr_status(uint8 ifidx, uint8 *buff, uint32 size);
|
||||
extern int32 ieee80211_conf_set_datatag(uint8 ifidx, uint32 hdl, uint32 tag);
|
||||
extern int32 ieee80211_conf_get_ant_sel(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_reason_code(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_status_code(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_rtc(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_get_acs_result(uint8 ifidx, uint8 *buff);
|
||||
extern int32 ieee80211_conf_set_rtc(uint8 ifidx, uint8 *data);
|
||||
extern int32 ieee80211_conf_set_radio_onoff(uint8 ifidx, uint8 en);
|
||||
extern int32 ieee80211_conf_set_isolate(uint8 ifidx, uint8 isolate);
|
||||
extern int32 ieee80211_conf_set_ft(uint8 ifidx, void *ft_param);
|
||||
extern int32 ieee80211_chan_center_freq(uint8 ifidx, uint8 channel);
|
||||
extern int32 ieee80211_get_bssinfo(struct hgic_bss_info *bss, uint8 band, uint8 *ssid, uint8 *bssid);
|
||||
extern int32 ieee80211_conf_set_dupfilter(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_set_conn_timeout(uint8 ifidx, uint32 auth_tmo, uint32 assoc_tmo, uint32 handshake_tmo);
|
||||
extern int32 ieee80211_bss_add_manualAP(uint8 *ssid, uint8 *bssid, uint8 channel, uint8 band, struct ieee80211_bss_wpadata *wpa_data);
|
||||
extern int32 ieee80211_bss_get_wpadata(uint8 *bssid, uint8 band, struct ieee80211_bss_wpadata *wpa_data);
|
||||
extern int32 ieee80211_expand_mlme_size(uint8 ifidx, struct ieee80211_mlme_size *size);
|
||||
extern int32 ieee80211_conf_set_csa(uint8 ifidx, struct ieee80211_csa_param *csa);
|
||||
extern void ieee80211_hook_status(void);
|
||||
extern int32 ieee80211_conf_set_wpa_cipher(uint8 ifidx, uint32 wpa_proto, uint32 pairwise_cipher, uint32 group_cipher);
|
||||
extern int32 ieee80211_conf_set_p2p_dev_name(uint8 ifidx, char *dev_name);
|
||||
extern int32 ieee80211_conf_set_p2p_model_name(uint8 ifidx, char *model_name);
|
||||
extern int32 ieee80211_conf_set_p2p_model_num(uint8 ifidx, char *model_num);
|
||||
extern int32 ieee80211_conf_set_p2p_vendor_name(uint8 ifidx, char *vendor_name);
|
||||
extern int32 ieee80211_conf_set_p2p_serial_number(uint8 ifidx, char *serial_number);
|
||||
extern int32 ieee80211_conf_set_p2p_uuid(uint8 ifidx, char *uuid);
|
||||
extern int32 ieee80211_conf_set_p2p_methods(uint8 ifidx, char *methods);
|
||||
extern int32 ieee80211_conf_set_p2p_dev_type(uint8 ifidx, char *dev_type);
|
||||
extern int32 ieee80211_conf_set_wfd_element(uint8 ifidx, uint8 id, uint8 *data, uint16 len);
|
||||
extern int32 ieee80211_conf_set_absolute_beacon(uint8 ifidx, uint8 en);
|
||||
extern int32 ieee80211_conf_set_auto_assoc(uint8 ifidx, uint8 auto_assoc, uint8 auto_scan);
|
||||
extern int32 ieee80211_conf_set_relay_mode(uint8 ifidx, uint8 enable, uint8 relay_level, uint8 relay_mcast);
|
||||
extern int32 ieee80211_conf_get_relay_level(uint8 ifidx);
|
||||
extern int32 ieee80211_conf_set_listen_interval(uint8 ifidx, uint16 listen_interval);
|
||||
extern int32 ieee80211_conf_set_scan_max(uint8 ifidx, uint16 scan_max);
|
||||
extern int32 ieee80211_conf_set_signal_threshold(uint8 ifidx, uint8 rssi_thres, uint8 evm_thres);
|
||||
extern int32 ieee80211_conf_set_security_policy(uint8 ifidx, uint8 security_policy);
|
||||
extern int32 ieee80211_conf_set_sae_pwe_loop(uint8 ifidx, uint8 loop);
|
||||
extern int32 ieee80211_conf_set_ap_psmode_en(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_set_pair_ngo(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_set_mutl_pair(uint8 ifidx, uint8 enable);
|
||||
extern int32 ieee80211_conf_set_linkcost_param(uint8 ifidx, struct ieee80211_linkcost_param *param);
|
||||
extern int32 ieee80211_conf_set_pair_channel(uint8 ifidx, uint8 chan);
|
||||
extern int32 ieee80211_conf_get_tx_mcs(uint8 ifidx, uint8 *sta_addr, uint32 aid);
|
||||
extern int32 ieee80211_conf_set_tx_mcs(uint8 ifidx, uint32 mcs, uint32 type);
|
||||
|
||||
extern void ieee80211_crypto_ec_support(void);
|
||||
extern void ieee80211_crypto_ecdh_support(void);
|
||||
extern void ieee80211_crypto_aes_support(void);
|
||||
extern void ieee80211_crypto_bignum_support(void);
|
||||
extern void ieee80211_crypto_dh_support(void);
|
||||
extern void ieee80211_crypto_sha_support(void);
|
||||
extern void ieee80211_crypto_hash_support(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
871
sdk/include/lib/umac/libwnb.h
Normal file
871
sdk/include/lib/umac/libwnb.h
Normal file
@@ -0,0 +1,871 @@
|
||||
#ifndef _HGSDK_WNB_H_
|
||||
#define _HGSDK_WNB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "sys_config.h"
|
||||
#include "lib/common/rbuffer.h"
|
||||
#include "lib/lmac/hgic.h"
|
||||
#include "lib/skb/skb_list.h"
|
||||
|
||||
#define WNB_SSID_LEN (32)
|
||||
#define ETH_P_NETAT (0x4848)
|
||||
#define ETH_P_ATDATA (0x4849)
|
||||
#define ETH_P_RAWDATA (0x4850)
|
||||
#define ETH_P_M2UCAST (0x4852)
|
||||
#define ETH_P_WNBROAM (0x4853)
|
||||
|
||||
/* WNB protocol defines */
|
||||
#define IEEE80211_STYPE_WNB 0x00E0
|
||||
|
||||
#define WNB_STYPE_ASSOC 0x01
|
||||
#define WNB_STYPE_PAIR 0x02
|
||||
#define WNB_STYPE_DISASSOC 0x03
|
||||
#define WNB_STYPE_CUSTOMER 0x04
|
||||
#define WNB_STYPE_CONFIG 0x05
|
||||
#define WNB_STYPE_OTA 0x06
|
||||
#define WNB_STYPE_STA_HEARTHBEAT 0x07
|
||||
#define WNB_STYPE_ROAMING 0x08
|
||||
#define WNB_STYPE_PROBE_REQUEST 0x09
|
||||
#define WNB_STYPE_PROBE_RESPONSE 0x0A
|
||||
#define WNB_STYPE_USER_HEARTBEAT 0x0B
|
||||
#define WNB_STYPE_USER_HEARTBEAT_RESP 0x0C
|
||||
#define WNB_STYPE_USER_WAKEUP_DATA 0x0D
|
||||
#define WNB_STYPE_USER_HEARTBEAT_LOST 0x0E
|
||||
#define WNB_STYPE_BATTERY_SOC 0x0F
|
||||
#define WNB_STYPE_MGTM_CONFIG 0x11
|
||||
|
||||
#define WNB_FOR_ME(h,wnb) (os_memcmp((h)->addr1, (wnb)->cfg->addr, 6)==0)
|
||||
#define RSSI_CHANGED(r1,r2) ((r1)>(r2)?((r1)-(r2)>8):((r2)-(r1)>8))
|
||||
#define EVM_CHANGED(r1,r2) ((r1)>(r2)?((r1)-(r2)>3):((r2)-(r1)>3))
|
||||
//#define WNB_IS_BCAST_ADDR(a) (((a)[0]&(a)[1]&(a)[2]&(a)[3]&(a)[4]&(a)[5]) == 0xff)
|
||||
//#define WNB_IS_MCAST_ADDR(a) ((a)[0]&0x01)
|
||||
//#define WNB_IS_ZERO_ADDR(a) (!((a)[0] | (a)[1] | (a)[2] | (a)[3] | (a)[4] | (a)[5]))
|
||||
#define WNB_PROTO(fc) (ieee80211_is_mgmt(fc) && ((fc) & 0x00f0) == IEEE80211_STYPE_WNB)
|
||||
//#define MAC_EQU(a1,a2) (os_memcmp((a1), (a2), 6)==0)
|
||||
#define WNB_TIM_SET(wnb, aid) ((wnb)->ps_data.tim[(aid) / 8] |= (1 << ((aid) % 8)))
|
||||
#define WNB_TIM_CLR(wnb, aid) ((wnb)->ps_data.tim[(aid) / 8] &= ~(1 << ((aid) % 8)))
|
||||
#define FROM_AP(wnb, hdr) (MAC_EQU((wnb)->stas[0].sta->addr, (hdr)->addr2))
|
||||
#define IS_MYAP(wnb, sta) (((wnb)->cfg->role == WNB_STA_ROLE_SLAVE||(wnb)->cfg->role == WNB_STA_ROLE_REPEATER) && (sta) == &(wnb)->stas[0])
|
||||
#define MY_SSID(wnb) (((wnb)->cfg->role == WNB_STA_ROLE_REPEATER)?(wnb)->cfg->r_ssid:(wnb)->cfg->ssid)
|
||||
#define MY_KEY(wnb) (((wnb)->cfg->role == WNB_STA_ROLE_REPEATER)?(wnb)->cfg->r_key:(wnb)->cfg->key)
|
||||
#define MY_ENC(wnb) (((wnb)->cfg->role == WNB_STA_ROLE_REPEATER)?(wnb)->cfg->r_encrypt:(wnb)->cfg->encrypt)
|
||||
#define IS_UPPER_AP(wnb, sta) (((wnb)->cfg->role == WNB_STA_ROLE_REPEATER) && (sta) == &(wnb)->stas[0])
|
||||
|
||||
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
||||
#define BITS_PER_BYTE (8)
|
||||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
||||
|
||||
#define WNB_NETLOG_PORT (64320)
|
||||
|
||||
enum wnb_frm_type {
|
||||
WNB_FRM_TYPE_ETHER = 0,
|
||||
WNB_FRM_TYPE_HGIC,
|
||||
WNB_FRM_TYPE_RAW,
|
||||
};
|
||||
|
||||
struct wnb_txq_param {
|
||||
uint8 aifsn : 4,
|
||||
acm : 1,
|
||||
aci : 2,
|
||||
reserved : 1;
|
||||
uint8 ecwmin : 4,
|
||||
ecwmax : 4;
|
||||
uint16 txop_limit;
|
||||
};
|
||||
|
||||
struct wnb_mgmt {
|
||||
uint8 type: 7, resp: 1;
|
||||
uint8 cookie;
|
||||
uint16 center_freq; // current center frequence
|
||||
};
|
||||
|
||||
struct wnb_mgmt_heartbeat {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 aid;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_pair {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 role;
|
||||
uint8 encrypt;
|
||||
uint8 key[32];
|
||||
uint8 dev_id[6];
|
||||
uint8 ssid[WNB_SSID_LEN];
|
||||
uint8 aid;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_assoc {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 aid;
|
||||
uint8 dev_id[6];
|
||||
uint8 auth[WNB_SSID_LEN];
|
||||
uint8 ps_mode: 3, roaming:1, newkey:1, p2: 3;
|
||||
uint8 ssid_set:1, rev:7;
|
||||
uint8 roam_bssid[6];
|
||||
uint8 ssid[WNB_SSID_LEN];
|
||||
};
|
||||
|
||||
struct wnb_mgmt_assoc_resp {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 aid;
|
||||
uint8 dev_id[6];
|
||||
uint8 assoc_status;
|
||||
uint16 bss_max_idle;
|
||||
uint8 wk_reason;
|
||||
uint8 repeater:1, newkey:1, rev:6;
|
||||
uint8 p1, p2, p3, p4;
|
||||
uint8 key[32];
|
||||
uint16 repeater_level;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_config {
|
||||
struct wnb_mgmt hdr;
|
||||
uint16 type, len;
|
||||
};
|
||||
|
||||
enum wnb_mgmt_configtype{
|
||||
WNB_MGMT_CONFIGTYPE_FREQINFO = 1,
|
||||
WNB_MGMT_CONFIGTYPE_RESET,
|
||||
WNB_MGMT_CONFIGTYPE_PSALIVE_CONFIG,
|
||||
};
|
||||
|
||||
struct wnb_mgmt_probe_req {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 ssid[WNB_SSID_LEN];
|
||||
};
|
||||
|
||||
struct wnb_mgmt_probe_resp {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 ssid[WNB_SSID_LEN];
|
||||
uint8 encrypt: 1;
|
||||
uint16 repeter;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_disassoc {
|
||||
struct wnb_mgmt hdr;
|
||||
uint16 flags;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_roaming {
|
||||
struct wnb_mgmt hdr;
|
||||
uint8 request:1, pad:7;
|
||||
};
|
||||
|
||||
struct wnb_bss_info {
|
||||
struct list_head list;
|
||||
uint8 ssid[WNB_SSID_LEN + 2];
|
||||
uint8 bssid[6];
|
||||
uint8 encrypt: 1, assoc: 1;
|
||||
int8 signal;
|
||||
uint16 freq, repeater;
|
||||
uint32 lifetime;
|
||||
};
|
||||
|
||||
|
||||
#define WNB_DISASSOC_FLAGS_UNPAIR BIT(0)
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/* WNB module defines */
|
||||
#define WNB_EVTQ_SIZE (32)
|
||||
#define WNB_NAT_COUNT (256)
|
||||
#define WNB_CHAN_COUNT (16)
|
||||
#define WNB_PAIR_DELAY (50)
|
||||
#define WNB_PAIR_TRY (4)
|
||||
#define WNB_CONN_DELAY (20)
|
||||
#define WNB_HEART_INT (500)
|
||||
#define WNB_CON_CHAN_TRY (2)
|
||||
#define WNB_SCAN_DELAY (20)
|
||||
#define WNB_SCAN_TRY (2)
|
||||
#define WNB_BSS_MAX (32)
|
||||
#define WNB_PS_BC_SIZE (4)
|
||||
#define WNB_PS_DATA_SIZE (2)
|
||||
#define WNB_MAX_IDLE_TU (30*1000) // units: 1.024ms
|
||||
|
||||
#define wnb_dbg(fmt, ...) //os_printf(fmt, ##__VA_ARGS__)
|
||||
#define wnb_err(fmt, ...) os_printf(fmt, ##__VA_ARGS__)
|
||||
|
||||
typedef enum{
|
||||
WNB_FORWARD_TYPE_NONE,
|
||||
WNB_FORWARD_TYPE_2LOCAL,
|
||||
WNB_FORWARD_TYPE_2UPPER,
|
||||
}wnb_forward_type;
|
||||
|
||||
typedef enum {
|
||||
WNB_EVENT_SEND_BEACON = 1,
|
||||
WNB_EVENT_HEARTBEAT,
|
||||
WNB_EVENT_PAIR_START,
|
||||
WNB_EVENT_PAIR_SUCCESS,
|
||||
WNB_EVENT_PAIR_FAIL,
|
||||
WNB_EVENT_PAIR_DONE,
|
||||
WNB_EVENT_CONNECT_START,
|
||||
WNB_EVENT_CONNECTED,
|
||||
WNB_EVENT_DISCONNECTED,
|
||||
WNB_EVENT_RX_DATA,
|
||||
WNB_EVENT_RSSI,
|
||||
WNB_EVENT_SCAN_START,
|
||||
WNB_EVENT_SCAN_DONE,
|
||||
WNB_EVENT_EVM,
|
||||
WNB_EVENT_DHCPC_REQ,
|
||||
WNB_EVENT_DHCPC_DONE,
|
||||
WNB_EVENT_CONNECT_FAIL,
|
||||
} wnb_event;
|
||||
|
||||
typedef enum {
|
||||
WNB_STATE_IDLE,
|
||||
WNB_STATE_PAIR_START,
|
||||
WNB_STATE_PAIRING,
|
||||
WNB_STATE_PAIR_DONE,
|
||||
WNB_STATE_CONNECT_START,
|
||||
WNB_STATE_CONNECTING,
|
||||
WNB_STATE_CONNECTED,
|
||||
WNB_STATE_DISCONNECT,
|
||||
WNB_STATE_SCAN_START,
|
||||
WNB_STATE_SCANNING,
|
||||
WNB_STATE_SCAN_DONE,
|
||||
WNB_STATE_WAITING_AP,
|
||||
} wnb_state;
|
||||
|
||||
typedef enum {
|
||||
WNB_STA_ROLE_SLAVE,
|
||||
WNB_STA_ROLE_MASTER,
|
||||
WNB_STA_ROLE_GPMEMB,
|
||||
WNB_STA_ROLE_REPEATER,
|
||||
|
||||
WNB_STA_ROLE_MAX,
|
||||
} wnb_sta_role;
|
||||
|
||||
typedef enum {
|
||||
WNB_ASSOC_SUCCESS = 0,
|
||||
WNB_ASSOC_REFUSED = 1,
|
||||
WNB_ASSOC_DENIED_NO_MORE_STAS = 17,
|
||||
WNB_ASSOC_DENIED_INSUFFICIENT_BANDWIDTH = 33,
|
||||
WNB_ASSOC_REFUSED_AP_OUT_OF_MEMORY = 93,
|
||||
WNB_ASSOC_NO_AP = 0xff,
|
||||
} wnb_assoc_status;
|
||||
|
||||
typedef void (*wnb_event_cb)(wnb_event evt, uint32 param1, uint32 param2);
|
||||
|
||||
/*saved into flash*/
|
||||
struct wnb_sta_info {
|
||||
uint16 paired : 1,
|
||||
encrypt : 1;
|
||||
uint8 addr[6];
|
||||
uint8 key[32];
|
||||
};
|
||||
|
||||
struct wnb_psalive_config{
|
||||
|
||||
uint16 wkdata_off;
|
||||
uint16 wkdata_save:1;
|
||||
uint8 wkdata_mask[16];
|
||||
};
|
||||
|
||||
struct wnb_sta_psalive {
|
||||
uint32 ipaddr;
|
||||
uint16 port;
|
||||
uint8 hb_period, hb_timeout;
|
||||
uint8 *heartbeat;
|
||||
uint8 *heartbeat_resp;
|
||||
uint8 *wakeup_data;
|
||||
int16 expired;
|
||||
uint16 heartbeat_len, heartbeat_resp_len, wakeup_data_len;
|
||||
uint8 heartbeat_lost, rev;
|
||||
struct wnb_psalive_config config;
|
||||
};
|
||||
|
||||
/*needn't save*/
|
||||
struct wnb_sta {
|
||||
void *wnb;
|
||||
struct wnb_sta_info *sta;
|
||||
uint8 id, aid;
|
||||
uint16 connected : 1,
|
||||
ps : 1,
|
||||
ps_poll : 1,
|
||||
ps_mode : 3,
|
||||
m2ucast : 1,
|
||||
roam_out : 2,
|
||||
roam_in : 1,
|
||||
rnd_key : 1;
|
||||
uint32 last_rx;
|
||||
uint32 last_tx;
|
||||
uint32 roam_jiff;
|
||||
int8 rssi, evm, wk_reason, rev;
|
||||
uint32 ipaddr;
|
||||
uint16 rxseq_head[4];
|
||||
uint64 rxseq_bit[4];
|
||||
uint16 tx_seqno[4];
|
||||
struct skb_list psdata;
|
||||
struct skb_list ps_etherdata;
|
||||
struct wnb_sta_psalive psalive;
|
||||
uint8 roaming_bssid[6];
|
||||
uint8 roaming_notify;
|
||||
uint8 key[32];
|
||||
};
|
||||
|
||||
struct wnb_route_entry {
|
||||
struct list_head list;
|
||||
struct wnb_sta *sta;
|
||||
uint32 lifetime;
|
||||
uint8 addr[6];
|
||||
};
|
||||
|
||||
struct wnb_route_table {
|
||||
os_mutex_t lock;
|
||||
struct list_head list[16];
|
||||
uint32 count;
|
||||
};
|
||||
|
||||
#define WNB_WKUPHOST_REASONS (32)
|
||||
struct wnb_config {
|
||||
uint8 role;
|
||||
uint8 bss_bw;
|
||||
uint8 encrypt: 1, forward: 1, key_set: 1, mkey_set: 1, join_group: 1, bssid_set: 1, mcast_filter: 1, reassoc_wkhost: 1;
|
||||
uint8 chan_cnt;
|
||||
|
||||
uint16 freq_start, freq_end;
|
||||
uint16 chan_list[WNB_CHAN_COUNT];
|
||||
uint8 ssid[WNB_SSID_LEN];
|
||||
uint8 key[32];
|
||||
|
||||
uint8 addr[6];
|
||||
uint8 max_sta;
|
||||
uint8 tx_mcs;
|
||||
|
||||
uint8 acs_enable;
|
||||
uint8 acs_tmo;
|
||||
uint8 tx_bw;
|
||||
uint8 tx_power: 5, pri_chan: 3;
|
||||
|
||||
uint8 mcast_key[32];
|
||||
|
||||
uint8 psconnect_period, psconnect_roundup;
|
||||
uint8 last_chan, repeater_level;
|
||||
|
||||
uint16 wkio_mode: 1, psmode: 3, auto_chsw: 1, auto_role: 1, roaming: 1,
|
||||
dupfilter: 1, pa_pwrctrl_dis: 1, pair_autostop: 1, supper_pwr_dis: 1,
|
||||
r_encrypt: 1, not_auto_save: 1, dcdc13: 1, auto_pair:1, dhcpc_en:1;
|
||||
uint16 bss_max_idle;
|
||||
|
||||
uint16 beacon_int, dtim_period;
|
||||
|
||||
uint8 group_aid, agg_cnt, wkup_io, wkio_edge;
|
||||
|
||||
uint16 aplost_time, auto_sleep_time;
|
||||
|
||||
uint16 heartbeat_int, ack_tmo;
|
||||
|
||||
int8 roam_rssi_th;
|
||||
uint8 roam_int, max_txcnt, rev4;
|
||||
|
||||
uint8 r_ssid[WNB_SSID_LEN];
|
||||
uint8 r_key[32];
|
||||
uint8 dhcpc_hostname[32];
|
||||
|
||||
uint8 mcast_txmcs, mcast_txbw, mcast_clearch, mcast_dupcnt;
|
||||
|
||||
uint32 dhcpc_update_hbdata:1, wkhost_reasons_set:1, dual_ant:1,ant_auto_dis:1,
|
||||
ant_sel:1, mac_filter_en:1, roaming_samefreq:1, ap_hide:1, ap_psmode:1,
|
||||
dis_1v1_m2u:1, psconnect_dis:1, kick_assoc:1;
|
||||
uint8 wkhost_reasons[WNB_WKUPHOST_REASONS];
|
||||
|
||||
//################################################################
|
||||
uint8 reserve[256]; /*must reduce this array after add new fields */
|
||||
struct wnb_sta_info stas[WNB_STA_COUNT]; /*keep at bottom*/
|
||||
};
|
||||
|
||||
struct wnb_statistic {
|
||||
uint32 tot_tx, tot_rx, tot_fw, if_recv, if_write, rx_hook, tx_hook;
|
||||
uint32 tx_err, rx_err, if_err, fw_err, rx_drop, no_mem, tx_drop, filter;
|
||||
};
|
||||
|
||||
struct wnb_rx_info {
|
||||
struct wnb_sta *sta;
|
||||
uint8 *data;
|
||||
uint16 len;
|
||||
uint16 fromDS: 1, resv: 15;
|
||||
};
|
||||
|
||||
#define WNB_MAX_TIM_LEN (32)
|
||||
|
||||
struct wnb_ps_data {
|
||||
/* yes, this looks ugly, but guarantees that we can later use bitmap_empty :)
|
||||
* NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
|
||||
uint8 tim[WNB_MAX_TIM_LEN];
|
||||
struct skb_list bc_buf;
|
||||
uint8 num_sta_ps; /* number of stations in PS mode */
|
||||
int32 dtim_count;
|
||||
uint8 dtim_bc_mc;
|
||||
};
|
||||
|
||||
struct wnb_init_param {
|
||||
uint8 if_type;
|
||||
uint8 frm_type;
|
||||
uint8 hook_cnt;
|
||||
struct lmac_ops *ops;
|
||||
struct wnb_config *cfg;
|
||||
wnb_event_cb cb;
|
||||
};
|
||||
|
||||
struct wnb_mgmt_tx {
|
||||
uint8 *dest;
|
||||
uint16 len;
|
||||
uint16 flags;
|
||||
struct wnb_mgmt *mgmt;
|
||||
struct hgic_tx_info *txinfo;
|
||||
};
|
||||
|
||||
struct wnb_udp_data{
|
||||
uint8 *dest;
|
||||
uint32 dest_ip, dest_port;
|
||||
uint32 src_ip, src_port;
|
||||
uint8 *data;
|
||||
uint32 len;
|
||||
};
|
||||
|
||||
struct wireless_nb;
|
||||
typedef int32(*wnb_pkt_tx_hdl)(struct wireless_nb *wnb, struct sk_buff *skb);
|
||||
typedef int32(*wnb_pkt_rx_hdl)(struct wireless_nb *wnb, struct wnb_rx_info *rxinfo);
|
||||
struct wnb_pkt_hook {
|
||||
const char *name;
|
||||
uint16 protocol;
|
||||
wnb_pkt_tx_hdl tx;
|
||||
wnb_pkt_rx_hdl rx;
|
||||
};
|
||||
|
||||
typedef enum{
|
||||
WNB_ROAM_IDLE,
|
||||
WNB_ROAM_CHECK_RSSI,
|
||||
WNB_ROAM_REQUEST_BGSCAN,
|
||||
WNB_ROAM_REQUEST_ROAMING,
|
||||
WNB_ROAM_REQUEST_CANCLE,
|
||||
WNB_ROAM_DO_BGSCAN,
|
||||
WNB_ROAM_DO_ROAMING,
|
||||
}WNB_ROAM_STATE;
|
||||
|
||||
/* WNB sub modules */
|
||||
struct wnb_module_roam {
|
||||
WNB_ROAM_STATE state;
|
||||
uint8 request;
|
||||
uint8 check;
|
||||
int16 rssi;
|
||||
int8 rssi_avg;
|
||||
uint8 bssid[6];
|
||||
uint8 ssid[32];
|
||||
struct wnb_bss_info *newbss;
|
||||
void (*check_roaming)(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
void (*check_scan_result)(struct wireless_nb *wnb);
|
||||
int32(*forward_data)(struct wireless_nb *wnb, struct wnb_sta *sta, struct sk_buff *skb);
|
||||
int32(*cache_data)(struct wireless_nb *wnb, struct sk_buff *skb);
|
||||
void(*roam_in)(struct wireless_nb *wnb, struct wnb_sta *sta, uint8 notify, uint8 *roam_bssid);
|
||||
void(*proc_mgmt)(struct wireless_nb * wnb, uint8 * data, int32 len);
|
||||
};
|
||||
|
||||
struct wnb_module_ota {
|
||||
void (*proc_data)(struct wireless_nb *wnb);
|
||||
};
|
||||
|
||||
enum WNB_PSALIVE_ACTION{
|
||||
WNB_PSALIVE_ACTION_DO_HEARBEAT,
|
||||
WNB_PSALIVE_ACTION_KEEP_HEARTBEAT,
|
||||
WNB_PSALIVE_ACTION_SEND_CONFIG,
|
||||
WNB_PSALIVE_ACTION_UPDATE_HBDATA,
|
||||
};
|
||||
struct wnb_module_psalive {
|
||||
os_timer_t timer;
|
||||
void (*do_action)(struct wireless_nb *wnb, int32 action);
|
||||
void (*proc_mgmt)(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void (*start_sta)(struct wireless_nb *wnb, struct wnb_sta *sta, uint8 start);
|
||||
};
|
||||
|
||||
struct wnb_module_netlog {
|
||||
uint8 addr[6], cookie[6];
|
||||
uint32 ip;
|
||||
uint32 time;
|
||||
uint16 port;
|
||||
};
|
||||
|
||||
struct wnb_module_netat {
|
||||
uint8 dest[6];
|
||||
};
|
||||
|
||||
struct wnb_module_dhcpc {
|
||||
uint32 transID, leasetime;
|
||||
uint8 svraddr[6], state;
|
||||
os_timer_t timer;
|
||||
struct {
|
||||
uint32 ipaddr, netmask, svrip, router, dns1, dns2;
|
||||
} result;
|
||||
void (*reset)(struct wireless_nb *wnb);
|
||||
void (*request_ip)(struct wireless_nb *wnb);
|
||||
};
|
||||
|
||||
struct wnb_module_atcmd {
|
||||
struct{
|
||||
int32 count;
|
||||
struct hgic_tx_info txinfo;
|
||||
}txdata_arg;
|
||||
};
|
||||
|
||||
struct wnb_module_drivercmd {
|
||||
void (*proc_cmd)(struct wireless_nb *wnb);
|
||||
void (*report_txwnd)(struct wireless_nb *wnb);
|
||||
};
|
||||
|
||||
struct wnb_module_arp {
|
||||
void (*send_reply)(struct wireless_nb *wnb);
|
||||
};
|
||||
|
||||
struct wireless_nb {
|
||||
wnb_state state;
|
||||
struct wnb_config *cfg;
|
||||
struct wnb_sta *stas;
|
||||
os_mutex_t lock;
|
||||
os_semaphore_t sema;
|
||||
os_semaphore_t sm_sema;
|
||||
os_semaphore_t cfgsema;
|
||||
os_task_t task;
|
||||
os_task_t sm_task;
|
||||
os_timer_t dly_run;
|
||||
os_timer_t heart_tm;
|
||||
os_timer_t beacon_tm;
|
||||
struct skb_list datalist;
|
||||
struct skb_list cstlist;
|
||||
struct skb_list f2upper;
|
||||
struct skb_list f2local;
|
||||
struct skb_list cmd_list;
|
||||
struct skb_list otalist;
|
||||
struct skb_list loglist;
|
||||
struct skb_list wkdata_list;
|
||||
|
||||
struct list_head bss_list;
|
||||
os_mutex_t bss_lock;
|
||||
uint8 bss_cnt;
|
||||
uint8 waiting_ap;
|
||||
|
||||
RBUFFER_DEF(evtq, uint8, WNB_EVTQ_SIZE);
|
||||
struct mac_bus *bus;
|
||||
struct lmac_ops *ops;
|
||||
struct wnb_route_table rt_table;
|
||||
struct wnb_route_table lp_table;
|
||||
struct wnb_pkt_hook **hooks;
|
||||
wnb_event_cb cb;
|
||||
|
||||
struct wnb_ps_data ps_data;
|
||||
struct dsleep_psdata *psalive_data;
|
||||
|
||||
uint16 chan_list[WNB_CHAN_COUNT];
|
||||
uint8 chan_cnt, start_chan, chan_idx;
|
||||
int8 chan_try;
|
||||
|
||||
uint8 assoc_result;
|
||||
uint8 hooks_cnt;
|
||||
uint8 sta_num;
|
||||
uint16 repeater_level;
|
||||
|
||||
uint8 mgmt_cookie, last_cookie;
|
||||
uint16 bus_txcookie;
|
||||
uint16 bus_rxcookie;
|
||||
|
||||
uint16 curr_freq;
|
||||
uint16 tx_seqno;
|
||||
uint16 ap_freq;
|
||||
|
||||
uint8 frm_type;
|
||||
uint8 my_aid;
|
||||
uint8 heartbeat_lost;
|
||||
int8 rssi, rssi_notify, evm;
|
||||
uint8 change_sequence, edca_update_cnt;
|
||||
|
||||
uint8 conn_fail;
|
||||
uint16 conn_delay, pair_delay, scan_delay;
|
||||
|
||||
uint16 ether_type;
|
||||
uint8 ps_hb_set: 1, ps_hbresp_set: 1, ps_wkdata_set: 1, ps_config_set:1, sleep_try: 3, detect_ap: 1;
|
||||
uint8 host_alive, wk_reason;
|
||||
|
||||
/*flags*/
|
||||
uint32 need_save: 1,
|
||||
ps: 1,
|
||||
fix_freq: 1,
|
||||
closed: 1,
|
||||
testmode: 1,
|
||||
mcast_copy: 1,
|
||||
mcu_func: 1,
|
||||
bg_scan: 1,
|
||||
repeater_en:1,
|
||||
req_txwnd:1;
|
||||
|
||||
struct {
|
||||
uint8 role_changed:1, keygen:1, resp_rx:1, resp_tx:1;
|
||||
uint8 key[32];
|
||||
uint32 start_jif;
|
||||
struct wnb_sta *sta;
|
||||
} pairing;
|
||||
struct {
|
||||
uint8 addr[6];
|
||||
uint8 assoc_status;
|
||||
uint8 req_param: 1, req_param_dis: 1, req_param_cnt: 6;
|
||||
} report;
|
||||
|
||||
uint32 last_rx, last_tx, last_ps;
|
||||
struct wnb_statistic statistic;
|
||||
|
||||
struct wnb_module_roam roaming;
|
||||
struct wnb_module_ota ota;
|
||||
struct wnb_module_netlog netlog;
|
||||
struct wnb_module_netat netat;
|
||||
struct wnb_module_dhcpc dhcpc;
|
||||
struct wnb_module_atcmd atcmd;
|
||||
struct wnb_module_drivercmd drivercmd;
|
||||
struct wnb_module_arp arp;
|
||||
struct wnb_module_psalive psalive;
|
||||
};
|
||||
|
||||
|
||||
#define WNB_SMRUN(wnb) os_sema_up(&wnb->sm_sema)
|
||||
#define WNB_SMRUN_DELAY(wnb, tmo) os_timer_start(&wnb->dly_run, tmo)
|
||||
#define WNB_RUN(wnb) os_sema_up(&wnb->sema)
|
||||
#define WNB_EVENT(wnb, evt) do{RB_SET(&wnb->evtq, (uint8)evt); WNB_RUN(wnb);}while(0)
|
||||
#define WNB_CB(evt,p1,p2) if(wnb->cb){ wnb->cb(evt, (uint32)(p1), (uint32)(p2));}
|
||||
#define WNB_IS_REQ(hdr) (!((hdr)->resp)) /*wnb request packet*/
|
||||
#define WNB_IS_RESP(hdr) ((hdr)->resp) /*wnb response packet*/
|
||||
#define WNB_NEXT_CH(wnb, ch) (((ch)+1>=(wnb)->chan_cnt)?(0):((ch)+1))
|
||||
#define WNB_VALID_BW(bw) ((bw)==1||(bw)==2||(bw)==4||(bw)==8)
|
||||
#define WNB_VALID_FREQ(f) ((f)>=7300&&(f)<=9300)
|
||||
#define WNB_VALID_MCS(m) (((m)>=0 && (m)<=7)||((m)==10))
|
||||
#define WNB_PSDATA_SET2AP(wnb) (wnb->ps_hb_set && wnb->ps_hbresp_set && wnb->ps_wkdata_set && wnb->ps_config_set)
|
||||
|
||||
extern const uint8 wnb_bcast_addr[6];
|
||||
extern const struct wnb_txq_param wnb_edca_params[5][4];
|
||||
extern uint8 ieee80211_is_data_qos(uint16 frame_control);
|
||||
|
||||
int32 wnb_init(struct wnb_init_param *param);
|
||||
void wnb_open(void);
|
||||
void wnb_close(void);
|
||||
void wnb_clear(void);
|
||||
int32 wnb_cfg_save(void);
|
||||
|
||||
void wnb_role(struct wireless_nb *wnb, wnb_sta_role role);
|
||||
int32 wnb_join_group(struct wireless_nb *wnb, uint8 *group_addr, uint8 aid);
|
||||
int32 wnb_send_customer_data(struct hgic_tx_info *txinfo, uint8 *dest, uint8 *data, int32 len);
|
||||
int32 wnb_send_ether_data(struct hgic_tx_info *txinfo, uint8 *data, int32 len);
|
||||
void wnb_tx_data(struct wireless_nb *wnb, struct sk_buff *skb, wnb_forward_type forward);
|
||||
int32 wnb_save_cfg(struct wnb_config *cfg, uint8 force);
|
||||
void wnb_setup_chan_list(struct wireless_nb *wnb);
|
||||
int32 wnb_freq_to_ch(struct wireless_nb *wnb, uint32 freq);
|
||||
uint32 wnb_customer_id(void);
|
||||
int32 wnb_dev_identify(struct wireless_nb *wnb, uint8 *id);
|
||||
int32 wnb_is_loopback_data(struct wireless_nb *wnb, struct wnb_rx_info *rxinfo);
|
||||
int32 wnb_ether_filter(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void wnb_set_edca_param(struct wireless_nb *wnb, struct wnb_txq_param *param);
|
||||
int32 wnb_macbus_send_data(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
|
||||
|
||||
int32 wnb_send_mgmt(struct wireless_nb *wnb, struct wnb_mgmt_tx *tx);
|
||||
uint8 wnb_cookie(struct wireless_nb *wnb);
|
||||
uint16 wnb_seqno(struct wireless_nb *wnb, struct wnb_sta *sta, uint8 ac);
|
||||
int32 wnb_host_notify(void *priv, uint8 event_id, uint8 *args, int32 len);
|
||||
void wnb_role_changed(struct wireless_nb *wnb);
|
||||
struct wnb_sta *wnb_get_sta(struct wireless_nb *wnb, uint8 *addr);
|
||||
struct wnb_sta *wnb_new_sta(struct wireless_nb *wnb);
|
||||
void wnb_del_sta(struct wireless_nb *wnb, struct wnb_sta *sta);
|
||||
int32 wnb_get_qos_flags(struct sk_buff *skb, uint8 qos[2]);
|
||||
void wnb_new_state(struct wireless_nb *wnb, uint8 new_state);
|
||||
void wnb_statistic_print(void);
|
||||
void wnb_load_factparam(struct wnb_config *wnbcfg);
|
||||
void wnb_sta_init(struct wireless_nb *wnb);
|
||||
|
||||
void wnb_connect(int32 start);
|
||||
void wnb_send_assoc_req(struct wireless_nb *wnb);
|
||||
void wnb_send_disassoc(struct wireless_nb *wnb, uint8 *dest, uint16 flags);
|
||||
void wnb_rx_assoc(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void wnb_rx_disassoc(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void wnb_send_beacon(struct wireless_nb *wnb);
|
||||
void wnb_send_heartbeat(struct wireless_nb *wnb, uint8 *dest);
|
||||
void wnb_rx_heartbeat(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
int32 wnb_rx_beacon(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
void wnb_delay_next_conn(struct wireless_nb *wnb);
|
||||
|
||||
void wnb_pairing(int32 start);
|
||||
void wnb_rx_pair(struct wireless_nb *wnb, uint8 *data, int len);
|
||||
void wnb_pairing_hello(struct wireless_nb *wnb);
|
||||
void wnb_rx_config(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void wnb_pair_role_changed(struct wireless_nb *wnb);
|
||||
void wnb_host_event_pair_done(struct wireless_nb *wnb);
|
||||
void wnb_pairing_prepare(struct wireless_nb *wnb);
|
||||
|
||||
void wnb_route_init(struct wireless_nb *wnb);
|
||||
void wnb_route_update(struct wireless_nb *wnb, uint8 *dest, struct wnb_sta *sta);
|
||||
struct wnb_sta *wnb_route(struct wireless_nb *wnb, uint8 *dest);
|
||||
int32 wnb_srcrt_check(struct wireless_nb *wnb, uint8 *src);
|
||||
void wnb_lptable_update(struct wireless_nb *wnb, uint8 *dest, uint8 *src);
|
||||
void wnb_route_del(struct wnb_route_table *rt, uint8 *addr);
|
||||
void wnb_route_print(struct wnb_route_table *rt);
|
||||
|
||||
void wnb_scan(struct wireless_nb *wnb, int32 start);
|
||||
int32 wnb_get_scan_result(struct wireless_nb *wnb, struct sk_buff *skb);
|
||||
int32 wnb_rx_probe_reponse(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
int32 wnb_rx_probe_request(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
int32 wnb_tx_probe_request(struct wireless_nb *wnb, uint8 *ssid);
|
||||
void wnb_bss_flush(struct wireless_nb *wnb);
|
||||
int32 wnb_bss_info_update(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
void wnb_bss_info_update_from_beacon(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
struct wnb_bss_info *wnb_roam(struct wireless_nb *wnb, uint8 flags);
|
||||
uint8 *wnb_get_element(uint8 *ie, int32 ie_len, uint8 id);
|
||||
|
||||
|
||||
int32 wnb_rx(void *priv, struct hgic_rx_info *rxinfo, uint8 *data, int32 len);
|
||||
int32 wnb_proc_data_rx_hooks(struct wireless_nb *wnb, struct wnb_rx_info *rxinfo);
|
||||
int32 wnb_proc_data_tx_hooks(struct wireless_nb *wnb, struct sk_buff *skb);
|
||||
|
||||
void wnb_sta_ps_end(struct wireless_nb *wnb, struct wnb_sta *sta);
|
||||
void wnb_sta_ps_start(struct wireless_nb *wnb, struct wnb_sta *sta);
|
||||
void wnb_free_psdata(struct wireless_nb *wnb, struct wnb_sta *sta);
|
||||
void wnb_ps_init(struct wireless_nb *wnb);
|
||||
void wnb_ps_mode(struct wireless_nb *wnb, uint32 start, uint32 time);
|
||||
int32 wnb_get_sta_list(struct wireless_nb *wnb, struct sk_buff *skb);
|
||||
|
||||
int32 wnb_lptable_check(struct wireless_nb *wnb, uint8 *src);
|
||||
void wnb_reset_beatheart(struct wireless_nb *wnb);
|
||||
|
||||
void wnb_disassoc_all(struct wireless_nb *wnb);
|
||||
void wnb_request_parameter(struct wireless_nb *wnb);
|
||||
int32 wnb_wakeup_sta(struct wireless_nb *wnb, uint8 *addr);
|
||||
int8 wnb_get_sta_signal(struct wireless_nb *wnb, int32 index, uint8 *addr);
|
||||
void wnb_send_nullfunc(struct wireless_nb *wnb, struct wnb_sta *sta, int32 ps);
|
||||
void wnb_send_pspoll_response(struct wireless_nb *wnb);
|
||||
|
||||
struct wnb_sta *wnb_get_sta_ip(struct wireless_nb *wnb, uint32 ipaddr);
|
||||
|
||||
void wnb_ps_check_autosleep(struct wireless_nb *wnb);
|
||||
void wnb_ps_ap_alive(struct wireless_nb *wnb);
|
||||
void wnb_ps_wakeup_host(struct wireless_nb *wnb);
|
||||
void wnb_ps_exit(struct wireless_nb *wnb, uint8 wk_reason);
|
||||
void wnb_ps_check_wkreason(struct wireless_nb *wnb, uint8 wk_reason);
|
||||
|
||||
void wnb_opendev(struct wireless_nb *wnb);
|
||||
void wnb_closedev(struct wireless_nb *wnb);
|
||||
void wnb_init_lmac(struct wireless_nb *wnb);
|
||||
int8 wnb_freq_type_match(uint8 ah_module_type, uint32 freq);
|
||||
int32 wnb_rx_battery_soc(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
int32 mcu_battery_soc_request(struct wireless_nb *wnb);
|
||||
|
||||
uint16 wnb_checksum(uint16 initcksum, uint8 *ptr, int32 len);
|
||||
void wnb_connect_start(struct wireless_nb *wnb);
|
||||
void wnb_send_data_upper_ap(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
void wnb_check_ps_connect(struct wireless_nb *wnb);
|
||||
int32 wnb_backgroud_scan(struct wireless_nb *wnb);
|
||||
void wnb_start_bgscan(struct wireless_nb *wnb);
|
||||
void wnb_scan_channel(struct wireless_nb *wnb);
|
||||
void wnb_ps_set_ssid(struct wireless_nb *wnb);
|
||||
void wnb_ps_get_ssid(struct wireless_nb *wnb);
|
||||
void wnb_random(uint8 *key, int32 len);
|
||||
void wnb_auto_pair_check(struct wireless_nb *wnb, int start);
|
||||
void wnb_scan_dump(struct wireless_nb *wnb);
|
||||
int32 customer_driver_data_send(uint8 *data, uint32 len);
|
||||
int32 wnb_config_send_data(struct wireless_nb *wnb, uint8 *dest, uint16 type, uint8 *data, int32 len);
|
||||
void wnb_config_send(struct wireless_nb *wnb);
|
||||
void wnb_rx_mgmt_config(struct wireless_nb *wnb, uint8 *data, int32 len);
|
||||
int32 wnb_set_key(struct wireless_nb *wnb, uint8 cmd, uint8 *addr, uint8 *key, uint8 swap);
|
||||
int32 wnb_unpair_sta(struct wireless_nb *wnb, uint8 *addr);
|
||||
int32 wnb_register_hook(struct wnb_pkt_hook *hook);
|
||||
int32 wnb_ssid_match(struct wireless_nb * wnb, uint8 *ssid, uint8 ssid_len);
|
||||
|
||||
void wnb_config_send_psaliveconfig(struct wireless_nb *wnb);
|
||||
void wnb_check_request_params(struct wireless_nb *wnb);
|
||||
void wnb_request_params_en(struct wireless_nb *wnb, int32 en);
|
||||
void wnb_encrypt(uint8 *key, uint8 *in, uint8 *out, uint32 len, uint8 en);
|
||||
|
||||
void wnb_module_drivercmd_init(void);
|
||||
void wnb_module_psalive_init(void);
|
||||
void wnb_module_ota_init(void);
|
||||
void wnb_module_dhcpc_init(void);
|
||||
void wnb_module_netlog_init(void);
|
||||
void wnb_module_arp_init(void);
|
||||
void wnb_module_roam_init(void);
|
||||
void wnb_module_netat_init(void);
|
||||
void wnb_module_atcmd_init(void);
|
||||
|
||||
static inline void wnb_roaming_check(struct wireless_nb *wnb, struct hgic_rx_info *rxinfo, uint8 *data, int32 len)
|
||||
{
|
||||
if(wnb->roaming.check_roaming) wnb->roaming.check_roaming(wnb, rxinfo, data, len);
|
||||
}
|
||||
static inline void wnb_roaming_check_scan_result(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->roaming.check_scan_result) wnb->roaming.check_scan_result(wnb);
|
||||
}
|
||||
static inline void wnb_notify_sta_roam_in(struct wireless_nb *wnb, struct wnb_sta *sta, uint8 notify, uint8 *roam_bssid)
|
||||
{
|
||||
if(wnb->roaming.roam_in) wnb->roaming.roam_in(wnb, sta, notify, roam_bssid);
|
||||
}
|
||||
static inline int32 wnb_roaming_forward(struct wireless_nb *wnb, struct wnb_sta *sta, struct sk_buff *skb)
|
||||
{
|
||||
if(wnb->roaming.forward_data)
|
||||
return wnb->roaming.forward_data(wnb, sta, skb);
|
||||
return 0;
|
||||
}
|
||||
static inline void wnb_rx_roaming_frame(struct wireless_nb * wnb, uint8 * data, int32 len)
|
||||
{
|
||||
if(wnb->roaming.proc_mgmt) wnb->roaming.proc_mgmt(wnb, data, len);
|
||||
}
|
||||
static inline int32 wnb_roaming_cache_data(struct wireless_nb *wnb, struct sk_buff *skb)
|
||||
{
|
||||
if(wnb->roaming.cache_data)
|
||||
return wnb->roaming.cache_data(wnb, skb);
|
||||
return 0;
|
||||
}
|
||||
static inline void wnb_psalive_action(struct wireless_nb *wnb, int32 action)
|
||||
{
|
||||
if(wnb->psalive.do_action) wnb->psalive.do_action(wnb, action);
|
||||
}
|
||||
static inline void wnb_psalive_start(struct wireless_nb *wnb, struct wnb_sta *sta, uint8 start)
|
||||
{
|
||||
if(wnb->psalive.start_sta) wnb->psalive.start_sta(wnb, sta, start);
|
||||
}
|
||||
static inline void wnb_rx_psalive_frame(struct wireless_nb *wnb, uint8 *data, int32 len)
|
||||
{
|
||||
if(wnb->psalive.proc_mgmt) wnb->psalive.proc_mgmt(wnb, data, len);
|
||||
}
|
||||
static inline void wnb_dhcpc_reset(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->dhcpc.reset) wnb->dhcpc.reset(wnb);
|
||||
}
|
||||
static inline void wnb_dhcpc_request_ip(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->dhcpc.request_ip) wnb->dhcpc.request_ip(wnb);
|
||||
}
|
||||
static inline void wnb_proc_driver_cmd(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->drivercmd.proc_cmd) wnb->drivercmd.proc_cmd(wnb);
|
||||
}
|
||||
static inline void wnb_driver_cmd_report_txwnd(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->drivercmd.report_txwnd) wnb->drivercmd.report_txwnd(wnb);
|
||||
}
|
||||
static inline void wnb_send_arp_reply(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->arp.send_reply) wnb->arp.send_reply(wnb);
|
||||
}
|
||||
static inline void wnb_proc_ota_data(struct wireless_nb *wnb)
|
||||
{
|
||||
if(wnb->ota.proc_data) wnb->ota.proc_data(wnb);
|
||||
}
|
||||
|
||||
static inline char *WNB_ROLE_STR(int8 role)
|
||||
{
|
||||
switch (role) {
|
||||
case WNB_STA_ROLE_MASTER: return "ap";
|
||||
case WNB_STA_ROLE_SLAVE: return "sta";
|
||||
case WNB_STA_ROLE_GPMEMB: return "group";
|
||||
case WNB_STA_ROLE_REPEATER: return "apsta";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
65
sdk/include/lib/umac/umac.h
Normal file
65
sdk/include/lib/umac/umac.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef _HGIC_UMAC_H_
|
||||
#define _HGIC_UMAC_H_
|
||||
#include "lib/lmac/hgic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WPA_KEY_MGMT_PSK BIT(1)
|
||||
#define WPA_KEY_MGMT_NONE BIT(2)
|
||||
#define WPA_KEY_MGMT_SAE BIT(10)
|
||||
#define WPA_KEY_MGMT_OWE BIT(22)
|
||||
|
||||
#define UMAC_CHAN_CNT (16)
|
||||
|
||||
enum umac_ops_type {
|
||||
UMAC_OPS_HOST,
|
||||
UMAC_OPS_LOCAL,
|
||||
};
|
||||
|
||||
enum umac_ops_local_type {
|
||||
UMAC_OPS_LOCAL_TYPE_LWIP,
|
||||
UMAC_OPS_LOCAL_TYPE_GMAC,
|
||||
};
|
||||
|
||||
struct umac_ops {
|
||||
int type;
|
||||
void *priv;
|
||||
int (*recv_data)(struct umac_ops *ops, unsigned char *data, unsigned int len);
|
||||
};
|
||||
|
||||
struct umac_config {
|
||||
unsigned short freq_start, freq_end;
|
||||
unsigned short chan_list[UMAC_CHAN_CNT];
|
||||
unsigned char tx_bw, tx_mcs, acs, acs_tm, primary_chan, bgrssi, bss_bw, chan_cnt;
|
||||
unsigned char hg0[1024];
|
||||
unsigned char hg1[1024];
|
||||
};
|
||||
|
||||
extern struct umac_config *sys_get_umaccfg(void);
|
||||
extern int sys_save_umaccfg(struct umac_config *cfg);
|
||||
|
||||
extern int umac_init(void);
|
||||
extern int umac_config_read(const char *name, char *buff, int size);
|
||||
extern int umac_config_write(const char *name, char *buff, int size);
|
||||
|
||||
extern int32 umac_add_txw80x(void *ops);
|
||||
|
||||
|
||||
extern int wpas_init(void);
|
||||
extern int wpas_start(char *ifname);
|
||||
extern int wpas_stop(char *ifname);
|
||||
extern int wpas_cli(char *ifname, char *cmd, char *reply_buff, int reply_len);
|
||||
|
||||
extern int hapd_init(void);
|
||||
extern int hapd_start(char *ifname);
|
||||
extern int hapd_stop(char *ifname);
|
||||
extern int hapd_cli(char *ifname, char *cmd, char *reply_buff, int reply_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
174
sdk/include/lib/umac/wifi_cfg.h
Normal file
174
sdk/include/lib/umac/wifi_cfg.h
Normal file
@@ -0,0 +1,174 @@
|
||||
#ifndef _HGUC_WIFI_CFG_H_
|
||||
#define _HGUC_WIFI_CFG_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32 wificfg_save(int8 force);
|
||||
|
||||
void syscfg_dump(void);
|
||||
|
||||
void wificfg_set_mode(uint8 mode);
|
||||
|
||||
int32 wificfg_get_mode();
|
||||
|
||||
int32 wificfg_set_bss_bw(uint8 ifidx, uint8 bss_bw);
|
||||
|
||||
int32 wificfg_get_bss_bw(uint8 ifidx);
|
||||
|
||||
int32 wificfg_set_tx_mcs(uint8 tx_mcs);
|
||||
|
||||
int32 wificfg_set_channel(uint8 ifidx, uint8 channel);
|
||||
|
||||
int32 wificfg_set_chan_list(uint8 ifidx, uint16 *chan_list, uint8 chan_cnt);
|
||||
|
||||
int32 wificfg_set_macaddr(uint8 ifidx, uint8 *addr);
|
||||
|
||||
int32 wificfg_set_ssid(uint8 ifidx, uint8 *ssid);
|
||||
|
||||
int32 wificfg_set_bssid(uint8 ifidx, uint8 *bssid);
|
||||
|
||||
int32 wificfg_set_mcast_key(uint8 ifidx, uint8 *key);
|
||||
|
||||
int32 wificfg_set_wpa_psk(uint8 ifidx, uint8 *key);
|
||||
|
||||
int32 wificfg_get_psk(uint8 *key);
|
||||
|
||||
int32 wificfg_set_key_mgmt(uint8 ifidx, uint32 key_mgmt);
|
||||
|
||||
int32 wificfg_get_ssid(uint8 ifidx, uint8 ssid[32]);
|
||||
|
||||
int32 wificfg_get_bssid(uint8 ifidx, uint8 *bssid);
|
||||
|
||||
int32 wificfg_get_wpa_psk(uint8 ifidx, uint8 psk[32]);
|
||||
|
||||
int32 wificfg_get_chan_list(uint8 ifidx, uint16 *chan_list, uint8 chan_cnt);
|
||||
|
||||
int32 wificfg_set_acs(uint8 ifidx, uint8 acs, uint8 tmo);
|
||||
|
||||
int32 wificfg_set_pri_chan(uint8 pri_chan);
|
||||
|
||||
int32 wificfg_set_tx_power(uint8 txpower);
|
||||
|
||||
int32 wificfg_get_txpower(uint8 ifidx);
|
||||
|
||||
int32 wificfg_set_beacon_int(uint8 ifidx, uint32 beacon_int);
|
||||
|
||||
int32 wificfg_set_heartbeat_int(uint8 ifidx, uint32 heartbeat_int);
|
||||
|
||||
int32 wificfg_set_bss_maxidle(uint8 ifidx, uint32 max_idle);
|
||||
|
||||
int32 wificfg_set_wkio_mode(uint8 ifidx, uint8 mode);
|
||||
|
||||
int32 wificfg_set_dtim_period(uint8 ifidx, uint32 dtim_period);
|
||||
|
||||
int32 wificfg_set_psmode(uint8 ifidx, uint8 psmode);
|
||||
|
||||
int32 wificfg_set_wkdata_save(uint8 ifidx, uint8 wkdata_save);
|
||||
|
||||
int32 wificfg_set_autosleep(uint8 ifidx, uint8 autosleep);
|
||||
|
||||
int32 wificfg_set_psconnect(uint8 period, uint8 roundup);
|
||||
|
||||
int32 wificfg_load_def(uint8 reset);
|
||||
|
||||
int32 wificfg_set_sleep_aplost_time(uint8 ifidx, uint32 time);
|
||||
|
||||
int32 wificfg_set_agg_cnt(uint8 agg_cnt);
|
||||
|
||||
int32 wificfg_get_agg_cnt(uint8 ifidx);
|
||||
|
||||
int32 wificfg_set_auto_chan_switch(uint8 disable);
|
||||
|
||||
int32 wificfg_set_reassoc_wkhost(uint8 ifidx, uint8 enable);
|
||||
|
||||
int32 wificfg_set_wakeup_io(uint8 io, uint8 edge);
|
||||
|
||||
const char *wificfg_keymgmt_str(uint8 ifidx);
|
||||
|
||||
const char *wificfg_wifimode_str(uint8 ifidx);
|
||||
|
||||
int32 wificfg_set_auto_sleep_time(uint8 ifidx, int32 time);
|
||||
|
||||
int32 wificfg_set_pair_autostop(uint8 ifidx, uint8 en);
|
||||
|
||||
int32 wificfg_set_super_pwr_off(uint8 off);
|
||||
|
||||
int32 wificfg_set_repeater_ssid(uint8 ifidx, uint8 *ssid);
|
||||
|
||||
int32 wificfg_set_repeater_psk(uint8 ifidx, uint8 *data, uint32 data_len);
|
||||
|
||||
int32 wificfg_set_auto_save(uint8 ifidx, uint8 off);
|
||||
|
||||
int32 wificfg_set_dcdc13(uint8 en);
|
||||
|
||||
int32 wificfg_set_acktmo(uint16 tmo);
|
||||
|
||||
int32 wificfg_set_pa_pwrctrl_dis(uint8 dis);
|
||||
|
||||
int32 wificfg_set_dhcpc_en(uint8 ifidx, uint8 en);
|
||||
|
||||
int32 wificfg_set_mcast_txparam(uint8 ifidx, uint8 *data);
|
||||
|
||||
int32 wificfg_set_ant_auto_off(uint8 off);
|
||||
|
||||
int32 wificfg_set_ant_sel(uint8 sel);
|
||||
|
||||
int32 wificfg_set_wkhost_reasons(uint8 ifidx, uint8 *reasons, uint8 count);
|
||||
|
||||
int32 wificfg_set_mac_filter_en(uint8 ifidx, uint8 en);
|
||||
|
||||
int32 wificfg_get_use2addr(void);
|
||||
|
||||
int32 wificfg_set_ap_hide(uint8 ifidx, uint8 en);
|
||||
|
||||
int32 wificfg_set_dual_ant(uint8 en);
|
||||
|
||||
int32 wificfg_set_max_txcnt(uint8 frm_max, uint8 rts_max);
|
||||
|
||||
int32 wificfg_set_dup_filter_en(uint8 en);
|
||||
|
||||
int32 wificfg_set_dis_1v1_m2u(uint8 dis);
|
||||
|
||||
int32 wificfg_set_dis_psconnect(uint8 dis);
|
||||
|
||||
int32 wificfg_get_freq_range(uint8 ifidx, uint16 *freq_start, uint16 *freq_end, uint8 *chan_bw);
|
||||
|
||||
int32 wificfg_get_freq_range(uint8 ifidx, uint16 *freq_start, uint16 *freq_end, uint8 *chan_bw);
|
||||
|
||||
int32 wificfg_set_cca_for_ce(uint8 en);
|
||||
|
||||
int32 wificfg_set_ap_psmode(uint8 en);
|
||||
|
||||
int32 wificfg_set_tx_bw(uint8 tx_bw);
|
||||
|
||||
int32 wificfg_set_ap_chan_switch(uint8 ifidx, uint8 chan, uint8 counter);
|
||||
|
||||
int32 wificfg_get_curr_freq(uint8 ifidx);
|
||||
|
||||
int32 wificfg_set_connect_paironly(uint8 en);
|
||||
|
||||
int32 wificfg_set_paired_stas(uint8 ifidx, uint8 *mac_list, uint8 cnt);
|
||||
|
||||
int32 wificfg_set_wait_psmode(uint8 mode);
|
||||
|
||||
int32 wificfg_set_standby(uint8 channel, uint32 period_ms);
|
||||
|
||||
int32 wificfg_set_wkupdata_mask(uint8 ifidx, uint8 offset, uint8 *mask, uint32 mask_len);
|
||||
|
||||
int32 wificfg_set_wakeup_data(uint8 ifidx, uint8 *data, uint32 data_len);
|
||||
|
||||
int32 wificfg_set_wkdata_svr_ip(uint8 ifidx, uint32 svr_ip);
|
||||
|
||||
int32 wificfg_set_passwd(uint8 ifidx, uint8 *passwd);
|
||||
|
||||
int32 wificfg_set_rpasswd(uint8 ifidx, uint8 *passwd);
|
||||
|
||||
int32 wificfg_set_signal_threshold(uint8 ifidx, uint8 rssi_thres, uint8 evm_thres);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
144
sdk/include/lib/umac/wifi_mgr.h
Normal file
144
sdk/include/lib/umac/wifi_mgr.h
Normal file
@@ -0,0 +1,144 @@
|
||||
#ifndef HGIC_WIFI_MGR_H_
|
||||
#define HGIC_WIFI_MGR_H_
|
||||
|
||||
#include "sys_config.h"
|
||||
#include "typesdef.h"
|
||||
#include "errno.h"
|
||||
#include "list.h"
|
||||
#include "dev.h"
|
||||
#include "devid.h"
|
||||
#include "list.h"
|
||||
#include "osal/string.h"
|
||||
#include "osal/mutex.h"
|
||||
#include "osal/semaphore.h"
|
||||
#include "osal/mutex.h"
|
||||
#include "osal/task.h"
|
||||
#include "osal/timer.h"
|
||||
#include "hal/netdev.h"
|
||||
#include "lib/common/rbuffer.h"
|
||||
#include "lib/bus/macbus/mac_bus.h"
|
||||
#include "lib/skb/skb.h"
|
||||
#include "lib/skb/skb_list.h"
|
||||
#include "lib/lmac/hgic.h"
|
||||
#include "lib/net/utils.h"
|
||||
#include "lib/umac/ieee80211.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ETH_P_WIFIMGR (0x4855)
|
||||
#define ETH_P_HGRAW (0x4884)
|
||||
|
||||
#define WIFIMGR_WORK_CNT (4)
|
||||
#define WIFIMGR_LOCAL_IDCNT (16)
|
||||
|
||||
struct wifi_mgr;
|
||||
|
||||
enum wifimgr_frm_type {
|
||||
WIFIMGR_FRM_TYPE_ETHER = 0,
|
||||
WIFIMGR_FRM_TYPE_HGIC,
|
||||
WIFIMGR_FRM_TYPE_RAW,
|
||||
};
|
||||
|
||||
enum wifimgr_stype {
|
||||
WIFI_MGR_STYPE_NONE = 0,
|
||||
WIFI_MGR_STYPE_PSALIVE = 1,
|
||||
WIFI_MGR_STYPE_MGRCMD = 2,
|
||||
};
|
||||
|
||||
enum wifimgr_cmd{
|
||||
WIFIMGR_CMD_RESET_STA,
|
||||
WIFIMGR_CMD_SET_STA_FREQINFO,
|
||||
};
|
||||
|
||||
struct wifimgr_hdr {
|
||||
uint16 magic, len, crc;
|
||||
uint8 type, r1, r2, r3;
|
||||
};
|
||||
|
||||
typedef int32(*wifimgr_work_cb)(struct wifi_mgr *mgr, uint32 param1, uint32 param2);
|
||||
struct wifimgr_work {
|
||||
uint32 param1, param2;
|
||||
wifimgr_work_cb run;
|
||||
};
|
||||
|
||||
struct wifi_dev {
|
||||
struct netdev ndev;
|
||||
netdev_input_cb input_cb;
|
||||
uint8 addr[6];
|
||||
uint8 ifidx;
|
||||
uint8 open:1;
|
||||
struct wifi_mgr *mgr;
|
||||
};
|
||||
|
||||
struct wifi_mgr {
|
||||
struct netdev ndev;
|
||||
netdev_input_cb input_cb;
|
||||
void *input_priv;
|
||||
uint8 addr[6];
|
||||
uint8 frm_type;
|
||||
uint8 open:1, netif:1, init_report:1, icmp_mntr:1;
|
||||
uint32 if_recv, if_write, if_err;
|
||||
uint16 bus_txcookie, bus_rxcookie;
|
||||
uint16 drv_aggsize;
|
||||
ieee80211_evt_cb old_cb;
|
||||
struct list_head smod;
|
||||
struct mac_bus *bus;
|
||||
struct skb_list cmdlist;
|
||||
struct skb_list up2host;
|
||||
struct skb_list cachedata;
|
||||
struct os_work work;
|
||||
os_mutex_t lock;
|
||||
os_timer_t timer;
|
||||
|
||||
uint32 agg_len;
|
||||
uint8 *agg_buff;
|
||||
int8 rssi[2];
|
||||
uint16 host_alive;
|
||||
struct sk_buff *cmdskb;
|
||||
struct lmac_ops *lops;
|
||||
struct bt_ops *btops;
|
||||
uint32 local_ids[WIFIMGR_LOCAL_IDCNT];
|
||||
};
|
||||
|
||||
struct wifimgr_submod {
|
||||
struct list_head list;
|
||||
struct wifi_mgr *mgr;
|
||||
uint8 type;
|
||||
const char *name;
|
||||
int32(*event_proc)(struct wifimgr_submod *smod, uint8 ifidx, uint16 evt, uint32 param1, uint32 param2);
|
||||
int32(*cmd_proc)(struct wifimgr_submod *smod, struct sk_buff **skb);
|
||||
int32(*rx_wifimgr)(struct wifimgr_submod *smod, uint8 ifidx, uint8 *data, uint32 len);
|
||||
};
|
||||
|
||||
struct sk_buff *wifi_mgr_alloc_resp(struct sk_buff *skb, int8 *data, int32 len);
|
||||
void wifi_mgr_print2host(void *priv, char *msg, int len);
|
||||
int32 wifi_mgr_notify_host(struct wifi_mgr *mgr, uint8 event_id, uint8 *args, int32 len);
|
||||
int32 wifi_mgr_buswrite_cmdresp(struct wifi_mgr *mgr, struct sk_buff *skb, int status);
|
||||
int32 wifi_mgr_buswrite_data(struct wifi_mgr *mgr, uint8 *data, uint32 len, uint32 flags);
|
||||
int32 wifi_mgr_send_wifimgr_data(uint8 *dest, uint8 stype, uint8 *data, uint32 len);
|
||||
void wifi_mgr_switch(int8 to_host);
|
||||
void wifi_mgr_add_submod(struct wifimgr_submod *smod);
|
||||
int32 wifi_mgr_init(enum mac_bus_type bus_type, int8 frm_type, void *ops, void *btops, struct macbus_param *param);
|
||||
void wifi_mgr_proc_hgic_cmd(struct wifi_mgr *mgr, struct sk_buff *skb);
|
||||
void wifi_mgr_status(void);
|
||||
|
||||
int32 wifi_mgr_reset_sta(struct wifi_mgr *mgr, uint8 *addr);
|
||||
int32 wifi_mgr_set_sta_freqinfo(struct wifi_mgr *mgr, uint8 *freqinfo, uint32 size);
|
||||
int32 wifi_mgr_enable_psalive(uint8 ifidx, uint8 wnb_support);
|
||||
void wifi_mgrcmd_enable(void);
|
||||
int32 wifi_mgr_enable_psconnect(void);
|
||||
void wifi_mgr_enable_dhcpc(void);
|
||||
|
||||
int32 host_cmd_resp(int16 ret, uint8 *resp, uint32 resp_len, void *hdr);
|
||||
int32 host_data_send(uint8 *data, uint32 data_len);
|
||||
int32 host_event_new(uint32 evt_id, uint8 *data, uint32 data_len);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user