aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-09 17:49:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-13 19:32:31 -0400
commit89993890aeb8fe58b2d49b2661965524802ab73c (patch)
treed541a26a8a370401ef2c4d0cafdd8868853ed127 /drivers
parentdac37d720860bbbc535adc90249184308501c1f0 (diff)
rt2x00: Fix rt2400pci signal
After sampling hundreds of RX frame descriptors, the results were conclusive: - The Ralink documentation regarding the SIGNAL and RSSI are wrong. It turns out that of the 5 BBR registers, we should not use BBR0 and BBR1 for SIGNAL and RSSI respectively, but actually BBR1 and BBR2. BBR0 does show values, but the exact meaning remains unclear, but they cannot be translated into a SIGNAL or RSSI field. BBR3, BBR4 and BBR5 are always 0, so their meaning is unknown. As it turns out, the reported SIGNAL is the PLCP value, this in contradiction to what was expected looking at rt2500pci which only reported the PLCP values for OFDM rates and bitrate values for CCK rates. This means we should let the driver raise the flag about the contents of the SIGNAL field so rt2x00lib can always do the right thing based on what the driver reports. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.h6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c16
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h3
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c6
8 files changed, 43 insertions, 15 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index a92626bc536a..4cd284209d16 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1058,9 +1058,11 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
1058 struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data; 1058 struct queue_entry_priv_pci_rx *priv_rx = entry->priv_data;
1059 u32 word0; 1059 u32 word0;
1060 u32 word2; 1060 u32 word2;
1061 u32 word3;
1061 1062
1062 rt2x00_desc_read(priv_rx->desc, 0, &word0); 1063 rt2x00_desc_read(priv_rx->desc, 0, &word0);
1063 rt2x00_desc_read(priv_rx->desc, 2, &word2); 1064 rt2x00_desc_read(priv_rx->desc, 2, &word2);
1065 rt2x00_desc_read(priv_rx->desc, 3, &word3);
1064 1066
1065 rxdesc->flags = 0; 1067 rxdesc->flags = 0;
1066 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR)) 1068 if (rt2x00_get_field32(word0, RXD_W0_CRC_ERROR))
@@ -1070,9 +1072,11 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
1070 1072
1071 /* 1073 /*
1072 * Obtain the status about this packet. 1074 * Obtain the status about this packet.
1075 * The signal is the PLCP value.
1073 */ 1076 */
1074 rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL); 1077 rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL);
1075 rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) - 1078 rxdesc->signal_plcp = 1;
1079 rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) -
1076 entry->queue->rt2x00dev->rssi_offset; 1080 entry->queue->rt2x00dev->rssi_offset;
1077 rxdesc->ofdm = 0; 1081 rxdesc->ofdm = 0;
1078 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); 1082 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.h b/drivers/net/wireless/rt2x00/rt2400pci.h
index da178d44660e..a5210f9a3360 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.h
+++ b/drivers/net/wireless/rt2x00/rt2400pci.h
@@ -899,13 +899,13 @@
899 * Word2 899 * Word2
900 */ 900 */
901#define RXD_W2_BUFFER_LENGTH FIELD32(0x0000ffff) 901#define RXD_W2_BUFFER_LENGTH FIELD32(0x0000ffff)
902#define RXD_W2_SIGNAL FIELD32(0x00ff0000) 902#define RXD_W2_BBR0 FIELD32(0x00ff0000)
903#define RXD_W2_RSSI FIELD32(0xff000000) 903#define RXD_W2_SIGNAL FIELD32(0xff000000)
904 904
905/* 905/*
906 * Word3 906 * Word3
907 */ 907 */
908#define RXD_W3_BBR2 FIELD32(0x000000ff) 908#define RXD_W3_RSSI FIELD32(0x000000ff)
909#define RXD_W3_BBR3 FIELD32(0x0000ff00) 909#define RXD_W3_BBR3 FIELD32(0x0000ff00)
910#define RXD_W3_BBR4 FIELD32(0x00ff0000) 910#define RXD_W3_BBR4 FIELD32(0x00ff0000)
911#define RXD_W3_BBR5 FIELD32(0xff000000) 911#define RXD_W3_BBR5 FIELD32(0xff000000)
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 4ae09b418704..0f5139a2f238 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1219,10 +1219,17 @@ static void rt2500pci_fill_rxdone(struct queue_entry *entry,
1219 if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR)) 1219 if (rt2x00_get_field32(word0, RXD_W0_PHYSICAL_ERROR))
1220 rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC; 1220 rxdesc->flags |= RX_FLAG_FAILED_PLCP_CRC;
1221 1221
1222 /*
1223 * Obtain the status about this packet.
1224 * When frame was received with an OFDM bitrate,
1225 * the signal is the PLCP value. If it was received with
1226 * a CCK bitrate the signal is the rate in 100kbit/s.
1227 */
1228 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1222 rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL); 1229 rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL);
1230 rxdesc->signal_plcp = rxdesc->ofdm;
1223 rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) - 1231 rxdesc->rssi = rt2x00_get_field32(word2, RXD_W2_RSSI) -
1224 entry->queue->rt2x00dev->rssi_offset; 1232 entry->queue->rt2x00dev->rssi_offset;
1225 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1226 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); 1233 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
1227 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1234 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1228} 1235}
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 8dfebfd695de..c8216d755835 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1135,11 +1135,15 @@ static void rt2500usb_fill_rxdone(struct queue_entry *entry,
1135 1135
1136 /* 1136 /*
1137 * Obtain the status about this packet. 1137 * Obtain the status about this packet.
1138 * When frame was received with an OFDM bitrate,
1139 * the signal is the PLCP value. If it was received with
1140 * a CCK bitrate the signal is the rate in 100kbit/s.
1138 */ 1141 */
1142 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1139 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); 1143 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
1144 rxdesc->signal_plcp = rxdesc->ofdm;
1140 rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) - 1145 rxdesc->rssi = rt2x00_get_field32(word1, RXD_W1_RSSI) -
1141 entry->queue->rt2x00dev->rssi_offset; 1146 entry->queue->rt2x00dev->rssi_offset;
1142 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1143 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); 1147 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
1144 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1148 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1145 1149
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index eb2d21c4e8e9..a885254d2e85 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -574,19 +574,21 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
574 u16 fc; 574 u16 fc;
575 575
576 /* 576 /*
577 * If the signal is the plcp value,
578 * we need to strip the preamble bit (0x08).
579 */
580 if (rxdesc->signal_plcp)
581 rxdesc->signal &= ~0x08;
582
583 /*
577 * Update RX statistics. 584 * Update RX statistics.
578 */ 585 */
579 sband = &rt2x00dev->bands[rt2x00dev->curr_band]; 586 sband = &rt2x00dev->bands[rt2x00dev->curr_band];
580 for (i = 0; i < sband->n_bitrates; i++) { 587 for (i = 0; i < sband->n_bitrates; i++) {
581 rate = rt2x00_get_rate(sband->bitrates[i].hw_value); 588 rate = rt2x00_get_rate(sband->bitrates[i].hw_value);
582 589
583 /* 590 if ((rxdesc->signal_plcp && rate->plcp == rxdesc->signal) ||
584 * When frame was received with an OFDM bitrate, 591 (!rxdesc->signal_plcp && rate->bitrate == rxdesc->signal)) {
585 * the signal is the PLCP value. If it was received with
586 * a CCK bitrate the signal is the rate in 100kbit/s.
587 */
588 if ((rxdesc->ofdm && rate->plcp == rxdesc->signal) ||
589 (!rxdesc->ofdm && rate->bitrate == rxdesc->signal)) {
590 idx = i; 592 idx = i;
591 break; 593 break;
592 } 594 }
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index fbabf389b622..c5f46f234083 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -134,6 +134,8 @@ static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
134 * Summary of information that has been read from the RX frame descriptor. 134 * Summary of information that has been read from the RX frame descriptor.
135 * 135 *
136 * @signal: Signal of the received frame. 136 * @signal: Signal of the received frame.
137 * @signal_plcp: Does the signal field contain the plcp value,
138 * or does it contain the bitrate itself.
137 * @rssi: RSSI of the received frame. 139 * @rssi: RSSI of the received frame.
138 * @ofdm: Was frame send with an OFDM rate. 140 * @ofdm: Was frame send with an OFDM rate.
139 * @size: Data size of the received frame. 141 * @size: Data size of the received frame.
@@ -142,6 +144,7 @@ static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
142 */ 144 */
143struct rxdone_entry_desc { 145struct rxdone_entry_desc {
144 int signal; 146 int signal;
147 int signal_plcp;
145 int rssi; 148 int rssi;
146 int ofdm; 149 int ofdm;
147 int size; 150 int size;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 914aee0ce8ce..4baa916b80cf 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1645,10 +1645,14 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
1645 1645
1646 /* 1646 /*
1647 * Obtain the status about this packet. 1647 * Obtain the status about this packet.
1648 * When frame was received with an OFDM bitrate,
1649 * the signal is the PLCP value. If it was received with
1650 * a CCK bitrate the signal is the rate in 100kbit/s.
1648 */ 1651 */
1652 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1649 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); 1653 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
1654 rxdesc->signal_plcp = rxdesc->ofdm;
1650 rxdesc->rssi = rt61pci_agc_to_rssi(entry->queue->rt2x00dev, word1); 1655 rxdesc->rssi = rt61pci_agc_to_rssi(entry->queue->rt2x00dev, word1);
1651 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1652 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); 1656 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
1653 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1657 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1654} 1658}
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index fc38c0c5cc3a..48938819ee2f 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1405,10 +1405,14 @@ static void rt73usb_fill_rxdone(struct queue_entry *entry,
1405 1405
1406 /* 1406 /*
1407 * Obtain the status about this packet. 1407 * Obtain the status about this packet.
1408 * When frame was received with an OFDM bitrate,
1409 * the signal is the PLCP value. If it was received with
1410 * a CCK bitrate the signal is the rate in 100kbit/s.
1408 */ 1411 */
1412 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1409 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL); 1413 rxdesc->signal = rt2x00_get_field32(word1, RXD_W1_SIGNAL);
1414 rxdesc->signal_plcp = rxdesc->ofdm;
1410 rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1); 1415 rxdesc->rssi = rt73usb_agc_to_rssi(entry->queue->rt2x00dev, word1);
1411 rxdesc->ofdm = rt2x00_get_field32(word0, RXD_W0_OFDM);
1412 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT); 1416 rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
1413 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1417 rxdesc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1414 1418