📄 hostap_wlan.h
字号:
#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 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); 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 *) netdev_priv(dev))->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 */ struct work_struct reset_queue; /* For scheduling a change of the promiscuous mode RID */ int is_promisc; struct work_struct set_multicast_list_queue; struct work_struct set_tim_queue; struct list_head set_tim_list; spinlock_t set_tim_lock; int wds_max_connections; int wds_connections;#define HOSTAP_WDS_BROADCAST_RA BIT(0)#define HOSTAP_WDS_AP_CLIENT BIT(1)#define HOSTAP_WDS_STANDARD_FRAME BIT(2) u32 wds_type; u16 tx_control; /* flags to be used in TX description */ int manual_retry_count; /* -1 = use f/w default; otherwise retry count * to be used with all frames */ struct iw_statistics wstats; unsigned long scan_timestamp; /* Time started to scan */ enum { PRISM2_MONITOR_80211 = 0, PRISM2_MONITOR_PRISM = 1, PRISM2_MONITOR_CAPHDR = 2 } monitor_type; int (*saved_eth_header_parse)(struct sk_buff *skb, unsigned char *haddr); int monitor_allow_fcserr; int hostapd; /* whether user space daemon, hostapd, is used for AP * management */ int hostapd_sta; /* whether hostapd is used with an extra STA interface */ struct net_device *apdev; struct net_device_stats apdevstats; char assoc_ap_addr[ETH_ALEN]; struct net_device *stadev; struct net_device_stats stadevstats;#define WEP_KEYS 4#define WEP_KEY_LEN 13 struct ieee80211_crypt_data *crypt[WEP_KEYS]; int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ struct timer_list crypt_deinit_timer; struct list_head crypt_deinit_list; int open_wep; /* allow unencrypted frames */ int host_encrypt; int host_decrypt; int privacy_invoked; /* force privacy invoked flag even if no keys are * configured */ int fw_encrypt_ok; /* whether firmware-based WEP encrypt is working * in Host AP mode (STA f/w 1.4.9 or newer) */ int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ struct prism2_frag_entry frag_cache[PRISM2_FRAG_CACHE_LEN]; unsigned int frag_next_idx; int ieee_802_1x; /* is IEEE 802.1X used */ int antsel_tx, antsel_rx; int rts_threshold; /* dot11RTSThreshold */ int fragm_threshold; /* dot11FragmentationThreshold */ int auth_algs; /* PRISM2_AUTH_ flags */ int enh_sec; /* cnfEnhSecurity options (broadcast SSID hide/ignore) */ int tallies32; /* 32-bit tallies in use */ struct prism2_helper_functions *func; u8 *pda; int fw_ap;#define PRISM2_FW_VER(major, minor, variant) \(((major) << 16) | ((minor) << 8) | variant) u32 sta_fw_ver; /* Tasklets for handling hardware IRQ related operations outside hw IRQ * handler */ struct tasklet_struct bap_tasklet; struct tasklet_struct info_tasklet; struct sk_buff_head info_list; /* info frames as skb's for * info_tasklet */ struct hostap_tx_callback_info *tx_callback; /* registered TX callbacks */ struct tasklet_struct rx_tasklet; struct sk_buff_head rx_list; struct tasklet_struct sta_tx_exc_tasklet; struct sk_buff_head sta_tx_exc_list; int host_roaming; unsigned long last_join_time; /* time of last JoinRequest */ struct hfa384x_hostscan_result *last_scan_results; int last_scan_results_count; enum { PRISM2_SCAN, PRISM2_HOSTSCAN } last_scan_type; struct work_struct info_queue; long pending_info; /* bit field of pending info_queue items */#define PRISM2_INFO_PENDING_LINKSTATUS 0#define PRISM2_INFO_PENDING_SCANRESULTS 1 int prev_link_status; /* previous received LinkStatus info */ int prev_linkstatus_connected; u8 preferred_ap[6]; /* use this AP if possible */#ifdef PRISM2_CALLBACK void *callback_data; /* Can be used in callbacks; e.g., allocate * on enable event and free on disable event. * Host AP driver code does not touch this. */#endif /* PRISM2_CALLBACK */ wait_queue_head_t hostscan_wq; /* Passive scan in Host AP mode */ struct timer_list passive_scan_timer; int passive_scan_interval; /* in seconds, 0 = disabled */ int passive_scan_channel; enum { PASSIVE_SCAN_WAIT, PASSIVE_SCAN_LISTEN } passive_scan_state; struct timer_list tick_timer; unsigned long last_tick_timer; unsigned int sw_tick_stuck; /* commsQuality / dBmCommsQuality data from periodic polling; only * valid for Managed and Ad-hoc modes */ unsigned long last_comms_qual_update; int comms_qual; /* in some odd unit.. */ int avg_signal; /* in dB (note: negative) */ int avg_noise; /* in dB (note: negative) */ struct work_struct comms_qual_update; /* RSSI to dBm adjustment (for RX descriptor fields) */ int rssi_to_dBm; /* substract from RSSI to get approximate dBm value */ /* BSS list / protected by local->lock */ struct list_head bss_list; int num_bss_info; int wpa; /* WPA support enabled */ int tkip_countermeasures; int drop_unencrypted; /* Generic IEEE 802.11 info element to be added to * ProbeResp/Beacon/(Re)AssocReq */ u8 *generic_elem; size_t generic_elem_len;#ifdef PRISM2_DOWNLOAD_SUPPORT /* Persistent volatile download data */ struct prism2_download_data *dl_pri; struct prism2_download_data *dl_sec;#endif /* PRISM2_DOWNLOAD_SUPPORT */#ifdef PRISM2_IO_DEBUG#define PRISM2_IO_DEBUG_SIZE 10000 u32 io_debug[PRISM2_IO_DEBUG_SIZE]; int io_debug_head; int io_debug_enabled;#endif /* PRISM2_IO_DEBUG */ /* Pointer to hardware model specific (cs,pci,plx) private data. */ void *hw_priv;};/* Per interface private Host AP data * Allocated for each net device that Host AP uses (wlan#, wlan#ap, wlan#sta, * WDS) and netdev_priv(dev) points to this structure. */struct hostap_interface { struct list_head list; /* list entry in Host AP interface list */ struct net_device *dev; /* pointer to this device */ struct local_info *local; /* pointer to shared private data */ struct net_device_stats stats; struct iw_spy_data spy_data; /* iwspy support */ struct iw_public_data wireless_data; enum { HOSTAP_INTERFACE_MASTER, HOSTAP_INTERFACE_MAIN, HOSTAP_INTERFACE_AP, HOSTAP_INTERFACE_STA, HOSTAP_INTERFACE_WDS, } type; union { struct hostap_interface_wds { u8 remote_addr[ETH_ALEN]; } wds; } u;};#define HOSTAP_SKB_TX_DATA_MAGIC 0xf08a36a2/* * TX meta data - stored in skb->cb buffer, so this must not be increased over * the 40-byte limit */struct hostap_skb_tx_data { u32 magic; /* HOSTAP_SKB_TX_DATA_MAGIC */ u8 rate; /* transmit rate */#define HOSTAP_TX_FLAGS_WDS BIT(0)#define HOSTAP_TX_FLAGS_BUFFERED_FRAME BIT(1)#define HOSTAP_TX_FLAGS_ADD_MOREDATA BIT(2) u8 flags; /* HOSTAP_TX_FLAGS_* */ u16 tx_cb_idx; struct hostap_interface *iface; unsigned long jiffies; /* queueing timestamp */ unsigned short ethertype;};#ifndef PRISM2_NO_DEBUG#define DEBUG_FID BIT(0)#define DEBUG_PS BIT(1)#define DEBUG_FLOW BIT(2)#define DEBUG_AP BIT(3)#define DEBUG_HW BIT(4)#define DEBUG_EXTRA BIT(5)#define DEBUG_EXTRA2 BIT(6)#define DEBUG_PS2 BIT(7)#define DEBUG_MASK (DEBUG_PS | DEBUG_AP | DEBUG_HW | DEBUG_EXTRA)#define PDEBUG(n, args...) \do { if ((n) & DEBUG_MASK) printk(KERN_DEBUG args); } while (0)#define PDEBUG2(n, args...) \do { if ((n) & DEBUG_MASK) printk(args); } while (0)#else /* PRISM2_NO_DEBUG */#define PDEBUG(n, args...)#define PDEBUG2(n, args...)#endif /* PRISM2_NO_DEBUG */enum { BAP0 = 0, BAP1 = 1 };#define PRISM2_IO_DEBUG_CMD_INB 0#define PRISM2_IO_DEBUG_CMD_INW 1#define PRISM2_IO_DEBUG_CMD_INSW 2#define PRISM2_IO_DEBUG_CMD_OUTB 3#define PRISM2_IO_DEBUG_CMD_OUTW 4#define PRISM2_IO_DEBUG_CMD_OUTSW 5#define PRISM2_IO_DEBUG_CMD_ERROR 6#define PRISM2_IO_DEBUG_CMD_INTERRUPT 7#ifdef PRISM2_IO_DEBUG#define PRISM2_IO_DEBUG_ENTRY(cmd, reg, value) \(((cmd) << 24) | ((reg) << 16) | value)static inline void prism2_io_debug_add(struct net_device *dev, int cmd, int reg, int value){ struct hostap_interface *iface = netdev_priv(dev); local_info_t *local = iface->local; if (!local->io_debug_enabled) return; local->io_debug[local->io_debug_head] = jiffies & 0xffffffff; if (++local->io_debug_head >= PRISM2_IO_DEBUG_SIZE) local->io_debug_head = 0; local->io_debug[local->io_debug_head] = PRISM2_IO_DEBUG_ENTRY(cmd, reg, value); if (++local->io_debug_head >= PRISM2_IO_DEBUG_SIZE) local->io_debug_head = 0;}static inline void prism2_io_debug_error(struct net_device *dev, int err){ struct hostap_interface *iface = netdev_priv(dev); local_info_t *local = iface->local; unsigned long flags; if (!local->io_debug_enabled) return; spin_lock_irqsave(&local->lock, flags); prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_ERROR, 0, err); if (local->io_debug_enabled == 1) { local->io_debug_enabled = 0; printk(KERN_DEBUG "%s: I/O debug stopped\n", dev->name); } spin_unlock_irqrestore(&local->lock, flags);}#else /* PRISM2_IO_DEBUG */static inline void prism2_io_debug_add(struct net_device *dev, int cmd, int reg, int value){}static inline void prism2_io_debug_error(struct net_device *dev, int err){}#endif /* PRISM2_IO_DEBUG */#ifdef PRISM2_CALLBACKenum { /* Called when card is enabled */ PRISM2_CALLBACK_ENABLE, /* Called when card is disabled */ PRISM2_CALLBACK_DISABLE, /* Called when RX/TX starts/ends */ PRISM2_CALLBACK_RX_START, PRISM2_CALLBACK_RX_END, PRISM2_CALLBACK_TX_START, PRISM2_CALLBACK_TX_END};void prism2_callback(local_info_t *local, int event);#else /* PRISM2_CALLBACK */#define prism2_callback(d, e) do { } while (0)#endif /* PRISM2_CALLBACK */#endif /* __KERNEL__ */#endif /* HOSTAP_WLAN_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -