carl9170 firmware: introduce per-rate ER Protection setting
authorChristian Lamparter <chunkeey@googlemail.com>
Thu, 22 Jul 2010 18:07:37 +0000 (20:07 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Thu, 22 Jul 2010 18:07:37 +0000 (20:07 +0200)
Previously, the firmware has applied (or rather has stuck)
with the ERP settings of the first rate for all retry rates.
This is now history and the driver can choose between
different ERP settings for each individual retry rate.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
carlfw/src/wlan.c
include/shared/wlan.h

index aaff3eeaf9bb2555cd6aa86f035e149060c1ab64..6278b58486e570aa6570fb4e20ccd251c56f264c 100644 (file)
@@ -181,7 +181,7 @@ static void wlan_tx_complete(struct carl9170_tx_superframe *super,
 static bool wlan_tx_consume_retry(struct carl9170_tx_superframe *super)
 {
        /* check if this was the last possible retry with this rate */
 static bool wlan_tx_consume_retry(struct carl9170_tx_superframe *super)
 {
        /* check if this was the last possible retry with this rate */
-       if (unlikely(super->s.cnt >= super->s.tries[super->s.rix])) {
+       if (unlikely(super->s.cnt >= super->s.ri[super->s.rix].tries)) {
                /* end of the road - indicate tx failure */
                if (unlikely(super->s.rix == CARL9170_TX_MAX_RETRY_RATES))
                        return false;
                /* end of the road - indicate tx failure */
                if (unlikely(super->s.rix == CARL9170_TX_MAX_RETRY_RATES))
                        return false;
@@ -196,6 +196,9 @@ static bool wlan_tx_consume_retry(struct carl9170_tx_superframe *super)
                /* finally - mark the old rate as USED */
                super->s.rix++;
 
                /* finally - mark the old rate as USED */
                super->s.rix++;
 
+               /* update MAC flags */
+               super->f.hdr.mac.erp_prot = super->s.ri[super->s.rix].erp_prot;
+
                /* reinitialize try counter */
                super->s.cnt = 1;
        } else {
                /* reinitialize try counter */
                super->s.cnt = 1;
        } else {
@@ -467,7 +470,7 @@ static void wlan_send_buffered_ba(void)
                sizeof(struct ar9170_tx_hwdesc) +
                sizeof(struct ieee80211_ba);
 
                sizeof(struct ar9170_tx_hwdesc) +
                sizeof(struct ieee80211_ba);
 
-       baf->s.tries[0] = 3;
+       baf->s.ri[0].tries = 3;
        baf->s.queue = 0;
        baf->f.hdr.length = sizeof(struct ieee80211_ba) + FCS_LEN;
 
        baf->s.queue = 0;
        baf->f.hdr.length = sizeof(struct ieee80211_ba) + FCS_LEN;
 
index 35e2e4f884850bfce009a3252e82b455f8f34946..1fd3ab1e6baa1b6ae75374038a291452dac98352 100644 (file)
@@ -84,7 +84,7 @@
 /* these are either-or */
 #define        AR9170_TX_MAC_PROT_RTS                  0x0001
 #define        AR9170_TX_MAC_PROT_CTS                  0x0002
 /* these are either-or */
 #define        AR9170_TX_MAC_PROT_RTS                  0x0001
 #define        AR9170_TX_MAC_PROT_CTS                  0x0002
-#define        AR9170_TX_MAC_PROT_MASK                 0x0003
+#define        AR9170_TX_MAC_PROT                      0x0003
 
 #define        AR9170_TX_MAC_NO_ACK                    0x0004
 /* if unset, MAC will only do SIFS space before frame */
 
 #define        AR9170_TX_MAC_NO_ACK                    0x0004
 /* if unset, MAC will only do SIFS space before frame */
@@ -229,6 +229,12 @@ struct ar9170_tx_hw_phy_control {
        } __packed;
 } __packed;
 
        } __packed;
 } __packed;
 
+struct ar9170_tx_rate_info {
+       u8 tries:3;
+       u8 erp_prot:2;
+       u8 free:3; /* free for use (e.g.:RIFS/TXOP/AMPDU) */
+} __packed;
+
 struct carl9170_tx_superdesc {
        __le16 len;
        u8 rix;
 struct carl9170_tx_superdesc {
        __le16 len;
        u8 rix;
@@ -244,7 +250,7 @@ struct carl9170_tx_superdesc {
        u8 fill_in_tsf:1;
        u8 cab:1;
        u8 padding2;
        u8 fill_in_tsf:1;
        u8 cab:1;
        u8 padding2;
-       u8 tries[CARL9170_TX_MAX_RATES];
+       struct ar9170_tx_rate_info ri[CARL9170_TX_MAX_RATES];
        struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES];
 } __packed;
 
        struct ar9170_tx_hw_phy_control rr[CARL9170_TX_MAX_RETRY_RATES];
 } __packed;
 
@@ -292,6 +298,11 @@ struct _ar9170_tx_hwdesc {
 #define        CARL9170_TX_SUPER_MISC_FILL_IN_TSF              0x40
 #define        CARL9170_TX_SUPER_MISC_CAB                      0x80
 
 #define        CARL9170_TX_SUPER_MISC_FILL_IN_TSF              0x40
 #define        CARL9170_TX_SUPER_MISC_CAB                      0x80
 
+#define CARL9170_TX_SUPER_RI_TRIES                     0x7
+#define CARL9170_TX_SUPER_RI_TRIES_S                   0
+#define CARL9170_TX_SUPER_RI_ERP_PROT                  0x18
+#define CARL9170_TX_SUPER_RI_ERP_PROT_S                        3
+
 struct _carl9170_tx_superdesc {
        __le16 len;
        u8 rix;
 struct _carl9170_tx_superdesc {
        __le16 len;
        u8 rix;
@@ -300,7 +311,7 @@ struct _carl9170_tx_superdesc {
        u8 ampdu_settings;
        u8 misc;
        u8 padding;
        u8 ampdu_settings;
        u8 misc;
        u8 padding;
-       u8 tries[CARL9170_TX_MAX_RATES];
+       u8 ri[CARL9170_TX_MAX_RATES];
        __le32 rr[CARL9170_TX_MAX_RETRY_RATES];
 } __packed;
 
        __le32 rr[CARL9170_TX_MAX_RETRY_RATES];
 } __packed;