netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baligh Gasmi <gasmibal@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
	Toke Hoiland-Jorgensen <toke@redhat.com>,
	Linus Lussing <linus.luessing@c0d3.blue>,
	Kalle Valo <kvalo@kernel.org>, Baligh Gasmi <gasmibal@gmail.com>
Subject: [RFC/RFT v5 4/4] mac80211: extend channel info with average busy time.
Date: Tue, 19 Jul 2022 14:35:25 +0200	[thread overview]
Message-ID: <20220719123525.3448926-5-gasmibal@gmail.com> (raw)
In-Reply-To: <20220719123525.3448926-1-gasmibal@gmail.com>

Add the average busy time of the channel in the nl80211.

Signed-off-by: Baligh Gasmi <gasmibal@gmail.com>
---
 include/net/cfg80211.h       | 1 +
 include/uapi/linux/nl80211.h | 2 ++
 net/mac80211/cfg.c           | 8 ++++++++
 net/wireless/nl80211.c       | 6 ++++++
 4 files changed, 17 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 80f41446b1f0..38bafcaf3446 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4494,6 +4494,7 @@ struct cfg80211_ops {
 				struct cfg80211_fils_aad *fils_aad);
 	int	(*set_radar_background)(struct wiphy *wiphy,
 					struct cfg80211_chan_def *chandef);
+	int     (*get_avg_busy_time)(struct wiphy *wiphy, struct net_device *dev);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d9490e3062a7..4e625f656bd6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3177,6 +3177,8 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_DISABLE_EHT,
 
+	NL80211_ATTR_WIPHY_AVG_BUSY_TIME,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4ddf297f40f2..21a9d0b37ff5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4536,6 +4536,13 @@ ieee80211_set_radar_background(struct wiphy *wiphy,
 	return local->ops->set_radar_background(&local->hw, chandef);
 }
 
+static int ieee80211_get_avg_busy_time(struct wiphy *wiphy,
+				       struct net_device *dev)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	return ewma_avg_busy_read(&sdata->avg_busy);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -4641,4 +4648,5 @@ const struct cfg80211_ops mac80211_config_ops = {
 	.set_sar_specs = ieee80211_set_sar_specs,
 	.color_change = ieee80211_color_change,
 	.set_radar_background = ieee80211_set_radar_background,
+	.get_avg_busy_time = ieee80211_get_avg_busy_time,
 };
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 740b29481bc6..eeb3d85fd506 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3717,6 +3717,12 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
 			goto nla_put_failure;
 	}
 
+	if (rdev->ops->get_avg_busy_time) {
+		int busy = rdev->ops->get_avg_busy_time(&rdev->wiphy, dev);
+		nla_put_u32(msg, NL80211_ATTR_WIPHY_AVG_BUSY_TIME,
+			   busy);
+	}
+
 	wdev_lock(wdev);
 	switch (wdev->iftype) {
 	case NL80211_IFTYPE_AP:
-- 
2.37.1


      parent reply	other threads:[~2022-07-19 13:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 12:35 [RFC/RFT v5 0/4] expected throughput from AQL airtime Baligh Gasmi
2022-07-19 12:35 ` [RFC/RFT v5 1/4] mac80211: use AQL airtime for expected throughput Baligh Gasmi
2022-08-25 13:31   ` Nicolas Escande
2022-08-25 14:17     ` Baligh GASMI
2022-07-19 12:35 ` [RFC/RFT v5 2/4] mac80211: add periodic monitor for channel busy time Baligh Gasmi
2022-08-25  8:58   ` Johannes Berg
2022-08-25  9:27     ` Baligh GASMI
2022-08-25 13:35   ` Nicolas Escande
2022-07-19 12:35 ` [RFC/RFT v5 3/4] mac80211: add busy time factor into expected throughput Baligh Gasmi
2022-08-25 13:36   ` Nicolas Escande
2022-07-19 12:35 ` Baligh Gasmi [this message]

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=20220719123525.3448926-5-gasmibal@gmail.com \
    --to=gasmibal@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linus.luessing@c0d3.blue \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=toke@redhat.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).