if_ath_tx.c (220098) | if_ath_tx.c (227344) |
---|---|
1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 220098 2011-03-28 11:48:49Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_tx.c 227344 2011-11-08 17:08:12Z adrian $"); |
32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 71 unchanged lines hidden (view full) --- 111void 112ath_txfrag_cleanup(struct ath_softc *sc, 113 ath_bufhead *frags, struct ieee80211_node *ni) 114{ 115 struct ath_buf *bf, *next; 116 117 ATH_TXBUF_LOCK_ASSERT(sc); 118 | 32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 71 unchanged lines hidden (view full) --- 111void 112ath_txfrag_cleanup(struct ath_softc *sc, 113 ath_bufhead *frags, struct ieee80211_node *ni) 114{ 115 struct ath_buf *bf, *next; 116 117 ATH_TXBUF_LOCK_ASSERT(sc); 118 |
119 STAILQ_FOREACH_SAFE(bf, frags, bf_list, next) { | 119 TAILQ_FOREACH_SAFE(bf, frags, bf_list, next) { |
120 /* NB: bf assumed clean */ | 120 /* NB: bf assumed clean */ |
121 STAILQ_REMOVE_HEAD(frags, bf_list); 122 STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); | 121 TAILQ_REMOVE(frags, bf, bf_list); 122 TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); |
123 ieee80211_node_decref(ni); 124 } 125} 126 127/* 128 * Setup xmit of a fragmented frame. Allocate a buffer 129 * for each frag and bump the node reference count to 130 * reflect the held reference to be setup by ath_tx_start. --- 8 unchanged lines hidden (view full) --- 139 ATH_TXBUF_LOCK(sc); 140 for (m = m0->m_nextpkt; m != NULL; m = m->m_nextpkt) { 141 bf = _ath_getbuf_locked(sc); 142 if (bf == NULL) { /* out of buffers, cleanup */ 143 ath_txfrag_cleanup(sc, frags, ni); 144 break; 145 } 146 ieee80211_node_incref(ni); | 123 ieee80211_node_decref(ni); 124 } 125} 126 127/* 128 * Setup xmit of a fragmented frame. Allocate a buffer 129 * for each frag and bump the node reference count to 130 * reflect the held reference to be setup by ath_tx_start. --- 8 unchanged lines hidden (view full) --- 139 ATH_TXBUF_LOCK(sc); 140 for (m = m0->m_nextpkt; m != NULL; m = m->m_nextpkt) { 141 bf = _ath_getbuf_locked(sc); 142 if (bf == NULL) { /* out of buffers, cleanup */ 143 ath_txfrag_cleanup(sc, frags, ni); 144 break; 145 } 146 ieee80211_node_incref(ni); |
147 STAILQ_INSERT_TAIL(frags, bf, bf_list); | 147 TAILQ_INSERT_TAIL(frags, bf, bf_list); |
148 } 149 ATH_TXBUF_UNLOCK(sc); 150 | 148 } 149 ATH_TXBUF_UNLOCK(sc); 150 |
151 return !STAILQ_EMPTY(frags); | 151 return !TAILQ_EMPTY(frags); |
152} 153 154/* 155 * Reclaim mbuf resources. For fragmented frames we 156 * need to claim each frag chained with m_nextpkt. 157 */ 158void 159ath_freetx(struct mbuf *m) --- 158 unchanged lines hidden (view full) --- 318 * to write the address of the first buffer 319 * in the chain. Since it's not busy now 320 * handle this chore. We are certain the 321 * buffer at the front is the right one since 322 * axq_link is NULL only when the buffer list 323 * is/was empty. 324 */ 325 ath_hal_puttxbuf(ah, txq->axq_qnum, | 152} 153 154/* 155 * Reclaim mbuf resources. For fragmented frames we 156 * need to claim each frag chained with m_nextpkt. 157 */ 158void 159ath_freetx(struct mbuf *m) --- 158 unchanged lines hidden (view full) --- 318 * to write the address of the first buffer 319 * in the chain. Since it's not busy now 320 * handle this chore. We are certain the 321 * buffer at the front is the right one since 322 * axq_link is NULL only when the buffer list 323 * is/was empty. 324 */ 325 ath_hal_puttxbuf(ah, txq->axq_qnum, |
326 STAILQ_FIRST(&txq->axq_q)->bf_daddr); | 326 TAILQ_FIRST(&txq->axq_q)->bf_daddr); |
327 txq->axq_flags &= ~ATH_TXQ_PUTPENDING; 328 DPRINTF(sc, ATH_DEBUG_TDMA | ATH_DEBUG_XMIT, 329 "%s: Q%u restarted\n", __func__, 330 txq->axq_qnum); 331 } 332 } 333#else 334 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); --- 11 unchanged lines hidden (view full) --- 346 txq->axq_qnum, txq->axq_link, 347 (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); 348 } 349#endif /* IEEE80211_SUPPORT_TDMA */ 350 txq->axq_link = &bf->bf_desc[bf->bf_nseg - 1].ds_link; 351 ath_hal_txstart(ah, txq->axq_qnum); 352 } else { 353 if (txq->axq_link != NULL) { | 327 txq->axq_flags &= ~ATH_TXQ_PUTPENDING; 328 DPRINTF(sc, ATH_DEBUG_TDMA | ATH_DEBUG_XMIT, 329 "%s: Q%u restarted\n", __func__, 330 txq->axq_qnum); 331 } 332 } 333#else 334 ATH_TXQ_INSERT_TAIL(txq, bf, bf_list); --- 11 unchanged lines hidden (view full) --- 346 txq->axq_qnum, txq->axq_link, 347 (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); 348 } 349#endif /* IEEE80211_SUPPORT_TDMA */ 350 txq->axq_link = &bf->bf_desc[bf->bf_nseg - 1].ds_link; 351 ath_hal_txstart(ah, txq->axq_qnum); 352 } else { 353 if (txq->axq_link != NULL) { |
354 struct ath_buf *last = ATH_TXQ_LAST(txq); | 354 struct ath_buf *last = ATH_TXQ_LAST(txq, axq_q_s); |
355 struct ieee80211_frame *wh; 356 357 /* mark previous frame */ 358 wh = mtod(last->bf_m, struct ieee80211_frame *); 359 wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; 360 bus_dmamap_sync(sc->sc_dmat, last->bf_dmamap, 361 BUS_DMASYNC_PREWRITE); 362 --- 746 unchanged lines hidden (view full) --- 1109 } 1110 sc->sc_wd_timer = 5; 1111 ifp->if_opackets++; 1112 sc->sc_stats.ast_tx_raw++; 1113 1114 return 0; 1115bad2: 1116 ATH_TXBUF_LOCK(sc); | 355 struct ieee80211_frame *wh; 356 357 /* mark previous frame */ 358 wh = mtod(last->bf_m, struct ieee80211_frame *); 359 wh->i_fc[1] |= IEEE80211_FC1_MORE_DATA; 360 bus_dmamap_sync(sc->sc_dmat, last->bf_dmamap, 361 BUS_DMASYNC_PREWRITE); 362 --- 746 unchanged lines hidden (view full) --- 1109 } 1110 sc->sc_wd_timer = 5; 1111 ifp->if_opackets++; 1112 sc->sc_stats.ast_tx_raw++; 1113 1114 return 0; 1115bad2: 1116 ATH_TXBUF_LOCK(sc); |
1117 STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); | 1117 TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); |
1118 ATH_TXBUF_UNLOCK(sc); 1119bad: 1120 ifp->if_oerrors++; 1121 sc->sc_stats.ast_tx_raw_fail++; 1122 ieee80211_free_node(ni); 1123 return error; 1124} | 1118 ATH_TXBUF_UNLOCK(sc); 1119bad: 1120 ifp->if_oerrors++; 1121 sc->sc_stats.ast_tx_raw_fail++; 1122 ieee80211_free_node(ni); 1123 return error; 1124} |