diff options
Diffstat (limited to 'sys/dev/pci/if_ipw.c')
-rw-r--r-- | sys/dev/pci/if_ipw.c | 80 |
1 files changed, 15 insertions, 65 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index d4b94eeafcc..ce89bf4ab16 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.42 2005/02/21 13:33:29 damien Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.43 2005/03/12 13:23:30 damien Exp $ */ /*- * Copyright (c) 2004, 2005 @@ -87,7 +87,6 @@ int ipw_media_change(struct ifnet *); void ipw_media_status(struct ifnet *, struct ifmediareq *); int ipw_newstate(struct ieee80211com *, enum ieee80211_state, int); u_int16_t ipw_read_prom_word(struct ipw_softc *, u_int8_t); -void ipw_scan_result(struct ipw_softc *); void ipw_command_intr(struct ipw_softc *, struct ipw_soft_buf *); void ipw_newstate_intr(struct ipw_softc *, struct ipw_soft_buf *); void ipw_data_intr(struct ipw_softc *, struct ipw_status *, @@ -236,7 +235,7 @@ ipw_attach(struct device *parent, struct device *self, void *aux) /* set device capabilities */ ic->ic_caps = IEEE80211_C_IBSS | IEEE80211_C_MONITOR | IEEE80211_C_PMGT | IEEE80211_C_TXPMGT | IEEE80211_C_WEP | - IEEE80211_C_SHPREAMBLE; + IEEE80211_C_SHPREAMBLE | IEEE80211_C_SCANALL; /* read MAC address from EEPROM */ val = ipw_read_prom_word(sc, IPW_EEPROM_MAC + 0); @@ -698,23 +697,23 @@ int ipw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) { struct ipw_softc *sc = ic->ic_softc; - struct ieee80211_node *ni = ic->ic_bss; + struct ieee80211_node *ni; + u_int8_t macaddr[IEEE80211_ADDR_LEN]; u_int32_t len; - u_int8_t val; switch (nstate) { case IEEE80211_S_RUN: - len = IEEE80211_NWID_LEN; - ipw_read_table2(sc, IPW_INFO_CURRENT_SSID, ni->ni_essid, &len); - ni->ni_esslen = len; - - val = ipw_read_table1(sc, IPW_INFO_CURRENT_CHANNEL); - ni->ni_chan = &ic->ic_channels[val]; - DELAY(100); /* firmware needs a short delay here */ len = IEEE80211_ADDR_LEN; - ipw_read_table2(sc, IPW_INFO_CURRENT_BSSID, ni->ni_bssid, &len); + ipw_read_table2(sc, IPW_INFO_CURRENT_BSSID, macaddr, &len); + + ni = ieee80211_find_node(ic, macaddr); + if (ni == NULL) + break; + + (*ic->ic_node_copy)(ic, ic->ic_bss, ni); + ieee80211_node_newstate(ni, IEEE80211_STA_BSS); break; case IEEE80211_S_INIT: @@ -785,57 +784,6 @@ ipw_read_prom_word(struct ipw_softc *sc, u_int8_t addr) } void -ipw_scan_result(struct ipw_softc *sc) -{ - struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211_node *ni; - u_int32_t i, cnt, off; - struct ipw_node ap; - - /* flush previously seen access points */ - ieee80211_free_allnodes(ic); - - cnt = ipw_read_table1(sc, IPW_INFO_APS_CNT); - off = ipw_read_table1(sc, IPW_INFO_APS_BASE); - - DPRINTF(("Found %u APs\n", cnt)); - - for (i = 0; i < cnt; i++) { - ipw_read_mem_1(sc, off, (u_int8_t *)&ap, sizeof ap); - off += sizeof ap; - -#ifdef IPW_DEBUG - if (ipw_debug >= 2) { - u_char *p = (u_char *)≈ - int j; - - printf("AP%u\n", i); - for (j = 0; j < sizeof ap; j++) - printf("%02x", *p++); - printf("\n"); - } -#endif - - ni = ieee80211_lookup_node(ic, ap.bssid, - &ic->ic_channels[ap.chan]); - if (ni != NULL) - continue; - - ni = ieee80211_alloc_node(ic, ap.bssid); - if (ni == NULL) - return; - - IEEE80211_ADDR_COPY(ni->ni_bssid, ap.bssid); - ni->ni_rssi = ap.rssi; - ni->ni_intval = letoh16(ap.intval); - ni->ni_capinfo = letoh16(ap.capinfo); - ni->ni_chan = &ic->ic_channels[ap.chan]; - ni->ni_esslen = ap.esslen; - bcopy(ap.essid, ni->ni_essid, IEEE80211_NWID_LEN); - } -} - -void ipw_command_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf) { struct ipw_cmd *cmd; @@ -874,10 +822,12 @@ ipw_newstate_intr(struct ipw_softc *sc, struct ipw_soft_buf *sbuf) /* don't leave run state on background scan */ if (ic->ic_state != IEEE80211_S_RUN) ieee80211_new_state(ic, IEEE80211_S_SCAN, -1); + + ic->ic_flags |= IEEE80211_F_ASCAN; break; case IPW_STATE_SCAN_COMPLETE: - ipw_scan_result(sc); + ic->ic_flags &= ~IEEE80211_F_ASCAN; break; case IPW_STATE_ASSOCIATION_LOST: |