nl80211: sched_scan relative RSSI parameters
Add driver interface support to set sched_scan relative RSSI parameters and to indicate driver support for this. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
37e9f511eb
commit
20c846d9ee
3 changed files with 68 additions and 0 deletions
|
@ -495,6 +495,36 @@ struct wpa_driver_scan_params {
|
||||||
*/
|
*/
|
||||||
unsigned int duration_mandatory:1;
|
unsigned int duration_mandatory:1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* relative_rssi_set - Whether relative RSSI parameters are set
|
||||||
|
*/
|
||||||
|
unsigned int relative_rssi_set:1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* relative_rssi - Relative RSSI for reporting better BSSs
|
||||||
|
*
|
||||||
|
* Amount of RSSI by which a BSS should be better than the current
|
||||||
|
* connected BSS to report the new BSS to user space.
|
||||||
|
*/
|
||||||
|
s8 relative_rssi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* relative_adjust_band - Band to which RSSI should be adjusted
|
||||||
|
*
|
||||||
|
* The relative_adjust_rssi should be added to the band specified
|
||||||
|
* by relative_adjust_band.
|
||||||
|
*/
|
||||||
|
enum set_band relative_adjust_band;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* relative_adjust_rssi - RSSI to be added to relative_adjust_band
|
||||||
|
*
|
||||||
|
* An amount of relative_band_rssi should be added to the BSSs that
|
||||||
|
* belong to the band specified by relative_adjust_band while comparing
|
||||||
|
* with other bands for BSS reporting.
|
||||||
|
*/
|
||||||
|
s8 relative_adjust_rssi;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: Whenever adding new parameters here, please make sure
|
* NOTE: Whenever adding new parameters here, please make sure
|
||||||
* wpa_scan_clone_params() and wpa_scan_free_params() get updated with
|
* wpa_scan_clone_params() and wpa_scan_free_params() get updated with
|
||||||
|
@ -1397,6 +1427,8 @@ struct wpa_driver_capa {
|
||||||
#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA 0x0000400000000000ULL
|
#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA 0x0000400000000000ULL
|
||||||
/** Driver supports mgmt_tx with random TX addr in connected state */
|
/** Driver supports mgmt_tx with random TX addr in connected state */
|
||||||
#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED 0x0000800000000000ULL
|
#define WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED 0x0000800000000000ULL
|
||||||
|
/** Driver supports better BSS reporting with sched_scan in connected mode */
|
||||||
|
#define WPA_DRIVER_FLAGS_SCHED_SCAN_RELATIVE_RSSI 0x0001000000000000ULL
|
||||||
u64 flags;
|
u64 flags;
|
||||||
|
|
||||||
#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
|
#define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \
|
||||||
|
|
|
@ -395,6 +395,9 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,
|
||||||
if (ext_feature_isset(ext_features, len,
|
if (ext_feature_isset(ext_features, len,
|
||||||
NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED))
|
NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED))
|
||||||
capa->flags |= WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED;
|
capa->flags |= WPA_DRIVER_FLAGS_MGMT_TX_RANDOM_TA_CONNECTED;
|
||||||
|
if (ext_feature_isset(ext_features, len,
|
||||||
|
NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI))
|
||||||
|
capa->flags |= WPA_DRIVER_FLAGS_SCHED_SCAN_RELATIVE_RSSI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -562,6 +562,39 @@ int wpa_driver_nl80211_sched_scan(void *priv,
|
||||||
nla_nest_end(msg, match_sets);
|
nla_nest_end(msg, match_sets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params->relative_rssi_set) {
|
||||||
|
struct nl80211_bss_select_rssi_adjust rssi_adjust;
|
||||||
|
|
||||||
|
os_memset(&rssi_adjust, 0, sizeof(rssi_adjust));
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: Relative RSSI: %d",
|
||||||
|
params->relative_rssi);
|
||||||
|
if (nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI,
|
||||||
|
params->relative_rssi))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (params->relative_adjust_rssi) {
|
||||||
|
int pref_band_set = 1;
|
||||||
|
|
||||||
|
switch (params->relative_adjust_band) {
|
||||||
|
case WPA_SETBAND_5G:
|
||||||
|
rssi_adjust.band = NL80211_BAND_5GHZ;
|
||||||
|
break;
|
||||||
|
case WPA_SETBAND_2G:
|
||||||
|
rssi_adjust.band = NL80211_BAND_2GHZ;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pref_band_set = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rssi_adjust.delta = params->relative_adjust_rssi;
|
||||||
|
|
||||||
|
if (pref_band_set &&
|
||||||
|
nla_put(msg, NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST,
|
||||||
|
sizeof(rssi_adjust), &rssi_adjust))
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
|
|
||||||
/* TODO: if we get an error here, we should fall back to normal scan */
|
/* TODO: if we get an error here, we should fall back to normal scan */
|
||||||
|
|
Loading…
Reference in a new issue