rt2x00: rt2800: use correct txop value in tx descriptor
PATCH 3/3 rt2x00: rt2800: use correct txop value in tx descriptor
rt2800 devices use a different enumeration to specify what IFS values should be used on frame transmission compared to the other rt2x00 devices. Hence, create a new enum called txop that contains the valid values.
Furthermore use TXOP_HTTXOP as default on HT devices which means that the hardware should select the correct IFS value on its own.
I'm not sure if we have the need to specify one of the other txop values in the future but as far as I could see TXOP_HTTXOP is used by the Ralink drivers for all normal data frames and should be a reasonable default.
This patch doesn't really fix anything as until now the IFS_BACKOFF(=0) value was used as txop which luckily mapped to TXOP_HTTXOP(=0).
--- drivers/net/wireless/rt2x00/rt2800pci.c | 2 +- drivers/net/wireless/rt2x00/rt2800usb.c | 2 +- drivers/net/wireless/rt2x00/rt2x00ht.c | 2 ++ drivers/net/wireless/rt2x00/rt2x00queue.h | 2 ++ drivers/net/wireless/rt2x00/rt2x00reg.h | 10 ++++++++++ 5 files changed, 16 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +1 -1
@@ -643,7 +643,7 @@ static int rt2800pci_write_tx_data(struct queue_entry* entry,rt2x00_set_field32 (&word,TXWI_W0_AMPDU ,test_bit (ENTRY_TXD_HT_AMPDU , &txdesc->flags));rt2x00_set_field32 (&word,TXWI_W0_MPDU_DENSITY , txdesc->mpdu_density); -rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->ifs); +rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->txop);rt2x00_set_field32 (&word,TXWI_W0_MCS , txdesc->mcs);rt2x00_set_field32 (&word,TXWI_W0_BW ,test_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags));
drivers/net/wireless/rt2x00/rt2800usb.c +1 -1
@@ -417,7 +417,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,rt2x00_set_field32 (&word,TXWI_W0_AMPDU ,test_bit (ENTRY_TXD_HT_AMPDU , &txdesc->flags));rt2x00_set_field32 (&word,TXWI_W0_MPDU_DENSITY , txdesc->mpdu_density); -rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->ifs); +rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->txop);rt2x00_set_field32 (&word,TXWI_W0_MCS , txdesc->mcs);rt2x00_set_field32 (&word,TXWI_W0_BW ,test_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags));
drivers/net/wireless/rt2x00/rt2x00ht.c +2 -0
@@ -66,4 +66,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,__set_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags);if (txrate->flags &IEEE80211_TX_RC_SHORT_GI )__set_bit (ENTRY_TXD_HT_SHORT_GI , &txdesc->flags); + + txdesc->txop =TXOP_HTTXOP ; }
drivers/net/wireless/rt2x00/rt2x00queue.h +2 -0
@@ -299,6 +299,7 @@ enum txentry_desc_flags {* @retry_limit: Max number of retries. * @aifs: AIFS value. * @ifs: IFS value. +* @txop: IFS value for 11n capable chips. * @cw_min: cwmin value. * @cw_max: cwmax value. * @cipher: Cipher type used for encryption.
@@ -328,6 +329,7 @@ struct txentry_desc {short retry_limit;short aifs;short ifs; +short txop;short cw_min;short cw_max;
drivers/net/wireless/rt2x00/rt2x00reg.h +10 -0
@@ -101,6 +101,16 @@ enum ifs { };/* +* IFS values for HT devices +*/ +enum txop { +TXOP_HTTXOP =0 , +TXOP_PIFS =1 , +TXOP_SIFS =2 , +TXOP_BACKOFF =3 , +}; + +/* * Cipher types for hardware encryption */ enum cipher {
Signature · 1 line
1.6.4.2
Quoted 54 lines · Helmut Schaa
rt2800 devices use a different enumeration to specify what IFS values should be used on frame transmission compared to the other rt2x00 devices. Hence, create a new enum called txop that contains the valid values.
Furthermore use
TXOP_HTTXOPas default on HT devices which means that the hardware should select the correct IFS value on its own.I'm not sure if we have the need to specify one of the other txop values in the future but as far as I could see
TXOP_HTTXOPis used by the Ralink drivers for all normal data frames and should be a reasonable default.This patch doesn't really fix anything as until now the
IFS_BACKOFF(=0)value was used as txop which luckily mapped toTXOP_HTTXOP(=0).Signed-off-by Helmut Schaa <[email protected]>--- drivers/net/wireless/rt2x00/rt2800pci.c | 2 +- drivers/net/wireless/rt2x00/rt2800usb.c | 2 +- drivers/net/wireless/rt2x00/rt2x00ht.c | 2 ++ drivers/net/wireless/rt2x00/rt2x00queue.h | 2 ++ drivers/net/wireless/rt2x00/rt2x00reg.h | 10 ++++++++++ 5 files changed, 16 insertions(+), 2 deletions(-)drivers/net/wireless/rt2x00/rt2800pci.c +1
-1@@ -643,7 +643,7 @@ static int rt2800pci_write_tx_data(struct queue_entry* entry,rt2x00_set_field32 (&word,TXWI_W0_AMPDU ,test_bit (ENTRY_TXD_HT_AMPDU , &txdesc->flags));rt2x00_set_field32 (&word,TXWI_W0_MPDU_DENSITY , txdesc->mpdu_density); -rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->ifs); +rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->txop);rt2x00_set_field32 (&word,TXWI_W0_MCS , txdesc->mcs);rt2x00_set_field32 (&word,TXWI_W0_BW ,test_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags));drivers/net/wireless/rt2x00/rt2800usb.c +1
-1@@ -417,7 +417,7 @@ static void rt2800usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,rt2x00_set_field32 (&word,TXWI_W0_AMPDU ,test_bit (ENTRY_TXD_HT_AMPDU , &txdesc->flags));rt2x00_set_field32 (&word,TXWI_W0_MPDU_DENSITY , txdesc->mpdu_density); -rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->ifs); +rt2x00_set_field32 (&word,TXWI_W0_TX_OP , txdesc->txop);rt2x00_set_field32 (&word,TXWI_W0_MCS , txdesc->mcs);rt2x00_set_field32 (&word,TXWI_W0_BW ,test_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags));drivers/net/wireless/rt2x00/rt2x00ht.c +0
-0
drivers/net/wireless/rt2x00/rt2x00ht.c void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, · line 71
Quoted 6 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +2
-0@@ -66,4 +66,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,__set_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags);if (txrate->flags &IEEE80211_TX_RC_SHORT_GI )__set_bit (ENTRY_TXD_HT_SHORT_GI , &txdesc->flags); + + txdesc->txop =TXOP_HTTXOP ; }
I am not too sure about this part. If I look at the Ralink vendor driver, they are most of the time using IFS_BACKOFF (value 3). Why did you put this on TXOP_HTTXOP?
Quoted 41 lines
drivers/net/wireless/rt2x00/rt2x00queue.h +2
-0@@ -299,6 +299,7 @@ enum txentry_desc_flags {* @retry_limit: Max number of retries. * @aifs: AIFS value. * @ifs: IFS value. +* @txop: IFS value for 11n capable chips. * @cw_min: cwmin value. * @cw_max: cwmax value. * @cipher: Cipher type used for encryption. @@ -328,6 +329,7 @@ struct txentry_desc {short retry_limit;short aifs;short ifs; +short txop;short cw_min;short cw_max;drivers/net/wireless/rt2x00/rt2x00reg.h +10
-0@@ -101,6 +101,16 @@ enum ifs { };/* +* IFS values for HT devices +*/ +enum txop { +TXOP_HTTXOP =0 , +TXOP_PIFS =1 , +TXOP_SIFS =2 , +TXOP_BACKOFF =3 , +}; + +/* * Cipher types for hardware encryption */ enum cipher {
Am Donnerstag 06 Mai 2010 schrieb Gertjan van Wingerde:
Quoted 1 line · Helmut Schaa
[...]
Quoted 15 lines
drivers/net/wireless/rt2x00/rt2x00ht.c void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, · line 71
Quoted 11 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +2
-0@@ -66,4 +66,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,__set_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags);if (txrate->flags &IEEE80211_TX_RC_SHORT_GI )__set_bit (ENTRY_TXD_HT_SHORT_GI , &txdesc->flags); + + txdesc->txop =TXOP_HTTXOP ; }I am not too sure about this part. If I look at the Ralink vendor driver, they are most of the time using
IFS_BACKOFF(value 3). Why did you put this onTXOP_HTTXOP?
Quoted 1 line
From what I saw in the ralink driver
IFS_BACKOFFis only used for management frames,IFS_SIFSonly
for subsequent frames in a fragment burst and IFS_HTTXOPS for "normal" data frames. But that's just the result of a _quick_ review. So I might be wrong here as well :)
To be honest I don't really know what the device does in case IFS_HTTXOPS is set but that was the value we've passed to the driver before ;) (==IFS_BACKOFF on all other ralink chips) and it works quite well. I also tried IFS_BACKOFF and I wasn't able to see a difference when using legacy (11b & 11g) rates (neither on the device itself nor with a second machine monitoring the traffic).
But I agree that we have to dig further on when to use which value but nevertheless the patch shouldn't cause any harm but is meant as a base for further improvements.
If you want to we can also wait with this one until we completely figured out what to do?
Helmut
Am Donnerstag 06 Mai 2010 schrieb Helmut Schaa:
Quoted 24 lines
Am Donnerstag 06 Mai 2010 schrieb Gertjan van Wingerde:
Quoted 1 line · Helmut Schaa
[...]
Quoted 6 lines
Quoted 6 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +0
-0@@ -66,4 +66,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,__set_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags);Quoted 8 lines
drivers/net/wireless/rt2x00/rt2x00ht.c void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, · line 71
Quoted 5 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +2
-0if (txrate->flags &IEEE80211_TX_RC_SHORT_GI )__set_bit (ENTRY_TXD_HT_SHORT_GI , &txdesc->flags); + + txdesc->txop =TXOP_HTTXOP ; }I am not too sure about this part. If I look at the Ralink vendor driver, they are most of the time using
IFS_BACKOFF(value 3). Why did you put this onTXOP_HTTXOP?From what I saw in the ralink driver
IFS_BACKOFFis only used for management frames,IFS_SIFSonly for subsequent frames in a fragment burst andIFS_HTTXOPSfor "normal" data frames. But that's just the result of a _quick_ review. So I might be wrong here as well :)
Quoted 5 lines
To be honest I don't really know what the device does in case
IFS_HTTXOPSis set but that was the value we've passed to the driver before ;) (==IFS_BACKOFF on all other ralink chips) and it works quite well. I also triedIFS_BACKOFFand I wasn't able to see a difference when using legacy (11b & 11g) rates (neither on the device itself nor with a second machine monitoring the traffic).
Ok, after further examination it turns out to be:
- Management frames are sent with IFS_BACKOFF
- Special case for PsPoll frames also with IFS_BACKOFF
- Data frames are sent with IFS_HTTXOP
- Data frame subsequent fragments are send with IFS_SIFS
- CTS frames (in AP mode) use IFS_SIFS
So, I guess I resend this patch after some testing with IFS_BACKOFF for management frames and IFS_HTTXOP for data frames and SIFS for subsequent fragments.
John, please don't merge this patch yet. Thanks.
Helmut
Quoted 39 lines · Helmut Schaa
Am Donnerstag 06 Mai 2010 schrieb Helmut Schaa:
Quoted 24 lines
Am Donnerstag 06 Mai 2010 schrieb Gertjan van Wingerde:
Quoted 1 line · Helmut Schaa
[...]
Quoted 6 lines
Quoted 6 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +0
-0@@ -66,4 +66,6 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,__set_bit (ENTRY_TXD_HT_BW_40 , &txdesc->flags);Quoted 8 lines
drivers/net/wireless/rt2x00/rt2x00ht.c void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, · line 71
Quoted 5 lines
drivers/net/wireless/rt2x00/rt2x00ht.c +2
-0if (txrate->flags &IEEE80211_TX_RC_SHORT_GI )__set_bit (ENTRY_TXD_HT_SHORT_GI , &txdesc->flags); + + txdesc->txop =TXOP_HTTXOP ; }I am not too sure about this part. If I look at the Ralink vendor driver, they are most of the time using
IFS_BACKOFF(value 3). Why did you put this onTXOP_HTTXOP?From what I saw in the ralink driver
IFS_BACKOFFis only used for management frames,IFS_SIFSonly for subsequent frames in a fragment burst andIFS_HTTXOPSfor "normal" data frames. But that's just the result of a _quick_ review. So I might be wrong here as well :)Quoted 5 lines
To be honest I don't really know what the device does in case
IFS_HTTXOPSis set but that was the value we've passed to the driver before ;) (==IFS_BACKOFF on all other ralink chips) and it works quite well. I also triedIFS_BACKOFFand I wasn't able to see a difference when using legacy (11b & 11g) rates (neither on the device itself nor with a second machine monitoring the traffic).Ok, after further examination it turns out to be:
- Management frames are sent with
IFS_BACKOFF
- Special case for PsPoll frames also withIFS_BACKOFF
- Data frames are sent withIFS_HTTXOP
- Data frame subsequent fragments are send withIFS_SIFS
- CTS frames (in AP mode) useIFS_SIFS
Quoted 5 lines
So, I guess I resend this patch after some testing with
IFS_BACKOFFfor management frames andIFS_HTTXOPfor data frames and SIFS for subsequent fragments.John, please don't merge this patch yet. Thanks.
Thanks for investigating this further. I think the approach you describe above is the correct approach for this.
---
Gertjan.