From owner-p4-projects@FreeBSD.ORG Sat Nov 26 00:55:29 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DA4F916A424; Sat, 26 Nov 2005 00:55:28 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A860A16A423 for ; Sat, 26 Nov 2005 00:55:28 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5872F43D8E for ; Sat, 26 Nov 2005 00:55:12 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jAQ0t6Ou015366 for ; Sat, 26 Nov 2005 00:55:06 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jAQ0t5Tj015363 for perforce@freebsd.org; Sat, 26 Nov 2005 00:55:05 GMT (envelope-from sam@freebsd.org) Date: Sat, 26 Nov 2005 00:55:05 GMT Message-Id: <200511260055.jAQ0t5Tj015363@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 87232 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2005 00:55:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=87232 Change 87232 by sam@sam_ebb on 2005/11/26 00:54:38 fixups for new scanning stuff and channel reorg Affected files ... .. //depot/projects/wifi/sys/dev/ral/if_ral.c#8 edit Differences ... ==== //depot/projects/wifi/sys/dev/ral/if_ral.c#8 (text+ko) ==== @@ -125,6 +125,9 @@ static void ral_bbp_write(struct ral_softc *, uint8_t, uint8_t); static uint8_t ral_bbp_read(struct ral_softc *, uint8_t); static void ral_rf_write(struct ral_softc *, uint8_t, uint32_t); +static void ral_scan_start(struct ieee80211com *); +static void ral_scan_end(struct ieee80211com *); +static void ral_set_channel(struct ieee80211com *); static void ral_set_chan(struct ral_softc *, struct ieee80211_channel *); #if 0 @@ -134,7 +137,7 @@ static void ral_update_plcp(struct ral_softc *); static void ral_update_slot(struct ifnet *); static void ral_update_led(struct ral_softc *, int, int); -static void ral_set_bssid(struct ral_softc *, uint8_t *); +static void ral_set_bssid(struct ral_softc *, const uint8_t *); static void ral_set_macaddr(struct ral_softc *, uint8_t *); static void ral_get_macaddr(struct ral_softc *, uint8_t *); static void ral_update_promisc(struct ral_softc *); @@ -448,11 +451,12 @@ /* set supported .11b and .11g channels (1 through 14) */ for (i = 1; i <= 14; i++) { c = &ic->ic_channels[ic->ic_nchans++]; - c->ic_freq = - ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ); - c->ic_flags = - IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | - IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ; + c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ); + c->ic_flags = IEEE80211_CHAN_B; + c->ic_ieee = i; + c = &ic->ic_channels[ic->ic_nchans++]; + c->ic_freq = ieee80211_ieee2mhz(i, IEEE80211_CHAN_2GHZ); + c->ic_flags = IEEE80211_CHAN_G; c->ic_ieee = i; } @@ -460,6 +464,9 @@ ic->ic_node_alloc = ral_node_alloc; ic->ic_updateslot = ral_update_slot; ic->ic_reset = ral_reset; + ic->ic_scan_start = ral_scan_start; + ic->ic_scan_end = ral_scan_end; + ic->ic_set_channel = ral_set_channel; /* override state transition machine */ sc->sc_newstate = ic->ic_newstate; @@ -1125,6 +1132,7 @@ struct ral_tx_desc *desc; struct ral_tx_data *data; struct ral_node *rn; + int err; bus_dmamap_sync(sc->txq.desc_dmat, sc->txq.desc_map, BUS_DMASYNC_POSTREAD); @@ -1140,6 +1148,7 @@ rn = (struct ral_node *)data->ni; + err = 0; switch (le32toh(desc->flags) & RAL_TX_RESULT_MASK) { case RAL_TX_SUCCESS: DPRINTFN(10, ("data frame sent successfully\n")); @@ -1164,6 +1173,7 @@ &rn->rssadapt, &data->id); } ifp->if_oerrors++; + err = ETIMEDOUT; break; case RAL_TX_FAIL_INVALID: @@ -1172,11 +1182,15 @@ device_printf(sc->sc_dev, "sending data frame failed " "0x%08x\n", le32toh(desc->flags)); ifp->if_oerrors++; + err = EIO; /* NB: anything */ + break; } bus_dmamap_sync(sc->txq.data_dmat, data->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->txq.data_dmat, data->map); + if (data->m->m_flags & M_TXCB) + ieee80211_process_callback(data->ni, data->m, err); m_freem(data->m); data->m = NULL; ieee80211_free_node(data->ni); @@ -2248,6 +2262,37 @@ } static void +ral_scan_start(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct ral_softc *sc = ifp->if_softc; + + /* abort TSF synchronization */ + RAL_WRITE(sc, RAL_CSR14, 0); + ral_set_bssid(sc, ifp->if_broadcastaddr); +} + +static void +ral_scan_end(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct ral_softc *sc = ifp->if_softc; + + ral_enable_tsf_sync(sc); + /* XXX keep local copy */ + ral_set_bssid(sc, ic->ic_bss->ni_bssid); +} + +static void +ral_set_channel(struct ieee80211com *ic) +{ + struct ifnet *ifp = ic->ic_ifp; + struct ral_softc *sc = ifp->if_softc; + + ral_set_chan(sc, ic->ic_curchan); +} + +static void ral_set_chan(struct ral_softc *sc, struct ieee80211_channel *c) { #define N(a) (sizeof (a) / sizeof ((a)[0])) @@ -2331,7 +2376,7 @@ break; } - if (ic->ic_state != IEEE80211_S_SCAN) { + if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) { /* set Japan filter bit for channel 14 */ tmp = ral_bbp_read(sc, 70); @@ -2484,7 +2529,7 @@ } static void -ral_set_bssid(struct ral_softc *sc, uint8_t *bssid) +ral_set_bssid(struct ral_softc *sc, const uint8_t *bssid) { uint32_t tmp;