aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/xmit.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/xmit.c')
-rw-r--r--drivers/net/wireless/ath9k/xmit.c77
1 files changed, 28 insertions, 49 deletions
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 413fbdd38ab6..fc52f61ef3ed 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -83,18 +83,16 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
83 txq->axq_linkbuf = list_entry(txq->axq_q.prev, struct ath_buf, list); 83 txq->axq_linkbuf = list_entry(txq->axq_q.prev, struct ath_buf, list);
84 84
85 DPRINTF(sc, ATH_DBG_QUEUE, 85 DPRINTF(sc, ATH_DBG_QUEUE,
86 "%s: txq depth = %d\n", __func__, txq->axq_depth); 86 "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth);
87 87
88 if (txq->axq_link == NULL) { 88 if (txq->axq_link == NULL) {
89 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); 89 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
90 DPRINTF(sc, ATH_DBG_XMIT, 90 DPRINTF(sc, ATH_DBG_XMIT,
91 "%s: TXDP[%u] = %llx (%p)\n", 91 "TXDP[%u] = %llx (%p)\n",
92 __func__, txq->axq_qnum, 92 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
93 ito64(bf->bf_daddr), bf->bf_desc);
94 } else { 93 } else {
95 *txq->axq_link = bf->bf_daddr; 94 *txq->axq_link = bf->bf_daddr;
96 DPRINTF(sc, ATH_DBG_XMIT, "%s: link[%u] (%p)=%llx (%p)\n", 95 DPRINTF(sc, ATH_DBG_XMIT, "link[%u] (%p)=%llx (%p)\n",
97 __func__,
98 txq->axq_qnum, txq->axq_link, 96 txq->axq_qnum, txq->axq_link,
99 ito64(bf->bf_daddr), bf->bf_desc); 97 ito64(bf->bf_daddr), bf->bf_desc);
100 } 98 }
@@ -109,8 +107,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
109 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 107 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
110 struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); 108 struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
111 109
112 DPRINTF(sc, ATH_DBG_XMIT, 110 DPRINTF(sc, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
113 "%s: TX complete: skb: %p\n", __func__, skb);
114 111
115 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || 112 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK ||
116 tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { 113 tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
@@ -983,8 +980,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
983 int txok, nbad = 0; 980 int txok, nbad = 0;
984 int status; 981 int status;
985 982
986 DPRINTF(sc, ATH_DBG_QUEUE, 983 DPRINTF(sc, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
987 "%s: tx queue %d (%x), link %p\n", __func__,
988 txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), 984 txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
989 txq->axq_link); 985 txq->axq_link);
990 986
@@ -1116,9 +1112,9 @@ static void ath_tx_stopdma(struct ath_softc *sc, struct ath_txq *txq)
1116 struct ath_hal *ah = sc->sc_ah; 1112 struct ath_hal *ah = sc->sc_ah;
1117 1113
1118 (void) ath9k_hw_stoptxdma(ah, txq->axq_qnum); 1114 (void) ath9k_hw_stoptxdma(ah, txq->axq_qnum);
1119 DPRINTF(sc, ATH_DBG_XMIT, "%s: tx queue [%u] %x, link %p\n", 1115 DPRINTF(sc, ATH_DBG_XMIT, "tx queue [%u] %x, link %p\n",
1120 __func__, txq->axq_qnum, 1116 txq->axq_qnum, ath9k_hw_gettxbuf(ah, txq->axq_qnum),
1121 ath9k_hw_gettxbuf(ah, txq->axq_qnum), txq->axq_link); 1117 txq->axq_link);
1122} 1118}
1123 1119
1124/* Drain only the data queues */ 1120/* Drain only the data queues */
@@ -1142,8 +1138,7 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
1142 1138
1143 if (npend) { 1139 if (npend) {
1144 /* TxDMA not stopped, reset the hal */ 1140 /* TxDMA not stopped, reset the hal */
1145 DPRINTF(sc, ATH_DBG_XMIT, 1141 DPRINTF(sc, ATH_DBG_XMIT, "Unable to stop TxDMA. Reset HAL!\n");
1146 "%s: Unable to stop TxDMA. Reset HAL!\n", __func__);
1147 1142
1148 spin_lock_bh(&sc->sc_resetlock); 1143 spin_lock_bh(&sc->sc_resetlock);
1149 if (!ath9k_hw_reset(ah, 1144 if (!ath9k_hw_reset(ah,
@@ -1153,8 +1148,7 @@ static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
1153 sc->sc_ht_extprotspacing, true, &status)) { 1148 sc->sc_ht_extprotspacing, true, &status)) {
1154 1149
1155 DPRINTF(sc, ATH_DBG_FATAL, 1150 DPRINTF(sc, ATH_DBG_FATAL,
1156 "%s: unable to reset hardware; hal status %u\n", 1151 "Unable to reset hardware; hal status %u\n",
1157 __func__,
1158 status); 1152 status);
1159 } 1153 }
1160 spin_unlock_bh(&sc->sc_resetlock); 1154 spin_unlock_bh(&sc->sc_resetlock);
@@ -1194,7 +1188,6 @@ static void ath_tx_addto_baw(struct ath_softc *sc,
1194 * Function to send an A-MPDU 1188 * Function to send an A-MPDU
1195 * NB: must be called with txq lock held 1189 * NB: must be called with txq lock held
1196 */ 1190 */
1197
1198static int ath_tx_send_ampdu(struct ath_softc *sc, 1191static int ath_tx_send_ampdu(struct ath_softc *sc,
1199 struct ath_atx_tid *tid, 1192 struct ath_atx_tid *tid,
1200 struct list_head *bf_head, 1193 struct list_head *bf_head,
@@ -1242,7 +1235,6 @@ static int ath_tx_send_ampdu(struct ath_softc *sc,
1242 * looks up the rate 1235 * looks up the rate
1243 * returns aggr limit based on lowest of the rates 1236 * returns aggr limit based on lowest of the rates
1244 */ 1237 */
1245
1246static u32 ath_lookup_rate(struct ath_softc *sc, 1238static u32 ath_lookup_rate(struct ath_softc *sc,
1247 struct ath_buf *bf, 1239 struct ath_buf *bf,
1248 struct ath_atx_tid *tid) 1240 struct ath_atx_tid *tid)
@@ -1310,7 +1302,6 @@ static u32 ath_lookup_rate(struct ath_softc *sc,
1310 * meet the minimum required mpdudensity. 1302 * meet the minimum required mpdudensity.
1311 * caller should make sure that the rate is HT rate . 1303 * caller should make sure that the rate is HT rate .
1312 */ 1304 */
1313
1314static int ath_compute_num_delims(struct ath_softc *sc, 1305static int ath_compute_num_delims(struct ath_softc *sc,
1315 struct ath_atx_tid *tid, 1306 struct ath_atx_tid *tid,
1316 struct ath_buf *bf, 1307 struct ath_buf *bf,
@@ -1382,7 +1373,6 @@ static int ath_compute_num_delims(struct ath_softc *sc,
1382 * For aggregation from software buffer queue. 1373 * For aggregation from software buffer queue.
1383 * NB: must be called with txq lock held 1374 * NB: must be called with txq lock held
1384 */ 1375 */
1385
1386static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, 1376static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
1387 struct ath_atx_tid *tid, 1377 struct ath_atx_tid *tid,
1388 struct list_head *bf_q, 1378 struct list_head *bf_q,
@@ -1505,7 +1495,6 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
1505 * process pending frames possibly doing a-mpdu aggregation 1495 * process pending frames possibly doing a-mpdu aggregation
1506 * NB: must be called with txq lock held 1496 * NB: must be called with txq lock held
1507 */ 1497 */
1508
1509static void ath_tx_sched_aggr(struct ath_softc *sc, 1498static void ath_tx_sched_aggr(struct ath_softc *sc,
1510 struct ath_txq *txq, struct ath_atx_tid *tid) 1499 struct ath_txq *txq, struct ath_atx_tid *tid)
1511{ 1500{
@@ -1635,7 +1624,6 @@ static void ath_tid_drain(struct ath_softc *sc,
1635 * Drain all pending buffers 1624 * Drain all pending buffers
1636 * NB: must be called with txq lock held 1625 * NB: must be called with txq lock held
1637 */ 1626 */
1638
1639static void ath_txq_drain_pending_buffers(struct ath_softc *sc, 1627static void ath_txq_drain_pending_buffers(struct ath_softc *sc,
1640 struct ath_txq *txq) 1628 struct ath_txq *txq)
1641{ 1629{
@@ -1795,8 +1783,7 @@ int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
1795 1783
1796 bf = ath_tx_get_buffer(sc); 1784 bf = ath_tx_get_buffer(sc);
1797 if (!bf) { 1785 if (!bf) {
1798 DPRINTF(sc, ATH_DBG_XMIT, "%s: TX buffers are full\n", 1786 DPRINTF(sc, ATH_DBG_XMIT, "TX buffers are full\n");
1799 __func__);
1800 return -1; 1787 return -1;
1801 } 1788 }
1802 1789
@@ -1820,8 +1807,8 @@ int ath_tx_init(struct ath_softc *sc, int nbufs)
1820 "tx", nbufs, 1); 1807 "tx", nbufs, 1);
1821 if (error != 0) { 1808 if (error != 0) {
1822 DPRINTF(sc, ATH_DBG_FATAL, 1809 DPRINTF(sc, ATH_DBG_FATAL,
1823 "%s: failed to allocate tx descriptors: %d\n", 1810 "Failed to allocate tx descriptors: %d\n",
1824 __func__, error); 1811 error);
1825 break; 1812 break;
1826 } 1813 }
1827 1814
@@ -1830,9 +1817,8 @@ int ath_tx_init(struct ath_softc *sc, int nbufs)
1830 "beacon", ATH_BCBUF, 1); 1817 "beacon", ATH_BCBUF, 1);
1831 if (error != 0) { 1818 if (error != 0) {
1832 DPRINTF(sc, ATH_DBG_FATAL, 1819 DPRINTF(sc, ATH_DBG_FATAL,
1833 "%s: failed to allocate " 1820 "Failed to allocate beacon descriptors: %d\n",
1834 "beacon descripotrs: %d\n", 1821 error);
1835 __func__, error);
1836 break; 1822 break;
1837 } 1823 }
1838 1824
@@ -1904,8 +1890,8 @@ struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
1904 } 1890 }
1905 if (qnum >= ARRAY_SIZE(sc->sc_txq)) { 1891 if (qnum >= ARRAY_SIZE(sc->sc_txq)) {
1906 DPRINTF(sc, ATH_DBG_FATAL, 1892 DPRINTF(sc, ATH_DBG_FATAL,
1907 "%s: hal qnum %u out of range, max %u!\n", 1893 "qnum %u out of range, max %u!\n",
1908 __func__, qnum, (unsigned int)ARRAY_SIZE(sc->sc_txq)); 1894 qnum, (unsigned int)ARRAY_SIZE(sc->sc_txq));
1909 ath9k_hw_releasetxqueue(ah, qnum); 1895 ath9k_hw_releasetxqueue(ah, qnum);
1910 return NULL; 1896 return NULL;
1911 } 1897 }
@@ -1950,8 +1936,8 @@ int ath_tx_setup(struct ath_softc *sc, int haltype)
1950 1936
1951 if (haltype >= ARRAY_SIZE(sc->sc_haltype2q)) { 1937 if (haltype >= ARRAY_SIZE(sc->sc_haltype2q)) {
1952 DPRINTF(sc, ATH_DBG_FATAL, 1938 DPRINTF(sc, ATH_DBG_FATAL,
1953 "%s: HAL AC %u out of range, max %zu!\n", 1939 "HAL AC %u out of range, max %zu!\n",
1954 __func__, haltype, ARRAY_SIZE(sc->sc_haltype2q)); 1940 haltype, ARRAY_SIZE(sc->sc_haltype2q));
1955 return 0; 1941 return 0;
1956 } 1942 }
1957 txq = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, haltype); 1943 txq = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, haltype);
@@ -1970,8 +1956,7 @@ int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype)
1970 case ATH9K_TX_QUEUE_DATA: 1956 case ATH9K_TX_QUEUE_DATA:
1971 if (haltype >= ARRAY_SIZE(sc->sc_haltype2q)) { 1957 if (haltype >= ARRAY_SIZE(sc->sc_haltype2q)) {
1972 DPRINTF(sc, ATH_DBG_FATAL, 1958 DPRINTF(sc, ATH_DBG_FATAL,
1973 "%s: HAL AC %u out of range, max %zu!\n", 1959 "HAL AC %u out of range, max %zu!\n",
1974 __func__,
1975 haltype, ARRAY_SIZE(sc->sc_haltype2q)); 1960 haltype, ARRAY_SIZE(sc->sc_haltype2q));
1976 return -1; 1961 return -1;
1977 } 1962 }
@@ -2004,8 +1989,8 @@ struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb)
2004 /* Try to avoid running out of descriptors */ 1989 /* Try to avoid running out of descriptors */
2005 if (txq->axq_depth >= (ATH_TXBUF - 20)) { 1990 if (txq->axq_depth >= (ATH_TXBUF - 20)) {
2006 DPRINTF(sc, ATH_DBG_FATAL, 1991 DPRINTF(sc, ATH_DBG_FATAL,
2007 "%s: TX queue: %d is full, depth: %d\n", 1992 "TX queue: %d is full, depth: %d\n",
2008 __func__, qnum, txq->axq_depth); 1993 qnum, txq->axq_depth);
2009 ieee80211_stop_queue(sc->hw, skb_get_queue_mapping(skb)); 1994 ieee80211_stop_queue(sc->hw, skb_get_queue_mapping(skb));
2010 txq->stopped = 1; 1995 txq->stopped = 1;
2011 spin_unlock_bh(&txq->axq_lock); 1996 spin_unlock_bh(&txq->axq_lock);
@@ -2047,8 +2032,7 @@ int ath_txq_update(struct ath_softc *sc, int qnum,
2047 2032
2048 if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) { 2033 if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) {
2049 DPRINTF(sc, ATH_DBG_FATAL, 2034 DPRINTF(sc, ATH_DBG_FATAL,
2050 "%s: unable to update hardware queue %u!\n", 2035 "Unable to update hardware queue %u!\n", qnum);
2051 __func__, qnum);
2052 error = -EIO; 2036 error = -EIO;
2053 } else { 2037 } else {
2054 ath9k_hw_resettxqueue(ah, qnum); /* push to h/w */ 2038 ath9k_hw_resettxqueue(ah, qnum); /* push to h/w */
@@ -2167,7 +2151,7 @@ void ath_draintxq(struct ath_softc *sc, bool retry_tx)
2167 * we go to INIT state */ 2151 * we go to INIT state */
2168 if (!(sc->sc_flags & SC_OP_INVALID)) { 2152 if (!(sc->sc_flags & SC_OP_INVALID)) {
2169 (void) ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq); 2153 (void) ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq);
2170 DPRINTF(sc, ATH_DBG_XMIT, "%s: beacon queue %x\n", __func__, 2154 DPRINTF(sc, ATH_DBG_XMIT, "beacon queue %x\n",
2171 ath9k_hw_gettxbuf(sc->sc_ah, sc->sc_bhalq)); 2155 ath9k_hw_gettxbuf(sc->sc_ah, sc->sc_bhalq));
2172 } 2156 }
2173 2157
@@ -2267,8 +2251,6 @@ void ath_tx_aggr_teardown(struct ath_softc *sc, struct ath_node *an, u8 tid)
2267 struct list_head bf_head; 2251 struct list_head bf_head;
2268 INIT_LIST_HEAD(&bf_head); 2252 INIT_LIST_HEAD(&bf_head);
2269 2253
2270 DPRINTF(sc, ATH_DBG_AGGR, "%s: teardown TX aggregation\n", __func__);
2271
2272 if (txtid->state & AGGR_CLEANUP) /* cleanup is in progress */ 2254 if (txtid->state & AGGR_CLEANUP) /* cleanup is in progress */
2273 return; 2255 return;
2274 2256
@@ -2501,8 +2483,7 @@ void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb)
2501 if (hdrlen & 3) { 2483 if (hdrlen & 3) {
2502 padsize = hdrlen % 4; 2484 padsize = hdrlen % 4;
2503 if (skb_headroom(skb) < padsize) { 2485 if (skb_headroom(skb) < padsize) {
2504 DPRINTF(sc, ATH_DBG_XMIT, "%s: TX CABQ padding " 2486 DPRINTF(sc, ATH_DBG_XMIT, "TX CABQ padding failed\n");
2505 "failed\n", __func__);
2506 dev_kfree_skb_any(skb); 2487 dev_kfree_skb_any(skb);
2507 return; 2488 return;
2508 } 2489 }
@@ -2512,12 +2493,10 @@ void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb)
2512 2493
2513 txctl.txq = sc->sc_cabq; 2494 txctl.txq = sc->sc_cabq;
2514 2495
2515 DPRINTF(sc, ATH_DBG_XMIT, "%s: transmitting CABQ packet, skb: %p\n", 2496 DPRINTF(sc, ATH_DBG_XMIT, "transmitting CABQ packet, skb: %p\n", skb);
2516 __func__,
2517 skb);
2518 2497
2519 if (ath_tx_start(sc, skb, &txctl) != 0) { 2498 if (ath_tx_start(sc, skb, &txctl) != 0) {
2520 DPRINTF(sc, ATH_DBG_XMIT, "%s: TX failed\n", __func__); 2499 DPRINTF(sc, ATH_DBG_XMIT, "CABQ TX failed\n");
2521 goto exit; 2500 goto exit;
2522 } 2501 }
2523 2502