Search Linux Wireless

[PATCH 25/30] rt2x00: Fix PLCP setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From b545a9a3b8ff04a2c6f62923cf01043aeb9ec599 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@xxxxxxxxx>
Date: Sat, 18 Aug 2007 16:09:25 +0200
Subject: [PATCH 25/30] rt2x00: Fix PLCP setup

The Length extension bit should only be set when using
the 11Mbs rate and when the residual is <= 3. (value comes
from zd1211rw, ralink legacy driver was unclear)

Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
---
 drivers/net/wireless/rt2x00/rt2x00dev.c |   36 +++++++++++++++++-------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 36b522b..a0fcd05 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -480,14 +480,15 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 		desc.ifs = IFS_BACKOFF;
 
 	/*
-	 * How the length should be processed depends
-	 * on if we are working with OFDM rates or not.
+	 * PLCP setup
+	 * Length calculation depends on OFDM/CCK rate.
 	 */
+	desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP);
+	desc.service = 0x04;
+
 	if (test_bit(ENTRY_TXD_OFDM_RATE, &entry->flags)) {
-		residual = 0;
 		desc.length_high = ((length + FCS_LEN) >> 6) & 0x3f;
 		desc.length_low = ((length + FCS_LEN) & 0x3f);
-
 	} else {
 		bitrate = DEVICE_GET_RATE_FIELD(tx_rate, RATE);
 
@@ -497,23 +498,26 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 		residual = get_duration_res(length + FCS_LEN, bitrate);
 		duration = get_duration(length + FCS_LEN, bitrate);
 
-		if (residual != 0)
+		if (residual != 0) {
 			duration++;
 
+			/*
+			 * Check if we need to set the Length Extension
+			 */
+			if (bitrate == 110 && residual <= 3)
+				desc.service |= 0x80;
+		}
+
 		desc.length_high = (duration >> 8) & 0xff;
 		desc.length_low = duration & 0xff;
-	}
 
-	/*
-	 * Create the signal and service values.
-	 */
-	desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP);
-	if (DEVICE_GET_RATE_FIELD(tx_rate, PREAMBLE))
-		desc.signal |= 0x08;
-
-	desc.service = 0x04;
-	if (residual <= (8 % 11))
-		desc.service |= 0x80;
+		/*
+		 * When preamble is enabled we should set the
+		 * preamble bit for the signal.
+		 */
+		if (DEVICE_GET_RATE_FIELD(tx_rate, PREAMBLE))
+			desc.signal |= 0x08;
+	}
 
 	rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry, txd, &desc,
 					   ieee80211hdr, length, control);
-- 
1.5.3.rc5

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux