Skip to contentSkip to conversation

mwl8k: fix rf_antenna rx argument for AP

PATCH In review Thomas Pedersen 2 participants 4 messages Feb 17, 2011 – Feb 22, 2011 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 mwl8k: fix rf_antenna rx argument for AP

From: Nishant Sarmukadam <[email protected]>

When configuring rx antennas using CMD_RF_ANTENNA, the argument input is the number of antennas to be enabled. For AP, we support 3 rx antennas and hence set the field to 3. For tx antennas, value is a bitmap, so 0x7 enables all three.

---
 drivers/net/wireless/mwl8k.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/mwl8k.c +7 -3
index af4f2c6..f79da1b 100644
@@ -3945,9 +3945,13 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed)
 		if (rc)
 			goto out;
 
-		rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_RX, 0x7);
-		if (!rc)
-			rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_TX, 0x7);
+		rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_RX, 0x3);
+		if (rc)
+			wiphy_warn(hw->wiphy, "failed to set # of RX antennas");
+		rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_TX, 0x7);
+		if (rc)
+			wiphy_warn(hw->wiphy, "failed to set # of TX antennas");
+
 	} else {
 		rc = mwl8k_cmd_rf_tx_power(hw, conf->power_level);
 		if (rc)
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 2/3 mwl8k: Tell mac80211 we have rate adaptation in FW

From: Nishant Sarmukadam <[email protected]>

All mwl8k parts perform rate control in firmware. Make this known to mac80211 so that it does not launch minstrel. Also, because actual tx rate information is not available from the firmware, invalidate the rate status before returning the skb to mac80211.

---
 drivers/net/wireless/mwl8k.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/net/wireless/mwl8k.c +8 -1
index f79da1b..44355f7 100644
@@ -1535,6 +1535,13 @@ mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force)
 
 		info = IEEE80211_SKB_CB(skb);
 		ieee80211_tx_info_clear_status(info);
+
+		/* Rate control is happening in the firmware.
+		 * Ensure no tx rate is being reported.
+		 */
+                info->status.rates[0].idx = -1;
+                info->status.rates[0].count = 1;
+
 		if (MWL8K_TXD_SUCCESS(status))
 			info->flags |= IEEE80211_TX_STAT_ACK;
 
@@ -4764,7 +4771,7 @@ static int mwl8k_firmware_load_success(struct mwl8k_priv *priv)
 	hw->queues = MWL8K_TX_QUEUES;
 
 	/* Set rssi values to dBm */
-	hw->flags |= IEEE80211_HW_SIGNAL_DBM;
+	hw->flags |= IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_HAS_RATE_CONTROL;
 	hw->vif_data_size = sizeof(struct mwl8k_vif);
 	hw->sta_data_size = sizeof(struct mwl8k_sta);
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 3/3 mwl8k: Invert tx queues for set_hw_spec and set_edca_params

In reply to Thomas Pedersen

From: Nishant Sarmukadam <[email protected]>

mac80211 and mwl8k FW tx queue priorities map inversely to each other. Fix this.

---
 drivers/net/wireless/mwl8k.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/wireless/mwl8k.c +16 -4
index 44355f7..03f2584 100644
@@ -2128,8 +2128,18 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw)
 	cmd->ps_cookie = cpu_to_le32(priv->cookie_dma);
 	cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rxd_dma);
 	cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES);
-	for (i = 0; i < MWL8K_TX_QUEUES; i++)
-		cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].txd_dma);
+
+	/*
+	 * Mac80211 stack has Q0 as highest priority and Q3 as lowest in
+	 * that order. Firmware has Q3 as highest priority and Q0 as lowest
+	 * in that order. Map Q3 of mac80211 to Q0 of firmware so that the
+	 * priority is interpreted the right way in firmware.
+	 */
+	for (i = 0; i < MWL8K_TX_QUEUES; i++) {
+		int j = MWL8K_TX_QUEUES - 1 - i;
+		cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[j].txd_dma);
+	}
+
 	cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT |
 				 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP |
 				 MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON);
@@ -4331,12 +4341,14 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue,
 		if (!priv->wmm_enabled)
 			rc = mwl8k_cmd_set_wmm_mode(hw, 1);
 
-		if (!rc)
-			rc = mwl8k_cmd_set_edca_params(hw, queue,
+		if (!rc) {
+			int q = MWL8K_TX_QUEUES - 1 - queue;
+			rc = mwl8k_cmd_set_edca_params(hw, q,
 						       params->cw_min,
 						       params->cw_max,
 						       params->aifs,
 						       params->txop);
+		}
 
 		mwl8k_fw_unlock(hw);
 	}
Signature · 1 line
1.7.0.4
#3 lore raw
In reply to Thomas Pedersen
Quoted 10 lines · Thomas Pedersen

From: Nishant Sarmukadam <[email protected]>

When configuring rx antennas using CMD_RF_ANTENNA, the argument input is the number of antennas to be enabled. For AP, we support 3 rx antennas and hence set the field to 3. For tx antennas, value is a bitmap, so 0x7 enables all three.

I hope you registered your displeasure with the firmware writers over this API detail...

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.