net: Expose a way to know if the network interface is suspended or not
And use it in the shell to display such information then. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
db6f896c00
commit
4322c66e4b
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue