Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1
5
6/*
7 * Copyright (c) 2016 Intel Corporation
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11
12#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_H_
13#define ZEPHYR_INCLUDE_NET_ETHERNET_H_
14
15#include <zephyr/kernel.h>
16#include <zephyr/types.h>
17#include <stdbool.h>
18#include <zephyr/sys/atomic.h>
19
20#include <zephyr/net/net_ip.h>
21#include <zephyr/net/net_pkt.h>
22#include <zephyr/net/lldp.h>
23#include <zephyr/sys/clock.h>
24#include <zephyr/sys/util.h>
25#include <zephyr/net/net_if.h>
27#include <zephyr/net/ptp_time.h>
28#include <zephyr/net/virtual.h>
30
31#if defined(CONFIG_NVMEM)
32#include <zephyr/nvmem.h>
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
47
48#define NET_ETH_ADDR_LEN 6U
49
54
56
57#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
58
59/* zephyr-keep-sorted-start */
60#define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */
61#define NET_ETH_PTYPE_ARP 0x0806
62#define NET_ETH_PTYPE_CAN 0x000C /* CAN: Controller Area Network */
63#define NET_ETH_PTYPE_CANFD 0x000D /* CANFD: CAN flexible data rate*/
64#define NET_ETH_PTYPE_EAPOL 0x888e
65#define NET_ETH_PTYPE_ECAT 0x88a4
66#define NET_ETH_PTYPE_HDLC 0x0019 /* HDLC frames (like in PPP) */
67#define NET_ETH_PTYPE_IEEE802154 0x00F6 /* from linux/if_ether.h: IEEE802.15.4 frame */
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 /* TSN (IEEE 1722) packet */
73#define NET_ETH_PTYPE_VLAN 0x8100
74/* zephyr-keep-sorted-stop */
75
76/* zephyr-keep-sorted-start re(^#define) */
77#if !defined(ETH_P_8021Q)
78#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
79#endif
80#if !defined(ETH_P_ALL)
81#define ETH_P_ALL NET_ETH_PTYPE_ALL
82#endif
83#if !defined(ETH_P_ARP)
84#define ETH_P_ARP NET_ETH_PTYPE_ARP
85#endif
86#if !defined(ETH_P_CAN)
87#define ETH_P_CAN NET_ETH_PTYPE_CAN
88#endif
89#if !defined(ETH_P_CANFD)
90#define ETH_P_CANFD NET_ETH_PTYPE_CANFD
91#endif
92#if !defined(ETH_P_EAPOL)
93#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL
94#endif
95#if !defined(ETH_P_ECAT)
96#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
97#endif
98#if !defined(ETH_P_HDLC)
99#define ETH_P_HDLC NET_ETH_PTYPE_HDLC
100#endif
101#if !defined(ETH_P_IEEE802154)
102#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
103#endif
104#if !defined(ETH_P_IP)
105#define ETH_P_IP NET_ETH_PTYPE_IP
106#endif
107#if !defined(ETH_P_IPV6)
108#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
109#endif
110#if !defined(ETH_P_TSN)
111#define ETH_P_TSN NET_ETH_PTYPE_TSN
112#endif
113/* zephyr-keep-sorted-stop */
114
116
117#define NET_ETH_MINIMAL_FRAME_SIZE 60
118#define NET_ETH_MTU 1500
119
121
122#if defined(CONFIG_NET_VLAN)
123#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_vlan_hdr))
124#else
125#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
126#endif
127
128#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
129
130#if defined(CONFIG_DSA_TAG_SIZE)
131#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
132#else
133#define DSA_TAG_SIZE 0
134#endif
135
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)
138
139#define NET_ETH_VLAN_HDR_SIZE 4
140
142
205
207
208enum dsa_port_type {
209 NON_DSA_PORT,
210 DSA_CONDUIT_PORT,
211 DSA_USER_PORT,
212 DSA_CPU_PORT,
213 DSA_PORT,
214};
215
216enum ethernet_config_type {
217 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
218 ETHERNET_CONFIG_TYPE_QAV_PARAM,
219 ETHERNET_CONFIG_TYPE_QBV_PARAM,
220 ETHERNET_CONFIG_TYPE_QBU_PARAM,
221 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
222 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
223 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
224 ETHERNET_CONFIG_TYPE_FILTER,
225 ETHERNET_CONFIG_TYPE_PORTS_NUM,
226 ETHERNET_CONFIG_TYPE_TXINJECTION_MODE,
227 ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT,
228 ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT,
229 ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM,
230};
231
232enum ethernet_qav_param_type {
233 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
234 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
235 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
236 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
237 ETHERNET_QAV_PARAM_TYPE_STATUS,
238};
239
241
247 enum ethernet_qav_param_type type;
248 union {
252 unsigned int delta_bandwidth;
254 unsigned int idle_slope;
256 unsigned int oper_idle_slope;
258 unsigned int traffic_class;
259 } ;
260};
261
263
264enum ethernet_qbv_param_type {
265 ETHERNET_QBV_PARAM_TYPE_STATUS,
266 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
267 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
268 ETHERNET_QBV_PARAM_TYPE_TIME,
269};
270
271enum ethernet_qbv_state_type {
272 ETHERNET_QBV_STATE_TYPE_ADMIN,
273 ETHERNET_QBV_STATE_TYPE_OPER,
274};
275
276enum ethernet_gate_state_operation {
277 ETHERNET_SET_GATE_STATE,
278 ETHERNET_SET_AND_HOLD_MAC_STATE,
279 ETHERNET_SET_AND_RELEASE_MAC_STATE,
280};
281
283
289 enum ethernet_qbv_param_type type;
291 enum ethernet_qbv_state_type state;
292 union {
295
297 struct {
299 bool gate_status[NET_TC_TX_COUNT];
300
302 enum ethernet_gate_state_operation operation;
303
306
310
313
318 struct {
321
324
327 };
328 } ;
329};
330
332
333enum ethernet_qbu_param_type {
334 ETHERNET_QBU_PARAM_TYPE_STATUS,
335 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
336 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
337 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
338
339 /* Some preemption settings are from Qbr spec. */
340 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
341 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
342};
343
344enum ethernet_qbu_preempt_status {
345 ETHERNET_QBU_STATUS_EXPRESS,
346 ETHERNET_QBU_STATUS_PREEMPTABLE
347} __packed;
348
350
356 enum ethernet_qbu_param_type type;
357 union {
360
363
365 enum ethernet_qbu_preempt_status
366 frame_preempt_statuses[NET_TC_TX_COUNT];
367
370
373
379 } ;
380};
381
383
384enum ethernet_filter_type {
385 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
386 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
387};
388
390
399
403 enum ethernet_filter_type type;
407 bool set;
408};
409
411
412enum ethernet_txtime_param_type {
413 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
414};
415
417
421 enum ethernet_txtime_param_type type;
426};
427
431 ETHERNET_CHECKSUM_SUPPORT_NONE = NET_IF_CHECKSUM_NONE_BIT,
433 ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER = NET_IF_CHECKSUM_IPV4_HEADER_BIT,
435 ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP = NET_IF_CHECKSUM_IPV4_ICMP_BIT,
437 ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER = NET_IF_CHECKSUM_IPV6_HEADER_BIT,
439 ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP = NET_IF_CHECKSUM_IPV6_ICMP_BIT,
441 ETHERNET_CHECKSUM_SUPPORT_TCP = NET_IF_CHECKSUM_TCP_BIT,
443 ETHERNET_CHECKSUM_SUPPORT_UDP = NET_IF_CHECKSUM_UDP_BIT,
444};
445
447
448struct ethernet_config {
449 union {
450 bool promisc_mode;
451 bool txinjection_mode;
452
453 struct net_eth_addr mac_address;
454
455 struct ethernet_qav_param qav_param;
456 struct ethernet_qbv_param qbv_param;
457 struct ethernet_qbu_param qbu_param;
458 struct ethernet_txtime_param txtime_param;
459
460 int priority_queues_num;
461 int ports_num;
462
463 enum ethernet_checksum_support chksum_support;
464
465 struct ethernet_filter filter;
466
467 uint16_t extra_tx_pkt_headroom;
468 } ;
469};
470
472
482
489 struct net_if_api iface_api;
490
495#if defined(CONFIG_NET_STATISTICS_ETHERNET)
496 struct net_stats_eth *(*get_stats)(const struct device *dev, struct net_if *iface);
497
503 struct net_stats_eth *(*get_stats_type)(const struct device *dev,
504 struct net_if *iface,
505 uint32_t type);
506#endif
507
509 int (*start)(const struct device *dev, struct net_if *iface);
510
512 int (*stop)(const struct device *dev, struct net_if *iface);
513
515 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev, struct net_if *iface);
516
518 int (*set_config)(const struct device *dev,
519 struct net_if *iface,
520 enum ethernet_config_type type,
521 const struct ethernet_config *config);
522
524 int (*get_config)(const struct device *dev,
525 struct net_if *iface,
526 enum ethernet_config_type type,
527 struct ethernet_config *config);
528
534#if defined(CONFIG_NET_VLAN)
535 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
536 uint16_t tag, bool enable);
537#endif /* CONFIG_NET_VLAN */
538
540#if defined(CONFIG_PTP_CLOCK)
541 const struct device *(*get_ptp_clock)(const struct device *dev, struct net_if *iface);
542#endif /* CONFIG_PTP_CLOCK */
543
545 const struct device *(*get_phy)(const struct device *dev, struct net_if *iface);
546
548 int (*send)(const struct device *dev, struct net_pkt *pkt);
549};
550
552
553/* Make sure that the network interface API is properly setup inside
554 * Ethernet API struct (it is the first one).
555 */
556BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
557
558struct net_eth_hdr {
559 struct net_eth_addr dst;
560 struct net_eth_addr src;
561 uint16_t type;
562} __packed;
563
564struct ethernet_vlan {
566 struct net_if *iface;
567
569 uint16_t tag;
570};
571
572#if defined(CONFIG_NET_VLAN_COUNT)
573#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
574#else
575#define NET_VLAN_MAX_COUNT 0
576#endif
577
579
600
602
603enum ethernet_flags {
604 ETH_CARRIER_UP,
605};
606
608struct ethernet_context {
613
614#if defined(CONFIG_NET_ETHERNET_BRIDGE)
615 struct net_if *bridge;
616#endif
617
624 struct k_work carrier_work;
625
627 struct net_if *iface;
628
629#if defined(CONFIG_NET_LLDP)
631 struct ethernet_lldp lldp;
632#endif
633
637 enum net_l2_flags ethernet_l2_flags;
638
639#if defined(CONFIG_NET_GPTP)
644 uint16_t gptp_port;
645#endif
646
647#if defined(CONFIG_NET_DSA)
649 enum dsa_port_type dsa_port;
650
652 void *dsa_switch_ctx;
653#endif
654
656 bool is_net_carrier_up : 1;
657
659 bool is_init : 1;
660
662 enum ethernet_if_types eth_if_type;
663};
664
670void ethernet_init(struct net_if *iface);
671
672#define ETHERNET_L2_CTX_TYPE struct ethernet_context
673
674/* Separate header for VLAN as some of device interfaces might not
675 * support VLAN.
676 */
677struct net_eth_vlan_hdr {
678 struct net_eth_addr dst;
679 struct net_eth_addr src;
680 struct {
681 uint16_t tpid; /* tag protocol id */
682 uint16_t tci; /* tag control info */
683 } vlan;
684 uint16_t type;
685} __packed;
686
688
696static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
697{
698 if (addr->addr[0] == 0xff &&
699 addr->addr[1] == 0xff &&
700 addr->addr[2] == 0xff &&
701 addr->addr[3] == 0xff &&
702 addr->addr[4] == 0xff &&
703 addr->addr[5] == 0xff) {
704 return true;
705 }
706
707 return false;
708}
709
717static inline bool net_eth_is_addr_all_zeroes(struct net_eth_addr *addr)
718{
719 if (addr->addr[0] == 0x00 &&
720 addr->addr[1] == 0x00 &&
721 addr->addr[2] == 0x00 &&
722 addr->addr[3] == 0x00 &&
723 addr->addr[4] == 0x00 &&
724 addr->addr[5] == 0x00) {
725 return true;
726 }
727
728 return false;
729}
730
738static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
739{
740 if (addr->addr[0] == 0x00 &&
741 addr->addr[1] == 0x00 &&
742 addr->addr[2] == 0x00 &&
743 addr->addr[3] == 0x00 &&
744 addr->addr[4] == 0x00 &&
745 addr->addr[5] == 0x00) {
746 return true;
747 }
748
749 return false;
750}
751
759static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
760{
761 return addr->addr[0] & 0x01;
762}
763
771static inline bool net_eth_is_addr_unicast(struct net_eth_addr *addr)
772{
774}
775
783static inline bool net_eth_is_addr_valid(struct net_eth_addr *addr)
784{
786}
787
795static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
796{
797 if (addr->addr[0] == 0x01 &&
798 addr->addr[1] == 0x80 &&
799 addr->addr[2] == 0xc2 &&
800 addr->addr[3] == 0x00 &&
801 addr->addr[4] == 0x00 &&
802 addr->addr[5] == 0x0e) {
803 return true;
804 }
805
806 return false;
807}
808
816static inline bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
817{
818 if (addr->addr[0] == 0x01 &&
819 addr->addr[1] == 0x1b &&
820 addr->addr[2] == 0x19 &&
821 addr->addr[3] == 0x00 &&
822 addr->addr[4] == 0x00 &&
823 addr->addr[5] == 0x00) {
824 return true;
825 }
826
827 return false;
828}
829
836
843void net_eth_ipv4_mcast_to_mac_addr(const struct net_in_addr *ipv4_addr,
844 struct net_eth_addr *mac_addr);
845
852void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr,
853 struct net_eth_addr *mac_addr);
854
862static inline
864{
865 const struct device *dev = net_if_get_device(iface);
866 const struct ethernet_api *api = (struct ethernet_api *)dev->api;
867 enum ethernet_hw_caps caps = (enum ethernet_hw_caps)0;
868#if defined(CONFIG_NET_DSA)
869 struct ethernet_context *eth_ctx = net_if_l2_data(iface);
870
871 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
873 } else if (eth_ctx->dsa_port == DSA_USER_PORT) {
875 }
876#endif
877 if (api == NULL || api->get_capabilities == NULL) {
878 return caps;
879 }
880
881 return (enum ethernet_hw_caps)(caps | api->get_capabilities(dev, iface));
882}
883
893static inline
894int net_eth_get_hw_config(struct net_if *iface, enum ethernet_config_type type,
895 struct ethernet_config *config)
896{
897 const struct device *dev = net_if_get_device(iface);
898 const struct ethernet_api *eth = (struct ethernet_api *)dev->api;
899
900 if (!eth->get_config) {
901 return -ENOTSUP;
902 }
903
904 return eth->get_config(dev, iface, type, config);
905}
906
907
916#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
917int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
918#else
919static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
920{
921 ARG_UNUSED(iface);
922 ARG_UNUSED(tag);
923
924 return -EINVAL;
925}
926#endif
927
936#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
937int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
938#else
939static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
940{
941 ARG_UNUSED(iface);
942 ARG_UNUSED(tag);
943
944 return -EINVAL;
945}
946#endif
947
959#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
961#else
962static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
963{
964 ARG_UNUSED(iface);
965
966 return NET_VLAN_TAG_UNSPEC;
967}
968#endif
969
979#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
980struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
981#else
982static inline
983struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag)
984{
985 /* Special case for priority tagged frames, without vlan ifaces being present */
986 if (IS_ENABLED(CONFIG_NET_VLAN) && (tag == NET_VLAN_TAG_PRIORITY)) {
987 return iface;
988 }
989
990 return NULL;
991}
992#endif
993
1003static inline struct net_if *net_eth_get_vlan_main(struct net_if *iface)
1004{
1005 return net_virtual_get_iface(iface);
1006}
1007
1022#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1023bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1024 struct net_if *iface);
1025#else
1026static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1027 struct net_if *iface)
1028{
1029 ARG_UNUSED(ctx);
1030 ARG_UNUSED(iface);
1031
1032 return IS_ENABLED(CONFIG_NET_VLAN);
1033}
1034#endif
1035
1043#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1044bool net_eth_get_vlan_status(struct net_if *iface);
1045#else
1046static inline bool net_eth_get_vlan_status(struct net_if *iface)
1047{
1048 ARG_UNUSED(iface);
1049
1050 return false;
1051}
1052#endif
1053
1061#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1062bool net_eth_is_vlan_interface(struct net_if *iface);
1063#else
1064static inline bool net_eth_is_vlan_interface(struct net_if *iface)
1065{
1066 ARG_UNUSED(iface);
1067
1068 return false;
1069}
1070#endif
1071
1073
1074#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1075
1076#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1077 init_fn, pm, data, config, prio, \
1078 api, mtu) \
1079 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1080 init_fn, pm, data, config, prio, \
1081 api, ETHERNET_L2, \
1082 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1083
1084#else /* CONFIG_ETH_DRIVER_RAW_MODE */
1085
1086#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1087 init_fn, pm, data, config, prio, \
1088 api, mtu) \
1089 Z_DEVICE_STATE_DEFINE(dev_id); \
1090 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1091 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1092 config, POST_KERNEL, prio, api, \
1093 &Z_DEVICE_STATE_NAME(dev_id));
1094
1095#endif /* CONFIG_ETH_DRIVER_RAW_MODE */
1096
1097#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1098 config, prio, api, mtu) \
1099 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1100 init_fn, pm, data, config, prio, \
1101 api, mtu)
1102
1104
1122#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1123 prio, api, mtu) \
1124 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1125 pm, data, config, prio, api, mtu)
1126
1149#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1150 pm, data, config, prio, api, mtu) \
1151 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1152 instance, init_fn, pm, data, \
1153 config, prio, api, mtu)
1154
1171#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1172 prio, api, mtu) \
1173 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1174 DEVICE_DT_NAME(node_id), init_fn, pm, \
1175 data, config, prio, api, mtu)
1176
1186#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1187 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1188
1196#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1197 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1198
1213
1227#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1233#endif
1234};
1235
1250static inline int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
1251{
1252 if (cfg == NULL || cfg->type == NET_ETH_MAC_DEFAULT) {
1253 return -ENODATA;
1254 }
1255
1256 /* Copy the static part */
1257 memcpy(mac_addr, cfg->addr, cfg->addr_len);
1258
1259 if (cfg->type == NET_ETH_MAC_RANDOM) {
1260 sys_rand_get(&mac_addr[cfg->addr_len], NET_ETH_ADDR_LEN - cfg->addr_len);
1261
1262 /* Clear group bit, multicast (I/G) */
1263 mac_addr[0] &= ~0x01;
1264 /* Set MAC address locally administered, unicast (LAA) */
1265 mac_addr[0] |= 0x02;
1266
1267 return 0;
1268 }
1269
1270#if defined(CONFIG_NVMEM)
1271 if (cfg->type == NET_ETH_MAC_NVMEM) {
1272 return nvmem_cell_read(&cfg->cell, &mac_addr[cfg->addr_len], 0,
1273 NET_ETH_ADDR_LEN - cfg->addr_len);
1274 }
1275#endif
1276
1277 if (cfg->type == NET_ETH_MAC_STATIC) {
1278 return 0;
1279 }
1280
1281 return -ENODATA;
1282}
1283
1285
1286#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1293#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1294 .cell = NVMEM_CELL_GET_BY_NAME_OR(node_id, mac_address, {0}),
1295#else
1296#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id)
1297#endif
1298
1299#define Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id) \
1300 { \
1301 .type = NET_ETH_MAC_RANDOM, \
1302 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1303 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1304 }
1305
1306#define Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id) \
1307 { \
1308 .type = NET_ETH_MAC_NVMEM, \
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), \
1311 Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1312 }
1313
1314#define Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id) \
1315 { \
1316 .type = NET_ETH_MAC_STATIC, \
1317 .addr = DT_PROP(node_id, local_mac_address), \
1318 .addr_len = DT_PROP_LEN(node_id, local_mac_address), \
1319 }
1320
1321#define Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id) \
1322 { \
1323 .type = NET_ETH_MAC_DEFAULT, \
1324 }
1325
1327
1333#define NET_ETH_MAC_DT_CONFIG_INIT(node_id) \
1334 COND_CASE_1(DT_PROP(node_id, zephyr_random_mac_address), \
1335 (Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id)), \
1336 DT_NVMEM_CELLS_HAS_NAME(node_id, mac_address), \
1337 (Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id)), \
1338 DT_NODE_HAS_PROP(node_id, local_mac_address), \
1339 (Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id)), \
1340 (Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id)))
1341
1349#define NET_ETH_MAC_DT_INST_CONFIG_INIT(inst) \
1350 NET_ETH_MAC_DT_CONFIG_INIT(DT_DRV_INST(inst))
1351
1359void net_eth_carrier_set(struct net_if *iface, bool carrier_up);
1360
1367static inline void net_eth_carrier_on(struct net_if *iface)
1368{
1369 net_eth_carrier_set(iface, true);
1370}
1371
1378static inline void net_eth_carrier_off(struct net_if *iface)
1379{
1380 net_eth_carrier_set(iface, false);
1381}
1382
1392int net_eth_promisc_mode(struct net_if *iface, bool enable);
1393
1403int net_eth_txinjection_mode(struct net_if *iface, bool enable);
1404
1415int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac,
1416 enum ethernet_filter_type type, bool enable);
1417
1425const struct device *net_eth_get_phy(struct net_if *iface);
1426
1435#if defined(CONFIG_PTP_CLOCK)
1436const struct device *net_eth_get_ptp_clock(struct net_if *iface);
1437#else
1438static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
1439{
1440 ARG_UNUSED(iface);
1441
1442 return NULL;
1443}
1444#endif
1445
1455__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
1456
1464static inline bool net_eth_type_is_wifi(struct net_if *iface)
1465{
1466 const struct ethernet_context *ctx = (struct ethernet_context *)
1467 net_if_l2_data(iface);
1468
1469 return ctx->eth_if_type == L2_ETH_IF_TYPE_WIFI;
1470}
1471
1479static inline bool net_eth_type_is_ethernet(struct net_if *iface)
1480{
1481 const struct ethernet_context *ctx = (struct ethernet_context *)net_if_l2_data(iface);
1482
1483 return ctx->eth_if_type == L2_ETH_IF_TYPE_ETHERNET;
1484}
1485
1491static inline void net_eth_set_if_type_wifi(struct net_if *iface)
1492{
1493 struct ethernet_context *ctx = (struct ethernet_context *)net_if_l2_data(iface);
1494
1495 ctx->eth_if_type = L2_ETH_IF_TYPE_WIFI;
1496}
1497
1501
1502#ifdef __cplusplus
1503}
1504#endif
1505
1506#include <zephyr/syscalls/ethernet.h>
1507
1508#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
System clock APIs.
VLAN specific definitions.
long atomic_t
Atomic integer variable.
Definition atomic_types.h:31
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:1003
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:894
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:392
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:919
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:717
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:759
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:1438
#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.
static uint16_t net_eth_get_vlan_tag(struct net_if *iface)
Return VLAN tag specified to network interface.
Definition ethernet.h:962
static void net_eth_carrier_on(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier is detected.
Definition ethernet.h:1367
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:1464
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:696
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:1046
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:738
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1064
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 void net_eth_carrier_off(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier was lost.
Definition ethernet.h:1378
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:1250
static void net_eth_set_if_type_wifi(struct net_if *iface)
Set the Ethernet interface type to Wi-Fi.
Definition ethernet.h:1491
void net_eth_carrier_set(struct net_if *iface, bool carrier_up)
Inform ethernet L2 driver that ethernet carrier is detected or was lost.
static enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
Return ethernet device hardware capability information.
Definition ethernet.h:863
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:939
ethernet_checksum_support
Protocols that are supported by checksum offloading.
Definition ethernet.h:429
ethernet_stats_type
Ethernet statistics type (bitmap).
Definition ethernet.h:474
net_eth_mac_type
MAC address configuration types.
Definition ethernet.h:1200
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 or if prio...
Definition ethernet.h:1026
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:983
static bool net_eth_type_is_ethernet(struct net_if *iface)
Check if the Ethernet L2 network interface is cabled ethernet.
Definition ethernet.h:1479
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:771
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:795
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:816
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:783
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:394
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:397
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:152
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:188
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:176
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:185
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:158
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:191
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:155
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:179
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:161
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:197
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:203
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:170
@ 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:182
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:167
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:200
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:194
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:173
@ 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:443
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:441
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:437
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header).
Definition ethernet.h:435
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:433
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:431
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header).
Definition ethernet.h:439
@ ETHERNET_STATS_TYPE_VENDOR
Vendor statistics only.
Definition ethernet.h:478
@ ETHERNET_STATS_TYPE_ALL
All statistics.
Definition ethernet.h:480
@ ETHERNET_STATS_TYPE_COMMON
Common statistics only (excludes vendor statistics).
Definition ethernet.h:476
@ NET_ETH_MAC_RANDOM
A random MAC address is generated during initialization.
Definition ethernet.h:1204
@ NET_ETH_MAC_NVMEM
The MAC address is read from an NVMEM cell.
Definition ethernet.h:1209
@ NET_ETH_MAC_DEFAULT
MAC address is handled by the driver (backwards compatible case).
Definition ethernet.h:1202
@ NET_ETH_MAC_STATIC
A static MAC address is provided in the device tree.
Definition ethernet.h:1211
enum net_verdict(* net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
LLDP Receive packet callback.
Definition lldp.h:213
static void * net_if_l2_data(struct net_if *iface)
Get a pointer to the interface L2 private data.
Definition net_if.h:1076
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1094
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:44
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:154
#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:78
#define EINVAL
Invalid argument.
Definition errno.h:61
#define ENOTSUP
Unsupported value.
Definition errno.h:115
struct net_if * net_virtual_get_iface(struct net_if *iface)
Return network interface related to this virtual network interface.
#define NET_VLAN_TAG_UNSPEC
Unspecified VLAN tag value.
Definition ethernet_vlan.h:32
#define NET_VLAN_TAG_PRIORITY
VLAN ID for forwarding to the native interface (priority tagging).
Definition ethernet_vlan.h:35
#define NULL
Definition iar_missing_defs.h:20
#define BUILD_ASSERT(EXPR, MSG...)
Definition llvm.h:51
Public kernel APIs.
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:484
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:489
int(* start)(const struct device *dev, struct net_if *iface)
Collect optional ethernet specific statistics.
Definition ethernet.h:509
int(* stop)(const struct device *dev, struct net_if *iface)
Stop the device.
Definition ethernet.h:512
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:548
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:518
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:524
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev, struct net_if *iface)
Get the device capabilities.
Definition ethernet.h:515
Ethernet filter description.
Definition ethernet.h:401
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:405
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:407
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:403
Ethernet LLDP specific parameters.
Definition ethernet.h:581
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:589
sys_snode_t node
Used for track timers.
Definition ethernet.h:583
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:598
k_timepoint_t tx_timer_timeout
LLDP TX timer timeout.
Definition ethernet.h:595
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:592
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:586
Ethernet Qav specific parameters.
Definition ethernet.h:243
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:250
unsigned int oper_idle_slope
Oper Idle Slope (bits per second).
Definition ethernet.h:256
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:247
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:258
int queue_id
ID of the priority queue to use.
Definition ethernet.h:245
unsigned int idle_slope
Idle Slope (bits per second).
Definition ethernet.h:254
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth).
Definition ethernet.h:252
Ethernet Qbu specific parameters.
Definition ethernet.h:352
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:365
uint32_t release_advance
Release advance (nanoseconds).
Definition ethernet.h:362
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:356
uint32_t hold_advance
Hold advance (nanoseconds).
Definition ethernet.h:359
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:369
bool link_partner_status
Link partner status (from Qbr).
Definition ethernet.h:372
int port_id
Port id.
Definition ethernet.h:354
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:378
Ethernet Qbv specific parameters.
Definition ethernet.h:285
int port_id
Port id.
Definition ethernet.h:287
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:294
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:289
uint16_t row
Gate control list row.
Definition ethernet.h:308
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:291
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:299
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:320
uint32_t extension_time
Extension time (nanoseconds).
Definition ethernet.h:326
struct ethernet_qbv_param::@143362007131123250037113307322214063224345127206::@267205225343356146055331045254176141131315175175 gate_control
Gate control information.
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:302
uint32_t time_interval
Time interval ticks (nanoseconds).
Definition ethernet.h:305
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:323
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:312
Ethernet TXTIME specific parameters.
Definition ethernet.h:419
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:425
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:423
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:421
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:1215
enum net_eth_mac_type type
The configuration type.
Definition ethernet.h:1217
struct nvmem_cell cell
The NVMEM cell to read the MAC address from.
Definition ethernet.h:1232
uint8_t addr[6U]
The static MAC address part.
Definition ethernet.h:1224
uint8_t addr_len
The length of the statically provided part.
Definition ethernet.h:1226
Network Interface structure.
Definition net_if.h:744
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:119
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
Header file for the Atomic operations API.
Misc utilities.
Virtual Network Interface.