From 5a9a39caf3bf5195a38194bb844a428eaa7f2bb8 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 24 Apr 2025 19:30:07 +0300 Subject: [PATCH] net: mgmt: Convert the mgmt API to use 64-bit masks Instead of using 32 bit enum values for event numbers, convert the code to use 64 bit long bit fields. This means that the user API is changed to use 64 bit event values instead of 32 bit event values. Signed-off-by: Jukka Rissanen --- .../networking/api/coap_server.rst | 2 +- doc/connectivity/networking/api/net_mgmt.rst | 6 +- drivers/modem/modem_cellular.c | 2 +- drivers/wifi/esp32/src/esp_wifi_drv.c | 2 +- include/zephyr/net/coap_mgmt.h | 20 +- include/zephyr/net/conn_mgr_connectivity.h | 14 +- include/zephyr/net/ethernet_mgmt.h | 20 +- include/zephyr/net/ieee802154_mgmt.h | 11 +- include/zephyr/net/net_event.h | 245 ++++++++++++------ include/zephyr/net/net_mgmt.h | 85 +++--- include/zephyr/net/ppp.h | 20 +- include/zephyr/net/socket_net_mgmt.h | 2 +- include/zephyr/net/wifi_mgmt.h | 63 +++-- modules/hostap/src/supp_events.h | 27 +- modules/hostap/src/supp_main.c | 4 +- samples/boards/nxp/s32/netc/src/main.c | 2 +- samples/net/capture/src/main.c | 4 +- samples/net/cloud/mqtt_azure/src/main.c | 2 +- samples/net/cloud/tagoio_http_post/src/wifi.c | 2 +- samples/net/common/net_sample_common.c | 2 +- samples/net/dhcpv4_client/src/main.c | 2 +- samples/net/dns_resolve/src/main.c | 2 +- samples/net/dsa/src/main.c | 2 +- samples/net/ipv4_autoconf/src/main.c | 2 +- samples/net/lwm2m_client/src/lwm2m-client.c | 4 +- samples/net/mqtt_sn_publisher/src/main.c | 2 +- .../secure_mqtt_sensor_actuator/src/main.c | 2 +- samples/net/sockets/coap_download/src/main.c | 2 +- samples/net/sockets/coap_server/src/events.c | 2 +- .../sockets/dumb_http_server_mt/src/main.c | 2 +- .../net/sockets/echo_client/src/echo-client.c | 4 +- .../net/sockets/echo_server/src/echo-server.c | 2 +- samples/net/sockets/packet/src/packet.c | 2 +- samples/net/sockets/txtime/src/main.c | 2 +- samples/net/wifi/apsta_mode/src/main.c | 2 +- samples/subsys/mgmt/updatehub/src/main.c | 2 +- subsys/logging/backends/log_backend_net.c | 2 +- subsys/mgmt/mcumgr/transport/src/smp_udp.c | 2 +- subsys/net/conn_mgr/conn_mgr_connectivity.c | 4 +- subsys/net/conn_mgr/events_handler.c | 16 +- subsys/net/ip/ipv4_autoconf.c | 2 +- subsys/net/ip/ipv6_pe.c | 2 +- subsys/net/ip/net_mgmt.c | 36 +-- subsys/net/ip/net_stats.c | 2 +- subsys/net/ip/pmtu.c | 1 - subsys/net/l2/ethernet/arp.c | 4 +- subsys/net/l2/ethernet/ethernet_mgmt.c | 4 +- subsys/net/l2/ethernet/ethernet_stats.c | 2 +- subsys/net/l2/ethernet/lldp/lldp.c | 4 +- subsys/net/l2/ieee802154/ieee802154_mgmt.c | 18 +- subsys/net/l2/ieee802154/ieee802154_shell.c | 4 +- subsys/net/l2/openthread/openthread.c | 2 +- subsys/net/l2/ppp/ppp_l2.c | 2 +- subsys/net/l2/virtual/virtual_mgmt.c | 4 +- subsys/net/l2/wifi/wifi_mgmt.c | 66 ++--- subsys/net/l2/wifi/wifi_shell.c | 4 +- subsys/net/lib/coap/coap.c | 2 +- subsys/net/lib/coap/coap_server.c | 2 +- subsys/net/lib/config/init.c | 26 +- subsys/net/lib/config/init_clock_sntp.c | 2 +- subsys/net/lib/dhcpv4/dhcpv4.c | 4 +- subsys/net/lib/dhcpv6/dhcpv6.c | 2 +- subsys/net/lib/dns/llmnr_responder.c | 2 +- subsys/net/lib/dns/mdns_responder.c | 8 +- subsys/net/lib/ptp/port.c | 2 +- subsys/net/lib/shell/events.c | 6 +- subsys/net/lib/sockets/sockets_net_mgmt.c | 4 +- subsys/shell/backends/shell_mqtt.c | 2 +- tests/boards/espressif/ethernet/src/main.c | 2 +- tests/boards/espressif/wifi/src/main.c | 2 +- tests/net/conn_mgr_conn/src/main.c | 2 +- tests/net/conn_mgr_monitor/src/main.c | 18 +- tests/net/conn_mgr_nsos/src/main.c | 2 +- tests/net/dhcpv4/client/prj.conf | 3 + tests/net/dhcpv4/client/src/main.c | 4 +- tests/net/dhcpv6/src/main.c | 2 +- tests/net/hostname/src/main.c | 2 +- .../ieee802154/l2/src/ieee802154_shell_test.c | 2 +- tests/net/igmp/src/main.c | 6 +- tests/net/lib/dns_addremove/src/main.c | 2 +- tests/net/mgmt/src/mgmt.c | 43 +-- tests/net/mld/src/main.c | 6 +- tests/net/pmtu/src/main.c | 6 +- 83 files changed, 546 insertions(+), 370 deletions(-) diff --git a/doc/connectivity/networking/api/coap_server.rst b/doc/connectivity/networking/api/coap_server.rst index c6ce9a64253..971e89bab4d 100644 --- a/doc/connectivity/networking/api/coap_server.rst +++ b/doc/connectivity/networking/api/coap_server.rst @@ -242,7 +242,7 @@ following example simply prints when an event occurs. #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) - void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, + void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { switch (mgmt_event) { diff --git a/doc/connectivity/networking/api/net_mgmt.rst b/doc/connectivity/networking/api/net_mgmt.rst index 2973ee82b04..7c47a63eee2 100644 --- a/doc/connectivity/networking/api/net_mgmt.rst +++ b/doc/connectivity/networking/api/net_mgmt.rst @@ -97,7 +97,7 @@ An example follows. struct net_mgmt_event_callback ipv4_callback; void callback_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_xxx) { @@ -139,7 +139,7 @@ Or similarly using :c:macro:`NET_MGMT_REGISTER_EVENT_HANDLER`. #define EVENT_IFACE_SET (NET_EVENT_IF_xxx | NET_EVENT_IF_yyy) #define EVENT_IPV4_SET (NET_EVENT_IPV4_xxx | NET_EVENT_IPV4_yyy) - static void event_handler(uint32_t mgmt_event, struct net_if *iface, + static void event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { @@ -183,7 +183,7 @@ You define your handler modeled with this signature: .. code-block:: c - static int your_handler(uint32_t mgmt_event, struct net_if *iface, + static int your_handler(uint64_t mgmt_event, struct net_if *iface, void *data, size_t len); and then register it with an associated mgmt_request code: diff --git a/drivers/modem/modem_cellular.c b/drivers/modem/modem_cellular.c index 1c00525b7d8..8eb87fd3608 100644 --- a/drivers/modem/modem_cellular.c +++ b/drivers/modem/modem_cellular.c @@ -1774,7 +1774,7 @@ static int modem_cellular_pm_action(const struct device *dev, enum pm_device_act } #endif /* CONFIG_PM_DEVICE */ -static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct modem_cellular_data *data = diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index b1499168a45..b6ce07024bc 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -77,7 +77,7 @@ struct esp32_wifi_runtime { static struct net_mgmt_event_callback esp32_dhcp_cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/include/zephyr/net/coap_mgmt.h b/include/zephyr/net/coap_mgmt.h index 961ca18d1ab..0cc25a9cb18 100644 --- a/include/zephyr/net/coap_mgmt.h +++ b/include/zephyr/net/coap_mgmt.h @@ -40,13 +40,25 @@ struct coap_service; struct coap_resource; struct coap_observer; +enum { + NET_EVENT_COAP_CMD_SERVICE_STARTED_VAL, + NET_EVENT_COAP_CMD_SERVICE_STOPPED_VAL, + NET_EVENT_COAP_CMD_OBSERVER_ADDED_VAL, + NET_EVENT_COAP_CMD_OBSERVER_REMOVED_VAL, + + NET_EVENT_COAP_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_COAP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_coap_cmd exceeds the limit"); + enum net_event_coap_cmd { /* Service events */ - NET_EVENT_COAP_CMD_SERVICE_STARTED = 1, - NET_EVENT_COAP_CMD_SERVICE_STOPPED, + NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STARTED), + NET_MGMT_CMD(NET_EVENT_COAP_CMD_SERVICE_STOPPED), /* Observer events */ - NET_EVENT_COAP_CMD_OBSERVER_ADDED, - NET_EVENT_COAP_CMD_OBSERVER_REMOVED, + NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_ADDED), + NET_MGMT_CMD(NET_EVENT_COAP_CMD_OBSERVER_REMOVED), }; /** @endcond */ diff --git a/include/zephyr/net/conn_mgr_connectivity.h b/include/zephyr/net/conn_mgr_connectivity.h index d1b0ea8106a..cb0f63fcfac 100644 --- a/include/zephyr/net/conn_mgr_connectivity.h +++ b/include/zephyr/net/conn_mgr_connectivity.h @@ -41,9 +41,19 @@ extern "C" { NET_MGMT_EVENT_BIT) #define NET_MGMT_CONN_IF_EVENT (NET_MGMT_IFACE_BIT | NET_MGMT_CONN_BASE) +enum { + NET_EVENT_CONN_CMD_IF_TIMEOUT_VAL, + NET_EVENT_CONN_CMD_IF_FATAL_ERROR_VAL, + + NET_EVENT_CONN_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_CONN_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_conn_cmd exceeds the limit"); + enum net_event_conn_cmd { - NET_EVENT_CONN_CMD_IF_TIMEOUT = 1, - NET_EVENT_CONN_CMD_IF_FATAL_ERROR, + NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_TIMEOUT), + NET_MGMT_CMD(NET_EVENT_CONN_CMD_IF_FATAL_ERROR), }; /** @endcond */ diff --git a/include/zephyr/net/ethernet_mgmt.h b/include/zephyr/net/ethernet_mgmt.h index 6ef7bbd9afb..f4a6bc20478 100644 --- a/include/zephyr/net/ethernet_mgmt.h +++ b/include/zephyr/net/ethernet_mgmt.h @@ -162,11 +162,23 @@ struct ethernet_req_params { }; }; +enum { + NET_EVENT_ETHERNET_CMD_CARRIER_ON_VAL, + NET_EVENT_ETHERNET_CMD_CARRIER_OFF_VAL, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED_VAL, + NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED_VAL, + + NET_EVENT_ETHERNET_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_ETHERNET_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ethernet_cmd exceeds the limit"); + enum net_event_ethernet_cmd { - NET_EVENT_ETHERNET_CMD_CARRIER_ON = 1, - NET_EVENT_ETHERNET_CMD_CARRIER_OFF, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED, - NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED, + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_ON), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_CARRIER_OFF), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_ENABLED), + NET_MGMT_CMD(NET_EVENT_ETHERNET_CMD_VLAN_TAG_DISABLED), }; #define NET_EVENT_ETHERNET_CARRIER_ON \ diff --git a/include/zephyr/net/ieee802154_mgmt.h b/include/zephyr/net/ieee802154_mgmt.h index bf20b49b720..970f8a89a9c 100644 --- a/include/zephyr/net/ieee802154_mgmt.h +++ b/include/zephyr/net/ieee802154_mgmt.h @@ -255,8 +255,17 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_SECURITY_SETTINGS); * @cond INTERNAL_HIDDEN */ +enum { + NET_EVENT_IEEE802154_CMD_SCAN_RESULT_VAL, + + NET_EVENT_IEEE802154_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IEEE802154_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ieee802154_cmd exceeds the limit"); + enum net_event_ieee802154_cmd { - NET_EVENT_IEEE802154_CMD_SCAN_RESULT = 1, + NET_MGMT_CMD(NET_EVENT_IEEE802154_CMD_SCAN_RESULT), }; /** diff --git a/include/zephyr/net/net_event.h b/include/zephyr/net/net_event.h index 0b8c995cd3e..3a948ca5ef9 100644 --- a/include/zephyr/net/net_event.h +++ b/include/zephyr/net/net_event.h @@ -34,11 +34,23 @@ extern "C" { NET_MGMT_LAYER(NET_IF_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IF_CORE_CODE)) +enum { + NET_EVENT_IF_CMD_DOWN_VAL, + NET_EVENT_IF_CMD_UP_VAL, + NET_EVENT_IF_CMD_ADMIN_DOWN_VAL, + NET_EVENT_IF_CMD_ADMIN_UP_VAL, + + NET_EVENT_IF_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IF_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_if_cmd exceeds the limit"); + enum net_event_if_cmd { - NET_EVENT_IF_CMD_DOWN = 1, - NET_EVENT_IF_CMD_UP, - NET_EVENT_IF_CMD_ADMIN_DOWN, - NET_EVENT_IF_CMD_ADMIN_UP, + NET_MGMT_CMD(NET_EVENT_IF_CMD_DOWN), + NET_MGMT_CMD(NET_EVENT_IF_CMD_UP), + NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_DOWN), + NET_MGMT_CMD(NET_EVENT_IF_CMD_ADMIN_UP), }; /* IPv6 Events */ @@ -49,32 +61,65 @@ enum net_event_if_cmd { NET_MGMT_LAYER(NET_IPV6_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV6_CORE_CODE)) +enum { + NET_EVENT_IPV6_CMD_ADDR_ADD_VAL, + NET_EVENT_IPV6_CMD_ADDR_DEL_VAL, + NET_EVENT_IPV6_CMD_MADDR_ADD_VAL, + NET_EVENT_IPV6_CMD_MADDR_DEL_VAL, + NET_EVENT_IPV6_CMD_PREFIX_ADD_VAL, + NET_EVENT_IPV6_CMD_PREFIX_DEL_VAL, + NET_EVENT_IPV6_CMD_MCAST_JOIN_VAL, + NET_EVENT_IPV6_CMD_MCAST_LEAVE_VAL, + NET_EVENT_IPV6_CMD_ROUTER_ADD_VAL, + NET_EVENT_IPV6_CMD_ROUTER_DEL_VAL, + NET_EVENT_IPV6_CMD_ROUTE_ADD_VAL, + NET_EVENT_IPV6_CMD_ROUTE_DEL_VAL, + NET_EVENT_IPV6_CMD_DAD_SUCCEED_VAL, + NET_EVENT_IPV6_CMD_DAD_FAILED_VAL, + NET_EVENT_IPV6_CMD_NBR_ADD_VAL, + NET_EVENT_IPV6_CMD_NBR_DEL_VAL, + NET_EVENT_IPV6_CMD_DHCP_START_VAL, + NET_EVENT_IPV6_CMD_DHCP_BOUND_VAL, + NET_EVENT_IPV6_CMD_DHCP_STOP_VAL, + NET_EVENT_IPV6_CMD_ADDR_DEPRECATED_VAL, + NET_EVENT_IPV6_CMD_PE_ENABLED_VAL, + NET_EVENT_IPV6_CMD_PE_DISABLED_VAL, + NET_EVENT_IPV6_CMD_PE_FILTER_ADD_VAL, + NET_EVENT_IPV6_CMD_PE_FILTER_DEL_VAL, + NET_EVENT_IPV6_CMD_PMTU_CHANGED_VAL, + + NET_EVENT_IPV6_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IPV6_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ipv6_cmd exceeds the limit"); + enum net_event_ipv6_cmd { - NET_EVENT_IPV6_CMD_ADDR_ADD = 1, - NET_EVENT_IPV6_CMD_ADDR_DEL, - NET_EVENT_IPV6_CMD_MADDR_ADD, - NET_EVENT_IPV6_CMD_MADDR_DEL, - NET_EVENT_IPV6_CMD_PREFIX_ADD, - NET_EVENT_IPV6_CMD_PREFIX_DEL, - NET_EVENT_IPV6_CMD_MCAST_JOIN, - NET_EVENT_IPV6_CMD_MCAST_LEAVE, - NET_EVENT_IPV6_CMD_ROUTER_ADD, - NET_EVENT_IPV6_CMD_ROUTER_DEL, - NET_EVENT_IPV6_CMD_ROUTE_ADD, - NET_EVENT_IPV6_CMD_ROUTE_DEL, - NET_EVENT_IPV6_CMD_DAD_SUCCEED, - NET_EVENT_IPV6_CMD_DAD_FAILED, - NET_EVENT_IPV6_CMD_NBR_ADD, - NET_EVENT_IPV6_CMD_NBR_DEL, - NET_EVENT_IPV6_CMD_DHCP_START, - NET_EVENT_IPV6_CMD_DHCP_BOUND, - NET_EVENT_IPV6_CMD_DHCP_STOP, - NET_EVENT_IPV6_CMD_ADDR_DEPRECATED, - NET_EVENT_IPV6_CMD_PE_ENABLED, - NET_EVENT_IPV6_CMD_PE_DISABLED, - NET_EVENT_IPV6_CMD_PE_FILTER_ADD, - NET_EVENT_IPV6_CMD_PE_FILTER_DEL, - NET_EVENT_IPV6_CMD_PMTU_CHANGED, + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PREFIX_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_JOIN), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_MCAST_LEAVE), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ROUTE_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_SUCCEED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DAD_FAILED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_NBR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_START), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_BOUND), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_DHCP_STOP), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_ADDR_DEPRECATED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_ENABLED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_DISABLED), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PE_FILTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV6_CMD_PMTU_CHANGED), }; /* IPv4 Events*/ @@ -85,22 +130,45 @@ enum net_event_ipv6_cmd { NET_MGMT_LAYER(NET_IPV4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_IPV4_CORE_CODE)) +enum { + NET_EVENT_IPV4_CMD_ADDR_ADD_VAL, + NET_EVENT_IPV4_CMD_ADDR_DEL_VAL, + NET_EVENT_IPV4_CMD_MADDR_ADD_VAL, + NET_EVENT_IPV4_CMD_MADDR_DEL_VAL, + NET_EVENT_IPV4_CMD_ROUTER_ADD_VAL, + NET_EVENT_IPV4_CMD_ROUTER_DEL_VAL, + NET_EVENT_IPV4_CMD_DHCP_START_VAL, + NET_EVENT_IPV4_CMD_DHCP_BOUND_VAL, + NET_EVENT_IPV4_CMD_DHCP_STOP_VAL, + NET_EVENT_IPV4_CMD_MCAST_JOIN_VAL, + NET_EVENT_IPV4_CMD_MCAST_LEAVE_VAL, + NET_EVENT_IPV4_CMD_ACD_SUCCEED_VAL, + NET_EVENT_IPV4_CMD_ACD_FAILED_VAL, + NET_EVENT_IPV4_CMD_ACD_CONFLICT_VAL, + NET_EVENT_IPV4_CMD_PMTU_CHANGED_VAL, + + NET_EVENT_IPV4_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_IPV4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ipv4_cmd exceeds the limit"); + enum net_event_ipv4_cmd { - NET_EVENT_IPV4_CMD_ADDR_ADD = 1, - NET_EVENT_IPV4_CMD_ADDR_DEL, - NET_EVENT_IPV4_CMD_MADDR_ADD, - NET_EVENT_IPV4_CMD_MADDR_DEL, - NET_EVENT_IPV4_CMD_ROUTER_ADD, - NET_EVENT_IPV4_CMD_ROUTER_DEL, - NET_EVENT_IPV4_CMD_DHCP_START, - NET_EVENT_IPV4_CMD_DHCP_BOUND, - NET_EVENT_IPV4_CMD_DHCP_STOP, - NET_EVENT_IPV4_CMD_MCAST_JOIN, - NET_EVENT_IPV4_CMD_MCAST_LEAVE, - NET_EVENT_IPV4_CMD_ACD_SUCCEED, - NET_EVENT_IPV4_CMD_ACD_FAILED, - NET_EVENT_IPV4_CMD_ACD_CONFLICT, - NET_EVENT_IPV4_CMD_PMTU_CHANGED, + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MADDR_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_ADD), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ROUTER_DEL), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_START), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_BOUND), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_DHCP_STOP), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_JOIN), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_MCAST_LEAVE), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_SUCCEED), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_FAILED), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_ACD_CONFLICT), + NET_MGMT_CMD(NET_EVENT_IPV4_CMD_PMTU_CHANGED), }; /* L4 network events */ @@ -111,22 +179,45 @@ enum net_event_ipv4_cmd { NET_MGMT_LAYER(NET_L4_LAYER) | \ NET_MGMT_LAYER_CODE(NET_L4_CORE_CODE)) +enum { + NET_EVENT_L4_CMD_CONNECTED_VAL, + NET_EVENT_L4_CMD_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_IPV4_CONNECTED_VAL, + NET_EVENT_L4_CMD_IPV4_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_IPV6_CONNECTED_VAL, + NET_EVENT_L4_CMD_IPV6_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_DNS_SERVER_ADD_VAL, + NET_EVENT_L4_CMD_DNS_SERVER_DEL_VAL, + NET_EVENT_L4_CMD_HOSTNAME_CHANGED_VAL, + NET_EVENT_L4_CMD_CAPTURE_STARTED_VAL, + NET_EVENT_L4_CMD_CAPTURE_STOPPED_VAL, + NET_EVENT_L4_CMD_VPN_CONNECTED_VAL, + NET_EVENT_L4_CMD_VPN_DISCONNECTED_VAL, + NET_EVENT_L4_CMD_VPN_PEER_ADD_VAL, + NET_EVENT_L4_CMD_VPN_PEER_DEL_VAL, + + NET_EVENT_L4_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_L4_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_l4_cmd exceeds the limit"); + enum net_event_l4_cmd { - NET_EVENT_L4_CMD_CONNECTED = 1, - NET_EVENT_L4_CMD_DISCONNECTED, - NET_EVENT_L4_CMD_IPV4_CONNECTED, - NET_EVENT_L4_CMD_IPV4_DISCONNECTED, - NET_EVENT_L4_CMD_IPV6_CONNECTED, - NET_EVENT_L4_CMD_IPV6_DISCONNECTED, - NET_EVENT_L4_CMD_DNS_SERVER_ADD, - NET_EVENT_L4_CMD_DNS_SERVER_DEL, - NET_EVENT_L4_CMD_HOSTNAME_CHANGED, - NET_EVENT_L4_CMD_CAPTURE_STARTED, - NET_EVENT_L4_CMD_CAPTURE_STOPPED, - NET_EVENT_L4_CMD_VPN_CONNECTED, - NET_EVENT_L4_CMD_VPN_DISCONNECTED, - NET_EVENT_L4_CMD_VPN_PEER_ADD, - NET_EVENT_L4_CMD_VPN_PEER_DEL, + NET_MGMT_CMD(NET_EVENT_L4_CMD_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV4_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_IPV6_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_ADD), + NET_MGMT_CMD(NET_EVENT_L4_CMD_DNS_SERVER_DEL), + NET_MGMT_CMD(NET_EVENT_L4_CMD_HOSTNAME_CHANGED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STARTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_CAPTURE_STOPPED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_CONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_DISCONNECTED), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_ADD), + NET_MGMT_CMD(NET_EVENT_L4_CMD_VPN_PEER_DEL), }; /** @endcond */ @@ -153,11 +244,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 address is removed from the system. */ #define NET_EVENT_IPV6_ADDR_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL) /** Event emitted when an IPv6 multicast address is added to the system. */ #define NET_EVENT_IPV6_MADDR_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD) /** Event emitted when an IPv6 multicast address is removed from the system. */ #define NET_EVENT_IPV6_MADDR_DEL \ @@ -165,19 +256,19 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 prefix is added to the system. */ #define NET_EVENT_IPV6_PREFIX_ADD \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD) /** Event emitted when an IPv6 prefix is removed from the system. */ #define NET_EVENT_IPV6_PREFIX_DEL \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL) /** Event emitted when an IPv6 multicast group is joined. */ #define NET_EVENT_IPV6_MCAST_JOIN \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN) /** Event emitted when an IPv6 multicast group is left. */ #define NET_EVENT_IPV6_MCAST_LEAVE \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE) /** Event emitted when an IPv6 router is added to the system. */ #define NET_EVENT_IPV6_ROUTER_ADD \ @@ -213,15 +304,15 @@ enum net_event_l4_cmd { /** Event emitted when an IPv6 DHCP client starts. */ #define NET_EVENT_IPV6_DHCP_START \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_START) /** Event emitted when an IPv6 DHCP client address is bound. */ #define NET_EVENT_IPV6_DHCP_BOUND \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND) /** Event emitted when an IPv6 DHCP client is stopped. */ #define NET_EVENT_IPV6_DHCP_STOP \ - (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) + (NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP) /** IPv6 address is deprecated. */ #define NET_EVENT_IPV6_ADDR_DEPRECATED \ @@ -253,11 +344,11 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 address is removed from the system. */ #define NET_EVENT_IPV4_ADDR_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL) /** Event emitted when an IPv4 multicast address is added to the system. */ #define NET_EVENT_IPV4_MADDR_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD) /** Event emitted when an IPv4 multicast address is removed from the system. */ #define NET_EVENT_IPV4_MADDR_DEL \ @@ -265,31 +356,31 @@ enum net_event_l4_cmd { /** Event emitted when an IPv4 router is added to the system. */ #define NET_EVENT_IPV4_ROUTER_ADD \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD) /** Event emitted when an IPv4 router is removed from the system. */ #define NET_EVENT_IPV4_ROUTER_DEL \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL) /** Event emitted when an IPv4 DHCP client is started. */ #define NET_EVENT_IPV4_DHCP_START \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START) /** Event emitted when an IPv4 DHCP client address is bound. */ #define NET_EVENT_IPV4_DHCP_BOUND \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND) /** Event emitted when an IPv4 DHCP client is stopped. */ #define NET_EVENT_IPV4_DHCP_STOP \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP) /** Event emitted when an IPv4 multicast group is joined. */ #define NET_EVENT_IPV4_MCAST_JOIN \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN) /** Event emitted when an IPv4 multicast group is left. */ #define NET_EVENT_IPV4_MCAST_LEAVE \ - (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) + (NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE) /** Event emitted when an IPv4 address conflict detection succeeds. */ #define NET_EVENT_IPV4_ACD_SUCCEED \ diff --git a/include/zephyr/net/net_mgmt.h b/include/zephyr/net/net_mgmt.h index 04e95cbb5ec..9c559b7fd8b 100644 --- a/include/zephyr/net/net_mgmt.h +++ b/include/zephyr/net/net_mgmt.h @@ -14,7 +14,6 @@ #include #include -#include #include #ifdef __cplusplus @@ -36,38 +35,30 @@ struct net_if; /** * @brief NET MGMT event mask basics, normalizing parts of bit fields */ -#define NET_MGMT_EVENT_MASK 0x80000000 -#define NET_MGMT_ON_IFACE_MASK 0x40000000 -#define NET_MGMT_LAYER_MASK 0x30000000 -#define NET_MGMT_SYNC_EVENT_MASK 0x08000000 -#define NET_MGMT_LAYER_CODE_MASK 0x07FF0000 -#define NET_MGMT_COMMAND_MASK 0x0000FFFF - -#define NET_MGMT_EVENT_BIT BIT(31) -#define NET_MGMT_IFACE_BIT BIT(30) -#define NET_MGMT_SYNC_EVENT_BIT BIT(27) - -#define NET_MGMT_LAYER(_layer) (_layer << 28) -#define NET_MGMT_LAYER_CODE(_code) (_code << 16) - -#define NET_MGMT_EVENT(mgmt_request) \ - (mgmt_request & NET_MGMT_EVENT_MASK) +#define NET_MGMT_EVENT_MASK GENMASK64(63, 63) /* 0x8000000000000000 */ +#define NET_MGMT_ON_IFACE_MASK GENMASK64(62, 62) /* 0x4000000000000000 */ +#define NET_MGMT_LAYER_MASK GENMASK64(61, 60) /* 0x3000000000000000 */ +#define NET_MGMT_SYNC_EVENT_MASK GENMASK64(59, 59) /* 0x0800000000000000 */ +#define NET_MGMT_LAYER_CODE_MASK GENMASK64(58, 52) /* 0x07F0000000000000 */ +#define NET_MGMT_COMMAND_MASK GENMASK64(51, 0) /* 0x000FFFFFFFFFFFFF */ -#define NET_MGMT_ON_IFACE(mgmt_request) \ - (mgmt_request & NET_MGMT_ON_IFACE_MASK) +#define NET_MGMT_MAX_COMMANDS 52 /* TODO: figure out the value from mask */ -#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) \ - (mgmt_request & NET_MGMT_SYNC_EVENT_MASK) +#define NET_MGMT_EVENT_BIT BIT64(63) +#define NET_MGMT_IFACE_BIT BIT64(62) +#define NET_MGMT_SYNC_EVENT_BIT BIT64(59) -#define NET_MGMT_GET_LAYER(mgmt_request) \ - ((mgmt_request & NET_MGMT_LAYER_MASK) >> 28) +#define NET_MGMT_LAYER(_layer) FIELD_PREP(NET_MGMT_LAYER_MASK, (_layer)) +#define NET_MGMT_LAYER_CODE(_code) FIELD_PREP(NET_MGMT_LAYER_CODE_MASK, (_code)) -#define NET_MGMT_GET_LAYER_CODE(mgmt_request) \ - ((mgmt_request & NET_MGMT_LAYER_CODE_MASK) >> 16) - -#define NET_MGMT_GET_COMMAND(mgmt_request) \ - (mgmt_request & NET_MGMT_COMMAND_MASK) +#define NET_MGMT_EVENT(mgmt_request) FIELD_GET(NET_MGMT_EVENT_MASK, mgmt_request) +#define NET_MGMT_ON_IFACE(mgmt_request) FIELD_GET(NET_MGMT_ON_IFACE_MASK, mgmt_request) +#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) FIELD_GET(NET_MGMT_SYNC_EVENT_MASK, mgmt_request) +#define NET_MGMT_GET_LAYER(mgmt_request) FIELD_GET(NET_MGMT_LAYER_MASK, mgmt_request) +#define NET_MGMT_GET_LAYER_CODE(mgmt_request) FIELD_GET(NET_MGMT_LAYER_CODE_MASK, mgmt_request) +#define NET_MGMT_GET_COMMAND(mgmt_request) FIELD_GET(NET_MGMT_COMMAND_MASK, mgmt_request) +#define NET_MGMT_CMD(cmd) cmd = BIT64(cmd ##_VAL) /* Useful generic definitions */ #define NET_MGMT_LAYER_L2 1 @@ -102,6 +93,8 @@ enum net_mgmt_layer_code { NET_MGMT_LAYER_CODE_RESERVED = 0x7F /**< Reserved layer code for future use */ }; +#include + /** * @typedef net_mgmt_request_handler_t * @brief Signature which all Net MGMT request handler need to follow @@ -113,7 +106,7 @@ enum net_mgmt_layer_code { * NULL otherwise. * @param len Length in byte of the memory pointed by data. */ -typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request, +typedef int (*net_mgmt_request_handler_t)(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len); @@ -134,7 +127,7 @@ typedef int (*net_mgmt_request_handler_t)(uint32_t mgmt_request, * @param _mgmt_request Management event identifier */ #define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request) \ - extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \ + extern int net_mgmt_##_mgmt_request(uint64_t mgmt_request, \ struct net_if *iface, \ void *data, size_t len) @@ -158,7 +151,7 @@ struct net_mgmt_event_callback; * if it's an event on an iface. NULL otherwise. */ typedef void (*net_mgmt_event_handler_t)(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface); /** @@ -202,11 +195,11 @@ struct net_mgmt_event_callback { * receive events from multiple layers, one must have multiple * listeners registered, one for each layer being listened. */ - uint32_t event_mask; + uint64_t event_mask; /** Internal place holder when a synchronous event wait is * successfully unlocked on a event. */ - uint32_t raised_event; + uint64_t raised_event; }; }; @@ -221,7 +214,7 @@ struct net_mgmt_event_callback { * @param info_length Length in bytes of the memory pointed by @p info. * @param user_data Data provided by the user to the handler. */ -typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event, +typedef void (*net_mgmt_event_static_handler_t)(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data); @@ -230,7 +223,7 @@ typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event, /* Structure for event handler registered at compile time */ struct net_mgmt_event_static_handler { - uint32_t event_mask; + uint64_t event_mask; net_mgmt_event_static_handler_t handler; void *user_data; }; @@ -267,7 +260,7 @@ struct net_mgmt_event_static_handler { static inline void net_mgmt_init_event_callback(struct net_mgmt_event_callback *cb, net_mgmt_event_handler_t handler, - uint32_t mgmt_event_mask) + uint64_t mgmt_event_mask) { __ASSERT(cb, "Callback pointer should not be NULL"); __ASSERT(handler, "Handler pointer should not be NULL"); @@ -313,7 +306,7 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb); * is not defined. */ #if defined(CONFIG_NET_MGMT_EVENT) -void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length); #else #define net_mgmt_event_notify_with_info(...) @@ -326,7 +319,7 @@ void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, * based on an iface. NULL otherwise. */ #if defined(CONFIG_NET_MGMT_EVENT) -static inline void net_mgmt_event_notify(uint32_t mgmt_event, +static inline void net_mgmt_event_notify(uint64_t mgmt_event, struct net_if *iface) { net_mgmt_event_notify_with_info(mgmt_event, iface, NULL, 0); @@ -356,15 +349,15 @@ static inline void net_mgmt_event_notify(uint32_t mgmt_event, * actual event. */ #ifdef CONFIG_NET_MGMT_EVENT -int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, k_timeout_t timeout); #else -static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +static inline int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -401,15 +394,15 @@ static inline int net_mgmt_event_wait(uint32_t mgmt_event_mask, */ #ifdef CONFIG_NET_MGMT_EVENT int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout); #else static inline int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/include/zephyr/net/ppp.h b/include/zephyr/net/ppp.h index a2b63b7dd1e..a2f58825c35 100644 --- a/include/zephyr/net/ppp.h +++ b/include/zephyr/net/ppp.h @@ -570,11 +570,23 @@ void net_ppp_init(struct net_if *iface); NET_MGMT_LAYER_CODE(NET_PPP_CODE)) #define NET_PPP_EVENT (NET_PPP_BASE | NET_MGMT_EVENT_BIT) +enum { + NET_EVENT_PPP_CMD_CARRIER_ON_VAL, + NET_EVENT_PPP_CMD_CARRIER_OFF_VAL, + NET_EVENT_PPP_CMD_PHASE_RUNNING_VAL, + NET_EVENT_PPP_CMD_PHASE_DEAD_VAL, + + NET_EVENT_PPP_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_PPP_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_ppp_cmd exceeds the limit"); + enum net_event_ppp_cmd { - NET_EVENT_PPP_CMD_CARRIER_ON = 1, - NET_EVENT_PPP_CMD_CARRIER_OFF, - NET_EVENT_PPP_CMD_PHASE_RUNNING, - NET_EVENT_PPP_CMD_PHASE_DEAD, + NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_ON), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_CARRIER_OFF), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_RUNNING), + NET_MGMT_CMD(NET_EVENT_PPP_CMD_PHASE_DEAD), }; struct net_if; diff --git a/include/zephyr/net/socket_net_mgmt.h b/include/zephyr/net/socket_net_mgmt.h index 8f3c5829ad3..337648d5d18 100644 --- a/include/zephyr/net/socket_net_mgmt.h +++ b/include/zephyr/net/socket_net_mgmt.h @@ -73,7 +73,7 @@ struct sockaddr_nm { uintptr_t nm_pid; /** net_mgmt mask */ - uint32_t nm_mask; + uint64_t nm_mask; }; diff --git a/include/zephyr/net/wifi_mgmt.h b/include/zephyr/net/wifi_mgmt.h index 64088070dc0..40dd023839a 100644 --- a/include/zephyr/net/wifi_mgmt.h +++ b/include/zephyr/net/wifi_mgmt.h @@ -317,44 +317,73 @@ NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING); NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_NEIGHBOR_REP_COMPLETE); +/** @cond INTERNAL_HIDDEN */ + +enum { + NET_EVENT_WIFI_CMD_SCAN_RESULT_VAL, + NET_EVENT_WIFI_CMD_SCAN_DONE_VAL, + NET_EVENT_WIFI_CMD_CONNECT_RESULT_VAL, + NET_EVENT_WIFI_CMD_DISCONNECT_RESULT_VAL, + NET_EVENT_WIFI_CMD_IFACE_STATUS_VAL, + NET_EVENT_WIFI_CMD_TWT_VAL, + NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE_VAL, + NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT_VAL, + NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE_VAL, + NET_EVENT_WIFI_CMD_SIGNAL_CHANGE_VAL, + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED_VAL, + NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE_VAL, + NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT_VAL, + NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT_VAL, + NET_EVENT_WIFI_CMD_AP_STA_CONNECTED_VAL, + NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED_VAL, + NET_EVENT_WIFI_CMD_SUPPLICANT_VAL, + + NET_EVENT_WIFI_CMD_MAX, +}; + +BUILD_ASSERT(NET_EVENT_WIFI_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_wifi_cmd exceeds the limit"); + +/** @endcond */ + /** @brief Wi-Fi management events */ enum net_event_wifi_cmd { /** Scan results available */ - NET_EVENT_WIFI_CMD_SCAN_RESULT = 1, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_RESULT), /** Scan done */ - NET_EVENT_WIFI_CMD_SCAN_DONE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SCAN_DONE), /** Connect result */ - NET_EVENT_WIFI_CMD_CONNECT_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_CONNECT_RESULT), /** Disconnect result */ - NET_EVENT_WIFI_CMD_DISCONNECT_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_RESULT), /** Interface status */ - NET_EVENT_WIFI_CMD_IFACE_STATUS, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_IFACE_STATUS), /** TWT events */ - NET_EVENT_WIFI_CMD_TWT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT), /** TWT sleep status: awake or sleeping, can be used by application * to determine if it can send data or not. */ - NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_TWT_SLEEP_STATE), /** Raw scan results available */ - NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_RAW_SCAN_RESULT), /** Disconnect complete */ - NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_DISCONNECT_COMPLETE), /** Signal change event */ - NET_EVENT_WIFI_CMD_SIGNAL_CHANGE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SIGNAL_CHANGE), /** Neighbor Report */ - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED), /** Neighbor Report complete */ - NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE), /** AP mode enable result */ - NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT), /** AP mode disable result */ - NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_DISABLE_RESULT), /** STA connected to AP */ - NET_EVENT_WIFI_CMD_AP_STA_CONNECTED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_CONNECTED), /** STA disconnected from AP */ - NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_AP_STA_DISCONNECTED), /** Supplicant specific event */ - NET_EVENT_WIFI_CMD_SUPPLICANT, + NET_MGMT_CMD(NET_EVENT_WIFI_CMD_SUPPLICANT), }; /** Event emitted for Wi-Fi scan result */ diff --git a/modules/hostap/src/supp_events.h b/modules/hostap/src/supp_events.h index 09c30e7a37f..1c74af52849 100644 --- a/modules/hostap/src/supp_events.h +++ b/modules/hostap/src/supp_events.h @@ -17,14 +17,27 @@ NET_MGMT_IFACE_BIT) #define NET_MGMT_SUPPLICANT_EVENT (NET_MGMT_EVENT_BIT | NET_MGMT_SUPPLICANT_BASE) +enum { + NET_EVENT_SUPPLICANT_CMD_READY_VAL, + NET_EVENT_SUPPLICANT_CMD_NOT_READY_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING_VAL, + NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED_VAL, + NET_EVENT_SUPPLICANT_CMD_INT_EVENT_VAL, + + NET_EVENT_SUPPLICANT_CMD_MAX +}; + +BUILD_ASSERT(NET_EVENT_SUPPLICANT_CMD_MAX <= NET_MGMT_MAX_COMMANDS, + "Number of events in net_event_supplicant_cmd exceeds the limit"); + enum net_event_supplicant_cmd { - NET_EVENT_SUPPLICANT_CMD_READY = 1, - NET_EVENT_SUPPLICANT_CMD_NOT_READY, - NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING, - NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED, - NET_EVENT_SUPPLICANT_CMD_INT_EVENT, - NET_EVENT_WIFI_CMD_MAX + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_READY), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_NOT_READY), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_ADDED), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVING), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_IFACE_REMOVED), + NET_MGMT_CMD(NET_EVENT_SUPPLICANT_CMD_INT_EVENT), }; #define NET_EVENT_SUPPLICANT_READY \ diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c index 5ba2ef5b10c..ab20729448d 100644 --- a/modules/hostap/src/supp_main.c +++ b/modules/hostap/src/supp_main.c @@ -495,14 +495,14 @@ static void submit_iface_work(struct supplicant_context *ctx, } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_INF_MON static void interface_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & INTERFACE_EVENT_MASK) != mgmt_event) { return; } if (!is_wanted_interface(iface)) { - LOG_DBG("Ignoring event (0x%02x) from interface %d (%p)", + LOG_DBG("Ignoring event (0x%" PRIx64 ") from interface %d (%p)", mgmt_event, net_if_get_by_iface(iface), iface); return; } diff --git a/samples/boards/nxp/s32/netc/src/main.c b/samples/boards/nxp/s32/netc/src/main.c index 8399a7dd9b5..09e6cea9883 100644 --- a/samples/boards/nxp/s32/netc/src/main.c +++ b/samples/boards/nxp/s32/netc/src/main.c @@ -69,7 +69,7 @@ static int setup_iface(struct net_if *iface, const char *ipv6_addr, } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/capture/src/main.c b/samples/net/capture/src/main.c index 3feafc4eb25..1b68ee30afa 100644 --- a/samples/net/capture/src/main.c +++ b/samples/net/capture/src/main.c @@ -285,7 +285,7 @@ static int init_app(void) #define EVENT_MASK (NET_EVENT_CAPTURE_STARTED | NET_EVENT_CAPTURE_STOPPED) static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); @@ -307,7 +307,7 @@ int main(void) { static struct net_mgmt_event_callback mgmt_cb; struct net_if *iface; - uint32_t event; + uint64_t event; int ret; LOG_INF("Starting network capture sample"); diff --git a/samples/net/cloud/mqtt_azure/src/main.c b/samples/net/cloud/mqtt_azure/src/main.c index 841c1fb7ebe..538461af2d1 100644 --- a/samples/net/cloud/mqtt_azure/src/main.c +++ b/samples/net/cloud/mqtt_azure/src/main.c @@ -487,7 +487,7 @@ static void abort_mqtt_connection(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & L4_EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/cloud/tagoio_http_post/src/wifi.c b/samples/net/cloud/tagoio_http_post/src/wifi.c index f9eb52b7a59..a0cd121d62b 100644 --- a/samples/net/cloud/tagoio_http_post/src/wifi.c +++ b/samples/net/cloud/tagoio_http_post/src/wifi.c @@ -26,7 +26,7 @@ static void handle_wifi_connect_result(struct net_mgmt_event_callback *cb) } static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: diff --git a/samples/net/common/net_sample_common.c b/samples/net/common/net_sample_common.c index e1b91c91122..0b570a64feb 100644 --- a/samples/net/common/net_sample_common.c +++ b/samples/net/common/net_sample_common.c @@ -20,7 +20,7 @@ LOG_MODULE_REGISTER(net_samples_common, LOG_LEVEL_DBG); static struct net_mgmt_event_callback l4_cb; static K_SEM_DEFINE(network_connected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { switch (event) { diff --git a/samples/net/dhcpv4_client/src/main.c b/samples/net/dhcpv4_client/src/main.c index 00d48949d73..72f7a17f273 100644 --- a/samples/net/dhcpv4_client/src/main.c +++ b/samples/net/dhcpv4_client/src/main.c @@ -38,7 +38,7 @@ static void start_dhcpv4_client(struct net_if *iface, void *user_data) } static void handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/dns_resolve/src/main.c b/samples/net/dns_resolve/src/main.c index 23e5645d0b4..5302f569874 100644 --- a/samples/net/dns_resolve/src/main.c +++ b/samples/net/dns_resolve/src/main.c @@ -198,7 +198,7 @@ static void print_dhcpv4_addr(struct net_if *iface, struct net_if_addr *if_addr, } static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { diff --git a/samples/net/dsa/src/main.c b/samples/net/dsa/src/main.c index 16d41af5999..a84b2cef7a9 100644 --- a/samples/net/dsa/src/main.c +++ b/samples/net/dsa/src/main.c @@ -54,7 +54,7 @@ static void dsa_iface_find_cb(struct net_if *iface, void *user_data) static struct net_mgmt_event_callback mgmt_cb; static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/ipv4_autoconf/src/main.c b/samples/net/ipv4_autoconf/src/main.c index c4e93105cf7..9dd9fa53bb7 100644 --- a/samples/net/ipv4_autoconf/src/main.c +++ b/samples/net/ipv4_autoconf/src/main.c @@ -25,7 +25,7 @@ LOG_MODULE_REGISTER(net_ipv4_autoconf_sample, LOG_LEVEL_DBG); static struct net_mgmt_event_callback mgmt_cb; static void handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int i = 0; diff --git a/samples/net/lwm2m_client/src/lwm2m-client.c b/samples/net/lwm2m_client/src/lwm2m-client.c index 9127769ff6b..7c15f84502c 100644 --- a/samples/net/lwm2m_client/src/lwm2m-client.c +++ b/samples/net/lwm2m_client/src/lwm2m-client.c @@ -334,7 +334,7 @@ static void on_net_event_l4_connected(void) } static void l4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t event, + uint64_t event, struct net_if *iface) { switch (event) { @@ -356,7 +356,7 @@ static void l4_event_handler(struct net_mgmt_event_callback *cb, } static void connectivity_event_handler(struct net_mgmt_event_callback *cb, - uint32_t event, + uint64_t event, struct net_if *iface) { if (event == NET_EVENT_CONN_IF_FATAL_ERROR) { diff --git a/samples/net/mqtt_sn_publisher/src/main.c b/samples/net/mqtt_sn_publisher/src/main.c index 65436daea4d..fddeb4c976f 100644 --- a/samples/net/mqtt_sn_publisher/src/main.c +++ b/samples/net/mqtt_sn_publisher/src/main.c @@ -30,7 +30,7 @@ K_SEM_DEFINE(run_app, 0, 1); #define EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED) -static void net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { diff --git a/samples/net/secure_mqtt_sensor_actuator/src/main.c b/samples/net/secure_mqtt_sensor_actuator/src/main.c index 64993139e90..9b6872a69cf 100644 --- a/samples/net/secure_mqtt_sensor_actuator/src/main.c +++ b/samples/net/secure_mqtt_sensor_actuator/src/main.c @@ -30,7 +30,7 @@ static struct net_mgmt_event_callback net_l4_mgmt_cb; K_SEM_DEFINE(net_conn_sem, 0, 1); static void net_l4_evt_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_L4_CONNECTED: diff --git a/samples/net/sockets/coap_download/src/main.c b/samples/net/sockets/coap_download/src/main.c index bb15551cfba..2e1ee6c59d3 100644 --- a/samples/net/sockets/coap_download/src/main.c +++ b/samples/net/sockets/coap_download/src/main.c @@ -21,7 +21,7 @@ static int64_t start_time; /* This struct contains (potentially large) TX and RX buffers, so allocate statically */ static struct coap_client client = {0}; -static void net_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void net_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (NET_EVENT_L4_CONNECTED == mgmt_event) { diff --git a/samples/net/sockets/coap_server/src/events.c b/samples/net/sockets/coap_server/src/events.c index 3f843fba017..8c621214a7d 100644 --- a/samples/net/sockets/coap_server/src/events.c +++ b/samples/net/sockets/coap_server/src/events.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(net_coap_service_sample); #define COAP_EVENTS_SET (NET_EVENT_COAP_OBSERVER_ADDED | NET_EVENT_COAP_OBSERVER_REMOVED | \ NET_EVENT_COAP_SERVICE_STARTED | NET_EVENT_COAP_SERVICE_STOPPED) -void coap_event_handler(uint32_t mgmt_event, struct net_if *iface, +void coap_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/samples/net/sockets/dumb_http_server_mt/src/main.c b/samples/net/sockets/dumb_http_server_mt/src/main.c index ed19fa96833..4c8a1021923 100644 --- a/samples/net/sockets/dumb_http_server_mt/src/main.c +++ b/samples/net/sockets/dumb_http_server_mt/src/main.c @@ -98,7 +98,7 @@ K_THREAD_DEFINE(tcp6_thread_id, STACK_SIZE, NET_EVENT_L4_DISCONNECTED) static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_client/src/echo-client.c b/samples/net/sockets/echo_client/src/echo-client.c index 3ca9ddc8aa0..9c451b9c3cc 100644 --- a/samples/net/sockets/echo_client/src/echo-client.c +++ b/samples/net/sockets/echo_client/src/echo-client.c @@ -229,7 +229,7 @@ static int check_our_ipv6_sockets(int sock, } static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static char addr_str[INET6_ADDRSTRLEN]; @@ -297,7 +297,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/samples/net/sockets/echo_server/src/echo-server.c b/samples/net/sockets/echo_server/src/echo-server.c index fd6bd4f6acf..c4dc98b4004 100644 --- a/samples/net/sockets/echo_server/src/echo-server.c +++ b/samples/net/sockets/echo_server/src/echo-server.c @@ -82,7 +82,7 @@ static void stop_udp_and_tcp(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(iface); ARG_UNUSED(cb); diff --git a/samples/net/sockets/packet/src/packet.c b/samples/net/sockets/packet/src/packet.c index 3b3af25c7ab..e4354254b3e 100644 --- a/samples/net/sockets/packet/src/packet.c +++ b/samples/net/sockets/packet/src/packet.c @@ -229,7 +229,7 @@ static void send_packet(void) } static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { k_sem_give(&iface_up); diff --git a/samples/net/sockets/txtime/src/main.c b/samples/net/sockets/txtime/src/main.c index d4bc85a3f2a..870e10f8ff7 100644 --- a/samples/net/sockets/txtime/src/main.c +++ b/samples/net/sockets/txtime/src/main.c @@ -71,7 +71,7 @@ static void quit(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static bool dhcpv4_done; diff --git a/samples/net/wifi/apsta_mode/src/main.c b/samples/net/wifi/apsta_mode/src/main.c index eb90b1c2104..aa0d0cb28cb 100644 --- a/samples/net/wifi/apsta_mode/src/main.c +++ b/samples/net/wifi/apsta_mode/src/main.c @@ -36,7 +36,7 @@ static struct wifi_connect_req_params sta_config; static struct net_mgmt_event_callback cb; -static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/samples/subsys/mgmt/updatehub/src/main.c b/samples/subsys/mgmt/updatehub/src/main.c index 73d64a1a694..9f9af6ae003 100644 --- a/samples/subsys/mgmt/updatehub/src/main.c +++ b/samples/subsys/mgmt/updatehub/src/main.c @@ -63,7 +63,7 @@ void start_updatehub(void) } static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & EVENT_MASK) != mgmt_event) { return; diff --git a/subsys/logging/backends/log_backend_net.c b/subsys/logging/backends/log_backend_net.c index 11f0612724f..b0e3ca5c425 100644 --- a/subsys/logging/backends/log_backend_net.c +++ b/subsys/logging/backends/log_backend_net.c @@ -367,7 +367,7 @@ const struct log_backend *log_backend_net_get(void) } #if defined(CONFIG_LOG_BACKEND_NET_USE_CONNECTION_MANAGER) -static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/mgmt/mcumgr/transport/src/smp_udp.c b/subsys/mgmt/mcumgr/transport/src/smp_udp.c index 8067b36d6e6..e3da22e6731 100644 --- a/subsys/mgmt/mcumgr/transport/src/smp_udp.c +++ b/subsys/mgmt/mcumgr/transport/src/smp_udp.c @@ -280,7 +280,7 @@ static void smp_udp_open_iface(struct net_if *iface, void *user_data) } } -static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void smp_udp_net_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/conn_mgr/conn_mgr_connectivity.c b/subsys/net/conn_mgr/conn_mgr_connectivity.c index 5bf8e3f58be..905b5b07d1c 100644 --- a/subsys/net/conn_mgr/conn_mgr_connectivity.c +++ b/subsys/net/conn_mgr/conn_mgr_connectivity.c @@ -315,7 +315,7 @@ static void conn_mgr_conn_handle_iface_down(struct net_if *iface) } static struct net_mgmt_event_callback conn_mgr_conn_iface_cb; -static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_IFACE_EVENTS_MASK) != mgmt_event) { @@ -333,7 +333,7 @@ static void conn_mgr_conn_iface_handler(struct net_mgmt_event_callback *cb, uint } static struct net_mgmt_event_callback conn_mgr_conn_self_cb; -static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void conn_mgr_conn_self_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event & CONN_MGR_CONN_SELF_EVENTS_MASK) != mgmt_event) { diff --git a/subsys/net/conn_mgr/events_handler.c b/subsys/net/conn_mgr/events_handler.c index 8f15a8b6c62..2a0c6fefc28 100644 --- a/subsys/net/conn_mgr/events_handler.c +++ b/subsys/net/conn_mgr/events_handler.c @@ -19,12 +19,12 @@ static struct net_mgmt_event_callback ipv6_events_cb; static struct net_mgmt_event_callback ipv4_events_cb; static void conn_mgr_iface_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "Iface", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "Iface", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IFACE_EVENTS_MASK) != mgmt_event) { @@ -55,12 +55,12 @@ done: #if defined(CONFIG_NET_IPV6) static void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv6", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv6", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV6_EVENTS_MASK) != mgmt_event) { @@ -101,7 +101,7 @@ done: #else static inline void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -112,12 +112,12 @@ void conn_mgr_ipv6_events_handler(struct net_mgmt_event_callback *cb, #if defined(CONFIG_NET_IPV4) static void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { int idx; - NET_DBG("%s event 0x%x received on iface %d (%p)", "IPv4", mgmt_event, + NET_DBG("%s event 0x%" PRIx64 " received on iface %d (%p)", "IPv4", mgmt_event, net_if_get_by_iface(iface), iface); if ((mgmt_event & CONN_MGR_IPV4_EVENTS_MASK) != mgmt_event) { @@ -159,7 +159,7 @@ done: #else static inline void conn_mgr_ipv4_events_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/ip/ipv4_autoconf.c b/subsys/net/ip/ipv4_autoconf.c index 057bd6f41a6..fc32ce7d7da 100644 --- a/subsys/net/ip/ipv4_autoconf.c +++ b/subsys/net/ip/ipv4_autoconf.c @@ -55,7 +55,7 @@ static inline void ipv4_autoconf_addr_set(struct net_if_ipv4_autoconf *ipv4auto) } static void acd_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct net_if_config *cfg; struct in_addr *addr; diff --git a/subsys/net/ip/ipv6_pe.c b/subsys/net/ip/ipv6_pe.c index 4379dc47e7e..bb03683db39 100644 --- a/subsys/net/ip/ipv6_pe.c +++ b/subsys/net/ip/ipv6_pe.c @@ -501,7 +501,7 @@ static void ipv6_pe_recheck_filters(bool is_denylist) #if CONFIG_NET_IPV6_PE_FILTER_PREFIX_COUNT > 0 static void send_filter_event(struct in6_addr *addr, bool is_denylist, - int event_type) + uint64_t event_type) { if (IS_ENABLED(CONFIG_NET_MGMT_EVENT_INFO)) { struct net_event_ipv6_pe_filter info; diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index 4fbc1a1b599..d48a54e5611 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -27,7 +27,7 @@ struct mgmt_event_entry { #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ size_t info_length; #endif /* CONFIG_NET_MGMT_EVENT_INFO */ - uint32_t event; + uint64_t event; struct net_if *iface; }; @@ -47,7 +47,7 @@ K_KERNEL_STACK_DEFINE(mgmt_stack, CONFIG_NET_MGMT_EVENT_STACK_SIZE); static struct k_work_q mgmt_work_q_obj; #endif -static uint32_t global_event_mask; +static uint64_t global_event_mask; static sys_slist_t event_callbacks = SYS_SLIST_STATIC_INIT(&event_callbacks); /* Forward declaration for the actual caller */ @@ -67,7 +67,7 @@ static struct k_work_q *mgmt_work_q = COND_CODE_1(CONFIG_NET_MGMT_EVENT_SYSTEM_W static void mgmt_event_work_handler(struct k_work *work); static K_WORK_DEFINE(mgmt_work, mgmt_event_work_handler); -static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, +static inline void mgmt_push_event(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -85,7 +85,7 @@ static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, memcpy(new_event.info, info, length); new_event.info_length = length; } else { - NET_ERR("Event %u info length %zu > max size %zu", + NET_ERR("Event 0x%" PRIx64 " info length %zu > max size %zu", mgmt_event, length, NET_EVENT_INFO_MAX_SIZE); (void)k_mutex_unlock(&net_mgmt_event_lock); @@ -99,7 +99,7 @@ static inline void mgmt_push_event(uint32_t mgmt_event, struct net_if *iface, if (k_msgq_put(&event_msgq, &new_event, K_MSEC(CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT)) != 0) { - NET_WARN("Failure to push event (%u), " + NET_WARN("Failure to push event (0x%" PRIx64 "), " "try increasing the 'CONFIG_NET_MGMT_EVENT_QUEUE_SIZE' " "or 'CONFIG_NET_MGMT_EVENT_QUEUE_TIMEOUT' options.", mgmt_event); @@ -128,7 +128,7 @@ static void mgmt_event_work_handler(struct k_work *work) #else -static inline void mgmt_push_event(uint32_t event, struct net_if *iface, +static inline void mgmt_push_event(uint64_t event, struct net_if *iface, const void *info, size_t length) { #ifndef CONFIG_NET_MGMT_EVENT_INFO @@ -149,7 +149,7 @@ static inline void mgmt_push_event(uint32_t event, struct net_if *iface, #endif /* CONFIG_NET_MGMT_EVENT_QUEUE */ -static inline void mgmt_add_event_mask(uint32_t event_mask) +static inline void mgmt_add_event_mask(uint64_t event_mask) { global_event_mask |= event_mask; } @@ -169,7 +169,7 @@ static inline void mgmt_rebuild_global_event_mask(void) } } -static inline bool mgmt_is_event_handled(uint32_t mgmt_event) +static inline bool mgmt_is_event_handled(uint64_t mgmt_event) { return (((NET_MGMT_GET_LAYER(mgmt_event) & NET_MGMT_GET_LAYER(global_event_mask)) == @@ -188,7 +188,7 @@ static inline void mgmt_run_slist_callbacks(const struct mgmt_event_entry * cons struct net_mgmt_event_callback *cb, *tmp; /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Event layer %u code %u cmd %u", + NET_DBG("Event layer 0x%" PRIx64 " code 0x%" PRIx64 " cmd 0x%" PRIx64, NET_MGMT_GET_LAYER(mgmt_event->event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event->event), NET_MGMT_GET_COMMAND(mgmt_event->event)); @@ -283,8 +283,8 @@ static void mgmt_run_callbacks(const struct mgmt_event_entry * const mgmt_event) } static int mgmt_event_wait_call(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **event_iface, const void **info, size_t *info_length, @@ -303,7 +303,7 @@ static int mgmt_event_wait_call(struct net_if *iface, sync_data.iface = iface; } - NET_DBG("Synchronous event 0x%08x wait %p", sync.event_mask, &sync); + NET_DBG("Synchronous event 0x%" PRIx64 " wait %p", sync.event_mask, &sync); net_mgmt_add_event_callback(&sync); @@ -367,12 +367,12 @@ void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb) (void)k_mutex_unlock(&net_mgmt_callback_lock); } -void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, +void net_mgmt_event_notify_with_info(uint64_t mgmt_event, struct net_if *iface, const void *info, size_t length) { if (mgmt_is_event_handled(mgmt_event)) { /* Readable layer code is starting from 1, thus the increment */ - NET_DBG("Notifying Event layer %u code %u type %u", + NET_DBG("Notifying Event layer 0x%" PRIx64 " code 0x%" PRIx64 " type 0x%" PRIx64, NET_MGMT_GET_LAYER(mgmt_event) + 1, NET_MGMT_GET_LAYER_CODE(mgmt_event), NET_MGMT_GET_COMMAND(mgmt_event)); @@ -381,8 +381,8 @@ void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, } } -int net_mgmt_event_wait(uint32_t mgmt_event_mask, - uint32_t *raised_event, +int net_mgmt_event_wait(uint64_t mgmt_event_mask, + uint64_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, @@ -394,8 +394,8 @@ int net_mgmt_event_wait(uint32_t mgmt_event_mask, } int net_mgmt_event_wait_on_iface(struct net_if *iface, - uint32_t mgmt_event_mask, - uint32_t *raised_event, + uint64_t mgmt_event_mask, + uint64_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout) diff --git a/subsys/net/ip/net_stats.c b/subsys/net/ip/net_stats.c index 5da625faeb6..9e7d0bb6fc7 100644 --- a/subsys/net/ip/net_stats.c +++ b/subsys/net/ip/net_stats.c @@ -252,7 +252,7 @@ void net_print_statistics(void) #if defined(CONFIG_NET_STATISTICS_USER_API) -static int net_stats_get(uint32_t mgmt_request, struct net_if *iface, +static int net_stats_get(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/ip/pmtu.c b/subsys/net/ip/pmtu.c index be2c3355a6b..cdd09ed0ca8 100644 --- a/subsys/net/ip/pmtu.c +++ b/subsys/net/ip/pmtu.c @@ -12,7 +12,6 @@ LOG_MODULE_REGISTER(net_pmtu, CONFIG_NET_PMTU_LOG_LEVEL); #include -#include #include #include #include "pmtu.h" diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index af816185fe1..d49ab054eaa 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -569,7 +569,7 @@ static void notify_all_ipv4_addr(struct net_if *iface) } static void iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -586,7 +586,7 @@ static void iface_event_handler(struct net_mgmt_event_callback *cb, } static void ipv4_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct in_addr *ipaddr; diff --git a/subsys/net/l2/ethernet/ethernet_mgmt.c b/subsys/net/l2/ethernet/ethernet_mgmt.c index 645f7036720..88272612cde 100644 --- a/subsys/net/l2/ethernet/ethernet_mgmt.c +++ b/subsys/net/l2/ethernet/ethernet_mgmt.c @@ -25,7 +25,7 @@ static inline bool is_hw_caps_supported(const struct device *dev, return ((api->get_capabilities(dev) & caps) != 0); } -static int ethernet_set_config(uint32_t mgmt_request, +static int ethernet_set_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -207,7 +207,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_TXINJECTION_MODE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_ETHERNET_SET_MAC_FILTER, ethernet_set_config); -static int ethernet_get_config(uint32_t mgmt_request, +static int ethernet_get_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ethernet/ethernet_stats.c b/subsys/net/l2/ethernet/ethernet_stats.c index ccbbd53e2f2..57d354623f6 100644 --- a/subsys/net/l2/ethernet/ethernet_stats.c +++ b/subsys/net/l2/ethernet/ethernet_stats.c @@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(net_ethernet_stats, CONFIG_NET_L2_ETHERNET_LOG_LEVEL); #if defined(CONFIG_NET_STATISTICS_USER_API) -static int eth_stats_get(uint32_t mgmt_request, struct net_if *iface, +static int eth_stats_get(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { size_t len_chk = 0; diff --git a/subsys/net/l2/ethernet/lldp/lldp.c b/subsys/net/l2/ethernet/lldp/lldp.c index 2895691d6f0..230e69eb6b8 100644 --- a/subsys/net/l2/ethernet/lldp/lldp.c +++ b/subsys/net/l2/ethernet/lldp/lldp.c @@ -234,7 +234,7 @@ static int lldp_check_iface(struct net_if *iface) return 0; } -static int lldp_start(struct net_if *iface, uint32_t mgmt_event) +static int lldp_start(struct net_if *iface, uint64_t mgmt_event) { struct ethernet_context *ctx; int ret, slot; @@ -328,7 +328,7 @@ int net_lldp_register_callback(struct net_if *iface, net_lldp_recv_cb_t recv_cb) } static void iface_event_handler(struct net_mgmt_event_callback *evt_cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { lldp_start(iface, mgmt_event); } diff --git a/subsys/net/l2/ieee802154/ieee802154_mgmt.c b/subsys/net/l2/ieee802154/ieee802154_mgmt.c index 993bcc12ae9..3c654c375b6 100644 --- a/subsys/net/l2/ieee802154/ieee802154_mgmt.c +++ b/subsys/net/l2/ieee802154/ieee802154_mgmt.c @@ -74,7 +74,7 @@ enum net_verdict ieee802154_handle_beacon(struct net_if *iface, return NET_CONTINUE; } -static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_cancel_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -94,7 +94,7 @@ static int ieee802154_cancel_scan(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_CANCEL_SCAN, ieee802154_cancel_scan); -static int ieee802154_scan(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct ieee802154_phy_supported_channels *supported_channels; @@ -437,7 +437,7 @@ out: return NET_DROP; } -static int ieee802154_associate(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_associate(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -631,7 +631,7 @@ out: NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_ASSOCIATE, ieee802154_associate); -static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_disassociate(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -706,7 +706,7 @@ static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_DISASSOCIATE, ieee802154_disassociate); -static int ieee802154_set_ack(uint32_t mgmt_request, struct net_if *iface, +static int ieee802154_set_ack(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct ieee802154_context *ctx = net_if_l2_data(iface); @@ -733,7 +733,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_ACK, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_UNSET_ACK, ieee802154_set_ack); -static int ieee802154_set_parameters(uint32_t mgmt_request, +static int ieee802154_set_parameters(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -851,7 +851,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SHORT_ADDR, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_TX_POWER, ieee802154_set_parameters); -static int ieee802154_get_parameters(uint32_t mgmt_request, +static int ieee802154_get_parameters(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -914,7 +914,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_GET_TX_POWER, #ifdef CONFIG_NET_L2_IEEE802154_SECURITY -static int ieee802154_set_security_settings(uint32_t mgmt_request, +static int ieee802154_set_security_settings(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -953,7 +953,7 @@ out: NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_IEEE802154_SET_SECURITY_SETTINGS, ieee802154_set_security_settings); -static int ieee802154_get_security_settings(uint32_t mgmt_request, +static int ieee802154_get_security_settings(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/ieee802154/ieee802154_shell.c b/subsys/net/l2/ieee802154/ieee802154_shell.c index 8a4e6ab0b6c..777e7c6e46f 100644 --- a/subsys/net/l2/ieee802154/ieee802154_shell.c +++ b/subsys/net/l2/ieee802154/ieee802154_shell.c @@ -209,7 +209,7 @@ static inline char *print_coordinator_address(char *buf, int buf_len) } static void scan_result_cb(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { char buf[64]; @@ -224,7 +224,7 @@ static int cmd_ieee802154_scan(const struct shell *sh, size_t argc, char *argv[]) { struct net_if *iface = net_if_get_ieee802154(); - uint32_t scan_type; + uint64_t scan_type; int ret = 0; if (argc < 3) { diff --git a/subsys/net/l2/openthread/openthread.c b/subsys/net/l2/openthread/openthread.c index 6ddeadf8dfc..4ed6a34162f 100644 --- a/subsys/net/l2/openthread/openthread.c +++ b/subsys/net/l2/openthread/openthread.c @@ -34,7 +34,7 @@ static struct openthread_state_changed_callback ot_l2_state_changed_cb; #ifdef CONFIG_NET_MGMT_EVENT static struct net_mgmt_event_callback ip6_addr_cb; -static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void ipv6_addr_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if (net_if_l2(iface) != &NET_L2_GET_NAME(OPENTHREAD)) { diff --git a/subsys/net/l2/ppp/ppp_l2.c b/subsys/net/l2/ppp/ppp_l2.c index 5521d76470e..ae573a6e7ce 100644 --- a/subsys/net/l2/ppp/ppp_l2.c +++ b/subsys/net/l2/ppp/ppp_l2.c @@ -474,7 +474,7 @@ static void tx_handler(void *p1, void *p2, void *p3) } } -static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void net_ppp_mgmt_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct ppp_context *ctx; diff --git a/subsys/net/l2/virtual/virtual_mgmt.c b/subsys/net/l2/virtual/virtual_mgmt.c index 1210fc59083..c6187e0dd9f 100644 --- a/subsys/net/l2/virtual/virtual_mgmt.c +++ b/subsys/net/l2/virtual/virtual_mgmt.c @@ -13,7 +13,7 @@ LOG_MODULE_REGISTER(net_virtual_mgmt, CONFIG_NET_L2_VIRTUAL_LOG_LEVEL); #include #include -static int virtual_interface_set_config(uint32_t mgmt_request, +static int virtual_interface_set_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { @@ -89,7 +89,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_LINK_TYPE, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_VIRTUAL_INTERFACE_SET_PRIVATE_KEY, virtual_interface_set_config); -static int virtual_interface_get_config(uint32_t mgmt_request, +static int virtual_interface_get_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { diff --git a/subsys/net/l2/wifi/wifi_mgmt.c b/subsys/net/l2/wifi/wifi_mgmt.c index dc52c42a5c2..0183faab1d5 100644 --- a/subsys/net/l2/wifi/wifi_mgmt.c +++ b/subsys/net/l2/wifi/wifi_mgmt.c @@ -371,7 +371,7 @@ static const struct wifi_mgmt_ops *const get_wifi_api(struct net_if *iface) return off_api ? off_api->wifi_mgmt_api : NULL; } -static int wifi_connect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_connect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -475,7 +475,7 @@ static void scan_result_cb(struct net_if *iface, int status, #endif /* CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY */ } -static int wifi_scan(uint32_t mgmt_request, struct net_if *iface, +static int wifi_scan(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -504,7 +504,7 @@ static int wifi_scan(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_SCAN, wifi_scan); -static int wifi_disconnect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_disconnect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -546,7 +546,7 @@ void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status) } #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_ROAMING -static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, +static int wifi_start_roaming(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -589,7 +589,7 @@ static int wifi_start_roaming(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_START_ROAMING, wifi_start_roaming); -static int wifi_neighbor_rep_complete(uint32_t mgmt_request, struct net_if *iface, +static int wifi_neighbor_rep_complete(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -684,7 +684,7 @@ void wifi_mgmt_raise_neighbor_rep_recv_event(struct net_if *iface, char *inbuf, } #endif -static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_enable(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { struct wifi_connect_req_params *params = @@ -705,7 +705,7 @@ static int wifi_ap_enable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_ENABLE, wifi_ap_enable); -static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_disable(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -724,7 +724,7 @@ static int wifi_ap_disable(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_DISABLE, wifi_ap_disable); -static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_sta_disconnect(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -752,7 +752,7 @@ static int wifi_ap_sta_disconnect(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_STA_DISCONNECT, wifi_ap_sta_disconnect); -static int wifi_ap_config_params(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_config_params(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -790,7 +790,7 @@ static int wifi_ap_config_params(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_CONFIG_PARAM, wifi_ap_config_params); -static int wifi_ap_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_ap_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -814,7 +814,7 @@ static int wifi_ap_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_AP_RTS_THRESHOLD, wifi_ap_set_rts_threshold); -static int wifi_iface_status(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_status(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -842,7 +842,7 @@ void wifi_mgmt_raise_iface_status_event(struct net_if *iface, } #ifdef CONFIG_NET_STATISTICS_WIFI -static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -861,7 +861,7 @@ static int wifi_iface_stats(uint32_t mgmt_request, struct net_if *iface, } NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_GET_WIFI, wifi_iface_stats); -static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, +static int wifi_iface_stats_reset(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -876,7 +876,7 @@ static int wifi_iface_stats_reset(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_STATS_RESET_WIFI, wifi_iface_stats_reset); #endif /* CONFIG_NET_STATISTICS_WIFI */ -static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, +static int wifi_11k_cfg(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -902,7 +902,7 @@ static int wifi_11k_cfg(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_CONFIG, wifi_11k_cfg); -static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface, +static int wifi_11k_neighbor_request(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -923,7 +923,7 @@ static int wifi_11k_neighbor_request(uint32_t mgmt_request, struct net_if *iface NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_11K_NEIGHBOR_REQUEST, wifi_11k_neighbor_request); -static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_power_save(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -977,7 +977,7 @@ static int wifi_set_power_save(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS, wifi_set_power_save); -static int wifi_get_power_save_config(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_power_save_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1001,7 +1001,7 @@ static int wifi_get_power_save_config(uint32_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PS_CONFIG, wifi_get_power_save_config); -static int wifi_set_twt(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_twt(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1068,7 +1068,7 @@ fail: NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_TWT, wifi_set_twt); -static int wifi_set_btwt(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_btwt(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1108,7 +1108,7 @@ void wifi_mgmt_raise_twt_event(struct net_if *iface, struct wifi_twt_params *twt sizeof(struct wifi_twt_params)); } -static int wifi_reg_domain(uint32_t mgmt_request, struct net_if *iface, +static int wifi_reg_domain(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1140,7 +1140,7 @@ void wifi_mgmt_raise_twt_sleep_state(struct net_if *iface, sizeof(twt_sleep_state)); } -static int wifi_mode(uint32_t mgmt_request, struct net_if *iface, +static int wifi_mode(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1164,7 +1164,7 @@ static int wifi_mode(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_MODE, wifi_mode); -static int wifi_packet_filter(uint32_t mgmt_request, struct net_if *iface, +static int wifi_packet_filter(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1188,7 +1188,7 @@ static int wifi_packet_filter(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PACKET_FILTER, wifi_packet_filter); -static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, +static int wifi_channel(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1212,7 +1212,7 @@ static int wifi_channel(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CHANNEL, wifi_channel); -static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_version(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1228,7 +1228,7 @@ static int wifi_get_version(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_VERSION, wifi_get_version); -static int wifi_btm_query(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_btm_query(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1252,7 +1252,7 @@ static int wifi_btm_query(uint32_t mgmt_request, struct net_if *iface, void *dat NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_BTM_QUERY, wifi_btm_query); -static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_connection_params(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1272,7 +1272,7 @@ static int wifi_get_connection_params(uint32_t mgmt_request, struct net_if *ifac NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONN_PARAMS, wifi_get_connection_params); -static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) +static int wifi_wps_config(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); const struct wifi_mgmt_ops *const wifi_mgmt_api = get_wifi_api(iface); @@ -1291,7 +1291,7 @@ static int wifi_wps_config(uint32_t mgmt_request, struct net_if *iface, void *da NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_WPS_CONFIG, wifi_wps_config); -static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1316,7 +1316,7 @@ static int wifi_set_rts_threshold(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD, wifi_set_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP -static int wifi_dpp(uint32_t mgmt_request, struct net_if *iface, +static int wifi_dpp(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1338,7 +1338,7 @@ NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_DPP, wifi_dpp); #endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */ -static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, +static int wifi_pmksa_flush(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1357,7 +1357,7 @@ static int wifi_pmksa_flush(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_PMKSA_FLUSH, wifi_pmksa_flush); -static int wifi_get_rts_threshold(uint32_t mgmt_request, struct net_if *iface, +static int wifi_get_rts_threshold(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1382,7 +1382,7 @@ static int wifi_get_rts_threshold(uint32_t mgmt_request, struct net_if *iface, NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_RTS_THRESHOLD_CONFIG, wifi_get_rts_threshold); #ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static int wifi_set_enterprise_creds(uint32_t mgmt_request, struct net_if *iface, +static int wifi_set_enterprise_creds(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { const struct device *dev = net_if_get_device(iface); @@ -1721,7 +1721,7 @@ static int add_static_network_config(struct net_if *iface) #endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ } -static int connect_stored_command(uint32_t mgmt_request, struct net_if *iface, void *data, +static int connect_stored_command(uint64_t mgmt_request, struct net_if *iface, void *data, size_t len) { int ret = 0; diff --git a/subsys/net/l2/wifi/wifi_shell.c b/subsys/net/l2/wifi/wifi_shell.c index 1f670221b5e..a418df26c54 100644 --- a/subsys/net/l2/wifi/wifi_shell.c +++ b/subsys/net/l2/wifi/wifi_shell.c @@ -798,7 +798,7 @@ static void handle_wifi_neighbor_rep_complete(struct net_mgmt_event_callback *cb #endif static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_CONNECT_RESULT: @@ -836,7 +836,7 @@ static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, } static void wifi_mgmt_scan_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { case NET_EVENT_WIFI_SCAN_RESULT: diff --git a/subsys/net/lib/coap/coap.c b/subsys/net/lib/coap/coap.c index a3605f211fe..4e32ced8ee7 100644 --- a/subsys/net/lib/coap/coap.c +++ b/subsys/net/lib/coap/coap.c @@ -1956,7 +1956,7 @@ void coap_observer_init(struct coap_observer *observer, static inline void coap_observer_raise_event(struct coap_resource *resource, struct coap_observer *observer, - uint32_t mgmt_event) + uint64_t mgmt_event) { #ifdef CONFIG_NET_MGMT_EVENT_INFO const struct net_event_coap_observer net_event = { diff --git a/subsys/net/lib/coap/coap_server.c b/subsys/net/lib/coap/coap_server.c index 6ab85ede3f1..27e4267167f 100644 --- a/subsys/net/lib/coap/coap_server.c +++ b/subsys/net/lib/coap/coap_server.c @@ -385,7 +385,7 @@ static inline bool coap_service_in_section(const struct coap_service *service) STRUCT_SECTION_END(coap_service) > service; } -static inline void coap_service_raise_event(const struct coap_service *service, uint32_t mgmt_event) +static inline void coap_service_raise_event(const struct coap_service *service, uint64_t mgmt_event) { #if defined(CONFIG_NET_MGMT_EVENT_INFO) const struct net_event_coap_service net_event = { diff --git a/subsys/net/lib/config/init.c b/subsys/net/lib/config/init.c index 56b6bc03b6c..22500fd8f84 100644 --- a/subsys/net/lib/config/init.c +++ b/subsys/net/lib/config/init.c @@ -102,7 +102,7 @@ static void print_dhcpv4_info(struct net_if *iface) static struct net_mgmt_event_callback mgmt4_cb; static void ipv4_addr_add_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IPV4_ADDR_ADD) { @@ -244,7 +244,7 @@ static struct net_mgmt_event_callback mgmt6_cb; static struct in6_addr laddr; static void ipv6_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct net_if_ipv6 *ipv6 = iface->config.ip.ipv6; int i; @@ -310,7 +310,7 @@ static void ipv6_event_handler(struct net_mgmt_event_callback *cb, static void setup_ipv6(struct net_if *iface, uint32_t flags) { struct net_if_addr *ifaddr; - uint32_t mask = NET_EVENT_IPV6_DAD_SUCCEED; + uint64_t mask = NET_EVENT_IPV6_DAD_SUCCEED; if (sizeof(CONFIG_NET_CONFIG_MY_IPV6_ADDR) == 1) { /* Empty address, skip setting ANY address in this case */ @@ -330,20 +330,10 @@ static void setup_ipv6(struct net_if *iface, uint32_t flags) net_mgmt_init_event_callback(&mgmt6_cb, ipv6_event_handler, mask); net_mgmt_add_event_callback(&mgmt6_cb); - /* - * check for CMD_ADDR_ADD bit here, NET_EVENT_IPV6_ADDR_ADD is - * a combination of _NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_ADD - * so it will always return != NET_EVENT_IPV6_CMD_ADDR_ADD if any other - * event is set (for instance NET_EVENT_IPV6_ROUTER_ADD) - */ - if ((mask & NET_EVENT_IPV6_CMD_ADDR_ADD) == - NET_EVENT_IPV6_CMD_ADDR_ADD) { - ifaddr = net_if_ipv6_addr_add(iface, &laddr, - NET_ADDR_MANUAL, 0); - if (!ifaddr) { - NET_ERR("Cannot add %s to interface", - CONFIG_NET_CONFIG_MY_IPV6_ADDR); - } + ifaddr = net_if_ipv6_addr_add(iface, &laddr, NET_ADDR_MANUAL, 0); + if (!ifaddr) { + NET_ERR("Cannot add %s to interface", + CONFIG_NET_CONFIG_MY_IPV6_ADDR); } exit: @@ -363,7 +353,7 @@ exit: #if defined(CONFIG_NET_NATIVE) static void iface_up_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { NET_INFO("Interface %d (%p) coming up", diff --git a/subsys/net/lib/config/init_clock_sntp.c b/subsys/net/lib/config/init_clock_sntp.c index dd63564f9c0..0e2b9aa1362 100644 --- a/subsys/net/lib/config/init_clock_sntp.c +++ b/subsys/net/lib/config/init_clock_sntp.c @@ -89,7 +89,7 @@ static void sntp_resync_handler(struct k_work *work) #endif /* CONFIG_NET_CONFIG_SNTP_INIT_RESYNC */ #ifdef CONFIG_NET_CONFIG_SNTP_INIT_USE_CONNECTION_MANAGER -static void l4_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void l4_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { ARG_UNUSED(iface); diff --git a/subsys/net/lib/dhcpv4/dhcpv4.c b/subsys/net/lib/dhcpv4/dhcpv4.c index c475b1fb4d2..269a20f86c0 100644 --- a/subsys/net/lib/dhcpv4/dhcpv4.c +++ b/subsys/net/lib/dhcpv4/dhcpv4.c @@ -1635,7 +1635,7 @@ drop: } static void dhcpv4_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; @@ -1696,7 +1696,7 @@ out: #if defined(CONFIG_NET_IPV4_ACD) static void dhcpv4_acd_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; struct in_addr *addr; diff --git a/subsys/net/lib/dhcpv6/dhcpv6.c b/subsys/net/lib/dhcpv6/dhcpv6.c index 2e1441b0331..4f3809dfa7b 100644 --- a/subsys/net/lib/dhcpv6/dhcpv6.c +++ b/subsys/net/lib/dhcpv6/dhcpv6.c @@ -2198,7 +2198,7 @@ static void dhcpv6_timeout(struct k_work *work) } static void dhcpv6_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { sys_snode_t *node = NULL; diff --git a/subsys/net/lib/dns/llmnr_responder.c b/subsys/net/lib/dns/llmnr_responder.c index bf330e24374..f0f1f57ff28 100644 --- a/subsys/net/lib/dns/llmnr_responder.c +++ b/subsys/net/lib/dns/llmnr_responder.c @@ -117,7 +117,7 @@ static void create_ipv4_dst_addr(struct sockaddr_in *src_addr, #endif static void llmnr_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { #if defined(CONFIG_NET_IPV4) diff --git a/subsys/net/lib/dns/mdns_responder.c b/subsys/net/lib/dns/mdns_responder.c index 24d5cf63166..59e7852401d 100644 --- a/subsys/net/lib/dns/mdns_responder.c +++ b/subsys/net/lib/dns/mdns_responder.c @@ -157,7 +157,7 @@ static void mark_needs_announce(struct net_if *iface, bool needs_announce) #endif /* CONFIG_MDNS_RESPONDER_PROBE */ static void mdns_iface_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_IF_UP) { @@ -958,7 +958,7 @@ static void probing(struct k_work *work) } static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { uint32_t probe_delay = sys_rand32_get() % 250; bool probe_started = false; @@ -1110,7 +1110,7 @@ static void mdns_addr_event_handler(struct net_mgmt_event_callback *cb, } static void mdns_conn_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_L4_DISCONNECTED) { /* Clear the failed probes counter so that we can start @@ -1823,7 +1823,7 @@ static void do_init_listener(struct k_work *work) static int mdns_responder_init(void) { - uint32_t flags = NET_EVENT_IF_UP; + uint64_t flags = NET_EVENT_IF_UP; external_records = NULL; external_records_count = 0; diff --git a/subsys/net/lib/ptp/port.c b/subsys/net/lib/ptp/port.c index f6f73376d76..c40298d1374 100644 --- a/subsys/net/lib/ptp/port.c +++ b/subsys/net/lib/ptp/port.c @@ -964,7 +964,7 @@ int port_state_update(struct ptp_port *port, enum ptp_port_event event, bool tt_ } static void port_link_monitor(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/subsys/net/lib/shell/events.c b/subsys/net/lib/shell/events.c index 6b27dc2e4b0..51afbc85fc9 100644 --- a/subsys/net/lib/shell/events.c +++ b/subsys/net/lib/shell/events.c @@ -44,7 +44,7 @@ static const char unknown_event_str[] = ""; struct event_msg { struct net_if *iface; size_t len; - uint32_t event; + uint64_t event; uint8_t data[MAX_EVENT_INFO_SIZE]; }; @@ -52,7 +52,7 @@ K_MSGQ_DEFINE(event_mon_msgq, sizeof(struct event_msg), CONFIG_NET_MGMT_EVENT_QUEUE_SIZE, sizeof(intptr_t)); static void event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { struct event_msg msg; int ret; @@ -563,7 +563,7 @@ static void event_mon_handler(const struct shell *sh, void *p2, void *p3) } if (desc == unknown_event_str) { - PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%08x)\n", layer_str, + PR_INFO("EVENT: %s [%d] %s%s%s%s%s (0x%" PRIx64 ")\n", layer_str, net_if_get_by_iface(msg.iface), desc, desc2 ? " " : "", desc2 ? desc2 : "", info ? " " : "", info ? info : "", msg.event); diff --git a/subsys/net/lib/sockets/sockets_net_mgmt.c b/subsys/net/lib/sockets/sockets_net_mgmt.c index 909893e0444..0b45416c1f2 100644 --- a/subsys/net/lib/sockets/sockets_net_mgmt.c +++ b/subsys/net/lib/sockets/sockets_net_mgmt.c @@ -31,7 +31,7 @@ __net_socket struct net_mgmt_socket { uintptr_t pid; /* net_mgmt mask */ - uint32_t mask; + uint64_t mask; /* Message allocation timeout */ k_timeout_t alloc_timeout; @@ -145,7 +145,7 @@ static ssize_t znet_mgmt_recvfrom(struct net_mgmt_socket *mgmt, void *buf, { struct sockaddr_nm *nm_addr = (struct sockaddr_nm *)src_addr; k_timeout_t timeout = mgmt->wait_timeout; - uint32_t raised_event = 0; + uint64_t raised_event = 0; uint8_t *copy_to = buf; struct net_mgmt_msghdr hdr; struct net_if *iface; diff --git a/subsys/shell/backends/shell_mqtt.c b/subsys/shell/backends/shell_mqtt.c index 28bd39f4b0d..d77cbac6742 100644 --- a/subsys/shell/backends/shell_mqtt.c +++ b/subsys/shell/backends/shell_mqtt.c @@ -508,7 +508,7 @@ static void net_disconnect_handler(struct k_work *work) } /* Network connection event handler */ -static void network_evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void network_evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct shell_mqtt *sh = sh_mqtt; diff --git a/tests/boards/espressif/ethernet/src/main.c b/tests/boards/espressif/ethernet/src/main.c index b64bc946366..e9c397d795f 100644 --- a/tests/boards/espressif/ethernet/src/main.c +++ b/tests/boards/espressif/ethernet/src/main.c @@ -30,7 +30,7 @@ static uint8_t ntp_server[4]; static struct net_mgmt_event_callback mgmt_cb; static struct net_dhcpv4_option_callback dhcp_cb; -static void ipv4_event(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void ipv4_event(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { if ((mgmt_event != NET_EVENT_IPV4_ADDR_ADD) || diff --git a/tests/boards/espressif/wifi/src/main.c b/tests/boards/espressif/wifi/src/main.c index bbccdb9b2a9..931927ef25d 100644 --- a/tests/boards/espressif/wifi/src/main.c +++ b/tests/boards/espressif/wifi/src/main.c @@ -93,7 +93,7 @@ static void wifi_disconnect_result(struct net_mgmt_event_callback *cb) } } -static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { switch (mgmt_event) { diff --git a/tests/net/conn_mgr_conn/src/main.c b/tests/net/conn_mgr_conn/src/main.c index b66e246b12d..940d142b8db 100644 --- a/tests/net/conn_mgr_conn/src/main.c +++ b/tests/net/conn_mgr_conn/src/main.c @@ -95,7 +95,7 @@ static struct event_stats { struct net_mgmt_event_callback conn_mgr_conn_callback; static void conn_mgr_conn_handler(struct net_mgmt_event_callback *cb, - uint32_t event, struct net_if *iface) + uint64_t event, struct net_if *iface) { k_mutex_lock(&event_mutex, K_FOREVER); diff --git a/tests/net/conn_mgr_monitor/src/main.c b/tests/net/conn_mgr_monitor/src/main.c index cd8242c10d1..e1e1cd67081 100644 --- a/tests/net/conn_mgr_monitor/src/main.c +++ b/tests/net/conn_mgr_monitor/src/main.c @@ -38,12 +38,12 @@ #define DAD_WAIT_TIME EVENT_WAIT_TIME #endif -#define TEST_EXPECT_L4_CONNECTED BIT(NET_EVENT_L4_CMD_CONNECTED) -#define TEST_EXPECT_L4_DISCONNECTED BIT(NET_EVENT_L4_CMD_DISCONNECTED) -#define TEST_EXPECT_L4_IPV6_CONNECTED BIT(NET_EVENT_L4_CMD_IPV6_CONNECTED) -#define TEST_EXPECT_L4_IPV6_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV6_DISCONNECTED) -#define TEST_EXPECT_L4_IPV4_CONNECTED BIT(NET_EVENT_L4_CMD_IPV4_CONNECTED) -#define TEST_EXPECT_L4_IPV4_DISCONNECTED BIT(NET_EVENT_L4_CMD_IPV4_DISCONNECTED) +#define TEST_EXPECT_L4_CONNECTED NET_EVENT_L4_CMD_CONNECTED +#define TEST_EXPECT_L4_DISCONNECTED NET_EVENT_L4_CMD_DISCONNECTED +#define TEST_EXPECT_L4_IPV6_CONNECTED NET_EVENT_L4_CMD_IPV6_CONNECTED +#define TEST_EXPECT_L4_IPV6_DISCONNECTED NET_EVENT_L4_CMD_IPV6_DISCONNECTED +#define TEST_EXPECT_L4_IPV4_CONNECTED NET_EVENT_L4_CMD_IPV4_CONNECTED +#define TEST_EXPECT_L4_IPV4_DISCONNECTED NET_EVENT_L4_CMD_IPV4_DISCONNECTED #define TEST_EXPECT_CLEAR(event) (global_stats.expected_events &= ~event) @@ -162,7 +162,7 @@ static struct test_stats get_reset_stats(void) /* Callback hooks */ struct net_mgmt_event_callback l4_callback; -void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) +void l4_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { if (event == NET_EVENT_L4_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -187,7 +187,7 @@ void l4_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_i struct net_mgmt_event_callback conn_callback; -void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net_if *iface) +void conn_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { if (event == NET_EVENT_L4_IPV6_CONNECTED) { k_mutex_lock(&stats_mutex, K_FOREVER); @@ -224,7 +224,7 @@ void conn_handler(struct net_mgmt_event_callback *cb, uint32_t event, struct net } } -static void wait_for_events(uint32_t event_mask, k_timeout_t timeout) +static void wait_for_events(uint64_t event_mask, k_timeout_t timeout) { k_mutex_lock(&stats_mutex, K_FOREVER); k_sem_reset(&event_sem); diff --git a/tests/net/conn_mgr_nsos/src/main.c b/tests/net/conn_mgr_nsos/src/main.c index 41c4273f262..d4e014accff 100644 --- a/tests/net/conn_mgr_nsos/src/main.c +++ b/tests/net/conn_mgr_nsos/src/main.c @@ -15,7 +15,7 @@ K_SEM_DEFINE(l4_connected, 0, 1); K_SEM_DEFINE(l4_disconnected, 0, 1); -static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event, +static void l4_event_handler(struct net_mgmt_event_callback *cb, uint64_t event, struct net_if *iface) { switch (event) { diff --git a/tests/net/dhcpv4/client/prj.conf b/tests/net/dhcpv4/client/prj.conf index 5b126f90a14..5ac77585482 100644 --- a/tests/net/dhcpv4/client/prj.conf +++ b/tests/net/dhcpv4/client/prj.conf @@ -20,6 +20,7 @@ CONFIG_NET_MGMT_EVENT=y CONFIG_NET_MGMT_EVENT_INFO=y CONFIG_DNS_RESOLVER=y +CONFIG_DNS_RESOLVER_MAX_SERVERS=3 # Turn off UDP checksum checking as the test fails otherwise. CONFIG_NET_UDP_CHECKSUM=n @@ -31,3 +32,5 @@ CONFIG_NET_DHCPV4_INITIAL_DELAY_MAX=2 CONFIG_NET_DHCPV4_LOG_LEVEL_DBG=y CONFIG_LOG_BUFFER_SIZE=8192 + +CONFIG_ZVFS_POLL_MAX=5 diff --git a/tests/net/dhcpv4/client/src/main.c b/tests/net/dhcpv4/client/src/main.c index 654a98d2cbe..7c87ab4d478 100644 --- a/tests/net/dhcpv4/client/src/main.c +++ b/tests/net/dhcpv4/client/src/main.c @@ -493,7 +493,7 @@ static struct net_dhcpv4_option_callback opt_vs_invalid_cb; static int event_count; static void receiver_cb(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_ADDR_ADD && nm_event != NET_EVENT_DNS_SERVER_ADD && @@ -694,7 +694,7 @@ ZTEST(dhcpv4_tests, test_dhcp) #elif defined(CONFIG_NET_DHCPV4_OPTION_CALLBACKS) while (event_count < 10) { #elif defined(CONFIG_NET_DHCPV4_OPTION_PRINT_IGNORED) - while (event_count < 2) { + while (event_count < 1) { #else while (event_count < 5) { #endif diff --git a/tests/net/dhcpv6/src/main.c b/tests/net/dhcpv6/src/main.c index c5046a2746a..b1375383c67 100644 --- a/tests/net/dhcpv6/src/main.c +++ b/tests/net/dhcpv6/src/main.c @@ -178,7 +178,7 @@ fail: return NULL; } -static void evt_handler(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void evt_handler(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); diff --git a/tests/net/hostname/src/main.c b/tests/net/hostname/src/main.c index bfc2fd926f8..b5c0664d2ef 100644 --- a/tests/net/hostname/src/main.c +++ b/tests/net/hostname/src/main.c @@ -101,7 +101,7 @@ static void net_iface_init(struct net_if *iface) #ifdef CONFIG_NET_MGMT_EVENT static void hostname_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_HOSTNAME_CHANGED) { #ifdef CONFIG_NET_MGMT_EVENT_INFO diff --git a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c index 0281b699edb..5964025e023 100644 --- a/tests/net/ieee802154/l2/src/ieee802154_shell_test.c +++ b/tests/net/ieee802154/l2/src/ieee802154_shell_test.c @@ -50,7 +50,7 @@ static bool expected_association_permitted_bit; #define EXPECTED_PAYLOAD_DATA EXPECTED_ENDDEVICE_EXT_ADDR_LE #define EXPECTED_PAYLOAD_LEN 8 -static void scan_result_cb(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, +static void scan_result_cb(struct net_mgmt_event_callback *cb, uint64_t mgmt_event, struct net_if *iface) { struct ieee802154_context *ctx = net_if_l2_data(iface); diff --git a/tests/net/igmp/src/main.c b/tests/net/igmp/src/main.c index 7878c5953eb..e2f201dd4ee 100644 --- a/tests/net/igmp/src/main.c +++ b/tests/net/igmp/src/main.c @@ -227,7 +227,7 @@ NET_DEVICE_INIT(net_test_igmp, "net_test_igmp", 127); static void group_joined(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_JOIN) { /* Spurious callback. */ @@ -240,7 +240,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV4_MCAST_LEAVE) { /* Spurious callback. */ @@ -253,7 +253,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index 3ff9bb2aabe..8faf96b49cf 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -139,7 +139,7 @@ NET_DEVICE_INIT_INSTANCE(net_iface1_test, 127); static void dns_evt_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { if (mgmt_event == NET_EVENT_DNS_SERVER_ADD) { k_sem_give(&dns_added); diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c index 004b60adb97..288dcc353b2 100644 --- a/tests/net/mgmt/src/mgmt.c +++ b/tests/net/mgmt/src/mgmt.c @@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_MGMT_EVENT_LOG_LEVEL); MAX(sizeof(TEST_INFO_STRING), sizeof(struct in6_addr)) /* Notifier infra */ -static uint32_t event2throw; +static uint64_t event2throw; static uint32_t throw_times; static uint32_t throw_sleep; static bool with_info; @@ -38,7 +38,7 @@ static struct k_thread thrower_thread_data; static struct k_sem thrower_lock; /* Receiver infra */ -static uint32_t rx_event; +static uint64_t rx_event; static uint32_t rx_calls; static size_t info_length_in_test; static struct net_mgmt_event_callback rx_cb; @@ -49,7 +49,7 @@ static struct in6_addr addr6 = { { { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, static char info_data[TEST_MGMT_EVENT_INFO_SIZE]; -static int test_mgmt_request(uint32_t mgmt_request, +static int test_mgmt_request(uint64_t mgmt_request, struct net_if *iface, void *data, uint32_t len) { uint32_t *test_data = data; @@ -67,14 +67,14 @@ static int test_mgmt_request(uint32_t mgmt_request, NET_MGMT_REGISTER_REQUEST_HANDLER(TEST_MGMT_REQUEST, test_mgmt_request); -static void test_mgmt_event_handler(uint32_t mgmt_event, struct net_if *iface, void *info, +static void test_mgmt_event_handler(uint64_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data) { if (!with_static) { return; } - TC_PRINT("\t\tReceived static event 0x%08X\n", mgmt_event); + TC_PRINT("\t\tReceived static event 0x%" PRIx64 "\n", mgmt_event); ARG_UNUSED(user_data); @@ -144,7 +144,7 @@ static void thrower_thread(void *p1, void *p2, void *p3) while (1) { k_sem_take(&thrower_lock, K_FOREVER); - TC_PRINT("\tThrowing event 0x%08X %u times\n", + TC_PRINT("\tThrowing event 0x%" PRIx64 " %u times\n", event2throw, throw_times); for (; throw_times; throw_times--) { @@ -168,9 +168,9 @@ static void thrower_thread(void *p1, void *p2, void *p3) } static void receiver_cb(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { - TC_PRINT("\t\tReceived event 0x%08X\n", nm_event); + TC_PRINT("\t\tReceived event 0x%" PRIx64 "\n", nm_event); if (with_info && cb->info) { if (cb->info_length != info_length_in_test) { @@ -208,14 +208,15 @@ static int sending_event(uint32_t times, bool receiver, bool info) k_msleep(THREAD_SLEEP); if (receiver) { - TC_PRINT("\tReceived 0x%08X %u times\n", + TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); net_mgmt_del_event_callback(&rx_cb); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; } return TC_PASS; @@ -233,7 +234,7 @@ static int test_sending_event_info(uint32_t times, bool receiver) static int test_synchronous_event_listener(uint32_t times, bool on_iface) { - uint32_t event_mask; + uint64_t event_mask; int ret; TC_PRINT("- Synchronous event listener %s\n", @@ -283,13 +284,14 @@ static int test_static_event_listener(uint32_t times, bool info) /* Let the network stack to proceed */ k_msleep(THREAD_SLEEP); - TC_PRINT("\tReceived 0x%08X %u times\n", + TC_PRINT("\tReceived 0x%" PRIx64 " %u times\n", rx_event, rx_calls); zassert_equal(rx_event, event2throw, "rx_event check failed"); zassert_equal(rx_calls, times, "rx_calls check failed"); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; with_static = false; return TC_PASS; @@ -297,12 +299,12 @@ static int test_static_event_listener(uint32_t times, bool info) static void initialize_event_tests(void) { - event2throw = 0U; + event2throw = 0ULL; throw_times = 0U; throw_sleep = 0; with_info = false; - rx_event = 0U; + rx_event = 0ULL; rx_calls = 0U; k_sem_init(&thrower_lock, 0, UINT_MAX); @@ -318,9 +320,9 @@ static void initialize_event_tests(void) NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); } -static int test_core_event(uint32_t event, bool (*func)(void)) +static int test_core_event(uint64_t event, bool (*func)(void)) { - TC_PRINT("- Triggering core event: 0x%08X\n", event); + TC_PRINT("- Triggering core event: 0x%" PRIx64 "\n", event); info_length_in_test = sizeof(struct in6_addr); memcpy(info_data, &addr6, sizeof(addr6)); @@ -336,10 +338,11 @@ static int test_core_event(uint32_t event, bool (*func)(void)) zassert_true(rx_calls > 0 && rx_calls != -1, "rx_calls empty"); zassert_equal(rx_event, event, "rx_event check failed, " - "0x%08x vs 0x%08x", rx_event, event); + "0x%" PRIx64 " vs 0x%" PRIx64, rx_event, event); net_mgmt_del_event_callback(&rx_cb); - rx_event = rx_calls = 0U; + rx_event = 0ULL; + rx_calls = 0U; return TC_PASS; } @@ -426,7 +429,7 @@ ZTEST(mgmt_fn_test_suite, test_mgmt) static K_SEM_DEFINE(wait_for_event_processing, 0, 1); static void net_mgmt_event_handler(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, struct net_if *iface) + uint64_t mgmt_event, struct net_if *iface) { static int cb_call_count; diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index 1c95fe5409d..0036b5853af 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -238,7 +238,7 @@ static void test_iface_carrier_off_on(void) } static void group_joined(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_JOIN) { /* Spurious callback. */ @@ -254,7 +254,7 @@ static void group_joined(struct net_mgmt_event_callback *cb, } static void group_left(struct net_mgmt_event_callback *cb, - uint32_t nm_event, struct net_if *iface) + uint64_t nm_event, struct net_if *iface) { if (nm_event != NET_EVENT_IPV6_MCAST_LEAVE) { /* Spurious callback. */ @@ -270,7 +270,7 @@ static void group_left(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = { diff --git a/tests/net/pmtu/src/main.c b/tests/net/pmtu/src/main.c index 54d225a259e..d744a4415f4 100644 --- a/tests/net/pmtu/src/main.c +++ b/tests/net/pmtu/src/main.c @@ -103,7 +103,7 @@ static K_SEM_DEFINE(wait_pmtu_changed, 0, UINT_MAX); static bool is_pmtu_changed; static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -123,7 +123,7 @@ static void ipv6_pmtu_changed(struct net_mgmt_event_callback *cb, } static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, - uint32_t mgmt_event, + uint64_t mgmt_event, struct net_if *iface) { ARG_UNUSED(cb); @@ -143,7 +143,7 @@ static void ipv4_pmtu_changed(struct net_mgmt_event_callback *cb, } static struct mgmt_events { - uint32_t event; + uint64_t event; net_mgmt_event_handler_t handler; struct net_mgmt_event_callback cb; } mgmt_events[] = {