]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: nl80211/cfg80211: support operating as RSTA in PMSR FTM request
authorAvraham Stern <avraham.stern@intel.com>
Sun, 11 Jan 2026 17:03:51 +0000 (19:03 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 27 Jan 2026 12:40:38 +0000 (13:40 +0100)
Add an option to operate as the RSTA in an FTM measurement request.
When requested, the device will dwell on the requested channel until
the peer starts the FTM negotiation. This option is only valid for
trigger-based/non trigger-based measurement with LMR feedback which
will allow the RSTA to receive the results of the measurement.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260111190221.1f95fc0afab4.Iae2d32783b8e7c4a29089fec0f4c6bce94d303cc@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/pmsr.c

index 535fd95b0d83ac9b920cab53d4647ad8f48ec7ee..ac7df439bd24102cb77a6506dc4e2f13ec350d5f 100644 (file)
@@ -4312,6 +4312,8 @@ struct cfg80211_pmsr_result {
  *              EDCA based ranging will be used.
  * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
  *              @trigger_based or @non_trigger_based is set.
+ * @rsta: Operate as the RSTA in the measurement. Only valid if @lmr_feedback
+ *     and either @trigger_based or @non_trigger_based is set.
  * @bss_color: the bss color of the responder. Optional. Set to zero to
  *     indicate the driver should set the BSS color. Only valid if
  *     @non_trigger_based or @trigger_based is set.
@@ -4327,7 +4329,8 @@ struct cfg80211_pmsr_ftm_request_peer {
           request_civicloc:1,
           trigger_based:1,
           non_trigger_based:1,
-          lmr_feedback:1;
+          lmr_feedback:1,
+          rsta:1;
        u8 num_bursts_exp;
        u8 burst_duration;
        u8 ftms_per_burst;
@@ -5658,6 +5661,7 @@ cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
  *     (0 means unknown)
  * @ftm.max_total_ltf_rx: maximum total number of LTFs that can be received
  *     (0 means unknown)
+ * @ftm.support_rsta: supports operating as RSTA in PMSR FTM request
  */
 struct cfg80211_pmsr_capabilities {
        unsigned int max_peers;
@@ -5683,6 +5687,7 @@ struct cfg80211_pmsr_capabilities {
                u8 max_rx_sts;
                u8 max_total_ltf_tx;
                u8 max_total_ltf_rx;
+               u8 support_rsta:1;
        } ftm;
 };
 
index 8910b709bfb188a1378e53ae1bf7a5fc6322a086..54ddbd9a5459309930d10c23909c56b5129e028c 100644 (file)
@@ -7812,6 +7812,8 @@ enum nl80211_peer_measurement_attrs {
  *     maximum total number of LTFs the device can receive. The total number
  *     of LTFs is (number of LTF repetitions) * (number of space-time streams).
  *     This limits the allowed combinations of LTF repetitions and STS.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT: flag attribute indicating the
+ *     device supports operating as the RSTA in PMSR FTM request
  *
  * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
  * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
@@ -7836,6 +7838,7 @@ enum nl80211_peer_measurement_ftm_capa {
        NL80211_PMSR_FTM_CAPA_ATTR_MAX_RX_STS,
        NL80211_PMSR_FTM_CAPA_ATTR_MAX_TOTAL_LTF_TX,
        NL80211_PMSR_FTM_CAPA_ATTR_MAX_TOTAL_LTF_RX,
+       NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT,
 
        /* keep last */
        NUM_NL80211_PMSR_FTM_CAPA_ATTR,
@@ -7888,6 +7891,14 @@ enum nl80211_peer_measurement_ftm_capa {
  * @NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR: optional. The BSS color of the
  *     responder. Only valid if %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED
  *     or %NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED is set.
+ * @NL80211_PMSR_FTM_REQ_ATTR_RSTA: optional. Request to perform the measurement
+ *     as the RSTA (flag). When set, the device is expected to dwell on the
+ *     channel specified in %NL80211_PMSR_PEER_ATTR_CHAN until it receives the
+ *     FTM request from the peer or the timeout specified by
+ *     %NL80211_ATTR_TIMEOUT has expired.
+ *     Only valid if %NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK is set (so the
+ *     RSTA will have the measurement results to report back in the FTM
+ *     response).
  *
  * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
  * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
@@ -7908,6 +7919,7 @@ enum nl80211_peer_measurement_ftm_req {
        NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED,
        NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK,
        NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR,
+       NL80211_PMSR_FTM_REQ_ATTR_RSTA,
 
        /* keep last */
        NUM_NL80211_PMSR_FTM_REQ_ATTR,
index 74ea922a5e8a82a2b9d21ee633674cd403a89e8c..85e30fda4c464c07cecbeeba46eac62270b8a3ed 100644 (file)
@@ -361,6 +361,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = {
        [NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED] = { .type = NLA_FLAG },
        [NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK] = { .type = NLA_FLAG },
        [NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR] = { .type = NLA_U8 },
+       [NL80211_PMSR_FTM_REQ_ATTR_RSTA] = { .type = NLA_FLAG },
 };
 
 static const struct nla_policy
@@ -2336,6 +2337,9 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap,
            nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MAX_TOTAL_LTF_RX,
                        cap->ftm.max_total_ltf_rx))
                return -ENOBUFS;
+       if (cap->ftm.support_rsta &&
+           nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT))
+               return -ENOBUFS;
 
        nla_nest_end(msg, ftm);
        return 0;
index d5077d32009808585e2264c96c7de62c85b971f4..60e1e31c21854d8b5c9a94fd6dabb026a7548fd8 100644 (file)
@@ -187,6 +187,21 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev,
                        nla_get_u8(tb[NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR]);
        }
 
+       out->ftm.rsta = !!tb[NL80211_PMSR_FTM_REQ_ATTR_RSTA];
+       if (out->ftm.rsta && !capa->ftm.support_rsta) {
+               NL_SET_ERR_MSG_ATTR(info->extack,
+                                   tb[NL80211_PMSR_FTM_REQ_ATTR_RSTA],
+                                   "FTM: RSTA not supported by device");
+               return -EOPNOTSUPP;
+       }
+
+       if (out->ftm.rsta && !out->ftm.lmr_feedback) {
+               NL_SET_ERR_MSG_ATTR(info->extack,
+                                   tb[NL80211_PMSR_FTM_REQ_ATTR_RSTA],
+                                   "FTM: RSTA set without LMR feedback");
+               return -EINVAL;
+       }
+
        return 0;
 }