From: Emmanuel Grumbach Date: Tue, 15 Apr 2008 23:01:37 +0000 (-0700) Subject: iwlwifi: remove the statistics work X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=49ea85961cf8b60b5387cc1c1bc06fe4b6a31ee4;p=linux-beck.git iwlwifi: remove the statistics work This patch does 3 things 1) It removes the statistics work. The request statistics command is sent in ASYNC mode in this flow, the mutex is uneeded, so the request statistics function can't go to sleep. No need for a workqueue anymore. 2) iwl4965_send_statistics_request has been renamed to iwl_send_statistics_request and moved to iwl-core.c 3) A request for statistics is sent in alive_notify, the makes the uCode sends statistics notification periodically starting from association. Signed-off-by: Emmanuel Grumbach Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index a10a6e81769f..3df70f89f11b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -976,40 +976,21 @@ int iwl4965_hw_nic_reset(struct iwl_priv *priv) /** * iwl4965_bg_statistics_periodic - Timer callback to queue statistics * - * This callback is provided in order to queue the statistics_work - * in work_queue context (v. softirq) + * This callback is provided in order to send a statistics request. * * This timer function is continually reset to execute within * REG_RECALIB_PERIOD seconds since the last STATISTICS_NOTIFICATION * was received. We need to ensure we receive the statistics in order - * to update the temperature used for calibrating the TXPOWER. However, - * we can't send the statistics command from softirq context (which - * is the context which timers run at) so we have to queue off the - * statistics_work to actually send the command to the hardware. + * to update the temperature used for calibrating the TXPOWER. */ static void iwl4965_bg_statistics_periodic(unsigned long data) { struct iwl_priv *priv = (struct iwl_priv *)data; - queue_work(priv->workqueue, &priv->statistics_work); -} - -/** - * iwl4965_bg_statistics_work - Send the statistics request to the hardware. - * - * This is queued by iwl4965_bg_statistics_periodic. - */ -static void iwl4965_bg_statistics_work(struct work_struct *work) -{ - struct iwl_priv *priv = container_of(work, struct iwl_priv, - statistics_work); - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; - mutex_lock(&priv->mutex); - iwl4965_send_statistics_request(priv); - mutex_unlock(&priv->mutex); + iwl_send_statistics_request(priv, CMD_ASYNC); } #define CT_LIMIT_CONST 259 @@ -2026,6 +2007,9 @@ int iwl4965_alive_notify(struct iwl_priv *priv) iwl_release_nic_access(priv); spin_unlock_irqrestore(&priv->lock, flags); + /* Ask for statistics now, the uCode will send statistics notification + * periodically after association */ + iwl_send_statistics_request(priv, CMD_ASYNC); return ret; } @@ -4903,7 +4887,6 @@ void iwl4965_hw_rx_handler_setup(struct iwl_priv *priv) void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv) { INIT_WORK(&priv->txpower_work, iwl4965_bg_txpower_work); - INIT_WORK(&priv->statistics_work, iwl4965_bg_statistics_work); #ifdef CONFIG_IWL4965_SENSITIVITY INIT_WORK(&priv->sensitivity_work, iwl4965_bg_sensitivity_work); #endif diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index e5ab4c01ec9b..c8e73a5212af 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -638,7 +638,6 @@ extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, const u8 *dest, int left); extern int iwl4965_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl4965_rx_queue *q); -extern int iwl4965_send_statistics_request(struct iwl_priv *priv); extern void iwl4965_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb, u32 decrypt_res, struct ieee80211_rx_status *stats); @@ -1206,7 +1205,6 @@ struct iwl_priv { #ifdef CONFIG_IWL4965_SENSITIVITY struct work_struct sensitivity_work; #endif - struct work_struct statistics_work; struct timer_list statistics_periodic; }; /*iwl_priv */ diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index d8a226e68ed1..88d62462ed4a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c @@ -277,3 +277,15 @@ int iwlcore_low_level_notify(struct iwl_priv *priv, } EXPORT_SYMBOL(iwlcore_low_level_notify); +int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags) +{ + u32 stat_flags = 0; + struct iwl_host_cmd cmd = { + .id = REPLY_STATISTICS_CMD, + .meta.flags = flags, + .len = sizeof(stat_flags), + .data = (u8 *) &stat_flags, + }; + return iwl_send_cmd(priv, &cmd); +} +EXPORT_SYMBOL(iwl_send_statistics_request); diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 23c21e38ca8a..aef1b48ea50c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h @@ -228,4 +228,6 @@ enum iwlcore_card_notify { int iwlcore_low_level_notify(struct iwl_priv *priv, enum iwlcore_card_notify notify); +extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags); + #endif /* __iwl_core_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 5ec0af4788e4..42e519be0206 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -596,13 +596,6 @@ static void iwl4965_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt) } -int iwl4965_send_statistics_request(struct iwl_priv *priv) -{ - u32 flags = 0; - return iwl_send_cmd_pdu(priv, REPLY_STATISTICS_CMD, - sizeof(flags), &flags); -} - /** * iwl4965_rxon_add_station - add station into station table. * @@ -7530,7 +7523,7 @@ static ssize_t show_statistics(struct device *d, return -EAGAIN; mutex_lock(&priv->mutex); - rc = iwl4965_send_statistics_request(priv); + rc = iwl_send_statistics_request(priv, 0); mutex_unlock(&priv->mutex); if (rc) {