From e6e961423cd36f0e92fa31f0a35437a2de6cc28d Mon Sep 17 00:00:00 2001 From: Rohan Sahay <103027015+rosahay-silabs@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:45:18 +0530 Subject: [PATCH] [Silabs] Adds debug prints for rs911x platform for better understanding (#37102) * Improve error logging for WiFi data transmission failures in low_level_output * Adds SLAAC IPv6 print * Revert line for define check * Adds missing includes * Update status initialization * Revert "Update status initialization" This reverts commit f8f8377da765c772570e9031a62af919c46cfbba. * Adds change based on comments * Fix compilation --------- Co-authored-by: Rohan S <3526930+brosahay@users.noreply.github.com> --- src/platform/silabs/wifi/lwip-support/ethernetif.cpp | 12 ++++++------ .../silabs/wifi/rs911x/WifiInterfaceImpl.cpp | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/platform/silabs/wifi/lwip-support/ethernetif.cpp b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp index 0f97ac948adbfe..84485f71a92c71 100644 --- a/src/platform/silabs/wifi/lwip-support/ethernetif.cpp +++ b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp @@ -334,8 +334,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) { #if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) UNUSED_PARAMETER(netif); - sl_status_t status; - status = sl_wifi_send_raw_data_frame(SL_WIFI_CLIENT_INTERFACE, (uint8_t *) p->payload, p->len); + sl_status_t status = sl_wifi_send_raw_data_frame(SL_WIFI_CLIENT_INTERFACE, (uint8_t *) p->payload, p->len); if (status != SL_STATUS_OK) { return ERR_IF; @@ -367,14 +366,14 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) #endif if ((netif->flags & (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) != (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) { - ChipLogProgress(DeviceLayer, "EN-RSI:NOT UP"); + ChipLogError(DeviceLayer, "EN-RSI:NOT UP"); xSemaphoreGive(ethout_sem); return ERR_IF; } packet = wfx_rsi_alloc_pkt(); if (!packet) { - ChipLogProgress(DeviceLayer, "EN-RSI:No buf"); + ChipLogError(DeviceLayer, "EN-RSI:No buf"); xSemaphoreGive(ethout_sem); return ERR_IF; } @@ -402,9 +401,10 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* forward the generated packet to RSI to * send the data over wifi network */ - if (wfx_rsi_send_data(packet, datalength)) + int32_t status = wfx_rsi_send_data(packet, datalength); + if (status != 0) { - ChipLogProgress(DeviceLayer, "*ERR*EN-RSI:Send fail"); + ChipLogError(DeviceLayer, "*ERR*EN-RSI:Send fail: %ld", status); xSemaphoreGive(ethout_sem); return ERR_IF; } diff --git a/src/platform/silabs/wifi/rs911x/WifiInterfaceImpl.cpp b/src/platform/silabs/wifi/rs911x/WifiInterfaceImpl.cpp index aff400d4f7b49f..d55cddf7e5adf5 100644 --- a/src/platform/silabs/wifi/rs911x/WifiInterfaceImpl.cpp +++ b/src/platform/silabs/wifi/rs911x/WifiInterfaceImpl.cpp @@ -19,6 +19,7 @@ #include "silabs_utils.h" #include "sl_status.h" #include +#include #include #include #include @@ -502,6 +503,9 @@ void HandleDHCPPolling(void) */ if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !HasNotifiedIPv6Change()) { + char addrStr[chip::Inet::IPAddress::kMaxStringLength] = { 0 }; + VerifyOrReturn(ip6addr_ntoa_r(netif_ip6_addr(sta_netif, 0), addrStr, sizeof(addrStr)) != nullptr); + ChipLogProgress(DeviceLayer, "SLAAC OK: linklocal addr: %s", addrStr); NotifyIPv6Change(true); WifiPlatformEvent event = WifiPlatformEvent::kStationDhcpDone; PostWifiPlatformEvent(event);