Skip to content

Commit

Permalink
[NXP] add support of new wifi diagnostics, only available with sdk 2.…
Browse files Browse the repository at this point in the history
…16.100

Signed-off-by: Martin Girardot <[email protected]>
  • Loading branch information
Martin-NXP committed Sep 27, 2024
1 parent b7295f8 commit 926d9b8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
35 changes: 35 additions & 0 deletions src/platform/nxp/common/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,37 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastTxCount(uint32_t & pa
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

#if SDK_2_16_100
CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastRxCount)
{
#ifdef CONFIG_WIFI_GET_LOG
wlan_pkt_stats_t stats;
int ret = wlan_get_log(&stats);
if (ret == WM_SUCCESS)
{
packetUnicastRxCount = stats.rx_unicast_cnt - mPacketUnicastRxCount;
return CHIP_NO_ERROR;
}
#endif /* CONFIG_WIFI_GET_LOG */
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiOverrunCount(uint64_t & overrunCount)
{
#ifdef CONFIG_WIFI_GET_LOG
wlan_pkt_stats_t stats;
int ret = wlan_get_log(&stats);
if (ret == WM_SUCCESS)
{
overrunCount = (stats.tx_overrun_cnt + stats.rx_overrun_cnt) - mOverrunCount;
return CHIP_NO_ERROR;
}
#endif /* CONFIG_WIFI_GET_LOG */
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
}

#endif

CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts(void)
{
#ifdef CONFIG_WIFI_GET_LOG
Expand All @@ -433,6 +464,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWiFiNetworkDiagnosticsCounts(void)
mPacketMulticastRxCount = stats.mcast_rx_frame;
mBeaconRxCount = stats.bcn_rcv_cnt;
mBeaconLostCount = stats.bcn_miss_cnt;
#if SDK_2_16_100
mPacketUnicastRxCount = stats.rx_unicast_cnt;
mOverrunCount = stats.tx_overrun_cnt + stats.rx_overrun_cnt;
#endif
return CHIP_NO_ERROR;
}
#endif /* CONFIG_WIFI_GET_LOG */
Expand Down
13 changes: 9 additions & 4 deletions src/platform/nxp/common/DiagnosticDataProviderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
CHIP_ERROR GetWiFiPacketMulticastTxCount(uint32_t & packetMulticastTxCount) override;
CHIP_ERROR GetWiFiPacketUnicastTxCount(uint32_t & packetUnicastTxCount) override;
CHIP_ERROR ResetWiFiNetworkDiagnosticsCounts() override;
#if SDK_2_16_100
CHIP_ERROR GetWiFiOverrunCount(uint64_t & overrunCount) override;
CHIP_ERROR GetWiFiPacketUnicastRxCount(uint32_t & packetUnicastTxCount) override;
#endif


uint32_t mBeaconRxCount = 0;
uint32_t mBeaconLostCount = 0;
uint32_t mPacketMulticastRxCount = 0;
uint32_t mPacketMulticastTxCount = 0;
// currently not supported by SDK
// uint32_t mPacketUnicastRxCount = 0;
uint32_t mPacketUnicastTxCount = 0;
// currently not supported by SDK
// uint64_t mOverrunCount = 0;
#if SDK_2_16_100
uint32_t mPacketUnicastRxCount = 0;
uint64_t mOverrunCount = 0;
#endif
#endif /* CHIP_DEVICE_CONFIG_ENABLE_WPA */
};

Expand Down

0 comments on commit 926d9b8

Please sign in to comment.