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 | |
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')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 30 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-tx.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 69 |
5 files changed, 79 insertions, 62 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index bad0e94e4e5d..2652e3746ef5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -1365,6 +1365,15 @@ enum { | |||
1365 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ | 1365 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ |
1366 | }; | 1366 | }; |
1367 | 1367 | ||
1368 | static inline int iwl_is_tx_success(u32 status) | ||
1369 | { | ||
1370 | status &= TX_STATUS_MSK; | ||
1371 | return (status == TX_STATUS_SUCCESS) | ||
1372 | || (status == TX_STATUS_DIRECT_DONE); | ||
1373 | } | ||
1374 | |||
1375 | |||
1376 | |||
1368 | /* ******************************* | 1377 | /* ******************************* |
1369 | * TX aggregation status | 1378 | * TX aggregation status |
1370 | ******************************* */ | 1379 | ******************************* */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 9d43085ead9c..9449b61c8c0e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -209,6 +209,8 @@ void iwl_rx_allocate(struct iwl_priv *priv); | |||
209 | void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, | 209 | void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, |
210 | struct iwl_rx_mem_buffer *rxb); | 210 | struct iwl_rx_mem_buffer *rxb); |
211 | 211 | ||
212 | /* TX helpers */ | ||
213 | |||
212 | /***************************************************** | 214 | /***************************************************** |
213 | * TX | 215 | * TX |
214 | ******************************************************/ | 216 | ******************************************************/ |
@@ -220,6 +222,7 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv); | |||
220 | int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, | 222 | int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd, |
221 | dma_addr_t addr, u16 len); | 223 | dma_addr_t addr, u16 len); |
222 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); | 224 | int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq); |
225 | |||
223 | /***************************************************** | 226 | /***************************************************** |
224 | * S e n d i n g H o s t C o m m a n d s * | 227 | * S e n d i n g H o s t C o m m a n d s * |
225 | *****************************************************/ | 228 | *****************************************************/ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 291c1ec9b0de..934331304703 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1242,6 +1242,36 @@ static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id) | |||
1242 | clear_bit(txq_id, &priv->txq_ctx_active_msk); | 1242 | clear_bit(txq_id, &priv->txq_ctx_active_msk); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | #ifdef CONFIG_IWLWIF_DEBUG | ||
1246 | const char *iwl_get_tx_fail_reason(u32 status); | ||
1247 | #else | ||
1248 | static inline const char *iwl_get_tx_fail_reason(u32 status) { return ""; } | ||
1249 | #endif | ||
1250 | |||
1251 | |||
1252 | #ifdef CONFIG_IWL4965_HT | ||
1253 | static inline int iwl_get_ra_sta_id(struct iwl_priv *priv, | ||
1254 | struct ieee80211_hdr *hdr) | ||
1255 | { | ||
1256 | if (priv->iw_mode == IEEE80211_IF_TYPE_STA) { | ||
1257 | return IWL_AP_ID; | ||
1258 | } else { | ||
1259 | u8 *da = ieee80211_get_DA(hdr); | ||
1260 | return iwl_find_station(priv, da); | ||
1261 | } | ||
1262 | } | ||
1263 | |||
1264 | static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv, | ||
1265 | int txq_id, int idx) | ||
1266 | { | ||
1267 | if (priv->txq[txq_id].txb[idx].skb[0]) | ||
1268 | return (struct ieee80211_hdr *)priv->txq[txq_id]. | ||
1269 | txb[idx].skb[0]->data; | ||
1270 | return NULL; | ||
1271 | } | ||
1272 | #endif | ||
1273 | |||
1274 | |||
1245 | static inline int iwl_is_associated(struct iwl_priv *priv) | 1275 | static inline int iwl_is_associated(struct iwl_priv *priv) |
1246 | { | 1276 | { |
1247 | return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; | 1277 | return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 0b822b5ab523..885a4c11ac49 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -1060,3 +1060,33 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1060 | return ret ? ret : idx; | 1060 | return ret ? ret : idx; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | #ifdef CONFIG_IWLWIF_DEBUG | ||
1064 | #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x | ||
1065 | |||
1066 | const char *iwl_get_tx_fail_reason(u32 status) | ||
1067 | { | ||
1068 | switch (status & TX_STATUS_MSK) { | ||
1069 | case TX_STATUS_SUCCESS: | ||
1070 | return "SUCCESS"; | ||
1071 | TX_STATUS_ENTRY(SHORT_LIMIT); | ||
1072 | TX_STATUS_ENTRY(LONG_LIMIT); | ||
1073 | TX_STATUS_ENTRY(FIFO_UNDERRUN); | ||
1074 | TX_STATUS_ENTRY(MGMNT_ABORT); | ||
1075 | TX_STATUS_ENTRY(NEXT_FRAG); | ||
1076 | TX_STATUS_ENTRY(LIFE_EXPIRE); | ||
1077 | TX_STATUS_ENTRY(DEST_PS); | ||
1078 | TX_STATUS_ENTRY(ABORTED); | ||
1079 | TX_STATUS_ENTRY(BT_RETRY); | ||
1080 | TX_STATUS_ENTRY(STA_INVALID); | ||
1081 | TX_STATUS_ENTRY(FRAG_DROPPED); | ||
1082 | TX_STATUS_ENTRY(TID_DISABLE); | ||
1083 | TX_STATUS_ENTRY(FRAME_FLUSHED); | ||
1084 | TX_STATUS_ENTRY(INSUFFICIENT_CF_POLL); | ||
1085 | TX_STATUS_ENTRY(TX_LOCKED); | ||
1086 | TX_STATUS_ENTRY(NO_BEACON_ON_RADAR); | ||
1087 | } | ||
1088 | |||
1089 | return "UNKNOWN"; | ||
1090 | } | ||
1091 | EXPORT_SYMBOL(iwl_get_tx_fail_reason); | ||
1092 | #endif /* CONFIG_IWLWIFI_DEBUG */ | ||
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 | ||