diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-05-29 04:35:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-03 15:00:24 -0400 |
commit | a332f8d618a7bdb0096c7b21555120a1822cedec (patch) | |
tree | 4535d0e93f742c324d77314f961090b3cf71a24d /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 001caff0da8784989ef208af0f39d55ea07dfef5 (diff) |
iwlwifi: move tx response common handlers to iwlcore
This pach moves common tx response handlers to the header files
and iwl-tx.c.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 69 |
1 files changed, 7 insertions, 62 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index af8394c4b2df..411fad32e95a 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -915,33 +915,7 @@ int iwl4965_is_network_packet(struct iwl_priv *priv, struct ieee80211_hdr *heade | |||
915 | return 1; | 915 | return 1; |
916 | } | 916 | } |
917 | 917 | ||
918 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x | ||
919 | 918 | ||
920 | static const char *iwl4965_get_tx_fail_reason(u32 status) | ||
921 | { | ||
922 | switch (status & TX_STATUS_MSK) { | ||
923 | case TX_STATUS_SUCCESS: | ||
924 | return "SUCCESS"; | ||
925 | TX_STATUS_ENTRY(SHORT_LIMIT); | ||
926 | TX_STATUS_ENTRY(LONG_LIMIT); | ||
927 | TX_STATUS_ENTRY(FIFO_UNDERRUN); | ||
928 | TX_STATUS_ENTRY(MGMNT_ABORT); | ||
929 | TX_STATUS_ENTRY(NEXT_FRAG); | ||
930 | TX_STATUS_ENTRY(LIFE_EXPIRE); | ||
931 | TX_STATUS_ENTRY(DEST_PS); | ||
932 | TX_STATUS_ENTRY(ABORTED); | ||
933 | TX_STATUS_ENTRY(BT_RETRY); | ||
934 | TX_STATUS_ENTRY(STA_INVALID); | ||
935 | TX_STATUS_ENTRY(FRAG_DROPPED); | ||
936 | TX_STATUS_ENTRY(TID_DISABLE); | ||
937 | TX_STATUS_ENTRY(FRAME_FLUSHED); | ||
938 | TX_STATUS_ENTRY(INSUFFICIENT_CF_POLL); | ||
939 | TX_STATUS_ENTRY(TX_LOCKED); | ||
940 | TX_STATUS_ENTRY(NO_BEACON_ON_RADAR); | ||
941 | } | ||
942 | |||
943 | return "UNKNOWN"; | ||
944 | } | ||
945 | 919 | ||
946 | /** | 920 | /** |
947 | * iwl4965_scan_cancel - Cancel any currently executing HW scan | 921 | * iwl4965_scan_cancel - Cancel any currently executing HW scan |
@@ -1606,40 +1580,12 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
1606 | return nfreed; | 1580 | return nfreed; |
1607 | } | 1581 | } |
1608 | 1582 | ||
1609 | static int iwl4965_is_tx_success(u32 status) | ||
1610 | { | ||
1611 | status &= TX_STATUS_MSK; | ||
1612 | return (status == TX_STATUS_SUCCESS) | ||
1613 | || (status == TX_STATUS_DIRECT_DONE); | ||
1614 | } | ||
1615 | |||
1616 | /****************************************************************************** | 1583 | /****************************************************************************** |
1617 | * | 1584 | * |
1618 | * Generic RX handler implementations | 1585 | * Generic RX handler implementations |
1619 | * | 1586 | * |
1620 | ******************************************************************************/ | 1587 | ******************************************************************************/ |
1621 | #ifdef CONFIG_IWL4965_HT | 1588 | #ifdef CONFIG_IWL4965_HT |
1622 | |||
1623 | static inline int iwl4965_get_ra_sta_id(struct iwl_priv *priv, | ||
1624 | struct ieee80211_hdr *hdr) | ||
1625 | { | ||
1626 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) | ||
1627 | return IWL_AP_ID; | ||
1628 | else { | ||
1629 | u8 *da = ieee80211_get_DA(hdr); | ||
1630 | return iwl_find_station(priv, da); | ||
1631 | } | ||
1632 | } | ||
1633 | |||
1634 | static struct ieee80211_hdr *iwl4965_tx_queue_get_hdr( | ||
1635 | struct iwl_priv *priv, int txq_id, int idx) | ||
1636 | { | ||
1637 | if (priv->txq[txq_id].txb[idx].skb[0]) | ||
1638 | return (struct ieee80211_hdr *)priv->txq[txq_id]. | ||
1639 | txb[idx].skb[0]->data; | ||
1640 | return NULL; | ||
1641 | } | ||
1642 | |||
1643 | static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) | 1589 | static inline u32 iwl4965_get_scd_ssn(struct iwl4965_tx_resp *tx_resp) |
1644 | { | 1590 | { |
1645 | __le32 *scd_ssn = (__le32 *)((u32 *)&tx_resp->status + | 1591 | __le32 *scd_ssn = (__le32 *)((u32 *)&tx_resp->status + |
@@ -1687,7 +1633,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
1687 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); | 1633 | info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); |
1688 | info->status.retry_count = tx_resp->failure_frame; | 1634 | info->status.retry_count = tx_resp->failure_frame; |
1689 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | 1635 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; |
1690 | info->flags |= iwl4965_is_tx_success(status)? | 1636 | info->flags |= iwl_is_tx_success(status)? |
1691 | IEEE80211_TX_STAT_ACK : 0; | 1637 | IEEE80211_TX_STAT_ACK : 0; |
1692 | iwl4965_hwrate_to_tx_control(priv, | 1638 | iwl4965_hwrate_to_tx_control(priv, |
1693 | le32_to_cpu(tx_resp->rate_n_flags), | 1639 | le32_to_cpu(tx_resp->rate_n_flags), |
@@ -1720,7 +1666,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
1720 | IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", | 1666 | IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", |
1721 | agg->frame_count, txq_id, idx); | 1667 | agg->frame_count, txq_id, idx); |
1722 | 1668 | ||
1723 | hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, idx); | 1669 | hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx); |
1724 | 1670 | ||
1725 | sc = le16_to_cpu(hdr->seq_ctrl); | 1671 | sc = le16_to_cpu(hdr->seq_ctrl); |
1726 | if (idx != (SEQ_TO_SN(sc) & 0xff)) { | 1672 | if (idx != (SEQ_TO_SN(sc) & 0xff)) { |
@@ -1800,14 +1746,14 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
1800 | memset(&info->status, 0, sizeof(info->status)); | 1746 | memset(&info->status, 0, sizeof(info->status)); |
1801 | 1747 | ||
1802 | #ifdef CONFIG_IWL4965_HT | 1748 | #ifdef CONFIG_IWL4965_HT |
1803 | hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index); | 1749 | hdr = iwl_tx_queue_get_hdr(priv, txq_id, index); |
1804 | fc = le16_to_cpu(hdr->frame_control); | 1750 | fc = le16_to_cpu(hdr->frame_control); |
1805 | if (ieee80211_is_qos_data(fc)) { | 1751 | if (ieee80211_is_qos_data(fc)) { |
1806 | qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc)); | 1752 | qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc)); |
1807 | tid = qc[0] & 0xf; | 1753 | tid = qc[0] & 0xf; |
1808 | } | 1754 | } |
1809 | 1755 | ||
1810 | sta_id = iwl4965_get_ra_sta_id(priv, hdr); | 1756 | sta_id = iwl_get_ra_sta_id(priv, hdr); |
1811 | if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { | 1757 | if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { |
1812 | IWL_ERROR("Station not known\n"); | 1758 | IWL_ERROR("Station not known\n"); |
1813 | return; | 1759 | return; |
@@ -1825,8 +1771,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
1825 | iwl4965_tx_status_reply_tx(priv, agg, | 1771 | iwl4965_tx_status_reply_tx(priv, agg, |
1826 | (struct iwl4965_tx_resp_agg *)tx_resp, index); | 1772 | (struct iwl4965_tx_resp_agg *)tx_resp, index); |
1827 | 1773 | ||
1828 | if ((tx_resp->frame_count == 1) && | 1774 | if ((tx_resp->frame_count == 1) && !iwl_is_tx_success(status)) { |
1829 | !iwl4965_is_tx_success(status)) { | ||
1830 | /* TODO: send BAR */ | 1775 | /* TODO: send BAR */ |
1831 | } | 1776 | } |
1832 | 1777 | ||
@@ -1856,12 +1801,12 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
1856 | 1801 | ||
1857 | info->status.retry_count = tx_resp->failure_frame; | 1802 | info->status.retry_count = tx_resp->failure_frame; |
1858 | info->flags |= | 1803 | info->flags |= |
1859 | iwl4965_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; | 1804 | iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; |
1860 | iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), | 1805 | iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), |
1861 | info); | 1806 | info); |
1862 | 1807 | ||
1863 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " | 1808 | IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " |
1864 | "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status), | 1809 | "retries %d\n", txq_id, iwl_get_tx_fail_reason(status), |
1865 | status, le32_to_cpu(tx_resp->rate_n_flags), | 1810 | status, le32_to_cpu(tx_resp->rate_n_flags), |
1866 | tx_resp->failure_frame); | 1811 | tx_resp->failure_frame); |
1867 | 1812 | ||