Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:63825 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756617Ab1LGViM convert rfc822-to-8bit (ORCPT ); Wed, 7 Dec 2011 16:38:12 -0500 Received: by ggnr5 with SMTP id r5so1105448ggn.19 for ; Wed, 07 Dec 2011 13:38:11 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1323266001-12912-3-git-send-email-rmanohar@qca.qualcomm.com> References: <1323266001-12912-1-git-send-email-rmanohar@qca.qualcomm.com> <1323266001-12912-3-git-send-email-rmanohar@qca.qualcomm.com> From: "Luis R. Rodriguez" Date: Wed, 7 Dec 2011 13:37:49 -0800 Message-ID: (sfid-20111207_223815_722224_4BF42A0B) Subject: Re: [PATCH 3/4] ath9k: Restore EEPROM regulatory upon STA disconnect To: Rajkumar Manoharan Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Wed, Dec 7, 2011 at 5:53 AM, Rajkumar Manoharan wrote: > The current regulatory for world roaming mode cards might be > overriden by country IE from the assiciated AP. But these > regulatory values are failed to be restored on disconnection. > This patch ensures to resotre regulatry values at driver side. > > Signed-off-by: Rajkumar Manoharan > --- >  drivers/net/wireless/ath/ath9k/main.c |    8 ++++++++ >  1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c > index 424289f..a4dbb7b 100644 > --- a/drivers/net/wireless/ath/ath9k/main.c > +++ b/drivers/net/wireless/ath/ath9k/main.c > @@ -2046,6 +2046,14 @@ static void ath9k_config_bss(struct ath_softc *sc, struct ieee80211_vif *vif) >                sc->sc_flags &= ~SC_OP_ANI_RUN; >                del_timer_sync(&common->ani.timer); >                memset(&sc->caldata, 0, sizeof(sc->caldata)); > +               /* > +                * Restore regulatory values that might be updated > +                * by country IEs. > +                */ > +               if (!ath_is_world_regd(&common->regulatory) && > +                   ath_is_world_regd(&common->reg_world_copy)) > +                       memcpy(&common->regulatory, &common->reg_world_copy, > +                              sizeof(struct ath_regulatory)); >        } NACK, this patch should not be required given that patch [2/4] in this series restores this on the reg_notifier() for the NL80211_REGDOM_SET_BY_CORE case -- the trick is that when cfg80211 detects not only a disconnect, but any regulatory restore, it will *always* send a reg core hint! Again the hunk from patch [2/4] was: @@ -363,14 +381,37 @@ int ath_reg_notifier_apply(struct wiphy *wiphy, return 0; switch (request->initiator) { - case NL80211_REGDOM_SET_BY_DRIVER: case NL80211_REGDOM_SET_BY_CORE: + /* + * If common->reg_world_copy is world roaming it means we *were* + * world roaming... so we now have to restore that data. + */ + if (!ath_is_world_regd(&common->reg_world_copy)) + break; + + memcpy(reg, &common->reg_world_copy, + sizeof(struct ath_regulatory)); + break; + case NL80211_REGDOM_SET_BY_DRIVER: case NL80211_REGDOM_SET_BY_USER: break; Can you please test without this patch and ensure you get the data properly restored? Luis