Zephyr API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2016 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_H_
14#define ZEPHYR_INCLUDE_NET_ETHERNET_H_
15
16#include <zephyr/kernel.h>
17#include <zephyr/types.h>
18#include <stdbool.h>
19#include <zephyr/sys/atomic.h>
20
21#include <zephyr/net/net_ip.h>
22#include <zephyr/net/net_pkt.h>
23#include <zephyr/net/lldp.h>
24#include <zephyr/sys/clock.h>
25#include <zephyr/sys/util.h>
26#include <zephyr/net/net_if.h>
28#include <zephyr/net/ptp_time.h>
29#include <zephyr/net/virtual.h>
31
32#if defined(CONFIG_NVMEM)
33#include <zephyr/nvmem.h>
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
49#define NET_ETH_ADDR_LEN 6U
55
58#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
59
60/* zephyr-keep-sorted-start */
61#define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */
62#define NET_ETH_PTYPE_ARP 0x0806
63#define NET_ETH_PTYPE_CAN 0x000C /* CAN: Controller Area Network */
64#define NET_ETH_PTYPE_CANFD 0x000D /* CANFD: CAN flexible data rate*/
65#define NET_ETH_PTYPE_EAPOL 0x888e
66#define NET_ETH_PTYPE_ECAT 0x88a4
67#define NET_ETH_PTYPE_HDLC 0x0019 /* HDLC frames (like in PPP) */
68#define NET_ETH_PTYPE_IEEE802154 0x00F6 /* from linux/if_ether.h: IEEE802.15.4 frame */
69#define NET_ETH_PTYPE_IP 0x0800
70#define NET_ETH_PTYPE_IPV6 0x86dd
71#define NET_ETH_PTYPE_LLDP 0x88cc
72#define NET_ETH_PTYPE_PTP 0x88f7
73#define NET_ETH_PTYPE_TSN 0x22f0 /* TSN (IEEE 1722) packet */
74#define NET_ETH_PTYPE_VLAN 0x8100
75/* zephyr-keep-sorted-stop */
76
77/* zephyr-keep-sorted-start re(^#define) */
78#if !defined(ETH_P_8021Q)
79#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
80#endif
81#if !defined(ETH_P_ALL)
82#define ETH_P_ALL NET_ETH_PTYPE_ALL
83#endif
84#if !defined(ETH_P_ARP)
85#define ETH_P_ARP NET_ETH_PTYPE_ARP
86#endif
87#if !defined(ETH_P_CAN)
88#define ETH_P_CAN NET_ETH_PTYPE_CAN
89#endif
90#if !defined(ETH_P_CANFD)
91#define ETH_P_CANFD NET_ETH_PTYPE_CANFD
92#endif
93#if !defined(ETH_P_EAPOL)
94#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL
95#endif
96#if !defined(ETH_P_ECAT)
97#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
98#endif
99#if !defined(ETH_P_HDLC)
100#define ETH_P_HDLC NET_ETH_PTYPE_HDLC
101#endif
102#if !defined(ETH_P_IEEE802154)
103#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
104#endif
105#if !defined(ETH_P_IP)
106#define ETH_P_IP NET_ETH_PTYPE_IP
107#endif
108#if !defined(ETH_P_IPV6)
109#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
110#endif
111#if !defined(ETH_P_TSN)
112#define ETH_P_TSN NET_ETH_PTYPE_TSN
113#endif
114/* zephyr-keep-sorted-stop */
115
118#define NET_ETH_MINIMAL_FRAME_SIZE 60
119#define NET_ETH_MTU 1500
123#if defined(CONFIG_NET_VLAN)
124#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_vlan_hdr))
125#else
126#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
127#endif
128
129#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
130
131#if defined(CONFIG_DSA_TAG_SIZE)
132#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
133#else
134#define DSA_TAG_SIZE 0
135#endif
136
137#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
138#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
139
140#define NET_ETH_VLAN_HDR_SIZE 4
141
209
212enum dsa_port_type {
213 NON_DSA_PORT,
214 DSA_CONDUIT_PORT,
215 DSA_USER_PORT,
216 DSA_CPU_PORT,
217 DSA_PORT,
218};
219
220enum ethernet_config_type {
221 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
222 ETHERNET_CONFIG_TYPE_QAV_PARAM,
223 ETHERNET_CONFIG_TYPE_QBV_PARAM,
224 ETHERNET_CONFIG_TYPE_QBU_PARAM,
225 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
226 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
227 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
228 ETHERNET_CONFIG_TYPE_FILTER,
229 ETHERNET_CONFIG_TYPE_PORTS_NUM,
230 ETHERNET_CONFIG_TYPE_TXINJECTION_MODE,
231 ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT,
232 ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT,
233 ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM,
234};
235
236enum ethernet_qav_param_type {
237 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
238 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
239 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
240 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
241 ETHERNET_QAV_PARAM_TYPE_STATUS,
242};
243
251 enum ethernet_qav_param_type type;
252 union {
256 unsigned int delta_bandwidth;
258 unsigned int idle_slope;
260 unsigned int oper_idle_slope;
262 unsigned int traffic_class;
263 } ;
264};
265
268enum ethernet_qbv_param_type {
269 ETHERNET_QBV_PARAM_TYPE_STATUS,
270 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
271 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
272 ETHERNET_QBV_PARAM_TYPE_TIME,
273};
274
275enum ethernet_qbv_state_type {
276 ETHERNET_QBV_STATE_TYPE_ADMIN,
277 ETHERNET_QBV_STATE_TYPE_OPER,
278};
279
280enum ethernet_gate_state_operation {
281 ETHERNET_SET_GATE_STATE,
282 ETHERNET_SET_AND_HOLD_MAC_STATE,
283 ETHERNET_SET_AND_RELEASE_MAC_STATE,
284};
285
293 enum ethernet_qbv_param_type type;
295 enum ethernet_qbv_state_type state;
296 union {
299
301 struct {
303 bool gate_status[NET_TC_TX_COUNT];
304
306 enum ethernet_gate_state_operation operation;
307
310
314
317
322 struct {
325
328
331 };
332 } ;
333};
334
337enum ethernet_qbu_param_type {
338 ETHERNET_QBU_PARAM_TYPE_STATUS,
339 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
340 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
341 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
342
343 /* Some preemption settings are from Qbr spec. */
344 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
345 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
346};
347
348enum ethernet_qbu_preempt_status {
349 ETHERNET_QBU_STATUS_EXPRESS,
350 ETHERNET_QBU_STATUS_PREEMPTABLE
351} __packed;
352
360 enum ethernet_qbu_param_type type;
361 union {
364
367
369 enum ethernet_qbu_preempt_status
370 frame_preempt_statuses[NET_TC_TX_COUNT];
371
374
377
383 } ;
384};
385
388enum ethernet_filter_type {
389 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
390 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
391};
392
403
407 enum ethernet_filter_type type;
411 bool set;
412};
413
416enum ethernet_txtime_param_type {
417 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
418};
419
425 enum ethernet_txtime_param_type type;
430};
431
435 ETHERNET_CHECKSUM_SUPPORT_NONE = NET_IF_CHECKSUM_NONE_BIT,
437 ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER = NET_IF_CHECKSUM_IPV4_HEADER_BIT,
439 ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP = NET_IF_CHECKSUM_IPV4_ICMP_BIT,
441 ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER = NET_IF_CHECKSUM_IPV6_HEADER_BIT,
443 ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP = NET_IF_CHECKSUM_IPV6_ICMP_BIT,
445 ETHERNET_CHECKSUM_SUPPORT_TCP = NET_IF_CHECKSUM_TCP_BIT,
447 ETHERNET_CHECKSUM_SUPPORT_UDP = NET_IF_CHECKSUM_UDP_BIT,
448};
449
452struct ethernet_config {
453 union {
454 bool promisc_mode;
455 bool txinjection_mode;
456
457 struct net_eth_addr mac_address;
458
459 struct ethernet_qav_param qav_param;
460 struct ethernet_qbv_param qbv_param;
461 struct ethernet_qbu_param qbu_param;
462 struct ethernet_txtime_param txtime_param;
463
464 int priority_queues_num;
465 int ports_num;
466
467 enum ethernet_checksum_support chksum_support;
468
469 struct ethernet_filter filter;
470
471 uint16_t extra_tx_pkt_headroom;
472 } ;
473};
474
486
493 struct net_if_api iface_api;
494
499#if defined(CONFIG_NET_STATISTICS_ETHERNET)
500 struct net_stats_eth *(*get_stats)(const struct device *dev, struct net_if *iface);
501
507 struct net_stats_eth *(*get_stats_type)(const struct device *dev,
508 struct net_if *iface,
509 uint32_t type);
510#endif
511
513 int (*start)(const struct device *dev, struct net_if *iface);
514
516 int (*stop)(const struct device *dev, struct net_if *iface);
517
519 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev, struct net_if *iface);
520
522 int (*set_config)(const struct device *dev,
523 struct net_if *iface,
524 enum ethernet_config_type type,
525 const struct ethernet_config *config);
526
528 int (*get_config)(const struct device *dev,
529 struct net_if *iface,
530 enum ethernet_config_type type,
531 struct ethernet_config *config);
532
538#if defined(CONFIG_NET_VLAN)
539 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
540 uint16_t tag, bool enable);
541#endif /* CONFIG_NET_VLAN */
542
544#if defined(CONFIG_PTP_CLOCK)
545 const struct device *(*get_ptp_clock)(const struct device *dev, struct net_if *iface);
546#endif /* CONFIG_PTP_CLOCK */
547
549 const struct device *(*get_phy)(const struct device *dev, struct net_if *iface);
550
552 int (*send)(const struct device *dev, struct net_pkt *pkt);
553};
554
557/* Make sure that the network interface API is properly setup inside
558 * Ethernet API struct (it is the first one).
559 */
560BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
561
562struct net_eth_hdr {
563 struct net_eth_addr dst;
564 struct net_eth_addr src;
565 uint16_t type;
566} __packed;
567
568struct ethernet_vlan {
570 struct net_if *iface;
571
573 uint16_t tag;
574};
575
576#if defined(CONFIG_NET_VLAN_COUNT)
577#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
578#else
579#define NET_VLAN_MAX_COUNT 0
580#endif
581
604
607enum ethernet_flags {
608 ETH_CARRIER_UP,
609};
610
612struct ethernet_context {
617
618#if defined(CONFIG_NET_ETHERNET_BRIDGE)
619 struct net_if *bridge;
620#endif
621
628 struct k_work carrier_work;
629
631 struct net_if *iface;
632
633#if defined(CONFIG_NET_LLDP)
635 struct ethernet_lldp lldp;
636#endif
637
641 enum net_l2_flags ethernet_l2_flags;
642
643#if defined(CONFIG_NET_GPTP)
648 uint16_t gptp_port;
649#endif
650
651#if defined(CONFIG_NET_DSA)
653 enum dsa_port_type dsa_port;
654
656 void *dsa_switch_ctx;
657#endif
658
660 bool is_net_carrier_up : 1;
661
663 bool is_init : 1;
664
666 enum ethernet_if_types eth_if_type;
667};
668
674void ethernet_init(struct net_if *iface);
675
676#define ETHERNET_L2_CTX_TYPE struct ethernet_context
677
678/* Separate header for VLAN as some of device interfaces might not
679 * support VLAN.
680 */
681struct net_eth_vlan_hdr {
682 struct net_eth_addr dst;
683 struct net_eth_addr src;
684 struct {
685 uint16_t tpid; /* tag protocol id */
686 uint16_t tci; /* tag control info */
687 } vlan;
688 uint16_t type;
689} __packed;
690
700static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
701{
702 if (addr->addr[0] == 0xff &&
703 addr->addr[1] == 0xff &&
704 addr->addr[2] == 0xff &&
705 addr->addr[3] == 0xff &&
706 addr->addr[4] == 0xff &&
707 addr->addr[5] == 0xff) {
708 return true;
709 }
710
711 return false;
712}
713
721static inline bool net_eth_is_addr_all_zeroes(struct net_eth_addr *addr)
722{
723 if (addr->addr[0] == 0x00 &&
724 addr->addr[1] == 0x00 &&
725 addr->addr[2] == 0x00 &&
726 addr->addr[3] == 0x00 &&
727 addr->addr[4] == 0x00 &&
728 addr->addr[5] == 0x00) {
729 return true;
730 }
731
732 return false;
733}
734
742static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
743{
744 if (addr->addr[0] == 0x00 &&
745 addr->addr[1] == 0x00 &&
746 addr->addr[2] == 0x00 &&
747 addr->addr[3] == 0x00 &&
748 addr->addr[4] == 0x00 &&
749 addr->addr[5] == 0x00) {
750 return true;
751 }
752
753 return false;
754}
755
763static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
764{
765 return addr->addr[0] & 0x01;
766}
767
775static inline bool net_eth_is_addr_unicast(struct net_eth_addr *addr)
776{
778}
779
787static inline bool net_eth_is_addr_valid(struct net_eth_addr *addr)
788{
790}
791
799static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
800{
801 if (addr->addr[0] == 0x01 &&
802 addr->addr[1] == 0x80 &&
803 addr->addr[2] == 0xc2 &&
804 addr->addr[3] == 0x00 &&
805 addr->addr[4] == 0x00 &&
806 addr->addr[5] == 0x0e) {
807 return true;
808 }
809
810 return false;
811}
812
820static inline bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
821{
822 if (addr->addr[0] == 0x01 &&
823 addr->addr[1] == 0x1b &&
824 addr->addr[2] == 0x19 &&
825 addr->addr[3] == 0x00 &&
826 addr->addr[4] == 0x00 &&
827 addr->addr[5] == 0x00) {
828 return true;
829 }
830
831 return false;
832}
833
840
847void net_eth_ipv4_mcast_to_mac_addr(const struct net_in_addr *ipv4_addr,
848 struct net_eth_addr *mac_addr);
849
856void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr,
857 struct net_eth_addr *mac_addr);
858
866static inline
868{
869 const struct device *dev = net_if_get_device(iface);
870 const struct ethernet_api *api = (struct ethernet_api *)dev->api;
871 enum ethernet_hw_caps caps = (enum ethernet_hw_caps)0;
872#if defined(CONFIG_NET_DSA)
873 struct ethernet_context *eth_ctx = net_if_l2_data(iface);
874
875 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
877 } else if (eth_ctx->dsa_port == DSA_USER_PORT) {
879 }
880#endif
881 if (api == NULL || api->get_capabilities == NULL) {
882 return caps;
883 }
884
885 return (enum ethernet_hw_caps)(caps | api->get_capabilities(dev, iface));
886}
887
897static inline
898int net_eth_get_hw_config(struct net_if *iface, enum ethernet_config_type type,
899 struct ethernet_config *config)
900{
901 const struct device *dev = net_if_get_device(iface);
902 const struct ethernet_api *eth = (struct ethernet_api *)dev->api;
903
904 if (!eth->get_config) {
905 return -ENOTSUP;
906 }
907
908 return eth->get_config(dev, iface, type, config);
909}
910
911
920#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
921int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
922#else
923static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
924{
925 ARG_UNUSED(iface);
926 ARG_UNUSED(tag);
927
928 return -EINVAL;
929}
930#endif
931
940#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
941int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
942#else
943static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
944{
945 ARG_UNUSED(iface);
946 ARG_UNUSED(tag);
947
948 return -EINVAL;
949}
950#endif
951
963#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
965#else
966static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
967{
968 ARG_UNUSED(iface);
969
970 return NET_VLAN_TAG_UNSPEC;
971}
972#endif
973
983#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
984struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
985#else
986static inline
987struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag)
988{
989 /* Special case for priority tagged frames, without vlan ifaces being present */
990 if (IS_ENABLED(CONFIG_NET_VLAN) && (tag == NET_VLAN_TAG_PRIORITY)) {
991 return iface;
992 }
993
994 return NULL;
995}
996#endif
997
1007static inline struct net_if *net_eth_get_vlan_main(struct net_if *iface)
1008{
1009 return net_virtual_get_iface(iface);
1010}
1011
1026#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1027bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1028 struct net_if *iface);
1029#else
1030static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1031 struct net_if *iface)
1032{
1033 ARG_UNUSED(ctx);
1034 ARG_UNUSED(iface);
1035
1036 return IS_ENABLED(CONFIG_NET_VLAN);
1037}
1038#endif
1039
1047#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1048bool net_eth_get_vlan_status(struct net_if *iface);
1049#else
1050static inline bool net_eth_get_vlan_status(struct net_if *iface)
1051{
1052 ARG_UNUSED(iface);
1053
1054 return false;
1055}
1056#endif
1057
1065#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1066bool net_eth_is_vlan_interface(struct net_if *iface);
1067#else
1068static inline bool net_eth_is_vlan_interface(struct net_if *iface)
1069{
1070 ARG_UNUSED(iface);
1071
1072 return false;
1073}
1074#endif
1075
1078#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1079
1080#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1081 init_fn, pm, data, config, prio, \
1082 api, mtu) \
1083 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1084 init_fn, pm, data, config, prio, \
1085 api, ETHERNET_L2, \
1086 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1087
1088#else /* CONFIG_ETH_DRIVER_RAW_MODE */
1089
1090#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1091 init_fn, pm, data, config, prio, \
1092 api, mtu) \
1093 Z_DEVICE_STATE_DEFINE(dev_id); \
1094 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1095 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1096 config, POST_KERNEL, prio, api, \
1097 &Z_DEVICE_STATE_NAME(dev_id));
1098
1099#endif /* CONFIG_ETH_DRIVER_RAW_MODE */
1100
1101#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1102 config, prio, api, mtu) \
1103 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1104 init_fn, pm, data, config, prio, \
1105 api, mtu)
1106
1126#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1127 prio, api, mtu) \
1128 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1129 pm, data, config, prio, api, mtu)
1130
1153#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1154 pm, data, config, prio, api, mtu) \
1155 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1156 instance, init_fn, pm, data, \
1157 config, prio, api, mtu)
1158
1175#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1176 prio, api, mtu) \
1177 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1178 DEVICE_DT_NAME(node_id), init_fn, pm, \
1179 data, config, prio, api, mtu)
1180
1190#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1191 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1192
1200#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1201 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1202
1217
1231#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1237#endif
1238};
1239
1254static inline int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
1255{
1256 if (cfg == NULL || cfg->type == NET_ETH_MAC_DEFAULT) {
1257 return -ENODATA;
1258 }
1259
1260 /* Copy the static part */
1261 memcpy(mac_addr, cfg->addr, cfg->addr_len);
1262
1263 if (cfg->type == NET_ETH_MAC_RANDOM) {
1264 sys_rand_get(&mac_addr[cfg->addr_len], NET_ETH_ADDR_LEN - cfg->addr_len);
1265
1266 /* Clear group bit, multicast (I/G) */
1267 mac_addr[0] &= ~0x01;
1268 /* Set MAC address locally administered, unicast (LAA) */
1269 mac_addr[0] |= 0x02;
1270
1271 return 0;
1272 }
1273
1274#if defined(CONFIG_NVMEM)
1275 if (cfg->type == NET_ETH_MAC_NVMEM) {
1276 return nvmem_cell_read(&cfg->cell, &mac_addr[cfg->addr_len], 0,
1277 NET_ETH_ADDR_LEN - cfg->addr_len);
1278 }
1279#endif
1280
1281 if (cfg->type == NET_ETH_MAC_STATIC) {
1282 return 0;
1283 }
1284
1285 return -ENODATA;
1286}
1287
1290#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1297#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1298 .cell = NVMEM_CELL_GET_BY_NAME_OR(node_id, mac_address, {0}),
1299#else
1300#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id)
1301#endif
1302
1303#define Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id) \
1304 { \
1305 .type = NET_ETH_MAC_RANDOM, \
1306 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1307 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1308 }
1309
1310#define Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id) \
1311 { \
1312 .type = NET_ETH_MAC_NVMEM, \
1313 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1314 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1315 Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1316 }
1317
1318#define Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id) \
1319 { \
1320 .type = NET_ETH_MAC_STATIC, \
1321 .addr = DT_PROP(node_id, local_mac_address), \
1322 .addr_len = DT_PROP_LEN(node_id, local_mac_address), \
1323 }
1324
1325#define Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id) \
1326 { \
1327 .type = NET_ETH_MAC_DEFAULT, \
1328 }
1329
1337#define NET_ETH_MAC_DT_CONFIG_INIT(node_id) \
1338 COND_CASE_1(DT_PROP(node_id, zephyr_random_mac_address), \
1339 (Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id)), \
1340 DT_NVMEM_CELLS_HAS_NAME(node_id, mac_address), \
1341 (Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id)), \
1342 DT_NODE_HAS_PROP(node_id, local_mac_address), \
1343 (Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id)), \
1344 (Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id)))
1345
1353#define NET_ETH_MAC_DT_INST_CONFIG_INIT(inst) \
1354 NET_ETH_MAC_DT_CONFIG_INIT(DT_DRV_INST(inst))
1355
1363void net_eth_carrier_set(struct net_if *iface, bool carrier_up);
1364
1371static inline void net_eth_carrier_on(struct net_if *iface)
1372{
1373 net_eth_carrier_set(iface, true);
1374}
1375
1382static inline void net_eth_carrier_off(struct net_if *iface)
1383{
1384 net_eth_carrier_set(iface, false);
1385}
1386
1396int net_eth_promisc_mode(struct net_if *iface, bool enable);
1397
1407int net_eth_txinjection_mode(struct net_if *iface, bool enable);
1408
1419int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac,
1420 enum ethernet_filter_type type, bool enable);
1421
1429const struct device *net_eth_get_phy(struct net_if *iface);
1430
1439#if defined(CONFIG_PTP_CLOCK)
1440const struct device *net_eth_get_ptp_clock(struct net_if *iface);
1441#else
1442static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
1443{
1444 ARG_UNUSED(iface);
1445
1446 return NULL;
1447}
1448#endif
1449
1459__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
1460
1468static inline bool net_eth_type_is_wifi(struct net_if *iface)
1469{
1470 const struct ethernet_context *ctx = (struct ethernet_context *)
1471 net_if_l2_data(iface);
1472
1473 return ctx->eth_if_type == L2_ETH_IF_TYPE_WIFI;
1474}
1475
1483static inline bool net_eth_type_is_ethernet(struct net_if *iface)
1484{
1485 const struct ethernet_context *ctx = (struct ethernet_context *)net_if_l2_data(iface);
1486
1487 return ctx->eth_if_type == L2_ETH_IF_TYPE_ETHERNET;
1488}
1489
1495static inline void net_eth_set_if_type_wifi(struct net_if *iface)
1496{
1497 struct ethernet_context *ctx = (struct ethernet_context *)net_if_l2_data(iface);
1498
1499 ctx->eth_if_type = L2_ETH_IF_TYPE_WIFI;
1500}
1501
1506#ifdef __cplusplus
1507}
1508#endif
1509
1510#include <zephyr/syscalls/ethernet.h>
1511
1512#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
Header file for the Atomic operations API.
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:1007
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:898
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:396
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:923
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:721
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:763
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:1442
#define NET_ETH_ADDR_LEN
Ethernet MAC address length.
Definition ethernet.h:49
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:966
static void net_eth_carrier_on(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier is detected.
Definition ethernet.h:1371
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:1468
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:700
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:1050
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:742
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1068
ethernet_hw_caps
Ethernet hardware capabilities.
Definition ethernet.h:145
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:1382
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:1254
static void net_eth_set_if_type_wifi(struct net_if *iface)
Set the Ethernet interface type to Wi-Fi.
Definition ethernet.h:1495
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:867
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:943
ethernet_checksum_support
Protocols that are supported by checksum offloading.
Definition ethernet.h:433
ethernet_stats_type
Ethernet statistics type (bitmap)
Definition ethernet.h:478
net_eth_mac_type
MAC address configuration types.
Definition ethernet.h:1204
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:1030
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:987
static bool net_eth_type_is_ethernet(struct net_if *iface)
Check if the Ethernet L2 network interface is cabled ethernet.
Definition ethernet.h:1483
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:775
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:799
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:820
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:787
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:398
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:401
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:153
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:192
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:180
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:189
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:159
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:195
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:156
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:183
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:162
@ ETHERNET_PTP
IEEE 802.1AS (gPTP) clock supported.
Definition ethernet.h:171
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:201
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:207
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:174
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
RX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:150
@ ETHERNET_LLDP
Link Layer Discovery Protocol supported.
Definition ethernet.h:186
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:168
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:204
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:198
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:177
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
TX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:147
@ ETHERNET_LINK_2500BASE
2.5 Gbits link supported
Definition ethernet.h:165
@ ETHERNET_CHECKSUM_SUPPORT_UDP
Device supports UDP checksum offloading for all supported IP protocols.
Definition ethernet.h:447
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:445
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:441
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header)
Definition ethernet.h:439
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:437
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:435
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header)
Definition ethernet.h:443
@ ETHERNET_STATS_TYPE_VENDOR
Vendor statistics only.
Definition ethernet.h:482
@ ETHERNET_STATS_TYPE_ALL
All statistics.
Definition ethernet.h:484
@ ETHERNET_STATS_TYPE_COMMON
Common statistics only (excludes vendor statistics)
Definition ethernet.h:480
@ NET_ETH_MAC_RANDOM
A random MAC address is generated during initialization.
Definition ethernet.h:1208
@ NET_ETH_MAC_NVMEM
The MAC address is read from an NVMEM cell.
Definition ethernet.h:1213
@ NET_ETH_MAC_DEFAULT
MAC address is handled by the driver (backwards compatible case)
Definition ethernet.h:1206
@ NET_ETH_MAC_STATIC
A static MAC address is provided in the device tree.
Definition ethernet.h:1215
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:1065
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1083
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:42
#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
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:488
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:493
int(* start)(const struct device *dev, struct net_if *iface)
Collect optional ethernet specific statistics.
Definition ethernet.h:513
int(* stop)(const struct device *dev, struct net_if *iface)
Stop the device.
Definition ethernet.h:516
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:552
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:522
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:528
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev, struct net_if *iface)
Get the device capabilities.
Definition ethernet.h:519
Ethernet filter description.
Definition ethernet.h:405
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:409
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:411
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:407
Ethernet LLDP specific parameters.
Definition ethernet.h:585
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:593
sys_snode_t node
Used for track timers.
Definition ethernet.h:587
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:602
k_timepoint_t tx_timer_timeout
LLDP TX timer timeout.
Definition ethernet.h:599
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:596
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:590
Ethernet Qav specific parameters.
Definition ethernet.h:247
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:254
unsigned int oper_idle_slope
Oper Idle Slope (bits per second)
Definition ethernet.h:260
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:251
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:262
int queue_id
ID of the priority queue to use.
Definition ethernet.h:249
unsigned int idle_slope
Idle Slope (bits per second)
Definition ethernet.h:258
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth)
Definition ethernet.h:256
Ethernet Qbu specific parameters.
Definition ethernet.h:356
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:369
uint32_t release_advance
Release advance (nanoseconds)
Definition ethernet.h:366
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:360
uint32_t hold_advance
Hold advance (nanoseconds)
Definition ethernet.h:363
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:373
bool link_partner_status
Link partner status (from Qbr)
Definition ethernet.h:376
int port_id
Port id.
Definition ethernet.h:358
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:382
Ethernet Qbv specific parameters.
Definition ethernet.h:289
int port_id
Port id.
Definition ethernet.h:291
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:298
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:293
uint16_t row
Gate control list row.
Definition ethernet.h:312
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:295
struct ethernet_qbv_param::@362::@364 gate_control
Gate control information.
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:303
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:324
uint32_t extension_time
Extension time (nanoseconds)
Definition ethernet.h:330
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:306
uint32_t time_interval
Time interval ticks (nanoseconds)
Definition ethernet.h:309
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:327
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:316
Ethernet TXTIME specific parameters.
Definition ethernet.h:423
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:429
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:427
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:425
Kernel timepoint type.
Definition clock.h:291
A structure used to submit work.
Definition kernel.h:4625
Ethernet address.
Definition ethernet.h:52
uint8_t addr[6U]
Buffer storing the address.
Definition ethernet.h:53
MAC address configuration.
Definition ethernet.h:1219
enum net_eth_mac_type type
The configuration type.
Definition ethernet.h:1221
struct nvmem_cell cell
The NVMEM cell to read the MAC address from.
Definition ethernet.h:1236
uint8_t addr[6U]
The static MAC address part.
Definition ethernet.h:1228
uint8_t addr_len
The length of the statically provided part.
Definition ethernet.h:1230
Network Interface structure.
Definition net_if.h:733
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
Misc utilities.
Virtual Network Interface.