Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 <kernel.h>
17#include <zephyr/types.h>
18#include <stdbool.h>
19#include <sys/atomic.h>
20
21#include <net/net_ip.h>
22#include <net/net_pkt.h>
23
24#if defined(CONFIG_NET_LLDP)
25#include <net/lldp.h>
26#endif
27
28#include <sys/util.h>
29#include <net/net_if.h>
30#include <net/ethernet_vlan.h>
31#include <net/ptp_time.h>
32
33#if defined(CONFIG_NET_DSA)
34#include <net/dsa.h>
35#endif
36
37#if defined(CONFIG_NET_ETHERNET_BRIDGE)
38#include <net/ethernet_bridge.h>
39#endif
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
54struct net_eth_addr {
55 uint8_t addr[6];
56};
57
58#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
59
60#define NET_ETH_PTYPE_ARP 0x0806
61#define NET_ETH_PTYPE_IP 0x0800
62#define NET_ETH_PTYPE_TSN 0x22f0 /* TSN (IEEE 1722) packet */
63#define NET_ETH_PTYPE_IPV6 0x86dd
64#define NET_ETH_PTYPE_VLAN 0x8100
65#define NET_ETH_PTYPE_PTP 0x88f7
66#define NET_ETH_PTYPE_LLDP 0x88cc
67#define NET_ETH_PTYPE_ALL 0x0003 /* from linux/if_ether.h */
68#define NET_ETH_PTYPE_ECAT 0x88a4
69
70#if !defined(ETH_P_ALL)
71#define ETH_P_ALL NET_ETH_PTYPE_ALL
72#endif
73#if !defined(ETH_P_IP)
74#define ETH_P_IP NET_ETH_PTYPE_IP
75#endif
76#if !defined(ETH_P_ARP)
77#define ETH_P_ARP NET_ETH_PTYPE_ARP
78#endif
79#if !defined(ETH_P_IPV6)
80#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
81#endif
82#if !defined(ETH_P_8021Q)
83#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
84#endif
85#if !defined(ETH_P_TSN)
86#define ETH_P_TSN NET_ETH_PTYPE_TSN
87#endif
88#if !defined(ETH_P_ECAT)
89#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
90#endif
91
92#define NET_ETH_MINIMAL_FRAME_SIZE 60
93#define NET_ETH_MTU 1500
94#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + sizeof(struct net_eth_hdr))
95#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
96/*
97 * Extend the max frame size for DSA (KSZ8794) by one byte (to 1519) to
98 * store tail tag.
99 */
100#if defined(CONFIG_NET_DSA)
101#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
102#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
103#else
104#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE)
105#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE)
106#endif
107
108#define NET_ETH_VLAN_HDR_SIZE 4
109
116
119
122
125
128
131
134
137
140
143
146
149
152
155
158
162
165
168
171};
172
175enum ethernet_config_type {
176 ETHERNET_CONFIG_TYPE_AUTO_NEG,
177 ETHERNET_CONFIG_TYPE_LINK,
178 ETHERNET_CONFIG_TYPE_DUPLEX,
179 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
180 ETHERNET_CONFIG_TYPE_QAV_PARAM,
181 ETHERNET_CONFIG_TYPE_QBV_PARAM,
182 ETHERNET_CONFIG_TYPE_QBU_PARAM,
183 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
184 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
185 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
186 ETHERNET_CONFIG_TYPE_FILTER,
187 ETHERNET_CONFIG_TYPE_PORTS_NUM,
188};
189
190enum ethernet_qav_param_type {
191 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
192 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
193 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
194 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
195 ETHERNET_QAV_PARAM_TYPE_STATUS,
196};
197
204 enum ethernet_qav_param_type type;
205 union {
209 unsigned int delta_bandwidth;
211 unsigned int idle_slope;
213 unsigned int oper_idle_slope;
215 unsigned int traffic_class;
216 };
217};
218
221enum ethernet_qbv_param_type {
222 ETHERNET_QBV_PARAM_TYPE_STATUS,
223 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
224 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
225 ETHERNET_QBV_PARAM_TYPE_TIME,
226};
227
228enum ethernet_qbv_state_type {
229 ETHERNET_QBV_STATE_TYPE_ADMIN,
230 ETHERNET_QBV_STATE_TYPE_OPER,
231};
232
233enum ethernet_gate_state_operation {
234 ETHERNET_SET_GATE_STATE,
235 ETHERNET_SET_AND_HOLD_MAC_STATE,
236 ETHERNET_SET_AND_RELEASE_MAC_STATE,
237};
238
245 enum ethernet_qbv_param_type type;
247 enum ethernet_qbv_state_type state;
248 union {
251
252 struct {
254 bool gate_status[NET_TC_TX_COUNT];
255
257 enum ethernet_gate_state_operation operation;
258
261
265
268
269 /* The time values are set in one go when type is set to
270 * ETHERNET_QBV_PARAM_TYPE_TIME
271 */
272 struct {
275
278
281 };
282 };
283};
284
287enum ethernet_qbu_param_type {
288 ETHERNET_QBU_PARAM_TYPE_STATUS,
289 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
290 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
291 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
292
293 /* Some preemption settings are from Qbr spec. */
294 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
295 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
296};
297
298enum ethernet_qbu_preempt_status {
299 ETHERNET_QBU_STATUS_EXPRESS,
300 ETHERNET_QBU_STATUS_PREEMPTABLE
301} __packed;
302
309 enum ethernet_qbu_param_type type;
310 union {
313
316
319 enum ethernet_qbu_preempt_status
320 frame_preempt_statuses[NET_TC_TX_COUNT];
321
324
327
332 };
333};
334
335
338enum ethernet_filter_type {
339 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
340 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
341};
342
347 enum ethernet_filter_type type;
349 struct net_eth_addr mac_address;
351 bool set;
352};
353
356enum ethernet_txtime_param_type {
357 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
358};
359
364 enum ethernet_txtime_param_type type;
369};
370
372struct ethernet_config {
373 union {
374 bool auto_negotiation;
375 bool full_duplex;
376 bool promisc_mode;
377
378 struct {
379 bool link_10bt;
380 bool link_100bt;
381 bool link_1000bt;
382 } l;
383
384 struct net_eth_addr mac_address;
385
386 struct ethernet_qav_param qav_param;
387 struct ethernet_qbv_param qbv_param;
388 struct ethernet_qbu_param qbu_param;
389 struct ethernet_txtime_param txtime_param;
390
391 int priority_queues_num;
392 int ports_num;
393
394 struct ethernet_filter filter;
395 };
396};
404 struct net_if_api iface_api;
405
406#if defined(CONFIG_NET_STATISTICS_ETHERNET)
411 struct net_stats_eth *(*get_stats)(const struct device *dev);
412#endif
413
415 int (*start)(const struct device *dev);
416
418 int (*stop)(const struct device *dev);
419
421 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev);
422
424 int (*set_config)(const struct device *dev,
425 enum ethernet_config_type type,
426 const struct ethernet_config *config);
427
429 int (*get_config)(const struct device *dev,
430 enum ethernet_config_type type,
431 struct ethernet_config *config);
432
433#if defined(CONFIG_NET_VLAN)
439 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
440 uint16_t tag, bool enable);
441#endif /* CONFIG_NET_VLAN */
442
443#if defined(CONFIG_PTP_CLOCK)
445 const struct device *(*get_ptp_clock)(const struct device *dev);
446#endif /* CONFIG_PTP_CLOCK */
447
449 int (*send)(const struct device *dev, struct net_pkt *pkt);
450};
451
452/* Make sure that the network interface API is properly setup inside
453 * Ethernet API struct (it is the first one).
454 */
455BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
456
458struct net_eth_hdr {
459 struct net_eth_addr dst;
460 struct net_eth_addr src;
461 uint16_t type;
462} __packed;
463
464struct ethernet_vlan {
466 struct net_if *iface;
467
470};
471
472#if defined(CONFIG_NET_VLAN_COUNT)
473#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
474#else
475/* Even thou there are no VLAN support, the minimum count must be set to 1.
476 */
477#define NET_VLAN_MAX_COUNT 1
478#endif
479
482#if defined(CONFIG_NET_LLDP)
483struct ethernet_lldp {
485 sys_snode_t node;
486
488 const struct net_lldpdu *lldpdu;
489
491 const uint8_t *optional_du;
492
494 size_t optional_len;
495
497 struct net_if *iface;
498
500 int64_t tx_timer_start;
501
503 uint32_t tx_timer_timeout;
504
507};
508#endif /* CONFIG_NET_LLDP */
509
512};
513
520
521#if defined(CONFIG_NET_VLAN)
522 struct ethernet_vlan vlan[NET_VLAN_MAX_COUNT];
523
529 ATOMIC_DEFINE(interfaces, NET_VLAN_MAX_COUNT);
530#endif
531
532#if defined(CONFIG_NET_ETHERNET_BRIDGE)
533 struct eth_bridge_iface_context bridge;
534#endif
535
543
545 struct net_if *iface;
546
547#if defined(CONFIG_NET_LLDP)
548 struct ethernet_lldp lldp[NET_VLAN_MAX_COUNT];
549#endif
550
555
556#if defined(CONFIG_NET_L2_PTP)
561 int port;
562#endif
563
564#if defined(CONFIG_NET_DSA)
568 dsa_net_recv_cb_t dsa_recv_cb;
569
571 uint8_t dsa_port_idx;
572
574 struct dsa_context *dsa_ctx;
575
577 dsa_send_t dsa_send;
578#endif
579
580#if defined(CONFIG_NET_VLAN)
585 int8_t vlan_enabled;
586#endif
587
590
592 bool is_init : 1;
593};
594
600void ethernet_init(struct net_if *iface);
601
604#define ETHERNET_L2_CTX_TYPE struct ethernet_context
605
606/* Separate header for VLAN as some of device interfaces might not
607 * support VLAN.
608 */
609struct net_eth_vlan_hdr {
610 struct net_eth_addr dst;
611 struct net_eth_addr src;
612 struct {
613 uint16_t tpid; /* tag protocol id */
614 uint16_t tci; /* tag control info */
615 } vlan;
616 uint16_t type;
617} __packed;
618
619
620static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
621{
622 if (addr->addr[0] == 0xff &&
623 addr->addr[1] == 0xff &&
624 addr->addr[2] == 0xff &&
625 addr->addr[3] == 0xff &&
626 addr->addr[4] == 0xff &&
627 addr->addr[5] == 0xff) {
628 return true;
629 }
630
631 return false;
632}
633
634static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
635{
636 if (addr->addr[0] == 0x00 &&
637 addr->addr[1] == 0x00 &&
638 addr->addr[2] == 0x00 &&
639 addr->addr[3] == 0x00 &&
640 addr->addr[4] == 0x00 &&
641 addr->addr[5] == 0x00) {
642 return true;
643 }
644
645 return false;
646}
647
648static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
649{
650#if defined(CONFIG_NET_IPV6)
651 if (addr->addr[0] == 0x33 &&
652 addr->addr[1] == 0x33) {
653 return true;
654 }
655#endif
656
657#if defined(CONFIG_NET_IPV4)
658 if (addr->addr[0] == 0x01 &&
659 addr->addr[1] == 0x00 &&
660 addr->addr[2] == 0x5e) {
661 return true;
662 }
663#endif
664
665 return false;
666}
667
668static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
669{
670#if defined(CONFIG_NET_GPTP) || defined(CONFIG_NET_LLDP)
671 if (addr->addr[0] == 0x01 &&
672 addr->addr[1] == 0x80 &&
673 addr->addr[2] == 0xc2 &&
674 addr->addr[3] == 0x00 &&
675 addr->addr[4] == 0x00 &&
676 addr->addr[5] == 0x0e) {
677 return true;
678 }
679#endif
680
681 return false;
682}
683
684const struct net_eth_addr *net_eth_broadcast_addr(void);
685
694void net_eth_ipv4_mcast_to_mac_addr(const struct in_addr *ipv4_addr,
695 struct net_eth_addr *mac_addr);
696
703void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
704 struct net_eth_addr *mac_addr);
705
713static inline
715{
716 const struct ethernet_api *eth =
717 (struct ethernet_api *)net_if_get_device(iface)->api;
718
719 if (!eth->get_capabilities) {
720 return (enum ethernet_hw_caps)0;
721 }
722
723 return eth->get_capabilities(net_if_get_device(iface));
724}
725
734#if defined(CONFIG_NET_VLAN)
735int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
736#else
737static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
738{
739 return -EINVAL;
740}
741#endif
742
751#if defined(CONFIG_NET_VLAN)
752int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
753#else
754static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
755{
756 return -EINVAL;
757}
758#endif
759
768#if defined(CONFIG_NET_VLAN)
770#else
771static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
772{
773 return NET_VLAN_TAG_UNSPEC;
774}
775#endif
776
787#if defined(CONFIG_NET_VLAN)
788struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
789#else
790static inline
792{
793 return NULL;
794}
795#endif
796
805#if defined(CONFIG_NET_VLAN)
807 struct net_if *iface);
808#else
809static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
810 struct net_if *iface)
811{
812 return false;
813}
814#endif
815
823#if defined(CONFIG_NET_VLAN)
824bool net_eth_get_vlan_status(struct net_if *iface);
825#else
826static inline bool net_eth_get_vlan_status(struct net_if *iface)
827{
828 return false;
829}
830#endif
831
832#if defined(CONFIG_NET_VLAN)
833#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
834 pm_action_cb, data, cfg, prio, api, mtu) \
835 Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
836 Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
837 pm_action_cb, data, cfg, POST_KERNEL, \
838 prio, api, &Z_DEVICE_STATE_NAME(dev_name)); \
839 NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2));\
840 NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
841
842#else /* CONFIG_NET_VLAN */
843
844#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
845 pm_action_cb, data, cfg, prio, api, mtu) \
846 Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
847 pm_action_cb, data, cfg, prio, api, \
848 ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),\
849 mtu)
850#endif /* CONFIG_NET_VLAN */
851
871#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_action_cb, \
872 data, cfg, prio, api, mtu) \
873 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, \
874 init_fn, pm_action_cb, data, cfg, prio, \
875 api, mtu)
876
895#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_action_cb, data, \
896 cfg, prio, api, mtu) \
897 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
898 DT_PROP_OR(node_id, label, ""), \
899 init_fn, pm_action_cb, data, cfg, prio, \
900 api, mtu)
901
913#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
914 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
915
922void net_eth_carrier_on(struct net_if *iface);
923
930void net_eth_carrier_off(struct net_if *iface);
931
941int net_eth_promisc_mode(struct net_if *iface, bool enable);
942
951#if defined(CONFIG_PTP_CLOCK)
952const struct device *net_eth_get_ptp_clock(struct net_if *iface);
953#else
954static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
955{
956 ARG_UNUSED(iface);
957
958 return NULL;
959}
960#endif
961
971__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
972
980#if defined(CONFIG_NET_L2_PTP)
981int net_eth_get_ptp_port(struct net_if *iface);
982#else
983static inline int net_eth_get_ptp_port(struct net_if *iface)
984{
985 ARG_UNUSED(iface);
986
987 return -ENODEV;
988}
989#endif /* CONFIG_NET_L2_PTP */
990
997#if defined(CONFIG_NET_L2_PTP)
998void net_eth_set_ptp_port(struct net_if *iface, int port);
999#endif /* CONFIG_NET_L2_PTP */
1000
1005#ifdef __cplusplus
1006}
1007#endif
1008
1009#include <syscalls/ethernet.h>
1010
1011#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
long atomic_t
Definition: atomic.h:22
ZTEST_BMEM int index[(3)]
Definition: main.c:32
DSA definitions and handlers.
Ethernet Bridge public header file.
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:68
int(* dsa_send_t)(const struct device *dev, struct net_pkt *pkt)
Pointer to master interface send function.
Definition: dsa.h:94
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition: atomic.h:114
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition: ethernet.h:737
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition: ethernet.h:983
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:954
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. This happens when cable is disconnected.
static uint16_t net_eth_get_vlan_tag(struct net_if *iface)
Return VLAN tag specified to network interface.
Definition: ethernet.h:771
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:826
const struct device * net_eth_get_ptp_clock_by_index(int index)
Return PTP clock that is tied to this ethernet network interface index.
ethernet_hw_caps
Definition: ethernet.h:113
ethernet_flags
Definition: ethernet.h:510
void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr, struct net_eth_addr *mac_addr)
Convert IPv6 multicast address to Ethernet address.
static enum ethernet_hw_caps net_eth_get_hw_capabilities(struct net_if *iface)
Return ethernet device hardware capability information.
Definition: ethernet.h:714
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition: ethernet.h:754
void net_eth_carrier_on(struct net_if *iface)
Inform ethernet L2 driver that ethernet carrier is detected. This happens when cable is connected.
static bool net_eth_is_vlan_enabled(struct ethernet_context *ctx, struct net_if *iface)
Check if VLAN is enabled for a specific network interface.
Definition: ethernet.h:809
void ethernet_init(struct net_if *iface)
Initialize Ethernet L2 stack for a given interface.
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:791
void net_eth_ipv4_mcast_to_mac_addr(const struct in_addr *ipv4_addr, struct net_eth_addr *mac_addr)
Convert IPv4 multicast address to Ethernet address.
@ ETHERNET_HW_VLAN
Definition: ethernet.h:121
@ ETHERNET_PRIORITY_QUEUES
Definition: ethernet.h:148
@ ETHERNET_DUPLEX_SET
Definition: ethernet.h:136
@ ETHERNET_HW_VLAN_TAG_STRIP
Definition: ethernet.h:157
@ ETHERNET_LINK_10BASE_T
Definition: ethernet.h:127
@ ETHERNET_HW_FILTERING
Definition: ethernet.h:151
@ ETHERNET_PTP
Definition: ethernet.h:139
@ ETHERNET_QBU
Definition: ethernet.h:167
@ ETHERNET_LINK_100BASE_T
Definition: ethernet.h:130
@ ETHERNET_DSA_MASTER_PORT
Definition: ethernet.h:161
@ ETHERNET_DSA_SLAVE_PORT
Definition: ethernet.h:160
@ ETHERNET_QAV
Definition: ethernet.h:142
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
Definition: ethernet.h:118
@ ETHERNET_LINK_1000BASE_T
Definition: ethernet.h:133
@ ETHERNET_LLDP
Definition: ethernet.h:154
@ ETHERNET_AUTO_NEGOTIATION_SET
Definition: ethernet.h:124
@ ETHERNET_TXTIME
Definition: ethernet.h:170
@ ETHERNET_QBV
Definition: ethernet.h:164
@ ETHERNET_PROMISC_MODE
Definition: ethernet.h:145
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
Definition: ethernet.h:115
@ ETH_CARRIER_UP
Definition: ethernet.h:511
enum net_verdict(* net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
LLDP Receive packet callback.
Definition: lldp.h:213
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition: net_if.h:606
net_l2_flags
Definition: net_l2.h:33
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define EINVAL
Definition: errno.h:61
#define ENODEV
Definition: errno.h:58
#define NET_VLAN_TAG_UNSPEC
Definition: ethernet_vlan.h:30
LLDP definitions and handler.
Public API for network interface.
IPv6 and IPv4 definitions.
Network packet buffer descriptor API.
Public functions for the Precision Time Protocol time specification.
struct _snode sys_snode_t
Definition: slist.h:33
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT64_TYPE__ int64_t
Definition: stdint.h:45
__INT8_TYPE__ int8_t
Definition: stdint.h:42
Runtime device structure (in ROM) per driver instance.
Definition: device.h:450
const void * api
Definition: device.h:456
Definition: ethernet_bridge.h:57
Definition: ethernet.h:399
struct net_if_api iface_api
Definition: ethernet.h:404
int(* start)(const struct device *dev)
Definition: ethernet.h:415
int(* get_config)(const struct device *dev, enum ethernet_config_type type, struct ethernet_config *config)
Definition: ethernet.h:429
int(* stop)(const struct device *dev)
Definition: ethernet.h:418
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev)
Definition: ethernet.h:421
int(* send)(const struct device *dev, struct net_pkt *pkt)
Definition: ethernet.h:449
int(* set_config)(const struct device *dev, enum ethernet_config_type type, const struct ethernet_config *config)
Definition: ethernet.h:424
Definition: ethernet.h:515
struct net_if * iface
Definition: ethernet.h:545
bool is_net_carrier_up
Definition: ethernet.h:589
enum net_l2_flags ethernet_l2_flags
Definition: ethernet.h:554
struct k_work carrier_work
Definition: ethernet.h:542
atomic_t flags
Definition: ethernet.h:519
bool is_init
Definition: ethernet.h:592
Definition: ethernet.h:345
struct net_eth_addr mac_address
Definition: ethernet.h:349
bool set
Definition: ethernet.h:351
enum ethernet_filter_type type
Definition: ethernet.h:347
Definition: ethernet.h:200
bool enabled
Definition: ethernet.h:207
unsigned int oper_idle_slope
Definition: ethernet.h:213
enum ethernet_qav_param_type type
Definition: ethernet.h:204
unsigned int traffic_class
Definition: ethernet.h:215
int queue_id
Definition: ethernet.h:202
unsigned int idle_slope
Definition: ethernet.h:211
unsigned int delta_bandwidth
Definition: ethernet.h:209
Definition: ethernet.h:305
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
Definition: ethernet.h:319
uint32_t release_advance
Definition: ethernet.h:315
enum ethernet_qbu_param_type type
Definition: ethernet.h:309
uint32_t hold_advance
Definition: ethernet.h:312
bool enabled
Definition: ethernet.h:323
bool link_partner_status
Definition: ethernet.h:326
int port_id
Definition: ethernet.h:307
uint8_t additional_fragment_size
Definition: ethernet.h:331
Definition: ethernet.h:241
int port_id
Definition: ethernet.h:243
bool enabled
Definition: ethernet.h:250
enum ethernet_qbv_param_type type
Definition: ethernet.h:245
uint16_t row
Definition: ethernet.h:263
enum ethernet_qbv_state_type state
Definition: ethernet.h:247
bool gate_status[NET_TC_TX_COUNT]
Definition: ethernet.h:254
struct net_ptp_extended_time base_time
Definition: ethernet.h:274
uint32_t extension_time
Definition: ethernet.h:280
enum ethernet_gate_state_operation operation
Definition: ethernet.h:257
struct ethernet_qbv_param::@150::@152 gate_control
uint32_t time_interval
Definition: ethernet.h:260
struct net_ptp_time cycle_time
Definition: ethernet.h:277
uint32_t gate_control_list_len
Definition: ethernet.h:267
Definition: ethernet.h:362
bool enable_txtime
Definition: ethernet.h:368
int queue_id
Definition: ethernet.h:366
enum ethernet_txtime_param_type type
Definition: ethernet.h:364
Definition: net_ip.h:139
Definition: net_ip.h:151
A structure used to submit work.
Definition: kernel.h:3572
Network Interface structure.
Definition: net_if.h:468
Definition: lldp.h:167
Network packet.
Definition: net_pkt.h:62
Precision Time Protocol Extended Timestamp format.
Definition: ptp_time.h:76
Precision Time Protocol Timestamp format.
Definition: ptp_time.h:39
All Ethernet specific statistics.
Definition: net_stats.h:441
static const char * tag(void)
Definition: main.c:27
Misc utilities.