Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1
6
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/util.h>
25#include <zephyr/net/net_if.h>
27#include <zephyr/net/ptp_time.h>
29
30#if defined(CONFIG_NET_DSA_DEPRECATED)
31#include <zephyr/net/dsa.h>
32#endif
33
34#if defined(CONFIG_NVMEM)
35#include <zephyr/nvmem.h>
36#endif
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
50
51#define NET_ETH_ADDR_LEN 6U
52
57
59
60#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
61
62/* zephyr-keep-sorted-start */
63#define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */
64#define NET_ETH_PTYPE_ARP 0x0806
65#define NET_ETH_PTYPE_CAN 0x000C /* CAN: Controller Area Network */
66#define NET_ETH_PTYPE_CANFD 0x000D /* CANFD: CAN flexible data rate*/
67#define NET_ETH_PTYPE_EAPOL 0x888e
68#define NET_ETH_PTYPE_ECAT 0x88a4
69#define NET_ETH_PTYPE_HDLC 0x0019 /* HDLC frames (like in PPP) */
70#define NET_ETH_PTYPE_IEEE802154 0x00F6 /* from linux/if_ether.h: IEEE802.15.4 frame */
71#define NET_ETH_PTYPE_IP 0x0800
72#define NET_ETH_PTYPE_IPV6 0x86dd
73#define NET_ETH_PTYPE_LLDP 0x88cc
74#define NET_ETH_PTYPE_PTP 0x88f7
75#define NET_ETH_PTYPE_TSN 0x22f0 /* TSN (IEEE 1722) packet */
76#define NET_ETH_PTYPE_VLAN 0x8100
77/* zephyr-keep-sorted-stop */
78
79/* zephyr-keep-sorted-start re(^#define) */
80#if !defined(ETH_P_8021Q)
81#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
82#endif
83#if !defined(ETH_P_ALL)
84#define ETH_P_ALL NET_ETH_PTYPE_ALL
85#endif
86#if !defined(ETH_P_ARP)
87#define ETH_P_ARP NET_ETH_PTYPE_ARP
88#endif
89#if !defined(ETH_P_CAN)
90#define ETH_P_CAN NET_ETH_PTYPE_CAN
91#endif
92#if !defined(ETH_P_CANFD)
93#define ETH_P_CANFD NET_ETH_PTYPE_CANFD
94#endif
95#if !defined(ETH_P_EAPOL)
96#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL
97#endif
98#if !defined(ETH_P_ECAT)
99#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
100#endif
101#if !defined(ETH_P_HDLC)
102#define ETH_P_HDLC NET_ETH_PTYPE_HDLC
103#endif
104#if !defined(ETH_P_IEEE802154)
105#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
106#endif
107#if !defined(ETH_P_IP)
108#define ETH_P_IP NET_ETH_PTYPE_IP
109#endif
110#if !defined(ETH_P_IPV6)
111#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
112#endif
113#if !defined(ETH_P_TSN)
114#define ETH_P_TSN NET_ETH_PTYPE_TSN
115#endif
116/* zephyr-keep-sorted-stop */
117
119
120#define NET_ETH_MINIMAL_FRAME_SIZE 60
121#define NET_ETH_MTU 1500
122
124
125#if defined(CONFIG_NET_VLAN)
126#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_vlan_hdr))
127#else
128#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
129#endif
130
131#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
132
133#if defined(CONFIG_DSA_TAG_SIZE)
134#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
135#else
136#define DSA_TAG_SIZE 0
137#endif
138
139#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
140#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
141
142#define NET_ETH_VLAN_HDR_SIZE 4
143
145
211
213
214#if !defined(CONFIG_NET_DSA_DEPRECATED)
215enum dsa_port_type {
216 NON_DSA_PORT,
217 DSA_CONDUIT_PORT,
218 DSA_USER_PORT,
219 DSA_CPU_PORT,
220 DSA_PORT,
221};
222#endif
223
224enum ethernet_config_type {
225 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
226 ETHERNET_CONFIG_TYPE_QAV_PARAM,
227 ETHERNET_CONFIG_TYPE_QBV_PARAM,
228 ETHERNET_CONFIG_TYPE_QBU_PARAM,
229 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
230 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
231 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
232 ETHERNET_CONFIG_TYPE_FILTER,
233 ETHERNET_CONFIG_TYPE_PORTS_NUM,
234 ETHERNET_CONFIG_TYPE_T1S_PARAM,
235 ETHERNET_CONFIG_TYPE_TXINJECTION_MODE,
236 ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT,
237 ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT,
238 ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM,
239};
240
241enum ethernet_qav_param_type {
242 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
243 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
244 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
245 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
246 ETHERNET_QAV_PARAM_TYPE_STATUS,
247};
248
249enum ethernet_t1s_param_type {
250 ETHERNET_T1S_PARAM_TYPE_PLCA_CONFIG,
251};
252
254
258 enum ethernet_t1s_param_type type;
259 union {
283 struct {
285 bool enable;
297 };
298};
299
305 enum ethernet_qav_param_type type;
306 union {
310 unsigned int delta_bandwidth;
312 unsigned int idle_slope;
314 unsigned int oper_idle_slope;
316 unsigned int traffic_class;
317 };
318};
319
321
322enum ethernet_qbv_param_type {
323 ETHERNET_QBV_PARAM_TYPE_STATUS,
324 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
325 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
326 ETHERNET_QBV_PARAM_TYPE_TIME,
327};
328
329enum ethernet_qbv_state_type {
330 ETHERNET_QBV_STATE_TYPE_ADMIN,
331 ETHERNET_QBV_STATE_TYPE_OPER,
332};
333
334enum ethernet_gate_state_operation {
335 ETHERNET_SET_GATE_STATE,
336 ETHERNET_SET_AND_HOLD_MAC_STATE,
337 ETHERNET_SET_AND_RELEASE_MAC_STATE,
338};
339
341
347 enum ethernet_qbv_param_type type;
349 enum ethernet_qbv_state_type state;
350 union {
353
355 struct {
357 bool gate_status[NET_TC_TX_COUNT];
358
360 enum ethernet_gate_state_operation operation;
361
364
368
371
376 struct {
379
382
385 };
386 };
387};
388
390
391enum ethernet_qbu_param_type {
392 ETHERNET_QBU_PARAM_TYPE_STATUS,
393 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
394 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
395 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
396
397 /* Some preemption settings are from Qbr spec. */
398 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
399 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
400};
401
402enum ethernet_qbu_preempt_status {
403 ETHERNET_QBU_STATUS_EXPRESS,
404 ETHERNET_QBU_STATUS_PREEMPTABLE
405} __packed;
406
408
414 enum ethernet_qbu_param_type type;
415 union {
418
421
423 enum ethernet_qbu_preempt_status
424 frame_preempt_statuses[NET_TC_TX_COUNT];
425
428
431
437 };
438};
439
441
442enum ethernet_filter_type {
443 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
444 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
445};
446
448
457
461 enum ethernet_filter_type type;
465 bool set;
466};
467
469
470enum ethernet_txtime_param_type {
471 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
472};
473
475
479 enum ethernet_txtime_param_type type;
484};
485
489 ETHERNET_CHECKSUM_SUPPORT_NONE = NET_IF_CHECKSUM_NONE_BIT,
491 ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER = NET_IF_CHECKSUM_IPV4_HEADER_BIT,
493 ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP = NET_IF_CHECKSUM_IPV4_ICMP_BIT,
495 ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER = NET_IF_CHECKSUM_IPV6_HEADER_BIT,
497 ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP = NET_IF_CHECKSUM_IPV6_ICMP_BIT,
499 ETHERNET_CHECKSUM_SUPPORT_TCP = NET_IF_CHECKSUM_TCP_BIT,
501 ETHERNET_CHECKSUM_SUPPORT_UDP = NET_IF_CHECKSUM_UDP_BIT,
502};
503
505
506struct ethernet_config {
507 union {
508 bool promisc_mode;
509 bool txinjection_mode;
510
511 struct net_eth_addr mac_address;
512
513 struct ethernet_t1s_param t1s_param;
514 struct ethernet_qav_param qav_param;
515 struct ethernet_qbv_param qbv_param;
516 struct ethernet_qbu_param qbu_param;
517 struct ethernet_txtime_param txtime_param;
518
519 int priority_queues_num;
520 int ports_num;
521
522 enum ethernet_checksum_support chksum_support;
523
524 struct ethernet_filter filter;
525
526 uint16_t extra_tx_pkt_headroom;
527 };
528};
529
531
541
548 struct net_if_api iface_api;
549
554#if defined(CONFIG_NET_STATISTICS_ETHERNET)
555 struct net_stats_eth *(*get_stats)(const struct device *dev);
556
562 struct net_stats_eth *(*get_stats_type)(const struct device *dev,
563 uint32_t type);
564#endif
565
567 int (*start)(const struct device *dev);
568
570 int (*stop)(const struct device *dev);
571
573 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev);
574
576 int (*set_config)(const struct device *dev,
577 enum ethernet_config_type type,
578 const struct ethernet_config *config);
579
581 int (*get_config)(const struct device *dev,
582 enum ethernet_config_type type,
583 struct ethernet_config *config);
584
590#if defined(CONFIG_NET_VLAN)
591 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
592 uint16_t tag, bool enable);
593#endif /* CONFIG_NET_VLAN */
594
596#if defined(CONFIG_PTP_CLOCK)
597 const struct device *(*get_ptp_clock)(const struct device *dev);
598#endif /* CONFIG_PTP_CLOCK */
599
601 const struct device *(*get_phy)(const struct device *dev);
602
604 int (*send)(const struct device *dev, struct net_pkt *pkt);
605};
606
608
609/* Make sure that the network interface API is properly setup inside
610 * Ethernet API struct (it is the first one).
611 */
612BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
613
614struct net_eth_hdr {
615 struct net_eth_addr dst;
616 struct net_eth_addr src;
617 uint16_t type;
618} __packed;
619
620struct ethernet_vlan {
622 struct net_if *iface;
623
625 uint16_t tag;
626};
627
628#if defined(CONFIG_NET_VLAN_COUNT)
629#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
630#else
631#define NET_VLAN_MAX_COUNT 0
632#endif
633
635
662
664
665enum ethernet_flags {
666 ETH_CARRIER_UP,
667};
668
670struct ethernet_context {
675
676#if defined(CONFIG_NET_ETHERNET_BRIDGE)
677 struct net_if *bridge;
678#endif
679
686 struct k_work carrier_work;
687
689 struct net_if *iface;
690
691#if defined(CONFIG_NET_LLDP)
692#if NET_VLAN_MAX_COUNT > 0
693#define NET_LLDP_MAX_COUNT NET_VLAN_MAX_COUNT
694#else
695#define NET_LLDP_MAX_COUNT 1
696#endif /* NET_VLAN_MAX_COUNT > 0 */
697
699 struct ethernet_lldp lldp[NET_LLDP_MAX_COUNT];
700#endif
701
705 enum net_l2_flags ethernet_l2_flags;
706
707#if defined(CONFIG_NET_L2_PTP)
712 int port;
713#endif
714
715#if defined(CONFIG_NET_DSA_DEPRECATED)
719 dsa_net_recv_cb_t dsa_recv_cb;
720
722 uint8_t dsa_port_idx;
723
725 struct dsa_context *dsa_ctx;
726
728 dsa_send_t dsa_send;
729
730#elif defined(CONFIG_NET_DSA)
732 enum dsa_port_type dsa_port;
733
735 void *dsa_switch_ctx;
736#endif
737
739 bool is_net_carrier_up : 1;
740
742 bool is_init : 1;
743
745 enum ethernet_if_types eth_if_type;
746};
747
753void ethernet_init(struct net_if *iface);
754
755#define ETHERNET_L2_CTX_TYPE struct ethernet_context
756
757/* Separate header for VLAN as some of device interfaces might not
758 * support VLAN.
759 */
760struct net_eth_vlan_hdr {
761 struct net_eth_addr dst;
762 struct net_eth_addr src;
763 struct {
764 uint16_t tpid; /* tag protocol id */
765 uint16_t tci; /* tag control info */
766 } vlan;
767 uint16_t type;
768} __packed;
769
771
779static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
780{
781 if (addr->addr[0] == 0xff &&
782 addr->addr[1] == 0xff &&
783 addr->addr[2] == 0xff &&
784 addr->addr[3] == 0xff &&
785 addr->addr[4] == 0xff &&
786 addr->addr[5] == 0xff) {
787 return true;
788 }
789
790 return false;
791}
792
800static inline bool net_eth_is_addr_all_zeroes(struct net_eth_addr *addr)
801{
802 if (addr->addr[0] == 0x00 &&
803 addr->addr[1] == 0x00 &&
804 addr->addr[2] == 0x00 &&
805 addr->addr[3] == 0x00 &&
806 addr->addr[4] == 0x00 &&
807 addr->addr[5] == 0x00) {
808 return true;
809 }
810
811 return false;
812}
813
821static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
822{
823 if (addr->addr[0] == 0x00 &&
824 addr->addr[1] == 0x00 &&
825 addr->addr[2] == 0x00 &&
826 addr->addr[3] == 0x00 &&
827 addr->addr[4] == 0x00 &&
828 addr->addr[5] == 0x00) {
829 return true;
830 }
831
832 return false;
833}
834
842static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
843{
844#if defined(CONFIG_NET_IPV6)
845 if (addr->addr[0] == 0x33 &&
846 addr->addr[1] == 0x33) {
847 return true;
848 }
849#endif
850
851#if defined(CONFIG_NET_IPV4)
852 if (addr->addr[0] == 0x01 &&
853 addr->addr[1] == 0x00 &&
854 addr->addr[2] == 0x5e) {
855 return true;
856 }
857#endif
858
859 return false;
860}
861
869static inline bool net_eth_is_addr_group(struct net_eth_addr *addr)
870{
871 return addr->addr[0] & 0x01;
872}
873
881static inline bool net_eth_is_addr_valid(struct net_eth_addr *addr)
882{
884}
885
893static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
894{
895#if defined(CONFIG_NET_GPTP) || defined(CONFIG_NET_LLDP)
896 if (addr->addr[0] == 0x01 &&
897 addr->addr[1] == 0x80 &&
898 addr->addr[2] == 0xc2 &&
899 addr->addr[3] == 0x00 &&
900 addr->addr[4] == 0x00 &&
901 addr->addr[5] == 0x0e) {
902 return true;
903 }
904#else
905 ARG_UNUSED(addr);
906#endif
907
908 return false;
909}
910
918static inline bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
919{
920#if defined(CONFIG_NET_GPTP)
921 if (addr->addr[0] == 0x01 &&
922 addr->addr[1] == 0x1b &&
923 addr->addr[2] == 0x19 &&
924 addr->addr[3] == 0x00 &&
925 addr->addr[4] == 0x00 &&
926 addr->addr[5] == 0x00) {
927 return true;
928 }
929#else
930 ARG_UNUSED(addr);
931#endif
932
933 return false;
934}
935
942
949void net_eth_ipv4_mcast_to_mac_addr(const struct net_in_addr *ipv4_addr,
950 struct net_eth_addr *mac_addr);
951
958void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr,
959 struct net_eth_addr *mac_addr);
960
968static inline
970{
971 const struct device *dev = net_if_get_device(iface);
972 const struct ethernet_api *api = (struct ethernet_api *)dev->api;
973 enum ethernet_hw_caps caps = (enum ethernet_hw_caps)0;
974#if defined(CONFIG_NET_DSA) && !defined(CONFIG_NET_DSA_DEPRECATED)
975 struct ethernet_context *eth_ctx = net_if_l2_data(iface);
976
977 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
979 } else if (eth_ctx->dsa_port == DSA_USER_PORT) {
981 }
982#endif
983 if (api == NULL || api->get_capabilities == NULL) {
984 return caps;
985 }
986
987 return (enum ethernet_hw_caps)(caps | api->get_capabilities(dev));
988}
989
999static inline
1000int net_eth_get_hw_config(struct net_if *iface, enum ethernet_config_type type,
1001 struct ethernet_config *config)
1002{
1003 const struct ethernet_api *eth =
1004 (struct ethernet_api *)net_if_get_device(iface)->api;
1005
1006 if (!eth->get_config) {
1007 return -ENOTSUP;
1008 }
1009
1010 return eth->get_config(net_if_get_device(iface), type, config);
1011}
1012
1013
1022#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1023int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
1024#else
1025static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
1026{
1027 ARG_UNUSED(iface);
1028 ARG_UNUSED(tag);
1029
1030 return -EINVAL;
1031}
1032#endif
1033
1042#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1043int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
1044#else
1045static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
1046{
1047 ARG_UNUSED(iface);
1048 ARG_UNUSED(tag);
1049
1050 return -EINVAL;
1051}
1052#endif
1053
1065#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1066uint16_t net_eth_get_vlan_tag(struct net_if *iface);
1067#else
1068static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
1069{
1070 ARG_UNUSED(iface);
1071
1072 return NET_VLAN_TAG_UNSPEC;
1073}
1074#endif
1075
1085#if defined(CONFIG_NET_VLAN)
1086struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
1087#else
1088static inline
1090{
1091 ARG_UNUSED(iface);
1092 ARG_UNUSED(tag);
1093
1094 return NULL;
1095}
1096#endif
1097
1107#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1108struct net_if *net_eth_get_vlan_main(struct net_if *iface);
1109#else
1110static inline
1112{
1113 ARG_UNUSED(iface);
1114
1115 return NULL;
1116}
1117#endif
1118
1132#if defined(CONFIG_NET_VLAN)
1133bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1134 struct net_if *iface);
1135#else
1136static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1137 struct net_if *iface)
1138{
1139 ARG_UNUSED(ctx);
1140 ARG_UNUSED(iface);
1141
1142 return false;
1143}
1144#endif
1145
1153#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1154bool net_eth_get_vlan_status(struct net_if *iface);
1155#else
1156static inline bool net_eth_get_vlan_status(struct net_if *iface)
1157{
1158 ARG_UNUSED(iface);
1159
1160 return false;
1161}
1162#endif
1163
1171#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1172bool net_eth_is_vlan_interface(struct net_if *iface);
1173#else
1174static inline bool net_eth_is_vlan_interface(struct net_if *iface)
1175{
1176 ARG_UNUSED(iface);
1177
1178 return false;
1179}
1180#endif
1181
1183
1184#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1185
1186#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1187 init_fn, pm, data, config, prio, \
1188 api, mtu) \
1189 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1190 init_fn, pm, data, config, prio, \
1191 api, ETHERNET_L2, \
1192 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1193
1194#else /* CONFIG_ETH_DRIVER_RAW_MODE */
1195
1196#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1197 init_fn, pm, data, config, prio, \
1198 api, mtu) \
1199 Z_DEVICE_STATE_DEFINE(dev_id); \
1200 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1201 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1202 config, POST_KERNEL, prio, api, \
1203 &Z_DEVICE_STATE_NAME(dev_id));
1204
1205#endif /* CONFIG_ETH_DRIVER_RAW_MODE */
1206
1207#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1208 config, prio, api, mtu) \
1209 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1210 init_fn, pm, data, config, prio, \
1211 api, mtu)
1212
1214
1232#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1233 prio, api, mtu) \
1234 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1235 pm, data, config, prio, api, mtu)
1236
1259#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1260 pm, data, config, prio, api, mtu) \
1261 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1262 instance, init_fn, pm, data, \
1263 config, prio, api, mtu)
1264
1281#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1282 prio, api, mtu) \
1283 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1284 DEVICE_DT_NAME(node_id), init_fn, pm, \
1285 data, config, prio, api, mtu)
1286
1296#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1297 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1298
1306#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1307 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1308
1323
1337#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1343#endif
1344};
1345
1360static inline int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
1361{
1362 if (cfg == NULL || cfg->type == NET_ETH_MAC_DEFAULT) {
1363 return -ENODATA;
1364 }
1365
1366 /* Copy the static part */
1367 memcpy(mac_addr, cfg->addr, cfg->addr_len);
1368
1369 if (cfg->type == NET_ETH_MAC_RANDOM) {
1370 sys_rand_get(&mac_addr[cfg->addr_len], NET_ETH_ADDR_LEN - cfg->addr_len);
1371
1372 /* Clear group bit, multicast (I/G) */
1373 mac_addr[0] &= ~0x01;
1374 /* Set MAC address locally administered, unicast (LAA) */
1375 mac_addr[0] |= 0x02;
1376
1377 return 0;
1378 }
1379
1380#if defined(CONFIG_NVMEM)
1381 if (cfg->type == NET_ETH_MAC_NVMEM) {
1382 return nvmem_cell_read(&cfg->cell, &mac_addr[cfg->addr_len], 0,
1383 NET_ETH_ADDR_LEN - cfg->addr_len);
1384 }
1385#endif
1386
1387 if (cfg->type == NET_ETH_MAC_STATIC) {
1388 return 0;
1389 }
1390
1391 return -ENODATA;
1392}
1393
1395
1396#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1403#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1404 .cell = NVMEM_CELL_GET_BY_NAME_OR(node_id, mac_address, {0}),
1405#else
1406#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id)
1407#endif
1408
1409#define Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id) \
1410 { \
1411 .type = NET_ETH_MAC_RANDOM, \
1412 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1413 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1414 }
1415
1416#define Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id) \
1417 { \
1418 .type = NET_ETH_MAC_NVMEM, \
1419 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1420 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1421 Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1422 }
1423
1424#define Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id) \
1425 { \
1426 .type = NET_ETH_MAC_STATIC, \
1427 .addr = DT_PROP(node_id, local_mac_address), \
1428 .addr_len = DT_PROP_LEN(node_id, local_mac_address), \
1429 }
1430
1431#define Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id) \
1432 { \
1433 .type = NET_ETH_MAC_DEFAULT, \
1434 }
1435
1437
1443#define NET_ETH_MAC_DT_CONFIG_INIT(node_id) \
1444 COND_CASE_1(DT_PROP(node_id, zephyr_random_mac_address), \
1445 (Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id)), \
1446 DT_NVMEM_CELLS_HAS_NAME(node_id, mac_address), \
1447 (Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id)), \
1448 DT_NODE_HAS_PROP(node_id, local_mac_address), \
1449 (Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id)), \
1450 (Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id)))
1451
1459#define NET_ETH_MAC_DT_INST_CONFIG_INIT(inst) \
1460 NET_ETH_MAC_DT_CONFIG_INIT(DT_DRV_INST(inst))
1461
1468void net_eth_carrier_on(struct net_if *iface);
1469
1476void net_eth_carrier_off(struct net_if *iface);
1477
1487int net_eth_promisc_mode(struct net_if *iface, bool enable);
1488
1498int net_eth_txinjection_mode(struct net_if *iface, bool enable);
1499
1510int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac,
1511 enum ethernet_filter_type type, bool enable);
1512
1520const struct device *net_eth_get_phy(struct net_if *iface);
1521
1530#if defined(CONFIG_PTP_CLOCK)
1531const struct device *net_eth_get_ptp_clock(struct net_if *iface);
1532#else
1533static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
1534{
1535 ARG_UNUSED(iface);
1536
1537 return NULL;
1538}
1539#endif
1540
1550__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
1551
1559#if defined(CONFIG_NET_L2_PTP)
1560int net_eth_get_ptp_port(struct net_if *iface);
1561#else
1562static inline int net_eth_get_ptp_port(struct net_if *iface)
1563{
1564 ARG_UNUSED(iface);
1565
1566 return -ENODEV;
1567}
1568#endif /* CONFIG_NET_L2_PTP */
1569
1576#if defined(CONFIG_NET_L2_PTP)
1577void net_eth_set_ptp_port(struct net_if *iface, int port);
1578#else
1579static inline void net_eth_set_ptp_port(struct net_if *iface, int port)
1580{
1581 ARG_UNUSED(iface);
1582 ARG_UNUSED(port);
1583}
1584#endif /* CONFIG_NET_L2_PTP */
1585
1593static inline bool net_eth_type_is_wifi(struct net_if *iface)
1594{
1595 const struct ethernet_context *ctx = (struct ethernet_context *)
1596 net_if_l2_data(iface);
1597
1598 return ctx->eth_if_type == L2_ETH_IF_TYPE_WIFI;
1599}
1600
1604
1605#ifdef __cplusplus
1606}
1607#endif
1608
1609#include <zephyr/syscalls/ethernet.h>
1610
1611#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
long atomic_t
Definition atomic_types.h:15
DSA definitions and handlers.
VLAN specific definitions.
enum net_verdict(* dsa_net_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
DSA (MGMT) Receive packet callback.
Definition dsa.h:70
int(* dsa_send_t)(const struct device *dev, struct net_pkt *pkt)
Pointer to master interface send function.
Definition dsa.h:96
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:1111
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:1000
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:450
static void net_eth_set_ptp_port(struct net_if *iface, int port)
Set PTP port number attached to this interface.
Definition ethernet.h:1579
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:1025
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:800
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:842
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition ethernet.h:1562
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:1533
#define NET_ETH_ADDR_LEN
Ethernet MAC address length.
Definition ethernet.h:51
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:1068
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:1593
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:779
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:1156
static bool net_eth_is_addr_group(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a group address.
Definition ethernet.h:869
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:821
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1174
ethernet_hw_caps
Ethernet hardware capabilities.
Definition ethernet.h:147
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:1360
static enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
Return ethernet device hardware capability information.
Definition ethernet.h:969
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:1045
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:487
ethernet_stats_type
Ethernet statistics type (bitmap).
Definition ethernet.h:533
net_eth_mac_type
MAC address configuration types.
Definition ethernet.h:1310
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:1136
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:1089
const struct net_eth_addr * net_eth_broadcast_addr(void)
Return Ethernet broadcast address.
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:893
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:918
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:881
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:452
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:455
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:155
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:194
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:182
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:191
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:161
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:197
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:158
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:185
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:164
@ ETHERNET_PTP
IEEE 802.1AS (gPTP) clock supported.
Definition ethernet.h:173
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:203
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:209
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:176
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
RX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:152
@ ETHERNET_LLDP
Link Layer Discovery Protocol supported.
Definition ethernet.h:188
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:170
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:206
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:200
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:179
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
TX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:149
@ ETHERNET_LINK_2500BASE
2.5 Gbits link supported
Definition ethernet.h:167
@ ETHERNET_CHECKSUM_SUPPORT_UDP
Device supports UDP checksum offloading for all supported IP protocols.
Definition ethernet.h:501
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:499
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:495
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header).
Definition ethernet.h:493
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:491
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:489
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header).
Definition ethernet.h:497
@ ETHERNET_STATS_TYPE_VENDOR
Vendor statistics only.
Definition ethernet.h:537
@ ETHERNET_STATS_TYPE_ALL
All statistics.
Definition ethernet.h:539
@ ETHERNET_STATS_TYPE_COMMON
Common statistics only (excludes vendor statistics).
Definition ethernet.h:535
@ NET_ETH_MAC_RANDOM
A random MAC address is generated during initialization.
Definition ethernet.h:1314
@ NET_ETH_MAC_NVMEM
The MAC address is read from an NVMEM cell.
Definition ethernet.h:1319
@ NET_ETH_MAC_DEFAULT
MAC address is handled by the driver (backwards compatible case).
Definition ethernet.h:1312
@ NET_ETH_MAC_STATIC
A static MAC address is provided in the device tree.
Definition ethernet.h:1321
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:1034
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1050
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
#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.
Main header file for NVMEM API.
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
__INT64_TYPE__ int64_t
Definition stdint.h:75
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:543
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:548
int(* start)(const struct device *dev)
Collect optional ethernet specific statistics.
Definition ethernet.h:567
int(* get_config)(const struct device *dev, enum ethernet_config_type type, struct ethernet_config *config)
Get hardware specific configuration.
Definition ethernet.h:581
int(* stop)(const struct device *dev)
Stop the device.
Definition ethernet.h:570
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev)
Get the device capabilities.
Definition ethernet.h:573
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:604
int(* set_config)(const struct device *dev, enum ethernet_config_type type, const struct ethernet_config *config)
Set specific hardware configuration.
Definition ethernet.h:576
Ethernet filter description.
Definition ethernet.h:459
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:463
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:465
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:461
Ethernet LLDP specific parameters.
Definition ethernet.h:637
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:645
sys_snode_t node
Used for track timers.
Definition ethernet.h:639
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:660
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:648
struct net_if * iface
Network interface that has LLDP supported.
Definition ethernet.h:651
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:642
uint32_t tx_timer_timeout
LLDP TX timeout.
Definition ethernet.h:657
int64_t tx_timer_start
LLDP TX timer start time.
Definition ethernet.h:654
Ethernet Qav specific parameters.
Definition ethernet.h:301
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:308
unsigned int oper_idle_slope
Oper Idle Slope (bits per second).
Definition ethernet.h:314
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:305
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:316
int queue_id
ID of the priority queue to use.
Definition ethernet.h:303
unsigned int idle_slope
Idle Slope (bits per second).
Definition ethernet.h:312
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth).
Definition ethernet.h:310
Ethernet Qbu specific parameters.
Definition ethernet.h:410
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:423
uint32_t release_advance
Release advance (nanoseconds).
Definition ethernet.h:420
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:414
uint32_t hold_advance
Hold advance (nanoseconds).
Definition ethernet.h:417
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:427
bool link_partner_status
Link partner status (from Qbr).
Definition ethernet.h:430
int port_id
Port id.
Definition ethernet.h:412
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:436
Ethernet Qbv specific parameters.
Definition ethernet.h:343
int port_id
Port id.
Definition ethernet.h:345
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:352
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:347
uint16_t row
Gate control list row.
Definition ethernet.h:366
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:349
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:357
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:378
uint32_t extension_time
Extension time (nanoseconds).
Definition ethernet.h:384
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:360
struct ethernet_qbv_param::@121175361150174144233316376176000350036121201324::@102147251204031207263025171335370313217251102106 gate_control
Gate control information.
uint32_t time_interval
Time interval ticks (nanoseconds).
Definition ethernet.h:363
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:381
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:370
Ethernet T1S specific parameters.
Definition ethernet.h:256
uint8_t burst_count
T1S PLCA burst count range: 0x0 to 0xFF.
Definition ethernet.h:291
struct ethernet_t1s_param::@045104211027030365347006377040354240151366265336::@055246010323023270273151373302031315361103011354 plca
PLCA is the Physical Layer (PHY) Collision Avoidance technique employed with multidrop 10Base-T1S sta...
uint8_t node_count
T1S PLCA node count range: 1 to 255.
Definition ethernet.h:289
uint8_t to_timer
T1S PLCA TO value.
Definition ethernet.h:295
uint8_t burst_timer
T1S PLCA burst timer.
Definition ethernet.h:293
uint8_t node_id
T1S PLCA node id range: 0 to 254.
Definition ethernet.h:287
enum ethernet_t1s_param_type type
Type of T1S parameter.
Definition ethernet.h:258
bool enable
T1S PLCA enabled.
Definition ethernet.h:285
Ethernet TXTIME specific parameters.
Definition ethernet.h:477
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:483
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:481
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:479
Ethernet address.
Definition ethernet.h:54
uint8_t addr[6U]
Buffer storing the address.
Definition ethernet.h:55
MAC address configuration.
Definition ethernet.h:1325
enum net_eth_mac_type type
The configuration type.
Definition ethernet.h:1327
struct nvmem_cell cell
The NVMEM cell to read the MAC address from.
Definition ethernet.h:1342
uint8_t addr[6U]
The static MAC address part.
Definition ethernet.h:1334
uint8_t addr_len
The length of the statically provided part.
Definition ethernet.h:1336
Network Interface structure.
Definition net_if.h:726
IPv6 address struct.
Definition net_ip.h:143
IPv4 address struct.
Definition net_ip.h:155
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:91
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:625
Non-Volatile Memory cell representation.
Definition nvmem.h:36
Misc utilities.