From patchwork Fri Aug 21 20:46:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Albert X-Patchwork-Id: 43220 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7LKkLX9001667 for ; Fri, 21 Aug 2009 20:46:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932569AbZHUUqS (ORCPT ); Fri, 21 Aug 2009 16:46:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932551AbZHUUqS (ORCPT ); Fri, 21 Aug 2009 16:46:18 -0400 Received: from mail.gmx.net ([213.165.64.20]:37038 "HELO mail.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S932530AbZHUUqR (ORCPT ); Fri, 21 Aug 2009 16:46:17 -0400 Received: (qmail invoked by alias); 21 Aug 2009 20:46:17 -0000 Received: from f048148007.adsl.alicedsl.de (EHLO [192.168.2.185]) [78.48.148.7] by mail.gmx.net (mp039) with SMTP; 21 Aug 2009 22:46:17 +0200 X-Authenticated: #3800222 X-Provags-ID: V01U2FsdGVkX19tqd9IDONtnT7U5UD8Gxp65JdGfDFQ8EAA1aos4W GjXbvHSBG4kiLq Message-ID: <4A8F0798.6050908@gmx.de> Date: Fri, 21 Aug 2009 22:46:16 +0200 From: Joerg Albert User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: "John W. Linville" CC: "linux-wireless@vger.kernel.org" , Christian Lamparter Subject: [PATCH 1/2 v2] ar9170: cleanup of bss_info_changed and beacon config X-Y-GMX-Trusted: 0 X-FuHaFi: 0.46 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add beacon control by BSS_CHANGED_BEACON_ENABLED and bss_conf->enable_beacon from mac80211. Signed-off-by: Joerg Albert --- As suggested by Christian this version preserves the old behaviour for STA mode. drivers/net/wireless/ath/ar9170/ar9170.h | 1 + drivers/net/wireless/ath/ar9170/mac.c | 24 ++++++++++++++---------- drivers/net/wireless/ath/ar9170/main.c | 15 ++++++++------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h index ce40724..914e471 100644 --- a/drivers/net/wireless/ath/ar9170/ar9170.h +++ b/drivers/net/wireless/ath/ar9170/ar9170.h @@ -178,6 +178,7 @@ struct ar9170 { /* beaconing */ struct sk_buff *beacon; struct work_struct beacon_work; + bool enable_beacon; /* cryptographic engine */ u64 usedkeys; diff --git a/drivers/net/wireless/ath/ar9170/mac.c b/drivers/net/wireless/ath/ar9170/mac.c index 6004936..71eeef5 100644 --- a/drivers/net/wireless/ath/ar9170/mac.c +++ b/drivers/net/wireless/ath/ar9170/mac.c @@ -383,20 +383,24 @@ int ar9170_set_beacon_timers(struct ar9170 *ar) if (ar->vif) { v |= ar->vif->bss_conf.beacon_int; - switch (ar->vif->type) { - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_ADHOC: - v |= BIT(25); - break; - case NL80211_IFTYPE_AP: - v |= BIT(24); - pretbtt = (ar->vif->bss_conf.beacon_int - 6) << 16; - break; - default: + if (ar->enable_beacon) { + + switch (ar->vif->type) { + case NL80211_IFTYPE_MESH_POINT: + case NL80211_IFTYPE_ADHOC: + v |= BIT(25); + break; + case NL80211_IFTYPE_AP: + v |= BIT(24); + pretbtt = (ar->vif->bss_conf.beacon_int - 6) << 16; + break; + default: break; + } } v |= ar->vif->bss_conf.dtim_period << 16; + } ar9170_regwrite_begin(ar); diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 658b323..911e502 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c @@ -2148,11 +2148,18 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw, goto out; } - if (changed & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED)) { + if (changed & BSS_CHANGED_BEACON_ENABLED) { + ar->enable_beacon = bss_conf->enable_beacon; + } + + if (changed & BSS_CHANGED_BEACON) { err = ar9170_update_beacon(ar); if (err) goto out; + } + if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON | + BSS_CHANGED_BEACON_INT)) { err = ar9170_set_beacon_timers(ar); if (err) goto out; @@ -2165,12 +2172,6 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw, #endif /* CONFIG_AR9170_LEDS */ } - if (changed & BSS_CHANGED_BEACON_INT) { - err = ar9170_set_beacon_timers(ar); - if (err) - goto out; - } - if (changed & BSS_CHANGED_HT) { /* TODO */ err = 0;