PERFORCE change 87232 for review
Sam Leffler
sam at FreeBSD.org
Sat Nov 26 00:55:29 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=87232
Change 87232 by sam at 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;
More information about the p4-projects
mailing list