rt2x00: Move quality statistics into seperate structure
PATCH 1/11 rt2x00: Move quality statistics into seperate structure
In reply to a message not in the archiveMove all link quality statistics variables into
the link_qual structure. This cleans up the link
structure and allows us to use it for more then
just statistics.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 11 +++--- drivers/net/wireless/rt2x00/rt2500pci.c | 11 +++--- drivers/net/wireless/rt2x00/rt2500usb.c | 12 +++--- drivers/net/wireless/rt2x00/rt2x00.h | 61 ++++++++++++++++++++----------- drivers/net/wireless/rt2x00/rt2x00dev.c | 46 ++++++++++++------------ drivers/net/wireless/rt2x00/rt61pci.c | 12 +++--- drivers/net/wireless/rt2x00/rt73usb.c | 13 +++---- 7 files changed, 92 insertions(+), 74 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +6 -5
@@ -542,7 +542,8 @@ static void rt2400pci_disable_led(struct rt2x00_dev *rt2x00dev)/* * Link tuning */ -static void rt2400pci_link_stats (struct rt2x00_dev *rt2x00dev) +static void rt2400pci_link_stats (struct rt2x00_dev *rt2x00dev, +struct link_qual *qual) {u32 reg;u8 bbp;
@@ -551,13 +552,13 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev)* Update FCS error count from register. */ rt2x00pci_register_read (rt2x00dev,CNT0 , ®); - rt2x00dev->link.rx_failed =rt2x00_get_field32 (reg,CNT0_FCS_ERROR ); + qual->rx_failed =rt2x00_get_field32 (reg,CNT0_FCS_ERROR );/* * Update False CCA count from register. */ rt2400pci_bbp_read (rt2x00dev,39 , &bbp); - rt2x00dev->link.false_cca = bbp; + qual->false_cca = bbp; }static void rt2400pci_reset_tuner (struct rt2x00_dev *rt2x00dev)
@@ -582,10 +583,10 @@ static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)*/ rt2400pci_bbp_read (rt2x00dev,13 , ®); -if (rt2x00dev->link.false_cca >512 && reg <0x20 ) { +if (rt2x00dev->link.qual.false_cca >512 && reg <0x20 ) {rt2400pci_bbp_write (rt2x00dev,13 , ++reg); rt2x00dev->link.vgc_level = reg; - }else if (rt2x00dev->link.false_cca <100 && reg >0x08 ) { + }else if (rt2x00dev->link.qual.false_cca <100 && reg >0x08 ) {rt2400pci_bbp_write (rt2x00dev,13 , --reg); rt2x00dev->link.vgc_level = reg; }
drivers/net/wireless/rt2x00/rt2500pci.c +6 -5
@@ -587,7 +587,8 @@ static void rt2500pci_disable_led(struct rt2x00_dev *rt2x00dev)/* * Link tuning */ -static void rt2500pci_link_stats (struct rt2x00_dev *rt2x00dev) +static void rt2500pci_link_stats (struct rt2x00_dev *rt2x00dev, +struct link_qual *qual) {u32 reg;
@@ -595,13 +596,13 @@ static void rt2500pci_link_stats(struct rt2x00_dev *rt2x00dev)* Update FCS error count from register. */ rt2x00pci_register_read (rt2x00dev,CNT0 , ®); - rt2x00dev->link.rx_failed =rt2x00_get_field32 (reg,CNT0_FCS_ERROR ); + qual->rx_failed =rt2x00_get_field32 (reg,CNT0_FCS_ERROR );/* * Update False CCA count from register. */ rt2x00pci_register_read (rt2x00dev,CNT3 , ®); - rt2x00dev->link.false_cca =rt2x00_get_field32 (reg,CNT3_FALSE_CCA ); + qual->false_cca =rt2x00_get_field32 (reg,CNT3_FALSE_CCA ); }static void rt2500pci_reset_tuner (struct rt2x00_dev *rt2x00dev)
@@ -679,10 +680,10 @@ dynamic_cca_tune:* R17 is inside the dynamic tuning range, * start tuning the link based on the false cca counter. */ -if (rt2x00dev->link.false_cca >512 && r17 <0x40 ) { +if (rt2x00dev->link.qual.false_cca >512 && r17 <0x40 ) {rt2500pci_bbp_write (rt2x00dev,17 , ++r17); rt2x00dev->link.vgc_level = r17; - }else if (rt2x00dev->link.false_cca <100 && r17 >0x32 ) { + }else if (rt2x00dev->link.qual.false_cca <100 && r17 >0x32 ) {rt2500pci_bbp_write (rt2x00dev,17 , --r17); rt2x00dev->link.vgc_level = r17; }
drivers/net/wireless/rt2x00/rt2500usb.c +6 -6
@@ -535,7 +535,8 @@ static void rt2500usb_disable_led(struct rt2x00_dev *rt2x00dev)/* * Link tuning */ -static void rt2500usb_link_stats (struct rt2x00_dev *rt2x00dev) +static void rt2500usb_link_stats (struct rt2x00_dev *rt2x00dev, +struct link_qual *qual) {u16 reg;
@@ -543,14 +544,13 @@ static void rt2500usb_link_stats(struct rt2x00_dev *rt2x00dev)* Update FCS error count from register. */ rt2500usb_register_read (rt2x00dev,STA_CSR0 , ®); - rt2x00dev->link.rx_failed =rt2x00_get_field16 (reg,STA_CSR0_FCS_ERROR ); + qual->rx_failed =rt2x00_get_field16 (reg,STA_CSR0_FCS_ERROR );/* * Update False CCA count from register. */ rt2500usb_register_read (rt2x00dev,STA_CSR3 , ®); - rt2x00dev->link.false_cca = -rt2x00_get_field16 (reg,STA_CSR3_FALSE_CCA_ERROR ); + qual->false_cca =rt2x00_get_field16 (reg,STA_CSR3_FALSE_CCA_ERROR ); }static void rt2500usb_reset_tuner (struct rt2x00_dev *rt2x00dev)
@@ -673,10 +673,10 @@ static void rt2500usb_link_tuner(struct rt2x00_dev *rt2x00dev)if (r17 > up_bound) {rt2500usb_bbp_write (rt2x00dev,17 , up_bound); rt2x00dev->link.vgc_level = up_bound; - }else if (rt2x00dev->link.false_cca >512 && r17 < up_bound) { + }else if (rt2x00dev->link.qual.false_cca >512 && r17 < up_bound) {rt2500usb_bbp_write (rt2x00dev,17 , ++r17); rt2x00dev->link.vgc_level = r17; - }else if (rt2x00dev->link.false_cca <100 && r17 > low_bound) { + }else if (rt2x00dev->link.qual.false_cca <100 && r17 > low_bound) {rt2500usb_bbp_write (rt2x00dev,17 , --r17); rt2x00dev->link.vgc_level = r17; }
drivers/net/wireless/rt2x00/rt2x00.h +39 -22
109 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00dev.c +23 -23
89 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt61pci.c +6 -6
@@ -792,7 +792,8 @@ static void rt61pci_activity_led(struct rt2x00_dev *rt2x00dev, int rssi)/* * Link tuning */ -static void rt61pci_link_stats (struct rt2x00_dev *rt2x00dev) +static void rt61pci_link_stats (struct rt2x00_dev *rt2x00dev, +struct link_qual *qual) {u32 reg;
@@ -800,14 +801,13 @@ static void rt61pci_link_stats(struct rt2x00_dev *rt2x00dev)* Update FCS error count from register. */ rt2x00pci_register_read (rt2x00dev,STA_CSR0 , ®); - rt2x00dev->link.rx_failed =rt2x00_get_field32 (reg,STA_CSR0_FCS_ERROR ); + qual->rx_failed =rt2x00_get_field32 (reg,STA_CSR0_FCS_ERROR );/* * Update False CCA count from register. */ rt2x00pci_register_read (rt2x00dev,STA_CSR1 , ®); - rt2x00dev->link.false_cca = -rt2x00_get_field32 (reg,STA_CSR1_FALSE_CCA_ERROR ); + qual->false_cca =rt2x00_get_field32 (reg,STA_CSR1_FALSE_CCA_ERROR ); }static void rt61pci_reset_tuner (struct rt2x00_dev *rt2x00dev)
@@ -904,11 +904,11 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev)* r17 does not yet exceed upper limit, continue and base * the r17 tuning on the false CCA count. */ -if (rt2x00dev->link.false_cca >512 && r17 < up_bound) { +if (rt2x00dev->link.qual.false_cca >512 && r17 < up_bound) {if (++r17 > up_bound) r17 = up_bound;rt61pci_bbp_write (rt2x00dev,17 , r17); - }else if (rt2x00dev->link.false_cca <100 && r17 > low_bound) { + }else if (rt2x00dev->link.qual.false_cca <100 && r17 > low_bound) {if (--r17 < low_bound) r17 = low_bound;rt61pci_bbp_write (rt2x00dev,17 , r17);
drivers/net/wireless/rt2x00/rt73usb.c +6 -7
@@ -659,7 +659,8 @@ static void rt73usb_activity_led(struct rt2x00_dev *rt2x00dev, int rssi)/* * Link tuning */ -static void rt73usb_link_stats (struct rt2x00_dev *rt2x00dev) +static void rt73usb_link_stats (struct rt2x00_dev *rt2x00dev, +struct link_qual *qual) {u32 reg;
@@ -667,15 +668,13 @@ static void rt73usb_link_stats(struct rt2x00_dev *rt2x00dev)* Update FCS error count from register. */ rt73usb_register_read (rt2x00dev,STA_CSR0 , ®); - rt2x00dev->link.rx_failed =rt2x00_get_field32 (reg,STA_CSR0_FCS_ERROR ); + qual->rx_failed =rt2x00_get_field32 (reg,STA_CSR0_FCS_ERROR );/* * Update False CCA count from register. */ rt73usb_register_read (rt2x00dev,STA_CSR1 , ®); - reg =rt2x00_get_field32 (reg,STA_CSR1_FALSE_CCA_ERROR ); - rt2x00dev->link.false_cca = -rt2x00_get_field32 (reg,STA_CSR1_FALSE_CCA_ERROR ); + qual->false_cca =rt2x00_get_field32 (reg,STA_CSR1_FALSE_CCA_ERROR ); }static void rt73usb_reset_tuner (struct rt2x00_dev *rt2x00dev)
@@ -781,12 +780,12 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev)* r17 does not yet exceed upper limit, continue and base * the r17 tuning on the false CCA count. */ -if (rt2x00dev->link.false_cca >512 && r17 < up_bound) { +if (rt2x00dev->link.qual.false_cca >512 && r17 < up_bound) { r17 +=4 ;if (r17 > up_bound) r17 = up_bound;rt73usb_bbp_write (rt2x00dev,17 , r17); - }else if (rt2x00dev->link.false_cca <100 && r17 > low_bound) { + }else if (rt2x00dev->link.qual.false_cca <100 && r17 > low_bound) { r17 -=4 ;if (r17 < low_bound) r17 = low_bound;
Signature · 1 line
1.5.3.4
PATCH 2/11 rt2x00: Use enum defines
In reply to a message not in the archiveWhen setting the default EEPROM values use the values from the enums instead of "magic" values.
--- drivers/net/wireless/rt2x00/rt2500pci.c | 9 ++++++--- drivers/net/wireless/rt2x00/rt2500usb.c | 9 ++++++--- drivers/net/wireless/rt2x00/rt61pci.c | 6 ++++-- drivers/net/wireless/rt2x00/rt73usb.c | 6 ++++-- 4 files changed, 20 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2500pci.c +6 -3
@@ -1418,9 +1418,12 @@ static int rt2500pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)rt2x00_eeprom_read (rt2x00dev,EEPROM_ANTENNA , &word);if (word ==0xffff ) {rt2x00_set_field16 (&word,EEPROM_ANTENNA_NUM ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT ,0 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT ,0 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_LED_MODE ,0 ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT , +ANTENNA_SW_DIVERSITY ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT , +ANTENNA_SW_DIVERSITY ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_LED_MODE , +LED_MODE_DEFAULT );rt2x00_set_field16 (&word,EEPROM_ANTENNA_DYN_TXAGC ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_HARDWARE_RADIO ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_RF_TYPE ,RF2522 );
drivers/net/wireless/rt2x00/rt2500usb.c +6 -3
@@ -1161,9 +1161,12 @@ static int rt2500usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)rt2x00_eeprom_read (rt2x00dev,EEPROM_ANTENNA , &word);if (word ==0xffff ) {rt2x00_set_field16 (&word,EEPROM_ANTENNA_NUM ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT ,0 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT ,0 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_LED_MODE ,0 ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT , +ANTENNA_SW_DIVERSITY ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT , +ANTENNA_SW_DIVERSITY ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_LED_MODE , +LED_MODE_DEFAULT );rt2x00_set_field16 (&word,EEPROM_ANTENNA_DYN_TXAGC ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_HARDWARE_RADIO ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_RF_TYPE ,RF2522 );
drivers/net/wireless/rt2x00/rt61pci.c +4 -2
@@ -1906,8 +1906,10 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)rt2x00_eeprom_read (rt2x00dev,EEPROM_ANTENNA , &word);if (word ==0xffff ) {rt2x00_set_field16 (&word,EEPROM_ANTENNA_NUM ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT ,2 ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT , +ANTENNA_B ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT , +ANTENNA_B );rt2x00_set_field16 (&word,EEPROM_ANTENNA_FRAME_TYPE ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_DYN_TXAGC ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_HARDWARE_RADIO ,0 );
drivers/net/wireless/rt2x00/rt73usb.c +4 -2
@@ -1389,8 +1389,10 @@ static int rt73usb_validate_eeprom(struct rt2x00_dev *rt2x00dev)rt2x00_eeprom_read (rt2x00dev,EEPROM_ANTENNA , &word);if (word ==0xffff ) {rt2x00_set_field16 (&word,EEPROM_ANTENNA_NUM ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT ,2 ); -rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT ,2 ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_TX_DEFAULT , +ANTENNA_B ); +rt2x00_set_field16 (&word,EEPROM_ANTENNA_RX_DEFAULT , +ANTENNA_B );rt2x00_set_field16 (&word,EEPROM_ANTENNA_FRAME_TYPE ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_DYN_TXAGC ,0 );rt2x00_set_field16 (&word,EEPROM_ANTENNA_HARDWARE_RADIO ,0 );
Signature · 1 line
1.5.3.4
PATCH 3/11 rt2x00: Correctly translate mac80211 antenna setup to rt2x00
In reply to a message not in the archivemac80211 has 3 values for the antenna setup:
0 - default
1 - use antenna 1
2 - use antenna 2
This means that rt2x00 should store the default value from the EEPROM somwhere and use that when mac80211 indicates that the antenna setup is 0.
This also implies that rt2x00 should no longer write the hw->config.antenna_sel_* values based on the EEPROM input.
This also adds the basis in rt2x00lib for correct software diversity handling. By default rt2x00lib will now configure antenna B instead of hardware diversity.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 25 +++++++++---- drivers/net/wireless/rt2x00/rt2500pci.c | 14 +++---- drivers/net/wireless/rt2x00/rt2500usb.c | 25 +++++++++---- drivers/net/wireless/rt2x00/rt2x00.h | 25 +++++++++++++- drivers/net/wireless/rt2x00/rt2x00config.c | 51 ++++++++++++++++++++++++++- drivers/net/wireless/rt2x00/rt2x00dev.c | 1 + drivers/net/wireless/rt2x00/rt61pci.c | 32 +++++++---------- drivers/net/wireless/rt2x00/rt73usb.c | 23 +++++------- 8 files changed, 137 insertions(+), 59 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +17 -8
@@ -397,7 +397,7 @@ static void rt2400pci_config_txpower(struct rt2x00_dev *rt2x00dev, int txpower) }static void rt2400pci_config_antenna (struct rt2x00_dev *rt2x00dev, -int antenna_tx,int antenna_rx) +struct antenna_setup *ant) {u8 r1;u8 r4;
@@ -408,7 +408,7 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the TX antenna. */ -switch (antenna_tx) { +switch (ant->tx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r1,BBP_R1_TX_ANTENNA ,1 );
@@ -424,7 +424,7 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the RX antenna. */ -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );
@@ -485,9 +485,7 @@ static void rt2400pci_config(struct rt2x00_dev *rt2x00dev,rt2400pci_config_txpower (rt2x00dev, libconf->conf->power_level);if (flags &CONFIG_UPDATE_ANTENNA ) -rt2400pci_config_antenna (rt2x00dev, - libconf->conf->antenna_sel_tx, - libconf->conf->antenna_sel_rx); +rt2400pci_config_antenna (rt2x00dev, &libconf->ant);if (flags & (CONFIG_UPDATE_SLOT_TIME |CONFIG_UPDATE_BEACON_INT ))rt2400pci_config_duration (rt2x00dev, libconf); }
@@ -1314,12 +1312,23 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Identify default antenna configuration. */ - rt2x00dev->hw->conf.antenna_sel_tx = + rt2x00dev->default_ant.tx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_TX_DEFAULT ); - rt2x00dev->hw->conf.antenna_sel_rx = + rt2x00dev->default_ant.rx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RX_DEFAULT );/* +* When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead. +* I am not 100% sure about this, but the legacy drivers do not +* indicate antenna swapping in software is required when +* diversity is enabled. +*/ +if (rt2x00dev->default_ant.tx ==ANTENNA_SW_DIVERSITY ) + rt2x00dev->default_ant.tx =ANTENNA_HW_DIVERSITY ; +if (rt2x00dev->default_ant.rx ==ANTENNA_SW_DIVERSITY ) + rt2x00dev->default_ant.rx =ANTENNA_HW_DIVERSITY ; + +/* * Store led mode, for correct led behaviour. */ rt2x00dev->led_mode =
drivers/net/wireless/rt2x00/rt2500pci.c +6 -8
@@ -424,7 +424,7 @@ static void rt2500pci_config_txpower(struct rt2x00_dev *rt2x00dev, }static void rt2500pci_config_antenna (struct rt2x00_dev *rt2x00dev, -const int antenna_tx,const int antenna_rx) +struct antenna_setup *ant) {u32 reg;u8 r14;
@@ -437,7 +437,7 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the TX antenna. */ -switch (antenna_tx) { +switch (ant->tx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,2 );
@@ -459,7 +459,7 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the RX antenna. */ -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,2 );
@@ -541,9 +541,7 @@ static void rt2500pci_config(struct rt2x00_dev *rt2x00dev,rt2500pci_config_txpower (rt2x00dev, libconf->conf->power_level);if (flags &CONFIG_UPDATE_ANTENNA ) -rt2500pci_config_antenna (rt2x00dev, - libconf->conf->antenna_sel_tx, - libconf->conf->antenna_sel_rx); +rt2500pci_config_antenna (rt2x00dev, &libconf->ant);if (flags & (CONFIG_UPDATE_SLOT_TIME |CONFIG_UPDATE_BEACON_INT ))rt2500pci_config_duration (rt2x00dev, libconf); }
@@ -1482,9 +1480,9 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Identify default antenna configuration. */ - rt2x00dev->hw->conf.antenna_sel_tx = + rt2x00dev->default_ant.tx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_TX_DEFAULT ); - rt2x00dev->hw->conf.antenna_sel_rx = + rt2x00dev->default_ant.rx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RX_DEFAULT );/*
drivers/net/wireless/rt2x00/rt2500usb.c +17 -8
@@ -385,7 +385,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev, }static void rt2500usb_config_antenna (struct rt2x00_dev *rt2x00dev, -const int antenna_tx,const int antenna_rx) +struct antenna_setup *ant) {u8 r2;u8 r14;
@@ -400,7 +400,7 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the TX antenna. */ -switch (antenna_tx) { +switch (ant->tx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,1 );
@@ -422,7 +422,7 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,/* * Configure the RX antenna. */ -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,1 );
@@ -487,9 +487,7 @@ static void rt2500usb_config(struct rt2x00_dev *rt2x00dev,rt2500usb_config_txpower (rt2x00dev, libconf->conf->power_level);if (flags &CONFIG_UPDATE_ANTENNA ) -rt2500usb_config_antenna (rt2x00dev, - libconf->conf->antenna_sel_tx, - libconf->conf->antenna_sel_rx); +rt2500usb_config_antenna (rt2x00dev, &libconf->ant);if (flags & (CONFIG_UPDATE_SLOT_TIME |CONFIG_UPDATE_BEACON_INT ))rt2500usb_config_duration (rt2x00dev, libconf); }
@@ -1276,12 +1274,23 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Identify default antenna configuration. */ - rt2x00dev->hw->conf.antenna_sel_tx = + rt2x00dev->default_ant.tx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_TX_DEFAULT ); - rt2x00dev->hw->conf.antenna_sel_rx = + rt2x00dev->default_ant.rx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RX_DEFAULT );/* +* When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead. +* I am not 100% sure about this, but the legacy drivers do not +* indicate antenna swapping in software is required when +* diversity is enabled. +*/ +if (rt2x00dev->default_ant.tx ==ANTENNA_SW_DIVERSITY ) + rt2x00dev->default_ant.tx =ANTENNA_HW_DIVERSITY ; +if (rt2x00dev->default_ant.rx ==ANTENNA_SW_DIVERSITY ) + rt2x00dev->default_ant.rx =ANTENNA_HW_DIVERSITY ; + +/* * Store led mode, for correct led behaviour. */ rt2x00dev->led_mode =
drivers/net/wireless/rt2x00/rt2x00.h +24 -1
@@ -180,6 +180,14 @@ struct rf_channel { };/* +* Antenna setup values. +*/ +struct antenna_setup { +enum antenna rx; +enum antenna tx; +}; + +/* * Quality statistics about the currently active link. */ struct link_qual {
@@ -251,6 +259,13 @@ struct link {struct link_qual qual;/* +* Currently active TX/RX antenna setup. +* When software diversity is used, this will indicate +* which antenna is actually used at this time. +*/ +struct antenna_setup active_ant; + +/* * Active VGC level */ int vgc_level;
@@ -272,7 +287,6 @@ static inline void rt2x00_clear_link(struct link *link) link->qual.tx_percentage =50 ; } -/* * Update the rssi using the walking average approach. */
@@ -378,6 +392,8 @@ struct rt2x00lib_conf {struct ieee80211_conf *conf;struct rf_channel rf; +struct antenna_setup ant; +int phymode;int basic_rates;
@@ -583,6 +599,13 @@ struct rt2x00_dev {struct hw_mode_spec spec;/* +* This is the default TX/RX antenna setup as indicated +* by the device's EEPROM. When mac80211 sets its +* antenna value to 0 we should be using these values. +*/ +struct antenna_setup default_ant; + +/* * Register pointers * csr_addr: Base register address. (PCI) * csr_cache: CSR cache for usb_control_msg. (USB)
drivers/net/wireless/rt2x00/rt2x00config.c +49 -2
73 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00dev.c +1 -0
@@ -419,6 +419,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,rt2x00lib_calculate_link_signal (rt2x00dev, desc->rssi); rx_status->ssi = desc->rssi; rx_status->flag = desc->flags; + rx_status->antenna = rt2x00dev->link.active_ant.rx;/* * Send frame to mac80211
drivers/net/wireless/rt2x00/rt61pci.c +13 -19
@@ -411,8 +411,7 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev, }static void rt61pci_config_antenna_5x (struct rt2x00_dev *rt2x00dev, -const int antenna_tx, -const int antenna_rx) +struct antenna_setup *ant) {u8 r3;u8 r4;
@@ -425,7 +424,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r3,BBP_R3_SMART_MODE , !rt2x00_rf (&rt2x00dev->chip,RF5225 )); -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );
@@ -458,8 +457,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, }static void rt61pci_config_antenna_2x (struct rt2x00_dev *rt2x00dev, -const int antenna_tx, -const int antenna_rx) +struct antenna_setup *ant) {u8 r3;u8 r4;
@@ -474,7 +472,7 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r4,BBP_R4_RX_FRAME_END , !test_bit (CONFIG_FRAME_TYPE , &rt2x00dev->flags)); -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );
@@ -514,8 +512,7 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev, }static void rt61pci_config_antenna_2529 (struct rt2x00_dev *rt2x00dev, -const int antenna_tx, -const int antenna_rx) +struct antenna_setup *ant) {u16 eeprom;u8 r3;
@@ -625,7 +622,7 @@ static const struct antenna_sel antenna_sel_bg[] = { };static void rt61pci_config_antenna (struct rt2x00_dev *rt2x00dev, -const int antenna_tx,const int antenna_rx) +struct antenna_setup *ant) {const struct antenna_sel *sel;unsigned int lna;
@@ -655,16 +652,14 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,if (rt2x00_rf (&rt2x00dev->chip,RF5225 ) ||rt2x00_rf (&rt2x00dev->chip,RF5325 )) -rt61pci_config_antenna_5x (rt2x00dev, antenna_tx, antenna_rx); +rt61pci_config_antenna_5x (rt2x00dev, ant);else if (rt2x00_rf (&rt2x00dev->chip,RF2527 )) -rt61pci_config_antenna_2x (rt2x00dev, antenna_tx, antenna_rx); +rt61pci_config_antenna_2x (rt2x00dev, ant);else if (rt2x00_rf (&rt2x00dev->chip,RF2529 )) {if (test_bit (CONFIG_DOUBLE_ANTENNA , &rt2x00dev->flags)) -rt61pci_config_antenna_2x (rt2x00dev, antenna_tx, - antenna_rx); +rt61pci_config_antenna_2x (rt2x00dev, ant);else -rt61pci_config_antenna_2529 (rt2x00dev, antenna_tx, - antenna_rx); +rt61pci_config_antenna_2529 (rt2x00dev, ant); } }
@@ -709,8 +704,7 @@ static void rt61pci_config(struct rt2x00_dev *rt2x00dev,if ((flags &CONFIG_UPDATE_TXPOWER ) && !(flags &CONFIG_UPDATE_CHANNEL ))rt61pci_config_txpower (rt2x00dev, libconf->conf->power_level);if (flags &CONFIG_UPDATE_ANTENNA ) -rt61pci_config_antenna (rt2x00dev, libconf->conf->antenna_sel_tx, - libconf->conf->antenna_sel_rx); +rt61pci_config_antenna (rt2x00dev, &libconf->ant);if (flags & (CONFIG_UPDATE_SLOT_TIME |CONFIG_UPDATE_BEACON_INT ))rt61pci_config_duration (rt2x00dev, libconf); }
@@ -2015,9 +2009,9 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Identify default antenna configuration. */ - rt2x00dev->hw->conf.antenna_sel_tx = + rt2x00dev->default_ant.tx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_TX_DEFAULT ); - rt2x00dev->hw->conf.antenna_sel_rx = + rt2x00dev->default_ant.rx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RX_DEFAULT );/*
drivers/net/wireless/rt2x00/rt73usb.c +10 -13
@@ -396,8 +396,7 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev, }static void rt73usb_config_antenna_5x (struct rt2x00_dev *rt2x00dev, -const int antenna_tx, -const int antenna_rx) +struct antenna_setup *ant) {u8 r3;u8 r4;
@@ -409,7 +408,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r3,BBP_R3_SMART_MODE ,0 ); -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );
@@ -442,8 +441,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, }static void rt73usb_config_antenna_2x (struct rt2x00_dev *rt2x00dev, -const int antenna_tx, -const int antenna_rx) +struct antenna_setup *ant) {u8 r3;u8 r4;
@@ -457,7 +455,7 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r4,BBP_R4_RX_FRAME_END , !test_bit (CONFIG_FRAME_TYPE , &rt2x00dev->flags)); -switch (antenna_rx) { +switch (ant->rx) {case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );
@@ -509,7 +507,7 @@ static const struct antenna_sel antenna_sel_bg[] = { };static void rt73usb_config_antenna (struct rt2x00_dev *rt2x00dev, -const int antenna_tx,const int antenna_rx) +struct antenna_setup *ant) {const struct antenna_sel *sel;unsigned int lna;
@@ -539,10 +537,10 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev,if (rt2x00_rf (&rt2x00dev->chip,RF5226 ) ||rt2x00_rf (&rt2x00dev->chip,RF5225 )) -rt73usb_config_antenna_5x (rt2x00dev, antenna_tx, antenna_rx); +rt73usb_config_antenna_5x (rt2x00dev, ant);else if (rt2x00_rf (&rt2x00dev->chip,RF2528 ) ||rt2x00_rf (&rt2x00dev->chip,RF2527 )) -rt73usb_config_antenna_2x (rt2x00dev, antenna_tx, antenna_rx); +rt73usb_config_antenna_2x (rt2x00dev, ant); } static void rt73usb_config_duration(struct rt2x00_dev *rt2x00dev,
@@ -586,8 +584,7 @@ static void rt73usb_config(struct rt2x00_dev *rt2x00dev,if ((flags &CONFIG_UPDATE_TXPOWER ) && !(flags &CONFIG_UPDATE_CHANNEL ))rt73usb_config_txpower (rt2x00dev, libconf->conf->power_level);if (flags &CONFIG_UPDATE_ANTENNA ) -rt73usb_config_antenna (rt2x00dev, libconf->conf->antenna_sel_tx, - libconf->conf->antenna_sel_rx); +rt73usb_config_antenna (rt2x00dev, &libconf->ant);if (flags & (CONFIG_UPDATE_SLOT_TIME |CONFIG_UPDATE_BEACON_INT ))rt73usb_config_duration (rt2x00dev, libconf); }
@@ -1501,9 +1498,9 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)/* * Identify default antenna configuration. */ - rt2x00dev->hw->conf.antenna_sel_tx = + rt2x00dev->default_ant.tx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_TX_DEFAULT ); - rt2x00dev->hw->conf.antenna_sel_rx = + rt2x00dev->default_ant.rx =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RX_DEFAULT );/*
Signature · 1 line
1.5.3.4
PATCH 4/11 rt2x00: SW diversity should default to antenna B
In reply to a message not in the archiveAlthough ANTENNA_SW_DIVERSITY should never be send to the driver, we should still handle it to prevent bugs. But instead of defaulting to ANTENNA_HW_DIVERSITY we should default to ANTENNA_B instead.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 16 ++++++++++++++-- drivers/net/wireless/rt2x00/rt2500pci.c | 26 ++++++++++++++++---------- drivers/net/wireless/rt2x00/rt2500usb.c | 16 ++++++++++++++-- drivers/net/wireless/rt2x00/rt61pci.c | 16 ++++++++++++++-- drivers/net/wireless/rt2x00/rt73usb.c | 16 ++++++++++++++-- 5 files changed, 72 insertions(+), 18 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +14 -2
@@ -409,13 +409,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the TX antenna. */ switch (ant->tx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r1,BBP_R1_TX_ANTENNA ,1 );break ;case ANTENNA_A :rt2x00_set_field8 (&r1,BBP_R1_TX_ANTENNA ,0 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r1,BBP_R1_TX_ANTENNA ,2 );break ;
@@ -425,13 +431,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the RX antenna. */ switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );break ;case ANTENNA_A :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,0 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );break ;
drivers/net/wireless/rt2x00/rt2500pci.c +16 -10
@@ -438,17 +438,19 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the TX antenna. */ switch (ant->tx) { -case ANTENNA_SW_DIVERSITY : -case ANTENNA_HW_DIVERSITY : -rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,2 ); -rt2x00_set_field32 (®,BBPCSR1_CCK ,2 ); -rt2x00_set_field32 (®,BBPCSR1_OFDM ,2 ); -break ;case ANTENNA_A :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,0 );rt2x00_set_field32 (®,BBPCSR1_CCK ,0 );rt2x00_set_field32 (®,BBPCSR1_OFDM ,0 );break ; +case ANTENNA_HW_DIVERSITY : +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,2 );rt2x00_set_field32 (®,BBPCSR1_CCK ,2 );
@@ -460,13 +462,17 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the RX antenna. */ switch (ant->rx) { -case ANTENNA_SW_DIVERSITY : -case ANTENNA_HW_DIVERSITY : -rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,2 ); -break ;case ANTENNA_A :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,0 );break ; +case ANTENNA_HW_DIVERSITY : +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,2 );break ;
drivers/net/wireless/rt2x00/rt2500usb.c +14 -2
@@ -401,7 +401,6 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the TX antenna. */ switch (ant->tx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,1 );rt2x00_set_field16 (&csr5,PHY_CSR5_CCK ,1 );
@@ -412,6 +411,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,rt2x00_set_field16 (&csr5,PHY_CSR5_CCK ,0 );rt2x00_set_field16 (&csr6,PHY_CSR6_OFDM ,0 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r2,BBP_R2_TX_ANTENNA ,2 );rt2x00_set_field16 (&csr5,PHY_CSR5_CCK ,2 );
@@ -423,13 +429,19 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,* Configure the RX antenna. */ switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,1 );break ;case ANTENNA_A :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,0 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r14,BBP_R14_RX_ANTENNA ,2 );break ;
drivers/net/wireless/rt2x00/rt61pci.c +14 -2
@@ -425,7 +425,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, !rt2x00_rf(&rt2x00dev->chip, RF5225));switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 ); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
@@ -440,6 +439,13 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,else rt2x00_set_field8 (&r77,BBP_R77_PAIR ,3 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r4,BBP_R4_RX_FRAME_END ,0 );
@@ -473,7 +479,6 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );break ;
@@ -481,6 +486,13 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r77,BBP_R77_PAIR ,3 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r77,BBP_R77_PAIR ,0 );
drivers/net/wireless/rt2x00/rt73usb.c +14 -2
@@ -409,7 +409,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r3,BBP_R3_SMART_MODE ,0 );switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 ); rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
@@ -424,6 +423,13 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,else rt2x00_set_field8 (&r77,BBP_R77_PAIR ,3 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r4,BBP_R4_RX_FRAME_END ,0 );
@@ -456,7 +462,6 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));switch (ant->rx) { -case ANTENNA_SW_DIVERSITY :case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );break ;
@@ -464,6 +469,13 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r77,BBP_R77_PAIR ,3 );break ; +case ANTENNA_SW_DIVERSITY : +/* +* NOTE: We should never come here because rt2x00lib is +* supposed to catch this and send us the correct antenna +* explicitely. However we are nog going to bug about this. +* Instead, just default to antenna B. +*/ case ANTENNA_B :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );rt2x00_set_field8 (&r77,BBP_R77_PAIR ,0 );
Signature · 1 line
1.5.3.4
PATCH 5/11 rt2x00: Remove rt2x00_clear_link
In reply to a message not in the archivert2x00_clear_link() was becoming too large for statically inline, also it was used on a single location and shouldn't really be used anywhere else. So move the entire code into the function rt2x00lib_start_link_tuner()
--- drivers/net/wireless/rt2x00/rt2x00.h | 18 +++--------------- drivers/net/wireless/rt2x00/rt2x00dev.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 16 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +3 -15
@@ -277,25 +277,13 @@ struct link { };/* -* Clear all counters inside the link structure. -*/ -static inline void rt2x00_clear_link (struct link *link) -{ - link->count =0 ; -memset (&link->qual,0 ,sizeof (link->qual)); - link->qual.rx_percentage =50 ; - link->qual.tx_percentage =50 ; -} - -/* * Update the rssi using the walking average approach. */ static inline void rt2x00_update_link_rssi (struct link *link,int rssi) { -if (!link->qual.avg_rssi) - link->qual.avg_rssi = rssi; -else - link->qual.avg_rssi = ((link->qual.avg_rssi *7 ) + rssi) /8 ; +if (link->qual.avg_rssi) + rssi = ((link->qual.avg_rssi *7 ) + rssi) /8 ; + link->qual.avg_rssi = rssi; }/*
drivers/net/wireless/rt2x00/rt2x00dev.c +15 -1
@@ -67,7 +67,21 @@ EXPORT_SYMBOL_GPL(rt2x00lib_get_ring);*/ static void rt2x00lib_start_link_tuner (struct rt2x00_dev *rt2x00dev) { -rt2x00_clear_link (&rt2x00dev->link); + rt2x00dev->link.count =0 ; + rt2x00dev->link.vgc_level =0 ; + +memset (&rt2x00dev->link.qual,0 ,sizeof (rt2x00dev->link.qual)); + +/* +* The RX and TX percentage should start at 50% +* this will assure we will get at least get some +* decent value when the link tuner starts. +* The value will be dropped and overwritten with +* the correct (measured )value anyway during the +* first run of the link tuner. +*/ + rt2x00dev->link.qual.rx_percentage =50 ; + rt2x00dev->link.qual.tx_percentage =50 ;/* * Reset the link tuner.
Signature · 1 line
1.5.3.4
PATCH 6/11 rt2x00: Implement SW diversity
In reply to a message not in the archiveWhen mac80211 indicates that the default antenna setup should be used _and_ that this default setup is SW_DIVERSITY.
This requires sampling and storing the RSSI per antenna and check once every 2 seconds to determine if the RSSI has changed significantly. Once this is the case we should sample the other antenna for a short period and evaluate if
we need to swap antenna or not.
--- drivers/net/wireless/rt2x00/rt2x00.h | 87 ++++++++++++++--- drivers/net/wireless/rt2x00/rt2x00config.c | 26 +++++- drivers/net/wireless/rt2x00/rt2x00dev.c | 138 +++++++++++++++++++++++++++- drivers/net/wireless/rt2x00/rt2x00lib.h | 2 + 4 files changed, 232 insertions(+), 21 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +72 -15
@@ -241,6 +241,43 @@ struct link_qual { };/* +* Antenna settings about the currently active link. +*/ +struct link_ant { +/* +* Antenna flags +*/ +unsigned int flags; +#define ANTENNA_RX_DIVERSITY 0x00000001 +#define ANTENNA_TX_DIVERSITY 0x00000002 +#define ANTENNA_MODE_SAMPLE 0x00000004 + +/* +* Currently active TX/RX antenna setup. +* When software diversity is used, this will indicate +* which antenna is actually used at this time. +*/ +struct antenna_setup active; + +/* +* RSSI information for the different antenna's. +* These statistics are used to determine when +* to switch antenna when using software diversity. +* +* rssi[0] -> Antenna A RSSI +* rssi[1] -> Antenna B RSSI +*/ +int rssi_history[2 ]; + +/* +* Current RSSI average of the currently active antenna. +* Similar to the avg_rssi in the link_qual structure +* this value is updated by using the walking average. +*/ +int rssi_ant; +}; + +/* * To optimize the quality of the link we need to store * the quality of received frames and periodically * optimize the link.
@@ -259,11 +296,9 @@ struct link {struct link_qual qual;/* -* Currently active TX/RX antenna setup. -* When software diversity is used, this will indicate -* which antenna is actually used at this time. +* TX/RX antenna setup. */ -struct antenna_setup active_ant; +struct link_ant ant;/* * Active VGC level
@@ -277,25 +312,47 @@ struct link { };/* -* Update the rssi using the walking average approach. +* Small helper macro to work with moving/walking averages. */ -static inline void rt2x00_update_link_rssi (struct link *link,int rssi) -{ -if (link->qual.avg_rssi) - rssi = ((link->qual.avg_rssi *7 ) + rssi) /8 ; - link->qual.avg_rssi = rssi; -} +#define MOVING_AVERAGE (__avg, __val, __samples) \ + ( (((__avg) * ((__samples) - 1)) + (__val)) / (__samples) ) + +/* +* When we lack RSSI information return something less then -80 to +* tell the driver to tune the device to maximum sensitivity. +*/ +#define DEFAULT_RSSI ( -128 )/* -* When the avg_rssi is unset or no frames have been received), -* we need to return the default value which needs to be less -* than -80 so the device will select the maximum sensitivity. +* Link quality access functions. */ static inline int rt2x00_get_link_rssi (struct link *link) {if (link->qual.avg_rssi && link->qual.rx_success)return link->qual.avg_rssi; -return -128 ; +return DEFAULT_RSSI ; +} + +static inline int rt2x00_get_link_ant_rssi (struct link *link) +{ +if (link->ant.rssi_ant && link->qual.rx_success) +return link->ant.rssi_ant; +return DEFAULT_RSSI ; +} + +static inline int rt2x00_get_link_ant_rssi_history (struct link *link, +enum antenna ant) +{ +if (link->ant.rssi_history[ant -ANTENNA_A ]) +return link->ant.rssi_history[ant -ANTENNA_A ]; +return DEFAULT_RSSI ; +} + +static inline int rt2x00_update_ant_rssi (struct link *link,int rssi) +{ +int old_rssi = link->ant.rssi_history[link->ant.active.rx -ANTENNA_A ]; + link->ant.rssi_history[link->ant.active.rx -ANTENNA_A ] = rssi; +return old_rssi; }/*
drivers/net/wireless/rt2x00/rt2x00config.c +23 -3
@@ -94,6 +94,26 @@ void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type) rt2x00dev->ops->lib->config_type (rt2x00dev, type, tsf_sync); } +void rt2x00lib_config_antenna (struct rt2x00_dev *rt2x00dev, +enum antenna rx,enum antenna tx) +{ +struct rt2x00lib_conf libconf; + + libconf.ant.rx = rx; + libconf.ant.tx = tx; + +/* +* Write new antenna setup to device and reset the link tuner. +* The latter is required since we need to recalibrate the +* noise-sensitivity ratio for the new setup. +*/ + rt2x00dev->ops->lib->config (rt2x00dev,CONFIG_UPDATE_ANTENNA , &libconf); +rt2x00lib_reset_link_tuner (rt2x00dev); + + rt2x00dev->link.ant.active.rx = libconf.ant.rx; + rt2x00dev->link.ant.active.tx = libconf.ant.tx; +} +void rt2x00lib_config (struct rt2x00_dev *rt2x00dev,struct ieee80211_conf *conf,const int force_config) {
@@ -101,7 +121,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,struct ieee80211_hw_mode *mode;struct ieee80211_rate *rate;struct antenna_setup *default_ant = &rt2x00dev->default_ant; -struct antenna_setup *active_ant = &rt2x00dev->link.active_ant; +struct antenna_setup *active_ant = &rt2x00dev->link.ant.active;int flags =0 ;int short_slot_time;
@@ -247,6 +267,6 @@ config: rt2x00dev->rx_status.freq = conf->freq; rt2x00dev->rx_status.channel = conf->channel; rt2x00dev->tx_power = conf->power_level; - rt2x00dev->link.active_ant.rx = libconf.ant.rx; - rt2x00dev->link.active_ant.tx = libconf.ant.tx; + rt2x00dev->link.ant.active.rx = libconf.ant.rx; + rt2x00dev->link.ant.active.tx = libconf.ant.tx; }
drivers/net/wireless/rt2x00/rt2x00dev.c +135 -3
168 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00lib.h +2 -0
@@ -53,6 +53,8 @@ void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev);void rt2x00lib_config_mac_addr (struct rt2x00_dev *rt2x00dev,u8 *mac);void rt2x00lib_config_bssid (struct rt2x00_dev *rt2x00dev,u8 *bssid);void rt2x00lib_config_type (struct rt2x00_dev *rt2x00dev,const int type); +void rt2x00lib_config_antenna (struct rt2x00_dev *rt2x00dev, +enum antenna rx,enum antenna tx);void rt2x00lib_config (struct rt2x00_dev *rt2x00dev,struct ieee80211_conf *conf,const int force_config);
Signature · 1 line
1.5.3.4
PATCH 7/11 rt2x00: Cleanup if-statements
In reply to a message not in the archiveCleanup if-statements for simple 1/0 register field values.
This also fixes a endian bug in rt2500usb when working with the PHY_CSR2 initialization. As well as a bug in the enabling of the LED in rt73usb.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 28 ++++++----------- drivers/net/wireless/rt2x00/rt2500pci.c | 28 ++++++----------- drivers/net/wireless/rt2x00/rt2500usb.c | 22 +++++-------- drivers/net/wireless/rt2x00/rt2500usb.h | 13 +++++++- drivers/net/wireless/rt2x00/rt2x00.h | 12 ++++---- drivers/net/wireless/rt2x00/rt61pci.c | 50 +++++++++++++++---------------- drivers/net/wireless/rt2x00/rt73usb.c | 28 ++++++++--------- 7 files changed, 83 insertions(+), 98 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +10 -18
@@ -524,18 +524,10 @@ static void rt2400pci_enable_led(struct rt2x00_dev *rt2x00dev)rt2x00_set_field32 (®,LEDCSR_ON_PERIOD ,70 );rt2x00_set_field32 (®,LEDCSR_OFF_PERIOD ,30 ); - -if (rt2x00dev->led_mode ==LED_MODE_TXRX_ACTIVITY ) { -rt2x00_set_field32 (®,LEDCSR_LINK ,1 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,0 ); - }else if (rt2x00dev->led_mode ==LED_MODE_ASUS ) { -rt2x00_set_field32 (®,LEDCSR_LINK ,0 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,1 ); - }else { -rt2x00_set_field32 (®,LEDCSR_LINK ,1 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,1 ); - } - +rt2x00_set_field32 (®,LEDCSR_LINK , + (rt2x00dev->led_mode !=LED_MODE_ASUS )); +rt2x00_set_field32 (®,LEDCSR_ACTIVITY , + (rt2x00dev->led_mode !=LED_MODE_TXRX_ACTIVITY ));rt2x00pci_register_write (rt2x00dev,LEDCSR , reg); }
@@ -1110,12 +1102,12 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, }rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®); -if (queue ==IEEE80211_TX_QUEUE_DATA0 ) -rt2x00_set_field32 (®,TXCSR0_KICK_PRIO ,1 ); -else if (queue ==IEEE80211_TX_QUEUE_DATA1 ) -rt2x00_set_field32 (®,TXCSR0_KICK_TX ,1 ); -else if (queue ==IEEE80211_TX_QUEUE_AFTER_BEACON ) -rt2x00_set_field32 (®,TXCSR0_KICK_ATIM ,1 ); +rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , + (queue ==IEEE80211_TX_QUEUE_DATA0 )); +rt2x00_set_field32 (®,TXCSR0_KICK_TX , + (queue ==IEEE80211_TX_QUEUE_DATA1 )); +rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , + (queue ==IEEE80211_TX_QUEUE_AFTER_BEACON ));rt2x00pci_register_write (rt2x00dev,TXCSR0 , reg); }
drivers/net/wireless/rt2x00/rt2500pci.c +10 -18
@@ -563,18 +563,10 @@ static void rt2500pci_enable_led(struct rt2x00_dev *rt2x00dev)rt2x00_set_field32 (®,LEDCSR_ON_PERIOD ,70 );rt2x00_set_field32 (®,LEDCSR_OFF_PERIOD ,30 ); - -if (rt2x00dev->led_mode ==LED_MODE_TXRX_ACTIVITY ) { -rt2x00_set_field32 (®,LEDCSR_LINK ,1 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,0 ); - }else if (rt2x00dev->led_mode ==LED_MODE_ASUS ) { -rt2x00_set_field32 (®,LEDCSR_LINK ,0 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,1 ); - }else { -rt2x00_set_field32 (®,LEDCSR_LINK ,1 ); -rt2x00_set_field32 (®,LEDCSR_ACTIVITY ,1 ); - } - +rt2x00_set_field32 (®,LEDCSR_LINK , + (rt2x00dev->led_mode !=LED_MODE_ASUS )); +rt2x00_set_field32 (®,LEDCSR_ACTIVITY , + (rt2x00dev->led_mode !=LED_MODE_TXRX_ACTIVITY ));rt2x00pci_register_write (rt2x00dev,LEDCSR , reg); }
@@ -1244,12 +1236,12 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, }rt2x00pci_register_read (rt2x00dev,TXCSR0 , ®); -if (queue ==IEEE80211_TX_QUEUE_DATA0 ) -rt2x00_set_field32 (®,TXCSR0_KICK_PRIO ,1 ); -else if (queue ==IEEE80211_TX_QUEUE_DATA1 ) -rt2x00_set_field32 (®,TXCSR0_KICK_TX ,1 ); -else if (queue ==IEEE80211_TX_QUEUE_AFTER_BEACON ) -rt2x00_set_field32 (®,TXCSR0_KICK_ATIM ,1 ); +rt2x00_set_field32 (®,TXCSR0_KICK_PRIO , + (queue ==IEEE80211_TX_QUEUE_DATA0 )); +rt2x00_set_field32 (®,TXCSR0_KICK_TX , + (queue ==IEEE80211_TX_QUEUE_DATA1 )); +rt2x00_set_field32 (®,TXCSR0_KICK_ATIM , + (queue ==IEEE80211_TX_QUEUE_AFTER_BEACON ));rt2x00pci_register_write (rt2x00dev,TXCSR0 , reg); }
drivers/net/wireless/rt2x00/rt2500usb.c +8 -14
@@ -517,18 +517,10 @@ static void rt2500usb_enable_led(struct rt2x00_dev *rt2x00dev)rt2500usb_register_write (rt2x00dev,MAC_CSR21 , reg);rt2500usb_register_read (rt2x00dev,MAC_CSR20 , ®); - -if (rt2x00dev->led_mode ==LED_MODE_TXRX_ACTIVITY ) { -rt2x00_set_field16 (®,MAC_CSR20_LINK ,1 ); -rt2x00_set_field16 (®,MAC_CSR20_ACTIVITY ,0 ); - }else if (rt2x00dev->led_mode ==LED_MODE_ASUS ) { -rt2x00_set_field16 (®,MAC_CSR20_LINK ,0 ); -rt2x00_set_field16 (®,MAC_CSR20_ACTIVITY ,1 ); - }else { -rt2x00_set_field16 (®,MAC_CSR20_LINK ,1 ); -rt2x00_set_field16 (®,MAC_CSR20_ACTIVITY ,1 ); - } - +rt2x00_set_field16 (®,MAC_CSR20_LINK , + (rt2x00dev->led_mode !=LED_MODE_ASUS )); +rt2x00_set_field16 (®,MAC_CSR20_ACTIVITY , + (rt2x00dev->led_mode !=LED_MODE_TXRX_ACTIVITY ));rt2500usb_register_write (rt2x00dev,MAC_CSR20 , reg); }
@@ -765,9 +757,11 @@ static int rt2500usb_init_registers(struct rt2x00_dev *rt2x00dev)if (rt2x00_get_rev (&rt2x00dev->chip) >=RT2570_VERSION_C ) {rt2500usb_register_read (rt2x00dev,PHY_CSR2 , ®); - reg &= ~0x0002 ; +rt2x00_set_field16 (®,PHY_CSR2_LNA ,0 ); }else { - reg =0x3002 ; + reg =0 ; +rt2x00_set_field16 (®,PHY_CSR2_LNA ,1 ); +rt2x00_set_field16 (®,PHY_CSR2_LNA_MODE ,3 ); }rt2500usb_register_write (rt2x00dev,PHY_CSR2 , reg);
drivers/net/wireless/rt2x00/rt2500usb.h +12 -1
@@ -430,10 +430,21 @@/* * MAC configuration registers. +*/ + +/* * PHY_CSR2: TX MAC configuration. -* PHY_CSR3: RX MAC configuration. +* NOTE: Both register fields are complete dummy, +* documentation and legacy drivers are unclear un +* what this register means or what fields exists. */ #define PHY_CSR2 0x04c4 +#define PHY_CSR2_LNA FIELD16(0x0002) +#define PHY_CSR2_LNA_MODE FIELD16(0x3000) + +/* +* PHY_CSR3: RX MAC configuration. +*/ #define PHY_CSR3 0x04c6/*
drivers/net/wireless/rt2x00/rt2x00.h +6 -6
@@ -133,20 +133,20 @@*/ static inline int is_rts_frame (u16 fc) { -return !!(((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_RTS )); +return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && + ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_RTS )); }static inline int is_cts_frame (u16 fc) { -return !!(((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_CTS )); +return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && + ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_CTS )); }static inline int is_probe_resp (u16 fc) { -return !!(((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_PROBE_RESP )); +return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) && + ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_PROBE_RESP )); }/*
drivers/net/wireless/rt2x00/rt61pci.c +24 -26
86 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt73usb.c +13 -15
@@ -200,8 +200,8 @@ rf_write:* all others contain 20 bits. */ rt2x00_set_field32 (®,PHY_CSR4_NUMBER_OF_BITS , -20 + !!(rt2x00_rf (&rt2x00dev->chip,RF5225 ) || -rt2x00_rf (&rt2x00dev->chip,RF2527 ))); +20 + (rt2x00_rf (&rt2x00dev->chip,RF5225 ) || +rt2x00_rf (&rt2x00dev->chip,RF2527 )));rt2x00_set_field32 (®,PHY_CSR4_IF_SELECT ,0 );rt2x00_set_field32 (®,PHY_CSR4_BUSY ,1 );
@@ -412,7 +412,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,case ANTENNA_HW_DIVERSITY :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,2 );rt2x00_set_field8 (&r4,BBP_R4_RX_FRAME_END , - !!(rt2x00dev->curr_hwmode !=HWMODE_A )); + (rt2x00dev->curr_hwmode !=HWMODE_A ));break ;case ANTENNA_A :rt2x00_set_field8 (&r4,BBP_R4_RX_ANTENNA ,1 );
@@ -531,17 +531,17 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev,if (rt2x00dev->curr_hwmode ==HWMODE_A ) { sel = antenna_sel_a; lna =test_bit (CONFIG_EXTERNAL_LNA_A , &rt2x00dev->flags); - -rt2x00_set_field32 (®,PHY_CSR0_PA_PE_BG ,0 ); -rt2x00_set_field32 (®,PHY_CSR0_PA_PE_A ,1 ); }else { sel = antenna_sel_bg; lna =test_bit (CONFIG_EXTERNAL_LNA_BG , &rt2x00dev->flags); - -rt2x00_set_field32 (®,PHY_CSR0_PA_PE_BG ,1 ); -rt2x00_set_field32 (®,PHY_CSR0_PA_PE_A ,0 ); } +rt2x00_set_field32 (®,PHY_CSR0_PA_PE_BG , + (rt2x00dev->curr_hwmode ==HWMODE_B || + rt2x00dev->curr_hwmode ==HWMODE_G )); +rt2x00_set_field32 (®,PHY_CSR0_PA_PE_A , + (rt2x00dev->curr_hwmode ==HWMODE_A )); +for (i =0 ; i <ARRAY_SIZE (antenna_sel_a); i++)rt73usb_bbp_write (rt2x00dev, sel[i].word, sel[i].value[lna]);
@@ -614,12 +614,10 @@ static void rt73usb_enable_led(struct rt2x00_dev *rt2x00dev)rt73usb_register_write (rt2x00dev,MAC_CSR14 , reg);rt2x00_set_field16 (&rt2x00dev->led_reg,MCU_LEDCS_RADIO_STATUS ,1 ); -if (rt2x00dev->rx_status.phymode ==MODE_IEEE80211A ) -rt2x00_set_field16 (&rt2x00dev->led_reg, -MCU_LEDCS_LINK_A_STATUS ,1 ); -else -rt2x00_set_field16 (&rt2x00dev->led_reg, -MCU_LEDCS_LINK_BG_STATUS ,1 ); +rt2x00_set_field16 (&rt2x00dev->led_reg,MCU_LEDCS_LINK_A_STATUS , + (rt2x00dev->rx_status.phymode ==MODE_IEEE80211A )); +rt2x00_set_field16 (&rt2x00dev->led_reg,MCU_LEDCS_LINK_BG_STATUS , + (rt2x00dev->rx_status.phymode !=MODE_IEEE80211A ));rt2x00usb_vendor_request_sw (rt2x00dev,USB_LED_CONTROL ,0x0000 , rt2x00dev->led_reg,REGISTER_TIMEOUT );
Signature · 1 line
1.5.3.4
PATCH 8/11 rt2x00: Fix residual check in PLCP calculations.
In reply to a message not in the archiveFrom: Mattias Nissler <[email protected]>
Because rt2x00 implements the residual calculation different from what the legacy code does (i.e. scaled values), we need to adjust the residual check. Again, we are only mimicking the behaviour of the ralink driver without actually knowing what we do :-(
--- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +1 -1
@@ -697,7 +697,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,/* * Check if we need to set the Length Extension */ -if (bitrate ==110 && residual <=3 ) +if (bitrate ==110 && residual <=30 ) desc.service |=0x80 ; }
Signature · 1 line
1.5.3.4
PATCH 9/11 rt2x00: Fix antenna selection.
In reply to a message not in the archiveFrom: Mattias Nissler <[email protected]>
In the config() handler, make sure that we do configure an antenna if the current active antenna is uninitialized. Furthermore, don't overwrite the active antenna with bogus values if we didn't touch the antenna setup.
--- drivers/net/wireless/rt2x00/rt2x00config.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
drivers/net/wireless/rt2x00/rt2x00config.c +14 -4
@@ -166,6 +166,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,else if (conf->antenna_sel_rx && conf->antenna_sel_rx != active_ant->rx) flags |=CONFIG_UPDATE_ANTENNA ; +else if (active_ant->rx ==ANTENNA_SW_DIVERSITY ) + flags |=CONFIG_UPDATE_ANTENNA ; if (!conf->antenna_sel_tx && default_ant->tx != ANTENNA_SW_DIVERSITY &&
@@ -174,6 +176,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,else if (conf->antenna_sel_tx && conf->antenna_sel_tx != active_ant->tx) flags |=CONFIG_UPDATE_ANTENNA ; +else if (active_ant->tx ==ANTENNA_SW_DIVERSITY ) + flags |=CONFIG_UPDATE_ANTENNA ;/* * The following configuration options are never
@@ -262,11 +266,17 @@ config:if (flags & (CONFIG_UPDATE_CHANNEL |CONFIG_UPDATE_ANTENNA ))rt2x00lib_reset_link_tuner (rt2x00dev); - rt2x00dev->curr_hwmode = libconf.phymode; - rt2x00dev->rx_status.phymode = conf->phymode; +if (flags &CONFIG_UPDATE_PHYMODE ) { + rt2x00dev->curr_hwmode = libconf.phymode; + rt2x00dev->rx_status.phymode = conf->phymode; + } + rt2x00dev->rx_status.freq = conf->freq; rt2x00dev->rx_status.channel = conf->channel; rt2x00dev->tx_power = conf->power_level; - rt2x00dev->link.ant.active.rx = libconf.ant.rx; - rt2x00dev->link.ant.active.tx = libconf.ant.tx; + +if (flags &CONFIG_UPDATE_ANTENNA ) { + rt2x00dev->link.ant.active.rx = libconf.ant.rx; + rt2x00dev->link.ant.active.tx = libconf.ant.tx; + } }
Signature · 1 line
1.5.3.4
PATCH 10/11] rt2x00: Add new rt73usb USB ID
In reply to a message not in the archive--- drivers/net/wireless/rt2x00/rt73usb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt73usb.c +1 -0
@@ -2035,6 +2035,7 @@ static struct usb_device_id rt73usb_device_table[] = { { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, + { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) },/* Billionton */ { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) },/* Buffalo */
Signature · 1 line
1.5.3.4
PATCH 11/11 rt2x00: Release rt2x00 2.0.11
In reply to a message not in the archiveVersion bump.
--- drivers/net/wireless/rt2x00/rt2x00.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -42,7 +42,7 @@* Module information. * DRV_NAME should be set within the individual module source files. */ -#define DRV_VERSION "2.0.10" +#define DRV_VERSION "2.0.11"#define DRV_PROJECT "http://rt2x00.serialmonkey.com"/*
Signature · 1 line
1.5.3.4
Johannes Berg
maintainerRe: [PATCH 08/11] rt2x00: Fix residual check in PLCP calculations.
In reply to Ivo van DoornQuoted 4 lines · Ivo van Doorn
Because rt2x00 implements the residual calculation different from what the legacy code does (i.e. scaled values), we need to adjust the residual check. Again, we are only mimicking the behaviour of the ralink driver without actually knowing what we do :-(
I think you're looking for IEEE 802.11 clause 18.2.3.5
johannes