diff options
author | Bruno Randolf <br1@einfach.org> | 2010-09-16 22:36:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-21 11:05:11 -0400 |
commit | 1440401e7051d4cf66084a7c36125834901bb90d (patch) | |
tree | 89878fd68c4ac88341692a190ee4996cefd32298 /drivers/net | |
parent | 651d9375dca9997ef2b05639191756da73b0cf8d (diff) |
ath5k: Move tx frame completion into separate function
Clearer separation between queue handling and what we do with completed frames.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 107 |
1 files changed, 57 insertions, 50 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 92d139bbcc31..81f4b567c6f2 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1516,6 +1516,61 @@ drop_packet: | |||
1516 | return NETDEV_TX_OK; | 1516 | return NETDEV_TX_OK; |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | static void | ||
1520 | ath5k_tx_frame_completed(struct ath5k_softc *sc, struct sk_buff *skb, | ||
1521 | struct ath5k_tx_status *ts) | ||
1522 | { | ||
1523 | struct ieee80211_tx_info *info; | ||
1524 | int i; | ||
1525 | |||
1526 | sc->stats.tx_all_count++; | ||
1527 | info = IEEE80211_SKB_CB(skb); | ||
1528 | |||
1529 | ieee80211_tx_info_clear_status(info); | ||
1530 | for (i = 0; i < 4; i++) { | ||
1531 | struct ieee80211_tx_rate *r = | ||
1532 | &info->status.rates[i]; | ||
1533 | |||
1534 | if (ts->ts_rate[i]) { | ||
1535 | r->idx = ath5k_hw_to_driver_rix(sc, ts->ts_rate[i]); | ||
1536 | r->count = ts->ts_retry[i]; | ||
1537 | } else { | ||
1538 | r->idx = -1; | ||
1539 | r->count = 0; | ||
1540 | } | ||
1541 | } | ||
1542 | |||
1543 | /* count the successful attempt as well */ | ||
1544 | info->status.rates[ts->ts_final_idx].count++; | ||
1545 | |||
1546 | if (unlikely(ts->ts_status)) { | ||
1547 | sc->stats.ack_fail++; | ||
1548 | if (ts->ts_status & AR5K_TXERR_FILT) { | ||
1549 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | ||
1550 | sc->stats.txerr_filt++; | ||
1551 | } | ||
1552 | if (ts->ts_status & AR5K_TXERR_XRETRY) | ||
1553 | sc->stats.txerr_retry++; | ||
1554 | if (ts->ts_status & AR5K_TXERR_FIFO) | ||
1555 | sc->stats.txerr_fifo++; | ||
1556 | } else { | ||
1557 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1558 | info->status.ack_signal = ts->ts_rssi; | ||
1559 | } | ||
1560 | |||
1561 | /* | ||
1562 | * Remove MAC header padding before giving the frame | ||
1563 | * back to mac80211. | ||
1564 | */ | ||
1565 | ath5k_remove_padding(skb); | ||
1566 | |||
1567 | if (ts->ts_antenna > 0 && ts->ts_antenna < 5) | ||
1568 | sc->stats.antenna_tx[ts->ts_antenna]++; | ||
1569 | else | ||
1570 | sc->stats.antenna_tx[0]++; /* invalid */ | ||
1571 | |||
1572 | ieee80211_tx_status(sc->hw, skb); | ||
1573 | } | ||
1519 | 1574 | ||
1520 | static void | 1575 | static void |
1521 | ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) | 1576 | ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) |
@@ -1524,8 +1579,7 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) | |||
1524 | struct ath5k_buf *bf, *bf0; | 1579 | struct ath5k_buf *bf, *bf0; |
1525 | struct ath5k_desc *ds; | 1580 | struct ath5k_desc *ds; |
1526 | struct sk_buff *skb; | 1581 | struct sk_buff *skb; |
1527 | struct ieee80211_tx_info *info; | 1582 | int ret; |
1528 | int i, ret; | ||
1529 | 1583 | ||
1530 | spin_lock(&txq->lock); | 1584 | spin_lock(&txq->lock); |
1531 | list_for_each_entry_safe(bf, bf0, &txq->q, list) { | 1585 | list_for_each_entry_safe(bf, bf0, &txq->q, list) { |
@@ -1541,7 +1595,6 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) | |||
1541 | if (ath5k_hw_get_txdp(sc->ah, txq->qnum) == bf->daddr && | 1595 | if (ath5k_hw_get_txdp(sc->ah, txq->qnum) == bf->daddr && |
1542 | !list_is_last(&bf->list, &txq->q)) | 1596 | !list_is_last(&bf->list, &txq->q)) |
1543 | break; | 1597 | break; |
1544 | |||
1545 | ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts); | 1598 | ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts); |
1546 | if (unlikely(ret == -EINPROGRESS)) | 1599 | if (unlikely(ret == -EINPROGRESS)) |
1547 | break; | 1600 | break; |
@@ -1551,58 +1604,12 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) | |||
1551 | break; | 1604 | break; |
1552 | } | 1605 | } |
1553 | 1606 | ||
1554 | sc->stats.tx_all_count++; | ||
1555 | skb = bf->skb; | 1607 | skb = bf->skb; |
1556 | info = IEEE80211_SKB_CB(skb); | ||
1557 | bf->skb = NULL; | 1608 | bf->skb = NULL; |
1558 | |||
1559 | pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, | 1609 | pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, |
1560 | PCI_DMA_TODEVICE); | 1610 | PCI_DMA_TODEVICE); |
1561 | 1611 | ||
1562 | ieee80211_tx_info_clear_status(info); | 1612 | ath5k_tx_frame_completed(sc, skb, &ts); |
1563 | for (i = 0; i < 4; i++) { | ||
1564 | struct ieee80211_tx_rate *r = | ||
1565 | &info->status.rates[i]; | ||
1566 | |||
1567 | if (ts.ts_rate[i]) { | ||
1568 | r->idx = ath5k_hw_to_driver_rix(sc, ts.ts_rate[i]); | ||
1569 | r->count = ts.ts_retry[i]; | ||
1570 | } else { | ||
1571 | r->idx = -1; | ||
1572 | r->count = 0; | ||
1573 | } | ||
1574 | } | ||
1575 | |||
1576 | /* count the successful attempt as well */ | ||
1577 | info->status.rates[ts.ts_final_idx].count++; | ||
1578 | |||
1579 | if (unlikely(ts.ts_status)) { | ||
1580 | sc->stats.ack_fail++; | ||
1581 | if (ts.ts_status & AR5K_TXERR_FILT) { | ||
1582 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | ||
1583 | sc->stats.txerr_filt++; | ||
1584 | } | ||
1585 | if (ts.ts_status & AR5K_TXERR_XRETRY) | ||
1586 | sc->stats.txerr_retry++; | ||
1587 | if (ts.ts_status & AR5K_TXERR_FIFO) | ||
1588 | sc->stats.txerr_fifo++; | ||
1589 | } else { | ||
1590 | info->flags |= IEEE80211_TX_STAT_ACK; | ||
1591 | info->status.ack_signal = ts.ts_rssi; | ||
1592 | } | ||
1593 | |||
1594 | /* | ||
1595 | * Remove MAC header padding before giving the frame | ||
1596 | * back to mac80211. | ||
1597 | */ | ||
1598 | ath5k_remove_padding(skb); | ||
1599 | |||
1600 | if (ts.ts_antenna > 0 && ts.ts_antenna < 5) | ||
1601 | sc->stats.antenna_tx[ts.ts_antenna]++; | ||
1602 | else | ||
1603 | sc->stats.antenna_tx[0]++; /* invalid */ | ||
1604 | |||
1605 | ieee80211_tx_status(sc->hw, skb); | ||
1606 | 1613 | ||
1607 | spin_lock(&sc->txbuflock); | 1614 | spin_lock(&sc->txbuflock); |
1608 | list_move_tail(&bf->list, &sc->txbuf); | 1615 | list_move_tail(&bf->list, &sc->txbuf); |