qcacmn: Check for MAX_AST entries when adding AST entry

check for max_ast entries supported by FW and add the
entry on host accordingly.

Change-Id: Ief70ba631bb41d50c79d3673e3eea0c45b0c1e19
CRs-Fixed: 2355947
This commit is contained in:
Tallapragada Kalyan
2018-12-03 19:29:52 +05:30
committed by nshrivas
parent 9ff4c54c25
commit a702362d34
12 changed files with 49 additions and 10 deletions

View File

@@ -2027,6 +2027,7 @@ void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
/* cdp_peer_map_attach() - CDP API to allocate PEER map memory
* @soc: opaque soc handle
* @max_peers: number of peers created in FW
* @max_ast_index: max number of AST index supported in FW
* @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
*
*
@@ -2034,11 +2035,12 @@ void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
*/
static inline void
cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
bool peer_map_unmap_v2)
uint32_t max_ast_index, bool peer_map_unmap_v2)
{
if (soc && soc->ops && soc->ops->cmn_drv_ops &&
soc->ops->cmn_drv_ops->txrx_peer_map_attach)
soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc, max_peers,
max_ast_index,
peer_map_unmap_v2);
}

View File

@@ -409,6 +409,7 @@ struct cdp_cmn_ops {
QDF_STATUS (*txrx_peer_map_attach)(ol_txrx_soc_handle soc,
uint32_t num_peers,
uint32_t max_ast_index,
bool peer_map_unmap_v2);
void (*txrx_pdev_set_ctrl_pdev)(struct cdp_pdev *pdev_hdl,

View File

@@ -6532,6 +6532,7 @@ dp_print_soc_rx_stats(struct dp_soc *soc)
char rxdma_error[DP_RXDMA_ERR_LENGTH];
uint8_t index = 0;
DP_PRINT_STATS("No of AST Entries = %d", soc->num_ast_entries);
DP_PRINT_STATS("SOC Rx Stats:\n");
DP_PRINT_STATS("Fragmented packets: %u",
soc->stats.rx.rx_frags);
@@ -8990,13 +8991,16 @@ dp_enable_peer_based_pktlog(
static QDF_STATUS dp_peer_map_attach_wifi3(struct cdp_soc_t *soc_hdl,
uint32_t max_peers,
uint32_t max_ast_index,
bool peer_map_unmap_v2)
{
struct dp_soc *soc = (struct dp_soc *)soc_hdl;
soc->max_peers = max_peers;
qdf_print ("%s max_peers %u\n", __func__, max_peers);
qdf_print ("%s max_peers %u, max_ast_index: %u\n",
__func__, max_peers, max_ast_index);
wlan_cfg_set_max_ast_idx(soc->wlan_cfg_ctx, max_ast_index);
if (dp_peer_find_attach(soc))
return QDF_STATUS_E_FAILURE;

View File

@@ -573,6 +573,15 @@ int dp_peer_add_ast(struct dp_soc *soc,
peer->mac_addr.raw, peer, mac_addr);
/* fw supports only 2 times the max_peers ast entries */
if (soc->num_ast_entries >=
wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
qdf_spin_unlock_bh(&soc->ast_lock);
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
FL("Max ast entries reached"));
return ret;
}
/* If AST entry already exists , just return from here
* ast entry with same mac address can exist on different radios
* if ast_override support is enabled use search by pdev in this
@@ -734,6 +743,7 @@ add_ast_entry:
ast_entry->is_active = TRUE;
DP_STATS_INC(soc, ast.added, 1);
soc->num_ast_entries++;
dp_peer_ast_hash_add(soc, ast_entry);
ast_entry->peer = peer;
@@ -815,6 +825,7 @@ void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry)
dp_peer_ast_hash_remove(soc, ast_entry);
dp_peer_ast_cleanup(soc, ast_entry);
qdf_mem_free(ast_entry);
soc->num_ast_entries--;
}
/*
@@ -1044,6 +1055,7 @@ static void dp_peer_ast_free_entry(struct dp_soc *soc,
CDP_TXRX_AST_DELETED);
}
qdf_mem_free(ast_entry);
soc->num_ast_entries--;
}
struct dp_peer *dp_peer_find_hash_find(struct dp_soc *soc,
@@ -1340,7 +1352,8 @@ dp_rx_peer_map_handler(void *soc_handle, uint16_t peer_id,
peer_mac_addr[2], peer_mac_addr[3], peer_mac_addr[4],
peer_mac_addr[5], vdev_id);
if ((hw_peer_id < 0) || (hw_peer_id > (WLAN_UMAC_PSOC_MAX_PEERS * 2))) {
if ((hw_peer_id < 0) ||
(hw_peer_id >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))) {
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"invalid hw_peer_id: %d", hw_peer_id);
qdf_assert_always(0);

View File

@@ -110,7 +110,7 @@ static inline bool dp_rx_mcast_echo_check(struct dp_soc *soc,
sa_idx = hal_rx_msdu_end_sa_idx_get(rx_tlv_hdr);
if ((sa_idx < 0) ||
(sa_idx >= (WLAN_UMAC_PSOC_MAX_PEERS * 2))) {
(sa_idx >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))) {
qdf_spin_unlock_bh(&soc->ast_lock);
QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
"invalid sa_idx: %d", sa_idx);

View File

@@ -93,7 +93,7 @@ dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
cdp_rx_ppdu->lsig_a = ppdu_info->rx_status.rate;
ast_index = ppdu_info->rx_status.ast_index;
if (ast_index >= (WLAN_UMAC_PSOC_MAX_PEERS * 2)) {
if (ast_index >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
cdp_rx_ppdu->peer_id = HTT_INVALID_PEER;
return;
}

View File

@@ -1013,6 +1013,8 @@ struct dp_soc {
uint8_t per_tid_basize_max_tid;
/* Soc level flag to enable da_war */
uint8_t da_war_enabled;
/* number of active ast entries */
uint32_t num_ast_entries;
};
#ifdef IPA_OFFLOAD

View File

@@ -352,6 +352,7 @@ static int init_deinit_ready_event_handler(ol_scn_t scn_handle,
wmi_legacy_service_ready_callback legacy_callback;
uint8_t num_radios, i;
uint32_t max_peers;
uint32_t max_ast_index;
target_resource_config *tgt_cfg;
if (!scn_handle) {
@@ -409,9 +410,10 @@ static int init_deinit_ready_event_handler(ol_scn_t scn_handle,
if (ready_ev.num_total_peer != 0) {
tgt_cfg = &info->wlan_res_cfg;
max_peers = tgt_cfg->num_peers + ready_ev.num_extra_peer + 1;
max_ast_index = ready_ev.max_ast_index + 1;
cdp_peer_map_attach(wlan_psoc_get_dp_handle(psoc), max_peers,
tgt_cfg->peer_map_unmap_v2);
max_ast_index, tgt_cfg->peer_map_unmap_v2);
}
/* Indicate to the waiting thread that the ready

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -411,7 +411,17 @@ void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
{
cfg->max_peer_id = val;;
cfg->max_peer_id = val;
}
void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
{
cfg->max_ast_idx = val;
}
int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
{
return cfg->max_ast_idx;
}
void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,

View File

@@ -1,5 +1,5 @@
/*
* * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
* * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -207,6 +207,7 @@ struct wlan_cfg_dp_soc_ctxt {
bool enable_data_stall_detection;
bool disable_intra_bss_fwd;
bool rxdma1_enable;
int max_ast_idx;
};
/**
@@ -281,7 +282,8 @@ void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
int mask);
void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val);
void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val);
int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg);
int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
int context, int mask);
int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,

View File

@@ -7255,6 +7255,7 @@ struct tbttoffset_params {
* agile DFS, by means of using one 80 MHz radio chain for
* radar detection, concurrently with using another radio
* chain for non-160 MHz regular operation.
* @max_ast_index: Max number of AST entries that FW could allocate.
*/
struct wmi_host_ready_ev_param {
uint32_t status;
@@ -7263,6 +7264,7 @@ struct wmi_host_ready_ev_param {
uint32_t num_total_peer;
uint32_t num_extra_peer;
bool agile_capability;
uint32_t max_ast_index;
};
enum bcn_offload_control_param {

View File

@@ -7972,6 +7972,7 @@ static QDF_STATUS extract_ready_event_params_tlv(wmi_unified_t wmi_handle,
ev_param->num_extra_peer = ev->num_extra_peers;
/* Agile_cap in ready event is not supported in TLV target */
ev_param->agile_capability = false;
ev_param->max_ast_index = ev->max_ast_index;
return QDF_STATUS_SUCCESS;
}