Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1361126ybt; Thu, 25 Jun 2020 04:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz02B13QJY+omGFZATuPK6il+yRhdhrTnCbPimHY8pQiarVYlsKys17vrgwBNXggXneiTRM X-Received: by 2002:a17:906:8588:: with SMTP id v8mr1230635ejx.211.1593083982879; Thu, 25 Jun 2020 04:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593083982; cv=none; d=google.com; s=arc-20160816; b=OS4GfJiq+y0SelcRKVojNuJVcJHgdrss6HInenRZSSba+cejC8dfx+PNjcp9Rwtmsr SP7SJRgA+WhPkwm+RddnCTJ5/JGdcydOEh4linAucJvf/Uuw2TQvPZmp4Chz4O+A3/Bg hY04sdpxadXJcR2aW7mTJ1k30N6jcCLToaykw9Db2N+YP2sQjGV2564+8nY6Mu5YEu2F 0stNGck2C4HYvrxsfHeM/Uo+3eRR2NQO9qJ7dfXZZoBMgKmbx9SxJejsKhsIt9DCwL2q 8FEs7+sGf4DAWwIcQ8K6O2WZKdIzvAWVlVM9M7IQU0kT7+/s8beBaLL3CrWWS+ojwPOg k6ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=b9Rkv9lcIz6H9SkMxOdkMwTPG6e9nJZrRWdEFKIi/4w=; b=JkL9KIk05ZwmMq+A87d32pLPS0UQQ56Up8qfN/V6PU5m+yy/0VEFwWrZUddhFyH+p/ drhTR728+A8Ar7sk4pE2ir6/DtZ9+qiED3H2cRGpCim7IZ36FP3tjdR0dTe1NEXeLW5I oE4vIVTkAScalYRs5higSvWx5A/zw1pxHBxkmjcua0VpyXKZpklojznUvar6hxqy7eF4 88dAz2UwEIsKVGe05slqtJd274iPlHtrOvqsoquTyF0DHAh0ImLdJj1ra3ZGQNL5IjdJ DVpkdQIyoGfe6IlxeoifeFMzFfwmQZifP5IHhn/nzuwKz64pmJNRSEXAWK3GxeCdCBrG zhtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si14697292eji.421.2020.06.25.04.19.05; Thu, 25 Jun 2020 04:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404201AbgFYLPa (ORCPT + 99 others); Thu, 25 Jun 2020 07:15:30 -0400 Received: from mga11.intel.com ([192.55.52.93]:27499 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404195AbgFYLP3 (ORCPT ); Thu, 25 Jun 2020 07:15:29 -0400 IronPort-SDR: HJsnwG4a0RJkd6jaQFgceoOBF7CzJG4oCGySP/u4V1yBQLM9vg751Uu70QCnEQDOMFIwkUDYaZ iR+O9MKY2Qww== X-IronPort-AV: E=McAfee;i="6000,8403,9662"; a="143082221" X-IronPort-AV: E=Sophos;i="5.75,279,1589266800"; d="scan'208";a="143082221" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2020 04:15:29 -0700 IronPort-SDR: of9TehtZ1pMxuW6CMNd0rcyc3eskj7i5VSr6hoYfmZBavnqc1Cb5G8pczyHU4Ij0z8VVnyFeQp RAJQ97UdSBFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,279,1589266800"; d="scan'208";a="423703718" Received: from kbergman-mobl.ger.corp.intel.com (HELO egrumbac-mobl1.ger.corp.intel.com) ([10.249.94.147]) by orsmga004.jf.intel.com with ESMTP; 25 Jun 2020 04:15:27 -0700 From: Emmanuel Grumbach To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach Subject: [PATCH v2] cfg80211: allow the low level driver to flush the BSS table Date: Thu, 25 Jun 2020 14:15:24 +0300 Message-Id: <20200625111524.3992-1-emmanuel.grumbach@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The low level driver adds its own opaque information in the BSS table in the cfg80211_bss structure. The low level driver may need to signal that this information is no longer relevant and needs to be recreated. Add an API to allow the low level driver to do that. iwlwifi needs this because it keeps there an information about the firmware's internal clock. This is kept in mac80211's struct ieee80211_bss::sync_device_ts. This information is populated while we scan, we add the internal firmware's clock to each beacon which allows us to program the firmware correctly after association so that it'll know when (in terms of its internal clock) the DTIM and TBTT will happen. When the firmware is reset this internal clock is reset as well and ieee80211_bss::sync_device_ts is no longer accurate. iwlwifi will call this new API any time the firmware is started. Signed-off-by: Emmanuel Grumbach --- v2: do not flush the BSS table upon suspend, and rewrite the commit message --- include/net/cfg80211.h | 6 ++++++ net/wireless/scan.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fc7e8807838d..03a72b5b1986 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7882,4 +7882,10 @@ void cfg80211_update_owe_info_event(struct net_device *netdev, struct cfg80211_update_owe_info *owe_info, gfp_t gfp); +/** + * cfg80211_bss_flush - resets all the scan entries + * @wiphy: the wiphy + */ +void cfg80211_bss_flush(struct wiphy *wiphy); + #endif /* __NET_CFG80211_H */ diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 74ea4cfb39fb..e67a74488bbe 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -712,6 +712,16 @@ void cfg80211_bss_expire(struct cfg80211_registered_device *rdev) __cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); } +void cfg80211_bss_flush(struct wiphy *wiphy) +{ + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + + spin_lock_bh(&rdev->bss_lock); + __cfg80211_bss_expire(rdev, jiffies); + spin_unlock_bh(&rdev->bss_lock); +} +EXPORT_SYMBOL(cfg80211_bss_flush); + const struct element * cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len, const u8 *match, unsigned int match_len, -- 2.17.1