rt2x00: Limit rt2x00pci rxdone processing to 16 entries at once
PATCH 1/13 rt2x00: Limit rt2x00pci rxdone processing to 16 entries at once
From: Helmut Schaa <[email protected]>
Instead of receiving an unlimited number of frames, stop after 16 entries and reschedule the rxdone tasklet. This allows other tasklets to be run inbetween.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 6 ++++-- drivers/net/wireless/rt2x00/rt2500pci.c | 6 ++++-- drivers/net/wireless/rt2x00/rt2800pci.c | 6 ++++-- drivers/net/wireless/rt2x00/rt2x00pci.c | 7 +++++-- drivers/net/wireless/rt2x00/rt2x00pci.h | 5 ++++- drivers/net/wireless/rt2x00/rt61pci.c | 6 ++++-- 6 files changed, 25 insertions(+), 11 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +4 -2
@@ -1368,8 +1368,10 @@ static void rt2400pci_tbtt_tasklet(unsigned long data)static void rt2400pci_rxdone_tasklet (unsigned long data) {struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -rt2x00pci_rxdone (rt2x00dev); -rt2400pci_enable_interrupt (rt2x00dev,CSR8_RXDONE ); +if (rt2x00pci_rxdone (rt2x00dev)) +tasklet_schedule (&rt2x00dev->rxdone_tasklet); +else +rt2400pci_enable_interrupt (rt2x00dev,CSR8_RXDONE ); }static irqreturn_t rt2400pci_interrupt (int irq,void *dev_instance)
drivers/net/wireless/rt2x00/rt2500pci.c +4 -2
@@ -1500,8 +1500,10 @@ static void rt2500pci_tbtt_tasklet(unsigned long data)static void rt2500pci_rxdone_tasklet (unsigned long data) {struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -rt2x00pci_rxdone (rt2x00dev); -rt2500pci_enable_interrupt (rt2x00dev,CSR8_RXDONE ); +if (rt2x00pci_rxdone (rt2x00dev)) +tasklet_schedule (&rt2x00dev->rxdone_tasklet); +else +rt2500pci_enable_interrupt (rt2x00dev,CSR8_RXDONE ); }static irqreturn_t rt2500pci_interrupt (int irq,void *dev_instance)
drivers/net/wireless/rt2x00/rt2800pci.c +4 -2
@@ -806,8 +806,10 @@ static void rt2800pci_tbtt_tasklet(unsigned long data)static void rt2800pci_rxdone_tasklet (unsigned long data) {struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -rt2x00pci_rxdone (rt2x00dev); -rt2800pci_enable_interrupt (rt2x00dev,INT_MASK_CSR_RX_DONE ); +if (rt2x00pci_rxdone (rt2x00dev)) +tasklet_schedule (&rt2x00dev->rxdone_tasklet); +else +rt2800pci_enable_interrupt (rt2x00dev,INT_MASK_CSR_RX_DONE ); }static void rt2800pci_autowake_tasklet (unsigned long data)
drivers/net/wireless/rt2x00/rt2x00pci.c +5 -2
@@ -60,14 +60,15 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev, }EXPORT_SYMBOL_GPL (rt2x00pci_regbusy_read); -void rt2x00pci_rxdone (struct rt2x00_dev *rt2x00dev) +bool rt2x00pci_rxdone (struct rt2x00_dev *rt2x00dev) {struct data_queue *queue = rt2x00dev->rx;struct queue_entry *entry;struct queue_entry_priv_pci *entry_priv;struct skb_frame_desc *skbdesc; +int max_rx =16 ; -while (1 ) { +while (--max_rx) { entry =rt2x00queue_get_entry (queue,Q_INDEX ); entry_priv = entry->priv_data;
@@ -93,6 +94,8 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)*/ rt2x00lib_rxdone (entry); } + +return !max_rx; }EXPORT_SYMBOL_GPL (rt2x00pci_rxdone);
drivers/net/wireless/rt2x00/rt2x00pci.h +4 -1
@@ -101,8 +101,11 @@ struct queue_entry_priv_pci {/** * rt2x00pci_rxdone - Handle RX done events * @rt2x00dev: Device pointer, see &struct rt2x00_dev. +* +* Returns true if there are still rx frames pending and false if all +* pending rx frames were processed. */ -void rt2x00pci_rxdone (struct rt2x00_dev *rt2x00dev); +bool rt2x00pci_rxdone (struct rt2x00_dev *rt2x00dev);/* * Device initialization handlers.
drivers/net/wireless/rt2x00/rt61pci.c +4 -2
@@ -2313,8 +2313,10 @@ static void rt61pci_tbtt_tasklet(unsigned long data)static void rt61pci_rxdone_tasklet (unsigned long data) {struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; -rt2x00pci_rxdone (rt2x00dev); -rt61pci_enable_interrupt (rt2x00dev,INT_MASK_CSR_RXDONE ); +if (rt2x00pci_rxdone (rt2x00dev)) +rt2x00pci_rxdone (rt2x00dev); +else +rt61pci_enable_interrupt (rt2x00dev,INT_MASK_CSR_RXDONE ); }static void rt61pci_autowake_tasklet (unsigned long data)
Signature · 1 line
1.7.2.3
PATCH 2/13 rt2x00: Limit rt2800pci txdone processing to 16 entries at once
From: Helmut Schaa <[email protected]>
Instead of reporting an unlimited number of tx status reports to mac80211 stop after 16 frames and reschedule the tx status tasklet. This allows other tasklets to be run inbetween.
--- drivers/net/wireless/rt2x00/rt2800pci.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2800pci.c +10 -2
@@ -717,12 +717,13 @@ static void rt2800pci_wakeup(struct rt2x00_dev *rt2x00dev)rt2800_config (rt2x00dev, &libconf,IEEE80211_CONF_CHANGE_PS ); } -static void rt2800pci_txdone (struct rt2x00_dev *rt2x00dev) +static bool rt2800pci_txdone (struct rt2x00_dev *rt2x00dev) {struct data_queue *queue;struct queue_entry *entry;u32 status;u8 qid; +int max_tx_done =16 ;while (kfifo_get (&rt2x00dev->txstatus_fifo, &status)) { qid =rt2x00_get_field32 (status,TX_STA_FIFO_PID_QUEUE );
@@ -759,7 +760,12 @@ static void rt2800pci_txdone(struct rt2x00_dev *rt2x00dev) entry =rt2x00queue_get_entry (queue,Q_INDEX_DONE );rt2800_txdone_entry (entry, status); + +if (--max_tx_done ==0 ) +break ; } + +return !max_tx_done; } static void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,
@@ -780,7 +786,9 @@ static void rt2800pci_enable_interrupt(struct rt2x00_dev *rt2x00dev,static void rt2800pci_txstatus_tasklet (unsigned long data) { -rt2800pci_txdone ((struct rt2x00_dev *)data); +struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +if (rt2800pci_txdone (rt2x00dev)) +tasklet_schedule (&rt2x00dev->txstatus_tasklet);/* * No need to enable the tx status interrupt here as we always
Signature · 1 line
1.7.2.3
PATCH 3/13 rt2x00: Calculate tx status fifo size instead of hardcoding it
From: Helmut Schaa <[email protected]>
Instead of hardcoding the tx status fifo size as 512 calculate it based on the number of tx queues and the number of entries per queue. Also round the size up to a power of 2 as kfifo would otherwise round it down.
On rt2800pci this will increase the kfifo size from 512 bytes to 1024 bytes which is then able to hold the tx status for all entries in all tx queues.
Furthermore, if the number of tx queues or tx entries changes in the future (use of the MGMT queue for example) the kfifo size doesn't need to be updated.
--- drivers/net/wireless/rt2x00/rt2x00dev.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +12 -6
@@ -27,6 +27,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/log2.h> #include "rt2x00.h" #include "rt2x00lib.h"
@@ -811,13 +812,18 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)*/ if (test_bit (DRIVER_REQUIRE_TXSTATUS_FIFO , &rt2x00dev->flags)) {/* -* Allocate txstatus fifo and tasklet, we use a size of 512 -* for the kfifo which is big enough to store 512/4=128 tx -* status reports. In the worst case (tx status for all tx -* queues gets reported before we've got a chance to handle -* them) 24*4=384 tx status reports need to be cached. +* Allocate the txstatus fifo. In the worst case the tx +* status fifo has to hold the tx status of all entries +* in all tx queues. Hence, calculate the kfifo size as +* tx_queues * entry_num and round up to the nearest +* power of 2. */ - status =kfifo_alloc (&rt2x00dev->txstatus_fifo,512 , +int kfifo_size = +roundup_pow_of_two (rt2x00dev->ops->tx_queues * + rt2x00dev->ops->tx->entry_num * +sizeof (u32)); + + status =kfifo_alloc (&rt2x00dev->txstatus_fifo, kfifo_size,GFP_KERNEL );if (status)return status;
Signature · 1 line
1.7.2.3
PATCH 4/13 rt2x00: Remove DRIVER_SUPPORT_WATCHDOG flag
From: Helmut Schaa <[email protected]>
We can simply check if the driver registered the watchdog callback. There's no need to have an additional flag for that.
--- drivers/net/wireless/rt2x00/rt2500usb.c | 1 - drivers/net/wireless/rt2x00/rt2800usb.c | 1 - drivers/net/wireless/rt2x00/rt2x00.h | 1 - drivers/net/wireless/rt2x00/rt2x00link.c | 11 +++++------ drivers/net/wireless/rt2x00/rt73usb.c | 1 - 5 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2500usb.c +0 -1
@@ -1796,7 +1796,6 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)__set_bit (CONFIG_SUPPORT_HW_CRYPTO , &rt2x00dev->flags);__set_bit (DRIVER_REQUIRE_COPY_IV , &rt2x00dev->flags); } -__set_bit (DRIVER_SUPPORT_WATCHDOG , &rt2x00dev->flags);__set_bit (DRIVER_REQUIRE_SW_SEQNO , &rt2x00dev->flags);/*
drivers/net/wireless/rt2x00/rt2800usb.c +0 -1
@@ -564,7 +564,6 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)if (!modparam_nohwcrypt)__set_bit (CONFIG_SUPPORT_HW_CRYPTO , &rt2x00dev->flags);__set_bit (DRIVER_SUPPORT_LINK_TUNING , &rt2x00dev->flags); -__set_bit (DRIVER_SUPPORT_WATCHDOG , &rt2x00dev->flags);__set_bit (DRIVER_REQUIRE_HT_TX_DESC , &rt2x00dev->flags);/*
drivers/net/wireless/rt2x00/rt2x00.h +0 -1
@@ -674,7 +674,6 @@ enum rt2x00_flags {DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL ,DRIVER_SUPPORT_PRE_TBTT_INTERRUPT , DRIVER_SUPPORT_LINK_TUNING, - DRIVER_SUPPORT_WATCHDOG,/* * Driver configuration
drivers/net/wireless/rt2x00/rt2x00link.c +5 -6
@@ -413,12 +413,11 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev) {struct link *link = &rt2x00dev->link; -if (!test_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags) || - !test_bit (DRIVER_SUPPORT_WATCHDOG , &rt2x00dev->flags)) -return ; - -ieee80211_queue_delayed_work (rt2x00dev->hw, - &link->watchdog_work,WATCHDOG_INTERVAL ); +if (test_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags) && + rt2x00dev->ops->lib->watchdog) +ieee80211_queue_delayed_work (rt2x00dev->hw, + &link->watchdog_work, +WATCHDOG_INTERVAL ); }void rt2x00link_stop_watchdog (struct rt2x00_dev *rt2x00dev)
drivers/net/wireless/rt2x00/rt73usb.c +0 -1
@@ -2209,7 +2209,6 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev)if (!modparam_nohwcrypt)__set_bit (CONFIG_SUPPORT_HW_CRYPTO , &rt2x00dev->flags);__set_bit (DRIVER_SUPPORT_LINK_TUNING , &rt2x00dev->flags); -__set_bit (DRIVER_SUPPORT_WATCHDOG , &rt2x00dev->flags);/* * Set the rssi offset.
Signature · 1 line
1.7.2.3
PATCH 5/13 rt2x00: Restructure bw_comp calculationATCHDOG flag
From: Helmut Schaa <[email protected]>
Move the HT40 check inside the calculation function to make it easier for a later cleanup.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +8 -5
@@ -1819,11 +1819,15 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,u16 eeprom;u8 comp_en;u8 comp_type; -int comp_value; +int comp_value =0 ;rt2x00_eeprom_read (rt2x00dev,EEPROM_TXPOWER_DELTA , &eeprom); -if (eeprom ==0xffff ) +/* +* HT40 compensation not required. +*/ +if (eeprom ==0xffff || + !test_bit (CONFIG_CHANNEL_HT40 , &rt2x00dev->flags))return 0 ;if (band ==IEEE80211_BAND_2GHZ ) {
@@ -1865,13 +1869,12 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev,u8 eirp_txpower;u8 eirp_txpower_criterion;u8 reg_limit; -int bw_comp =0 ; +int bw_comp;if (!((band ==IEEE80211_BAND_5GHZ ) && is_rate_b))return txpower; -if (test_bit (CONFIG_CHANNEL_HT40 , &rt2x00dev->flags)) - bw_comp =rt2800_get_txpower_bw_comp (rt2x00dev, band); + bw_comp =rt2800_get_txpower_bw_comp (rt2x00dev, band);if (test_bit (CONFIG_SUPPORT_POWER_LIMIT , &rt2x00dev->flags)) {/*
Signature · 1 line
1.7.2.3
PATCH 6/13 rt2x00: Don't recalculate HT40 compensation for each rate
From: Helmut Schaa <[email protected]>
Previously the HT40 tx power compensation value was calculated for each rate. However, the calculation is independent of the tx rate and as such can be precalculated and just passed in for each rate.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 32 +++++++++++++++++------------- 1 files changed, 18 insertions(+), 14 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +18 -14
@@ -1861,7 +1861,8 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev,int is_rate_b, enum ieee80211_band band, int power_level, - u8 txpower) + u8 txpower, + int delta) { u32 reg;u16 eeprom;
@@ -1869,13 +1870,10 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev,u8 eirp_txpower;u8 eirp_txpower_criterion;u8 reg_limit; -int bw_comp;if (!((band ==IEEE80211_BAND_5GHZ ) && is_rate_b))return txpower; - bw_comp =rt2800_get_txpower_bw_comp (rt2x00dev, band); -if (test_bit (CONFIG_SUPPORT_POWER_LIMIT , &rt2x00dev->flags)) {/* * Check if eirp txpower exceed txpower_limit.
@@ -1898,14 +1896,14 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev, EEPROM_EIRP_MAX_TX_POWER_5GHZ); eirp_txpower = eirp_txpower_criterion + (txpower - criterion) + - (is_rate_b ?4 :0 ) + bw_comp; + (is_rate_b ?4 :0 ) + delta; reg_limit = (eirp_txpower > power_level) ? (eirp_txpower - power_level) :0 ; }else reg_limit =0 ; -return txpower + bw_comp - reg_limit; +return txpower + delta - reg_limit; } static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
@@ -1919,6 +1917,12 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,u32 offset;enum ieee80211_band band = conf->channel->band;int power_level = conf->power_level; +int delta; + +/* +* Calculate HT40 compensation delta +*/ + delta =rt2800_get_txpower_bw_comp (rt2x00dev, band);/* * set to normal bbp tx power control mode: +/- 0dBm
@@ -1948,7 +1952,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE0 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE0 , txpower);/*
@@ -1959,7 +1963,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE1 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE1 , txpower);/*
@@ -1970,7 +1974,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE2 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE2 , txpower);/*
@@ -1981,7 +1985,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE3 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE3 , txpower);/* read the next four txpower values */
@@ -1997,7 +2001,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE0 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE4 , txpower);/*
@@ -2008,7 +2012,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE1 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE5 , txpower);/*
@@ -2019,7 +2023,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE2 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE6 , txpower);/*
@@ -2030,7 +2034,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE3 ); txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, - power_level, txpower); + power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE7 , txpower);rt2800_register_write (rt2x00dev, offset, reg);
Signature · 1 line
1.7.2.3
PATCH 7/13 rt2x00: Indention cleanup in rt2800lib
From: Helmut Schaa <[email protected]>
Fix the indention in rt2800_compesate_txpower and also fix a typo in the function name rt2800_compesate_txpower -> rt2800_compensate_txpower.
--- drivers/net/wireless/rt2x00/rt2800lib.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +11 -14
@@ -1857,12 +1857,9 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,return comp_value; } -static u8 rt2800_compesate_txpower (struct rt2x00_dev *rt2x00dev, -int is_rate_b, -enum ieee80211_band band, -int power_level, -u8 txpower, -int delta) +static u8 rt2800_compensate_txpower (struct rt2x00_dev *rt2x00dev,int is_rate_b, +enum ieee80211_band band,int power_level, +u8 txpower,int delta) {u32 reg;u16 eeprom;
@@ -1951,7 +1948,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE0 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE0 , txpower);
@@ -1962,7 +1959,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE1 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE1 , txpower);
@@ -1973,7 +1970,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE2 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE2 , txpower);
@@ -1984,7 +1981,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE3 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE3 , txpower);
@@ -2000,7 +1997,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE0 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE4 , txpower);
@@ -2011,7 +2008,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE1 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE5 , txpower);
@@ -2022,7 +2019,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE2 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE6 , txpower);
@@ -2033,7 +2030,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,*/ txpower =rt2x00_get_field16 (eeprom,EEPROM_TXPOWER_BYRATE_RATE3 ); - txpower =rt2800_compesate_txpower (rt2x00dev, is_rate_b, band, + txpower =rt2800_compensate_txpower (rt2x00dev, is_rate_b, band, power_level, txpower, delta);rt2x00_set_field32 (®,TX_PWR_CFG_RATE7 , txpower);
Signature · 1 line
1.7.2.3
PATCH 8/13 rt2x00: Remove obsolete rt2x00queue_align_payload
From: Helmut Schaa <[email protected]>
Since commit d1c3a37ceeb1a5ea02991a0476355f1a1d3b3e83 ("mac80211:
clarify alignment docs, fix up alignment") removed the requirement for a 4-byte aligned payload rt2x00queue_align_payload is obsolete as mac80211 will align the payload when it passes the frame to the net stack.
As a result we can remove the call to rt2x00queue_align_payload in the rx path and since that's the last user we can remove rt2x00queue_align_payload altogether.
One advantage is that we save some alignment operations for frames that don't need to be aligned (for example beause they are not passed to the net stack).
--- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 -- drivers/net/wireless/rt2x00/rt2x00lib.h | 10 ---------- drivers/net/wireless/rt2x00/rt2x00queue.c | 13 ------------- 3 files changed, 0 insertions(+), 25 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +0 -2
@@ -512,8 +512,6 @@ void rt2x00lib_rxdone(struct queue_entry *entry) (rxdesc.size > header_length) && (rxdesc.dev_flags & RXDONE_L2PAD))rt2x00queue_remove_l2pad (entry->skb, header_length); - else - rt2x00queue_align_payload(entry->skb, header_length);/* Trim buffer to correct size */ skb_trim (entry->skb, rxdesc.size);
drivers/net/wireless/rt2x00/rt2x00lib.h +0 -10
@@ -119,16 +119,6 @@ void rt2x00queue_free_skb(struct queue_entry *entry);void rt2x00queue_align_frame (struct sk_buff *skb);/** -* rt2x00queue_align_payload - Align 802.11 payload to 4-byte boundary -* @skb: The skb to align -* @header_length: Length of 802.11 header -* -* Align the 802.11 payload to a 4-byte boundary, this could -* mean the header is not aligned properly though. -*/ -void rt2x00queue_align_payload (struct sk_buff *skb,unsigned int header_length); - -/** * rt2x00queue_insert_l2pad - Align 802.11 header & payload to 4-byte boundary * @skb: The skb to align * @header_length: Length of 802.11 header
drivers/net/wireless/rt2x00/rt2x00queue.c +0 -13
@@ -148,19 +148,6 @@ void rt2x00queue_align_frame(struct sk_buff *skb)skb_trim (skb, frame_length); } -void rt2x00queue_align_payload (struct sk_buff *skb,unsigned int header_length) -{ -unsigned int frame_length = skb->len; -unsigned int align =ALIGN_SIZE (skb, header_length); - -if (!align) -return ; - -skb_push (skb, align); -memmove (skb->data, skb->data + align, frame_length); -skb_trim (skb, frame_length); -} -void rt2x00queue_insert_l2pad (struct sk_buff *skb,unsigned int header_length) {unsigned int payload_length = skb->len - header_length;
Signature · 1 line
1.7.2.3
PATCH 9/13 rt2x00: Implement tx power temperature compensation
From: Helmut Schaa <[email protected]>
rt2800 devices should adjust their tx power in accordance with the eeproms temperature calibration values. Add a new driver callback gain_calibration that is called every 4 seconds.
The rt2800 gain calibration routine simply runs the tx power configuration that takes care of calculating the temperature compensation delta.
We don't need to synchronize the calls to rt2800_config_txpower as they should all happen from mac80211's single threaded workqueue.
--- drivers/net/wireless/rt2x00/rt2800.h | 106 ++++++++++++++++++++++++ drivers/net/wireless/rt2x00/rt2800lib.c | 133 ++++++++++++++++++++++++++++- drivers/net/wireless/rt2x00/rt2800lib.h | 1 + drivers/net/wireless/rt2x00/rt2800pci.c | 1 + drivers/net/wireless/rt2x00/rt2800usb.c | 1 + drivers/net/wireless/rt2x00/rt2x00.h | 6 ++ drivers/net/wireless/rt2x00/rt2x00dev.c | 2 + drivers/net/wireless/rt2x00/rt2x00lib.h | 13 +++ drivers/net/wireless/rt2x00/rt2x00link.c | 38 +++++++++ 9 files changed, 296 insertions(+), 5 deletions(-)
drivers/net/wireless/rt2x00/rt2800.h +106 -0
@@ -2104,6 +2104,59 @@ struct mac_iveiv_entry {#define EEPROM_TXPOWER_BG_2 FIELD16(0xff00)/* +* EEPROM temperature compensation boundaries 802.11BG +* MINUS4: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -4) +* MINUS3: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -3) +*/ +#define EEPROM_TSSI_BOUND_BG1 0x0037 +#define EEPROM_TSSI_BOUND_BG1_MINUS4 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_BG1_MINUS3 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11BG +* MINUS2: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -2) +* MINUS1: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -1) +*/ +#define EEPROM_TSSI_BOUND_BG2 0x0038 +#define EEPROM_TSSI_BOUND_BG2_MINUS2 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_BG2_MINUS1 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11BG +* REF: Reference TSSI value, no tx power changes needed +* PLUS1: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 1) +*/ +#define EEPROM_TSSI_BOUND_BG3 0x0039 +#define EEPROM_TSSI_BOUND_BG3_REF FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_BG3_PLUS1 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11BG +* PLUS2: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 2) +* PLUS3: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 3) +*/ +#define EEPROM_TSSI_BOUND_BG4 0x003a +#define EEPROM_TSSI_BOUND_BG4_PLUS2 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_BG4_PLUS3 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11BG +* PLUS4: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 4) +* AGC_STEP: Temperature compensation step. +*/ +#define EEPROM_TSSI_BOUND_BG5 0x003b +#define EEPROM_TSSI_BOUND_BG5_PLUS4 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_BG5_AGC_STEP FIELD16(0xff00) + +/* * EEPROM TXPOWER 802.11A */ #define EEPROM_TXPOWER_A1 0x003c
@@ -2113,6 +2166,59 @@ struct mac_iveiv_entry {#define EEPROM_TXPOWER_A_2 FIELD16(0xff00)/* +* EEPROM temperature compensation boundaries 802.11A +* MINUS4: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -4) +* MINUS3: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -3) +*/ +#define EEPROM_TSSI_BOUND_A1 0x006a +#define EEPROM_TSSI_BOUND_A1_MINUS4 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_A1_MINUS3 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11A +* MINUS2: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -2) +* MINUS1: If the actual TSSI is below this boundary, tx power needs to be +* reduced by (agc_step * -1) +*/ +#define EEPROM_TSSI_BOUND_A2 0x006b +#define EEPROM_TSSI_BOUND_A2_MINUS2 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_A2_MINUS1 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11A +* REF: Reference TSSI value, no tx power changes needed +* PLUS1: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 1) +*/ +#define EEPROM_TSSI_BOUND_A3 0x006c +#define EEPROM_TSSI_BOUND_A3_REF FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_A3_PLUS1 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11A +* PLUS2: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 2) +* PLUS3: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 3) +*/ +#define EEPROM_TSSI_BOUND_A4 0x006d +#define EEPROM_TSSI_BOUND_A4_PLUS2 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_A4_PLUS3 FIELD16(0xff00) + +/* +* EEPROM temperature compensation boundaries 802.11A +* PLUS4: If the actual TSSI is above this boundary, tx power needs to be +* increased by (agc_step * 4) +* AGC_STEP: Temperature compensation step. +*/ +#define EEPROM_TSSI_BOUND_A5 0x006e +#define EEPROM_TSSI_BOUND_A5_PLUS4 FIELD16(0x00ff) +#define EEPROM_TSSI_BOUND_A5_AGC_STEP FIELD16(0xff00) + +/* * EEPROM TXPOWER by rate: tx power per tx rate for HT20 mode */ #define EEPROM_TXPOWER_BYRATE 0x006f
drivers/net/wireless/rt2x00/rt2800lib.c +128 -5
171 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2800lib.h +1 -0
@@ -181,6 +181,7 @@ void rt2800_link_stats(struct rt2x00_dev *rt2x00dev, struct link_qual *qual);void rt2800_reset_tuner (struct rt2x00_dev *rt2x00dev,struct link_qual *qual);void rt2800_link_tuner (struct rt2x00_dev *rt2x00dev,struct link_qual *qual,const u32 count); +void rt2800_gain_calibration (struct rt2x00_dev *rt2x00dev);int rt2800_enable_radio (struct rt2x00_dev *rt2x00dev);void rt2800_disable_radio (struct rt2x00_dev *rt2x00dev);
drivers/net/wireless/rt2x00/rt2800pci.c +1 -0
@@ -1053,6 +1053,7 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { .link_stats = rt2800_link_stats, .reset_tuner = rt2800_reset_tuner, .link_tuner = rt2800_link_tuner, + .gain_calibration = rt2800_gain_calibration, .start_queue = rt2800pci_start_queue, .kick_queue = rt2800pci_kick_queue, .stop_queue = rt2800pci_stop_queue,
drivers/net/wireless/rt2x00/rt2800usb.c +1 -0
@@ -629,6 +629,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { .link_stats = rt2800_link_stats, .reset_tuner = rt2800_reset_tuner, .link_tuner = rt2800_link_tuner, + .gain_calibration = rt2800_gain_calibration, .watchdog = rt2800usb_watchdog, .start_queue = rt2800usb_start_queue, .kick_queue = rt2x00usb_kick_queue,
drivers/net/wireless/rt2x00/rt2x00.h +6 -0
@@ -348,6 +348,11 @@ struct link {* to bring the device/driver back into the desired state. */ struct delayed_work watchdog_work; + +/* +* Work structure for scheduling periodic AGC adjustments. +*/ +struct delayed_work agc_work; };enum rt2x00_delayed_flags {
@@ -556,6 +561,7 @@ struct rt2x00lib_ops { struct link_qual *qual);void (*link_tuner) (struct rt2x00_dev *rt2x00dev,struct link_qual *qual,const u32 count); +void (*gain_calibration) (struct rt2x00_dev *rt2x00dev);/* * Data queue handlers.
drivers/net/wireless/rt2x00/rt2x00dev.c +2 -0
@@ -71,6 +71,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev)*/ rt2x00queue_start_queues (rt2x00dev);rt2x00link_start_tuner (rt2x00dev); +rt2x00link_start_agc (rt2x00dev);/* * Start watchdog monitoring.
@@ -93,6 +94,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)/* * Stop all queues */ +rt2x00link_stop_agc (rt2x00dev);rt2x00link_stop_tuner (rt2x00dev);rt2x00queue_stop_queues (rt2x00dev);rt2x00queue_flush_queues (rt2x00dev, true);
drivers/net/wireless/rt2x00/rt2x00lib.h +13 -0
@@ -32,6 +32,7 @@*/ #define WATCHDOG_INTERVAL round_jiffies_relative(HZ)#define LINK_TUNE_INTERVAL round_jiffies_relative(HZ) +#define AGC_INTERVAL round_jiffies_relative(4 * HZ)/* * rt2x00_rate: Per rate device information
@@ -271,6 +272,18 @@ void rt2x00link_start_watchdog(struct rt2x00_dev *rt2x00dev);void rt2x00link_stop_watchdog (struct rt2x00_dev *rt2x00dev);/** +* rt2x00link_start_agc - Start periodic gain calibration +* @rt2x00dev: Pointer to &struct rt2x00_dev. +*/ +void rt2x00link_start_agc (struct rt2x00_dev *rt2x00dev); + +/** +* rt2x00link_stop_agc - Stop periodic gain calibration +* @rt2x00dev: Pointer to &struct rt2x00_dev. +*/ +void rt2x00link_stop_agc (struct rt2x00_dev *rt2x00dev); + +/** * rt2x00link_register - Initialize link tuning & watchdog functionality * @rt2x00dev: Pointer to &struct rt2x00_dev. *
drivers/net/wireless/rt2x00/rt2x00link.c +38 -0
@@ -446,8 +446,46 @@ static void rt2x00link_watchdog(struct work_struct *work) WATCHDOG_INTERVAL); } +void rt2x00link_start_agc (struct rt2x00_dev *rt2x00dev) +{ +struct link *link = &rt2x00dev->link; + +if (test_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags) && + rt2x00dev->ops->lib->gain_calibration) +ieee80211_queue_delayed_work (rt2x00dev->hw, + &link->agc_work, +AGC_INTERVAL ); +} + +void rt2x00link_stop_agc (struct rt2x00_dev *rt2x00dev) +{ +cancel_delayed_work_sync (&rt2x00dev->link.agc_work); +} + +static void rt2x00link_agc (struct work_struct *work) +{ +struct rt2x00_dev *rt2x00dev = + container_of(work, struct rt2x00_dev, link.agc_work.work); +struct link *link = &rt2x00dev->link; + +/* +* When the radio is shutting down we should +* immediately cease the watchdog monitoring. +*/ +if (!test_bit (DEVICE_STATE_ENABLED_RADIO , &rt2x00dev->flags)) +return ; + + rt2x00dev->ops->lib->gain_calibration (rt2x00dev); + +if (test_bit (DEVICE_STATE_PRESENT , &rt2x00dev->flags)) +ieee80211_queue_delayed_work (rt2x00dev->hw, + &link->agc_work, +AGC_INTERVAL ); +} +void rt2x00link_register (struct rt2x00_dev *rt2x00dev) { +INIT_DELAYED_WORK (&rt2x00dev->link.agc_work, rt2x00link_agc);INIT_DELAYED_WORK (&rt2x00dev->link.watchdog_work, rt2x00link_watchdog);INIT_DELAYED_WORK (&rt2x00dev->link.work, rt2x00link_tuner); }
Signature · 1 line
1.7.2.3
PATCH 10/13 rt2x00: Fix STBC transmissions to STAs with Rx STBC > 1
From: Helmut Schaa <[email protected]>
For STBC transmissions rt2x00 used the number of RxSTBC streams the destination STA indicates in its HT capabilities as STBC value in the TXWI.
However, the legacy drivers and our own comment in rt2800.h suggest that the STBC field in the TXWI only allows a value of 0 or 1. The values 2 and 3 are reserved (probably for future devices).
And indeed, STBC transmissions to STAs indicating more then 1 RxSTBC stream fail when the STBC field is set to something >1.
Fix this by only setting the STBC field to 1 when STBC should be used.
--- drivers/net/wireless/rt2x00/rt2x00ht.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00/rt2x00ht.c +5 -2
@@ -43,8 +43,11 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry, txdesc->u.ht.ba_size =7 ;/* FIXME: What value is needed? */ - txdesc->u.ht.stbc = - (tx_info->flags &IEEE80211_TX_CTL_STBC ) >>IEEE80211_TX_CTL_STBC_SHIFT ; +/* +* Only one STBC stream is supported for now. +*/ +if (tx_info->flags &IEEE80211_TX_CTL_STBC ) + txdesc->u.ht.stbc =1 ;/* * If IEEE80211_TX_RC_MCS is set txrate->idx just contains the
Signature · 1 line
1.7.2.3
PATCH 11/13 rt2x00: Add support for the ZyXEL NWD-211AN USB
From: Ivo van Doorn <[email protected]>
Add new USB ID
--- drivers/net/wireless/rt2x00/rt2800usb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt2800usb.c +1 -0
@@ -876,6 +876,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x5a57, 0x5257), USB_DEVICE_DATA(&rt2800usb_ops) },/* Zyxel */ { USB_DEVICE(0x0586, 0x3416), USB_DEVICE_DATA(&rt2800usb_ops) }, + { USB_DEVICE(0x0586, 0x3418), USB_DEVICE_DATA(&rt2800usb_ops) }, #ifdef CONFIG_RT2800USB_RT33XX /* Ralink */ { USB_DEVICE(0x148f, 0x3370), USB_DEVICE_DATA(&rt2800usb_ops) },
Signature · 1 line
1.7.2.3
PATCH 12/13 rt2x00: Fix tx aggregation problems with some clients
From: Helmut Schaa <[email protected]>
Some clients seem to rely upon the reception of BlockAckReqs to flush their rx reorder buffer. In order to fix aggregation for these clients rt2x00 should send a BlockAckReq if the transmission of an AMPDU subframe fails.
Introduce a new flag TXDONE_AMPDU to indicate that this is an AMPDU subframe and pass IEEE80211_TX_STAT_AMPDU_NO_BACK to mac80211 if an AMPDU subframe failed during transmission.
This fixes aggregation problems with Intel 5100 Windows STAs (and maybe others as well).
--- drivers/net/wireless/rt2x00/rt2800lib.c | 3 +++ drivers/net/wireless/rt2x00/rt2x00dev.c | 6 +++++- drivers/net/wireless/rt2x00/rt2x00queue.h | 1 + 3 files changed, 9 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +3 -0
@@ -687,6 +687,9 @@ void rt2800_txdone_entry(struct queue_entry *entry, u32 status) mcs = real_mcs; } +if (aggr ==1 || ampdu ==1 ) +__set_bit (TXDONE_AMPDU , &txdesc.flags); +/* * Ralink has a retry mechanism using a global fallback * table. We setup this fallback table to try the immediate
drivers/net/wireless/rt2x00/rt2x00dev.c +5 -1
@@ -353,10 +353,14 @@ void rt2x00lib_txdone(struct queue_entry *entry,* which would allow the rc algorithm to better decide on * which rates are suitable. */ -if (tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { +if (test_bit (TXDONE_AMPDU , &txdesc->flags) || + tx_info->flags &IEEE80211_TX_CTL_AMPDU ) { tx_info->flags |=IEEE80211_TX_STAT_AMPDU ; tx_info->status.ampdu_len =1 ; tx_info->status.ampdu_ack_len = success ?1 :0 ; + +if (!success) + tx_info->flags |=IEEE80211_TX_STAT_AMPDU_NO_BACK ; }if (rate_flags &IEEE80211_TX_RC_USE_RTS_CTS ) {
drivers/net/wireless/rt2x00/rt2x00queue.h +1 -0
@@ -217,6 +217,7 @@ enum txdone_entry_desc_flags {TXDONE_FALLBACK ,TXDONE_FAILURE ,TXDONE_EXCESSIVE_RETRY , + TXDONE_AMPDU, };/**
Signature · 1 line
1.7.2.3
PATCH 13/13 rt2x00: Add an error message when trying to send on a full queue
From: Helmut Schaa <[email protected]>
We already tell mac80211 to stop the queue when we hit a certain threshold. Hence, it shouldn't happen at all that a frame gets queued for tx on a full queue. Add an error message for this case.
--- drivers/net/wireless/rt2x00/rt2x00queue.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.c +4 -1
@@ -482,8 +482,11 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,struct skb_frame_desc *skbdesc;u8 rate_idx, rate_flags; -if (unlikely (rt2x00queue_full (queue))) +if (unlikely (rt2x00queue_full (queue))) { +ERROR (queue->rt2x00dev, +"Dropping frame due to full tx queue %d.\n" , queue->qid);return -ENOBUFS ; + }if (unlikely (test_and_set_bit (ENTRY_OWNER_DEVICE_DATA , &entry->flags))) {
Signature · 1 line
1.7.2.3
Re: [PATCH 05/13] rt2x00: Restructure bw_comp calculationATCHDOG flag
In reply to Ivo van DoornIvo,
Subject seems to be incorrect.
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
PATCH v2 5/13 rt2x00: Restructure bw_comp calculation
In reply to Ivo van DoornFrom: Helmut Schaa <[email protected]>
Move the HT40 check inside the calculation function to make it easier for a later cleanup.
---
v2: Fix subject
--- drivers/net/wireless/rt2x00/rt2800lib.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/wireless/rt2x00/rt2800lib.c +8 -5
@@ -1819,11 +1819,15 @@ static int rt2800_get_txpower_bw_comp(struct rt2x00_dev *rt2x00dev,u16 eeprom;u8 comp_en;u8 comp_type; -int comp_value; +int comp_value =0 ;rt2x00_eeprom_read (rt2x00dev,EEPROM_TXPOWER_DELTA , &eeprom); -if (eeprom ==0xffff ) +/* +* HT40 compensation not required. +*/ +if (eeprom ==0xffff || + !test_bit (CONFIG_CHANNEL_HT40 , &rt2x00dev->flags))return 0 ;if (band ==IEEE80211_BAND_2GHZ ) {
@@ -1865,13 +1869,12 @@ static u8 rt2800_compesate_txpower(struct rt2x00_dev *rt2x00dev,u8 eirp_txpower;u8 eirp_txpower_criterion;u8 reg_limit; -int bw_comp =0 ; +int bw_comp;if (!((band ==IEEE80211_BAND_5GHZ ) && is_rate_b))return txpower; -if (test_bit (CONFIG_CHANNEL_HT40 , &rt2x00dev->flags)) - bw_comp =rt2800_get_txpower_bw_comp (rt2x00dev, band); + bw_comp =rt2800_get_txpower_bw_comp (rt2x00dev, band);if (test_bit (CONFIG_SUPPORT_POWER_LIMIT , &rt2x00dev->flags)) {/*
Signature · 1 line
1.7.2.3