13#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_H_
14#define ZEPHYR_INCLUDE_NET_ETHERNET_H_
31#if defined(CONFIG_NVMEM)
48#define NET_ETH_ADDR_LEN 6U
57#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
60#define NET_ETH_PTYPE_ALL 0x0003
61#define NET_ETH_PTYPE_ARP 0x0806
62#define NET_ETH_PTYPE_CAN 0x000C
63#define NET_ETH_PTYPE_CANFD 0x000D
64#define NET_ETH_PTYPE_EAPOL 0x888e
65#define NET_ETH_PTYPE_ECAT 0x88a4
66#define NET_ETH_PTYPE_HDLC 0x0019
67#define NET_ETH_PTYPE_IEEE802154 0x00F6
68#define NET_ETH_PTYPE_IP 0x0800
69#define NET_ETH_PTYPE_IPV6 0x86dd
70#define NET_ETH_PTYPE_LLDP 0x88cc
71#define NET_ETH_PTYPE_PTP 0x88f7
72#define NET_ETH_PTYPE_TSN 0x22f0
73#define NET_ETH_PTYPE_VLAN 0x8100
77#if !defined(ETH_P_8021Q)
78#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
80#if !defined(ETH_P_ALL)
81#define ETH_P_ALL NET_ETH_PTYPE_ALL
83#if !defined(ETH_P_ARP)
84#define ETH_P_ARP NET_ETH_PTYPE_ARP
86#if !defined(ETH_P_CAN)
87#define ETH_P_CAN NET_ETH_PTYPE_CAN
89#if !defined(ETH_P_CANFD)
90#define ETH_P_CANFD NET_ETH_PTYPE_CANFD
92#if !defined(ETH_P_EAPOL)
93#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL
95#if !defined(ETH_P_ECAT)
96#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
98#if !defined(ETH_P_HDLC)
99#define ETH_P_HDLC NET_ETH_PTYPE_HDLC
101#if !defined(ETH_P_IEEE802154)
102#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
104#if !defined(ETH_P_IP)
105#define ETH_P_IP NET_ETH_PTYPE_IP
107#if !defined(ETH_P_IPV6)
108#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
110#if !defined(ETH_P_TSN)
111#define ETH_P_TSN NET_ETH_PTYPE_TSN
117#define NET_ETH_MINIMAL_FRAME_SIZE 60
118#define NET_ETH_MTU 1500
122#if defined(CONFIG_NET_VLAN)
123#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_vlan_hdr))
125#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
128#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
130#if defined(CONFIG_DSA_TAG_SIZE)
131#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
133#define DSA_TAG_SIZE 0
136#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
137#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
139#define NET_ETH_VLAN_HDR_SIZE 4
219enum ethernet_config_type {
220 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
221 ETHERNET_CONFIG_TYPE_QAV_PARAM,
222 ETHERNET_CONFIG_TYPE_QBV_PARAM,
223 ETHERNET_CONFIG_TYPE_QBU_PARAM,
224 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
225 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
226 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
227 ETHERNET_CONFIG_TYPE_FILTER,
228 ETHERNET_CONFIG_TYPE_PORTS_NUM,
229 ETHERNET_CONFIG_TYPE_TXINJECTION_MODE,
230 ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT,
231 ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT,
232 ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM,
235enum ethernet_qav_param_type {
236 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
237 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
238 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
239 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
240 ETHERNET_QAV_PARAM_TYPE_STATUS,
250 enum ethernet_qav_param_type
type;
267enum ethernet_qbv_param_type {
268 ETHERNET_QBV_PARAM_TYPE_STATUS,
269 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
270 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
271 ETHERNET_QBV_PARAM_TYPE_TIME,
274enum ethernet_qbv_state_type {
275 ETHERNET_QBV_STATE_TYPE_ADMIN,
276 ETHERNET_QBV_STATE_TYPE_OPER,
279enum ethernet_gate_state_operation {
280 ETHERNET_SET_GATE_STATE,
281 ETHERNET_SET_AND_HOLD_MAC_STATE,
282 ETHERNET_SET_AND_RELEASE_MAC_STATE,
292 enum ethernet_qbv_param_type
type;
336enum ethernet_qbu_param_type {
337 ETHERNET_QBU_PARAM_TYPE_STATUS,
338 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
339 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
340 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
343 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
344 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
347enum ethernet_qbu_preempt_status {
348 ETHERNET_QBU_STATUS_EXPRESS,
349 ETHERNET_QBU_STATUS_PREEMPTABLE
359 enum ethernet_qbu_param_type
type;
368 enum ethernet_qbu_preempt_status
387enum ethernet_filter_type {
388 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
389 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
406 enum ethernet_filter_type
type;
415enum ethernet_txtime_param_type {
416 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
424 enum ethernet_txtime_param_type
type;
451struct ethernet_config {
454 bool txinjection_mode;
456 struct net_eth_addr mac_address;
458 struct ethernet_qav_param qav_param;
459 struct ethernet_qbv_param qbv_param;
460 struct ethernet_qbu_param qbu_param;
461 struct ethernet_txtime_param txtime_param;
463 int priority_queues_num;
468 struct ethernet_filter filter;
498#if defined(CONFIG_NET_STATISTICS_ETHERNET)
523 enum ethernet_config_type type,
524 const struct ethernet_config *config);
529 enum ethernet_config_type type,
530 struct ethernet_config *config);
537#if defined(CONFIG_NET_VLAN)
538 int (*vlan_setup)(
const struct device *dev,
struct net_if *iface,
543#if defined(CONFIG_PTP_CLOCK)
544 const struct device *(*get_ptp_clock)(
const struct device *dev,
struct net_if *iface);
567struct ethernet_vlan {
569 struct net_if *iface;
575#if defined(CONFIG_NET_VLAN_COUNT)
576#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
578#define NET_VLAN_MAX_COUNT 0
611struct ethernet_context {
617#if defined(CONFIG_NET_ETHERNET_BRIDGE)
618 struct net_if *bridge;
627 struct k_work carrier_work;
630 struct net_if *iface;
632#if defined(CONFIG_NET_LLDP)
634 struct ethernet_lldp lldp;
642#if defined(CONFIG_NET_L2_PTP)
650#if defined(CONFIG_NET_DSA)
652 enum dsa_port_type dsa_port;
655 void *dsa_switch_ctx;
659 bool is_net_carrier_up : 1;
673void ethernet_init(
struct net_if *iface);
675#define ETHERNET_L2_CTX_TYPE struct ethernet_context
680struct net_eth_vlan_hdr {
681 struct net_eth_addr dst;
682 struct net_eth_addr src;
701 if (addr->
addr[0] == 0xff &&
702 addr->
addr[1] == 0xff &&
703 addr->
addr[2] == 0xff &&
704 addr->
addr[3] == 0xff &&
705 addr->
addr[4] == 0xff &&
706 addr->
addr[5] == 0xff) {
722 if (addr->
addr[0] == 0x00 &&
723 addr->
addr[1] == 0x00 &&
724 addr->
addr[2] == 0x00 &&
725 addr->
addr[3] == 0x00 &&
726 addr->
addr[4] == 0x00 &&
727 addr->
addr[5] == 0x00) {
743 if (addr->
addr[0] == 0x00 &&
744 addr->
addr[1] == 0x00 &&
745 addr->
addr[2] == 0x00 &&
746 addr->
addr[3] == 0x00 &&
747 addr->
addr[4] == 0x00 &&
748 addr->
addr[5] == 0x00) {
764 return addr->
addr[0] & 0x01;
800 if (addr->
addr[0] == 0x01 &&
801 addr->
addr[1] == 0x80 &&
802 addr->
addr[2] == 0xc2 &&
803 addr->
addr[3] == 0x00 &&
804 addr->
addr[4] == 0x00 &&
805 addr->
addr[5] == 0x0e) {
821 if (addr->
addr[0] == 0x01 &&
822 addr->
addr[1] == 0x1b &&
823 addr->
addr[2] == 0x19 &&
824 addr->
addr[3] == 0x00 &&
825 addr->
addr[4] == 0x00 &&
826 addr->
addr[5] == 0x00) {
871#if defined(CONFIG_NET_DSA)
874 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
876 }
else if (eth_ctx->dsa_port == DSA_USER_PORT) {
898 struct ethernet_config *config)
907 return eth->
get_config(dev, iface, type, config);
919#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
939#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
962#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
982#if defined(CONFIG_NET_VLAN)
1004#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1029#if defined(CONFIG_NET_VLAN)
1050#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1068#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1081#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1083#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1084 init_fn, pm, data, config, prio, \
1086 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1087 init_fn, pm, data, config, prio, \
1089 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1093#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1094 init_fn, pm, data, config, prio, \
1096 Z_DEVICE_STATE_DEFINE(dev_id); \
1097 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1098 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1099 config, POST_KERNEL, prio, api, \
1100 &Z_DEVICE_STATE_NAME(dev_id));
1104#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1105 config, prio, api, mtu) \
1106 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1107 init_fn, pm, data, config, prio, \
1129#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1131 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1132 pm, data, config, prio, api, mtu)
1156#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1157 pm, data, config, prio, api, mtu) \
1158 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1159 instance, init_fn, pm, data, \
1160 config, prio, api, mtu)
1178#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1180 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1181 DEVICE_DT_NAME(node_id), init_fn, pm, \
1182 data, config, prio, api, mtu)
1193#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1194 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1203#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1204 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1234#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1270 mac_addr[0] &= ~0x01;
1272 mac_addr[0] |= 0x02;
1277#if defined(CONFIG_NVMEM)
1293#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1300#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1301 .cell = NVMEM_CELL_GET_BY_NAME_OR(node_id, mac_address, {0}),
1303#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id)
1306#define Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id) \
1308 .type = NET_ETH_MAC_RANDOM, \
1309 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1310 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1313#define Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id) \
1315 .type = NET_ETH_MAC_NVMEM, \
1316 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1317 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1318 Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1321#define Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id) \
1323 .type = NET_ETH_MAC_STATIC, \
1324 .addr = DT_PROP(node_id, local_mac_address), \
1325 .addr_len = DT_PROP_LEN(node_id, local_mac_address), \
1328#define Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id) \
1330 .type = NET_ETH_MAC_DEFAULT, \
1340#define NET_ETH_MAC_DT_CONFIG_INIT(node_id) \
1341 COND_CASE_1(DT_PROP(node_id, zephyr_random_mac_address), \
1342 (Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id)), \
1343 DT_NVMEM_CELLS_HAS_NAME(node_id, mac_address), \
1344 (Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id)), \
1345 DT_NODE_HAS_PROP(node_id, local_mac_address), \
1346 (Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id)), \
1347 (Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id)))
1356#define NET_ETH_MAC_DT_INST_CONFIG_INIT(inst) \
1357 NET_ETH_MAC_DT_CONFIG_INIT(DT_DRV_INST(inst))
1408 enum ethernet_filter_type type,
bool enable);
1427#if defined(CONFIG_PTP_CLOCK)
1456#if defined(CONFIG_NET_L2_PTP)
1473#if defined(CONFIG_NET_L2_PTP)
1492 const struct ethernet_context *ctx = (
struct ethernet_context *)
1507 const struct ethernet_context *ctx = (
struct ethernet_context *)
net_if_l2_data(iface);
1520#include <zephyr/syscalls/ethernet.h>
long atomic_t
Definition atomic_types.h:15
VLAN specific definitions.
static struct net_if * net_eth_get_vlan_main(struct net_if *iface)
Return main network interface that is attached to this VLAN tag.
Definition ethernet.h:1008
static int net_eth_get_hw_config(struct net_if *iface, enum ethernet_config_type type, struct ethernet_config *config)
Return ethernet device hardware configuration information.
Definition ethernet.h:897
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:395
static void net_eth_set_ptp_port(struct net_if *iface, int port)
Set PTP port number attached to this interface.
Definition ethernet.h:1476
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:922
static bool net_eth_is_addr_all_zeroes(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a all zeroes address.
Definition ethernet.h:720
void net_eth_ipv4_mcast_to_mac_addr(const struct net_in_addr *ipv4_addr, struct net_eth_addr *mac_addr)
Convert IPv4 multicast address to Ethernet address.
static bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a multicast address.
Definition ethernet.h:762
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition ethernet.h:1459
static const struct device * net_eth_get_ptp_clock(struct net_if *iface)
Return PTP clock that is tied to this ethernet network interface.
Definition ethernet.h:1430
#define NET_ETH_ADDR_LEN
Ethernet MAC address length.
Definition ethernet.h:48
int net_eth_promisc_mode(struct net_if *iface, bool enable)
Set promiscuous mode either ON or OFF.
void net_eth_carrier_off(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier was lost.
static uint16_t net_eth_get_vlan_tag(struct net_if *iface)
Return VLAN tag specified to network interface.
Definition ethernet.h:965
static bool net_eth_type_is_wifi(struct net_if *iface)
Check if the Ethernet L2 network interface can perform Wi-Fi.
Definition ethernet.h:1490
const struct device * net_eth_get_phy(struct net_if *iface)
Return the PHY device that is tied to this ethernet network interface.
static bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a broadcast address.
Definition ethernet.h:699
static bool net_eth_get_vlan_status(struct net_if *iface)
Get VLAN status for a given network interface (enabled or not).
Definition ethernet.h:1053
const struct device * net_eth_get_ptp_clock_by_index(int index)
Return PTP clock that is tied to this ethernet network interface index.
static bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
Check if the Ethernet MAC address is unspecified.
Definition ethernet.h:741
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1071
ethernet_hw_caps
Ethernet hardware capabilities.
Definition ethernet.h:144
int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac, enum ethernet_filter_type type, bool enable)
Set or unset HW filtering for MAC address mac.
void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr, struct net_eth_addr *mac_addr)
Convert IPv6 multicast address to Ethernet address.
static int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
Load a MAC address from a MAC address configuration structure with the specified type.
Definition ethernet.h:1257
static enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
Return ethernet device hardware capability information.
Definition ethernet.h:866
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:942
void net_eth_carrier_on(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier is detected.
ethernet_checksum_support
Protocols that are supported by checksum offloading.
Definition ethernet.h:432
ethernet_stats_type
Ethernet statistics type (bitmap).
Definition ethernet.h:477
net_eth_mac_type
MAC address configuration types.
Definition ethernet.h:1207
static bool net_eth_is_vlan_enabled(struct ethernet_context *ctx, struct net_if *iface)
Check if there are any VLAN interfaces enabled to this specific Ethernet network interface.
Definition ethernet.h:1033
static struct net_if * net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag)
Return network interface related to this VLAN tag.
Definition ethernet.h:986
static bool net_eth_type_is_ethernet(struct net_if *iface)
Check if the Ethernet L2 network interface is cabled ethernet.
Definition ethernet.h:1505
const struct net_eth_addr * net_eth_broadcast_addr(void)
Return Ethernet broadcast address.
static bool net_eth_is_addr_unicast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is an unicast address.
Definition ethernet.h:774
static bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a LLDP multicast address.
Definition ethernet.h:798
static bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a PTP multicast address.
Definition ethernet.h:819
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:786
int net_eth_txinjection_mode(struct net_if *iface, bool enable)
Set TX-Injection mode either ON or OFF.
@ L2_ETH_IF_TYPE_ETHERNET
IEEE 802.3 Ethernet (default).
Definition ethernet.h:397
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:400
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:152
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:191
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:179
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:188
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:158
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:194
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:155
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:182
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:161
@ ETHERNET_PTP
IEEE 802.1AS (gPTP) clock supported.
Definition ethernet.h:170
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:200
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:206
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:173
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
RX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:149
@ ETHERNET_LLDP
Link Layer Discovery Protocol supported.
Definition ethernet.h:185
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:167
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:203
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:197
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:176
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
TX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:146
@ ETHERNET_LINK_2500BASE
2.5 Gbits link supported
Definition ethernet.h:164
@ ETHERNET_CHECKSUM_SUPPORT_UDP
Device supports UDP checksum offloading for all supported IP protocols.
Definition ethernet.h:446
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:444
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:440
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header).
Definition ethernet.h:438
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:436
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:434
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header).
Definition ethernet.h:442
@ ETHERNET_STATS_TYPE_VENDOR
Vendor statistics only.
Definition ethernet.h:481
@ ETHERNET_STATS_TYPE_ALL
All statistics.
Definition ethernet.h:483
@ ETHERNET_STATS_TYPE_COMMON
Common statistics only (excludes vendor statistics).
Definition ethernet.h:479
@ NET_ETH_MAC_RANDOM
A random MAC address is generated during initialization.
Definition ethernet.h:1211
@ NET_ETH_MAC_NVMEM
The MAC address is read from an NVMEM cell.
Definition ethernet.h:1216
@ NET_ETH_MAC_DEFAULT
MAC address is handled by the driver (backwards compatible case).
Definition ethernet.h:1209
@ NET_ETH_MAC_STATIC
A static MAC address is provided in the device tree.
Definition ethernet.h:1218
enum net_verdict(* net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
LLDP Receive packet callback.
Definition lldp.h:218
static void * net_if_l2_data(struct net_if *iface)
Get a pointer to the interface L2 private data.
Definition net_if.h:1067
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1085
net_l2_flags
L2 flags.
Definition net_l2.h:37
int nvmem_cell_read(const struct nvmem_cell *cell, void *data, off_t off, size_t len)
Read data from an NVMEM cell.
void sys_rand_get(void *dst, size_t len)
Fill the destination buffer with random data values that should pass general randomness tests.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define ENODATA
Missing expected message data.
Definition errno.h:77
#define EINVAL
Invalid argument.
Definition errno.h:60
#define ENOTSUP
Unsupported value.
Definition errno.h:114
#define ENODEV
No such device.
Definition errno.h:57
#define NET_VLAN_TAG_UNSPEC
Unspecified VLAN tag value.
Definition ethernet_vlan.h:32
#define NULL
Definition iar_missing_defs.h:20
LLDP definitions and handler.
Public API for network interface.
IPv6 and IPv4 definitions.
Network packet buffer descriptor API.
Public NVMEM header file.
flags
Definition parser.h:97
Public functions for the Precision Time Protocol time specification.
Random number generator header file.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:519
Ethernet L2 API operations.
Definition ethernet.h:487
struct net_if_api iface_api
The net_if_api must be placed in first position in this struct so that we are compatible with network...
Definition ethernet.h:492
int(* start)(const struct device *dev, struct net_if *iface)
Collect optional ethernet specific statistics.
Definition ethernet.h:512
int(* stop)(const struct device *dev, struct net_if *iface)
Stop the device.
Definition ethernet.h:515
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:551
int(* set_config)(const struct device *dev, struct net_if *iface, enum ethernet_config_type type, const struct ethernet_config *config)
Set specific hardware configuration.
Definition ethernet.h:521
int(* get_config)(const struct device *dev, struct net_if *iface, enum ethernet_config_type type, struct ethernet_config *config)
Get hardware specific configuration.
Definition ethernet.h:527
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev, struct net_if *iface)
Get the device capabilities.
Definition ethernet.h:518
Ethernet filter description.
Definition ethernet.h:404
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:408
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:410
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:406
Ethernet LLDP specific parameters.
Definition ethernet.h:584
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:592
sys_snode_t node
Used for track timers.
Definition ethernet.h:586
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:601
k_timepoint_t tx_timer_timeout
LLDP TX timer timeout.
Definition ethernet.h:598
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:595
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:589
Ethernet Qav specific parameters.
Definition ethernet.h:246
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:253
unsigned int oper_idle_slope
Oper Idle Slope (bits per second).
Definition ethernet.h:259
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:250
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:261
int queue_id
ID of the priority queue to use.
Definition ethernet.h:248
unsigned int idle_slope
Idle Slope (bits per second).
Definition ethernet.h:257
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth).
Definition ethernet.h:255
Ethernet Qbu specific parameters.
Definition ethernet.h:355
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:368
uint32_t release_advance
Release advance (nanoseconds).
Definition ethernet.h:365
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:359
uint32_t hold_advance
Hold advance (nanoseconds).
Definition ethernet.h:362
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:372
bool link_partner_status
Link partner status (from Qbr).
Definition ethernet.h:375
int port_id
Port id.
Definition ethernet.h:357
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:381
Ethernet Qbv specific parameters.
Definition ethernet.h:288
int port_id
Port id.
Definition ethernet.h:290
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:297
struct ethernet_qbv_param::@055246010323023270273151373302031315361103011354::@066201007326270006176246045126267167014036102070 gate_control
Gate control information.
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:292
uint16_t row
Gate control list row.
Definition ethernet.h:311
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:294
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:302
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:323
uint32_t extension_time
Extension time (nanoseconds).
Definition ethernet.h:329
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:305
uint32_t time_interval
Time interval ticks (nanoseconds).
Definition ethernet.h:308
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:326
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:315
Ethernet TXTIME specific parameters.
Definition ethernet.h:422
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:428
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:426
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:424
Kernel timepoint type.
Definition clock.h:291
Ethernet address.
Definition ethernet.h:51
uint8_t addr[6U]
Buffer storing the address.
Definition ethernet.h:52
MAC address configuration.
Definition ethernet.h:1222
enum net_eth_mac_type type
The configuration type.
Definition ethernet.h:1224
struct nvmem_cell cell
The NVMEM cell to read the MAC address from.
Definition ethernet.h:1239
uint8_t addr[6U]
The static MAC address part.
Definition ethernet.h:1231
uint8_t addr_len
The length of the statically provided part.
Definition ethernet.h:1233
Network Interface structure.
Definition net_if.h:735
IPv6 address struct.
Definition net_ip.h:144
IPv4 address struct.
Definition net_ip.h:156
LLDP Data Unit (LLDPDU) shall contain the following ordered TLVs as stated in "8.2 LLDPDU format" fro...
Definition lldp.h:172
Network packet.
Definition net_pkt.h:95
Generalized Precision Time Protocol Extended Timestamp format.
Definition ptp_time.h:154
(Generalized) Precision Time Protocol Timestamp format.
Definition ptp_time.h:111
All Ethernet specific statistics.
Definition net_stats.h:647
Non-Volatile Memory cell representation.
Definition nvmem.h:37