From patchwork Wed Sep 29 09:22:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Randolf X-Patchwork-Id: 216762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8T9MSNG006594 for ; Wed, 29 Sep 2010 09:22:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754737Ab0I2JWV (ORCPT ); Wed, 29 Sep 2010 05:22:21 -0400 Received: from mail30f.wh2.ocn.ne.jp ([220.111.41.203]:17690 "HELO mail30f.wh2.ocn.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754608Ab0I2JWU (ORCPT ); Wed, 29 Sep 2010 05:22:20 -0400 Received: from vs3002.wh2.ocn.ne.jp (125.206.180.165) by mail30f.wh2.ocn.ne.jp (RS ver 1.0.95vs) with SMTP id 4-0906822136 for ; Wed, 29 Sep 2010 18:22:18 +0900 (JST) Received: (qmail 20716 invoked from network); 29 Sep 2010 09:22:16 -0000 Received: from unknown (HELO ?192.168.3.123?) (220.110.201.18) by with SMTP; 29 Sep 2010 09:22:16 -0000 Subject: [PATCH] ath5k: vif adhoc fixup To: greearb@candelatech.com From: Bruno Randolf Cc: linux-wireless@vger.kernel.org Date: Wed, 29 Sep 2010 18:22:22 +0900 Message-ID: <20100929092221.12160.62425.stgit@tt-desk> User-Agent: StGit/0.15 MIME-Version: 1.0 X-SF-Loop: 1 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 29 Sep 2010 09:22:29 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 499a906..3ed9935 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -1857,9 +1857,6 @@ ath5k_beacon_send(struct ath5k_softc *sc) struct ath5k_vif *avf; struct ath5k_buf *bf; struct sk_buff *skb; - u64 tsf; - u32 tsftu; - int slot; ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n"); @@ -1891,20 +1888,21 @@ ath5k_beacon_send(struct ath5k_softc *sc) sc->bmisscount = 0; } - tsf = ath5k_hw_get_tsf64(ah); - tsftu = TSF_TO_TU(tsf); - slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; - vif = sc->bslot[(slot + 1) % ATH_BCBUF]; - - ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, - "tsf %llx tsftu %x intval %u slot %u vif %p\n", - (unsigned long long)tsf, tsftu, sc->bintval, slot, vif); + if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) { + u64 tsf = ath5k_hw_get_tsf64(ah); + u32 tsftu = TSF_TO_TU(tsf); + int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; + vif = sc->bslot[(slot + 1) % ATH_BCBUF]; + ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, + "tsf %llx tsftu %x intval %u slot %u vif %p\n", + (unsigned long long)tsf, tsftu, sc->bintval, slot, vif); + } else /* only one interface */ + vif = sc->bslot[0]; - if (vif) - avf = (void *)vif->drv_priv; - else + if (!vif) return; + avf = (void *)vif->drv_priv; bf = avf->bbuf; if (unlikely(bf->skb == NULL || sc->opmode == NL80211_IFTYPE_STATION || sc->opmode == NL80211_IFTYPE_MONITOR)) { @@ -1964,7 +1962,7 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf) u64 hw_tsf; intval = sc->bintval & AR5K_BEACON_PERIOD; - if (sc->opmode == NL80211_IFTYPE_AP) { + if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) { intval /= ATH_BCBUF; /* staggered multi-bss beacons */ if (intval < 15) ATH5K_WARN(sc, "intval %u is too low, min 15\n", @@ -2795,7 +2793,6 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, ret = -ELNRNG; goto end; } - sc->nvifs++; switch (vif->type) { case NL80211_IFTYPE_AP: @@ -2809,6 +2806,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, goto end; } + sc->nvifs++; ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "add interface mode %d\n", avf->opmode); /* Assign the vap/adhoc to a beacon xmit slot. */