summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2005-10-06 20:33:40 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2005-10-06 20:33:40 +0000
commit6074de87468e472d0716f0e6679edf278c3f2885 (patch)
tree41fc30f39866cad3bd721b559dab696659ba916d
parent596546c95de7449a73e8ccc908844a480de93869 (diff)
o Use firmware extended scan command; this one doesn't crash when scanning
the 5GHz band. o Enable 802.11a channels scanning for 2915ABG adapters. o Fix a typo (negociated->negotiated).
-rw-r--r--sys/dev/pci/if_iwi.c27
-rw-r--r--sys/dev/pci/if_iwireg.h27
2 files changed, 32 insertions, 22 deletions
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index 7a62f676d88..fb90d755579 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwi.c,v 1.49 2005/09/19 20:01:11 damien Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.50 2005/10/06 20:33:39 damien Exp $ */
/*-
* Copyright (c) 2004, 2005
@@ -252,7 +252,6 @@ iwi_attach(struct device *parent, struct device *self, void *aux)
printf(", address %s\n", ether_sprintf(ic->ic_myaddr));
-#if 0
if (PCI_PRODUCT(pa->pa_id) >= PCI_PRODUCT_INTEL_PRO_WL_2915ABG_1) {
/* set supported .11a rates */
ic->ic_sup_rates[IEEE80211_MODE_11A] = iwi_rateset_11a;
@@ -269,7 +268,6 @@ iwi_attach(struct device *parent, struct device *self, void *aux)
ic->ic_channels[i].ic_flags = IEEE80211_CHAN_A;
}
}
-#endif
/* set supported .11b and .11g rates */
ic->ic_sup_rates[IEEE80211_MODE_11B] = iwi_rateset_11b;
@@ -1820,10 +1818,10 @@ iwi_set_chan(struct iwi_softc *sc, struct ieee80211_channel *chan)
struct iwi_scan scan;
bzero(&scan, sizeof scan);
- scan.type = IWI_SCAN_TYPE_PASSIVE;
- scan.intval = htole16(2000);
- scan.channels[0] = 1 | (IEEE80211_IS_CHAN_5GHZ(chan) ? IWI_CHAN_5GHZ :
- IWI_CHAN_2GHZ);
+ memset(scan.type, 26, IWI_SCAN_TYPE_PASSIVE);
+ scan.passive = htole16(2000);
+ scan.channels[0] = 1 |
+ (IEEE80211_IS_CHAN_5GHZ(chan) ? IWI_CHAN_5GHZ : IWI_CHAN_2GHZ);
scan.channels[1] = ieee80211_chan2ieee(ic, chan);
DPRINTF(("Setting channel to %u\n", ieee80211_chan2ieee(ic, chan)));
@@ -1839,9 +1837,14 @@ iwi_scan(struct iwi_softc *sc)
int i, count;
bzero(&scan, sizeof scan);
- scan.type = (ic->ic_des_esslen != 0) ? IWI_SCAN_TYPE_BDIRECTED :
- IWI_SCAN_TYPE_BROADCAST;
- scan.intval = htole16(40);
+
+ if (ic->ic_des_esslen != 0) {
+ scan.bdirected = htole16(40);
+ memset(scan.type, 26, IWI_SCAN_TYPE_BDIRECTED);
+ } else {
+ scan.broadcast = htole16(40);
+ memset(scan.type, 26, IWI_SCAN_TYPE_BROADCAST);
+ }
p = scan.channels;
count = 0;
@@ -1906,10 +1909,10 @@ iwi_auth_and_assoc(struct iwi_softc *sc)
if (error != 0)
return error;
- /* the rate set has already been "negociated" */
+ /* the rate set has already been "negotiated" */
rs.mode = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? IWI_MODE_11A :
IWI_MODE_11G;
- rs.type = IWI_RATESET_TYPE_NEGOCIATED;
+ rs.type = IWI_RATESET_TYPE_NEGOTIATED;
rs.nrates = ni->ni_rates.rs_nrates;
bcopy(ni->ni_rates.rs_rates, rs.rates, rs.nrates);
DPRINTF(("Setting negociated rates (%u)\n", rs.nrates));
diff --git a/sys/dev/pci/if_iwireg.h b/sys/dev/pci/if_iwireg.h
index e347ed75c55..98c6ef29d75 100644
--- a/sys/dev/pci/if_iwireg.h
+++ b/sys/dev/pci/if_iwireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwireg.h,v 1.16 2005/09/19 20:01:12 damien Exp $ */
+/* $OpenBSD: if_iwireg.h,v 1.17 2005/10/06 20:33:39 damien Exp $ */
/*-
* Copyright (c) 2004, 2005
@@ -250,9 +250,9 @@ struct iwi_cmd_desc {
#define IWI_CMD_SET_FRAG_THRESHOLD 16
#define IWI_CMD_SET_POWER_MODE 17
#define IWI_CMD_SET_WEP_KEY 18
-#define IWI_CMD_SCAN 20
#define IWI_CMD_ASSOCIATE 21
#define IWI_CMD_SET_RATES 22
+#define IWI_CMD_SCAN 26
#define IWI_CMD_DISABLE 33
#define IWI_CMD_SET_IV 34
#define IWI_CMD_SET_TX_POWER 35
@@ -284,7 +284,7 @@ struct iwi_rateset {
u_int8_t mode;
u_int8_t nrates;
u_int8_t type;
-#define IWI_RATESET_TYPE_NEGOCIATED 0
+#define IWI_RATESET_TYPE_NEGOTIATED 0
#define IWI_RATESET_TYPE_SUPPORTED 1
u_int8_t reserved;
u_int8_t rates[12];
@@ -326,16 +326,23 @@ struct iwi_associate {
/* structure for command IWI_CMD_SCAN */
struct iwi_scan {
- u_int8_t type;
-#define IWI_SCAN_TYPE_PASSIVE 1
-#define IWI_SCAN_TYPE_DIRECTED 2
-#define IWI_SCAN_TYPE_BROADCAST 3
-#define IWI_SCAN_TYPE_BDIRECTED 4
- u_int16_t intval;
+ u_int32_t index;
u_int8_t channels[54];
#define IWI_CHAN_5GHZ (0 << 6)
#define IWI_CHAN_2GHZ (1 << 6)
- u_int8_t reserved[3];
+
+ u_int8_t type[26];
+#define IWI_SCAN_TYPE_PASSIVE 0x11
+#define IWI_SCAN_TYPE_DIRECTED 0x22
+#define IWI_SCAN_TYPE_BROADCAST 0x33
+#define IWI_SCAN_TYPE_BDIRECTED 0x44
+
+ u_int8_t reserved1[2];
+ u_int16_t reserved2;
+ u_int16_t passive; /* dwell time */
+ u_int16_t directed; /* dwell time */
+ u_int16_t broadcast; /* dwell time */
+ u_int16_t bdirected; /* dwell time */
} __packed;
/* structure for command IWI_CMD_SET_CONFIGURATION */