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.
This commit is contained in:
thorpej 2002-09-23 14:31:27 +00:00
parent 8972c9d466
commit 4f4dc45bbb
5 changed files with 1300 additions and 409 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: wi_hostap.c,v 1.1 2002/08/11 06:13:53 thorpej Exp $ */
/* $NetBSD: wi_hostap.c,v 1.2 2002/09/23 14:31:27 thorpej Exp $ */
/* $OpenBSD: if_wi_hostap.c,v 1.19 2002/06/25 01:59:52 millert Exp $ */
/*
@ -60,6 +60,7 @@
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_llc.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net/if_ether.h>
@ -218,7 +219,7 @@ wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
printf("Sending disassoc to sta %s\n", ether_sprintf(sta_addr));
/* Send disassoc packet. */
resp_hdr = (struct wi_80211_hdr *)sc->wi_txbuf;
resp_hdr = (struct wi_80211_hdr *)&sc->wi_txbuf;
memset(resp_hdr, 0, sizeof(struct wi_80211_hdr));
resp_hdr->frame_ctl = WI_FTYPE_MGMT | WI_STYPE_MGMT_DISAS;
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
@ -229,8 +230,7 @@ wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
put_hword(&pkt, reason);
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf,
2 + sizeof(struct wi_80211_hdr));
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf, pkt - (caddr_t)&sc->wi_txbuf);
}
/* wihap_sta_deauth()
@ -248,7 +248,7 @@ wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
printf("Sending deauth to sta %s\n", ether_sprintf(sta_addr));
/* Send deauth packet. */
resp_hdr = (struct wi_80211_hdr *)sc->wi_txbuf;
resp_hdr = (struct wi_80211_hdr *)&sc->wi_txbuf;
memset(resp_hdr, 0, sizeof(struct wi_80211_hdr));
resp_hdr->frame_ctl = htole16(WI_FTYPE_MGMT | WI_STYPE_MGMT_DEAUTH);
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
@ -259,8 +259,7 @@ wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason)
put_hword(&pkt, reason);
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf,
2 + sizeof(struct wi_80211_hdr));
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf, pkt - (caddr_t)&sc->wi_txbuf);
}
/* wihap_shutdown()
@ -326,8 +325,8 @@ sta_hash_func(u_int8_t addr[])
static __inline int
addr_cmp(u_int8_t a[], u_int8_t b[])
{
return (*(u_int16_t *)(a + 4) == *(u_int16_t *)(b + 4) &&
*(u_int32_t *)(a ) == *(u_int32_t *)(b));
return (*(u_int32_t *)(a ) == *(u_int32_t *)(b) &&
*(u_int16_t *)(a + 4) == *(u_int16_t *)(b + 4));
}
void
@ -388,6 +387,9 @@ wihap_sta_delete(struct wihap_sta_info *sta)
LIST_REMOVE(sta, hash);
if (sta->challenge)
FREE(sta->challenge, M_TEMP);
#if defined(WI_HOSTAP_POWERSAVE)
IFQ_PURGE(&sta->ps_q);
#endif
FREE(sta, M_DEVBUF);
whi->n_stations--;
}
@ -430,6 +432,11 @@ wihap_sta_alloc(struct wi_softc *sc, u_int8_t *addr)
callout_reset(&sta->tmo, hz * whi->inactivity_time,
wihap_sta_timeout, sta);
#if defined(WI_HOSTAP_POWERSAVE)
/* XXX name the constant. make it configurable. */
IFQ_SET_MAXLEN(&sta->ps_q, 3);
#endif
return (sta);
}
@ -656,9 +663,7 @@ fail:
put_tlv(&pkt, IEEE80211_ELEMID_CHALLENGE,
challenge, challenge_len);
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf,
6 + sizeof(struct wi_80211_hdr) +
(challenge_len > 0 ? challenge_len + 2 : 0));
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf, pkt - (caddr_t)&sc->wi_txbuf);
}
@ -678,6 +683,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
u_int16_t lstintvl;
u_int8_t rates[8];
int ssid_len, rates_len;
int reassociation;
struct ieee80211_nwid ssid;
u_int16_t status;
u_int16_t asid = 0;
@ -689,8 +695,10 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
capinfo = take_hword(&pkt, &len);
lstintvl = take_hword(&pkt, &len);
if ((rxfrm->wi_frame_ctl & htole16(WI_FCTL_STYPE)) ==
htole16(WI_STYPE_MGMT_REASREQ)) {
reassociation = ((rxfrm->wi_frame_ctl & htole16(WI_FCTL_STYPE)) ==
htole16(WI_STYPE_MGMT_REASREQ));
if (reassociation) {
if (len < 6)
return;
/* Eat the MAC address of the current AP */
@ -700,7 +708,7 @@ wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
}
if ((ssid_len = take_tlv(&pkt, &len, IEEE80211_ELEMID_SSID,
ssid.i_nwid, sizeof(ssid)))<0)
ssid.i_nwid, sizeof(ssid.i_nwid)))<0)
return;
ssid.i_len = ssid_len;
if ((rates_len = take_tlv(&pkt, &len, IEEE80211_ELEMID_RATES,
@ -788,7 +796,12 @@ fail:
/* Send response. */
resp_hdr = (struct wi_80211_hdr *)&sc->wi_txbuf;
memset(resp_hdr, 0, sizeof(struct wi_80211_hdr));
resp_hdr->frame_ctl = htole16(WI_FTYPE_MGMT | WI_STYPE_MGMT_ASRESP);
resp_hdr->frame_ctl = htole16(WI_FTYPE_MGMT);
if (reassociation) {
resp_hdr->frame_ctl |= htole16(WI_STYPE_MGMT_REASRESP);
} else {
resp_hdr->frame_ctl |= htole16(WI_STYPE_MGMT_ASRESP);
}
pkt = (caddr_t)&sc->wi_txbuf + sizeof(struct wi_80211_hdr);
bcopy(rxfrm->wi_addr2, resp_hdr->addr1, ETHER_ADDR_LEN);
@ -800,8 +813,7 @@ fail:
put_hword(&pkt, asid);
rates_len = put_rates(&pkt, sc->wi_supprates);
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf,
8 + rates_len + sizeof(struct wi_80211_hdr));
wi_mgmt_xmit(sc, (caddr_t)&sc->wi_txbuf, pkt - (caddr_t)&sc->wi_txbuf);
}
/* wihap_deauth_req()
@ -945,46 +957,48 @@ wihap_mgmt_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
wihap_debug_frame_type(rxfrm);
pkt = mtod(m, caddr_t) + WI_802_11_OFFSET_RAW;
len = m->m_len - WI_802_11_OFFSET_RAW;
pkt = mtod(m, caddr_t) + WI_SHORT_802_11_END;
len = m->m_len - WI_SHORT_802_11_END;
if ((rxfrm->wi_frame_ctl & htole16(WI_FCTL_FTYPE)) ==
if ((rxfrm->wi_frame_ctl & htole16(WI_FCTL_FTYPE)) !=
htole16(WI_FTYPE_MGMT)) {
/* any of the following will mess w/ the station list */
s = splsoftclock();
switch (le16toh(rxfrm->wi_frame_ctl) & WI_FCTL_STYPE) {
case WI_STYPE_MGMT_ASREQ:
wihap_assoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_ASRESP:
break;
case WI_STYPE_MGMT_REASREQ:
wihap_assoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_REASRESP:
break;
case WI_STYPE_MGMT_PROBEREQ:
break;
case WI_STYPE_MGMT_PROBERESP:
break;
case WI_STYPE_MGMT_BEACON:
break;
case WI_STYPE_MGMT_ATIM:
break;
case WI_STYPE_MGMT_DISAS:
wihap_disassoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_AUTH:
wihap_auth_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_DEAUTH:
wihap_deauth_req(sc, rxfrm, pkt, len);
break;
}
splx(s);
m_freem(m);
return;
}
/* any of the following will mess w/ the station list */
s = splsoftclock();
switch (le16toh(rxfrm->wi_frame_ctl) & WI_FCTL_STYPE) {
case WI_STYPE_MGMT_ASREQ:
wihap_assoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_ASRESP:
break;
case WI_STYPE_MGMT_REASREQ:
wihap_assoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_REASRESP:
break;
case WI_STYPE_MGMT_PROBEREQ:
break;
case WI_STYPE_MGMT_PROBERESP:
break;
case WI_STYPE_MGMT_BEACON:
break;
case WI_STYPE_MGMT_ATIM:
break;
case WI_STYPE_MGMT_DISAS:
wihap_disassoc_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_AUTH:
wihap_auth_req(sc, rxfrm, pkt, len);
break;
case WI_STYPE_MGMT_DEAUTH:
wihap_deauth_req(sc, rxfrm, pkt, len);
break;
}
splx(s);
m_freem(m);
}
@ -1009,18 +1023,51 @@ wihap_sta_is_assoc(struct wihap_info *whi, u_int8_t addr[])
return (0);
}
#if defined(WI_HOSTAP_POWERSAVE)
/* wihap_dequeue()
*
* Dequeue a PS-Poll'd frame, if any.
*/
struct mbuf *
wihap_dequeue(struct wihap_info *whi, int *more_data)
{
*more_data = 0;
/* TBD Keep a circular queue of STAs who PS Poll'd. At time of
* PS Poll, label a STA with the time of PS Poll and put it
* on the tail of the queue. In this procedure, take STAs off
* the queue whose last Poll was too long ago for a reply to
* arrive in time. Dequeue one frame from the STA on the front
* of the queue. If any frame remains on the STAs queue, set
* *more_data = 1. Otherwise, set *more_data = 0.
*/
/* TBD Keep a second queue of STAs with PS traffic queued. Use
* the second queue to produce the TIM. Possibly age STAs.
*/
/* TBD Remove a STA from both queues before freeing it. */
return 0;
}
#endif /* WI_HOSTAP_POWERSAVE */
/* wihap_check_tx()
*
* Determine if a station is assoc'ed, get its tx rate, and update
* its activity.
* its activity. Return 1 (send frame), 0 (drop frame), -1 (frame
* power-save queued).
*/
int
wihap_check_tx(struct wihap_info *whi, u_int8_t addr[], u_int8_t *txrate)
wihap_check_tx(struct wi_softc *sc, struct mbuf *m, u_int8_t *txrate)
{
u_int8_t *addr;
struct wihap_info *whi;
struct wihap_sta_info *sta;
static u_int8_t txratetable[] = { 10, 20, 55, 110 };
int s;
whi = &sc->wi_hostap_info;
addr = mtod(m, struct ether_header*)->ether_dhost;
if (addr[0] & 0x01) {
*txrate = 0; /* XXX: multicast rate? */
return (1);
@ -1028,17 +1075,32 @@ wihap_check_tx(struct wihap_info *whi, u_int8_t addr[], u_int8_t *txrate)
s = splsoftclock();
sta = wihap_sta_find(whi, addr);
if (sta != NULL && (sta->flags & WI_SIFLAGS_ASSOC)) {
/* Keep it active. */
callout_reset(&sta->tmo, hz * whi->inactivity_time,
wihap_sta_timeout, sta);
*txrate = txratetable[sta->tx_curr_rate];
splx(s);
return (1);
}
splx(s);
return (0);
if (sta == NULL || !(sta->flags & WI_SIFLAGS_ASSOC)) {
splx(s);
if (sc->sc_ifp->if_flags & IFF_DEBUG)
printf("%s: Host-AP: dropping unassoc dst %s\n",
sc->sc_dev.dv_xname,
ether_sprintf(addr));
m_freem(m);
return (0);
}
/* Keep it active. */
callout_reset(&sta->tmo, hz * whi->inactivity_time,
wihap_sta_timeout, sta);
*txrate = txratetable[sta->tx_curr_rate];
#if defined(WI_HOSTAP_POWERSAVE)
if ((sta->flags & WI_SIFLAGS_ASLEEP) &&
!(sta->flags & WI_SIFLAGS_PSPOLL)) {
IFQ_ENQUEUE(&sta->ps_q, m);
splx(s);
return (0);
}
sta->flags &= ~WI_SIFLAGS_PSPOLL;
#endif /* WI_HOSTAP_POWERSAVE */
splx(s);
return (1);
}
/*
@ -1104,8 +1166,7 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
mcast = (rxfrm->wi_addr3[0] & 0x01) != 0;
if (mcast || wihap_sta_is_assoc(whi, rxfrm->wi_addr3)) {
/* If it's multicast, make a copy.
*/
/* If it's multicast, make a copy. */
if (mcast) {
m = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
if (m == NULL)
@ -1113,13 +1174,11 @@ wihap_data_input(struct wi_softc *sc, struct wi_frame *rxfrm, struct mbuf *m)
m->m_flags |= M_MCAST; /* XXX */
}
/* Queue up for repeating.
*/
/* Queue up for repeating. */
if (IF_QFULL(&ifp->if_snd)) {
IF_DROP(&ifp->if_snd);
m_freem(m);
}
else {
} else {
ifp->if_obytes += m->m_pkthdr.len;
if (m->m_flags & M_MCAST)
ifp->if_omcasts++;
@ -1216,6 +1275,9 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data)
}
sta = wihap_sta_alloc(sc, reqsta.addr);
sta->flags = reqsta.flags;
#if defined(WI_HOSTAP_POWERSAVE)
sta->flags &= ~(HOSTAP_FLAGS_ASLEEP | HOSTAP_FLAGS_PSPOLL);
#endif
callout_reset(&sta->tmo, hz * whi->inactivity_time,
wihap_sta_timeout, sta);
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wi_hostap.h,v 1.1 2002/08/11 06:13:54 thorpej Exp $ */
/* $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 $ */
/*
@ -50,7 +50,10 @@ struct hostap_sta {
#define HOSTAP_FLAGS_AUTHEN 0x0001
#define HOSTAP_FLAGS_ASSOC 0x0002
#define HOSTAP_FLAGS_PERM 0x0004
#define HOSTAP_FLAGS_BITS "\20\01ASSOC\02AUTH\03PERM"
#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)
@ -91,11 +94,18 @@ struct wihap_sta_info {
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
@ -123,7 +133,7 @@ struct wihap_info {
struct wi_softc;
struct wi_frame;
int wihap_check_tx(struct wihap_info *, u_int8_t [], u_int8_t *);
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 *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: wireg.h,v 1.38 2002/08/11 21:49:40 thorpej Exp $ */
/* $NetBSD: wireg.h,v 1.39 2002/09/23 14:31:28 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -209,6 +209,8 @@
#define WI_IOSIZE 0x40
#define WI_PCI_CBMA 0x10 /* Configuration Base Memory Address */
#define WI_PCI_COR_OFFSET 0x4C
/*
* Hermes & Prism2 register definitions
*/
@ -359,6 +361,9 @@
#define WI_PCI_MASTER0_LEN 0x88
#define WI_PCI_MASTER0_CON 0x8C
#define WI_COR_SOFT_RESET (1 << 7)
#define WI_COR_CLEAR 0x00
#define WI_PCI_STATUS 0x98
#define WI_PCI_MASTER1_ADDRH 0xA0
@ -711,15 +716,28 @@ struct wi_frame {
u_int8_t wi_dst_addr[6]; /* 0x2E */
u_int8_t wi_src_addr[6]; /* 0x34 */
u_int16_t wi_len; /* 0x3A */
u_int16_t wi_dat[3]; /* 0x3C */ /* SNAP header */
u_int16_t wi_type; /* 0x42 */
#if 0
struct llc wi_llc; /* 0x3C */ /* SNAP header */
#endif
};
#define WI_TX_BUFSIZE (ETHER_MAX_LEN + sizeof(struct wi_frame) + 8)
#define WI_802_3_OFFSET 0x2E
#define WI_802_11_OFFSET 0x44
#define WI_802_11_OFFSET_RAW 0x3C
#define WI_802_11_OFFSET_HDR 0x0E
#define WI_HWSPEC_END 0x0E
#define WI_802_11_BEGIN 0x0E
#define WI_SHORT_802_11_END 0x26
#define WI_LONG_802_11_END 0x2C
#define WI_802_3_BEGIN 0x2E
#define WI_802_3_END 0x3C
#define WI_DATA_BEGIN 0x3C
#define WI_LLC_BEGIN 0x3C
#define WI_LLC_END 0x44
/* Tx Status Field */
#define WI_TXSTAT_RET_ERR 0x0001
#define WI_TXSTAT_AGED_ERR 0x0002
@ -733,23 +751,18 @@ struct wi_frame {
#define WI_STAT_MAC_PORT 0x0700
#define WI_STAT_PCF 0x1000
#define WI_RXSTAT_MSG_TYPE 0xE000
#define WI_STAT_NORMAL 0x0000
#define WI_STAT_1042 0x2000 /* RFC1042 encoded */
#define WI_STAT_TUNNEL 0x4000 /* Bridge-tunnel encoded */
#define WI_STAT_WMP_MSG 0x6000 /* WaveLAN-II management protocol */
#define WI_STAT_MGMT 0x8000 /* 802.11b management frames */
#define WI_ENC_TX_MGMT 0x08
#define WI_ENC_TX_E_II 0x0E
#define WI_ENC_TX_1042 0x00
#define WI_ENC_TX_TUNNEL 0xF8
/* TxControl Field (enhanced) */
#define WI_TXCNTL_TX_OK 0x0002
#define WI_TXCNTL_TX_EX 0x0004
#define WI_TXCNTL_STRUCT_TYPE 0x0018
#define WI_ENC_TX_802_3 0x00
#define WI_ENC_TX_802_11 0x11
#define WI_ENC_TX_802_11 0x08
#define WI_TXCNTL_ALTRTRY 0x0020
#define WI_TXCNTL_NOCRYPT 0x0080
@ -759,9 +772,4 @@ struct wi_frame {
* We need these for the LLC/SNAP header fields in the TX/RX frame
* structure.
*/
#define WI_SNAP_K1 0xaa /* assigned global SAP for SNAP */
#define WI_SNAP_K2 0x00
#define WI_SNAP_CONTROL 0x03 /* unnumbered information format */
#define WI_SNAP_WORD0 (WI_SNAP_K1 | (WI_SNAP_K1 << 8))
#define WI_SNAP_WORD1 (WI_SNAP_K2 | (WI_SNAP_CONTROL << 8))
#define WI_SNAPHDR_LEN 0x6
#define WI_SNAP_LEN 8

View File

@ -1,4 +1,4 @@
/* $NetBSD: wivar.h,v 1.18 2002/08/11 21:50:06 thorpej Exp $ */
/* $NetBSD: wivar.h,v 1.19 2002/09/23 14:31:28 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -66,6 +66,8 @@ struct wi_softc {
u_int8_t sc_macaddr[ETHER_ADDR_LEN];
u_int16_t wi_txbuf[(sizeof(struct wi_frame) + 2312) / 2];
struct ifmedia sc_media;
int wi_flags;
int wi_tx_data_id;
@ -78,7 +80,7 @@ struct wi_softc {
u_int16_t wi_ap_density;
u_int16_t wi_tx_rate;
u_int16_t wi_create_ibss;
u_int16_t wi_channel;
u_int16_t wi_channels;
u_int16_t wi_pm_enabled;
u_int16_t wi_mor_enabled;
u_int16_t wi_max_sleep;
@ -90,13 +92,21 @@ struct wi_softc {
struct ieee80211_nwid wi_netid;
struct ieee80211_nwid wi_ibssid;
u_int16_t wi_txbuf[1596 / 2];
int wi_use_wep;
int wi_do_host_encrypt;
int wi_tx_key;
struct wi_ltv_keys wi_keys;
struct wi_counters wi_stats;
u_int16_t wi_ibss_port;
u_int8_t wi_current_bssid[IEEE80211_ADDR_LEN];
u_int16_t wi_current_channel; /* current BSS channel */
u_int8_t wi_join_bssid[IEEE80211_ADDR_LEN];
u_int16_t wi_join_channel; /* channel of BSS to join */
u_int16_t wi_create_channel;/* channel of BSS to create */
struct wi_apinfo wi_aps[MAXAPINFO];
int wi_naps;
int wi_scanning; /* scan mode */
@ -104,6 +114,9 @@ struct wi_softc {
struct wihap_info wi_hostap_info;
u_int32_t wi_icv;
int wi_icv_flag;
caddr_t sc_bpf80211;
caddr_t sc_bpf80211plus;
};
/* Values for wi_flags. */
@ -116,6 +129,9 @@ struct wi_softc {
#define WI_FLAGS_HAS_ROAMING 0x0040
#define WI_FLAGS_HAS_DIVERSITY 0x0080
#define WI_FLAGS_HAS_HOSTAP 0x0100
#define WI_FLAGS_CONNECTED 0x0200
#define WI_FLAGS_AP_IN_RANGE 0x0400
#define WI_FLAGS_JOINING 0x0800
struct wi_card_ident {
u_int16_t card_id;