]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: send MLO links tx power info in GET_INTERFACE
authorRameshkumar Sundaram <quic_ramess@quicinc.com>
Mon, 25 Nov 2024 08:32:16 +0000 (14:02 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 4 Dec 2024 15:14:46 +0000 (16:14 +0100)
Currently, TX power is reported on interface/wdev level as
part of NL80211_CMD_GET_INTERFACE. With MLO, Multiple links
can be part of an interface/wdev and hence its necessary to
report the TX power of each link.

Add support to send tx power for all valid links of an MLD as
part of NL80211_CMD_GET_INTERFACE request.

As far as userspace is concerned, there is no behavioral change
for Non-ML Interfaces. For ML interfaces, userspace should fetch
TX power that is nested inside NL80211_ATTR_MLO_LINKS, similar to
how channel info(NL80211_ATTR_WIPHY_FREQ) is fetched.

Co-developed-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Link: https://patch.msgid.link/20241125083217.216095-2-quic_ramess@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
12 files changed:
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/microchip/wilc1000/cfg80211.c
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
include/net/cfg80211.h
net/mac80211/cfg.c
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/trace.h
net/wireless/wext-compat.c

index 61b2e3f15f0e92162d104d0aaff391e8ec123374..72ce321f2a77ea9aeed8d006dfb6dff8fa346c40 100644 (file)
@@ -1441,6 +1441,7 @@ static int ath6kl_cfg80211_set_txpower(struct wiphy *wiphy,
 
 static int ath6kl_cfg80211_get_txpower(struct wiphy *wiphy,
                                       struct wireless_dev *wdev,
+                                      unsigned int link_id,
                                       int *dbm)
 {
        struct ath6kl *ar = (struct ath6kl *)wiphy_priv(wiphy);
index 297a7c738c0161112b33853460f42fc80fbde8bf..689e779fe00fc6d1a86924771176d38b32058969 100644 (file)
@@ -2676,7 +2676,7 @@ done:
 
 static s32
 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
-                           s32 *dbm)
+                           unsigned int link_id, s32 *dbm)
 {
        struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
        struct brcmf_cfg80211_vif *vif = wdev_to_vif(wdev);
index fca3eea7ee842150e438181da7a060314a53c516..a099fdaafa45d6daf1802dc996f1a191952440e1 100644 (file)
@@ -410,7 +410,7 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
 static int
 mwifiex_cfg80211_get_tx_power(struct wiphy *wiphy,
                              struct wireless_dev *wdev,
-                             int *dbm)
+                             unsigned int link_id, int *dbm)
 {
        struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
        struct mwifiex_private *priv = mwifiex_get_priv(adapter,
index e96736cc7259b981ba01d04a622533953a04d717..e7aa0f9919232350761d51cbb1b5be87ca39e855 100644 (file)
@@ -1669,7 +1669,7 @@ static int set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 
 static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
-                       int *dbm)
+                       unsigned int link_id, int *dbm)
 {
        int ret;
        struct wilc_vif *vif = netdev_priv(wdev->netdev);
index 8b97accf6638fc93791ea8cd394fa3b1c6c757f5..0b22825283422db0f1944ab01a9aed85d1d5e404 100644 (file)
@@ -881,7 +881,7 @@ static int qtnf_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
 }
 
 static int qtnf_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
-                            int *dbm)
+                            unsigned int link_id, int *dbm)
 {
        struct qtnf_vif *vif = qtnf_netdev_get_priv(wdev->netdev);
        int ret;
index c053ee9c1361c48901edcd0c7d5939d12778c3d7..7fcc46a0bb48fbd9c8ce2df1dffe227a3717a2dd 100644 (file)
@@ -1802,7 +1802,8 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
 }
 
 static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
-                                   struct wireless_dev *wdev, int *dbm)
+                                   struct wireless_dev *wdev,
+                                   unsigned int link_id, int *dbm)
 {
        *dbm = (12);
 
index 63e79a22a214fb052155ba8797045960e72f7f04..0a48f47a77dc31440c210e152ca07aa1430a19a9 100644 (file)
@@ -4733,7 +4733,7 @@ struct cfg80211_ops {
        int     (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
                                enum nl80211_tx_power_setting type, int mbm);
        int     (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
-                               int *dbm);
+                               unsigned int link_id, int *dbm);
 
        void    (*rfkill_poll)(struct wiphy *wiphy);
 
index 61a824ec33da356a9d2c4c99a5507b340bbf909e..b2410a91355605f017c49fd5f3a73b8a829924e0 100644 (file)
@@ -3190,6 +3190,7 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
 
 static int ieee80211_get_tx_power(struct wiphy *wiphy,
                                  struct wireless_dev *wdev,
+                                 unsigned int link_id,
                                  int *dbm)
 {
        struct ieee80211_local *local = wiphy_priv(wiphy);
index 9590f9bd2ec0c8d5f80278da5988727eeb194bb6..793d910347e3b5dde0509b83478c6876982d777d 100644 (file)
@@ -3980,10 +3980,10 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
                        goto nla_put_failure;
        }
 
-       if (rdev->ops->get_tx_power) {
+       if (rdev->ops->get_tx_power && !wdev->valid_links) {
                int dbm, ret;
 
-               ret = rdev_get_tx_power(rdev, wdev, &dbm);
+               ret = rdev_get_tx_power(rdev, wdev, 0, &dbm);
                if (ret == 0 &&
                    nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
                                DBM_TO_MBM(dbm)))
@@ -4052,6 +4052,15 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
                        if (ret == 0 && nl80211_send_chandef(msg, &chandef))
                                goto nla_put_failure;
 
+                       if (rdev->ops->get_tx_power) {
+                               int dbm, ret;
+
+                               ret = rdev_get_tx_power(rdev, wdev, link_id, &dbm);
+                               if (ret == 0 &&
+                                   nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
+                                               DBM_TO_MBM(dbm)))
+                                       goto nla_put_failure;
+                       }
                        nla_nest_end(msg, link);
                }
 
index adb6105bbb7d1d0a7a097a120c2a121121bf3f24..8f2aa7e76c0a63726005e4fc26944203b5837549 100644 (file)
@@ -600,11 +600,12 @@ static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
 }
 
 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
-                                   struct wireless_dev *wdev, int *dbm)
+                                   struct wireless_dev *wdev, unsigned int link_id,
+                                   int *dbm)
 {
        int ret;
-       trace_rdev_get_tx_power(&rdev->wiphy, wdev);
-       ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
+       trace_rdev_get_tx_power(&rdev->wiphy, wdev, link_id);
+       ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, link_id, dbm);
        trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
        return ret;
 }
index d5c9bb614fa6de0bf98605b00f61b4e3b9a689a2..a57210c8087c2f0a22a993b76d8b0a8d57937475 100644 (file)
@@ -1690,9 +1690,28 @@ TRACE_EVENT(rdev_set_wiphy_params,
                  WIPHY_PR_ARG, __entry->changed)
 );
 
-DEFINE_EVENT(wiphy_wdev_evt, rdev_get_tx_power,
-       TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
-       TP_ARGS(wiphy, wdev)
+DECLARE_EVENT_CLASS(wiphy_wdev_link_evt,
+       TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
+                unsigned int link_id),
+       TP_ARGS(wiphy, wdev, link_id),
+       TP_STRUCT__entry(
+               WIPHY_ENTRY
+               WDEV_ENTRY
+               __field(unsigned int, link_id)
+       ),
+       TP_fast_assign(
+               WIPHY_ASSIGN;
+               WDEV_ASSIGN;
+               __entry->link_id = link_id;
+       ),
+       TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", link_id: %u",
+                 WIPHY_PR_ARG, WDEV_PR_ARG, __entry->link_id)
+);
+
+DEFINE_EVENT(wiphy_wdev_link_evt, rdev_get_tx_power,
+       TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
+                unsigned int link_id),
+       TP_ARGS(wiphy, wdev, link_id)
 );
 
 TRACE_EVENT(rdev_set_tx_power,
@@ -2192,25 +2211,6 @@ TRACE_EVENT(rdev_set_noack_map,
        TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", noack_map: %u",
                  WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
 );
-
-DECLARE_EVENT_CLASS(wiphy_wdev_link_evt,
-       TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
-                unsigned int link_id),
-       TP_ARGS(wiphy, wdev, link_id),
-       TP_STRUCT__entry(
-               WIPHY_ENTRY
-               WDEV_ENTRY
-               __field(unsigned int, link_id)
-       ),
-       TP_fast_assign(
-               WIPHY_ASSIGN;
-               WDEV_ASSIGN;
-               __entry->link_id = link_id;
-       ),
-       TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT ", link_id: %u",
-                 WIPHY_PR_ARG, WDEV_PR_ARG, __entry->link_id)
-);
-
 DEFINE_EVENT(wiphy_wdev_link_evt, rdev_get_channel,
        TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
                 unsigned int link_id),
index 687f93664d1f16d334b72b55d34c53d99baa2c6a..a74b1afc594e5e339c63998ea06e37903f80db75 100644 (file)
@@ -910,7 +910,7 @@ static int cfg80211_wext_giwtxpower(struct net_device *dev,
                return -EOPNOTSUPP;
 
        scoped_guard(wiphy, &rdev->wiphy) {
-               err = rdev_get_tx_power(rdev, wdev, &val);
+               err = rdev_get_tx_power(rdev, wdev, 0, &val);
        }
        if (err)
                return err;