iwlwifi driver 12/17 updates
cover iwlwifi driver 12/17 updates
Hi John,
These are mostly cleanup except for patch 7 is targeted to address a memory allocation problem in heavy rx.
[PATCH 1/8] iwlwifi: cleanup iwl-dev.h
[PATCH 2/8] iwlwifi: add line feed to printk
[PATCH 3/8] iwlwifi: update comments on the debug interface [PATCH 4/8] iwlwifi: use type uint for module param debug [PATCH 5/8] iwlwifi: remove useless goto
[PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit() [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory [PATCH 8/8] iwlwifi: indicate txpower is off in sysfs
Thanks,
-yi
PATCH 1/8 iwlwifi: cleanup iwl-dev.h
From: Winkler, Tomas <[email protected]>
The patch removes unused definition and moves code to proper places.
--- drivers/net/wireless/iwlwifi/iwl-3945.h | 6 ----- drivers/net/wireless/iwlwifi/iwl-calib.c | 9 ++++++++ drivers/net/wireless/iwlwifi/iwl-commands.h | 2 + drivers/net/wireless/iwlwifi/iwl-dev.h | 29 ++------------------------ 4 files changed, 14 insertions(+), 32 deletions(-)
drivers/net/wireless/iwlwifi/iwl-3945.h +0 -6
@@ -405,12 +405,6 @@ struct iwl3945_rx_queue {#define SCAN_INTERVAL 100 -#define MAX_A_CHANNELS 252 -#define MIN_A_CHANNELS 7 - -#define MAX_B_CHANNELS 14 -#define MIN_B_CHANNELS 1 -#define STATUS_HCMD_ACTIVE 0/* host command in progress */ #define STATUS_HCMD_SYNC_ACTIVE 1/* sync host command in progress */ #define STATUS_INT_ENABLED 2
drivers/net/wireless/iwlwifi/iwl-calib.c +9 -0
@@ -70,6 +70,15 @@* INIT calibrations framework *****************************************************************************/ +struct statistics_general_data { +u32 beacon_silence_rssi_a; +u32 beacon_silence_rssi_b; +u32 beacon_silence_rssi_c; +u32 beacon_energy_a; +u32 beacon_energy_b; +u32 beacon_energy_c; +}; +int iwl_send_calib_results (struct iwl_priv *priv) {int ret =0 ;
drivers/net/wireless/iwlwifi/iwl-commands.h +2 -0
@@ -2418,6 +2418,8 @@ struct statistics_rx_ht_phy {__le32 reserved2; } __attribute__ ((packed)); +#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) +struct statistics_rx_non_phy {__le32 bogus_cts;/* CTS received when not expecting CTS */ __le32 bogus_ack;/* ACK received when not expecting ACK */
drivers/net/wireless/iwlwifi/iwl-dev.h +3 -26
@@ -323,14 +323,6 @@ struct iwl_rx_queue {#define IWL_SUPPORTED_RATES_IE_LEN 8 -#define SCAN_INTERVAL 100 - -#define MAX_A_CHANNELS 252 -#define MIN_A_CHANNELS 7 - -#define MAX_B_CHANNELS 14 -#define MIN_B_CHANNELS 1 -#define MAX_TID_COUNT 9#define IWL_INVALID_RATE 0xFF
@@ -496,8 +488,6 @@ struct iwl_sensitivity_ranges { }; -#define IWL_FAT_CHANNEL_52 BIT(IEEE80211_BAND_5GHZ) -#define KELVIN_TO_CELSIUS (x) ((x)-273)#define CELSIUS_TO_KELVIN (x) ((x)+273)
@@ -546,9 +536,6 @@ struct iwl_hw_params {const struct iwl_sensitivity_ranges *sens; }; -#define HT_SHORT_GI_20MHZ (1 << 0) -#define HT_SHORT_GI_40MHZ (1 << 1) -/****************************************************************************** *
@@ -590,15 +577,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) } -struct iwl_priv ; - -struct iwl_dma_ptr {dma_addr_t dma;void *addr;size_t size; }; +#define HT_SHORT_GI_20MHZ (1 << 0) +#define HT_SHORT_GI_40MHZ (1 << 1) +#define IWL_CHANNEL_WIDTH_20MHZ 0#define IWL_CHANNEL_WIDTH_40MHZ 1
@@ -613,7 +600,6 @@ struct iwl_dma_ptr {#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000/* Sensitivity and chain noise calibration */ -#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1)#define INITIALIZATION_VALUE 0xFFFF#define CAL_NUM_OF_BEACONS 20#define MAXIMUM_ALLOWED_PATHLOSS 15
@@ -666,15 +652,6 @@ enum iwl4965_calib_enabled_state { IWL_CALIB_ENABLED = 1, }; -struct statistics_general_data { -u32 beacon_silence_rssi_a; -u32 beacon_silence_rssi_b; -u32 beacon_silence_rssi_c; -u32 beacon_energy_a; -u32 beacon_energy_b; -u32 beacon_energy_c; -}; -/* * enum iwl_calib
Signature · 1 line
1.5.3.6
PATCH 2/8 iwlwifi: add line feed to printk
From: Wu, Fengguang <[email protected]>
This adds line feed to printk.
--- drivers/net/wireless/iwlwifi/iwl-led.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-led.c +1 -1
@@ -292,7 +292,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)if (tpt > (blink_tbl[i].tpt *IWL_1MB_RATE ))break ; -IWL_DEBUG_LED ("LED BLINK IDX=%d" , i); +IWL_DEBUG_LED ("LED BLINK IDX=%d\n" , i);return i; }
Signature · 1 line
1.5.3.6
PATCH 3/8 iwlwifi: update comments on the debug interface
From: Wu, Fengguang <[email protected]>
Bring up-to-date some comments on the location of debug files.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl-debug.h | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -1
@@ -3354,7 +3354,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)/* * The following adds a new attribute to the sysfs representation -* of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/) +* of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) * used for controlling the debug level. * * See the level definitions in iwl for details.
drivers/net/wireless/iwlwifi/iwl-debug.h +7 -10
@@ -96,28 +96,25 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)#endif /* CONFIG_IWLWIFI_DEBUGFS */ /* -* To use the debug system; +* To use the debug system: * * If you are defining a new debug classification, simply add it to the #define -* list here in the form of: +* list here in the form of * * #define IWL_DL_xxxx VALUE * -* shifting value to the left one bit from the previous entry. xxxx should be -* the name of the classification (for example, WEP) +* where xxxx should be the name of the classification (for example, WEP). * * You then need to either add a IWL_xxxx_DEBUG() macro definition for your * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want * to send output to that classification. * -* To add your debug level to the list of levels seen when you perform +* The active debug levels can be accessed via files * -* % cat /sys/class/net/wlanX/device/debug_level +* /sys/module/iwlagn/parameters/debug{50} +* /sys/class/net/wlan0/device/debug_level * -* you simply need to add your entry to the iwl_debug_levels array. -* -* If you do not see debug_level in /sys/class/net/wlanX/device/debug_level -* then you do not have CONFIG_IWLWIFI_DEBUG defined in your kernel config file +* when CONFIG_IWLWIFI_DEBUG=y. */ #define IWL_DL_INFO (1 << 0)
Signature · 1 line
1.5.3.6
PATCH 4/8 iwlwifi: use type uint for module param debug
From: Wu, Fengguang <[email protected]>
This enables one to change the debug level at bit 31.
--- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- drivers/net/wireless/iwlwifi/iwl-5000.c | 2 +- drivers/net/wireless/iwlwifi/iwl-core.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-4965.c +1 -1
@@ -2354,7 +2354,7 @@ module_param_named(disable, iwl4965_mod_params.disable, int, 0444);MODULE_PARM_DESC (disable,"manually disable the radio (default 0 [radio on])" );module_param_named (swcrypto, iwl4965_mod_params.sw_crypto, int,0444 );MODULE_PARM_DESC (swcrypto,"using crypto in software (default 0 [hardware])" ); -module_param_named (debug, iwl4965_mod_params.debug, int,0444 ); +module_param_named (debug, iwl4965_mod_params.debug, uint,0444 );MODULE_PARM_DESC (debug,"debug output mask" );module_param_named ( disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int,0444 );
drivers/net/wireless/iwlwifi/iwl-5000.c +1 -1
@@ -1623,7 +1623,7 @@ MODULE_PARM_DESC(disable50,module_param_named (swcrypto50, iwl50_mod_params.sw_crypto, bool,0444 );MODULE_PARM_DESC (swcrypto50,"using software crypto engine (default 0 [hardware])\n" ); -module_param_named (debug50, iwl50_mod_params.debug, int,0444 ); +module_param_named (debug50, iwl50_mod_params.debug, uint,0444 );MODULE_PARM_DESC (debug50,"50XX debug output mask" );module_param_named (queues_num50, iwl50_mod_params.num_of_queues, int,0444 );MODULE_PARM_DESC (queues_num50,"number of hw queues in 50xx series" );
drivers/net/wireless/iwlwifi/iwl-core.h +1 -1
@@ -154,7 +154,7 @@ struct iwl_ops {struct iwl_mod_params {int disable;/* def: 0 = enable radio */ int sw_crypto;/* def: 0 = using hardware encryption */ -int debug;/* def: 0 = minimal debug log messages */ +u32 debug;/* def: 0 = minimal debug log messages */ int disable_hw_scan;/* def: 0 = use h/w scan */ int num_of_queues;/* def: HW dependent */ int num_of_ampdu_queues;/* def: HW dependent */
drivers/net/wireless/iwlwifi/iwl3945-base.c +2 -2
@@ -65,7 +65,7 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,/* module parameters */ static int iwl3945_param_disable_hw_scan;/* def: 0 = use 3945's h/w scan */ -static int iwl3945_param_debug;/* def: 0 = minimal debug log messages */ +static u32 iwl3945_param_debug;/* def: 0 = minimal debug log messages */ static int iwl3945_param_disable;/* def: 0 = enable radio */ static int iwl3945_param_antenna;/* def: 0 = both antennas (use diversity) */ int iwl3945_param_hwcrypto;/* def: 0 = use software encryption */
@@ -8361,7 +8361,7 @@ MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");module_param_named (hwcrypto, iwl3945_param_hwcrypto, int,0444 );MODULE_PARM_DESC (hwcrypto,"using hardware crypto engine (default 0 [software])\n" ); -module_param_named (debug, iwl3945_param_debug, int,0444 ); +module_param_named (debug, iwl3945_param_debug, uint,0444 );MODULE_PARM_DESC (debug,"debug output mask" );module_param_named (disable_hw_scan, iwl3945_param_disable_hw_scan, int,0444 );MODULE_PARM_DESC (disable_hw_scan,"disable hardware scanning (default 0)" );
Signature · 1 line
1.5.3.6
PATCH 5/8 iwlwifi: remove useless goto
From: Wu Fengguang <[email protected]>
The patch removes some useless goto in code cleanup.
--- drivers/net/wireless/iwlwifi/iwl-4965.c | 8 ++------ drivers/net/wireless/iwlwifi/iwl-5000.c | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-)
drivers/net/wireless/iwlwifi/iwl-4965.c +2 -6
@@ -426,7 +426,6 @@ static void iwl4965_nic_config(struct iwl_priv *priv)static int iwl4965_apm_stop_master (struct iwl_priv *priv) { -int ret =0 ;unsigned long flags;spin_lock_irqsave (&priv->lock, flags);
@@ -434,16 +433,13 @@ static int iwl4965_apm_stop_master(struct iwl_priv *priv)/* set stop master bit */ iwl_set_bit (priv,CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); - ret =iwl_poll_direct_bit (priv,CSR_RESET , +iwl_poll_direct_bit (priv,CSR_RESET ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,100 ); -if (ret <0 ) - goto out; -out:spin_unlock_irqrestore (&priv->lock, flags);IWL_DEBUG_INFO ("stop master\n" ); -return ret; +return 0 ; }static void iwl4965_apm_stop (struct iwl_priv *priv)
drivers/net/wireless/iwlwifi/iwl-5000.c +2 -6
@@ -73,7 +73,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = {/* FIXME: same implementation as 4965 */ static int iwl5000_apm_stop_master (struct iwl_priv *priv) { -int ret =0 ;unsigned long flags;spin_lock_irqsave (&priv->lock, flags);
@@ -81,16 +80,13 @@ static int iwl5000_apm_stop_master(struct iwl_priv *priv)/* set stop master bit */ iwl_set_bit (priv,CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); - ret =iwl_poll_direct_bit (priv,CSR_RESET , +iwl_poll_direct_bit (priv,CSR_RESET ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,100 ); -if (ret <0 ) - goto out; -out:spin_unlock_irqrestore (&priv->lock, flags);IWL_DEBUG_INFO ("stop master\n" ); -return ret; +return 0 ; }
Signature · 1 line
1.5.3.6
PATCH 6/8 iwlwifi: use meaningful vars in _iwl_poll_bit()
From: Wu, Fengguang <[email protected]>
Rename vars in _iwl_poll_bit() to better reflect the truth.
--- drivers/net/wireless/iwlwifi/iwl-io.h | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-io.h +6 -5
@@ -87,17 +87,18 @@ static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)#define iwl_read32 (p, o) _iwl_read32(p, o)#endif +#define IWL_POLL_INTERVAL 10/* microseconds */ static inline int _iwl_poll_bit (struct iwl_priv *priv,u32 addr,u32 bits,u32 mask,int timeout) { -int i =0 ; +int t =0 ;do {if ((_iwl_read32 (priv, addr) & mask) == (bits & mask)) -return i; -udelay (10 ); - i +=10 ; - }while (i < timeout); +return t; +udelay (IWL_POLL_INTERVAL ); + t +=IWL_POLL_INTERVAL ; + }while (t < timeout);return -ETIMEDOUT ; }
Signature · 1 line
1.5.3.6
PATCH 7/8 iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
Previously we allocate Rx SKB with GFP_ATOMIC flag. This is because we need to hold a spinlock to protect the two rx_used and rx_free lists operation in the rxq.
spin_lock(); ... element = rxq->rx_used.next; element->skb = alloc_skb(..., GFP_ATOMIC); list_del(element); list_add_tail(&element->list, &rxq->rx_free); ... spin_unlock();
After spliting the rx_used delete and rx_free insert into two operations, we don't require the skb allocation in an atomic context any more (the function itself is scheduled in a workqueue).
spin_lock(); ... element = rxq->rx_used.next; list_del(element); ... spin_unlock(); ... element->skb = alloc_skb(..., GFP_KERNEL); ... spin_lock() ... list_add_tail(&element->list, &rxq->rx_free); ... spin_unlock();
This patch should fix the "iwlagn: Can not allocate SKB buffers" warning we see recently.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 12 +----------- drivers/net/wireless/iwlwifi/iwl-rx.c | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -11
@@ -1112,16 +1112,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv) priv->cfg->ops->lib->rx_handler_setup (priv); } -/* -* this should be called while priv->lock is locked -*/ -static void __iwl_rx_replenish (struct iwl_priv *priv) -{ -iwl_rx_allocate (priv); -iwl_rx_queue_restock (priv); -} - -/** * iwl_rx_handle - Main entry function for receiving responses from uCode *
@@ -1230,7 +1220,7 @@ void iwl_rx_handle(struct iwl_priv *priv) count++;if (count >=8 ) { priv->rxq.read = i; -__iwl_rx_replenish (priv); +iwl_rx_queue_restock (priv); count =0 ; } }
drivers/net/wireless/iwlwifi/iwl-rx.c +19 -10
@@ -244,25 +244,31 @@ void iwl_rx_allocate(struct iwl_priv *priv)struct list_head *element;struct iwl_rx_mem_buffer *rxb;unsigned long flags; -spin_lock_irqsave (&rxq->lock, flags); -while (!list_empty (&rxq->rx_used)) { + +while (1 ) { +spin_lock_irqsave (&rxq->lock, flags); + +if (list_empty (&rxq->rx_used)) { +spin_unlock_irqrestore (&rxq->lock, flags); +return ; + } element = rxq->rx_used.next; rxb = list_entry(element, struct iwl_rx_mem_buffer, list); +list_del (element); + +spin_unlock_irqrestore (&rxq->lock, flags);/* Alloc a new receive buffer */ rxb->skb =alloc_skb (priv->hw_params.rx_buf_size +256 , - __GFP_NOWARN |GFP_ATOMIC ); +GFP_KERNEL );if (!rxb->skb) { -if (net_ratelimit ()) - printk(KERN_CRIT DRV_NAME -": Can not allocate SKB buffers\n" ); + printk(KERN_CRIT DRV_NAME + "Can not allocate SKB buffers\n");/* We don't reschedule replenish work here -- we will * call the restock method and if it still needs * more buffers it will schedule replenish */ break ; } - priv->alloc_rxb_skb++; -list_del (element);/* Get physical address of RB/SKB */ rxb->real_dma_addr = pci_map_single(
@@ -276,12 +282,15 @@ void iwl_rx_allocate(struct iwl_priv *priv) rxb->aligned_dma_addr =ALIGN (rxb->real_dma_addr,256 );skb_reserve (rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr); +spin_lock_irqsave (&rxq->lock, flags); +list_add_tail (&rxb->list, &rxq->rx_free); rxq->free_count++; + priv->alloc_rxb_skb++; + +spin_unlock_irqrestore (&rxq->lock, flags); } -spin_unlock_irqrestore (&rxq->lock, flags); } -EXPORT_SYMBOL (iwl_rx_allocate);void iwl_rx_replenish (struct iwl_priv *priv) {
Signature · 1 line
1.5.3.6
PATCH 8/8 iwlwifi: indicate txpower is off in sysfs
From: Jay Sternberg <[email protected]>
The patch checks if the radio is disabled before displaying the tx power level. Previously when the txpower was set off show_tx_power still returned the prior power level. Now it will indicate the power has been turned off.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +5 -1
@@ -3430,7 +3430,11 @@ static ssize_t show_tx_power(struct device *d, struct device_attribute *attr, char *buf) { struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; -return sprintf (buf,"%d\n" , priv->tx_power_user_lmt); + +if (!iwl_is_ready_rf (priv)) +return sprintf (buf,"off\n" ); +else +return sprintf (buf,"%d\n" , priv->tx_power_user_lmt); } static ssize_t store_tx_power(struct device *d,
Signature · 1 line
1.5.3.6
Re: [PATCH 3/8] iwlwifi: update comments on the debug interface
In reply to Zhu YiQuoted 53 lines · Yi
From: Wu, Fengguang <[email protected]>
Bring up-to-date some comments on the location of debug files.
Signed-off-by Wu Fengguang <[email protected]>Acked-by Tomas Winkler <[email protected]>Signed-off-by Zhu Yi <[email protected]>--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- drivers/net/wireless/iwlwifi/iwl-debug.h | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-)drivers/net/wireless/iwlwifi/iwl-agn.c +1
-1@@ -3354,7 +3354,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)/* * The following adds a new attribute to the sysfs representation -* of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/) +* of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) * used for controlling the debug level. * * See the level definitions in iwl for details. drivers/net/wireless/iwlwifi/iwl-debug.h +4
-5@@ -96,28 +96,25 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)#endif /* CONFIG_IWLWIFI_DEBUGFS */ /* -* To use the debug system; +* To use the debug system: * * If you are defining a new debug classification, simply add it to the #define -* list here in the form of: +* list here in the form of * * #define IWL_DL_xxxx VALUE * -* shifting value to the left one bit from the previous entry. xxxx should be -* the name of the classification (for example, WEP) +* where xxxx should be the name of the classification (for example, WEP). * * You then need to either add a IWL_xxxx_DEBUG() macro definition for your * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want * to send output to that classification. * -* To add your debug level to the list of levels seen when you perform +* The active debug levels can be accessed via files *
drivers/net/wireless/iwlwifi/iwl-debug.h static inline void iwl_dbgfs_unregister(struct iwl_priv *priv) · line 118
Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-debug.h +3
-5-* % cat /sys/class/net/wlanX/device/debug_level +* /sys/module/iwlagn/parameters/debug{50} +* /sys/class/net/wlan0/device/debug_level * -* you simply need to add your entry to the iwl_debug_levels array. -* -* If you do not see debug_level in /sys/class/net/wlanX/device/debug_level -* then you do not have CONFIG_IWLWIFI_DEBUG defined in your kernel config file +* when CONFIG_IWLWIFI_DEBUG=y. */
Hi Yi,
This was my prepared version:
* The debug levels can be activated by the "debug" module parameter("debug50"
* for 5000), and be runtime accessed via file
*
* /sys/class/net/wlan0/device/debug_level
*
* when CONFIG_IWLWIFI_DEBUG=y.
It's not really an obviously better writing though, and can be safely ignored.
Thanks,
Fengguang