Skip to content
Permalink
Browse files

net: if: Only start the network interface during init if needed

If the NET_IF_NO_AUTO_START network interface flag is set, then
do not take network interface up during the initialization of the
network interface. The network device driver can set the flag in its
network interface initialization function if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed Apr 16, 2019
1 parent 712103d commit 3633951652d3ec7b93e9d697373d76a2bd3723f8
Showing with 11 additions and 1 deletion.
  1. +8 −0 include/net/net_if.h
  2. +3 −1 subsys/net/ip/net_if.c
@@ -179,6 +179,14 @@ enum net_if_flag {
/** Interface is in promiscuous mode */
NET_IF_PROMISC,

/** Do not start the interface immediately after initialization.
* This requires that either the device driver or some other entity
* will need to manually take the interface up when needed.
* For example for Ethernet this will happen when the driver calls
* the net_eth_carrier_on() function.
*/
NET_IF_NO_AUTO_START,

/** @cond INTERNAL_HIDDEN */
/* Total number of flags - must be at the end of the enum */
NET_IF_NUM_FLAGS
@@ -3154,6 +3154,8 @@ void net_if_post_init(void)

/* After TX is running, attempt to bring the interface up */
for (iface = __net_if_start; iface != __net_if_end; iface++) {
net_if_up(iface);
if (!net_if_flag_is_set(iface, NET_IF_NO_AUTO_START)) {
net_if_up(iface);
}
}
}

0 comments on commit 3633951

Please sign in to comment.
You can’t perform that action at this time.