2009-08-17 16:56:29

by Ivo Van Doorn

[permalink] [raw]
Subject: [PATCH 4/7] rt2x00: Set SKBDESC_L2_PADDED in RX path

When the RX descriptor indicates the frame was L2 padded,
the SKBDESC_L2_PADDED flag should be set to make sure the
L2 padding is removed before it is send to mac80211.

Signed-off-by: Ivo van Doorn <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index c82474e..6de2eda 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -2163,8 +2163,10 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
rxdesc->dev_flags |= RXDONE_MY_BSS;

- if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD))
+ if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
rxdesc->dev_flags |= RXDONE_L2PAD;
+ skbdesc->flags |= SKBDESC_L2_PADDED;
+ }

if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
rxdesc->flags |= RX_FLAG_SHORT_GI;
--
1.6.4



2009-08-17 20:46:31

by Benoit Papillault

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/7] rt2x00: Set SKBDESC_L2_PADDED in RX path

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ivo van Doorn a ?crit :
> When the RX descriptor indicates the frame was L2 padded,
> the SKBDESC_L2_PADDED flag should be set to make sure the
> L2 padding is removed before it is send to mac80211.
>
> Signed-off-by: Ivo van Doorn <[email protected]>
> ---
> drivers/net/wireless/rt2x00/rt2800usb.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c
b/drivers/net/wireless/rt2x00/rt2800usb.c
> index c82474e..6de2eda 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -2163,8 +2163,10 @@ static void rt2800usb_fill_rxdone(struct
queue_entry *entry,
> if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
> rxdesc->dev_flags |= RXDONE_MY_BSS;
>
> - if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD))
> + if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
> rxdesc->dev_flags |= RXDONE_L2PAD;
> + skbdesc->flags |= SKBDESC_L2_PADDED;
> + }
>
> if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
> rxdesc->flags |= RX_FLAG_SHORT_GI;
I have tested this patch as well and it looks correct. However, during
my test, the hardware does not set L2PAD flag, even if padding is
present (for some frames). I did the same test with the rt2870sta
driver from Ralink and the L2PAD was indeed set.

Ivo : what happens during your tests?

Regards,
Benoit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJwZkACgkQOR6EySwP7oLcEACcDDUaE5oeOhF8CsC1hdg6cKQ6
7K4An2DKy76bVP2CpfhOJePGNrSWDI2v
=3ymH
-----END PGP SIGNATURE-----


2009-08-17 16:56:31

by Ivo Van Doorn

[permalink] [raw]
Subject: [PATCH 6/7] rt2x00: Fix MCS register intialization

According to the original Ralink driver,
LG_FBK_CFG0_OFDMMCS2FBK should be initialized to 9 rather then 3.

Based on a patch for rt2800pci from Benoit

Signed-off-by: Benoit PAPILLAULT <[email protected]>
Signed-off-by: Ivo van Doorn <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 3633e58..45e02f1 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1520,7 +1520,7 @@ static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev)
rt2x00usb_register_read(rt2x00dev, LG_FBK_CFG0, &reg);
rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS0FBK, 8);
rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS1FBK, 8);
- rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS2FBK, 3);
+ rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS2FBK, 9);
rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS3FBK, 10);
rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS4FBK, 11);
rt2x00_set_field32(&reg, LG_FBK_CFG0_OFDMMCS5FBK, 12);
--
1.6.4


2009-08-17 23:33:21

by Ivo Van Doorn

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH 4/7] rt2x00: Set SKBDESC_L2_PADDED in RX path

On Monday 17 August 2009, Benoit PAPILLAULT wrote:
> Ivo van Doorn a ?crit :
> > When the RX descriptor indicates the frame was L2 padded,
> > the SKBDESC_L2_PADDED flag should be set to make sure the
> > L2 padding is removed before it is send to mac80211.
> >
> > Signed-off-by: Ivo van Doorn <[email protected]>
> > ---
> > drivers/net/wireless/rt2x00/rt2800usb.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c
> b/drivers/net/wireless/rt2x00/rt2800usb.c
> > index c82474e..6de2eda 100644
> > --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> > +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> > @@ -2163,8 +2163,10 @@ static void rt2800usb_fill_rxdone(struct
> queue_entry *entry,
> > if (rt2x00_get_field32(rxd0, RXD_W0_MY_BSS))
> > rxdesc->dev_flags |= RXDONE_MY_BSS;
> >
> > - if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD))
> > + if (rt2x00_get_field32(rxd0, RXD_W0_L2PAD)) {
> > rxdesc->dev_flags |= RXDONE_L2PAD;
> > + skbdesc->flags |= SKBDESC_L2_PADDED;
> > + }
> >
> > if (rt2x00_get_field32(rxwi1, RXWI_W1_SHORT_GI))
> > rxdesc->flags |= RX_FLAG_SHORT_GI;
> I have tested this patch as well and it looks correct. However, during
> my test, the hardware does not set L2PAD flag, even if padding is
> present (for some frames). I did the same test with the rt2870sta
> driver from Ralink and the L2PAD was indeed set.

But when the flag is set, it is being set correctly?
Perhaps we can just set the flag at all times, because rt2x00lib
checks how much padding is required anyway. Unless of course
the device doesn't always add L2 padding when it actually should have.

> Ivo : what happens during your tests?

Tests?

I don't really have time to perform any testing, so all patches are
only checked by me for 'code correctness'.

2009-08-17 16:56:31

by Ivo Van Doorn

[permalink] [raw]
Subject: [PATCH 5/7] rt2x00: wireless CLI ID and packet ID must not be 0

In the TX descriptor the Packet ID must not be 0,
so add 1 to the ID. The wireless CLI ID is not allowed
to be 0 either, but also must be initialized with the
wcid value rather then keyid.

Based on a patch for rt2800pci from Benoit

Signed-off-by: Benoit PAPILLAULT <[email protected]>
Signed-off-by: Ivo van Doorn <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800usb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 6de2eda..3633e58 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1995,11 +1995,11 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(&word, TXWI_W1_BW_WIN_SIZE, txdesc->ba_size);
rt2x00_set_field32(&word, TXWI_W1_WIRELESS_CLI_ID,
test_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags) ?
- txdesc->key_idx : 0xff);
+ (skbdesc->entry->entry_idx + 1) : 0xff);
rt2x00_set_field32(&word, TXWI_W1_MPDU_TOTAL_BYTE_COUNT,
skb->len - txdesc->l2pad);
rt2x00_set_field32(&word, TXWI_W1_PACKETID,
- skbdesc->entry->entry_idx);
+ skbdesc->entry->queue->qid + 1);
rt2x00_desc_write(txwi, 1, word);

/*
--
1.6.4


2009-08-17 16:56:30

by Ivo Van Doorn

[permalink] [raw]
Subject: [PATCH 7/7] rt2x00: Add support for retry rates

From: Benoit PAPILLAULT <[email protected]>

rt2800pci can handle different retry rates,
it will always step 1 rate down after a failed
transmission so creating the retry rate list
for mac80211 is quite simple.

Signed-off-by: Benoit PAPILLAULT <[email protected]>
Signed-off-by: Ivo van Doorn <[email protected]>
---
drivers/net/wireless/rt2x00/rt2x00dev.c | 22 +++++++++++++++++-----
drivers/net/wireless/rt2x00/rt2x00queue.h | 2 ++
2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index b6676c6..9ab70e4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -220,7 +220,8 @@ void rt2x00lib_txdone(struct queue_entry *entry,
struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
unsigned int header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
- u8 rate_idx, rate_flags;
+ u8 rate_idx, rate_flags, retry_rates;
+ unsigned int i;

/*
* Unmap the skb.
@@ -259,16 +260,27 @@ void rt2x00lib_txdone(struct queue_entry *entry,

rate_idx = skbdesc->tx_rate_idx;
rate_flags = skbdesc->tx_rate_flags;
+ retry_rates = test_bit(TXDONE_FALLBACK, &txdesc->flags) ?
+ (txdesc->retry + 1) : 1;

/*
* Initialize TX status
*/
memset(&tx_info->status, 0, sizeof(tx_info->status));
tx_info->status.ack_signal = 0;
- tx_info->status.rates[0].idx = rate_idx;
- tx_info->status.rates[0].flags = rate_flags;
- tx_info->status.rates[0].count = txdesc->retry + 1;
- tx_info->status.rates[1].idx = -1; /* terminate */
+
+ /*
+ * Frame was send with retries, hardware tried
+ * different rates to send out the frame, at each
+ * retry it lowered the rate 1 step.
+ */
+ for (i = 0; i < retry_rates && i < IEEE80211_TX_MAX_RATES; i++) {
+ tx_info->status.rates[i].idx = rate_idx - i;
+ tx_info->status.rates[i].flags = rate_flags;
+ tx_info->status.rates[i].count = 1;
+ }
+ if (i < (IEEE80211_TX_MAX_RATES -1))
+ tx_info->status.rates[i].idx = -1; /* terminate */

if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
if (test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 47d175a..a5591fb 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -214,6 +214,7 @@ struct rxdone_entry_desc {
*
* @TXDONE_UNKNOWN: Hardware could not determine success of transmission.
* @TXDONE_SUCCESS: Frame was successfully send
+ * @TXDONE_FALLBACK: Frame was successfully send using a fallback rate.
* @TXDONE_FAILURE: Frame was not successfully send
* @TXDONE_EXCESSIVE_RETRY: In addition to &TXDONE_FAILURE, the
* frame transmission failed due to excessive retries.
@@ -221,6 +222,7 @@ struct rxdone_entry_desc {
enum txdone_entry_desc_flags {
TXDONE_UNKNOWN,
TXDONE_SUCCESS,
+ TXDONE_FALLBACK,
TXDONE_FAILURE,
TXDONE_EXCESSIVE_RETRY,
};
--
1.6.4