Zephyr API Documentation 4.4.0
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/clock.h>
25#include <zephyr/sys/util.h>
26#include <zephyr/net/net_if.h>
28#include <zephyr/net/ptp_time.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
208
210
211enum dsa_port_type {
212 NON_DSA_PORT,
213 DSA_CONDUIT_PORT,
214 DSA_USER_PORT,
215 DSA_CPU_PORT,
216 DSA_PORT,
217};
218
219enum ethernet_config_type {
220 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
221 ETHERNET_CONFIG_TYPE_QAV_PARAM,
222 ETHERNET_CONFIG_TYPE_QBV_PARAM,
223 ETHERNET_CONFIG_TYPE_QBU_PARAM,
224 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
225 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
226 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
227 ETHERNET_CONFIG_TYPE_FILTER,
228 ETHERNET_CONFIG_TYPE_PORTS_NUM,
229 ETHERNET_CONFIG_TYPE_T1S_PARAM,
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
244enum ethernet_t1s_param_type {
245 ETHERNET_T1S_PARAM_TYPE_PLCA_CONFIG,
246};
247
249
253 enum ethernet_t1s_param_type type;
254 union {
278 struct {
280 bool enable;
292 };
293};
294
300 enum ethernet_qav_param_type type;
301 union {
305 unsigned int delta_bandwidth;
307 unsigned int idle_slope;
309 unsigned int oper_idle_slope;
311 unsigned int traffic_class;
312 };
313};
314
316
317enum ethernet_qbv_param_type {
318 ETHERNET_QBV_PARAM_TYPE_STATUS,
319 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
320 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
321 ETHERNET_QBV_PARAM_TYPE_TIME,
322};
323
324enum ethernet_qbv_state_type {
325 ETHERNET_QBV_STATE_TYPE_ADMIN,
326 ETHERNET_QBV_STATE_TYPE_OPER,
327};
328
329enum ethernet_gate_state_operation {
330 ETHERNET_SET_GATE_STATE,
331 ETHERNET_SET_AND_HOLD_MAC_STATE,
332 ETHERNET_SET_AND_RELEASE_MAC_STATE,
333};
334
336
342 enum ethernet_qbv_param_type type;
344 enum ethernet_qbv_state_type state;
345 union {
348
350 struct {
352 bool gate_status[NET_TC_TX_COUNT];
353
355 enum ethernet_gate_state_operation operation;
356
359
363
366
371 struct {
374
377
380 };
381 };
382};
383
385
386enum ethernet_qbu_param_type {
387 ETHERNET_QBU_PARAM_TYPE_STATUS,
388 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
389 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
390 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
391
392 /* Some preemption settings are from Qbr spec. */
393 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
394 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
395};
396
397enum ethernet_qbu_preempt_status {
398 ETHERNET_QBU_STATUS_EXPRESS,
399 ETHERNET_QBU_STATUS_PREEMPTABLE
400} __packed;
401
403
409 enum ethernet_qbu_param_type type;
410 union {
413
416
418 enum ethernet_qbu_preempt_status
419 frame_preempt_statuses[NET_TC_TX_COUNT];
420
423
426
432 };
433};
434
436
437enum ethernet_filter_type {
438 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
439 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
440};
441
443
452
456 enum ethernet_filter_type type;
460 bool set;
461};
462
464
465enum ethernet_txtime_param_type {
466 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
467};
468
470
474 enum ethernet_txtime_param_type type;
479};
480
484 ETHERNET_CHECKSUM_SUPPORT_NONE = NET_IF_CHECKSUM_NONE_BIT,
486 ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER = NET_IF_CHECKSUM_IPV4_HEADER_BIT,
488 ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP = NET_IF_CHECKSUM_IPV4_ICMP_BIT,
490 ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER = NET_IF_CHECKSUM_IPV6_HEADER_BIT,
492 ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP = NET_IF_CHECKSUM_IPV6_ICMP_BIT,
494 ETHERNET_CHECKSUM_SUPPORT_TCP = NET_IF_CHECKSUM_TCP_BIT,
496 ETHERNET_CHECKSUM_SUPPORT_UDP = NET_IF_CHECKSUM_UDP_BIT,
497};
498
500
501struct ethernet_config {
502 union {
503 bool promisc_mode;
504 bool txinjection_mode;
505
506 struct net_eth_addr mac_address;
507
508 struct ethernet_t1s_param t1s_param;
509 struct ethernet_qav_param qav_param;
510 struct ethernet_qbv_param qbv_param;
511 struct ethernet_qbu_param qbu_param;
512 struct ethernet_txtime_param txtime_param;
513
514 int priority_queues_num;
515 int ports_num;
516
517 enum ethernet_checksum_support chksum_support;
518
519 struct ethernet_filter filter;
520
521 uint16_t extra_tx_pkt_headroom;
522 };
523};
524
526
536
543 struct net_if_api iface_api;
544
549#if defined(CONFIG_NET_STATISTICS_ETHERNET)
550 struct net_stats_eth *(*get_stats)(const struct device *dev, struct net_if *iface);
551
557 struct net_stats_eth *(*get_stats_type)(const struct device *dev,
558 struct net_if *iface,
559 uint32_t type);
560#endif
561
563 int (*start)(const struct device *dev, struct net_if *iface);
564
566 int (*stop)(const struct device *dev, struct net_if *iface);
567
569 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev, struct net_if *iface);
570
572 int (*set_config)(const struct device *dev,
573 struct net_if *iface,
574 enum ethernet_config_type type,
575 const struct ethernet_config *config);
576
578 int (*get_config)(const struct device *dev,
579 struct net_if *iface,
580 enum ethernet_config_type type,
581 struct ethernet_config *config);
582
588#if defined(CONFIG_NET_VLAN)
589 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
590 uint16_t tag, bool enable);
591#endif /* CONFIG_NET_VLAN */
592
594#if defined(CONFIG_PTP_CLOCK)
595 const struct device *(*get_ptp_clock)(const struct device *dev, struct net_if *iface);
596#endif /* CONFIG_PTP_CLOCK */
597
599 const struct device *(*get_phy)(const struct device *dev, struct net_if *iface);
600
602 int (*send)(const struct device *dev, struct net_pkt *pkt);
603};
604
606
607/* Make sure that the network interface API is properly setup inside
608 * Ethernet API struct (it is the first one).
609 */
610BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
611
612struct net_eth_hdr {
613 struct net_eth_addr dst;
614 struct net_eth_addr src;
615 uint16_t type;
616} __packed;
617
618struct ethernet_vlan {
620 struct net_if *iface;
621
623 uint16_t tag;
624};
625
626#if defined(CONFIG_NET_VLAN_COUNT)
627#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
628#else
629#define NET_VLAN_MAX_COUNT 0
630#endif
631
633
654
656
657enum ethernet_flags {
658 ETH_CARRIER_UP,
659};
660
662struct ethernet_context {
667
668#if defined(CONFIG_NET_ETHERNET_BRIDGE)
669 struct net_if *bridge;
670#endif
671
678 struct k_work carrier_work;
679
681 struct net_if *iface;
682
683#if defined(CONFIG_NET_LLDP)
685 struct ethernet_lldp lldp;
686#endif
687
691 enum net_l2_flags ethernet_l2_flags;
692
693#if defined(CONFIG_NET_L2_PTP)
698 int port;
699#endif
700
701#if defined(CONFIG_NET_DSA)
703 enum dsa_port_type dsa_port;
704
706 void *dsa_switch_ctx;
707#endif
708
710 bool is_net_carrier_up : 1;
711
713 bool is_init : 1;
714
716 enum ethernet_if_types eth_if_type;
717};
718
724void ethernet_init(struct net_if *iface);
725
726#define ETHERNET_L2_CTX_TYPE struct ethernet_context
727
728/* Separate header for VLAN as some of device interfaces might not
729 * support VLAN.
730 */
731struct net_eth_vlan_hdr {
732 struct net_eth_addr dst;
733 struct net_eth_addr src;
734 struct {
735 uint16_t tpid; /* tag protocol id */
736 uint16_t tci; /* tag control info */
737 } vlan;
738 uint16_t type;
739} __packed;
740
742
750static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
751{
752 if (addr->addr[0] == 0xff &&
753 addr->addr[1] == 0xff &&
754 addr->addr[2] == 0xff &&
755 addr->addr[3] == 0xff &&
756 addr->addr[4] == 0xff &&
757 addr->addr[5] == 0xff) {
758 return true;
759 }
760
761 return false;
762}
763
771static inline bool net_eth_is_addr_all_zeroes(struct net_eth_addr *addr)
772{
773 if (addr->addr[0] == 0x00 &&
774 addr->addr[1] == 0x00 &&
775 addr->addr[2] == 0x00 &&
776 addr->addr[3] == 0x00 &&
777 addr->addr[4] == 0x00 &&
778 addr->addr[5] == 0x00) {
779 return true;
780 }
781
782 return false;
783}
784
792static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
793{
794 if (addr->addr[0] == 0x00 &&
795 addr->addr[1] == 0x00 &&
796 addr->addr[2] == 0x00 &&
797 addr->addr[3] == 0x00 &&
798 addr->addr[4] == 0x00 &&
799 addr->addr[5] == 0x00) {
800 return true;
801 }
802
803 return false;
804}
805
813static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
814{
815 return addr->addr[0] & 0x01;
816}
817
825static inline bool net_eth_is_addr_unicast(struct net_eth_addr *addr)
826{
828}
829
837static inline bool net_eth_is_addr_valid(struct net_eth_addr *addr)
838{
840}
841
849static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
850{
851 if (addr->addr[0] == 0x01 &&
852 addr->addr[1] == 0x80 &&
853 addr->addr[2] == 0xc2 &&
854 addr->addr[3] == 0x00 &&
855 addr->addr[4] == 0x00 &&
856 addr->addr[5] == 0x0e) {
857 return true;
858 }
859
860 return false;
861}
862
870static inline bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
871{
872 if (addr->addr[0] == 0x01 &&
873 addr->addr[1] == 0x1b &&
874 addr->addr[2] == 0x19 &&
875 addr->addr[3] == 0x00 &&
876 addr->addr[4] == 0x00 &&
877 addr->addr[5] == 0x00) {
878 return true;
879 }
880
881 return false;
882}
883
890
897void net_eth_ipv4_mcast_to_mac_addr(const struct net_in_addr *ipv4_addr,
898 struct net_eth_addr *mac_addr);
899
906void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr,
907 struct net_eth_addr *mac_addr);
908
916static inline
918{
919 const struct device *dev = net_if_get_device(iface);
920 const struct ethernet_api *api = (struct ethernet_api *)dev->api;
921 enum ethernet_hw_caps caps = (enum ethernet_hw_caps)0;
922#if defined(CONFIG_NET_DSA)
923 struct ethernet_context *eth_ctx = net_if_l2_data(iface);
924
925 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
927 } else if (eth_ctx->dsa_port == DSA_USER_PORT) {
929 }
930#endif
931 if (api == NULL || api->get_capabilities == NULL) {
932 return caps;
933 }
934
935 return (enum ethernet_hw_caps)(caps | api->get_capabilities(dev, iface));
936}
937
947static inline
948int net_eth_get_hw_config(struct net_if *iface, enum ethernet_config_type type,
949 struct ethernet_config *config)
950{
951 const struct device *dev = net_if_get_device(iface);
952 const struct ethernet_api *eth = dev->api;
953
954 if (!eth->get_config) {
955 return -ENOTSUP;
956 }
957
958 return eth->get_config(dev, iface, type, config);
959}
960
961
970#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
971int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
972#else
973static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
974{
975 ARG_UNUSED(iface);
976 ARG_UNUSED(tag);
977
978 return -EINVAL;
979}
980#endif
981
990#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
991int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
992#else
993static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
994{
995 ARG_UNUSED(iface);
996 ARG_UNUSED(tag);
997
998 return -EINVAL;
999}
1000#endif
1001
1013#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1014uint16_t net_eth_get_vlan_tag(struct net_if *iface);
1015#else
1016static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
1017{
1018 ARG_UNUSED(iface);
1019
1020 return NET_VLAN_TAG_UNSPEC;
1021}
1022#endif
1023
1033#if defined(CONFIG_NET_VLAN)
1034struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
1035#else
1036static inline
1038{
1039 ARG_UNUSED(iface);
1040 ARG_UNUSED(tag);
1041
1042 return NULL;
1043}
1044#endif
1045
1055#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1056struct net_if *net_eth_get_vlan_main(struct net_if *iface);
1057#else
1058static inline
1060{
1061 ARG_UNUSED(iface);
1062
1063 return NULL;
1064}
1065#endif
1066
1080#if defined(CONFIG_NET_VLAN)
1081bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1082 struct net_if *iface);
1083#else
1084static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
1085 struct net_if *iface)
1086{
1087 ARG_UNUSED(ctx);
1088 ARG_UNUSED(iface);
1089
1090 return false;
1091}
1092#endif
1093
1101#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1102bool net_eth_get_vlan_status(struct net_if *iface);
1103#else
1104static inline bool net_eth_get_vlan_status(struct net_if *iface)
1105{
1106 ARG_UNUSED(iface);
1107
1108 return false;
1109}
1110#endif
1111
1119#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1120bool net_eth_is_vlan_interface(struct net_if *iface);
1121#else
1122static inline bool net_eth_is_vlan_interface(struct net_if *iface)
1123{
1124 ARG_UNUSED(iface);
1125
1126 return false;
1127}
1128#endif
1129
1131
1132#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1133
1134#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1135 init_fn, pm, data, config, prio, \
1136 api, mtu) \
1137 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1138 init_fn, pm, data, config, prio, \
1139 api, ETHERNET_L2, \
1140 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1141
1142#else /* CONFIG_ETH_DRIVER_RAW_MODE */
1143
1144#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1145 init_fn, pm, data, config, prio, \
1146 api, mtu) \
1147 Z_DEVICE_STATE_DEFINE(dev_id); \
1148 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1149 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1150 config, POST_KERNEL, prio, api, \
1151 &Z_DEVICE_STATE_NAME(dev_id));
1152
1153#endif /* CONFIG_ETH_DRIVER_RAW_MODE */
1154
1155#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1156 config, prio, api, mtu) \
1157 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1158 init_fn, pm, data, config, prio, \
1159 api, mtu)
1160
1162
1180#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1181 prio, api, mtu) \
1182 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1183 pm, data, config, prio, api, mtu)
1184
1207#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1208 pm, data, config, prio, api, mtu) \
1209 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1210 instance, init_fn, pm, data, \
1211 config, prio, api, mtu)
1212
1229#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1230 prio, api, mtu) \
1231 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1232 DEVICE_DT_NAME(node_id), init_fn, pm, \
1233 data, config, prio, api, mtu)
1234
1244#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1245 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1246
1254#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1255 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1256
1271
1285#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1291#endif
1292};
1293
1308static inline int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
1309{
1310 if (cfg == NULL || cfg->type == NET_ETH_MAC_DEFAULT) {
1311 return -ENODATA;
1312 }
1313
1314 /* Copy the static part */
1315 memcpy(mac_addr, cfg->addr, cfg->addr_len);
1316
1317 if (cfg->type == NET_ETH_MAC_RANDOM) {
1318 sys_rand_get(&mac_addr[cfg->addr_len], NET_ETH_ADDR_LEN - cfg->addr_len);
1319
1320 /* Clear group bit, multicast (I/G) */
1321 mac_addr[0] &= ~0x01;
1322 /* Set MAC address locally administered, unicast (LAA) */
1323 mac_addr[0] |= 0x02;
1324
1325 return 0;
1326 }
1327
1328#if defined(CONFIG_NVMEM)
1329 if (cfg->type == NET_ETH_MAC_NVMEM) {
1330 return nvmem_cell_read(&cfg->cell, &mac_addr[cfg->addr_len], 0,
1331 NET_ETH_ADDR_LEN - cfg->addr_len);
1332 }
1333#endif
1334
1335 if (cfg->type == NET_ETH_MAC_STATIC) {
1336 return 0;
1337 }
1338
1339 return -ENODATA;
1340}
1341
1343
1344#if defined(CONFIG_NVMEM) || defined(__DOXYGEN__)
1351#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1352 .cell = NVMEM_CELL_GET_BY_NAME_OR(node_id, mac_address, {0}),
1353#else
1354#define Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id)
1355#endif
1356
1357#define Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id) \
1358 { \
1359 .type = NET_ETH_MAC_RANDOM, \
1360 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1361 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1362 }
1363
1364#define Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id) \
1365 { \
1366 .type = NET_ETH_MAC_NVMEM, \
1367 .addr = DT_PROP_OR(node_id, zephyr_mac_address_prefix, {0}), \
1368 .addr_len = DT_PROP_LEN_OR(node_id, zephyr_mac_address_prefix, 0), \
1369 Z_NET_ETH_MAC_DEV_CONFIG_INIT_CELL(node_id) \
1370 }
1371
1372#define Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id) \
1373 { \
1374 .type = NET_ETH_MAC_STATIC, \
1375 .addr = DT_PROP(node_id, local_mac_address), \
1376 .addr_len = DT_PROP_LEN(node_id, local_mac_address), \
1377 }
1378
1379#define Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id) \
1380 { \
1381 .type = NET_ETH_MAC_DEFAULT, \
1382 }
1383
1385
1391#define NET_ETH_MAC_DT_CONFIG_INIT(node_id) \
1392 COND_CASE_1(DT_PROP(node_id, zephyr_random_mac_address), \
1393 (Z_NET_ETH_MAC_DT_CONFIG_INIT_RANDOM(node_id)), \
1394 DT_NVMEM_CELLS_HAS_NAME(node_id, mac_address), \
1395 (Z_NET_ETH_MAC_DT_CONFIG_INIT_NVMEM(node_id)), \
1396 DT_NODE_HAS_PROP(node_id, local_mac_address), \
1397 (Z_NET_ETH_MAC_DT_CONFIG_INIT_STATIC(node_id)), \
1398 (Z_NET_ETH_MAC_DT_CONFIG_INIT_DEFAULT(node_id)))
1399
1407#define NET_ETH_MAC_DT_INST_CONFIG_INIT(inst) \
1408 NET_ETH_MAC_DT_CONFIG_INIT(DT_DRV_INST(inst))
1409
1416void net_eth_carrier_on(struct net_if *iface);
1417
1424void net_eth_carrier_off(struct net_if *iface);
1425
1435int net_eth_promisc_mode(struct net_if *iface, bool enable);
1436
1446int net_eth_txinjection_mode(struct net_if *iface, bool enable);
1447
1458int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac,
1459 enum ethernet_filter_type type, bool enable);
1460
1468const struct device *net_eth_get_phy(struct net_if *iface);
1469
1478#if defined(CONFIG_PTP_CLOCK)
1479const struct device *net_eth_get_ptp_clock(struct net_if *iface);
1480#else
1481static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
1482{
1483 ARG_UNUSED(iface);
1484
1485 return NULL;
1486}
1487#endif
1488
1498__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
1499
1507#if defined(CONFIG_NET_L2_PTP)
1508int net_eth_get_ptp_port(struct net_if *iface);
1509#else
1510static inline int net_eth_get_ptp_port(struct net_if *iface)
1511{
1512 ARG_UNUSED(iface);
1513
1514 return -ENODEV;
1515}
1516#endif /* CONFIG_NET_L2_PTP */
1517
1524#if defined(CONFIG_NET_L2_PTP)
1525void net_eth_set_ptp_port(struct net_if *iface, int port);
1526#else
1527static inline void net_eth_set_ptp_port(struct net_if *iface, int port)
1528{
1529 ARG_UNUSED(iface);
1530 ARG_UNUSED(port);
1531}
1532#endif /* CONFIG_NET_L2_PTP */
1533
1541static inline bool net_eth_type_is_wifi(struct net_if *iface)
1542{
1543 const struct ethernet_context *ctx = (struct ethernet_context *)
1544 net_if_l2_data(iface);
1545
1546 return ctx->eth_if_type == L2_ETH_IF_TYPE_WIFI;
1547}
1548
1552
1553#ifdef __cplusplus
1554}
1555#endif
1556
1557#include <zephyr/syscalls/ethernet.h>
1558
1559#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
long atomic_t
Definition atomic_types.h:15
System clock APIs.
VLAN specific definitions.
static struct net_if * net_eth_get_vlan_main(struct net_if *iface)
Return main network interface that is attached to this VLAN tag.
Definition ethernet.h:1059
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:948
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:445
static void net_eth_set_ptp_port(struct net_if *iface, int port)
Set PTP port number attached to this interface.
Definition ethernet.h:1527
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:973
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:771
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:813
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition ethernet.h:1510
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:1481
#define NET_ETH_ADDR_LEN
Ethernet MAC address length.
Definition ethernet.h:48
int net_eth_promisc_mode(struct net_if *iface, bool enable)
Set promiscuous mode either ON or OFF.
void net_eth_carrier_off(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier was lost.
static uint16_t net_eth_get_vlan_tag(struct net_if *iface)
Return VLAN tag specified to network interface.
Definition ethernet.h:1016
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:1541
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:750
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:1104
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:792
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1122
ethernet_hw_caps
Ethernet hardware capabilities.
Definition ethernet.h:144
int net_eth_mac_filter(struct net_if *iface, struct net_eth_addr *mac, enum ethernet_filter_type type, bool enable)
Set or unset HW filtering for MAC address mac.
void net_eth_ipv6_mcast_to_mac_addr(const struct net_in6_addr *ipv6_addr, struct net_eth_addr *mac_addr)
Convert IPv6 multicast address to Ethernet address.
static int net_eth_mac_load(const struct net_eth_mac_config *cfg, uint8_t *mac_addr)
Load a MAC address from a MAC address configuration structure with the specified type.
Definition ethernet.h:1308
static enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
Return ethernet device hardware capability information.
Definition ethernet.h:917
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:993
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:482
ethernet_stats_type
Ethernet statistics type (bitmap).
Definition ethernet.h:528
net_eth_mac_type
MAC address configuration types.
Definition ethernet.h:1258
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:1084
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:1037
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:825
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:849
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:870
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:837
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:447
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:450
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:152
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:191
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:179
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:188
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:158
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:194
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:155
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:182
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:161
@ ETHERNET_PTP
IEEE 802.1AS (gPTP) clock supported.
Definition ethernet.h:170
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:200
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:206
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:173
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
RX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:149
@ ETHERNET_LLDP
Link Layer Discovery Protocol supported.
Definition ethernet.h:185
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:167
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:203
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:197
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:176
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
TX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:146
@ ETHERNET_LINK_2500BASE
2.5 Gbits link supported
Definition ethernet.h:164
@ ETHERNET_CHECKSUM_SUPPORT_UDP
Device supports UDP checksum offloading for all supported IP protocols.
Definition ethernet.h:496
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:494
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:490
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header).
Definition ethernet.h:488
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:486
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:484
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header).
Definition ethernet.h:492
@ ETHERNET_STATS_TYPE_VENDOR
Vendor statistics only.
Definition ethernet.h:532
@ ETHERNET_STATS_TYPE_ALL
All statistics.
Definition ethernet.h:534
@ ETHERNET_STATS_TYPE_COMMON
Common statistics only (excludes vendor statistics).
Definition ethernet.h:530
@ NET_ETH_MAC_RANDOM
A random MAC address is generated during initialization.
Definition ethernet.h:1262
@ NET_ETH_MAC_NVMEM
The MAC address is read from an NVMEM cell.
Definition ethernet.h:1267
@ NET_ETH_MAC_DEFAULT
MAC address is handled by the driver (backwards compatible case).
Definition ethernet.h:1260
@ NET_ETH_MAC_STATIC
A static MAC address is provided in the device tree.
Definition ethernet.h:1269
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:1039
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1055
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.
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:538
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:543
int(* start)(const struct device *dev, struct net_if *iface)
Collect optional ethernet specific statistics.
Definition ethernet.h:563
int(* stop)(const struct device *dev, struct net_if *iface)
Stop the device.
Definition ethernet.h:566
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:602
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:572
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:578
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev, struct net_if *iface)
Get the device capabilities.
Definition ethernet.h:569
Ethernet filter description.
Definition ethernet.h:454
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:458
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:460
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:456
Ethernet LLDP specific parameters.
Definition ethernet.h:635
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:643
sys_snode_t node
Used for track timers.
Definition ethernet.h:637
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:652
k_timepoint_t tx_timer_timeout
LLDP TX timer timeout.
Definition ethernet.h:649
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:646
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:640
Ethernet Qav specific parameters.
Definition ethernet.h:296
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:303
unsigned int oper_idle_slope
Oper Idle Slope (bits per second).
Definition ethernet.h:309
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:300
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:311
int queue_id
ID of the priority queue to use.
Definition ethernet.h:298
unsigned int idle_slope
Idle Slope (bits per second).
Definition ethernet.h:307
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth).
Definition ethernet.h:305
Ethernet Qbu specific parameters.
Definition ethernet.h:405
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:418
uint32_t release_advance
Release advance (nanoseconds).
Definition ethernet.h:415
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:409
uint32_t hold_advance
Hold advance (nanoseconds).
Definition ethernet.h:412
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:422
bool link_partner_status
Link partner status (from Qbr).
Definition ethernet.h:425
int port_id
Port id.
Definition ethernet.h:407
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:431
Ethernet Qbv specific parameters.
Definition ethernet.h:338
int port_id
Port id.
Definition ethernet.h:340
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:347
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:342
uint16_t row
Gate control list row.
Definition ethernet.h:361
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:344
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:352
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:373
uint32_t extension_time
Extension time (nanoseconds).
Definition ethernet.h:379
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:355
struct ethernet_qbv_param::@121175361150174144233316376176000350036121201324::@102147251204031207263025171335370313217251102106 gate_control
Gate control information.
uint32_t time_interval
Time interval ticks (nanoseconds).
Definition ethernet.h:358
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:376
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:365
Ethernet T1S specific parameters.
Definition ethernet.h:251
uint8_t burst_count
T1S PLCA burst count range: 0x0 to 0xFF.
Definition ethernet.h:286
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:284
uint8_t to_timer
T1S PLCA TO value.
Definition ethernet.h:290
uint8_t burst_timer
T1S PLCA burst timer.
Definition ethernet.h:288
uint8_t node_id
T1S PLCA node id range: 0 to 254.
Definition ethernet.h:282
enum ethernet_t1s_param_type type
Type of T1S parameter.
Definition ethernet.h:253
bool enable
T1S PLCA enabled.
Definition ethernet.h:280
Ethernet TXTIME specific parameters.
Definition ethernet.h:472
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:478
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:476
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:474
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:1273
enum net_eth_mac_type type
The configuration type.
Definition ethernet.h:1275
struct nvmem_cell cell
The NVMEM cell to read the MAC address from.
Definition ethernet.h:1290
uint8_t addr[6U]
The static MAC address part.
Definition ethernet.h:1282
uint8_t addr_len
The length of the statically provided part.
Definition ethernet.h:1284
Network Interface structure.
Definition net_if.h:731
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: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:625
Non-Volatile Memory cell representation.
Definition nvmem.h:37
Misc utilities.