ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
To: <ath11k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>,
	Venkateswara Naralasetty <quic_vnaralas@quicinc.com>,
	Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
Subject: [PATCH v2 3/4] wifi: mac80211: notify BSS change upon AP power save change
Date: Mon, 20 Mar 2023 22:13:33 +0530	[thread overview]
Message-ID: <20230320164334.3325886-4-quic_mkenna@quicinc.com> (raw)
In-Reply-To: <20230320164334.3325886-1-quic_mkenna@quicinc.com>

From: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>

Notify BSS change to the drivers upon AP power save
changes through ieee80211_vif_cfg_change_notify().

BSS_CHANGED_PS is reused to notify the AP power save
change, which is currently used only for STA mode.

A new hw flag IEEE80211_HW_SUPPORTS_AP_PS is introduced
for backward compatibility and notify the AP power save
change to the drivers which support AP power save.

Signed-off-by: Venkateswara Naralasetty <quic_vnaralas@quicinc.com>
Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
---
 include/net/mac80211.h |  7 ++++++-
 net/mac80211/cfg.c     | 23 +++++++++++++++++------
 net/mac80211/debugfs.c |  1 +
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f12edca660ba..963607b64226 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -318,7 +318,7 @@ struct ieee80211_vif_chanctx_switch {
  * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
  * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
  * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
- * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
+ * @BSS_CHANGED_PS: PS changed for this BSS (AP and STA mode)
  * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
  * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
  *	changed
@@ -683,6 +683,7 @@ struct ieee80211_fils_discovery {
  *	beamformee
  * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU
  *	beamformer
+ * @ap_ps_enable: enable/disable ap power save.
  */
 struct ieee80211_bss_conf {
 	struct ieee80211_vif *vif;
@@ -776,6 +777,7 @@ struct ieee80211_bss_conf {
 	bool eht_su_beamformer;
 	bool eht_su_beamformee;
 	bool eht_mu_beamformer;
+	bool ap_ps_enable;
 };
 
 /**
@@ -2646,6 +2648,8 @@ struct ieee80211_txq {
  * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
  *	multicast frames on all links, mac80211 should not do that.
  *
+ * @IEEE80211_HW_SUPPORTS_AP_PS: Hardware supports AP power save.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -2703,6 +2707,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
 	IEEE80211_HW_DETECTS_COLOR_COLLISION,
 	IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
+	IEEE80211_HW_SUPPORTS_AP_PS,
 
 	/* keep last, obviously */
 	NUM_IEEE80211_HW_FLAGS
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 657be3d4dfcd..a9aec880721a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1468,6 +1468,7 @@ static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev,
 	struct beacon_data *old;
 	int err;
 	struct ieee80211_bss_conf *link_conf;
+	u32 changed = 0;
 
 	sdata_assert_lock(sdata);
 
@@ -1488,20 +1489,30 @@ static int ieee80211_update_ap(struct wiphy *wiphy, struct net_device *dev,
 	if (!old)
 		return -ENOENT;
 
-	err = ieee80211_assign_beacon(sdata, link, &params->settings.beacon,
-				      NULL, NULL);
-	if (err < 0)
-		return err;
+	if (test_bit(BEACON_VALID, params->valid)) {
+		err = ieee80211_assign_beacon(sdata, link, &params->settings.beacon,
+					      NULL, NULL);
+		if (err < 0)
+			return err;
+
+		changed |= err;
+	}
+
+	if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_AP_PS) &&
+	    test_bit(AP_PS_VALID, params->valid)) {
+		sdata->vif.bss_conf.ap_ps_enable = params->settings.ap_ps_enable;
+		changed |= BSS_CHANGED_PS;
+	}
 
 	if (params->settings.beacon.he_bss_color_valid &&
 	    params->settings.beacon.he_bss_color.enabled !=
 	    link_conf->he_bss_color.enabled) {
 		link_conf->he_bss_color.enabled =
 			params->settings.beacon.he_bss_color.enabled;
-		err |= BSS_CHANGED_HE_BSS_COLOR;
+		changed |= BSS_CHANGED_HE_BSS_COLOR;
 	}
 
-	ieee80211_link_info_change_notify(sdata, link, err);
+	ieee80211_vif_cfg_change_notify(sdata, changed);
 	return 0;
 }
 
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index dfb9f55e2685..9cf744917a5f 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -496,6 +496,7 @@ static const char *hw_flag_names[] = {
 	FLAG(SUPPORTS_CONC_MON_RX_DECAP),
 	FLAG(DETECTS_COLOR_COLLISION),
 	FLAG(MLO_MCAST_MULTI_LINK_TX),
+	FLAG(SUPPORTS_AP_PS),
 #undef FLAG
 };
 
-- 
2.25.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  parent reply	other threads:[~2023-03-20 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 16:43 [PATCH v2 0/4] Add AP power save support Maharaja Kennadyrajan
2023-03-20 16:43 ` [PATCH v2 1/4] wifi: nl80211: rename NL80211_CMD_SET_BEACON to NL80211_CMD_UDPATE_AP Maharaja Kennadyrajan
2023-03-20 16:43 ` [PATCH v2 2/4] wifi: nl80211: add configuration support for ap power save Maharaja Kennadyrajan
2023-03-20 16:43 ` Maharaja Kennadyrajan [this message]
2023-03-24  2:27   ` [PATCH v2 3/4] wifi: mac80211: notify BSS change upon AP power save change kernel test robot
2023-03-20 16:43 ` [PATCH v2 4/4] wifi: ath11k: add AP power save support Maharaja Kennadyrajan
2023-03-21  0:31   ` kernel test robot
2023-03-21  1:56   ` kernel test robot
2023-03-20 17:04 ` [PATCH v2 0/4] Add " Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230320164334.3325886-4-quic_mkenna@quicinc.com \
    --to=quic_mkenna@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_vnaralas@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).