qcacmn: add a flag in AST entry to indicate AST map

Add a flag for AST entry to indicate if AST entry is
mapped to AST table and use this flag while dereferncing
ast table with ast_index in ast_entry

Change-Id: I8c90f3c40116e24303aac8a7bd53e8f5b67e22bf
This commit is contained in:
Chaithanya Garrepalli 2018-10-18 00:14:11 +05:30 • committed by nshrivas
commit e10f87bd41
4 changed files with 20 additions and 11 deletions

View file

@ -466,6 +466,7 @@ static inline void dp_peer_map_ast(struct dp_soc *soc,
ast_entry->is_active = TRUE;
peer_type = ast_entry->type;
ast_entry->ast_hash_value = ast_hash;
ast_entry->is_mapped = TRUE;
}
if (ast_entry || (peer->vdev && peer->vdev->proxysta_vdev)) {
@ -574,7 +575,7 @@ add_ast_entry:
ast_entry->peer = peer;
ast_entry->pdev_id = vdev->pdev->pdev_id;
ast_entry->vdev_id = vdev->vdev_id;
ast_entry->ast_idx = DP_INVALID_AST_IDX;
ast_entry->is_mapped = false;
switch (type) {
case CDP_TXRX_AST_TYPE_STATIC:
@ -649,10 +650,10 @@ void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry)
dp_peer_ast_send_wds_del(soc, ast_entry);
} else {
/*
* For TYPE_SELF (STA mode), no T2H_PEER_MAP message to map
* the peer, hence no need to clear ast_table here.
* release the reference only if it is mapped
* to ast_table
*/
if (ast_entry->type != CDP_TXRX_AST_TYPE_SELF)
if (ast_entry->is_mapped)
soc->ast_table[ast_entry->ast_idx] = NULL;
TAILQ_REMOVE(&peer->ast_entry_list, ast_entry, ase_list_elem);
@ -686,10 +687,10 @@ void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry)
ast_entry->mac_addr.raw);
/*
* For TYPE_SELF (STA mode), no T2H_PEER_MAP message to map the peer,
* hence no need to clear ast_table here.
* release the reference only if it is mapped
* to ast_table
*/
if (ast_entry->type != CDP_TXRX_AST_TYPE_SELF)
if (ast_entry->is_mapped)
soc->ast_table[ast_entry->ast_idx] = NULL;
TAILQ_REMOVE(&peer->ast_entry_list, ast_entry, ase_list_elem);
@ -903,7 +904,12 @@ void dp_peer_ast_free_entry(struct dp_soc *soc,
{
struct dp_peer *peer = ast_entry->peer;
soc->ast_table[ast_entry->ast_idx] = NULL;
/*
* release the reference only if it is mapped
* to ast_table
*/
if (ast_entry->is_mapped)
soc->ast_table[ast_entry->ast_idx] = NULL;
TAILQ_REMOVE(&peer->ast_entry_list, ast_entry, ase_list_elem);
DP_STATS_INC(soc, ast.deleted, 1);
dp_peer_ast_hash_remove(soc, ast_entry);

View file

@ -479,7 +479,7 @@ dp_rx_wds_srcport_learn(struct dp_soc *soc,
* There is a possibility we might arrive here without
* AST MAP event , so this check is mandatory
*/
if (ast->ast_idx == sa_idx)
if (ast->is_mapped && (ast->ast_idx == sa_idx))
ast->is_active = TRUE;
if (sa_sw_peer_id != ta_peer->peer_ids[0]) {
@ -743,7 +743,7 @@ static inline QDF_STATUS dp_rx_ast_set_active(struct dp_soc *soc, uint16_t sa_id
* There is a possibility we might arrive here without
* AST MAP event , so this check is mandatory
*/
if (ast && (ast->ast_idx == sa_idx)) {
if (ast && ast->is_mapped && (ast->ast_idx == sa_idx)) {
ast->is_active = is_active;
qdf_spin_unlock_bh(&soc->ast_lock);
return QDF_STATUS_SUCCESS;

View file

@ -132,6 +132,7 @@ static inline bool dp_rx_mcast_echo_check(struct dp_soc *soc,
if (ase) {
ase->ast_idx = sa_idx;
soc->ast_table[sa_idx] = ase;
ase->is_mapped = TRUE;
}
}
} else

View file

@ -636,7 +636,6 @@ union dp_align_mac_addr {
} align4_2;
};
#define DP_INVALID_AST_IDX 0xFFFF
/*
* dp_ast_entry
*
@ -649,6 +648,8 @@ union dp_align_mac_addr {
* (used for aging out/expiry)
* @ase_list_elem: node in peer AST list
* @is_bss: flag to indicate if entry corresponds to bss peer
* @is_mapped: flag to indicate that we have mapped the AST entry
* in ast_table
* @pdev_id: pdev ID
* @vdev_id: vdev ID
* @ast_hash_value: hast value in HW
@ -666,6 +667,7 @@ struct dp_ast_entry {
bool next_hop;
bool is_active;
bool is_bss;
bool is_mapped;
uint8_t pdev_id;
uint8_t vdev_id;
uint16_t ast_hash_value;