NetBSD/sys/dev/ic/wi_hostap.h
thorpej 4f4dc45bbb Jumbo patch, from David Young <dyoung@ojctech.com>, with small tweaks
by me:
* Speed up reading/writing buffers from the hardware by avoiding
  slow forward seeks.  In preparation to use the optimization, do
  not read overlapping bytes.  This is currently disabled, but can
  be enabled with OPTIMIZE_RW_DATA.
* Hand 802.11 and Prism-specific frames to BPF.  User can watch these
  frames by specifying an alternate DLT to e.g. tcpdump(8).
* Add support for SIOC[SG]80211BSSID and SIOC[SG]80211CHANNEL.
* Issue join requests and track join/create state through link-status
  notifications.
* Split wi_rxeof into separate routines for receiving Ethernet II,
  802.11 data, and 802.11 management frames.
* Bug fix: Account for aligning m_data to a word boundary in the Rx
  buffer size check.
* Bug fix: Check for LLC/SNAP even if the firmware tells us the frame
  is Ethernet II, as the firmware sometimes gets this wrong.
* Process as many events as possible when we get an interrupt, using
  a simple heuristic to avoid reprocessing an event (which can have
  bad side-effects).  Clamp the time spent in the interrupt handler
  to 4ms.
* Redo the timeout loops to be consistent and less prone to error.
* Add delays to timeout loops which were missing them, so that a
  fast CPU won't win the race.
* Borrow some timeout loop values from the linux-wlan-ng driver,
  which seems to reflect a high level of clue (due to direct support
  from Intersil).
* Get rid of silly wi_read_data(..., len + 2) idiom; simply round up
  in wi_read_data() and wi_write_data().  Also, protect against a
  length of 0.
* Name some frequently-used constants.  Correct spelling.  Other style nits.
* Bug fix: On Prism, set Create IBSS register to 0 *always*.  The meaning
  of Create IBSS == 1 is join an IBSS or *ESS*, and we do not want to
  join an ESS, because that would put us in an inconsistent state.  0
  is the right value for Prism.
* Bug fix: Clean up state at the top of wi_init(), in the event that
  we don't reach the bottom.
* Simplify wi_start() by always providing an RFC1042-encoded 802.11
  frame to the firmware.
* Larval powersave support for HostAP mode, enabled by WI_HOSTAP_POWERSAVE.
* Bug fix: Call wi_stop() from wi_shutdown().
* Bug fix: sync media options with HostAP mode in wi_sync_media().
* In wi_media_status(), inquire firmware for current media state if
  media == auto.  From FreeBSD.
* Clean up the way buffer lengths are computed by using pointer
  arithmetic rather than magic constants.
* Swap the order of comparisons in addr_cmp() for speed.
* Bug fix: Send ReAssoc Response instead of Assoc Response to a
  ReAssoc Request.
* Bug fix: Copy SSID using the correct size.
* Give more meaningful names to offsets in a wi_frame.
* Bug fix: Assign the right values to the named constants for
  Rx frame encoding.
* Get rid of useless SNAP constants.
2002-09-23 14:31:27 +00:00

145 lines
4.6 KiB
C

/* $NetBSD: wi_hostap.h,v 1.2 2002/09/23 14:31:28 thorpej Exp $ */
/* $OpenBSD: if_wi_hostap.h,v 1.6 2002/06/08 22:19:47 millert Exp $ */
/*
* Copyright (c) 2002
* Thomas Skibo <skibo@pacbell.net>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Thomas Skibo.
* 4. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Thomas Skibo AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Thomas Skibo OR HIS DRINKING PALS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __WI_HOSTAP_H__
#define __WI_HOSTAP_H__
#define WIHAP_MAX_STATIONS 1800
struct hostap_sta {
u_int8_t addr[6];
u_int16_t asid;
u_int16_t flags;
u_int16_t sig_info; /* 15:8 signal, 7:0 noise */
u_int16_t capinfo;
u_int8_t rates;
};
#define HOSTAP_FLAGS_AUTHEN 0x0001
#define HOSTAP_FLAGS_ASSOC 0x0002
#define HOSTAP_FLAGS_PERM 0x0004
#if defined(WI_HOSTAP_POWERSAVE)
#define HOSTAP_FLAGS_ASLEEP 0x0008
#define HOSTAP_FLAGS_PSPOLL 0x0010
#endif /* WI_HOSTAP_POWERSAVE */
#define SIOCHOSTAP_GET _IOWR('i', 210, struct ifreq)
#define SIOCHOSTAP_ADD _IOWR('i', 211, struct ifreq)
#define SIOCHOSTAP_DEL _IOWR('i', 212, struct ifreq)
#define SIOCHOSTAP_GETALL _IOWR('i', 213, struct ifreq)
#define SIOCHOSTAP_GFLAGS _IOWR('i', 214, struct ifreq)
#define SIOCHOSTAP_SFLAGS _IOWR('i', 215, struct ifreq)
/* Flags for SIOCHOSTAP_GFLAGS/SFLAGS */
#define WIHAPFL_ACTIVE 0x0001
#define WIHAPFL_MAC_FILT 0x0002
/* Flags set inernally only: */
#define WIHAPFL_CANTCHANGE (WIHAPFL_ACTIVE)
struct hostap_getall {
int nstations;
struct hostap_sta *addr;
int size;
};
#ifdef _KERNEL
struct wihap_sta_info {
LIST_ENTRY(wihap_sta_info) list;
LIST_ENTRY(wihap_sta_info) hash;
struct wi_softc *sc;
u_int8_t addr[6];
u_short flags;
struct callout tmo;
u_int16_t asid;
u_int16_t capinfo;
u_int16_t sig_info; /* 15:8 signal, 7:0 noise */
u_int8_t rates;
u_int8_t tx_curr_rate;
u_int8_t tx_max_rate;
u_int32_t *challenge;
#if defined(WI_HOSTAP_POWERSAVE)
struct altq ps_q;
#endif
};
#define WI_SIFLAGS_ASSOC HOSTAP_FLAGS_ASSOC
#define WI_SIFLAGS_AUTHEN HOSTAP_FLAGS_AUTHEN
#define WI_SIFLAGS_PERM HOSTAP_FLAGS_PERM
#if defined(WI_HOSTAP_POWERSAVE)
#define WI_SIFLAGS_ASLEEP HOSTAP_FLAGS_ASLEEP
#define WI_SIFLAGS_PSPOLL HOSTAP_FLAGS_PSPOLL
#endif /* WI_HOSTAP_POWERSAVE */
#define WI_STA_HASH_SIZE 113
#if WI_STA_HASH_SIZE*16 >= 2007 /* will generate ASID's too large. */
#error "WI_STA_HASH_SIZE too big"
#endif
#if WI_STA_HASH_SIZE*16 < WIHAP_MAX_STATIONS
#error "WI_STA_HASH_SIZE too small"
#endif
struct wihap_info {
LIST_HEAD(sta_list, wihap_sta_info) sta_list;
LIST_HEAD(sta_hash, wihap_sta_info) sta_hash[WI_STA_HASH_SIZE];
u_int16_t apflags;
int n_stations;
u_int16_t asid_inuse_mask[WI_STA_HASH_SIZE];
int inactivity_time;
};
#define WIHAP_DFLT_INACTIVITY_TIME (120) /* 2 minutes */
struct wi_softc;
struct wi_frame;
int wihap_check_tx(struct wi_softc *, struct mbuf *, u_int8_t *);
int wihap_data_input(struct wi_softc *, struct wi_frame *, struct mbuf *);
int wihap_ioctl(struct wi_softc *, u_long, caddr_t);
void wihap_init(struct wi_softc *);
void wihap_mgmt_input(struct wi_softc *, struct wi_frame *, struct mbuf *);
void wihap_shutdown(struct wi_softc *);
#endif /* _KERNEL */
#endif /* __WI_HOSTAP_H__ */