📄 hostap_wlan.h
字号:
#ifndef HOSTAP_WLAN_H#define HOSTAP_WLAN_H#include "hostap_config.h"#include "hostap_common.h"#define MAX_PARM_DEVICES 8#define PARM_MIN_MAX "1-" __MODULE_STRING(MAX_PARM_DEVICES)#define DEF_INTS -1, -1, -1, -1, -1, -1, -1#define GET_INT_PARM(var,idx) var[var[idx] < 0 ? 0 : idx]/* Specific skb->protocol value that indicates that the packet already contains * txdesc header. * FIX: This might need own value that would be allocated especially for Prism2 * txdesc; ETH_P_CONTROL is commented as "Card specific control frames". * However, these skb's should have only minimal path in the kernel side since * prism2_send_mgmt() sends these with dev_queue_xmit() to prism2_tx(). */#define ETH_P_HOSTAP ETH_P_CONTROL/* ARPHRD_IEEE80211_PRISM uses a bloated version of Prism2 RX frame header * (from linux-wlan-ng) */struct linux_wlan_ng_val { u32 did; u16 status, len; u32 data;} __attribute__ ((packed));struct linux_wlan_ng_prism_hdr { u32 msgcode, msglen; char devname[16]; struct linux_wlan_ng_val hosttime, mactime, channel, rssi, sq, signal, noise, rate, istx, frmlen;} __attribute__ ((packed));struct linux_wlan_ng_cap_hdr { u32 version; u32 length; u64 mactime; u64 hosttime; u32 phytype; u32 channel; u32 datarate; u32 antenna; u32 priority; u32 ssi_type; s32 ssi_signal; s32 ssi_noise; u32 preamble; u32 encoding;} __attribute__ ((packed));#define LWNG_CAP_DID_BASE (4 | (1 << 6)) /* section 4, group 1 */#define LWNG_CAPHDR_VERSION 0x80211001struct hfa384x_rx_frame { /* HFA384X RX frame descriptor */ u16 status; /* HFA384X_RX_STATUS_ flags */ u32 time; /* timestamp, 1 microsecond resolution */ u8 silence; /* 27 .. 154; seems to be 0 */ u8 signal; /* 27 .. 154 */ u8 rate; /* 10, 20, 55, or 110 */ u8 rxflow; u32 reserved; /* 802.11 */ u16 frame_control; u16 duration_id; u8 addr1[6]; u8 addr2[6]; u8 addr3[6]; u16 seq_ctrl; u8 addr4[6]; u16 data_len; /* 802.3 */ u8 dst_addr[6]; u8 src_addr[6]; u16 len; /* followed by frame data; max 2304 bytes */} __attribute__ ((packed));struct hfa384x_tx_frame { /* HFA384X TX frame descriptor */ u16 status; /* HFA384X_TX_STATUS_ flags */ u16 reserved1; u16 reserved2; u32 sw_support; u8 retry_count; /* not yet implemented */ u8 tx_rate; /* Host AP only; 0 = firmware, or 10, 20, 55, 110 */ u16 tx_control; /* HFA384X_TX_CTRL_ flags */ /* 802.11 */ u16 frame_control; /* parts not used */ u16 duration_id; u8 addr1[6]; u8 addr2[6]; /* filled by firmware */ u8 addr3[6]; u16 seq_ctrl; /* filled by firmware */ u8 addr4[6]; u16 data_len; /* 802.3 */ u8 dst_addr[6]; u8 src_addr[6]; u16 len; /* followed by frame data; max 2304 bytes */} __attribute__ ((packed));struct hfa384x_rid_hdr{ u16 len; u16 rid;} __attribute__ ((packed));/* Macro for converting signal levels (range 27 .. 154) to wireless ext * dBm value with some accuracy */#define HFA384X_LEVEL_TO_dBm(v) 0x100 + (v) * 100 / 255 - 100#define HFA384X_LEVEL_TO_dBm_sign(v) (v) * 100 / 255 - 100struct hfa384x_scan_request { u16 channel_list; u16 txrate; /* HFA384X_RATES_* */} __attribute__ ((packed));struct hfa384x_hostscan_request { u16 channel_list; u16 txrate; u16 target_ssid_len; u8 target_ssid[32];} __attribute__ ((packed));struct hfa384x_join_request { u8 bssid[6]; u16 channel;} __attribute__ ((packed));struct hfa384x_info_frame { u16 len; u16 type;} __attribute__ ((packed));struct hfa384x_comm_tallies { u16 tx_unicast_frames; u16 tx_multicast_frames; u16 tx_fragments; u16 tx_unicast_octets; u16 tx_multicast_octets; u16 tx_deferred_transmissions; u16 tx_single_retry_frames; u16 tx_multiple_retry_frames; u16 tx_retry_limit_exceeded; u16 tx_discards; u16 rx_unicast_frames; u16 rx_multicast_frames; u16 rx_fragments; u16 rx_unicast_octets; u16 rx_multicast_octets; u16 rx_fcs_errors; u16 rx_discards_no_buffer; u16 tx_discards_wrong_sa; u16 rx_discards_wep_undecryptable; u16 rx_message_in_msg_fragments; u16 rx_message_in_bad_msg_fragments;} __attribute__ ((packed));struct hfa384x_comm_tallies32 { u32 tx_unicast_frames; u32 tx_multicast_frames; u32 tx_fragments; u32 tx_unicast_octets; u32 tx_multicast_octets; u32 tx_deferred_transmissions; u32 tx_single_retry_frames; u32 tx_multiple_retry_frames; u32 tx_retry_limit_exceeded; u32 tx_discards; u32 rx_unicast_frames; u32 rx_multicast_frames; u32 rx_fragments; u32 rx_unicast_octets; u32 rx_multicast_octets; u32 rx_fcs_errors; u32 rx_discards_no_buffer; u32 tx_discards_wrong_sa; u32 rx_discards_wep_undecryptable; u32 rx_message_in_msg_fragments; u32 rx_message_in_bad_msg_fragments;} __attribute__ ((packed));struct hfa384x_scan_result_hdr { u16 reserved; u16 scan_reason;#define HFA384X_SCAN_IN_PROGRESS 0 /* no results available yet */#define HFA384X_SCAN_HOST_INITIATED 1#define HFA384X_SCAN_FIRMWARE_INITIATED 2#define HFA384X_SCAN_INQUIRY_FROM_HOST 3} __attribute__ ((packed));#define HFA384X_SCAN_MAX_RESULTS 32struct hfa384x_scan_result { u16 chid; u16 anl; u16 sl; u8 bssid[6]; u16 beacon_interval; u16 capability; u16 ssid_len; u8 ssid[32]; u8 sup_rates[10]; u16 rate;} __attribute__ ((packed));struct hfa384x_hostscan_result { u16 chid; u16 anl; u16 sl; u8 bssid[6]; u16 beacon_interval; u16 capability; u16 ssid_len; u8 ssid[32]; u8 sup_rates[10]; u16 rate; u16 atim;} __attribute__ ((packed));struct comm_tallies_sums { unsigned int tx_unicast_frames; unsigned int tx_multicast_frames; unsigned int tx_fragments; unsigned int tx_unicast_octets; unsigned int tx_multicast_octets; unsigned int tx_deferred_transmissions; unsigned int tx_single_retry_frames; unsigned int tx_multiple_retry_frames; unsigned int tx_retry_limit_exceeded; unsigned int tx_discards; unsigned int rx_unicast_frames; unsigned int rx_multicast_frames; unsigned int rx_fragments; unsigned int rx_unicast_octets; unsigned int rx_multicast_octets; unsigned int rx_fcs_errors; unsigned int rx_discards_no_buffer; unsigned int tx_discards_wrong_sa; unsigned int rx_discards_wep_undecryptable; unsigned int rx_message_in_msg_fragments; unsigned int rx_message_in_bad_msg_fragments;};struct hfa384x_regs { u16 cmd; u16 evstat; u16 offset0; u16 offset1; u16 swsupport0;};#if defined(PRISM2_PCCARD) || defined(PRISM2_PLX)/* I/O ports for HFA384X Controller access */#define HFA384X_CMD_OFF 0x00#define HFA384X_PARAM0_OFF 0x02#define HFA384X_PARAM1_OFF 0x04#define HFA384X_PARAM2_OFF 0x06#define HFA384X_STATUS_OFF 0x08#define HFA384X_RESP0_OFF 0x0A#define HFA384X_RESP1_OFF 0x0C#define HFA384X_RESP2_OFF 0x0E#define HFA384X_INFOFID_OFF 0x10#define HFA384X_CONTROL_OFF 0x14#define HFA384X_SELECT0_OFF 0x18#define HFA384X_SELECT1_OFF 0x1A#define HFA384X_OFFSET0_OFF 0x1C#define HFA384X_OFFSET1_OFF 0x1E#define HFA384X_RXFID_OFF 0x20#define HFA384X_ALLOCFID_OFF 0x22#define HFA384X_TXCOMPLFID_OFF 0x24#define HFA384X_SWSUPPORT0_OFF 0x28#define HFA384X_SWSUPPORT1_OFF 0x2A#define HFA384X_SWSUPPORT2_OFF 0x2C#define HFA384X_EVSTAT_OFF 0x30#define HFA384X_INTEN_OFF 0x32#define HFA384X_EVACK_OFF 0x34#define HFA384X_DATA0_OFF 0x36#define HFA384X_DATA1_OFF 0x38#define HFA384X_AUXPAGE_OFF 0x3A#define HFA384X_AUXOFFSET_OFF 0x3C#define HFA384X_AUXDATA_OFF 0x3E#endif /* PRISM2_PCCARD || PRISM2_PLX */#ifdef PRISM2_PCI/* Memory addresses for ISL3874 controller access */#define HFA384X_CMD_OFF 0x00#define HFA384X_PARAM0_OFF 0x04#define HFA384X_PARAM1_OFF 0x08#define HFA384X_PARAM2_OFF 0x0C#define HFA384X_STATUS_OFF 0x10#define HFA384X_RESP0_OFF 0x14#define HFA384X_RESP1_OFF 0x18#define HFA384X_RESP2_OFF 0x1C#define HFA384X_INFOFID_OFF 0x20#define HFA384X_CONTROL_OFF 0x28#define HFA384X_SELECT0_OFF 0x30#define HFA384X_SELECT1_OFF 0x34#define HFA384X_OFFSET0_OFF 0x38#define HFA384X_OFFSET1_OFF 0x3C#define HFA384X_RXFID_OFF 0x40#define HFA384X_ALLOCFID_OFF 0x44#define HFA384X_TXCOMPLFID_OFF 0x48#define HFA384X_PCICOR_OFF 0x4C#define HFA384X_SWSUPPORT0_OFF 0x50#define HFA384X_SWSUPPORT1_OFF 0x54#define HFA384X_SWSUPPORT2_OFF 0x58#define HFA384X_PCIHCR_OFF 0x5C#define HFA384X_EVSTAT_OFF 0x60#define HFA384X_INTEN_OFF 0x64#define HFA384X_EVACK_OFF 0x68#define HFA384X_DATA0_OFF 0x6C#define HFA384X_DATA1_OFF 0x70#define HFA384X_AUXPAGE_OFF 0x74#define HFA384X_AUXOFFSET_OFF 0x78#define HFA384X_AUXDATA_OFF 0x7C#define HFA384X_PCI_M0_ADDRH_OFF 0x80#define HFA384X_PCI_M0_ADDRL_OFF 0x84#define HFA384X_PCI_M0_LEN_OFF 0x88#define HFA384X_PCI_M0_CTL_OFF 0x8C#define HFA384X_PCI_STATUS_OFF 0x98#define HFA384X_PCI_M1_ADDRH_OFF 0xA0#define HFA384X_PCI_M1_ADDRL_OFF 0xA4#define HFA384X_PCI_M1_LEN_OFF 0xA8#define HFA384X_PCI_M1_CTL_OFF 0xAC/* PCI bus master control bits (these are undocumented; based on guessing and * experimenting..) */#define HFA384X_PCI_CTL_FROM_BAP (BIT(5) | BIT(1) | BIT(0))#define HFA384X_PCI_CTL_TO_BAP (BIT(5) | BIT(0))#endif /* PRISM2_PCI *//* Command codes for CMD reg. */#define HFA384X_CMDCODE_INIT 0x00#define HFA384X_CMDCODE_ENABLE 0x01#define HFA384X_CMDCODE_DISABLE 0x02#define HFA384X_CMDCODE_ALLOC 0x0A#define HFA384X_CMDCODE_TRANSMIT 0x0B#define HFA384X_CMDCODE_INQUIRE 0x11#define HFA384X_CMDCODE_ACCESS 0x21#define HFA384X_CMDCODE_ACCESS_WRITE (0x21 | BIT(8))#define HFA384X_CMDCODE_DOWNLOAD 0x22#define HFA384X_CMDCODE_READMIF 0x30#define HFA384X_CMDCODE_WRITEMIF 0x31#define HFA384X_CMDCODE_TEST 0x38#define HFA384X_CMDCODE_MASK 0x3F/* Test mode operations */#define HFA384X_TEST_CHANGE_CHANNEL 0x08#define HFA384X_TEST_MONITOR 0x0B#define HFA384X_TEST_STOP 0x0F#define HFA384X_TEST_CFG_BITS 0x15#define HFA384X_TEST_CFG_BIT_ALC BIT(3)#define HFA384X_CMD_BUSY BIT(15)#define HFA384X_CMD_TX_RECLAIM BIT(8)#define HFA384X_OFFSET_ERR BIT(14)#define HFA384X_OFFSET_BUSY BIT(15)/* ProgMode for download command */#define HFA384X_PROGMODE_DISABLE 0#define HFA384X_PROGMODE_ENABLE_VOLATILE 1#define HFA384X_PROGMODE_ENABLE_NON_VOLATILE 2#define HFA384X_PROGMODE_PROGRAM_NON_VOLATILE 3#define HFA384X_AUX_MAGIC0 0xfe01#define HFA384X_AUX_MAGIC1 0xdc23#define HFA384X_AUX_MAGIC2 0xba45#define HFA384X_AUX_PORT_DISABLED 0#define HFA384X_AUX_PORT_DISABLE BIT(14)#define HFA384X_AUX_PORT_ENABLE BIT(15)#define HFA384X_AUX_PORT_ENABLED (BIT(14) | BIT(15))#define HFA384X_AUX_PORT_MASK (BIT(14) | BIT(15))#define PRISM2_PDA_SIZE 1024/* Events; EvStat, Interrupt mask (IntEn), and acknowledge bits (EvAck) */#define HFA384X_EV_TICK BIT(15)#define HFA384X_EV_WTERR BIT(14)#define HFA384X_EV_INFDROP BIT(13)#ifdef PRISM2_PCI#define HFA384X_EV_PCI_M1 BIT(9)#define HFA384X_EV_PCI_M0 BIT(8)#endif /* PRISM2_PCI */#define HFA384X_EV_INFO BIT(7)#define HFA384X_EV_DTIM BIT(5)#define HFA384X_EV_CMD BIT(4)#define HFA384X_EV_ALLOC BIT(3)#define HFA384X_EV_TXEXC BIT(2)#define HFA384X_EV_TX BIT(1)#define HFA384X_EV_RX BIT(0)/* HFA384X Information frames */#define HFA384X_INFO_HANDOVERADDR 0xF000 /* AP f/w ? */#define HFA384X_INFO_HANDOVERDEAUTHADDR 0xF001 /* AP f/w 1.3.7 */#define HFA384X_INFO_COMMTALLIES 0xF100#define HFA384X_INFO_SCANRESULTS 0xF101#define HFA384X_INFO_CHANNELINFORESULTS 0xF102 /* AP f/w only */#define HFA384X_INFO_HOSTSCANRESULTS 0xF103#define HFA384X_INFO_LINKSTATUS 0xF200#define HFA384X_INFO_ASSOCSTATUS 0xF201 /* ? */#define HFA384X_INFO_AUTHREQ 0xF202 /* ? */#define HFA384X_INFO_PSUSERCNT 0xF203 /* ? */#define HFA384X_INFO_KEYIDCHANGED 0xF204 /* ? */enum { HFA384X_LINKSTATUS_CONNECTED = 1, HFA384X_LINKSTATUS_DISCONNECTED = 2, HFA384X_LINKSTATUS_AP_CHANGE = 3, HFA384X_LINKSTATUS_AP_OUT_OF_RANGE = 4, HFA384X_LINKSTATUS_AP_IN_RANGE = 5, HFA384X_LINKSTATUS_ASSOC_FAILED = 6 };enum { HFA384X_PORTTYPE_BSS = 1, HFA384X_PORTTYPE_WDS = 2, HFA384X_PORTTYPE_PSEUDO_IBSS = 3, HFA384X_PORTTYPE_IBSS = 0, HFA384X_PORTTYPE_HOSTAP = 6 };#define HFA384X_RATES_1MBPS BIT(0)#define HFA384X_RATES_2MBPS BIT(1)#define HFA384X_RATES_5MBPS BIT(2)#define HFA384X_RATES_11MBPS BIT(3)#define HFA384X_ROAMING_FIRMWARE 1#define HFA384X_ROAMING_HOST 2#define HFA384X_ROAMING_DISABLED 3#define HFA384X_WEPFLAGS_PRIVACYINVOKED BIT(0)#define HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED BIT(1)#define HFA384X_WEPFLAGS_HOSTENCRYPT BIT(4)#define HFA384X_WEPFLAGS_HOSTDECRYPT BIT(7)#define HFA384X_RX_STATUS_MSGTYPE (BIT(15) | BIT(14) | BIT(13))#define HFA384X_RX_STATUS_PCF BIT(12)#define HFA384X_RX_STATUS_MACPORT (BIT(10) | BIT(9) | BIT(8))#define HFA384X_RX_STATUS_UNDECR BIT(1)#define HFA384X_RX_STATUS_FCSERR BIT(0)#define HFA384X_RX_STATUS_GET_MSGTYPE(s) \(((s) & HFA384X_RX_STATUS_MSGTYPE) >> 13)#define HFA384X_RX_STATUS_GET_MACPORT(s) \(((s) & HFA384X_RX_STATUS_MACPORT) >> 8)enum { HFA384X_RX_MSGTYPE_NORMAL = 0, HFA384X_RX_MSGTYPE_RFC1042 = 1, HFA384X_RX_MSGTYPE_BRIDGETUNNEL = 2, HFA384X_RX_MSGTYPE_MGMT = 4 };#define HFA384X_TX_CTRL_ALT_RTRY BIT(5)#define HFA384X_TX_CTRL_802_11 BIT(3)#define HFA384X_TX_CTRL_802_3 0#define HFA384X_TX_CTRL_TX_EX BIT(2)#define HFA384X_TX_CTRL_TX_OK BIT(1)#define HFA384X_TX_STATUS_RETRYERR BIT(0)#define HFA384X_TX_STATUS_AGEDERR BIT(1)#define HFA384X_TX_STATUS_DISCON BIT(2)#define HFA384X_TX_STATUS_FORMERR BIT(3)/* HFA3861/3863 (BBP) Control Registers */#define HFA386X_CR_TX_CONFIGURE 0x12 /* CR9 */#define HFA386X_CR_RX_CONFIGURE 0x14 /* CR10 */#define HFA386X_CR_A_D_TEST_MODES2 0x1A /* CR13 */#define HFA386X_CR_MANUAL_TX_POWER 0x3E /* CR31 */#define HFA386X_CR_MEASURED_TX_POWER 0x74 /* CR58 */#ifdef __KERNEL__#define PRISM2_TXFID_COUNT 8#define PRISM2_DATA_MAXLEN 2304#define PRISM2_TXFID_LEN (PRISM2_DATA_MAXLEN + sizeof(struct hfa384x_tx_frame))#define PRISM2_TXFID_EMPTY 0xffff#define PRISM2_TXFID_RESERVED 0xfffe#define PRISM2_DUMMY_FID 0xffff#define MAX_SSID_LEN 32#define MAX_NAME_LEN 32 /* this is assumed to be equal to MAX_SSID_LEN */#define PRISM2_DUMP_RX_HDR BIT(0)#define PRISM2_DUMP_TX_HDR BIT(1)#define PRISM2_DUMP_TXEXC_HDR BIT(2)struct hostap_tx_callback_info { u16 idx; void (*func)(struct sk_buff *, int ok, void *); void *data; struct hostap_tx_callback_info *next;};/* IEEE 802.11 requires that STA supports concurrent reception of at least * three fragmented frames. This define can be increased to support more * concurrent frames, but it should be noted that each entry can consume about * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -