Actually declare the structures used in iwn_scan_hdr instead of using
pointer arithmetic to create the elements on the fly. Other changes to scan routine taken from FreeBSD driver.
This commit is contained in:
parent
2f839a2253
commit
a920095679
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_iwn.c,v 1.26 2008/11/07 14:58:27 joerg Exp $ */
|
||||
/* $NetBSD: if_iwn.c,v 1.27 2008/11/13 12:04:09 blymn Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007
|
||||
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.26 2008/11/07 14:58:27 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.27 2008/11/13 12:04:09 blymn Exp $");
|
||||
|
||||
|
||||
/*
|
||||
|
@ -3194,27 +3194,24 @@ iwn_auth(struct iwn_softc *sc)
|
|||
/* update adapter's configuration */
|
||||
sc->config.associd = 0;
|
||||
IEEE80211_ADDR_COPY(sc->config.bssid, ni->ni_bssid);
|
||||
sc->config.chan = ieee80211_chan2ieee(ic, ni->ni_chan);
|
||||
sc->config.chan = htole16(ieee80211_chan2ieee(ic, ni->ni_chan));
|
||||
sc->config.flags = htole32(IWN_CONFIG_TSF);
|
||||
if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) {
|
||||
sc->config.flags |= htole32(IWN_CONFIG_AUTO |
|
||||
IWN_CONFIG_24GHZ);
|
||||
}
|
||||
switch (ic->ic_curmode) {
|
||||
case IEEE80211_MODE_11A:
|
||||
if (IEEE80211_IS_CHAN_A(ni->ni_chan)) {
|
||||
sc->config.cck_mask = 0;
|
||||
sc->config.ofdm_mask = 0x15;
|
||||
break;
|
||||
case IEEE80211_MODE_11B:
|
||||
} else if (IEEE80211_IS_CHAN_B(ni->ni_chan)) {
|
||||
sc->config.cck_mask = 0x03;
|
||||
sc->config.ofdm_mask = 0;
|
||||
break;
|
||||
default: /* assume 802.11b/g */
|
||||
} else {
|
||||
/* assume 802.11b/g */
|
||||
sc->config.cck_mask = 0xf;
|
||||
sc->config.ofdm_mask = 0x15;
|
||||
}
|
||||
|
||||
/* iwn_enable_tsf(sc, ni);*/
|
||||
if (ic->ic_flags & IEEE80211_F_SHSLOT)
|
||||
sc->config.flags |= htole32(IWN_CONFIG_SHSLOT);
|
||||
if (ic->ic_flags & IEEE80211_F_SHPREAMBLE)
|
||||
|
@ -3361,7 +3358,6 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
|
|||
struct iwn_tx_cmd *cmd;
|
||||
struct iwn_cmd_data *tx;
|
||||
struct iwn_scan_hdr *hdr;
|
||||
struct iwn_scan_essid *essid;
|
||||
struct iwn_scan_chan *chan;
|
||||
struct ieee80211_frame *wh;
|
||||
struct ieee80211_rateset *rs;
|
||||
|
@ -3420,8 +3416,7 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
|
|||
/* select Ant B and Ant C for scanning */
|
||||
hdr->rxchain = htole16(0x3e1 | 7 << IWN_RXCHAIN_ANTMSK_SHIFT);
|
||||
|
||||
tx = (struct iwn_cmd_data *)(hdr + 1);
|
||||
memset(tx, 0, sizeof (struct iwn_cmd_data));
|
||||
tx = &(hdr->tx_cmd);
|
||||
/*
|
||||
* linux
|
||||
* flags = IWN_TX_AUTO_SEQ
|
||||
|
@ -3446,17 +3441,15 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
|
|||
tx->rflags |= IWN_RFLAG_CCK;
|
||||
}
|
||||
|
||||
essid = (struct iwn_scan_essid *)(tx + 1);
|
||||
memset(essid, 0, 4 * sizeof (struct iwn_scan_essid));
|
||||
essid[0].id = IEEE80211_ELEMID_SSID;
|
||||
essid[0].len = ic->ic_des_esslen;
|
||||
memcpy(essid[0].data, ic->ic_des_essid, ic->ic_des_esslen);
|
||||
hdr->scan_essid[0].id = IEEE80211_ELEMID_SSID;
|
||||
hdr->scan_essid[0].len = ic->ic_des_esslen;
|
||||
memcpy(hdr->scan_essid[0].data, ic->ic_des_essid, ic->ic_des_esslen);
|
||||
|
||||
/*
|
||||
* Build a probe request frame. Most of the following code is a
|
||||
* copy & paste of what is done in net80211.
|
||||
*/
|
||||
wh = (struct ieee80211_frame *)&essid[4];
|
||||
wh = &(hdr->wh);
|
||||
wh->i_fc[0] = IEEE80211_FC0_VERSION_0 | IEEE80211_FC0_TYPE_MGT |
|
||||
IEEE80211_FC0_SUBTYPE_PROBE_REQ;
|
||||
wh->i_fc[1] = IEEE80211_FC1_DIR_NODS;
|
||||
|
@ -3466,11 +3459,13 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags)
|
|||
*(u_int16_t *)&wh->i_dur[0] = 0; /* filled by h/w */
|
||||
*(u_int16_t *)&wh->i_seq[0] = 0; /* filled by h/w */
|
||||
|
||||
frm = (uint8_t *)(wh + 1);
|
||||
frm = &(hdr->data[0]);
|
||||
|
||||
/* add empty SSID IE (firmware generates it for directed scans) */
|
||||
/* add empty SSID IE */
|
||||
*frm++ = IEEE80211_ELEMID_SSID;
|
||||
*frm++ = 0;
|
||||
*frm++ = ic->ic_des_esslen;
|
||||
memcpy(frm, ic->ic_des_essid, ic->ic_des_esslen);
|
||||
frm += ic->ic_des_esslen;
|
||||
|
||||
mode = ieee80211_chan2mode(ic, ic->ic_ibss_chan);
|
||||
rs = &ic->ic_sup_rates[mode];
|
||||
|
@ -3596,7 +3591,7 @@ iwn_config(struct iwn_softc *sc)
|
|||
IEEE80211_ADDR_COPY(sc->config.myaddr, ic->ic_myaddr);
|
||||
IEEE80211_ADDR_COPY(sc->config.wlap, ic->ic_myaddr);
|
||||
/* set default channel */
|
||||
sc->config.chan = ieee80211_chan2ieee(ic, ic->ic_ibss_chan);
|
||||
sc->config.chan = htole16(ieee80211_chan2ieee(ic, ic->ic_ibss_chan));
|
||||
sc->config.flags = htole32(IWN_CONFIG_TSF);
|
||||
if (IEEE80211_IS_CHAN_2GHZ(ic->ic_ibss_chan)) {
|
||||
sc->config.flags |= htole32(IWN_CONFIG_AUTO |
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_iwnreg.h,v 1.4 2008/10/13 12:39:26 blymn Exp $ */
|
||||
/* $NetBSD: if_iwnreg.h,v 1.5 2008/11/13 12:04:09 blymn Exp $ */
|
||||
/* OpenBSD: if_iwnreg.h,v 1.9 2007/11/27 20:59:40 damien Exp */
|
||||
|
||||
/*-
|
||||
|
@ -314,8 +314,7 @@ struct iwn_config {
|
|||
#define IWN_FILTER_NODECRYPT (1 << 3)
|
||||
#define IWN_FILTER_BSS (1 << 5)
|
||||
|
||||
uint8_t chan;
|
||||
uint8_t reserved5;
|
||||
uint16_t chan;
|
||||
uint8_t ht_single_mask;
|
||||
uint8_t ht_dual_mask;
|
||||
} __packed;
|
||||
|
@ -524,23 +523,24 @@ struct iwn_scan_essid {
|
|||
uint8_t data[IEEE80211_NWID_LEN];
|
||||
} __packed;
|
||||
|
||||
struct iwn_scan_hdr {
|
||||
uint16_t len;
|
||||
uint8_t reserved1;
|
||||
uint8_t nchan;
|
||||
uint16_t quiet;
|
||||
uint16_t plcp_threshold;
|
||||
uint16_t crc_threshold;
|
||||
uint16_t rxchain;
|
||||
uint32_t max_svc; /* background scans */
|
||||
uint32_t pause_svc; /* background scans */
|
||||
uint32_t flags;
|
||||
uint32_t filter;
|
||||
#define IWN_MAX_PROBES 4
|
||||
|
||||
/* followed by a struct iwn_cmd_data */
|
||||
/* followed by an array of 4x struct iwn_scan_essid */
|
||||
/* followed by probe request body */
|
||||
/* followed by nchan x struct iwn_scan_chan */
|
||||
struct iwn_scan_hdr {
|
||||
uint16_t len;
|
||||
uint8_t reserved1;
|
||||
uint8_t nchan;
|
||||
uint16_t quiet;
|
||||
uint16_t plcp_threshold;
|
||||
uint16_t crc_threshold;
|
||||
uint16_t rxchain;
|
||||
uint32_t max_svc; /* background scans */
|
||||
uint32_t pause_svc; /* background scans */
|
||||
uint32_t flags;
|
||||
uint32_t filter;
|
||||
struct iwn_cmd_data tx_cmd;
|
||||
struct iwn_scan_essid scan_essid[IWN_MAX_PROBES];
|
||||
struct ieee80211_frame wh;
|
||||
uint8_t data[0]; /* nchan x struct iwn_scan_chan */
|
||||
} __packed;
|
||||
|
||||
struct iwn_scan_chan {
|
||||
|
|
Loading…
Reference in New Issue