net: if: Fix interface initialization with socket offloading

A socket-offloaded interface should bypass interface initialization in
the same way as net-offloaded interface does.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2019-10-14 16:08:18 +02:00 committed by Jukka Rissanen
parent 6188185c57
commit 047969c0d0
2 changed files with 27 additions and 1 deletions

View file

@ -444,6 +444,11 @@ struct net_if_dev {
/** The hardware MTU */
u16_t mtu;
#if defined(CONFIG_NET_SOCKETS_OFFLOAD)
/** Indicate whether interface is offloaded at socket level. */
bool offloaded;
#endif /* CONFIG_NET_SOCKETS_OFFLOAD */
};
/**
@ -624,6 +629,24 @@ static inline struct net_offload *net_if_offload(struct net_if *iface)
#endif
}
/**
* @brief Return the socket offload status
*
* @param iface Network interface
*
* @return True if socket offloading is active, false otherwise.
*/
static inline bool net_if_is_socket_offloaded(struct net_if *iface)
{
#if defined(CONFIG_NET_SOCKETS_OFFLOAD)
return iface->if_dev->offloaded;
#else
ARG_UNUSED(iface);
return false;
#endif
}
/**
* @brief Get an network interface's link address
*

View file

@ -3439,7 +3439,10 @@ int net_if_up(struct net_if *iface)
return 0;
}
if (IS_ENABLED(CONFIG_NET_OFFLOAD) && net_if_is_ip_offloaded(iface)) {
if ((IS_ENABLED(CONFIG_NET_OFFLOAD) &&
net_if_is_ip_offloaded(iface)) ||
(IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD) &&
net_if_is_socket_offloaded(iface))) {
net_if_flag_set(iface, NET_IF_UP);
goto exit;
}