From 89a6c08c9b7d33ea9d3a57870efd9dcbba23c631 Mon Sep 17 00:00:00 2001 From: Radha Krishna Simha Jiguru Date: Fri, 7 Feb 2020 16:16:12 +0530 Subject: [PATCH] qcacmn: Avoid entry free only based on WDS feature flag Allow AST entry deletion from del_ast call for HTT V1 cases Change-Id: If7cd1dfe59680b29c8664a460a236e608c00b158 --- dp/wifi3.0/dp_main.c | 6 +----- dp/wifi3.0/dp_peer.c | 35 +++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index ca7e95e9c827..7ee0b6f6b2ad 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -6301,7 +6301,6 @@ void dp_peer_unref_delete(struct dp_peer *peer) struct cdp_peer_cookie peer_cookie; enum wlan_op_mode vdev_opmode; uint8_t vdev_mac_addr[QDF_MAC_ADDR_SIZE]; - struct dp_ast_entry *peer_ast_entry = NULL; /* * Hold the lock all the way from checking if the peer ref count @@ -6333,10 +6332,7 @@ void dp_peer_unref_delete(struct dp_peer *peer) qdf_spin_lock_bh(&soc->ast_lock); if (peer->self_ast_entry) { - peer_ast_entry = peer->self_ast_entry; - dp_peer_unlink_ast_entry(soc, peer_ast_entry); - dp_peer_free_ast_entry(soc, peer_ast_entry); - peer->self_ast_entry = NULL; + dp_peer_del_ast(soc, peer->self_ast_entry); } qdf_spin_unlock_bh(&soc->ast_lock); diff --git a/dp/wifi3.0/dp_peer.c b/dp/wifi3.0/dp_peer.c index f8b9123b504d..7fc3acc9087e 100644 --- a/dp/wifi3.0/dp_peer.c +++ b/dp/wifi3.0/dp_peer.c @@ -34,6 +34,34 @@ #include "dp_tx_capture.h" #endif +#ifdef FEATURE_WDS +static inline bool +dp_peer_ast_free_in_unmap_supported(struct dp_peer *peer, + struct dp_ast_entry *ast_entry) +{ + /* if peer map v2 is enabled we are not freeing ast entry + * here and it is supposed to be freed in unmap event (after + * we receive delete confirmation from target) + * + * if peer_id is invalid we did not get the peer map event + * for the peer free ast entry from here only in this case + */ + + if ((ast_entry->type != CDP_TXRX_AST_TYPE_WDS_HM_SEC) && + (ast_entry->type != CDP_TXRX_AST_TYPE_SELF)) + return true; + + return false; +} +#else +static inline bool +dp_peer_ast_free_in_unmap_supported(struct dp_peer *peer, + struct dp_ast_entry *ast_entry) +{ + return false; +} +#endif + static inline void dp_set_ssn_valid_flag(struct hal_reo_cmd_params *params, uint8_t valid) @@ -935,12 +963,7 @@ void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry) * if peer_id is invalid we did not get the peer map event * for the peer free ast entry from here only in this case */ - - /* For HM_SEC and SELF type we do not receive unmap event - * free ast_entry from here it self - */ - if ((ast_entry->type != CDP_TXRX_AST_TYPE_WDS_HM_SEC) && - (ast_entry->type != CDP_TXRX_AST_TYPE_SELF)) + if (dp_peer_ast_free_in_unmap_supported(peer, ast_entry)) return; /* for WDS secondary entry ast_entry->next_hop would be set so