📄 hostap_wlan.h
字号:
#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. */#define PRISM2_FRAG_CACHE_LEN 4struct prism2_frag_entry { unsigned long first_frag_time; unsigned int seq; unsigned int last_frag; struct sk_buff *skb; u8 src_addr[ETH_ALEN]; u8 dst_addr[ETH_ALEN];};struct prism2_crypt_data { struct list_head list; /* delayed deletion list */ struct hostap_crypto_ops *ops; void *priv; atomic_t refcnt;};struct hostap_cmd_queue { struct list_head list; wait_queue_head_t compl; volatile enum { CMD_SLEEP, CMD_CALLBACK, CMD_COMPLETED } type; void (*callback)(struct net_device *dev, long context, u16 resp0, u16 res); long context; u16 cmd, param0, param1; u16 resp0, res; volatile int issued, issuing; atomic_t usecnt; int del_req;};/* options for hw_shutdown */#define HOSTAP_HW_NO_DISABLE BIT(0)#define HOSTAP_HW_ENABLE_CMDCOMPL BIT(1)typedef struct local_info local_info_t;struct prism2_helper_functions { /* these functions are defined in hardware model specific files * (hostap_{cs,plx,pci}.c */ int (*card_present)(local_info_t *local); void (*cor_sreset)(local_info_t *local); int (*dev_open)(local_info_t *local); int (*dev_close)(local_info_t *local); void (*genesis_reset)(local_info_t *local, int hcr); /* the following functions are from hostap_hw.c, but they may have some * hardware model specific code */ /* FIX: low-level commands like cmd might disappear at some point to * make it easier to change them if needed (e.g., cmd would be replaced * with write_mif/read_mif/testcmd/inquire); at least get_rid and * set_rid might move to hostap_{cs,plx,pci}.c */ int (*cmd)(struct net_device *dev, u16 cmd, u16 param0, u16 *param1, u16 *resp0); void (*read_regs)(struct net_device *dev, struct hfa384x_regs *regs); int (*get_rid)(struct net_device *dev, u16 rid, void *buf, int len, int exact_len); int (*set_rid)(struct net_device *dev, u16 rid, void *buf, int len); int (*hw_enable)(struct net_device *dev, int initial); int (*hw_config)(struct net_device *dev, int initial); void (*hw_reset)(struct net_device *dev); void (*hw_shutdown)(struct net_device *dev, int no_disable); int (*reset_port)(struct net_device *dev); void (*schedule_reset)(local_info_t *local); int (*download)(local_info_t *local, struct prism2_download_param *param); int (*tx)(struct sk_buff *skb, struct net_device *dev); int (*set_tim)(struct net_device *dev, int aid, int set); int (*read_aux)(struct net_device *dev, unsigned addr, int len, u8 *buf); int need_tx_headroom; /* number of bytes of headroom needed before * IEEE 802.11 header */ enum { HOSTAP_HW_PCCARD, HOSTAP_HW_PLX, HOSTAP_HW_PCI } hw_type;};struct prism2_download_data { u32 dl_cmd; u32 start_addr; u32 num_areas; struct prism2_download_data_area { u32 addr; /* wlan card address */ u32 len; u8 *data; /* allocated data */ } data[0];};#define HOSTAP_MAX_BSS_COUNT 64#define MAX_WPA_IE_LEN 64struct hostap_bss_info { struct list_head list; unsigned long last_update; unsigned int count; u8 bssid[ETH_ALEN]; u16 capab_info; u8 ssid[32]; size_t ssid_len; u8 wpa_ie[MAX_WPA_IE_LEN]; size_t wpa_ie_len; u8 rsn_ie[MAX_WPA_IE_LEN]; size_t rsn_ie_len; int chan; int included;};/* Per radio private Host AP data - shared by all net devices interfaces used * by each radio (wlan#, wlan#ap, wlan#sta, WDS). * ((struct hostap_interface *) dev->priv)->local points to this structure. */struct local_info { struct module *hw_module; int card_idx; int dev_enabled; int master_dev_auto_open; /* was master device opened automatically */ int num_dev_open; /* number of open devices */ struct net_device *dev; /* master radio device */ struct net_device *ddev; /* main data device */ struct list_head hostap_interfaces; /* Host AP interface list (contains * struct hostap_interface entries) */ rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock * when removing entries from the list. * TX and RX paths can use read lock. */ spinlock_t cmdlock, baplock, lock; struct semaphore rid_bap_sem; u16 infofid; /* MAC buffer id for info frame */ /* txfid, intransmitfid, next_txtid, and next_alloc are protected by * txfidlock */ spinlock_t txfidlock; int txfid_len; /* length of allocated TX buffers */ u16 txfid[PRISM2_TXFID_COUNT]; /* buffer IDs for TX frames */ /* buffer IDs for intransmit frames or PRISM2_TXFID_EMPTY if * corresponding txfid is free for next TX frame */ u16 intransmitfid[PRISM2_TXFID_COUNT]; int next_txfid; /* index to the next txfid to be checked for * availability */ int next_alloc; /* index to the next intransmitfid to be checked for * allocation events */ /* bitfield for atomic bitops */#define HOSTAP_BITS_TRANSMIT 0#define HOSTAP_BITS_BAP_TASKLET 1#define HOSTAP_BITS_BAP_TASKLET2 2 long bits; struct ap_data *ap; char essid[MAX_SSID_LEN + 1]; char name[MAX_NAME_LEN + 1]; int name_set; u16 channel_mask; /* mask of allowed channels */ u16 scan_channel_mask; /* mask of channels to be scanned */ struct comm_tallies_sums comm_tallies; struct net_device_stats stats; struct proc_dir_entry *proc; int iw_mode; /* operating mode (IW_MODE_*) */ int pseudo_adhoc; /* 0: IW_MODE_ADHOC is real 802.11 compliant IBSS * 1: IW_MODE_ADHOC is "pseudo IBSS" */ char bssid[ETH_ALEN]; int channel; int beacon_int; int dtim_period; int mtu; int frame_dump; /* dump RX/TX frame headers, PRISM2_DUMP_ flags */ int fw_tx_rate_control; u16 tx_rate_control; u16 basic_rates; int hw_resetting; int hw_ready; int hw_reset_tries; /* how many times reset has been tried */ int hw_downloading; int shutdown; int pri_only; int no_pri; /* no PRI f/w present */ int sram_type; /* 8 = x8 SRAM, 16 = x16 SRAM, -1 = unknown */ enum { PRISM2_TXPOWER_AUTO = 0, PRISM2_TXPOWER_OFF, PRISM2_TXPOWER_FIXED, PRISM2_TXPOWER_UNKNOWN } txpower_type; int txpower; /* if txpower_type == PRISM2_TXPOWER_FIXED */ /* command queue for hfa384x_cmd(); protected with cmdlock */ struct list_head cmd_queue; /* max_len for cmd_queue; in addition, cmd_callback can use two * additional entries to prevent sleeping commands from stopping * transmits */#define HOSTAP_CMD_QUEUE_MAX_LEN 16 int cmd_queue_len; /* number of entries in cmd_queue */ /* if card timeout is detected in interrupt context, reset_queue is * used to schedule card reseting to be done in user context */ HOSTAP_QUEUE reset_queue; /* For scheduling a change of the promiscuous mode RID */ int is_promisc; HOSTAP_QUEUE set_multicast_list_queue;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -