diff --git a/dp/inc/cdp_txrx_mob_def.h b/dp/inc/cdp_txrx_mob_def.h index 4ed217257e..8369582240 100644 --- a/dp/inc/cdp_txrx_mob_def.h +++ b/dp/inc/cdp_txrx_mob_def.h @@ -241,16 +241,44 @@ enum peer_debug_id_type { PEER_DEBUG_ID_MAX }; +/** + * enum cdp_peer_bw - Bandwidth types + * @CDP_20_MHZ: 20MHz BW + * @CDP_40_MHZ: 40MHz BW + * @CDP_80_MHZ: 80MHz BW + * @CDP_160_MHZ: 160MHz BW + * @CDP_80P80_MHZ: 80+80MHz BW + * @CDP_5_MHZ: 5MHz BW + * @CDP_10_MHZ: 10MHz BW + * @CDP_320_MHZ: 320MHz BW + * @CDP_BW_INVALID: Invalid BW + * @CDP_BW_MAX: Max BW id + */ +enum cdp_peer_bw { + CDP_20_MHZ, + CDP_40_MHZ, + CDP_80_MHZ, + CDP_160_MHZ, + CDP_80P80_MHZ, + CDP_5_MHZ, + CDP_10_MHZ, + CDP_320_MHZ, + CDP_BW_INVALID, + CDP_BW_MAX +}; + /** * struct ol_txrx_desc_type - txrx descriptor type * @is_qos_enabled: is station qos enabled * @is_wapi_supported: is station wapi supported * @peer_addr: peer mac address + * @bw: bandwidth of peer connection */ struct ol_txrx_desc_type { uint8_t is_qos_enabled; uint8_t is_wapi_supported; struct qdf_mac_addr peer_addr; + enum cdp_peer_bw bw; }; /** diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index b471d1a792..2655e2dba5 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -7102,12 +7102,6 @@ static QDF_STATUS dp_txrx_peer_attach(struct dp_soc *soc, struct dp_peer *peer) txrx_peer->vdev = peer->vdev; pdev = peer->vdev->pdev; - /* Initialize MPDU success count with retry update thresholds */ - txrx_peer->mpdu_retry_threshold_1 = - soc->wlan_cfg_ctx->mpdu_retry_threshold_1; - txrx_peer->mpdu_retry_threshold_2 = - soc->wlan_cfg_ctx->mpdu_retry_threshold_2; - DP_STATS_INIT(txrx_peer); dp_wds_ext_peer_init(txrx_peer); diff --git a/dp/wifi3.0/dp_peer.c b/dp/wifi3.0/dp_peer.c index 8e61edbf43..7cfdf97f6b 100644 --- a/dp/wifi3.0/dp_peer.c +++ b/dp/wifi3.0/dp_peer.c @@ -5097,6 +5097,42 @@ dp_rx_delba_ind_handler(void *soc_handle, uint16_t peer_id, } #ifdef DP_PEER_EXTENDED_API +/** + * dp_peer_set_bw() - Set bandwidth and mpdu retry count threshold for peer + * @soc: DP soc handle + * @txrx_peer: Core txrx_peer handle + * @set_bw: enum of bandwidth to be set for this peer connection + * + * Return: None + */ +static void dp_peer_set_bw(struct dp_soc *soc, struct dp_txrx_peer *txrx_peer, + enum cdp_peer_bw set_bw) +{ + if (!txrx_peer) + return; + + txrx_peer->bw = set_bw; + + switch (set_bw) { + case CDP_160_MHZ: + case CDP_320_MHZ: + txrx_peer->mpdu_retry_threshold = + soc->wlan_cfg_ctx->mpdu_retry_threshold_2; + break; + case CDP_20_MHZ: + case CDP_40_MHZ: + case CDP_80_MHZ: + default: + txrx_peer->mpdu_retry_threshold = + soc->wlan_cfg_ctx->mpdu_retry_threshold_1; + break; + } + + dp_info("Peer id: %u: BW: %u, mpdu retry threshold: %u", + txrx_peer->peer_id, txrx_peer->bw, + txrx_peer->mpdu_retry_threshold); +} + #ifdef WLAN_FEATURE_11BE_MLO QDF_STATUS dp_register_peer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, struct ol_txrx_desc_type *sta_desc) @@ -5114,6 +5150,8 @@ QDF_STATUS dp_register_peer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, peer->state = OL_TXRX_PEER_STATE_CONN; qdf_spin_unlock_bh(&peer->peer_info_lock); + dp_peer_set_bw(soc, peer->txrx_peer, sta_desc->bw); + dp_rx_flush_rx_cached(peer, false); if (IS_MLO_DP_LINK_PEER(peer) && peer->first_link) { @@ -5185,6 +5223,8 @@ QDF_STATUS dp_register_peer(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, peer->state = OL_TXRX_PEER_STATE_CONN; qdf_spin_unlock_bh(&peer->peer_info_lock); + dp_peer_set_bw(soc, peer->txrx_peer, sta_desc->bw); + dp_rx_flush_rx_cached(peer, false); dp_peer_unref_delete(peer, DP_MOD_ID_CDP); diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 43a0a9a63d..183ceb69f4 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -4037,7 +4037,8 @@ static inline void dp_tx_update_peer_extd_stats(struct hal_tx_completion_status *ts, struct dp_txrx_peer *txrx_peer) { - uint8_t mcs, pkt_type, retry_threshold; + uint8_t mcs, pkt_type; + uint8_t retry_threshold = txrx_peer->mpdu_retry_threshold; mcs = ts->mcs; pkt_type = ts->pkt_type; @@ -4084,19 +4085,9 @@ dp_tx_update_peer_extd_stats(struct hal_tx_completion_status *ts, if (ts->first_msdu) { DP_PEER_EXTD_STATS_INCC(txrx_peer, tx.retries_mpdu, 1, ts->transmit_cnt > 1); - switch (ts->bw) { - case 0: /* 20Mhz */ - case 1: /* 40Mhz */ - case 2: /* 80Mhz */ - retry_threshold = txrx_peer->mpdu_retry_threshold_1; - break; - default: /* 160Mhz */ - retry_threshold = txrx_peer->mpdu_retry_threshold_2; - break; - } + if (!retry_threshold) return; - DP_PEER_EXTD_STATS_INCC(txrx_peer, tx.mpdu_success_with_retries, qdf_do_div(ts->transmit_cnt, retry_threshold), diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index bc8f310e9e..04652d3755 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -3840,9 +3840,8 @@ struct dp_peer_stats { * @stats: Peer stats * @delay_stats: Peer delay stats * @jitter_stats: Peer jitter stats - * @mpdu_retry_threshold_1: MPDU retry threshold 1 to increment tx bad count - * @mpdu_retry_threshold_1: MPDU retry threshold 2 to increment tx bad count - + * @bw: bandwidth of peer connection + * @mpdu_retry_threshold: MPDU retry threshold to increment tx bad count */ struct dp_txrx_peer { /* Core TxRx Peer */ @@ -3898,8 +3897,10 @@ struct dp_txrx_peer { #ifdef CONFIG_SAWF struct dp_peer_sawf_stats *sawf_stats; #endif - uint8_t mpdu_retry_threshold_1; - uint8_t mpdu_retry_threshold_2; +#ifdef DP_PEER_EXTENDED_API + enum cdp_peer_bw bw; + uint8_t mpdu_retry_threshold; +#endif }; /* Peer structure for data path state */