Zephyr Project API  3.2.0
A Scalable Open Source RTOS
ethernet.h
Go to the documentation of this file.
1
7/*
8 * Copyright (c) 2016 Intel Corporation
9 *
10 * SPDX-License-Identifier: Apache-2.0
11 */
12
13#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_H_
14#define ZEPHYR_INCLUDE_NET_ETHERNET_H_
15
16#include <zephyr/kernel.h>
17#include <zephyr/types.h>
18#include <stdbool.h>
19#include <zephyr/sys/atomic.h>
20
21#include <zephyr/net/net_ip.h>
22#include <zephyr/net/net_pkt.h>
23
24#if defined(CONFIG_NET_LLDP)
25#include <zephyr/net/lldp.h>
26#endif
27
28#include <zephyr/sys/util.h>
29#include <zephyr/net/net_if.h>
31#include <zephyr/net/ptp_time.h>
32
33#if defined(CONFIG_NET_DSA)
34#include <zephyr/net/dsa.h>
35#endif
36
37#if defined(CONFIG_NET_ETHERNET_BRIDGE)
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#define NET_ETH_PTYPE_EAPOL 0x888e
70#define NET_ETH_PTYPE_IEEE802154 0x00F6 /* from linux/if_ether.h: IEEE802.15.4 frame */
71
72#if !defined(ETH_P_ALL)
73#define ETH_P_ALL NET_ETH_PTYPE_ALL
74#endif
75#if !defined(ETH_P_IP)
76#define ETH_P_IP NET_ETH_PTYPE_IP
77#endif
78#if !defined(ETH_P_ARP)
79#define ETH_P_ARP NET_ETH_PTYPE_ARP
80#endif
81#if !defined(ETH_P_IPV6)
82#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
83#endif
84#if !defined(ETH_P_8021Q)
85#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
86#endif
87#if !defined(ETH_P_TSN)
88#define ETH_P_TSN NET_ETH_PTYPE_TSN
89#endif
90#if !defined(ETH_P_ECAT)
91#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
92#endif
93#if !defined(ETH_P_IEEE802154)
94#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
95#endif
96
97#define NET_ETH_MINIMAL_FRAME_SIZE 60
98#define NET_ETH_MTU 1500
99#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + sizeof(struct net_eth_hdr))
100#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
101/*
102 * Extend the max frame size for DSA (KSZ8794) by one byte (to 1519) to
103 * store tail tag.
104 */
105#if defined(CONFIG_NET_DSA)
106#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
107#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
108#else
109#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE)
110#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE)
111#endif
112
113#define NET_ETH_VLAN_HDR_SIZE 4
114
121
124
127
130
133
136
139
142
145
148
151
154
157
160
163
167
170
173
176};
177
180enum ethernet_config_type {
181 ETHERNET_CONFIG_TYPE_AUTO_NEG,
182 ETHERNET_CONFIG_TYPE_LINK,
183 ETHERNET_CONFIG_TYPE_DUPLEX,
184 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
185 ETHERNET_CONFIG_TYPE_QAV_PARAM,
186 ETHERNET_CONFIG_TYPE_QBV_PARAM,
187 ETHERNET_CONFIG_TYPE_QBU_PARAM,
188 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
189 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
190 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
191 ETHERNET_CONFIG_TYPE_FILTER,
192 ETHERNET_CONFIG_TYPE_PORTS_NUM,
193};
194
195enum ethernet_qav_param_type {
196 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
197 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
198 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
199 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
200 ETHERNET_QAV_PARAM_TYPE_STATUS,
201};
202
209 enum ethernet_qav_param_type type;
210 union {
214 unsigned int delta_bandwidth;
216 unsigned int idle_slope;
218 unsigned int oper_idle_slope;
220 unsigned int traffic_class;
221 };
222};
223
226enum ethernet_qbv_param_type {
227 ETHERNET_QBV_PARAM_TYPE_STATUS,
228 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
229 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
230 ETHERNET_QBV_PARAM_TYPE_TIME,
231};
232
233enum ethernet_qbv_state_type {
234 ETHERNET_QBV_STATE_TYPE_ADMIN,
235 ETHERNET_QBV_STATE_TYPE_OPER,
236};
237
238enum ethernet_gate_state_operation {
239 ETHERNET_SET_GATE_STATE,
240 ETHERNET_SET_AND_HOLD_MAC_STATE,
241 ETHERNET_SET_AND_RELEASE_MAC_STATE,
242};
243
250 enum ethernet_qbv_param_type type;
252 enum ethernet_qbv_state_type state;
253 union {
256
257 struct {
259 bool gate_status[NET_TC_TX_COUNT];
260
262 enum ethernet_gate_state_operation operation;
263
266
270
273
274 /* The time values are set in one go when type is set to
275 * ETHERNET_QBV_PARAM_TYPE_TIME
276 */
277 struct {
280
283
286 };
287 };
288};
289
292enum ethernet_qbu_param_type {
293 ETHERNET_QBU_PARAM_TYPE_STATUS,
294 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
295 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
296 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
297
298 /* Some preemption settings are from Qbr spec. */
299 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
300 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
301};
302
303enum ethernet_qbu_preempt_status {
304 ETHERNET_QBU_STATUS_EXPRESS,
305 ETHERNET_QBU_STATUS_PREEMPTABLE
306} __packed;
307
314 enum ethernet_qbu_param_type type;
315 union {
318
321
324 enum ethernet_qbu_preempt_status
325 frame_preempt_statuses[NET_TC_TX_COUNT];
326
329
332
337 };
338};
339
340
343enum ethernet_filter_type {
344 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
345 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
346};
347
352 enum ethernet_filter_type type;
354 struct net_eth_addr mac_address;
356 bool set;
357};
358
361enum ethernet_txtime_param_type {
362 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
363};
364
369 enum ethernet_txtime_param_type type;
374};
375
377struct ethernet_config {
378 union {
379 bool auto_negotiation;
380 bool full_duplex;
381 bool promisc_mode;
382
383 struct {
384 bool link_10bt;
385 bool link_100bt;
386 bool link_1000bt;
387 } l;
388
389 struct net_eth_addr mac_address;
390
391 struct ethernet_qav_param qav_param;
392 struct ethernet_qbv_param qbv_param;
393 struct ethernet_qbu_param qbu_param;
394 struct ethernet_txtime_param txtime_param;
395
396 int priority_queues_num;
397 int ports_num;
398
399 struct ethernet_filter filter;
400 };
401};
409 struct net_if_api iface_api;
410
411#if defined(CONFIG_NET_STATISTICS_ETHERNET)
416 struct net_stats_eth *(*get_stats)(const struct device *dev);
417#endif
418
420 int (*start)(const struct device *dev);
421
423 int (*stop)(const struct device *dev);
424
426 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev);
427
429 int (*set_config)(const struct device *dev,
430 enum ethernet_config_type type,
431 const struct ethernet_config *config);
432
434 int (*get_config)(const struct device *dev,
435 enum ethernet_config_type type,
436 struct ethernet_config *config);
437
438#if defined(CONFIG_NET_VLAN)
444 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
445 uint16_t tag, bool enable);
446#endif /* CONFIG_NET_VLAN */
447
448#if defined(CONFIG_PTP_CLOCK)
450 const struct device *(*get_ptp_clock)(const struct device *dev);
451#endif /* CONFIG_PTP_CLOCK */
452
454 int (*send)(const struct device *dev, struct net_pkt *pkt);
455};
456
457/* Make sure that the network interface API is properly setup inside
458 * Ethernet API struct (it is the first one).
459 */
460BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
461
463struct net_eth_hdr {
464 struct net_eth_addr dst;
465 struct net_eth_addr src;
466 uint16_t type;
467} __packed;
468
469struct ethernet_vlan {
471 struct net_if *iface;
472
475};
476
477#if defined(CONFIG_NET_VLAN_COUNT)
478#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
479#else
480/* Even thou there are no VLAN support, the minimum count must be set to 1.
481 */
482#define NET_VLAN_MAX_COUNT 1
483#endif
484
487#if defined(CONFIG_NET_LLDP)
488struct ethernet_lldp {
490 sys_snode_t node;
491
493 const struct net_lldpdu *lldpdu;
494
496 const uint8_t *optional_du;
497
499 size_t optional_len;
500
502 struct net_if *iface;
503
505 int64_t tx_timer_start;
506
508 uint32_t tx_timer_timeout;
509
512};
513#endif /* CONFIG_NET_LLDP */
514
517};
518
525
526#if defined(CONFIG_NET_VLAN)
527 struct ethernet_vlan vlan[NET_VLAN_MAX_COUNT];
528
534 ATOMIC_DEFINE(interfaces, NET_VLAN_MAX_COUNT);
535#endif
536
537#if defined(CONFIG_NET_ETHERNET_BRIDGE)
538 struct eth_bridge_iface_context bridge;
539#endif
540
548
550 struct net_if *iface;
551
552#if defined(CONFIG_NET_LLDP)
553 struct ethernet_lldp lldp[NET_VLAN_MAX_COUNT];
554#endif
555
560
561#if defined(CONFIG_NET_L2_PTP)
566 int port;
567#endif
568
569#if defined(CONFIG_NET_DSA)
573 dsa_net_recv_cb_t dsa_recv_cb;
574
576 uint8_t dsa_port_idx;
577
579 struct dsa_context *dsa_ctx;
580
582 dsa_send_t dsa_send;
583#endif
584
585#if defined(CONFIG_NET_VLAN)
590 int8_t vlan_enabled;
591#endif
592
595
597 bool is_init : 1;
598};
599
605void ethernet_init(struct net_if *iface);
606
609#define ETHERNET_L2_CTX_TYPE struct ethernet_context
610
611/* Separate header for VLAN as some of device interfaces might not
612 * support VLAN.
613 */
614struct net_eth_vlan_hdr {
615 struct net_eth_addr dst;
616 struct net_eth_addr src;
617 struct {
618 uint16_t tpid; /* tag protocol id */
619 uint16_t tci; /* tag control info */
620 } vlan;
621 uint16_t type;
622} __packed;
623
624
625static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
626{
627 if (addr->addr[0] == 0xff &&
628 addr->addr[1] == 0xff &&
629 addr->addr[2] == 0xff &&
630 addr->addr[3] == 0xff &&
631 addr->addr[4] == 0xff &&
632 addr->addr[5] == 0xff) {
633 return true;
634 }
635
636 return false;
637}
638
639static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
640{
641 if (addr->addr[0] == 0x00 &&
642 addr->addr[1] == 0x00 &&
643 addr->addr[2] == 0x00 &&
644 addr->addr[3] == 0x00 &&
645 addr->addr[4] == 0x00 &&
646 addr->addr[5] == 0x00) {
647 return true;
648 }
649
650 return false;
651}
652
653static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
654{
655#if defined(CONFIG_NET_IPV6)
656 if (addr->addr[0] == 0x33 &&
657 addr->addr[1] == 0x33) {
658 return true;
659 }
660#endif
661
662#if defined(CONFIG_NET_IPV4)
663 if (addr->addr[0] == 0x01 &&
664 addr->addr[1] == 0x00 &&
665 addr->addr[2] == 0x5e) {
666 return true;
667 }
668#endif
669
670 return false;
671}
672
673static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
674{
675#if defined(CONFIG_NET_GPTP) || defined(CONFIG_NET_LLDP)
676 if (addr->addr[0] == 0x01 &&
677 addr->addr[1] == 0x80 &&
678 addr->addr[2] == 0xc2 &&
679 addr->addr[3] == 0x00 &&
680 addr->addr[4] == 0x00 &&
681 addr->addr[5] == 0x0e) {
682 return true;
683 }
684#endif
685
686 return false;
687}
688
689const struct net_eth_addr *net_eth_broadcast_addr(void);
690
699void net_eth_ipv4_mcast_to_mac_addr(const struct in_addr *ipv4_addr,
700 struct net_eth_addr *mac_addr);
701
708void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
709 struct net_eth_addr *mac_addr);
710
718static inline
720{
721 const struct ethernet_api *eth =
722 (struct ethernet_api *)net_if_get_device(iface)->api;
723
724 if (!eth->get_capabilities) {
725 return (enum ethernet_hw_caps)0;
726 }
727
728 return eth->get_capabilities(net_if_get_device(iface));
729}
730
739#if defined(CONFIG_NET_VLAN)
740int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
741#else
742static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
743{
744 return -EINVAL;
745}
746#endif
747
756#if defined(CONFIG_NET_VLAN)
757int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
758#else
759static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
760{
761 return -EINVAL;
762}
763#endif
764
773#if defined(CONFIG_NET_VLAN)
775#else
776static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
777{
778 return NET_VLAN_TAG_UNSPEC;
779}
780#endif
781
792#if defined(CONFIG_NET_VLAN)
793struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
794#else
795static inline
797{
798 return NULL;
799}
800#endif
801
810#if defined(CONFIG_NET_VLAN)
812 struct net_if *iface);
813#else
814static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
815 struct net_if *iface)
816{
817 return false;
818}
819#endif
820
828#if defined(CONFIG_NET_VLAN)
829bool net_eth_get_vlan_status(struct net_if *iface);
830#else
831static inline bool net_eth_get_vlan_status(struct net_if *iface)
832{
833 return false;
834}
835#endif
836
837#if defined(CONFIG_NET_VLAN)
838#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
839 pm_action_cb, data, cfg, prio, api, mtu) \
840 Z_DEVICE_STATE_DEFINE(node_id, dev_name) \
841 Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
842 pm_action_cb, data, cfg, POST_KERNEL, \
843 prio, api, &Z_DEVICE_STATE_NAME(dev_name)); \
844 NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2));\
845 NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
846
847#else /* CONFIG_NET_VLAN */
848
849#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
850 pm_action_cb, data, cfg, prio, api, mtu) \
851 Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
852 pm_action_cb, data, cfg, prio, api, \
853 ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),\
854 mtu)
855#endif /* CONFIG_NET_VLAN */
856
874#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_action_cb, \
875 data, cfg, prio, api, mtu) \
876 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, \
877 init_fn, pm_action_cb, data, cfg, prio, \
878 api, mtu)
879
896#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_action_cb, data, \
897 cfg, prio, api, mtu) \
898 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
899 DEVICE_DT_NAME(node_id), \
900 init_fn, pm_action_cb, data, cfg, prio, \
901 api, mtu)
902
912#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
913 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
914
921void net_eth_carrier_on(struct net_if *iface);
922
929void net_eth_carrier_off(struct net_if *iface);
930
940int net_eth_promisc_mode(struct net_if *iface, bool enable);
941
950#if defined(CONFIG_PTP_CLOCK)
951const struct device *net_eth_get_ptp_clock(struct net_if *iface);
952#else
953static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
954{
955 ARG_UNUSED(iface);
956
957 return NULL;
958}
959#endif
960
970__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
971
979#if defined(CONFIG_NET_L2_PTP)
980int net_eth_get_ptp_port(struct net_if *iface);
981#else
982static inline int net_eth_get_ptp_port(struct net_if *iface)
983{
984 ARG_UNUSED(iface);
985
986 return -ENODEV;
987}
988#endif /* CONFIG_NET_L2_PTP */
989
996#if defined(CONFIG_NET_L2_PTP)
997void net_eth_set_ptp_port(struct net_if *iface, int port);
998#endif /* CONFIG_NET_L2_PTP */
999
1004#ifdef __cplusplus
1005}
1006#endif
1007
1008#include <syscalls/ethernet.h>
1009
1010#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:742
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition: ethernet.h:982
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:953
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:776
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:831
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:118
ethernet_flags
Definition: ethernet.h:515
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:719
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition: ethernet.h:759
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:814
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:796
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:126
@ ETHERNET_PRIORITY_QUEUES
Definition: ethernet.h:153
@ ETHERNET_DUPLEX_SET
Definition: ethernet.h:141
@ ETHERNET_HW_VLAN_TAG_STRIP
Definition: ethernet.h:162
@ ETHERNET_LINK_10BASE_T
Definition: ethernet.h:132
@ ETHERNET_HW_FILTERING
Definition: ethernet.h:156
@ ETHERNET_PTP
Definition: ethernet.h:144
@ ETHERNET_QBU
Definition: ethernet.h:172
@ ETHERNET_LINK_100BASE_T
Definition: ethernet.h:135
@ ETHERNET_DSA_MASTER_PORT
Definition: ethernet.h:166
@ ETHERNET_DSA_SLAVE_PORT
Definition: ethernet.h:165
@ ETHERNET_QAV
Definition: ethernet.h:147
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
Definition: ethernet.h:123
@ ETHERNET_LINK_1000BASE_T
Definition: ethernet.h:138
@ ETHERNET_LLDP
Definition: ethernet.h:159
@ ETHERNET_AUTO_NEGOTIATION_SET
Definition: ethernet.h:129
@ ETHERNET_TXTIME
Definition: ethernet.h:175
@ ETHERNET_QBV
Definition: ethernet.h:169
@ ETHERNET_PROMISC_MODE
Definition: ethernet.h:150
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
Definition: ethernet.h:120
@ ETH_CARRIER_UP
Definition: ethernet.h:516
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:618
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
Public kernel APIs.
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: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
__INT8_TYPE__ int8_t
Definition: stdint.h:72
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435
const void * api
Definition: device.h:441
Definition: ethernet_bridge.h:57
Definition: ethernet.h:404
struct net_if_api iface_api
Definition: ethernet.h:409
int(* start)(const struct device *dev)
Definition: ethernet.h:420
int(* get_config)(const struct device *dev, enum ethernet_config_type type, struct ethernet_config *config)
Definition: ethernet.h:434
int(* stop)(const struct device *dev)
Definition: ethernet.h:423
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev)
Definition: ethernet.h:426
int(* send)(const struct device *dev, struct net_pkt *pkt)
Definition: ethernet.h:454
int(* set_config)(const struct device *dev, enum ethernet_config_type type, const struct ethernet_config *config)
Definition: ethernet.h:429
Definition: ethernet.h:520
struct net_if * iface
Definition: ethernet.h:550
bool is_net_carrier_up
Definition: ethernet.h:594
enum net_l2_flags ethernet_l2_flags
Definition: ethernet.h:559
struct k_work carrier_work
Definition: ethernet.h:547
atomic_t flags
Definition: ethernet.h:524
bool is_init
Definition: ethernet.h:597
Definition: ethernet.h:350
struct net_eth_addr mac_address
Definition: ethernet.h:354
bool set
Definition: ethernet.h:356
enum ethernet_filter_type type
Definition: ethernet.h:352
Definition: ethernet.h:205
bool enabled
Definition: ethernet.h:212
unsigned int oper_idle_slope
Definition: ethernet.h:218
enum ethernet_qav_param_type type
Definition: ethernet.h:209
unsigned int traffic_class
Definition: ethernet.h:220
int queue_id
Definition: ethernet.h:207
unsigned int idle_slope
Definition: ethernet.h:216
unsigned int delta_bandwidth
Definition: ethernet.h:214
Definition: ethernet.h:310
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
Definition: ethernet.h:324
uint32_t release_advance
Definition: ethernet.h:320
enum ethernet_qbu_param_type type
Definition: ethernet.h:314
uint32_t hold_advance
Definition: ethernet.h:317
bool enabled
Definition: ethernet.h:328
bool link_partner_status
Definition: ethernet.h:331
int port_id
Definition: ethernet.h:312
uint8_t additional_fragment_size
Definition: ethernet.h:336
Definition: ethernet.h:246
int port_id
Definition: ethernet.h:248
bool enabled
Definition: ethernet.h:255
enum ethernet_qbv_param_type type
Definition: ethernet.h:250
uint16_t row
Definition: ethernet.h:268
enum ethernet_qbv_state_type state
Definition: ethernet.h:252
struct ethernet_qbv_param::@197::@199 gate_control
bool gate_status[NET_TC_TX_COUNT]
Definition: ethernet.h:259
struct net_ptp_extended_time base_time
Definition: ethernet.h:279
uint32_t extension_time
Definition: ethernet.h:285
enum ethernet_gate_state_operation operation
Definition: ethernet.h:262
uint32_t time_interval
Definition: ethernet.h:265
struct net_ptp_time cycle_time
Definition: ethernet.h:282
uint32_t gate_control_list_len
Definition: ethernet.h:272
Definition: ethernet.h:367
bool enable_txtime
Definition: ethernet.h:373
int queue_id
Definition: ethernet.h:371
enum ethernet_txtime_param_type type
Definition: ethernet.h:369
Definition: net_ip.h:139
Definition: net_ip.h:151
A structure used to submit work.
Definition: kernel.h:3664
Network Interface structure.
Definition: net_if.h:480
Definition: lldp.h:167
Network packet.
Definition: net_pkt.h:59
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.