From patchwork Tue Jul 17 11:46:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1204881 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 53880DF25A for ; Tue, 17 Jul 2012 11:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056Ab2GQLsR (ORCPT ); Tue, 17 Jul 2012 07:48:17 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:41159 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050Ab2GQLsQ (ORCPT ); Tue, 17 Jul 2012 07:48:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1342525697; x=1374061697; h=from:mime-version:content-transfer-encoding:message-id: date:to:cc:subject; bh=h4luLgZx9juyWUOkEE3Aohuir8PMCpvqBMWT6pmn8vM=; b=hHszTuUhNV3v31USCCOEYSRfkrRPVYAQxQgl0d4rfi1oVc7Kw7QVZmMI fgaKNuoapANQh4Lb58KNIW3zSLhNiKo+fjgTgj+0jVPVQSga6hsIRhW5q /GQiOe/XPb1gNkBRqWvYWeJLRN+xWsCa/dODcXwCwH6kWs7O/4viUvmQv o=; X-IronPort-AV: E=McAfee;i="5400,1158,6774"; a="209050883" Received: from ironmsg02-l.qualcomm.com ([172.30.48.16]) by wolverine02.qualcomm.com with ESMTP; 17 Jul 2012 04:48:17 -0700 X-IronPort-AV: E=Sophos;i="4.77,601,1336374000"; d="scan'208";a="121758135" Received: from nasanexhc04.na.qualcomm.com ([172.30.48.17]) by ironmsg02-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 17 Jul 2012 04:47:56 -0700 Received: from sarge (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.17) with Microsoft SMTP Server (TLS) id 14.2.309.2; Tue, 17 Jul 2012 04:47:54 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20485.20636.11008.266065@gargle.gargle.HOWL> Date: Tue, 17 Jul 2012 17:16:36 +0530 To: X-Mailer: VM 8.2.0b under 24.1.1 (x86_64-unknown-linux-gnu) CC: Subject: [PATCH 11/12] ath9k: Reconfigure VIF state properly X-Originating-IP: [172.30.48.1] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When an interface in AP or P2P-GO mode is removed, check whether a station interface is already present and reconfigure the beacon timers etc. properly if it's associated. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 55c9095..6a44c95 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -19,6 +19,9 @@ #include "ath9k.h" #include "btcoex.h" +static void ath9k_set_assoc_state(struct ath_softc *sc, + struct ieee80211_vif *vif); + u8 ath9k_parse_mpdudensity(u8 mpdudensity) { /* @@ -878,6 +881,18 @@ static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) } } +static void ath9k_sta_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) +{ + struct ath_softc *sc = data; + struct ath_vif *avp = (void *)vif->drv_priv; + + if (vif->type != NL80211_IFTYPE_STATION) + return; + + if (avp->primary_sta_vif) + ath9k_set_assoc_state(sc, vif); +} + /* Called with sc->mutex held. */ void ath9k_calculate_iter_data(struct ieee80211_hw *hw, struct ieee80211_vif *vif, @@ -911,6 +926,7 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, struct ath_hw *ah = sc->sc_ah; struct ath_common *common = ath9k_hw_common(ah); struct ath9k_vif_iter_data iter_data; + enum nl80211_iftype old_opmode = ah->opmode; ath9k_calculate_iter_data(hw, vif, &iter_data); @@ -941,6 +957,17 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, ah->imask &= ~ATH9K_INT_TSFOOR; ath9k_hw_set_interrupts(ah); + + /* + * If we are changing the opmode to STATION, + * a beacon sync needs to be done. + */ + if (ah->opmode == NL80211_IFTYPE_STATION && + old_opmode == NL80211_IFTYPE_AP && + test_bit(SC_OP_PRIM_STA_VIF, &sc->sc_flags)) { + ieee80211_iterate_active_interfaces_atomic(sc->hw, + ath9k_sta_vif_iter, sc); + } } static int ath9k_add_interface(struct ieee80211_hw *hw,