FreeBSD/sys/dev/iwn/if_iwn.c
/*
 * Adapter-independent backend for TX_DONE firmware notifications.
 */
Adapter-independent backend for TX_DONE firmware notifications.
Adapter - independent backend for TX_DONE firmware notifications .
static void
iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt,
    uint8_t status)
{
	struct iwn_tx_ring *ring = &sc->txq[desc->qid & 0xf];
	struct iwn_tx_data *data = &ring->data[desc->idx];
	struct mbuf *m;
	struct ieee80211_node *ni;
	struct ieee80211vap *vap;
	KASSERT(data->ni != NULL, ("no node"));
	DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__);
	bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_POSTWRITE);
	bus_dmamap_unload(ring->data_dmat, data->map);
	m = data->m, data->m = NULL;
	ni = data->ni, data->ni = NULL;
	vap = ni->ni_vap;
	if (status & IWN_TX_FAIL)
		ieee80211_ratectl_tx_complete(vap, ni,
		    IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL);
	else
		ieee80211_ratectl_tx_complete(vap, ni,
		    IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL);
	if (status == IWN_TX_FAIL_TX_LOCKED &&
	    ni->ni_vap->iv_state == IEEE80211_S_AUTH)
		ieee80211_tx_complete(ni, m, 0);
	else
		ieee80211_tx_complete(ni, m,
		    (status & IWN_TX_FAIL) != 0);
	sc->sc_tx_timer = 0;
	if (--ring->queued < IWN_TX_RING_LOMARK)
		sc->qfullmsk &= ~(1 << ring->qid);
	DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__);
}
static void iwn_tx_done ( struct iwn_softc * sc , struct iwn_rx_desc * desc , int ackfailcnt , uint8_t status ) { struct iwn_tx_ring * ring = & sc -> txq [ desc -> qid & 0xf ] ; struct iwn_tx_data * data = & ring -> data [ desc -> idx ] ; struct mbuf * m ; struct ieee80211_node * ni ; struct ieee80211vap * vap ; KASSERT ( data -> ni != NULL , ( " " ) ) ; DPRINTF ( sc , IWN_DEBUG_TRACE , " \n " , __func__ ) ; bus_dmamap_sync ( ring -> data_dmat , data -> map , BUS_DMASYNC_POSTWRITE ) ; bus_dmamap_unload ( ring -> data_dmat , data -> map ) ; m = data -> m , data -> m = NULL ; ni = data -> ni , data -> ni = NULL ; vap = ni -> ni_vap ; if ( status & IWN_TX_FAIL ) ieee80211_ratectl_tx_complete ( vap , ni , IEEE80211_RATECTL_TX_FAILURE , & ackfailcnt , NULL ) ; else ieee80211_ratectl_tx_complete ( vap , ni , IEEE80211_RATECTL_TX_SUCCESS , & ackfailcnt , NULL ) ; if ( status == IWN_TX_FAIL_TX_LOCKED && ni -> ni_vap -> iv_state == IEEE80211_S_AUTH ) ieee80211_tx_complete ( ni , m , 0 ) ; else ieee80211_tx_complete ( ni , m , ( status & IWN_TX_FAIL ) != 0 ) ; sc -> sc_tx_timer = 0 ; if ( -- ring -> queued < IWN_TX_RING_LOMARK ) sc -> qfullmsk &= ~ ( 1 << ring -> qid ) ; DPRINTF ( sc , IWN_DEBUG_TRACE , " \n " , __func__ ) ; }
Adapter-independent backend for TX_DONE firmware notifications.
Adapter - independent backend for TX_DONE firmware notifications .
/* Unmap and free mbuf. */ /*
	 * Update rate control statistics for the node.
	 */ /*
	 * Channels marked for "radar" require traffic to be received
	 * to unlock before we can transmit.  Until traffic is seen
	 * any attempt to transmit is returned immediately with status
	 * set to IWN_TX_FAIL_TX_LOCKED.  Unfortunately this can easily
	 * happen on first authenticate after scanning.  To workaround
	 * this we ignore a failure of this sort in AUTH state so the
	 * 802.11 layer will fall back to using a timeout to wait for
	 * the AUTH reply.  This allows the firmware time to see
	 * traffic so a subsequent retry of AUTH succeeds.  It's
	 * unclear why the firmware does not maintain state for
	 * channels recently visited as this would allow immediate
	 * use of the channel after a scan (where we see traffic).
	 */