From 89219d97b4e472f2aacb54647ae39451a7b76511 Mon Sep 17 00:00:00 2001 From: "Ruchi, Agrawal" Date: Mon, 26 Feb 2018 16:43:06 +0530 Subject: [PATCH] qcacmn: ast entry reset api for son API to reset ast entry for son, ast entry active field will be set on call of reset_api and all the ast entry active field will reset on call of reset_table api, ast_flush api will delete enteries in table Change-Id: I26ed0fff818a112348a7aefba3b028ed40b2fe26 CRs-Fixed: 2209095 --- dp/inc/cdp_txrx_cmn.h | 91 +++++++++++++++++++++++------ dp/inc/cdp_txrx_ops.h | 10 +++- dp/wifi3.0/dp_main.c | 131 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 210 insertions(+), 22 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index e836b1b908..261aba38e1 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -257,6 +257,24 @@ static inline void cdp_peer_setup peer); } +static inline void *cdp_peer_ast_hash_find + (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return NULL; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find) + return NULL; + + return soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find(soc, + ast_mac_addr); +} + static inline int cdp_peer_add_ast (ol_txrx_soc_handle soc, struct cdp_peer *peer_handle, uint8_t *mac_addr, enum cdp_txrx_ast_entry_type type, uint32_t flags) @@ -279,8 +297,59 @@ static inline int cdp_peer_add_ast flags); } +static inline void cdp_peer_reset_ast + (ol_txrx_soc_handle soc, uint8_t *wds_macaddr) +{ + + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return; + } + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->txrx_peer_reset_ast) + return; + + soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr); +} + +static inline void cdp_peer_reset_ast_table + (ol_txrx_soc_handle soc) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table) + return; + + soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc); +} + +static inline void cdp_peer_flush_ast_table + (ol_txrx_soc_handle soc) +{ + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->cmn_drv_ops || + !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table) + return; + + soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc); +} + static inline int cdp_peer_update_ast - (ol_txrx_soc_handle soc, void *ast_handle, + (ol_txrx_soc_handle soc, uint8_t *wds_macaddr, struct cdp_peer *peer_handle, uint32_t flags) { if (!soc || !soc->ops) { @@ -294,9 +363,10 @@ static inline int cdp_peer_update_ast !soc->ops->cmn_drv_ops->txrx_peer_update_ast) return 0; + return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc, peer_handle, - ast_handle, + wds_macaddr, flags); } @@ -317,23 +387,6 @@ static inline void cdp_peer_del_ast soc->ops->cmn_drv_ops->txrx_peer_del_ast(soc, ast_handle); } -static inline void *cdp_peer_ast_hash_find - (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr) -{ - if (!soc || !soc->ops) { - QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, - "%s: Invalid Instance:", __func__); - QDF_BUG(0); - return NULL; - } - - if (!soc->ops->cmn_drv_ops || - !soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find) - return NULL; - - return soc->ops->cmn_drv_ops->txrx_peer_ast_hash_find(soc, - ast_mac_addr); -} static inline uint8_t cdp_peer_ast_get_pdev_id (ol_txrx_soc_handle soc, void *ast_handle) diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index e3446524c6..bae1bf0147 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -103,7 +103,8 @@ struct cdp_cmn_ops { int (*txrx_peer_update_ast) (ol_txrx_soc_handle soc, struct cdp_peer *peer_hdl, - void *ast_hdl, uint32_t flags); + uint8_t *mac_addr, uint32_t flags); + void *(*txrx_peer_ast_hash_find) (ol_txrx_soc_handle soc, uint8_t *ast_mac_addr); @@ -295,6 +296,13 @@ struct cdp_cmn_ops { void (*set_soc_dp_txrx_handle)(struct cdp_soc *soc_handle, void *dp_txrx_handle); + void (*txrx_peer_reset_ast) + (ol_txrx_soc_handle soc, uint8_t *ast_macaddr); + + void (*txrx_peer_reset_ast_table)(ol_txrx_soc_handle soc); + + void (*txrx_peer_flush_ast_table)(ol_txrx_soc_handle soc); + ol_txrx_tx_fp tx_send; }; diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 03ef964d8f..eca4b34727 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -310,20 +310,117 @@ static void dp_peer_del_ast_wifi3(struct cdp_soc_t *soc_hdl, qdf_spin_unlock_bh(&soc->ast_lock); } + static int dp_peer_update_ast_wifi3(struct cdp_soc_t *soc_hdl, struct cdp_peer *peer_hdl, - void *ast_entry_hdl, + uint8_t *wds_macaddr, uint32_t flags) { int status; struct dp_soc *soc = (struct dp_soc *)soc_hdl; + struct dp_ast_entry *ast_entry = NULL; + + qdf_spin_lock_bh(&soc->ast_lock); + ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); + status = dp_peer_update_ast(soc, (struct dp_peer *)peer_hdl, - (struct dp_ast_entry *)ast_entry_hdl, + ast_entry, flags); + qdf_spin_unlock_bh(&soc->ast_lock); + return status; } +/* + * dp_wds_reset_ast_wifi3() - Reset the is_active param for ast entry + * @soc_handle: Datapath SOC handle + * @ast_entry_hdl: AST Entry handle + * Return: None + */ +static void dp_wds_reset_ast_wifi3(struct cdp_soc_t *soc_hdl, + uint8_t *wds_macaddr) +{ + struct dp_soc *soc = (struct dp_soc *)soc_hdl; + struct dp_ast_entry *ast_entry = NULL; + + qdf_spin_lock_bh(&soc->ast_lock); + ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); + + if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) { + ast_entry->is_active = TRUE; + } + qdf_spin_unlock_bh(&soc->ast_lock); +} + +/* + * dp_wds_reset_ast_table_wifi3() - Reset the is_active param for all ast entry + * @soc: Datapath SOC handle + * + * Return: None + */ +static void dp_wds_reset_ast_table_wifi3(struct cdp_soc_t *soc_hdl) +{ + struct dp_soc *soc = (struct dp_soc *) soc_hdl; + struct dp_pdev *pdev; + struct dp_vdev *vdev; + struct dp_peer *peer; + struct dp_ast_entry *ase, *temp_ase; + int i; + + qdf_spin_lock_bh(&soc->ast_lock); + + for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { + pdev = soc->pdev_list[i]; + DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { + DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { + DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { + if (ase->type == + CDP_TXRX_AST_TYPE_STATIC) + continue; + ase->is_active = TRUE; + } + } + } + } + + qdf_spin_unlock_bh(&soc->ast_lock); +} + +/* + * dp_wds_flush_ast_table_wifi3() - Delete all wds and hmwds ast entry + * @soc: Datapath SOC handle + * + * Return: None + */ +static void dp_wds_flush_ast_table_wifi3(struct cdp_soc_t *soc_hdl) +{ + struct dp_soc *soc = (struct dp_soc *) soc_hdl; + struct dp_pdev *pdev; + struct dp_vdev *vdev; + struct dp_peer *peer; + struct dp_ast_entry *ase, *temp_ase; + int i; + + qdf_spin_lock_bh(&soc->ast_lock); + + for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { + pdev = soc->pdev_list[i]; + DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { + DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { + DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { + if (ase->type == + CDP_TXRX_AST_TYPE_STATIC) + continue; + dp_peer_del_ast(soc, ase); + } + } + } + } + + qdf_spin_unlock_bh(&soc->ast_lock); +} + static void *dp_peer_ast_hash_find_wifi3(struct cdp_soc_t *soc_hdl, uint8_t *ast_mac_addr) { @@ -575,6 +672,31 @@ static void dp_print_ast_stats(struct dp_soc *soc) } #endif +static void dp_print_peer_table(struct dp_vdev *vdev) +{ + struct dp_peer *peer = NULL; + + DP_PRINT_STATS("Dumping Peer Table Stats:"); + TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { + if (!peer) { + DP_PRINT_STATS("Invalid Peer"); + return; + } + DP_PRINT_STATS(" peer_mac_addr = %pM" + " nawds_enabled = %d" + " bss_peer = %d" + " wapi = %d" + " wds_enabled = %d" + " delete in progress = %d", + peer->mac_addr.raw, + peer->nawds_enabled, + peer->bss_peer, + peer->wapi, + peer->wds_enabled, + peer->delete_in_progress); + } +} + /* * dp_setup_srng - Internal function to setup SRNG rings used by data path */ @@ -1588,6 +1710,7 @@ static void dp_wds_aging_timer_fn(void *soc_hdl) qdf_timer_mod(&soc->wds_aging_timer, DP_WDS_AGING_TIMER_DEFAULT_MS); } + /* * dp_soc_wds_attach() - Setup WDS timer and AST table * @soc: Datapath SOC handle @@ -5605,6 +5728,7 @@ dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type) break; case TXRX_AST_STATS: dp_print_ast_stats(pdev->soc); + dp_print_peer_table(vdev); break; case TXRX_SRNG_PTR_STATS: dp_print_ring_stats(pdev); @@ -6714,6 +6838,9 @@ static struct cdp_cmn_ops dp_ops_cmn = { .get_soc_dp_txrx_handle = dp_soc_get_dp_txrx_handle, .set_soc_dp_txrx_handle = dp_soc_set_dp_txrx_handle, .tx_send = dp_tx_send, + .txrx_peer_reset_ast = dp_wds_reset_ast_wifi3, + .txrx_peer_reset_ast_table = dp_wds_reset_ast_table_wifi3, + .txrx_peer_flush_ast_table = dp_wds_flush_ast_table_wifi3, }; static struct cdp_ctrl_ops dp_ops_ctrl = {