diff --git a/include/net/net_if.h b/include/net/net_if.h index c07379d164e..c879f604829 100644 --- a/include/net/net_if.h +++ b/include/net/net_if.h @@ -2133,7 +2133,6 @@ static inline bool net_if_are_pending_tx_packets(struct net_if *iface) } #ifdef CONFIG_NET_POWER_MANAGEMENT - /** * @brief Suspend a network interface from a power management perspective * @@ -2152,6 +2151,14 @@ int net_if_suspend(struct net_if *iface); */ int net_if_resume(struct net_if *iface); +/** + * @brief Check if the network interface is suspended or not. + * + * @param iface Pointer to network interface + * + * @return True if interface is suspended, False otherwise. + */ +bool net_if_is_suspended(struct net_if *iface); #endif /* CONFIG_NET_POWER_MANAGEMENT */ /** @cond INTERNAL_HIDDEN */ diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index c3afc166bdb..0ec705c6cbc 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -3650,6 +3650,11 @@ int net_if_resume(struct net_if *iface) return 0; } +bool net_if_is_suspended(struct net_if *iface) +{ + return net_if_flag_is_set(iface, NET_IF_SUSPENDED); +} + #endif /* CONFIG_NET_POWER_MANAGEMENT */ #if defined(CONFIG_NET_PKT_TIMESTAMP_THREAD) diff --git a/subsys/net/ip/net_shell.c b/subsys/net/ip/net_shell.c index 7261e635792..92c3f51aa58 100644 --- a/subsys/net/ip/net_shell.c +++ b/subsys/net/ip/net_shell.c @@ -306,6 +306,12 @@ static void iface_cb(struct net_if *iface, void *user_data) return; } +#ifdef CONFIG_NET_POWER_MANAGEMENT + if (net_if_is_suspended(iface)) { + PR_INFO("Interface is suspended, thus not able to tx/rx.\n"); + } +#endif + if (net_if_get_link_addr(iface) && net_if_get_link_addr(iface)->addr) { PR("Link addr : %s\n",