nl80211/cfg80211: add support for non EDCA based ranging measurement
Add support for requesting that the ranging measurement will use the trigger-based / non trigger-based flow instead of the EDCA based flow. Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/20200131111300.891737-2-luca@coelho.fi Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
95247705c4
commit
efb5520d0e
@@ -693,8 +693,14 @@ int wiphy_register(struct wiphy *wiphy)
|
||||
~(BIT(NL80211_PREAMBLE_LEGACY) |
|
||||
BIT(NL80211_PREAMBLE_HT) |
|
||||
BIT(NL80211_PREAMBLE_VHT) |
|
||||
BIT(NL80211_PREAMBLE_HE) |
|
||||
BIT(NL80211_PREAMBLE_DMG))))
|
||||
return -EINVAL;
|
||||
if (WARN_ON((wiphy->pmsr_capa->ftm.trigger_based ||
|
||||
wiphy->pmsr_capa->ftm.non_trigger_based) &&
|
||||
!(wiphy->pmsr_capa->ftm.preambles &
|
||||
BIT(NL80211_PREAMBLE_HE))))
|
||||
return -EINVAL;
|
||||
if (WARN_ON(wiphy->pmsr_capa->ftm.bandwidths &
|
||||
~(BIT(NL80211_CHAN_WIDTH_20_NOHT) |
|
||||
BIT(NL80211_CHAN_WIDTH_20) |
|
||||
|
@@ -276,6 +276,8 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = {
|
||||
[NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES] = { .type = NLA_U8 },
|
||||
[NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI] = { .type = NLA_FLAG },
|
||||
[NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC] = { .type = NLA_FLAG },
|
||||
[NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED] = { .type = NLA_FLAG },
|
||||
[NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED] = { .type = NLA_FLAG },
|
||||
};
|
||||
|
||||
static const struct nla_policy
|
||||
@@ -1885,6 +1887,12 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap,
|
||||
nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
|
||||
cap->ftm.max_ftms_per_burst))
|
||||
return -ENOBUFS;
|
||||
if (cap->ftm.trigger_based &&
|
||||
nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_TRIGGER_BASED))
|
||||
return -ENOBUFS;
|
||||
if (cap->ftm.non_trigger_based &&
|
||||
nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_NON_TRIGGER_BASED))
|
||||
return -ENOBUFS;
|
||||
|
||||
nla_nest_end(msg, ftm);
|
||||
return 0;
|
||||
|
@@ -126,6 +126,38 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev,
|
||||
"FTM: civic location request not supported");
|
||||
}
|
||||
|
||||
out->ftm.trigger_based =
|
||||
!!tb[NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED];
|
||||
if (out->ftm.trigger_based && !capa->ftm.trigger_based) {
|
||||
NL_SET_ERR_MSG_ATTR(info->extack,
|
||||
tb[NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED],
|
||||
"FTM: trigger based ranging is not supported");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
out->ftm.non_trigger_based =
|
||||
!!tb[NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED];
|
||||
if (out->ftm.non_trigger_based && !capa->ftm.non_trigger_based) {
|
||||
NL_SET_ERR_MSG_ATTR(info->extack,
|
||||
tb[NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED],
|
||||
"FTM: trigger based ranging is not supported");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (out->ftm.trigger_based && out->ftm.non_trigger_based) {
|
||||
NL_SET_ERR_MSG(info->extack,
|
||||
"FTM: can't set both trigger based and non trigger based");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((out->ftm.trigger_based || out->ftm.non_trigger_based) &&
|
||||
out->ftm.preamble != NL80211_PREAMBLE_HE) {
|
||||
NL_SET_ERR_MSG_ATTR(info->extack,
|
||||
tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE],
|
||||
"FTM: non EDCA based ranging must use HE preamble");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user