From patchwork Mon Jun 20 11:42:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jussi Kivilinna X-Patchwork-Id: 897052 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5KBgrxj007102 for ; Mon, 20 Jun 2011 11:42:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753393Ab1FTLmv (ORCPT ); Mon, 20 Jun 2011 07:42:51 -0400 Received: from sd-mail-sa-01.sanoma.fi ([158.127.18.161]:42301 "EHLO sd-mail-sa-01.sanoma.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753369Ab1FTLmu (ORCPT ); Mon, 20 Jun 2011 07:42:50 -0400 Received: from localhost (localhost [127.0.0.1]) by sd-mail-sa-01.sanoma.fi (Postfix) with ESMTP id B761AF07DB; Mon, 20 Jun 2011 14:42:49 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at sd-mail-sa-01.sanoma.fi Received: from sd-mail-sa-01.sanoma.fi ([127.0.0.1]) by localhost (sd-mail-sa-01.sanoma.fi [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FsaVTCn1aDiI; Mon, 20 Jun 2011 14:42:49 +0300 (EEST) Received: from hayate.81.fi (dyn2-85-23-163-91.psoas.suomi.net [85.23.163.91]) by sd-mail-sa-01.sanoma.fi (Postfix) with ESMTPSA id 81075F033B; Mon, 20 Jun 2011 14:42:49 +0300 (EEST) Received: from fate.lan ([10.0.0.10] helo=fate) by hayate.81.fi with esmtp (Exim 4.72) (envelope-from ) id 1QYcsT-0000mS-7O; Mon, 20 Jun 2011 14:42:49 +0300 Received: from localhost6.localdomain6 (unknown [127.0.0.1]) by fate (Postfix) with ESMTP id 338F025206; Mon, 20 Jun 2011 14:42:49 +0300 (EEST) Subject: [PATCH 5/6] zd1211rw: don't let zd_mac_config_beacon() run too long from beacon interrupt handler To: linux-wireless@vger.kernel.org From: Jussi Kivilinna Cc: Daniel Drake , "John W. Linville" , Ulrich Kunitz Date: Mon, 20 Jun 2011 14:42:49 +0300 Message-ID: <20110620114249.964.31962.stgit@localhost6.localdomain6> In-Reply-To: <20110620114228.964.35459.stgit@localhost6.localdomain6> References: <20110620114228.964.35459.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 20 Jun 2011 11:42:53 +0000 (UTC) zd_mac_config_beacon() has only limited time to set up beacon when called from beacon interrupt handler/worker. So do not let it retry acquiring beacon fifo semaphore in interrupt handler. Beacon fifo semaphore should not be locked by firmware anyway at this time, it's only locked when device is using/txing beacon. Signed-off-by: Jussi Kivilinna --- drivers/net/wireless/zd1211rw/zd_mac.c | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 0828605..b67c52d 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -143,7 +143,7 @@ static void beacon_enable(struct zd_mac *mac); static void beacon_disable(struct zd_mac *mac); static void set_rts_cts(struct zd_mac *mac, unsigned int short_preamble); static int zd_mac_config_beacon(struct ieee80211_hw *hw, - struct sk_buff *beacon); + struct sk_buff *beacon, bool in_intr); static int zd_reg2alpha2(u8 regdomain, char *alpha2) { @@ -404,7 +404,7 @@ int zd_restore_settings(struct zd_mac *mac) if (mac->vif != NULL) { beacon = ieee80211_beacon_get(mac->hw, mac->vif); if (beacon) - zd_mac_config_beacon(mac->hw, beacon); + zd_mac_config_beacon(mac->hw, beacon, false); } zd_set_beacon_interval(&mac->chip, beacon_interval, @@ -704,7 +704,8 @@ static void zd_mac_free_cur_beacon(struct zd_mac *mac) mutex_unlock(&mac->chip.mutex); } -static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon) +static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon, + bool in_intr) { struct zd_mac *mac = zd_hw_mac(hw); int r, ret, num_cmds, req_pos = 0; @@ -736,6 +737,10 @@ static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon) r = zd_ioread32_locked(&mac->chip, &tmp, CR_BCN_FIFO_SEMAPHORE); if (r < 0) goto release_sema; + if (in_intr && tmp & 0x2) { + r = -EBUSY; + goto release_sema; + } end_jiffies = jiffies + HZ / 2; /*~500ms*/ message_jiffies = jiffies + HZ / 10; /*~100ms*/ @@ -790,7 +795,7 @@ release_sema: end_jiffies = jiffies + HZ / 2; /*~500ms*/ ret = zd_iowrite32_locked(&mac->chip, 1, CR_BCN_FIFO_SEMAPHORE); while (ret < 0) { - if (time_is_before_eq_jiffies(end_jiffies)) { + if (in_intr || time_is_before_eq_jiffies(end_jiffies)) { ret = -ETIMEDOUT; break; } @@ -1161,7 +1166,7 @@ static void zd_beacon_done(struct zd_mac *mac) */ beacon = ieee80211_beacon_get(mac->hw, mac->vif); if (beacon) - zd_mac_config_beacon(mac->hw, beacon); + zd_mac_config_beacon(mac->hw, beacon, true); spin_lock_irq(&mac->lock); mac->beacon.last_update = jiffies; @@ -1286,7 +1291,7 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw, if (beacon) { zd_chip_disable_hwint(&mac->chip); - zd_mac_config_beacon(hw, beacon); + zd_mac_config_beacon(hw, beacon, false); zd_chip_enable_hwint(&mac->chip); } } @@ -1439,7 +1444,7 @@ static void beacon_watchdog_handler(struct work_struct *work) if (beacon) { zd_mac_free_cur_beacon(mac); - zd_mac_config_beacon(mac->hw, beacon); + zd_mac_config_beacon(mac->hw, beacon, false); } zd_set_beacon_interval(&mac->chip, interval, period, mac->type);