Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Merge commit '9aef3a0f5affefc753e64bcba22fa3cc2f713974' into rcu11
Browse files Browse the repository at this point in the history
  • Loading branch information
ppajda committed Nov 27, 2021
2 parents ba6e428 + 9aef3a0 commit 7113cbb
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/qca-wifi-host-cmn/hal/wifi3.0/hal_srng.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ static void hal_reg_write_enqueue(struct hal_soc *hal_soc,
uint32_t write_idx;

if (srng->reg_write_in_progress) {
hal_verbose_debug("Already in progress srng ring id 0x%x addr 0x%x val %u",
hal_verbose_debug("Already in progress srng ring id 0x%x addr 0x%pK val %u",
srng->ring_id, addr, value);
qdf_atomic_inc(&hal_soc->stats.wstats.coalesces);
srng->wstats.coalesces++;
Expand Down Expand Up @@ -715,7 +715,7 @@ static void hal_reg_write_enqueue(struct hal_soc *hal_soc,
srng->reg_write_in_progress = true;
qdf_atomic_inc(&hal_soc->active_work_cnt);

hal_verbose_debug("write_idx %u srng ring id 0x%x addr 0x%x val %u",
hal_verbose_debug("write_idx %u srng ring id 0x%x addr 0x%pK val %u",
write_idx, srng->ring_id, addr, value);

qdf_queue_work(hal_soc->qdf_dev, hal_soc->reg_write_wq,
Expand Down
12 changes: 12 additions & 0 deletions drivers/staging/qca-wifi-host-cmn/hif/inc/hif.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ enum hif_event_type {
HIF_EVENT_BH_SCHED,
HIF_EVENT_SRNG_ACCESS_START,
HIF_EVENT_SRNG_ACCESS_END,
/* Do check hif_hist_skip_event_record when adding new events */
};

/**
Expand Down Expand Up @@ -368,6 +369,16 @@ struct hif_event_record {
enum hif_event_type type;
};

/**
* struct hif_event_misc - history related misc info
* @last_irq_index: last irq event index in history
* @last_irq_ts: last irq timestamp
*/
struct hif_event_misc {
int32_t last_irq_index;
uint64_t last_irq_ts;
};

/**
* struct hif_event_history - history for one interrupt group
* @index: index to store new event
Expand All @@ -378,6 +389,7 @@ struct hif_event_record {
*/
struct hif_event_history {
qdf_atomic_t index;
struct hif_event_misc misc;
struct hif_event_record event[HIF_EVENT_HIST_MAX];
};

Expand Down
1 change: 1 addition & 0 deletions drivers/staging/qca-wifi-host-cmn/hif/src/ce/ce_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ struct hif_ce_desc_event {
int index;
enum hif_ce_event_type type;
uint64_t time;
int cpu_id;
#ifdef HELIUMPLUS
union ce_desc descriptor;
#else
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/qca-wifi-host-cmn/hif/src/ce/ce_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void hif_record_ce_desc_event(struct hif_softc *scn, int ce_id,

event->type = type;
event->time = qdf_get_log_timestamp();
event->cpu_id = qdf_get_cpu();

if (descriptor)
qdf_mem_copy(&event->descriptor, descriptor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void hif_record_ce_srng_desc_event(struct hif_softc *scn, int ce_id,

event->type = type;
event->time = qdf_get_log_timestamp();
event->cpu_id = qdf_get_cpu();

if (descriptor)
qdf_mem_copy(&event->descriptor, descriptor,
Expand Down
91 changes: 91 additions & 0 deletions drivers/staging/qca-wifi-host-cmn/hif/src/hif_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,89 @@ int hif_get_next_record_index(qdf_atomic_t *table_index,
return record_index & (array_size - 1);
}

/**
* hif_hist_is_prev_record() - Check if index is the immediate
* previous record wrt curr_index
* @curr_index: curr index in the event history
* @index: index to be checked
* @hist_size: history size
*
* Return: true if index is immediately behind curr_index else false
*/
static inline
bool hif_hist_is_prev_record(int32_t curr_index, int32_t index,
uint32_t hist_size)
{
return (((index + 1) & (hist_size - 1)) == curr_index) ?
true : false;
}

/**
* hif_hist_skip_event_record() - Check if current event needs to be
* recorded or not
* @hist_ev: HIF event history
* @event: DP event entry
*
* Return: true if current event needs to be skipped else false
*/
static bool
hif_hist_skip_event_record(struct hif_event_history *hist_ev,
struct hif_event_record *event)
{
struct hif_event_record *rec;
struct hif_event_record *last_irq_rec;
int32_t index;

index = qdf_atomic_read(&hist_ev->index);
if (index < 0)
return false;

index &= (HIF_EVENT_HIST_MAX - 1);
rec = &hist_ev->event[index];

switch (event->type) {
case HIF_EVENT_IRQ_TRIGGER:
/*
* The prev record check is to prevent skipping the IRQ event
* record in case where BH got re-scheduled due to force_break
* but there are no entries to be reaped in the rings.
*/
if (rec->type == HIF_EVENT_BH_SCHED &&
hif_hist_is_prev_record(index,
hist_ev->misc.last_irq_index,
HIF_EVENT_HIST_MAX)) {
last_irq_rec =
&hist_ev->event[hist_ev->misc.last_irq_index];
last_irq_rec->timestamp = qdf_get_log_timestamp();
last_irq_rec->cpu_id = qdf_get_cpu();
last_irq_rec->hp++;
last_irq_rec->tp = last_irq_rec->timestamp -
hist_ev->misc.last_irq_ts;
return true;
}
break;
case HIF_EVENT_BH_SCHED:
if (rec->type == HIF_EVENT_BH_SCHED) {
rec->timestamp = qdf_get_log_timestamp();
rec->cpu_id = qdf_get_cpu();
return true;
}
break;
case HIF_EVENT_SRNG_ACCESS_START:
if (event->hp == event->tp)
return true;
break;
case HIF_EVENT_SRNG_ACCESS_END:
if (rec->type != HIF_EVENT_SRNG_ACCESS_START)
return true;
break;
default:
break;
}

return false;
}

void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
struct hif_event_record *event, uint8_t intr_grp_id)
{
Expand All @@ -67,11 +150,19 @@ void hif_hist_record_event(struct hif_opaque_softc *hif_ctx,
hif_ext_group = hif_state->hif_ext_group[intr_grp_id];
hist_ev = hif_ext_group->evt_hist;

if (hif_hist_skip_event_record(hist_ev, event))
return;

record_index = hif_get_next_record_index(
&hist_ev->index, HIF_EVENT_HIST_MAX);

record = &hist_ev->event[record_index];

if (event->type == HIF_EVENT_IRQ_TRIGGER) {
hist_ev->misc.last_irq_index = record_index;
hist_ev->misc.last_irq_ts = qdf_get_log_timestamp();
}

record->hal_ring_id = event->hal_ring_id;
record->hp = event->hp;
record->tp = event->tp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,16 @@ bool wlan_crypto_check_wpa_match(struct wlan_objmgr_psoc *psoc,
uint16_t ie_len, struct wlan_crypto_params *
peer_crypto_params);

/**
* wlan_crypto_parse_rsnxe_ie() - parse RSNXE IE
* @rsnxe_ie: RSNXE IE pointer
* @cap_len: pointer to hold len of ext capability
*
* Return: pointer to RSNXE capability or NULL
*/
uint8_t *
wlan_crypto_parse_rsnxe_ie(uint8_t *rsnxe_ie, uint8_t *cap_len);

/**
* wlan_set_vdev_crypto_prarams_from_ie - Sets vdev crypto params from IE info
* @vdev: vdev pointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ typedef enum wlan_crypto_rsn_cap {
WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED = 0x40,
} wlan_crypto_rsn_cap;

enum wlan_crypto_rsnx_cap {
WLAN_CRYPTO_RSNX_CAP_PROTECTED_TWT = 0x10,
WLAN_CRYPTO_RSNX_CAP_SAE_H2E = 0x20,
WLAN_CRYPTO_RSNX_CAP_SAE_PK = 0x40,
};

typedef enum wlan_crypto_key_mgmt {
WLAN_CRYPTO_KEY_MGMT_IEEE8021X = 0,
WLAN_CRYPTO_KEY_MGMT_PSK = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4064,6 +4064,27 @@ wlan_crypto_reset_prarams(struct wlan_crypto_params *params)
params->rsn_caps = 0;
}

uint8_t *
wlan_crypto_parse_rsnxe_ie(uint8_t *rsnxe_ie, uint8_t *cap_len)
{
uint8_t len;
uint8_t *ie;

if (!rsnxe_ie)
return NULL;

ie = rsnxe_ie;
len = ie[1];
ie += 2;

if (!len)
return NULL;

*cap_len = ie[0] & 0xf;

return ie;
}

QDF_STATUS wlan_set_vdev_crypto_prarams_from_ie(struct wlan_objmgr_vdev *vdev,
uint8_t *ie_ptr,
uint16_t ie_len)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "wlan_policy_mgr_api.h"
#endif
#include "wlan_reg_services_api.h"
#include "wlan_crypto_global_api.h"

#define SCM_20MHZ_BW_INDEX 0
#define SCM_40MHZ_BW_INDEX 1
Expand Down Expand Up @@ -671,6 +672,36 @@ static uint32_t scm_get_sta_nss(struct wlan_objmgr_psoc *psoc,
}
#endif

/**
* scm_calculate_sae_pk_ap_weightage() - Calculate SAE-PK AP weightage
* @entry: bss entry
* @score_params: bss score params
* @sae_pk_cap_present: sae_pk cap presetn in RSNXE capability field
*
* Return: SAE-PK AP weightage score
*/
static uint32_t
scm_calculate_sae_pk_ap_weightage(struct scan_cache_entry *entry,
struct scoring_config *score_params,
bool *sae_pk_cap_present)
{
uint8_t *rsnxe_ie, *rsnxe_cap, cap_len;

rsnxe_ie = util_scan_entry_rsnxe(entry);

rsnxe_cap = wlan_crypto_parse_rsnxe_ie(rsnxe_ie, &cap_len);

if (!rsnxe_cap)
return 0;

*sae_pk_cap_present = *rsnxe_cap & WLAN_CRYPTO_RSNX_CAP_SAE_PK;
if (*sae_pk_cap_present)
return score_params->weight_cfg.sae_pk_ap_weightage *
MAX_INDEX_SCORE;

return 0;
}

int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
struct scan_default_params *params,
struct scan_cache_entry *entry,
Expand All @@ -695,6 +726,8 @@ int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
int8_t rssi_pref_5g_rssi_thresh;
bool same_bucket = false;
bool ap_su_beam_former = false;
uint32_t sae_pk_score = 0;
bool sae_pk_cap_present = 0;
struct wlan_ie_vhtcaps *vht_cap;
struct scoring_config *score_config;
struct weight_config *weight_config;
Expand Down Expand Up @@ -805,6 +838,10 @@ int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
score += oce_wan_score;
}

sae_pk_score = scm_calculate_sae_pk_ap_weightage(entry, score_config,
&sae_pk_cap_present);
score += sae_pk_score;

pdev = wlan_objmgr_get_pdev_by_id(psoc, entry->pdev_id, WLAN_SCAN_ID);
if (!pdev) {
scm_err("pdev is NULL");
Expand Down Expand Up @@ -834,20 +871,21 @@ int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
score_config->beamformee_cap, score_config->cb_mode_24G,
score_config->cb_mode_5G, sta_nss);

scm_nofl_debug("Candidate("QDF_MAC_ADDR_FMT" freq %d): rssi %d HT %d VHT %d HE %d su bfer %d phy %d air time frac %d qbss %d cong_pct %d NSS %d",
scm_nofl_debug("Candidate("QDF_MAC_ADDR_FMT" freq %d): rssi %d HT %d VHT %d HE %d su bfer %d phy %d air time frac %d qbss %d cong_pct %d NSS %d sae_pk_cap_present %d",
QDF_MAC_ADDR_REF(entry->bssid.bytes),
entry->channel.chan_freq,
entry->rssi_raw, util_scan_entry_htcap(entry) ? 1 : 0,
util_scan_entry_vhtcap(entry) ? 1 : 0,
util_scan_entry_hecap(entry) ? 1 : 0, ap_su_beam_former,
entry->phy_mode, entry->air_time_fraction,
entry->qbss_chan_load, congestion_pct, entry->nss);
entry->qbss_chan_load, congestion_pct, entry->nss,
sae_pk_cap_present);

scm_nofl_debug("Scores: prorated_pcnt %d rssi %d pcl %d ht %d vht %d he %d bfee %d bw %d band %d congestion %d nss %d oce wan %d TOTAL %d",
scm_nofl_debug("Scores: prorated_pcnt %d rssi %d pcl %d ht %d vht %d he %d bfee %d bw %d band %d congestion %d nss %d oce wan %d sae_pk %d TOTAL %d",
prorated_pcnt, rssi_score, pcl_score, ht_score,
vht_score, he_score, beamformee_score, bandwidth_score,
band_score, congestion_score, nss_score, oce_wan_score,
score);
sae_pk_score, score);

entry->bss_score = score;
return score;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typedef uint32_t wlan_scan_id;
#define BEST_CANDIDATE_MAX_WEIGHT 100
#define MAX_INDEX_SCORE 100
#define MAX_INDEX_PER_INI 4
#define SAE_PK_AP_WEIGHTAGE 3

#define WLAN_GET_BITS(_val, _index, _num_bits) \
(((_val) >> (_index)) & ((1 << (_num_bits)) - 1))
Expand Down Expand Up @@ -162,6 +163,7 @@ struct element_info {
* @rnrie: reduced neighbor report IE
* @adaptive_11r: pointer to adaptive 11r IE
* @single_pmk: Pointer to sae single pmk IE
* @rsnxe: Pointer to rsnxe IE
*/
struct ie_list {
uint8_t *tim;
Expand Down Expand Up @@ -214,6 +216,7 @@ struct ie_list {
uint8_t *extender;
uint8_t *adaptive_11r;
uint8_t *single_pmk;
uint8_t *rsnxe;
};

enum scan_entry_connection_state {
Expand Down Expand Up @@ -480,6 +483,7 @@ struct scan_cache_entry {
* @pcl_weightage: PCL weightage
* @channel_congestion_weightage: channel congestion weightage
* @oce_wan_weightage: OCE WAN metrics weightage
* @sae_pk_ap_weightage: SAE-PK AP weigtage
*/
struct weight_config {
uint8_t rssi_weightage;
Expand All @@ -493,6 +497,7 @@ struct weight_config {
uint8_t pcl_weightage;
uint8_t channel_congestion_weightage;
uint8_t oce_wan_weightage;
uint8_t sae_pk_ap_weightage;
};

/**
Expand Down
Loading

0 comments on commit 7113cbb

Please sign in to comment.