aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBrian Cavagnolo <brian@cozybit.com>2011-03-17 14:58:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-03-30 14:15:13 -0400
commite600707b021efdc109e7becd467798da339ec26d (patch)
tree29a8d2287c1ef4bc33865ee9995029ebdfb43faa /drivers/net
parent5faa1aff08ef8d82b98ac2dfd7beb62ae6eda5e5 (diff)
mwl8k: differentiate between WMM queues and AMPDU queues
We now have two different kinds of queues. And the number of AMPDU queues may vary. So we must be clear about which queues we are dealing with. Note that when we report the number of queues to mac80211, we only report the WMM queues. Based on work by Yogesh Powar <yogeshp@marvell.com>. Signed-off-by: Brian Cavagnolo <brian@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwl8k.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 944ad030e4dd..53581ee8b79f 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -85,8 +85,10 @@ MODULE_PARM_DESC(ap_mode_default,
85 MWL8K_A2H_INT_TX_DONE) 85 MWL8K_A2H_INT_TX_DONE)
86 86
87#define MWL8K_RX_QUEUES 1 87#define MWL8K_RX_QUEUES 1
88#define MWL8K_TX_QUEUES 4 88#define MWL8K_TX_WMM_QUEUES 4
89#define MWL8K_MAX_AMPDU_QUEUES 8 89#define MWL8K_MAX_AMPDU_QUEUES 8
90#define MWL8K_MAX_TX_QUEUES (MWL8K_TX_WMM_QUEUES + MWL8K_MAX_AMPDU_QUEUES)
91#define mwl8k_tx_queues(priv) (MWL8K_TX_WMM_QUEUES + (priv)->num_ampdu_queues)
90 92
91struct rxd_ops { 93struct rxd_ops {
92 int rxd_size; 94 int rxd_size;
@@ -202,8 +204,8 @@ struct mwl8k_priv {
202 int pending_tx_pkts; 204 int pending_tx_pkts;
203 205
204 struct mwl8k_rx_queue rxq[MWL8K_RX_QUEUES]; 206 struct mwl8k_rx_queue rxq[MWL8K_RX_QUEUES];
205 struct mwl8k_tx_queue txq[MWL8K_TX_QUEUES + MWL8K_MAX_AMPDU_QUEUES]; 207 struct mwl8k_tx_queue txq[MWL8K_MAX_TX_QUEUES];
206 u32 txq_offset[MWL8K_TX_QUEUES + MWL8K_MAX_AMPDU_QUEUES]; 208 u32 txq_offset[MWL8K_MAX_TX_QUEUES];
207 209
208 bool radio_on; 210 bool radio_on;
209 bool radio_short_preamble; 211 bool radio_short_preamble;
@@ -236,7 +238,7 @@ struct mwl8k_priv {
236 * preserve the queue configurations so they can be restored if/when 238 * preserve the queue configurations so they can be restored if/when
237 * the firmware image is swapped. 239 * the firmware image is swapped.
238 */ 240 */
239 struct ieee80211_tx_queue_params wmm_params[MWL8K_TX_QUEUES]; 241 struct ieee80211_tx_queue_params wmm_params[MWL8K_TX_WMM_QUEUES];
240 242
241 /* async firmware loading state */ 243 /* async firmware loading state */
242 unsigned fw_state; 244 unsigned fw_state;
@@ -1400,7 +1402,7 @@ static void mwl8k_dump_tx_rings(struct ieee80211_hw *hw)
1400 struct mwl8k_priv *priv = hw->priv; 1402 struct mwl8k_priv *priv = hw->priv;
1401 int i; 1403 int i;
1402 1404
1403 for (i = 0; i < MWL8K_TX_QUEUES; i++) { 1405 for (i = 0; i < mwl8k_tx_queues(priv); i++) {
1404 struct mwl8k_tx_queue *txq = priv->txq + i; 1406 struct mwl8k_tx_queue *txq = priv->txq + i;
1405 int fw_owned = 0; 1407 int fw_owned = 0;
1406 int drv_owned = 0; 1408 int drv_owned = 0;
@@ -1888,7 +1890,7 @@ struct mwl8k_cmd_get_hw_spec_sta {
1888 __u8 mcs_bitmap[16]; 1890 __u8 mcs_bitmap[16];
1889 __le32 rx_queue_ptr; 1891 __le32 rx_queue_ptr;
1890 __le32 num_tx_queues; 1892 __le32 num_tx_queues;
1891 __le32 tx_queue_ptrs[MWL8K_TX_QUEUES]; 1893 __le32 tx_queue_ptrs[MWL8K_TX_WMM_QUEUES];
1892 __le32 caps2; 1894 __le32 caps2;
1893 __le32 num_tx_desc_per_queue; 1895 __le32 num_tx_desc_per_queue;
1894 __le32 total_rxd; 1896 __le32 total_rxd;
@@ -1994,8 +1996,8 @@ static int mwl8k_cmd_get_hw_spec_sta(struct ieee80211_hw *hw)
1994 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); 1996 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr));
1995 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); 1997 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma);
1996 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); 1998 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma);
1997 cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES); 1999 cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv));
1998 for (i = 0; i < MWL8K_TX_QUEUES; i++) 2000 for (i = 0; i < mwl8k_tx_queues(priv); i++)
1999 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].txd_dma); 2001 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].txd_dma);
2000 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); 2002 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS);
2001 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); 2003 cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS);
@@ -2101,7 +2103,7 @@ static int mwl8k_cmd_get_hw_spec_ap(struct ieee80211_hw *hw)
2101 priv->txq_offset[3] = le32_to_cpu(cmd->wcbbase3) & 0xffff; 2103 priv->txq_offset[3] = le32_to_cpu(cmd->wcbbase3) & 0xffff;
2102 2104
2103 for (i = 0; i < priv->num_ampdu_queues; i++) 2105 for (i = 0; i < priv->num_ampdu_queues; i++)
2104 priv->txq_offset[i + MWL8K_TX_QUEUES] = 2106 priv->txq_offset[i + MWL8K_TX_WMM_QUEUES] =
2105 le32_to_cpu(cmd->wcbbase_ampdu[i]) & 0xffff; 2107 le32_to_cpu(cmd->wcbbase_ampdu[i]) & 0xffff;
2106 } 2108 }
2107 2109
@@ -2125,7 +2127,7 @@ struct mwl8k_cmd_set_hw_spec {
2125 __le32 caps; 2127 __le32 caps;
2126 __le32 rx_queue_ptr; 2128 __le32 rx_queue_ptr;
2127 __le32 num_tx_queues; 2129 __le32 num_tx_queues;
2128 __le32 tx_queue_ptrs[MWL8K_TX_QUEUES]; 2130 __le32 tx_queue_ptrs[MWL8K_MAX_TX_QUEUES];
2129 __le32 flags; 2131 __le32 flags;
2130 __le32 num_tx_desc_per_queue; 2132 __le32 num_tx_desc_per_queue;
2131 __le32 total_rxd; 2133 __le32 total_rxd;
@@ -2159,7 +2161,7 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw)
2159 2161
2160 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); 2162 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma);
2161 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma); 2163 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma);
2162 cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES); 2164 cmd->num_tx_queues = cpu_to_le32(mwl8k_tx_queues(priv));
2163 2165
2164 /* 2166 /*
2165 * Mac80211 stack has Q0 as highest priority and Q3 as lowest in 2167 * Mac80211 stack has Q0 as highest priority and Q3 as lowest in
@@ -2167,8 +2169,8 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw)
2167 * in that order. Map Q3 of mac80211 to Q0 of firmware so that the 2169 * in that order. Map Q3 of mac80211 to Q0 of firmware so that the
2168 * priority is interpreted the right way in firmware. 2170 * priority is interpreted the right way in firmware.
2169 */ 2171 */
2170 for (i = 0; i < MWL8K_TX_QUEUES; i++) { 2172 for (i = 0; i < mwl8k_tx_queues(priv); i++) {
2171 int j = MWL8K_TX_QUEUES - 1 - i; 2173 int j = mwl8k_tx_queues(priv) - 1 - i;
2172 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[j].txd_dma); 2174 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[j].txd_dma);
2173 } 2175 }
2174 2176
@@ -3880,7 +3882,7 @@ static void mwl8k_tx_poll(unsigned long data)
3880 3882
3881 spin_lock_bh(&priv->tx_lock); 3883 spin_lock_bh(&priv->tx_lock);
3882 3884
3883 for (i = 0; i < MWL8K_TX_QUEUES; i++) 3885 for (i = 0; i < mwl8k_tx_queues(priv); i++)
3884 limit -= mwl8k_txq_reclaim(hw, i, limit, 0); 3886 limit -= mwl8k_txq_reclaim(hw, i, limit, 0);
3885 3887
3886 if (!priv->pending_tx_pkts && priv->tx_wait != NULL) { 3888 if (!priv->pending_tx_pkts && priv->tx_wait != NULL) {
@@ -4012,7 +4014,7 @@ static void mwl8k_stop(struct ieee80211_hw *hw)
4012 tasklet_disable(&priv->poll_rx_task); 4014 tasklet_disable(&priv->poll_rx_task);
4013 4015
4014 /* Return all skbs to mac80211 */ 4016 /* Return all skbs to mac80211 */
4015 for (i = 0; i < MWL8K_TX_QUEUES; i++) 4017 for (i = 0; i < mwl8k_tx_queues(priv); i++)
4016 mwl8k_txq_reclaim(hw, i, INT_MAX, 1); 4018 mwl8k_txq_reclaim(hw, i, INT_MAX, 1);
4017} 4019}
4018 4020
@@ -4510,14 +4512,14 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue,
4510 4512
4511 rc = mwl8k_fw_lock(hw); 4513 rc = mwl8k_fw_lock(hw);
4512 if (!rc) { 4514 if (!rc) {
4513 BUG_ON(queue > MWL8K_TX_QUEUES - 1); 4515 BUG_ON(queue > MWL8K_TX_WMM_QUEUES - 1);
4514 memcpy(&priv->wmm_params[queue], params, sizeof(*params)); 4516 memcpy(&priv->wmm_params[queue], params, sizeof(*params));
4515 4517
4516 if (!priv->wmm_enabled) 4518 if (!priv->wmm_enabled)
4517 rc = mwl8k_cmd_set_wmm_mode(hw, 1); 4519 rc = mwl8k_cmd_set_wmm_mode(hw, 1);
4518 4520
4519 if (!rc) { 4521 if (!rc) {
4520 int q = MWL8K_TX_QUEUES - 1 - queue; 4522 int q = MWL8K_TX_WMM_QUEUES - 1 - queue;
4521 rc = mwl8k_cmd_set_edca_params(hw, q, 4523 rc = mwl8k_cmd_set_edca_params(hw, q,
4522 params->cw_min, 4524 params->cw_min,
4523 params->cw_max, 4525 params->cw_max,
@@ -4788,7 +4790,7 @@ static int mwl8k_init_txqs(struct ieee80211_hw *hw)
4788 int rc = 0; 4790 int rc = 0;
4789 int i; 4791 int i;
4790 4792
4791 for (i = 0; i < MWL8K_TX_QUEUES; i++) { 4793 for (i = 0; i < mwl8k_tx_queues(priv); i++) {
4792 rc = mwl8k_txq_init(hw, i); 4794 rc = mwl8k_txq_init(hw, i);
4793 if (rc) 4795 if (rc)
4794 break; 4796 break;
@@ -4906,7 +4908,7 @@ err_free_irq:
4906 free_irq(priv->pdev->irq, hw); 4908 free_irq(priv->pdev->irq, hw);
4907 4909
4908err_free_queues: 4910err_free_queues:
4909 for (i = 0; i < MWL8K_TX_QUEUES; i++) 4911 for (i = 0; i < mwl8k_tx_queues(priv); i++)
4910 mwl8k_txq_deinit(hw, i); 4912 mwl8k_txq_deinit(hw, i);
4911 mwl8k_rxq_deinit(hw, 0); 4913 mwl8k_rxq_deinit(hw, 0);
4912 4914
@@ -4928,7 +4930,7 @@ static int mwl8k_reload_firmware(struct ieee80211_hw *hw, char *fw_image)
4928 mwl8k_stop(hw); 4930 mwl8k_stop(hw);
4929 mwl8k_rxq_deinit(hw, 0); 4931 mwl8k_rxq_deinit(hw, 0);
4930 4932
4931 for (i = 0; i < MWL8K_TX_QUEUES; i++) 4933 for (i = 0; i < mwl8k_tx_queues(priv); i++)
4932 mwl8k_txq_deinit(hw, i); 4934 mwl8k_txq_deinit(hw, i);
4933 4935
4934 rc = mwl8k_init_firmware(hw, fw_image, false); 4936 rc = mwl8k_init_firmware(hw, fw_image, false);
@@ -4947,7 +4949,7 @@ static int mwl8k_reload_firmware(struct ieee80211_hw *hw, char *fw_image)
4947 if (rc) 4949 if (rc)
4948 goto fail; 4950 goto fail;
4949 4951
4950 for (i = 0; i < MWL8K_TX_QUEUES; i++) { 4952 for (i = 0; i < MWL8K_TX_WMM_QUEUES; i++) {
4951 rc = mwl8k_conf_tx(hw, i, &priv->wmm_params[i]); 4953 rc = mwl8k_conf_tx(hw, i, &priv->wmm_params[i]);
4952 if (rc) 4954 if (rc)
4953 goto fail; 4955 goto fail;
@@ -4981,7 +4983,7 @@ static int mwl8k_firmware_load_success(struct mwl8k_priv *priv)
4981 4983
4982 hw->channel_change_time = 10; 4984 hw->channel_change_time = 10;
4983 4985
4984 hw->queues = MWL8K_TX_QUEUES; 4986 hw->queues = MWL8K_TX_WMM_QUEUES;
4985 4987
4986 /* Set rssi values to dBm */ 4988 /* Set rssi values to dBm */
4987 hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL; 4989 hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
@@ -5037,7 +5039,7 @@ static int mwl8k_firmware_load_success(struct mwl8k_priv *priv)
5037 return 0; 5039 return 0;
5038 5040
5039err_unprobe_hw: 5041err_unprobe_hw:
5040 for (i = 0; i < MWL8K_TX_QUEUES; i++) 5042 for (i = 0; i < mwl8k_tx_queues(priv); i++)
5041 mwl8k_txq_deinit(hw, i); 5043 mwl8k_txq_deinit(hw, i);
5042 mwl8k_rxq_deinit(hw, 0); 5044 mwl8k_rxq_deinit(hw, 0);
5043 5045
@@ -5196,10 +5198,10 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
5196 mwl8k_hw_reset(priv); 5198 mwl8k_hw_reset(priv);
5197 5199
5198 /* Return all skbs to mac80211 */ 5200 /* Return all skbs to mac80211 */
5199 for (i = 0; i < MWL8K_TX_QUEUES; i++) 5201 for (i = 0; i < mwl8k_tx_queues(priv); i++)
5200 mwl8k_txq_reclaim(hw, i, INT_MAX, 1); 5202 mwl8k_txq_reclaim(hw, i, INT_MAX, 1);
5201 5203
5202 for (i = 0; i < MWL8K_TX_QUEUES; i++) 5204 for (i = 0; i < mwl8k_tx_queues(priv); i++)
5203 mwl8k_txq_deinit(hw, i); 5205 mwl8k_txq_deinit(hw, i);
5204 5206
5205 mwl8k_rxq_deinit(hw, 0); 5207 mwl8k_rxq_deinit(hw, 0);