qcacmn: Add support to filter Aps based on dot11mode

Add support to filter APs based on dot11mode such
as connect only 11N/11AC/11AX capable APs.

Change-Id: I0046c726d944dd08453c19086282e32d0599ddac
CRs-Fixed: 2769979
This commit is contained in:
gaurank kathpalia
2020-09-01 21:42:37 +05:30
committed by snandini
parent f855cb66d1
commit 59460333ce
2 changed files with 54 additions and 3 deletions

View File

@@ -590,6 +590,41 @@ static inline bool scm_is_fils_config_match(struct scan_filter *filter,
}
#endif
static bool scm_check_dot11mode(struct scan_cache_entry *db_entry,
struct scan_filter *filter)
{
switch (filter->dot11mode) {
case ALLOW_ALL:
break;
case ALLOW_11N_ONLY:
if (!util_scan_entry_htcap(db_entry)) {
scm_debug(QDF_MAC_ADDR_FMT ": Ignore as dot11mode(HT only) didn't match",
QDF_MAC_ADDR_REF(db_entry->bssid.bytes));
return false;
}
break;
case ALLOW_11AC_ONLY:
if (!util_scan_entry_vhtcap(db_entry)) {
scm_debug(QDF_MAC_ADDR_FMT ": Ignore as dot11mode(VHT only) didn't match",
QDF_MAC_ADDR_REF(db_entry->bssid.bytes));
return false;
}
break;
case ALLOW_11AX_ONLY:
if (!util_scan_entry_hecap(db_entry)) {
scm_debug(QDF_MAC_ADDR_FMT ": Ignore as dot11mode(HE only) didn't match",
QDF_MAC_ADDR_REF(db_entry->bssid.bytes));
return false;
}
break;
default:
scm_debug("Invalid dot11mode filter passed %d",
filter->dot11mode);
}
return true;
}
bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
struct scan_cache_entry *db_entry,
struct scan_filter *filter,
@@ -604,6 +639,9 @@ bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
if (!def_param)
return false;
if (filter->dot11mode && !scm_check_dot11mode(db_entry, filter))
return false;
if (filter->age_threshold && filter->age_threshold <
util_scan_entry_age(db_entry))
return false;

View File

@@ -473,6 +473,20 @@ struct fils_filter_info {
struct filter_arg;
typedef struct filter_arg *bss_filter_arg_t;
/**
* enum dot11_mode_filter - Filter APs according to dot11mode
* @ALLOW_ALL: ignore check
* @ALLOW_11N_ONLY: allow only 11n AP
* @ALLOW_11AC_ONLY: allow only 11ac AP
* @ALLOW_11AX_ONLY: allow only 11ax AP
*/
enum dot11_mode_filter {
ALLOW_ALL,
ALLOW_11N_ONLY,
ALLOW_11AC_ONLY,
ALLOW_11AX_ONLY,
};
/**
* struct scan_filter: scan filter
* @enable_adaptive_11r: flag to check if adaptive 11r ini is enabled
@@ -487,8 +501,7 @@ typedef struct filter_arg *bss_filter_arg_t;
* @num_of_ssid: number of ssid
* @num_of_channels: number of channels
* @pmf_cap: Pmf capability
* @dot11_mode: operating modes 0 mean any
* 11a , 11g, 11n , 11ac , 11b etc
* @dot11mode: Filter APs based upon dot11mode
* @band: to get specific band 2.4G, 5G or 4.9 G
* @rssi_threshold: AP having RSSI greater than
* rssi threasholed (ignored if set 0)
@@ -519,7 +532,7 @@ struct scan_filter {
uint8_t num_of_ssid;
uint16_t num_of_channels;
enum wlan_pmf_cap pmf_cap;
enum wlan_phymode dot11_mode;
enum dot11_mode_filter dot11mode;
enum wlan_band band;
uint8_t rssi_threshold;
uint32_t mobility_domain;