Commit 2af3b2a6 authored by Jaewan Kim's avatar Jaewan Kim Committed by Johannes Berg

mac80211_hwsim: add PMSR report support via virtio

PMSR (a.k.a. peer measurement) is generalized measurement between two
devices with Wi-Fi support. And currently FTM (a.k.a. fine time measurement
or flight time measurement) is the one and only measurement.

Add the necessary functionality to allow mac80211_hwsim to report PMSR
result. The result would come from the wmediumd, where other Wi-Fi
devices' information are kept. mac80211_hwsim only need to deliver the
result to the userspace.

In detail, add new mac80211_hwsim attributes HWSIM_CMD_REPORT_PMSR, and
HWSIM_ATTR_PMSR_RESULT. When mac80211_hwsim receives the PMSR result with
command HWSIM_CMD_REPORT_PMSR and detail with attribute
HWSIM_ATTR_PMSR_RESULT, received data is parsed to cfg80211_pmsr_result and
resent to the userspace by cfg80211_pmsr_report().

To help receive the details of PMSR result, hwsim_rate_info_attributes is
added to receive rate_info without complex bitrate calculation. (i.e. send
rate_info without adding inverse of nl80211_put_sta_rate()).
Signed-off-by: default avatarJaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230322131637.2633968-6-jaewan@google.com
[fix uninitialized return value when there are no reports]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8ba1da95
......@@ -82,8 +82,8 @@ enum hwsim_tx_control_flags {
* @HWSIM_CMD_DEL_MAC_ADDR: remove the MAC address again, the attributes
* are the same as to @HWSIM_CMD_ADD_MAC_ADDR.
* @HWSIM_CMD_START_PMSR: request to start peer measurement with the
* %HWSIM_ATTR_PMSR_REQUEST.
* @HWSIM_CMD_ABORT_PMSR: abort previously sent peer measurement
* %HWSIM_ATTR_PMSR_REQUEST. Result will be sent back asynchronously
* with %HWSIM_CMD_REPORT_PMSR.
* @__HWSIM_CMD_MAX: enum limit
*/
enum {
......@@ -98,6 +98,7 @@ enum {
HWSIM_CMD_DEL_MAC_ADDR,
HWSIM_CMD_START_PMSR,
HWSIM_CMD_ABORT_PMSR,
HWSIM_CMD_REPORT_PMSR,
__HWSIM_CMD_MAX,
};
#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
......@@ -151,6 +152,8 @@ enum {
* to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
* @HWSIM_ATTR_PMSR_REQUEST: nested attribute used with %HWSIM_CMD_START_PMSR
* to provide details about peer measurement request (nl80211_peer_measurement_attrs)
* @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR
* to provide peer measurement result (nl80211_peer_measurement_attrs)
* @__HWSIM_ATTR_MAX: enum limit
*/
......@@ -184,6 +187,7 @@ enum {
HWSIM_ATTR_MLO_SUPPORT,
HWSIM_ATTR_PMSR_SUPPORT,
HWSIM_ATTR_PMSR_REQUEST,
HWSIM_ATTR_PMSR_RESULT,
__HWSIM_ATTR_MAX,
};
#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
......@@ -288,4 +292,47 @@ enum {
HWSIM_VQ_RX,
HWSIM_NUM_VQS,
};
/**
* enum hwsim_rate_info -- bitrate information.
*
* Information about a receiving or transmitting bitrate
* that can be mapped to struct rate_info
*
* @HWSIM_RATE_INFO_ATTR_FLAGS: bitflag of flags from &enum rate_info_flags
* @HWSIM_RATE_INFO_ATTR_MCS: mcs index if struct describes an HT/VHT/HE rate
* @HWSIM_RATE_INFO_ATTR_LEGACY: bitrate in 100kbit/s for 802.11abg
* @HWSIM_RATE_INFO_ATTR_NSS: number of streams (VHT & HE only)
* @HWSIM_RATE_INFO_ATTR_BW: bandwidth (from &enum rate_info_bw)
* @HWSIM_RATE_INFO_ATTR_HE_GI: HE guard interval (from &enum nl80211_he_gi)
* @HWSIM_RATE_INFO_ATTR_HE_DCM: HE DCM value
* @HWSIM_RATE_INFO_ATTR_HE_RU_ALLOC: HE RU allocation (from &enum nl80211_he_ru_alloc,
* only valid if bw is %RATE_INFO_BW_HE_RU)
* @HWSIM_RATE_INFO_ATTR_N_BOUNDED_CH: In case of EDMG the number of bonded channels (1-4)
* @HWSIM_RATE_INFO_ATTR_EHT_GI: EHT guard interval (from &enum nl80211_eht_gi)
* @HWSIM_RATE_INFO_ATTR_EHT_RU_ALLOC: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
* only valid if bw is %RATE_INFO_BW_EHT_RU)
* @NUM_HWSIM_RATE_INFO_ATTRS: internal
* @HWSIM_RATE_INFO_ATTR_MAX: highest attribute number
*/
enum hwsim_rate_info_attributes {
__HWSIM_RATE_INFO_ATTR_INVALID,
HWSIM_RATE_INFO_ATTR_FLAGS,
HWSIM_RATE_INFO_ATTR_MCS,
HWSIM_RATE_INFO_ATTR_LEGACY,
HWSIM_RATE_INFO_ATTR_NSS,
HWSIM_RATE_INFO_ATTR_BW,
HWSIM_RATE_INFO_ATTR_HE_GI,
HWSIM_RATE_INFO_ATTR_HE_DCM,
HWSIM_RATE_INFO_ATTR_HE_RU_ALLOC,
HWSIM_RATE_INFO_ATTR_N_BOUNDED_CH,
HWSIM_RATE_INFO_ATTR_EHT_GI,
HWSIM_RATE_INFO_ATTR_EHT_RU_ALLOC,
/* keep last */
NUM_HWSIM_RATE_INFO_ATTRS,
HWSIM_RATE_INFO_ATTR_MAX = NUM_HWSIM_RATE_INFO_ATTRS - 1
};
#endif /* __MAC80211_HWSIM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment