lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220719123525.3448926-5-gasmibal@gmail.com>
Date:   Tue, 19 Jul 2022 14:35:25 +0200
From:   Baligh Gasmi <gasmibal@...il.com>
To:     Johannes Berg <johannes@...solutions.net>
Cc:     "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Felix Fietkau <nbd@....name>,
        Toke Hoiland-Jorgensen <toke@...hat.com>,
        Linus Lussing <linus.luessing@...3.blue>,
        Kalle Valo <kvalo@...nel.org>,
        Baligh Gasmi <gasmibal@...il.com>
Subject: [RFC/RFT v5 4/4] mac80211: extend channel info with average busy time.

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

Signed-off-by: Baligh Gasmi <gasmibal@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ