]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: Set RTS threshold on per-radio basis
authorRoopni Devanathan <quic_rdevanat@quicinc.com>
Sun, 15 Jun 2025 08:23:12 +0000 (13:53 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 24 Jun 2025 13:19:27 +0000 (15:19 +0200)
Add support to get the radio for which RTS threshold needs to be changed
from userspace. Pass on this radio index to underlying drivers as an
additional argument.

A value of -1 indicates radio index is not mentioned and that the
configuration applies to all radio(s) of the wiphy.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
Link: https://patch.msgid.link/20250615082312.619639-5-quic_rdevanat@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c
net/mac80211/util.c

index 72cecc304658aff955727aad1cd9ba820a4f1c76..cc366d79d49a7c52ebc88bd7a322f663c9108ff8 100644 (file)
@@ -3077,8 +3077,15 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, int radio_idx,
        }
 
        if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
-               err = drv_set_rts_threshold(local, radio_idx,
-                                           wiphy->rts_threshold);
+               u32 rts_threshold;
+
+               if ((radio_idx == -1) || (radio_idx >= wiphy->n_radio))
+                       rts_threshold = wiphy->rts_threshold;
+               else
+                       rts_threshold =
+                               wiphy->radio_cfg[radio_idx].rts_threshold;
+
+               err = drv_set_rts_threshold(local, radio_idx, rts_threshold);
 
                if (err)
                        return err;
index 773c8da0acc97eaa1542ed6f2a6a2f4a2e1ef10a..c0ebf61da40ffc920ac7048e01c23f2799433312 100644 (file)
@@ -1756,6 +1756,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
        bool sched_scan_stopped = false;
        bool suspended = local->suspended;
        bool in_reconfig = false;
+       u32 rts_threshold;
 
        lockdep_assert_wiphy(local->hw.wiphy);
 
@@ -1829,7 +1830,14 @@ int ieee80211_reconfig(struct ieee80211_local *local)
        drv_set_frag_threshold(local, -1, hw->wiphy->frag_threshold);
 
        /* setup RTS threshold */
-       drv_set_rts_threshold(local, -1, hw->wiphy->rts_threshold);
+       if (hw->wiphy->n_radio > 0) {
+               for (i = 0; i < hw->wiphy->n_radio; i++) {
+                       rts_threshold = hw->wiphy->radio_cfg[i].rts_threshold;
+                       drv_set_rts_threshold(local, i, rts_threshold);
+               }
+       } else {
+               drv_set_rts_threshold(local, -1, hw->wiphy->rts_threshold);
+       }
 
        /* reset coverage class */
        drv_set_coverage_class(local, -1, hw->wiphy->coverage_class);