linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>,
	rt2x00 Users List <users@rt2x00.serialmonkey.com>,
	linux-wireless@vger.kernel.org,
	Gertjan van Wingerde <gwingerde@gmail.com>
Subject: [PATCH 10/14] rt2x00: Enable fallback rates for rt61pci and rt73usb
Date: Mon, 14 Jun 2010 22:12:54 +0200	[thread overview]
Message-ID: <201006142212.55156.IvDoorn@gmail.com> (raw)
In-Reply-To: <201006142212.27713.IvDoorn@gmail.com>

From: Ivo van Doorn <IvDoorn@gmail.com>

Explicitly enable the usage of fallback rates for
the transmission of frames with rt61pci and rt73usb hardware.

Note that for txdone reporting, only rt61pci is capable of
reporting the fallback rates, for USB it is not possible
to determine the number of retries. However the device will
use the fallback rates, so it might still help in the performance.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
 drivers/net/wireless/rt2x00/rt61pci.c |   22 ++++++++++++++++++++++
 drivers/net/wireless/rt2x00/rt73usb.c |    3 +++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 243df08..d127011 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -931,6 +931,9 @@ static void rt61pci_config_retry_limit(struct rt2x00_dev *rt2x00dev,
 	u32 reg;
 
 	rt2x00pci_register_read(rt2x00dev, TXRX_CSR4, &reg);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_RATE_DOWN, 1);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_RATE_STEP, 0);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_FALLBACK_CCK, 0);
 	rt2x00_set_field32(&reg, TXRX_CSR4_LONG_RETRY_LIMIT,
 			   libconf->conf->long_frame_max_tx_count);
 	rt2x00_set_field32(&reg, TXRX_CSR4_SHORT_RETRY_LIMIT,
@@ -2130,6 +2133,13 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
 		}
 		txdesc.retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT);
 
+		/*
+		 * the frame was retried at least once
+		 * -> hw used fallback rates
+		 */
+		if (txdesc.retry)
+			__set_bit(TXDONE_FALLBACK, &txdesc.flags);
+
 		rt2x00pci_txdone(entry, &txdesc);
 	}
 }
@@ -2587,6 +2597,18 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 						   EEPROM_MAC_ADDR_0));
 
 	/*
+	 * As rt61 has a global fallback table we cannot specify
+	 * more then one tx rate per frame but since the hw will
+	 * try several rates (based on the fallback table) we should
+	 * still initialize max_rates to the maximum number of rates
+	 * we are going to try. Otherwise mac80211 will truncate our
+	 * reported tx rates and the rc algortihm will end up with
+	 * incorrect data.
+	 */
+	rt2x00dev->hw->max_rates = 7;
+	rt2x00dev->hw->max_rate_tries = 1;
+
+	/*
 	 * Initialize hw_mode information.
 	 */
 	spec->supported_bands = SUPPORT_BAND_2GHZ;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 113ad69..d06d90f 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -816,6 +816,9 @@ static void rt73usb_config_retry_limit(struct rt2x00_dev *rt2x00dev,
 	u32 reg;
 
 	rt2x00usb_register_read(rt2x00dev, TXRX_CSR4, &reg);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_RATE_DOWN, 1);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_RATE_STEP, 0);
+	rt2x00_set_field32(&reg, TXRX_CSR4_OFDM_TX_FALLBACK_CCK, 0);
 	rt2x00_set_field32(&reg, TXRX_CSR4_LONG_RETRY_LIMIT,
 			   libconf->conf->long_frame_max_tx_count);
 	rt2x00_set_field32(&reg, TXRX_CSR4_SHORT_RETRY_LIMIT,
-- 
1.6.6.1


  reply	other threads:[~2010-06-14 20:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14 20:08 [PATCH 01/14] rt2x00: clarify meaning of txdone flags Ivo van Doorn
2010-06-14 20:09 ` [PATCH 02/14] rt2x00: don't use TXDONE_FALLBACK as success indicator Ivo van Doorn
2010-06-14 20:09   ` [PATCH 03/14] rt2x00: only set TXDONE_FALLBACK in rt2800pci if the frame was retried Ivo van Doorn
2010-06-14 20:10     ` [PATCH 04/14] rt2x00: Fix IEEE80211_TX_CTL_MORE_FRAMES handling Ivo van Doorn
2010-06-14 20:10       ` [PATCH 05/14] rt2x00: Add comment about BBP1_TX_POWER Ivo van Doorn
2010-06-14 20:11         ` [PATCH 06/14] rt2x00: Fix TX_STA_FIFO handling Ivo van Doorn
2010-06-14 20:11           ` [PATCH 07/14] rt2x00: Fix typo in rt2800_config_txpower Ivo van Doorn
2010-06-14 20:12             ` [PATCH 08/14] rt2x00: provide mac80211 a suitable max_rates value Ivo van Doorn
2010-06-14 20:12               ` [PATCH 09/14] rt2x00: Fix tx status reporting when falling back to the lowest rate Ivo van Doorn
2010-06-14 20:12                 ` Ivo van Doorn [this message]
2010-06-14 20:13                   ` [PATCH 11/14] rt2x00: Update author rt2800lib Ivo van Doorn
2010-06-14 20:13                     ` [PATCH 12/14] rt2x00: Limit TX done looping to number of TX ring entries Ivo van Doorn
2010-06-14 20:13                       ` [PATCH 13/14] rt2x00: Enable HW crypto by default Ivo van Doorn
2010-06-14 20:14                         ` [PATCH 14/14] rt2x00: Synchronize WCID initialization with legacy driver Ivo van Doorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006142212.55156.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).