diff --git a/dp/inc/cdp_txrx_stats_struct.h b/dp/inc/cdp_txrx_stats_struct.h index 962d9531af..f5c475d45b 100644 --- a/dp/inc/cdp_txrx_stats_struct.h +++ b/dp/inc/cdp_txrx_stats_struct.h @@ -569,6 +569,9 @@ enum WDI_EVENT { WDI_EVENT_HOST_SW_EVENT, #ifdef QCA_WIFI_QCN9224 WDI_EVENT_HYBRID_TX, +#ifdef WLAN_FEATURE_11BE_MLO + WDI_EVENT_MLO_TSTMP, +#endif #endif /* End of new event items */ WDI_EVENT_LAST diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index 139438c1d6..45573b6e30 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -2567,6 +2567,61 @@ static void dp_htt_mlo_peer_unmap_handler(struct htt_soc *soc, mlo_peer_id = HTT_RX_MLO_PEER_UNMAP_MLO_PEER_ID_GET(*msg_word); dp_rx_mlo_peer_unmap_handler(soc->dp_soc, mlo_peer_id); } + +static void +dp_rx_mlo_timestamp_ind_handler(struct dp_soc *soc, + uint32_t *msg_word) +{ + uint8_t pdev_id; + uint8_t target_pdev_id; + struct dp_pdev *pdev; + + if (!soc) + return; + + target_pdev_id = HTT_T2H_MLO_TIMESTAMP_OFFSET_PDEV_ID_GET(*msg_word); + pdev_id = dp_get_host_pdev_id_for_target_pdev_id(soc, + target_pdev_id); + + if (pdev_id >= MAX_PDEV_CNT) { + dp_htt_debug("%pK: pdev id %d is invalid", soc, pdev_id); + return; + } + + pdev = (struct dp_pdev *)soc->pdev_list[pdev_id]; + + if (!pdev) { + dp_err("Invalid pdev"); + return; + } + dp_wdi_event_handler(WDI_EVENT_MLO_TSTMP, soc, + msg_word, HTT_INVALID_PEER, WDI_NO_VAL, + pdev_id); + + qdf_spin_lock_bh(&soc->htt_stats.lock); + pdev->timestamp.msg_type = + HTT_T2H_MLO_TIMESTAMP_OFFSET_MSG_TYPE_GET(*msg_word); + pdev->timestamp.pdev_id = pdev_id; + pdev->timestamp.chip_id = + HTT_T2H_MLO_TIMESTAMP_OFFSET_CHIP_ID_GET(*msg_word); + pdev->timestamp.mac_clk_freq = + HTT_T2H_MLO_TIMESTAMP_OFFSET_MAC_CLK_FREQ_MHZ_GET(*msg_word); + pdev->timestamp.sync_tstmp_lo_us = *(msg_word + 1); + pdev->timestamp.sync_tstmp_hi_us = *(msg_word + 2); + pdev->timestamp.mlo_offset_lo_us = *(msg_word + 3); + pdev->timestamp.mlo_offset_hi_us = *(msg_word + 4); + pdev->timestamp.mlo_offset_clks = *(msg_word + 5); + pdev->timestamp.mlo_comp_us = + HTT_T2H_MLO_TIMESTAMP_OFFSET_MLO_TIMESTAMP_COMP_US_GET( + *(msg_word + 6)); + pdev->timestamp.mlo_comp_clks = + HTT_T2H_MLO_TIMESTAMP_OFFSET_MLO_TIMESTAMP_COMP_CLKS_GET( + *(msg_word + 6)); + pdev->timestamp.mlo_comp_timer = + HTT_T2H_MLO_TIMESTAMP_OFFSET_MLO_TIMESTAMP_COMP_PERIOD_US_GET( + *(msg_word + 7)); + qdf_spin_unlock_bh(&soc->htt_stats.lock); +} #else static void dp_htt_mlo_peer_map_handler(struct htt_soc *soc, uint32_t *msg_word) @@ -2579,6 +2634,13 @@ static void dp_htt_mlo_peer_unmap_handler(struct htt_soc *soc, { qdf_assert_always(0); } + +static void +dp_rx_mlo_timestamp_ind_handler(void *soc_handle, + uint32_t *msg_word) +{ + qdf_assert_always(0); +} #endif /* @@ -2985,6 +3047,11 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) dp_htt_mlo_peer_unmap_handler(soc, msg_word); break; } + case HTT_T2H_MSG_TYPE_MLO_TIMESTAMP_OFFSET_IND: + { + dp_rx_mlo_timestamp_ind_handler(soc->dp_soc, msg_word); + break; + } default: break; }; diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 95e2694707..90dad12f52 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -2488,6 +2488,45 @@ struct dp_soc_srngs_state { TAILQ_ENTRY(dp_soc_srngs_state) list_elem; }; +#if defined(QCA_WIFI_QCN9224) && defined(WLAN_FEATURE_11BE_MLO) +/* struct dp_mlo_sync_timestamp - PDEV level data structure for storing + * MLO timestamp received via HTT msg. + * msg_type: This would be set to HTT_T2H_MSG_TYPE_MLO_TIMESTAMP_OFFSET_IND + * pdev_id: pdev_id + * chip_id: chip_id + * mac_clk_freq: mac clock frequency of the mac HW block in MHz + * sync_tstmp_lo_us: lower 32 bits of the WLAN global time stamp (in us) at + * which last sync interrupt was received + * sync_tstmp_hi_us: upper 32 bits of the WLAN global time stamp (in us) at + * which last sync interrupt was received + * mlo_offset_lo_us: lower 32 bits of the MLO time stamp offset in us + * mlo_offset_hi_us: upper 32 bits of the MLO time stamp offset in us + * mlo_offset_clks: MLO time stamp offset in clock ticks for sub us + * mlo_comp_us: MLO time stamp compensation applied in us + * mlo_comp_clks: MLO time stamp compensation applied in clock ticks + * for sub us resolution + * mlo_comp_timer: period of MLO compensation timer at which compensation + * is applied, in us + */ +struct dp_mlo_sync_timestamp { + uint32_t msg_type:8, + pdev_id:2, + chip_id:2, + rsvd1:4, + mac_clk_freq:16; + uint32_t sync_tstmp_lo_us; + uint32_t sync_tstmp_hi_us; + uint32_t mlo_offset_lo_us; + uint32_t mlo_offset_hi_us; + uint32_t mlo_offset_clks; + uint32_t mlo_comp_us:16, + mlo_comp_clks:10, + rsvd2:6; + uint32_t mlo_comp_timer:22, + rsvd3:10; +}; +#endif + /* PDEV level structure for data path */ struct dp_pdev { /** @@ -2728,6 +2767,9 @@ struct dp_pdev { #ifdef WIFI_MONITOR_SUPPORT struct dp_mon_pdev *monitor_pdev; #endif +#if defined(QCA_WIFI_QCN9224) && defined(WLAN_FEATURE_11BE_MLO) + struct dp_mlo_sync_timestamp timestamp; +#endif }; struct dp_peer;