net: Enable PM settings on network devices
By changing the various *NET_DEVICE* macros. It is up to the device drivers to either set a proper PM function or, if not supported or PM disabled, to use device_pm_control_nop relevantly. All existing macro calls are updated. Since no PM support was added so far, device_pm_control_nop is used as the default everywhere. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
ebe20f99c7
commit
4ae72db135
|
@ -308,7 +308,7 @@ static int socket_can_init_1(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_INIT(socket_can_loopback_1, SOCKET_CAN_NAME_1, socket_can_init_1,
|
||||
&socket_can_context_1, NULL,
|
||||
device_pm_control_nop, &socket_can_context_1, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&socket_can_api,
|
||||
CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), CAN_MTU);
|
||||
|
|
|
@ -749,7 +749,7 @@ static int socket_can_init_0(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_INIT(socket_can_flexcan_0, SOCKET_CAN_NAME_1, socket_can_init_0,
|
||||
&socket_can_context_1, NULL,
|
||||
device_pm_control_nop, &socket_can_context_1, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&socket_can_api,
|
||||
CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), CAN_MTU);
|
||||
|
|
|
@ -398,7 +398,7 @@ static int net_can_init(struct device *dev)
|
|||
static struct net_can_context net_can_context_1;
|
||||
|
||||
NET_DEVICE_INIT(net_can_1, CONFIG_CAN_NET_NAME, net_can_init,
|
||||
&net_can_context_1, NULL,
|
||||
device_pm_control_nop, &net_can_context_1, NULL,
|
||||
CONFIG_CAN_NET_INIT_PRIORITY,
|
||||
&net_can_api_inst,
|
||||
CANBUS_L2, NET_L2_GET_CTX_TYPE(CANBUS_L2), NET_CAN_MTU);
|
||||
|
|
|
@ -1119,7 +1119,7 @@ static int socket_can_init_1(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_INIT(socket_can_stm32_1, SOCKET_CAN_NAME_1, socket_can_init_1,
|
||||
&socket_can_context_1, NULL,
|
||||
device_pm_control_nop, &socket_can_context_1, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&socket_can_api,
|
||||
CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), CAN_MTU);
|
||||
|
@ -1197,7 +1197,7 @@ static int socket_can_init_2(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_INIT(socket_can_stm32_2, SOCKET_CAN_NAME_2, socket_can_init_2,
|
||||
&socket_can_context_2, NULL,
|
||||
device_pm_control_nop, &socket_can_context_2, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&socket_can_api,
|
||||
CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), CAN_MTU);
|
||||
|
|
|
@ -250,6 +250,7 @@ static const struct ethernet_api e1000_api = {
|
|||
NET_DEVICE_INIT(eth_e1000,
|
||||
"ETH_0",
|
||||
e1000_probe,
|
||||
device_pm_control_nop,
|
||||
&e1000_dev,
|
||||
NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY,
|
||||
|
|
|
@ -830,8 +830,8 @@ static const struct eth_enc28j60_config eth_enc28j60_0_config = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(enc28j60_0, DT_INST_0_MICROCHIP_ENC28J60_LABEL,
|
||||
eth_enc28j60_init, ð_enc28j60_0_runtime,
|
||||
ð_enc28j60_0_config, CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs, NET_ETH_MTU);
|
||||
eth_enc28j60_init, device_pm_control_nop,
|
||||
ð_enc28j60_0_runtime, ð_enc28j60_0_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU);
|
||||
|
||||
#endif /* CONFIG_ETH_ENC28J60_0 */
|
||||
|
|
|
@ -766,6 +766,6 @@ static const struct enc424j600_config enc424j600_0_config = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(enc424j600_0, DT_INST_0_MICROCHIP_ENC424J600_LABEL,
|
||||
enc424j600_init, &enc424j600_0_runtime,
|
||||
&enc424j600_0_config, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
enc424j600_init, device_pm_control_nop,
|
||||
&enc424j600_0_runtime, &enc424j600_0_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU);
|
||||
|
|
|
@ -692,5 +692,5 @@ static struct eth_gecko_dev_data eth0_data = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_gecko, CONFIG_ETH_GECKO_NAME, eth_init,
|
||||
ð0_data, ð0_config, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_api, ETH_GECKO_MTU);
|
||||
device_pm_control_nop, ð0_data, ð0_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_GECKO_MTU);
|
||||
|
|
|
@ -254,9 +254,9 @@ static const struct ethernet_api eth_api = {
|
|||
.send = eth_tx
|
||||
};
|
||||
|
||||
NET_DEVICE_INIT(eth0, LITEETH_LABEL, eth_initialize, ð_data, ð_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_api, ETHERNET_L2,
|
||||
NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU);
|
||||
NET_DEVICE_INIT(eth0, LITEETH_LABEL, eth_initialize, device_pm_control_nop,
|
||||
ð_data, ð_config, CONFIG_ETH_INIT_PRIORITY, ð_api,
|
||||
ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU);
|
||||
|
||||
static void eth_irq_config(void)
|
||||
{
|
||||
|
|
|
@ -1127,8 +1127,8 @@ static struct eth_context eth_0_context = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_mcux_0, DT_ETH_MCUX_0_NAME, eth_init,
|
||||
ð_0_context, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs, NET_ETH_MTU);
|
||||
device_pm_control_nop, ð_0_context, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU);
|
||||
|
||||
static void eth_0_config_func(void)
|
||||
{
|
||||
|
@ -1185,8 +1185,8 @@ static struct eth_context eth_1_context = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_mcux_1, DT_ETH_MCUX_1_NAME, eth_init,
|
||||
ð_1_context, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs, NET_ETH_MTU);
|
||||
device_pm_control_nop, ð_1_context, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU);
|
||||
|
||||
static void eth_1_config_func(void)
|
||||
{
|
||||
|
|
|
@ -584,7 +584,7 @@ static const struct ethernet_api eth_if_api = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_native_posix, ETH_NATIVE_POSIX_DRV_NAME,
|
||||
eth_init, ð_context_data, NULL,
|
||||
eth_init, device_pm_control_nop, ð_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, ð_if_api,
|
||||
NET_ETH_MTU);
|
||||
|
||||
|
|
|
@ -2360,8 +2360,8 @@ static struct eth_sam_dev_data eth0_data = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth0_sam_gmac, CONFIG_ETH_SAM_GMAC_NAME, eth_initialize,
|
||||
ð0_data, ð0_config, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_api, GMAC_MTU);
|
||||
device_pm_control_nop, ð0_data, ð0_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_api, GMAC_MTU);
|
||||
|
||||
#if defined(CONFIG_PTP_CLOCK_SAM_GMAC)
|
||||
struct ptp_context {
|
||||
|
|
|
@ -678,6 +678,6 @@ int eth_init(struct device *dev)
|
|||
static struct eth_context eth_0_context;
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_smsc911x_0, "smsc911x_0",
|
||||
eth_init, ð_0_context,
|
||||
eth_init, device_pm_control_nop, ð_0_context,
|
||||
NULL /*ð_config_0*/, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU /*MTU*/);
|
||||
|
|
|
@ -352,7 +352,7 @@ static const struct ethernet_api eth_stellaris_apis = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(eth_stellaris, DT_INST_LABEL(0),
|
||||
eth_stellaris_dev_init, ð_data, ð_cfg,
|
||||
CONFIG_ETH_INIT_PRIORITY,
|
||||
eth_stellaris_dev_init, device_pm_control_nop,
|
||||
ð_data, ð_cfg, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_stellaris_apis, ETHERNET_L2,
|
||||
NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU);
|
||||
|
|
|
@ -594,5 +594,5 @@ static struct eth_stm32_hal_dev_data eth0_data = {
|
|||
};
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth0_stm32_hal, CONFIG_ETH_STM32_HAL_NAME, eth_initialize,
|
||||
ð0_data, ð0_config, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_api, ETH_STM32_HAL_MTU);
|
||||
device_pm_control_nop, ð0_data, ð0_config,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_STM32_HAL_MTU);
|
||||
|
|
|
@ -847,7 +847,8 @@ static struct ieee802154_radio_api cc1200_radio_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(cc1200, CONFIG_IEEE802154_CC1200_DRV_NAME,
|
||||
cc1200_init, &cc1200_context_data, NULL,
|
||||
cc1200_init, device_pm_control_nop,
|
||||
&cc1200_context_data, NULL,
|
||||
CONFIG_IEEE802154_CC1200_INIT_PRIO,
|
||||
&cc1200_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125);
|
||||
|
|
|
@ -715,7 +715,8 @@ static struct ieee802154_cc13xx_cc26xx_data ieee802154_cc13xx_cc26xx_data = {
|
|||
|
||||
NET_DEVICE_INIT(ieee802154_cc13xx_cc26xx,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_DRV_NAME,
|
||||
ieee802154_cc13xx_cc26xx_init, &ieee802154_cc13xx_cc26xx_data,
|
||||
NULL, CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
ieee802154_cc13xx_cc26xx_init, device_pm_control_nop,
|
||||
&ieee802154_cc13xx_cc26xx_data, NULL,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
&ieee802154_cc13xx_cc26xx_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU);
|
||||
|
|
|
@ -1146,7 +1146,8 @@ DEVICE_AND_API_INIT(cc2520, CONFIG_IEEE802154_CC2520_DRV_NAME,
|
|||
&cc2520_radio_api);
|
||||
#else
|
||||
NET_DEVICE_INIT(cc2520, CONFIG_IEEE802154_CC2520_DRV_NAME,
|
||||
cc2520_init, &cc2520_context_data, NULL,
|
||||
cc2520_init, device_pm_control_nop,
|
||||
&cc2520_context_data, NULL,
|
||||
CONFIG_IEEE802154_CC2520_INIT_PRIO,
|
||||
&cc2520_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125);
|
||||
|
|
|
@ -1108,6 +1108,7 @@ NET_DEVICE_INIT(
|
|||
kw41z, /* Device Name */
|
||||
CONFIG_IEEE802154_KW41Z_DRV_NAME, /* Driver Name */
|
||||
kw41z_init, /* Initialization Function */
|
||||
device_pm_control_nop, /* No PM API support */
|
||||
&kw41z_context_data, /* Context data */
|
||||
NULL, /* Configuration info */
|
||||
CONFIG_IEEE802154_KW41Z_INIT_PRIO, /* Initial priority */
|
||||
|
|
|
@ -1471,7 +1471,7 @@ DEVICE_AND_API_INIT(mcr20a, CONFIG_IEEE802154_MCR20A_DRV_NAME,
|
|||
&mcr20a_radio_api);
|
||||
#else
|
||||
NET_DEVICE_INIT(mcr20a, CONFIG_IEEE802154_MCR20A_DRV_NAME,
|
||||
mcr20a_init, &mcr20a_context_data, NULL,
|
||||
mcr20a_init, device_pm_control_nop, &mcr20a_context_data, NULL,
|
||||
CONFIG_IEEE802154_MCR20A_INIT_PRIO,
|
||||
&mcr20a_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2),
|
||||
|
|
|
@ -627,7 +627,7 @@ static struct ieee802154_radio_api nrf5_radio_api = {
|
|||
|
||||
#if defined(CONFIG_NET_L2_IEEE802154) || defined(CONFIG_NET_L2_OPENTHREAD)
|
||||
NET_DEVICE_INIT(nrf5_154_radio, CONFIG_IEEE802154_NRF5_DRV_NAME,
|
||||
nrf5_init, &nrf5_data, &nrf5_radio_cfg,
|
||||
nrf5_init, device_pm_control_nop, &nrf5_data, &nrf5_radio_cfg,
|
||||
CONFIG_IEEE802154_NRF5_INIT_PRIO,
|
||||
&nrf5_radio_api, L2,
|
||||
L2_CTX_TYPE, MTU);
|
||||
|
|
|
@ -895,6 +895,7 @@ static struct ieee802154_radio_api rf2xx_radio_api = {
|
|||
rf2xx_##n, \
|
||||
DT_INST_##n##_ATMEL_RF2XX_LABEL, \
|
||||
&rf2xx_init, \
|
||||
device_pm_control_nop, \
|
||||
&rf2xx_ctx_data_##n, \
|
||||
&rf2xx_ctx_config_##n, \
|
||||
CONFIG_IEEE802154_RF2XX_INIT_PRIO, \
|
||||
|
|
|
@ -384,7 +384,8 @@ static struct ieee802154_radio_api upipe_radio_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(upipe_15_4, CONFIG_IEEE802154_UPIPE_DRV_NAME,
|
||||
upipe_init, &upipe_context_data, NULL,
|
||||
upipe_init, device_pm_control_nop,
|
||||
&upipe_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&upipe_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125);
|
||||
|
|
|
@ -1523,6 +1523,6 @@ error:
|
|||
}
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(modem_sara, CONFIG_MODEM_UBLOX_SARA_R4_NAME,
|
||||
modem_init, &mdata, NULL,
|
||||
modem_init, device_pm_control_nop, &mdata, NULL,
|
||||
CONFIG_MODEM_UBLOX_SARA_R4_INIT_PRIORITY, &api_funcs,
|
||||
MDM_MAX_DATA_LENGTH);
|
||||
|
|
|
@ -1836,6 +1836,6 @@ static struct net_if_api api_funcs = {
|
|||
};
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(modem_wncm14a2a, "MODEM_WNCM14A2A",
|
||||
wncm14a2a_init, &ictx,
|
||||
wncm14a2a_init, device_pm_control_nop, &ictx,
|
||||
NULL, CONFIG_MODEM_WNCM14A2A_INIT_PRIORITY, &api_funcs,
|
||||
MDM_MAX_DATA_LENGTH);
|
||||
|
|
|
@ -100,7 +100,7 @@ static struct dummy_api loopback_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(loopback, "lo",
|
||||
loopback_dev_init, NULL, NULL,
|
||||
loopback_dev_init, device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&loopback_api, DUMMY_L2,
|
||||
NET_L2_GET_CTX_TYPE(DUMMY_L2), 536);
|
||||
|
|
|
@ -721,6 +721,6 @@ static const struct ppp_api ppp_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(ppp, CONFIG_NET_PPP_DRV_NAME, ppp_driver_init,
|
||||
&ppp_driver_context_data, NULL,
|
||||
device_pm_control_nop, &ppp_driver_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ppp_if_api,
|
||||
PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), PPP_MTU);
|
||||
|
|
|
@ -455,9 +455,11 @@ static const struct ethernet_api slip_if_api = {
|
|||
#define _SLIP_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2)
|
||||
#define _SLIP_MTU 1500
|
||||
|
||||
ETH_NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, &slip_context_data,
|
||||
NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &slip_if_api,
|
||||
_SLIP_MTU);
|
||||
ETH_NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME,
|
||||
slip_init, device_pm_control_nop,
|
||||
&slip_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&slip_if_api, _SLIP_MTU);
|
||||
#else
|
||||
|
||||
static const struct dummy_api slip_if_api = {
|
||||
|
@ -470,7 +472,7 @@ static const struct dummy_api slip_if_api = {
|
|||
#define _SLIP_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
#define _SLIP_MTU 576
|
||||
|
||||
NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, &slip_context_data,
|
||||
NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &slip_if_api,
|
||||
_SLIP_L2_LAYER, _SLIP_L2_CTX_TYPE, _SLIP_MTU);
|
||||
NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, device_pm_control_nop,
|
||||
&slip_context_data, NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&slip_if_api, _SLIP_L2_LAYER, _SLIP_L2_CTX_TYPE, _SLIP_MTU);
|
||||
#endif
|
||||
|
|
|
@ -871,6 +871,6 @@ error:
|
|||
}
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(wifi_esp, CONFIG_WIFI_ESP_NAME,
|
||||
esp_init, &esp_driver_data, NULL,
|
||||
esp_init, device_pm_control_nop, &esp_driver_data, NULL,
|
||||
CONFIG_WIFI_INIT_PRIORITY, &esp_api,
|
||||
ESP_MTU);
|
||||
|
|
|
@ -680,5 +680,5 @@ static const struct net_wifi_mgmt_offload eswifi_offload_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(eswifi_mgmt, CONFIG_WIFI_ESWIFI_NAME,
|
||||
eswifi_init, &eswifi0, NULL,
|
||||
eswifi_init, device_pm_control_nop, &eswifi0, NULL,
|
||||
CONFIG_WIFI_INIT_PRIORITY, &eswifi_offload_api, 1500);
|
||||
|
|
|
@ -262,6 +262,7 @@ static int simplelink_init(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(simplelink, CONFIG_WIFI_SIMPLELINK_NAME,
|
||||
simplelink_init, &simplelink_data, NULL,
|
||||
simplelink_init, device_pm_control_nop,
|
||||
&simplelink_data, NULL,
|
||||
CONFIG_WIFI_INIT_PRIORITY, &simplelink_api,
|
||||
CONFIG_WIFI_SIMPLELINK_MAX_PACKET_SIZE);
|
||||
|
|
|
@ -1113,6 +1113,6 @@ static int winc1500_init(struct device *dev)
|
|||
}
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(winc1500, CONFIG_WIFI_WINC1500_NAME,
|
||||
winc1500_init, &w1500_data, NULL,
|
||||
winc1500_init, device_pm_control_nop, &w1500_data, NULL,
|
||||
CONFIG_WIFI_INIT_PRIORITY, &winc1500_api,
|
||||
CONFIG_WIFI_WINC1500_MAX_PACKET_SIZE);
|
||||
|
|
|
@ -616,6 +616,8 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
|||
* @param drv_name The name this instance of the driver exposes to
|
||||
* the system.
|
||||
* @param init_fn Address to the init function of the driver.
|
||||
* @param pm_control_fn Pointer to device_pm_control function.
|
||||
* Can be empty function (device_pm_control_nop) if not implemented.
|
||||
* @param data Pointer to the device's configuration data.
|
||||
* @param cfg_info The address to the structure containing the
|
||||
* configuration information for this instance of the driver.
|
||||
|
@ -625,18 +627,18 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
|
|||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||
*/
|
||||
#if defined(CONFIG_NET_VLAN)
|
||||
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, \
|
||||
data, cfg_info, prio, api, mtu) \
|
||||
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
||||
data, cfg_info, prio, api, mtu) \
|
||||
DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2)); \
|
||||
NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
|
||||
|
||||
#else /* CONFIG_NET_VLAN */
|
||||
|
||||
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, \
|
||||
#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
||||
data, cfg_info, prio, api, mtu) \
|
||||
NET_DEVICE_INIT(dev_name, drv_name, init_fn, \
|
||||
NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
||||
data, cfg_info, prio, api, ETHERNET_L2, \
|
||||
NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
|
||||
|
||||
|
|
|
@ -2170,6 +2170,8 @@ struct net_if_api {
|
|||
* @param drv_name The name this instance of the driver exposes to
|
||||
* the system.
|
||||
* @param init_fn Address to the init function of the driver.
|
||||
* @param pm_control_fn Pointer to device_pm_control function.
|
||||
* Can be empty function (device_pm_control_nop) if not implemented.
|
||||
* @param data Pointer to the device's configuration data.
|
||||
* @param cfg_info The address to the structure containing the
|
||||
* configuration information for this instance of the driver.
|
||||
|
@ -2180,12 +2182,12 @@ struct net_if_api {
|
|||
* @param l2_ctx_type Type of L2 context data.
|
||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||
*/
|
||||
#define NET_DEVICE_INIT(dev_name, drv_name, init_fn, \
|
||||
data, cfg_info, prio, api, l2, \
|
||||
l2_ctx_type, mtu) \
|
||||
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
NET_L2_DATA_INIT(dev_name, 0, l2_ctx_type); \
|
||||
#define NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
|
||||
data, cfg_info, prio, api, l2, \
|
||||
l2_ctx_type, mtu) \
|
||||
DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
NET_L2_DATA_INIT(dev_name, 0, l2_ctx_type); \
|
||||
NET_IF_INIT(dev_name, 0, l2, mtu, NET_IF_MAX_CONFIGS)
|
||||
|
||||
/**
|
||||
|
@ -2201,6 +2203,8 @@ struct net_if_api {
|
|||
* the system.
|
||||
* @param instance Instance identifier.
|
||||
* @param init_fn Address to the init function of the driver.
|
||||
* @param pm_control_fn Pointer to device_pm_control function.
|
||||
* Can be empty function (device_pm_control_nop) if not implemented.
|
||||
* @param data Pointer to the device's configuration data.
|
||||
* @param cfg_info The address to the structure containing the
|
||||
* configuration information for this instance of the driver.
|
||||
|
@ -2212,10 +2216,10 @@ struct net_if_api {
|
|||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||
*/
|
||||
#define NET_DEVICE_INIT_INSTANCE(dev_name, drv_name, instance, init_fn, \
|
||||
data, cfg_info, prio, api, l2, \
|
||||
l2_ctx_type, mtu) \
|
||||
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
pm_control_fn, data, cfg_info, prio, \
|
||||
api, l2, l2_ctx_type, mtu) \
|
||||
DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
NET_L2_DATA_INIT(dev_name, instance, l2_ctx_type); \
|
||||
NET_IF_INIT(dev_name, instance, l2, mtu, NET_IF_MAX_CONFIGS)
|
||||
|
||||
|
@ -2230,6 +2234,8 @@ struct net_if_api {
|
|||
* @param drv_name The name this instance of the driver exposes to
|
||||
* the system.
|
||||
* @param init_fn Address to the init function of the driver.
|
||||
* @param pm_control_fn Pointer to device_pm_control function.
|
||||
* Can be empty function (device_pm_control_nop) if not implemented.
|
||||
* @param data Pointer to the device's configuration data.
|
||||
* @param cfg_info The address to the structure containing the
|
||||
* configuration information for this instance of the driver.
|
||||
|
@ -2238,10 +2244,11 @@ struct net_if_api {
|
|||
* used by the driver. Can be NULL.
|
||||
* @param mtu Maximum transfer unit in bytes for this network interface.
|
||||
*/
|
||||
#define NET_DEVICE_OFFLOAD_INIT(dev_name, drv_name, init_fn, \
|
||||
data, cfg_info, prio, api, mtu) \
|
||||
DEVICE_AND_API_INIT(dev_name, drv_name, init_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
#define NET_DEVICE_OFFLOAD_INIT(dev_name, drv_name, init_fn, \
|
||||
pm_control_fn, data, cfg_info, prio, \
|
||||
api, mtu) \
|
||||
DEVICE_DEFINE(dev_name, drv_name, init_fn, pm_control_fn, data, \
|
||||
cfg_info, POST_KERNEL, prio, api); \
|
||||
NET_IF_OFFLOAD_INIT(dev_name, 0, mtu)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -160,6 +160,7 @@ static int netusb_init_dev(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
NET_DEVICE_INIT(eth_netusb, "eth_netusb", netusb_init_dev, NULL, NULL,
|
||||
NET_DEVICE_INIT(eth_netusb, "eth_netusb", netusb_init_dev,
|
||||
device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &netusb_api_funcs, ETHERNET_L2,
|
||||
NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU);
|
||||
|
|
|
@ -270,7 +270,7 @@ static struct dummy_api net_6lo_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(net_6lo_test, "net_6lo_test",
|
||||
net_6lo_dev_init, NULL, NULL,
|
||||
net_6lo_dev_init, device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_6lo_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ static struct dummy_api offload_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_OFFLOAD_INIT(net_offload, "net_offload",
|
||||
NULL, &offload_context_data, NULL,
|
||||
NULL, device_pm_control_nop,
|
||||
&offload_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&offload_if_api, 0);
|
||||
|
||||
|
|
|
@ -300,7 +300,8 @@ static const struct dummy_api net_arp_if_api = {
|
|||
#endif
|
||||
|
||||
NET_DEVICE_INIT(net_arp_test, "net_arp_test",
|
||||
net_arp_dev_init, &net_arp_context_data, NULL,
|
||||
net_arp_dev_init, device_pm_control_nop,
|
||||
&net_arp_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_arp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
|
|
|
@ -289,15 +289,17 @@ static int eth_init(struct device *dev)
|
|||
|
||||
ETH_NET_DEVICE_INIT(eth_offloading_disabled_test,
|
||||
"eth_offloading_disabled_test",
|
||||
eth_init, ð_context_offloading_disabled,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
eth_init, device_pm_control_nop,
|
||||
ð_context_offloading_disabled, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs_offloading_disabled,
|
||||
NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_offloading_enabled_test,
|
||||
"eth_offloading_enabled_test",
|
||||
eth_init, ð_context_offloading_enabled,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
eth_init, device_pm_control_nop,
|
||||
ð_context_offloading_enabled, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs_offloading_enabled,
|
||||
NET_ETH_MTU);
|
||||
|
||||
|
|
|
@ -967,7 +967,8 @@ static struct dummy_api net_context_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT(net_context_test, "net_context_test",
|
||||
net_context_dev_init, &net_context_data, NULL,
|
||||
net_context_dev_init, device_pm_control_nop,
|
||||
&net_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_context_if_api, _ETH_L2_LAYER,
|
||||
_ETH_L2_CTX_TYPE, 127);
|
||||
|
|
|
@ -380,7 +380,8 @@ static struct dummy_api net_dhcpv4_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(net_dhcpv4_test, "net_dhcpv4_test",
|
||||
net_dhcpv4_dev_init, &net_dhcpv4_context_data, NULL,
|
||||
net_dhcpv4_dev_init, device_pm_control_nop,
|
||||
&net_dhcpv4_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_dhcpv4_if_api, DUMMY_L2,
|
||||
NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
|
||||
|
|
|
@ -301,9 +301,9 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
static void test_change_mac_when_up(void)
|
||||
{
|
||||
|
|
|
@ -120,6 +120,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -181,9 +182,9 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
|
||||
static const char *iface2str(struct net_if *iface)
|
||||
|
|
|
@ -305,7 +305,8 @@ static struct dummy_api net_icmpv4_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(net_icmpv4_test, "net_icmpv4_test",
|
||||
net_icmpv4_dev_init, &net_icmpv4_context_data, NULL,
|
||||
net_icmpv4_dev_init, device_pm_control_nop,
|
||||
&net_icmpv4_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_icmpv4_if_api, DUMMY_L2,
|
||||
NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
|
||||
|
|
|
@ -182,7 +182,7 @@ static struct dummy_api net_fragment_if_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(net_fragment_test, "net_fragment_test",
|
||||
net_fragment_dev_init, NULL, NULL,
|
||||
net_fragment_dev_init, device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_fragment_if_api, DUMMY_L2,
|
||||
NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
|
||||
|
|
|
@ -126,7 +126,7 @@ static struct ieee802154_radio_api fake_radio_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(fake, "fake_ieee802154",
|
||||
fake_init, NULL, NULL,
|
||||
fake_init, device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&fake_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125);
|
||||
|
|
|
@ -149,6 +149,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -161,6 +162,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface2_test,
|
|||
"iface2",
|
||||
iface2,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface2_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -173,6 +175,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface3_test,
|
|||
"iface3",
|
||||
iface3,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface3_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -257,9 +260,9 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
|
||||
static const char *iface2str(struct net_if *iface)
|
||||
|
|
|
@ -153,13 +153,15 @@ static struct dummy_api net_test_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_addr_test1, "net_addr_test1", iface1,
|
||||
net_test_init, &net_test_context_data, NULL,
|
||||
net_test_init, device_pm_control_nop,
|
||||
&net_test_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE,
|
||||
127);
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_addr_test2, "net_addr_test2", iface2,
|
||||
net_test_init, &net_test_context_data, NULL,
|
||||
net_test_init, device_pm_control_nop,
|
||||
&net_test_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE,
|
||||
127);
|
||||
|
|
|
@ -283,7 +283,7 @@ static const struct ethernet_api net_test_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2)
|
||||
|
||||
NET_DEVICE_INIT(net_test_ipv6, "net_test_ipv6",
|
||||
net_test_dev_init, &net_test_data, NULL,
|
||||
net_test_dev_init, device_pm_control_nop, &net_test_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE,
|
||||
127);
|
||||
|
|
|
@ -1365,6 +1365,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -1377,6 +1378,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface2_test,
|
|||
"iface2",
|
||||
iface2,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface2_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
|
|
@ -132,6 +132,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
|
|
@ -186,6 +186,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
|
|
@ -90,7 +90,8 @@ static struct dummy_api fake_iface_api = {
|
|||
};
|
||||
|
||||
NET_DEVICE_INIT(net_event_test, "net_event_test",
|
||||
fake_dev_init, NULL, NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
fake_dev_init, device_pm_control_nop,
|
||||
NULL, NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&fake_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
|
||||
|
||||
void test_requesting_nm(void)
|
||||
|
|
|
@ -142,7 +142,7 @@ static struct dummy_api net_test_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT(net_test_mld, "net_test_mld",
|
||||
net_test_dev_init, &net_test_data, NULL,
|
||||
net_test_dev_init, device_pm_control_nop, &net_test_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE,
|
||||
127);
|
||||
|
|
|
@ -73,7 +73,7 @@ static const struct dummy_api fake_dev_api = {
|
|||
#endif
|
||||
|
||||
NET_DEVICE_INIT(fake_dev, "fake_dev",
|
||||
fake_dev_init, NULL, NULL,
|
||||
fake_dev_init, device_pm_control_nop, NULL, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&fake_dev_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE,
|
||||
NET_ETH_MTU);
|
||||
|
|
|
@ -142,13 +142,15 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", eth_fake_init, ð_fake_data1,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1",
|
||||
eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data1, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", eth_fake_init, ð_fake_data2,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2",
|
||||
eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data2, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
|
||||
static const char *iface2str(struct net_if *iface)
|
||||
|
|
|
@ -155,16 +155,16 @@ static int eth_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_test_1, "eth_test_1", eth_init, ð_context_1, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_test_1, "eth_test_1", eth_init, device_pm_control_nop,
|
||||
ð_context_1, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_test_2, "eth_test_2", eth_init, ð_context_2, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_test_2, "eth_test_2", eth_init, device_pm_control_nop,
|
||||
ð_context_2, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_test_3, "eth_test_3", eth_init, ð_context_3, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_test_3, "eth_test_3", eth_init, device_pm_control_nop,
|
||||
ð_context_3, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
static u64_t timestamp_to_nsec(struct net_ptp_time *ts)
|
||||
|
|
|
@ -217,14 +217,18 @@ static struct dummy_api net_route_if_api_peer = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_route_test, "net_route_test", host,
|
||||
net_route_dev_init, &net_route_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_route_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
net_route_dev_init, device_pm_control_nop,
|
||||
&net_route_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_route_if_api, _ETH_L2_LAYER,
|
||||
_ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_route_test_peer, "net_route_test_peer", peer,
|
||||
net_route_dev_init, &net_route_data_peer, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_route_if_api_peer, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
net_route_dev_init, device_pm_control_nop,
|
||||
&net_route_data_peer, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_route_if_api_peer, _ETH_L2_LAYER,
|
||||
_ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
static void test_init(void)
|
||||
{
|
||||
|
|
|
@ -135,7 +135,8 @@ static struct dummy_api net_udp_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT(net_udp_test, "net_udp_test",
|
||||
net_udp_dev_init, &net_udp_context_data, NULL,
|
||||
net_udp_dev_init, device_pm_control_nop,
|
||||
&net_udp_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_udp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
|
|
|
@ -67,12 +67,14 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", eth_fake_init, ð_fake_data1,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", eth_fake_init,
|
||||
device_pm_control_nop, ð_fake_data1, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", eth_fake_init, ð_fake_data2,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", eth_fake_init,
|
||||
device_pm_control_nop, ð_fake_data2, NULL,
|
||||
CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
static int setup_socket(struct net_if *iface)
|
||||
|
|
|
@ -262,9 +262,9 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
/* A test thread that spits out events that we can catch and show to user */
|
||||
static void trigger_events(void)
|
||||
|
|
|
@ -808,9 +808,9 @@ static int eth_fake_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, ð_fake_data,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs,
|
||||
NET_ETH_MTU);
|
||||
ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, device_pm_control_nop,
|
||||
ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
ð_fake_api_funcs, NET_ETH_MTU);
|
||||
|
||||
static void setup_eth(void)
|
||||
{
|
||||
|
|
|
@ -1384,14 +1384,17 @@ static struct dummy_api net_tcp_if_api_peer = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_tcp_test, "net_tcp_test", host,
|
||||
net_tcp_dev_init, &net_tcp_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_tcp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
net_tcp_dev_init, device_pm_control_nop,
|
||||
&net_tcp_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_tcp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
NET_DEVICE_INIT_INSTANCE(net_tcp_test_peer, "net_tcp_test_peer", peer,
|
||||
net_tcp_dev_init, &net_tcp_context_data_peer, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_tcp_if_api_peer, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
net_tcp_dev_init, device_pm_control_nop,
|
||||
&net_tcp_context_data_peer, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_tcp_if_api_peer,
|
||||
_ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
static bool test_init_tcp_context(void)
|
||||
{
|
||||
|
|
|
@ -265,8 +265,8 @@ static int eth_init(struct device *dev)
|
|||
* is quite unlikely that this would be done in real life but for testing
|
||||
* purposes create it here.
|
||||
*/
|
||||
NET_DEVICE_INIT(eth_test, "eth_test", eth_init, ð_context,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_DEVICE_INIT(eth_test, "eth_test", eth_init, device_pm_control_nop,
|
||||
ð_context, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2),
|
||||
NET_ETH_MTU);
|
||||
|
||||
|
|
|
@ -152,12 +152,12 @@ static int eth_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_test, "eth_test", eth_init, ð_context,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_test, "eth_test", eth_init, device_pm_control_nop,
|
||||
ð_context, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_test2, "eth_test2", eth_init, ð_context2,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETH_NET_DEVICE_INIT(eth_test2, "eth_test2", eth_init, device_pm_control_nop,
|
||||
ð_context2, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
NET_ETH_MTU);
|
||||
|
||||
static void timestamp_callback(struct net_pkt *pkt)
|
||||
|
|
|
@ -137,7 +137,8 @@ static struct dummy_api net_udp_if_api = {
|
|||
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
|
||||
|
||||
NET_DEVICE_INIT(net_udp_test, "net_udp_test",
|
||||
net_udp_dev_init, &net_udp_context_data, NULL,
|
||||
net_udp_dev_init, device_pm_control_nop,
|
||||
&net_udp_context_data, NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&net_udp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
|
||||
|
||||
|
|
|
@ -170,7 +170,8 @@ static int eth_vlan_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ETH_NET_DEVICE_INIT(eth_vlan_test, "eth_vlan_test", eth_vlan_init,
|
||||
ETH_NET_DEVICE_INIT(eth_vlan_test, "eth_vlan_test",
|
||||
eth_vlan_init, device_pm_control_nop,
|
||||
ð_vlan_context, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs, NET_ETH_MTU);
|
||||
|
||||
|
@ -187,9 +188,9 @@ static int eth_init(struct device *dev)
|
|||
* is quite unlikely that this would be done in real life but for testing
|
||||
* purposes create it here.
|
||||
*/
|
||||
NET_DEVICE_INIT(eth_test, "eth_test", eth_init, ð_vlan_context,
|
||||
NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs,
|
||||
ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),
|
||||
NET_DEVICE_INIT(eth_test, "eth_test", eth_init, device_pm_control_nop,
|
||||
ð_vlan_context, NULL, CONFIG_ETH_INIT_PRIORITY,
|
||||
&api_funcs, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),
|
||||
NET_ETH_MTU);
|
||||
|
||||
struct net_if_test {
|
||||
|
@ -251,6 +252,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test,
|
|||
"iface1",
|
||||
iface1,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface1_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
@ -263,6 +265,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface2_test,
|
|||
"iface2",
|
||||
iface2,
|
||||
net_iface_dev_init,
|
||||
device_pm_control_nop,
|
||||
&net_iface2_data,
|
||||
NULL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
|
|
Loading…
Reference in a new issue