Date: Wed, 28 Feb 2007 12:25:28 GMT From: Sepherosa Ziehau <sephe@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 115162 for review Message-ID: <200702281225.l1SCPS0g029846@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=115162 Change 115162 by sephe@sephe_zealot:sam_wifi on 2007/02/28 12:25:19 - Implement TXCB mechanism for ral(4), without this, net80211 internal state machine will not run correctly. - Minor style changes. Reviewed-by: sam@ Affected files ... .. //depot/projects/wifi/sys/dev/ral/rt2560.c#14 edit .. //depot/projects/wifi/sys/dev/ral/rt2661.c#9 edit Differences ... ==== //depot/projects/wifi/sys/dev/ral/rt2560.c#14 (text) ==== @@ -1002,6 +1002,9 @@ struct ifnet *ifp = ic->ic_ifp; struct rt2560_tx_desc *desc; struct rt2560_tx_data *data; + struct ieee80211_node *ni; + struct mbuf *m; + int flags; bus_dmamap_sync(sc->prioq.desc_dmat, sc->prioq.desc_map, BUS_DMASYNC_POSTREAD); @@ -1010,18 +1013,18 @@ desc = &sc->prioq.desc[sc->prioq.next]; data = &sc->prioq.data[sc->prioq.next]; - if ((le32toh(desc->flags) & RT2560_TX_BUSY) || - !(le32toh(desc->flags) & RT2560_TX_VALID)) + flags = le32toh(desc->flags); + if ((flags & RT2560_TX_BUSY) || (flags & RT2560_TX_VALID) == 0) break; - switch (le32toh(desc->flags) & RT2560_TX_RESULT_MASK) { + switch (flags & RT2560_TX_RESULT_MASK) { case RT2560_TX_SUCCESS: DPRINTFN(10, ("mgt frame sent successfully\n")); break; case RT2560_TX_SUCCESS_RETRY: DPRINTFN(9, ("mgt frame sent after %u retries\n", - (le32toh(desc->flags) >> 5) & 0x7)); + (flags >> 5) & 0x7)); break; case RT2560_TX_FAIL_RETRY: @@ -1033,15 +1036,17 @@ case RT2560_TX_FAIL_OTHER: default: device_printf(sc->sc_dev, "sending mgt frame failed " - "0x%08x\n", le32toh(desc->flags)); + "0x%08x\n", flags); + break; } bus_dmamap_sync(sc->prioq.data_dmat, data->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->prioq.data_dmat, data->map); - m_freem(data->m); + + m = data->m; data->m = NULL; - ieee80211_free_node(data->ni); + ni = data->ni; data->ni = NULL; /* descriptor is no longer valid */ @@ -1051,6 +1056,13 @@ sc->prioq.queued--; sc->prioq.next = (sc->prioq.next + 1) % RT2560_PRIO_RING_COUNT; + + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, + (flags & RT2560_TX_RESULT_MASK) &~ + (RT2560_TX_SUCCESS | RT2560_TX_SUCCESS_RETRY)); + m_freem(m); + ieee80211_free_node(ni); } bus_dmamap_sync(sc->prioq.desc_dmat, sc->prioq.desc_map, ==== //depot/projects/wifi/sys/dev/ral/rt2661.c#9 (text) ==== @@ -894,6 +894,9 @@ int qid, retrycnt; for (;;) { + struct ieee80211_node *ni; + struct mbuf *m; + val = RAL_READ(sc, RT2661_STA_CSR4); if (!(val & RT2661_TX_STAT_VALID)) break; @@ -904,12 +907,17 @@ /* retrieve rate control algorithm context */ data = &txq->data[txq->stat]; - rn = (struct rt2661_node *)data->ni; + m = data->m; + data->m = NULL; + ni = data->ni; + data->ni = NULL; /* if no frame has been sent, ignore */ - if (rn == NULL) + if (ni == NULL) continue; + rn = (struct rt2661_node *)ni; + switch (RT2661_TX_RESULT(val)) { case RT2661_TX_SUCCESS: retrycnt = RT2661_TX_RETRYCNT(val); @@ -927,7 +935,7 @@ DPRINTFN(9, ("sending data frame failed (too much " "retries)\n")); if (data->id.id_node != NULL) { - ral_rssadapt_lower_rate(ic, data->ni, + ral_rssadapt_lower_rate(ic, ni, &rn->rssadapt, &data->id); } ifp->if_oerrors++; @@ -940,14 +948,17 @@ ifp->if_oerrors++; } - ieee80211_free_node(data->ni); - data->ni = NULL; - DPRINTFN(15, ("tx done q=%d idx=%u\n", qid, txq->stat)); txq->queued--; if (++txq->stat >= txq->count) /* faster than % count */ txq->stat = 0; + + if (m->m_flags & M_TXCB) + ieee80211_process_callback(ni, m, + RT2661_TX_RESULT(val) != RT2661_TX_SUCCESS); + m_freem(m); + ieee80211_free_node(ni); } sc->sc_tx_timer = 0; @@ -974,9 +985,6 @@ bus_dmamap_sync(txq->data_dmat, data->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(txq->data_dmat, data->map); - m_freem(data->m); - data->m = NULL; - /* node reference is released in rt2661_tx_intr() */ /* descriptor is no longer valid */ desc->flags &= ~htole32(RT2661_TX_VALID);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702281225.l1SCPS0g029846>