Skip to content

Commit 2383a5f

Browse files
MaochenWang1kartben
authored andcommitted
drivers: wifi: nxp: fix wifi stats cmd hang when net_if down
After net interface is down and the driver deinit, should not interact with driver and FW when call the 'wifi statistics' CMD. Signed-off-by: Maochen Wang <[email protected]>
1 parent c0d8bd1 commit 2383a5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/wifi/nxp/nxp_wifi_drv.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,10 @@ static int nxp_wifi_stats(const struct device *dev, struct net_stats_wifi *stats
12781278
stats->unicast.tx = if_handle->stats.unicast.tx;
12791279
stats->overrun_count = if_handle->stats.errors.rx + if_handle->stats.errors.tx;
12801280

1281+
if (!net_if_is_admin_up(net_if_lookup_by_dev(dev))) {
1282+
return 0;
1283+
}
1284+
12811285
#ifdef CONFIG_NXP_WIFI_GET_LOG
12821286
wifi_stats = k_malloc(sizeof(wlan_pkt_stats_t));
12831287
if (!wifi_stats) {
@@ -1326,6 +1330,10 @@ int nxp_wifi_reset_stats(const struct device *dev)
13261330
/* clear local statistics */
13271331
memset(&if_handle->stats, 0, sizeof(if_handle->stats));
13281332

1333+
if (!net_if_is_admin_up(net_if_lookup_by_dev(dev))) {
1334+
return 0;
1335+
}
1336+
13291337
#ifdef CONFIG_NXP_WIFI_GET_LOG
13301338
/* store firmware statistics */
13311339
wifi_stats = k_malloc(sizeof(wlan_pkt_stats_t));

0 commit comments

Comments
 (0)