net: ethernet: Align Ethernet drivers/L2 with iface state upgrade
Align Ethernet/Wi-Fi drivers/L2 with interface state handling update. For drivers, that did not support carrier detection, no changes are needed. Driver that did support carrier detection, are updated to set the carrier state to OFF by default, instead of setting the NET_IF_NO_AUTO_START flag. This allows to postopne the actual NET_EVENT_IF_UP notification until driver detects that carrier is ready. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
89b32a0f5d
commit
b279bfd2dd
|
@ -998,7 +998,7 @@ static void dsa_iface_init(struct net_if *iface)
|
|||
}
|
||||
|
||||
pdev->iface_init_count++;
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
/*
|
||||
* Start DSA work to monitor status of ports (read from switch IC)
|
||||
|
|
|
@ -563,7 +563,7 @@ static void enc424j600_iface_init(struct net_if *iface)
|
|||
context->iface = iface;
|
||||
ethernet_init(iface);
|
||||
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
context->iface_initialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ static void eth_esp32_iface_init(struct net_if *iface)
|
|||
}
|
||||
|
||||
/* Do not start the interface until PHY link is up */
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
}
|
||||
|
||||
static const struct ethernet_api eth_esp32_api = {
|
||||
|
|
|
@ -520,7 +520,7 @@ static void eth_iface_init(struct net_if *iface)
|
|||
dev_data->link_up = false;
|
||||
ethernet_init(iface);
|
||||
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
/* Generate MAC address, possibly used for filtering */
|
||||
generate_mac(dev_data->mac_addr);
|
||||
|
|
|
@ -1204,7 +1204,7 @@ static void eth_iface_init(struct net_if *iface)
|
|||
dsa_register_master_tx(iface, ð_tx);
|
||||
#endif
|
||||
ethernet_init(iface);
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
context->config_func();
|
||||
}
|
||||
|
|
|
@ -1965,7 +1965,7 @@ static void eth0_iface_init(struct net_if *iface)
|
|||
}
|
||||
|
||||
/* Do not start the interface until PHY link is up */
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
init_done = true;
|
||||
}
|
||||
|
|
|
@ -957,7 +957,7 @@ static void eth_iface_init(struct net_if *iface)
|
|||
|
||||
ethernet_init(iface);
|
||||
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
if (is_first_init) {
|
||||
const struct eth_stm32_hal_dev_cfg *cfg = dev->config;
|
||||
|
|
|
@ -226,7 +226,7 @@ static void eth_xlnx_gem_iface_init(struct net_if *iface)
|
|||
dev_data->iface = iface;
|
||||
net_if_set_link_addr(iface, dev_data->mac_addr, 6, NET_LINK_ETHERNET);
|
||||
ethernet_init(iface);
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
/*
|
||||
* Initialize the (delayed) work items for RX pending, TX done
|
||||
|
|
|
@ -429,7 +429,7 @@ static void esp32_wifi_init(struct net_if *iface)
|
|||
net_if_set_link_addr(iface, dev_data->mac_addr, 6, NET_LINK_ETHERNET);
|
||||
|
||||
ethernet_init(iface);
|
||||
net_if_flag_set(iface, NET_IF_NO_AUTO_START);
|
||||
net_if_carrier_off(iface);
|
||||
|
||||
esp_wifi_internal_reg_rxcb(ESP_IF_WIFI_STA, eth_esp32_rx);
|
||||
}
|
||||
|
|
|
@ -1065,10 +1065,10 @@ static void carrier_on_off(struct k_work *work)
|
|||
|
||||
if (eth_carrier_up) {
|
||||
ethernet_mgmt_raise_carrier_on_event(ctx->iface);
|
||||
net_if_up(ctx->iface);
|
||||
net_if_carrier_on(ctx->iface);
|
||||
} else {
|
||||
ethernet_mgmt_raise_carrier_off_event(ctx->iface);
|
||||
net_if_carrier_down(ctx->iface);
|
||||
net_if_carrier_off(ctx->iface);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue