Skip to contentSkip to conversation

Fix TX rate short preamble detection

PATCH In review Ivo van Doorn 2 participants 3 messages Jan 18, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix TX rate short preamble detection

Mac80211 provides 2 structures to handle bitrates, namely ieee80211_rate and ieee80211_tx_rate. To determine the short preamble mode for an outgoing frame, the flag IEEE80211_TX_RC_USE_SHORT_PREAMBLE must be checked on ieee80211_tx_rate and not ieee80211_rate (which rt2x00 did).

This fixes a regression which was triggered in 2.6.29-rcX as reported by Chris Clayton.

---

drivers/net/wireless/rt2x00/rt2x00queue.c +5 -4
index c1e5a05..3dab9b4 100644
@@ -186,10 +186,11 @@ static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
 
 static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
 						  struct txentry_desc *txdesc,
-						  struct ieee80211_rate *rate)
+						  const struct rt2x00_rate *hwrate)
 {
 	struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-	const struct rt2x00_rate *hwrate = rt2x00_get_rate(rate->hw_value);
+	struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+	struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
 	unsigned int data_length;
 	unsigned int duration;
 	unsigned int residual;
@@ -232,7 +233,7 @@ static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
 		 * When preamble is enabled we should set the
 		 * preamble bit for the signal.
 		 */
-		if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
+		if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
 			txdesc->signal |= 0x08;
 	}
 }
@@ -326,7 +327,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
 	 */
 	rt2x00crypto_create_tx_descriptor(entry, txdesc);
 	rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
-	rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, rate);
+	rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
 }
 
 static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
Tested-by on v1 1/1
#1 lore raw

Hi Ivo/John,

2009/1/18 Ivo van Doorn <[email protected]>:

Quoted 7 lines

Mac80211 provides 2 structures to handle bitrates, namely ieee80211_rate and ieee80211_tx_rate. To determine the short preamble mode for an outgoing frame, the flag IEEE80211_TX_RC_USE_SHORT_PREAMBLE must be checked on ieee80211_tx_rate and not ieee80211_rate (which rt2x00 did).

This fixes a regression which was triggered in 2.6.29-rcX as reported by Chris Clayton.

I don't think the patch below will apply to 2.6.29-rc because it is lagging behind wireless testing and, I would guess, is likely to stay that way for 2.6.29 because the merge window is closed. Won't the final patch that was provided to me at
http://marc.info/?l=linux-wireless&m=123229784930740&w=4 be the correct one? If so, could John please add:

Cheers,

Chris

Quoted 40 lines

---

drivers/net/wireless/rt2x00/rt2x00queue.c +5 -4
index c1e5a05..3dab9b4 100644
@@ -186,10 +186,11 @@ static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
 
 static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
                                                 struct txentry_desc *txdesc,
-                                                 struct ieee80211_rate *rate)
+                                                 const struct rt2x00_rate *hwrate)
 {
       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-       const struct rt2x00_rate *hwrate = rt2x00_get_rate(rate->hw_value);
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+       struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
       unsigned int data_length;
       unsigned int duration;
       unsigned int residual;
@@ -232,7 +233,7 @@ static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
                * When preamble is enabled we should set the
                * preamble bit for the signal.
                */
-               if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
+               if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
                       txdesc->signal |= 0x08;
       }
 }
@@ -326,7 +327,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        */
       rt2x00crypto_create_tx_descriptor(entry, txdesc);
       rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
-       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, rate);
+       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
 }
 
 static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
Signature · 1 line
In a world without walls and fences, who needs windows and gates?
#2 lore raw
Quoted 11 lines · Chris Clayton

Hi Ivo/John,

2009/1/18 Ivo van Doorn <[email protected]>:

Quoted 7 lines

Mac80211 provides 2 structures to handle bitrates, namely ieee80211_rate and ieee80211_tx_rate. To determine the short preamble mode for an outgoing frame, the flag IEEE80211_TX_RC_USE_SHORT_PREAMBLE must be checked on ieee80211_tx_rate and not ieee80211_rate (which rt2x00 did).

This fixes a regression which was triggered in 2.6.29-rcX as reported by Chris Clayton.

Quoted 6 lines

I don't think the patch below will apply to 2.6.29-rc because it is lagging behind wireless testing and, I would guess, is likely to stay that way for 2.6.29 because the merge window is closed. Won't the final patch that was provided to me at
http://marc.info/?l=linux-wireless&m=123229784930740&w=4 be the correct one? If so, could John please add:

True. but usually John wants the patch to go through wireless-testing, which makes below patch the correct one. :)
Anyway, in this case he has the luxoury of having both versions of the patch. ;)

Quoted 49 lines

Cheers,

Chris

Quoted 40 lines

---

drivers/net/wireless/rt2x00/rt2x00queue.c +5 -4
index c1e5a05..3dab9b4 100644
@@ -186,10 +186,11 @@ static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
 
 static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
                                                 struct txentry_desc *txdesc,
-                                                 struct ieee80211_rate *rate)
+                                                 const struct rt2x00_rate *hwrate)
 {
       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-       const struct rt2x00_rate *hwrate = rt2x00_get_rate(rate->hw_value);
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+       struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
       unsigned int data_length;
       unsigned int duration;
       unsigned int residual;
@@ -232,7 +233,7 @@ static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
                * When preamble is enabled we should set the
                * preamble bit for the signal.
                */
-               if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
+               if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
                       txdesc->signal |= 0x08;
       }
 }
@@ -326,7 +327,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        */
       rt2x00crypto_create_tx_descriptor(entry, txdesc);
       rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
-       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, rate);
+       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
 }
 
 static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,