Zephyr API Documentation  2.7.0-rc2
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 <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
69#if !defined(ETH_P_ALL)
70#define ETH_P_ALL NET_ETH_PTYPE_ALL
71#endif
72#if !defined(ETH_P_IP)
73#define ETH_P_IP NET_ETH_PTYPE_IP
74#endif
75#if !defined(ETH_P_ARP)
76#define ETH_P_ARP NET_ETH_PTYPE_ARP
77#endif
78#if !defined(ETH_P_IPV6)
79#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
80#endif
81#if !defined(ETH_P_8021Q)
82#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
83#endif
84#if !defined(ETH_P_TSN)
85#define ETH_P_TSN NET_ETH_PTYPE_TSN
86#endif
87
88#define NET_ETH_MINIMAL_FRAME_SIZE 60
89#define NET_ETH_MTU 1500
90#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + sizeof(struct net_eth_hdr))
91#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
92/*
93 * Extend the max frame size for DSA (KSZ8794) by one byte (to 1519) to
94 * store tail tag.
95 */
96#if defined(CONFIG_NET_DSA)
97#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
98#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
99#else
100#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE)
101#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE)
102#endif
103
104#define NET_ETH_VLAN_HDR_SIZE 4
105
112
115
118
121
124
127
130
133
136
139
142
145
148
151
154
158
161
164
167};
168
171enum ethernet_config_type {
172 ETHERNET_CONFIG_TYPE_AUTO_NEG,
173 ETHERNET_CONFIG_TYPE_LINK,
174 ETHERNET_CONFIG_TYPE_DUPLEX,
175 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
176 ETHERNET_CONFIG_TYPE_QAV_PARAM,
177 ETHERNET_CONFIG_TYPE_QBV_PARAM,
178 ETHERNET_CONFIG_TYPE_QBU_PARAM,
179 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
180 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
181 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
182 ETHERNET_CONFIG_TYPE_FILTER,
183 ETHERNET_CONFIG_TYPE_PORTS_NUM,
184};
185
186enum ethernet_qav_param_type {
187 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
188 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
189 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
190 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
191 ETHERNET_QAV_PARAM_TYPE_STATUS,
192};
193
200 enum ethernet_qav_param_type type;
201 union {
205 unsigned int delta_bandwidth;
207 unsigned int idle_slope;
209 unsigned int oper_idle_slope;
211 unsigned int traffic_class;
212 };
213};
214
217enum ethernet_qbv_param_type {
218 ETHERNET_QBV_PARAM_TYPE_STATUS,
219 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
220 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
221 ETHERNET_QBV_PARAM_TYPE_TIME,
222};
223
224enum ethernet_qbv_state_type {
225 ETHERNET_QBV_STATE_TYPE_ADMIN,
226 ETHERNET_QBV_STATE_TYPE_OPER,
227};
228
229enum ethernet_gate_state_operation {
230 ETHERNET_SET_GATE_STATE,
231 ETHERNET_SET_AND_HOLD_MAC_STATE,
232 ETHERNET_SET_AND_RELEASE_MAC_STATE,
233};
234
241 enum ethernet_qbv_param_type type;
243 enum ethernet_qbv_state_type state;
244 union {
247
248 struct {
250 bool gate_status[NET_TC_TX_COUNT];
251
253 enum ethernet_gate_state_operation operation;
254
257
261
264
265 /* The time values are set in one go when type is set to
266 * ETHERNET_QBV_PARAM_TYPE_TIME
267 */
268 struct {
271
274
277 };
278 };
279};
280
283enum ethernet_qbu_param_type {
284 ETHERNET_QBU_PARAM_TYPE_STATUS,
285 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
286 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
287 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
288
289 /* Some preemption settings are from Qbr spec. */
290 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
291 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
292};
293
294enum ethernet_qbu_preempt_status {
295 ETHERNET_QBU_STATUS_EXPRESS,
296 ETHERNET_QBU_STATUS_PREEMPTABLE
297} __packed;
298
305 enum ethernet_qbu_param_type type;
306 union {
309
312
315 enum ethernet_qbu_preempt_status
316 frame_preempt_statuses[NET_TC_TX_COUNT];
317
320
323
328 };
329};
330
331
334enum ethernet_filter_type {
335 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
336 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
337};
338
343 enum ethernet_filter_type type;
345 struct net_eth_addr mac_address;
347 bool set;
348};
349
352enum ethernet_txtime_param_type {
353 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
354};
355
360 enum ethernet_txtime_param_type type;
365};
366
368struct ethernet_config {
369 union {
370 bool auto_negotiation;
371 bool full_duplex;
372 bool promisc_mode;
373
374 struct {
375 bool link_10bt;
376 bool link_100bt;
377 bool link_1000bt;
378 } l;
379
380 struct net_eth_addr mac_address;
381
382 struct ethernet_qav_param qav_param;
383 struct ethernet_qbv_param qbv_param;
384 struct ethernet_qbu_param qbu_param;
385 struct ethernet_txtime_param txtime_param;
386
387 int priority_queues_num;
388 int ports_num;
389
390 struct ethernet_filter filter;
391 };
392};
400 struct net_if_api iface_api;
401
402#if defined(CONFIG_NET_STATISTICS_ETHERNET)
407 struct net_stats_eth *(*get_stats)(const struct device *dev);
408#endif
409
411 int (*start)(const struct device *dev);
412
414 int (*stop)(const struct device *dev);
415
417 enum ethernet_hw_caps (*get_capabilities)(const struct device *dev);
418
420 int (*set_config)(const struct device *dev,
421 enum ethernet_config_type type,
422 const struct ethernet_config *config);
423
425 int (*get_config)(const struct device *dev,
426 enum ethernet_config_type type,
427 struct ethernet_config *config);
428
429#if defined(CONFIG_NET_VLAN)
435 int (*vlan_setup)(const struct device *dev, struct net_if *iface,
436 uint16_t tag, bool enable);
437#endif /* CONFIG_NET_VLAN */
438
439#if defined(CONFIG_PTP_CLOCK)
441 const struct device *(*get_ptp_clock)(const struct device *dev);
442#endif /* CONFIG_PTP_CLOCK */
443
445 int (*send)(const struct device *dev, struct net_pkt *pkt);
446};
447
448/* Make sure that the network interface API is properly setup inside
449 * Ethernet API struct (it is the first one).
450 */
451BUILD_ASSERT(offsetof(struct ethernet_api, iface_api) == 0);
452
454struct net_eth_hdr {
455 struct net_eth_addr dst;
456 struct net_eth_addr src;
457 uint16_t type;
458} __packed;
459
460struct ethernet_vlan {
462 struct net_if *iface;
463
466};
467
468#if defined(CONFIG_NET_VLAN_COUNT)
469#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
470#else
471/* Even thou there are no VLAN support, the minimum count must be set to 1.
472 */
473#define NET_VLAN_MAX_COUNT 1
474#endif
475
478#if defined(CONFIG_NET_LLDP)
479struct ethernet_lldp {
481 sys_snode_t node;
482
484 const struct net_lldpdu *lldpdu;
485
487 const uint8_t *optional_du;
488
490 size_t optional_len;
491
493 struct net_if *iface;
494
496 int64_t tx_timer_start;
497
499 uint32_t tx_timer_timeout;
500
503};
504#endif /* CONFIG_NET_LLDP */
505
508};
509
516
517#if defined(CONFIG_NET_VLAN)
518 struct ethernet_vlan vlan[NET_VLAN_MAX_COUNT];
519
525 ATOMIC_DEFINE(interfaces, NET_VLAN_MAX_COUNT);
526#endif
527
528#if defined(CONFIG_NET_ETHERNET_BRIDGE)
529 struct eth_bridge_iface_context bridge;
530#endif
531
539
541 struct net_if *iface;
542
543#if defined(CONFIG_NET_LLDP)
544 struct ethernet_lldp lldp[NET_VLAN_MAX_COUNT];
545#endif
546
551
552#if defined(CONFIG_NET_GPTP)
557 int port;
558#endif
559
560#if defined(CONFIG_NET_DSA)
564 dsa_net_recv_cb_t dsa_recv_cb;
565
567 uint8_t dsa_port_idx;
568
570 struct dsa_context *dsa_ctx;
571
573 dsa_send_t dsa_send;
574#endif
575
576#if defined(CONFIG_NET_VLAN)
581 int8_t vlan_enabled;
582#endif
583
586
588 bool is_init : 1;
589};
590
596void ethernet_init(struct net_if *iface);
597
600#define ETHERNET_L2_CTX_TYPE struct ethernet_context
601
602/* Separate header for VLAN as some of device interfaces might not
603 * support VLAN.
604 */
605struct net_eth_vlan_hdr {
606 struct net_eth_addr dst;
607 struct net_eth_addr src;
608 struct {
609 uint16_t tpid; /* tag protocol id */
610 uint16_t tci; /* tag control info */
611 } vlan;
612 uint16_t type;
613} __packed;
614
615
616static inline bool net_eth_is_addr_broadcast(struct net_eth_addr *addr)
617{
618 if (addr->addr[0] == 0xff &&
619 addr->addr[1] == 0xff &&
620 addr->addr[2] == 0xff &&
621 addr->addr[3] == 0xff &&
622 addr->addr[4] == 0xff &&
623 addr->addr[5] == 0xff) {
624 return true;
625 }
626
627 return false;
628}
629
630static inline bool net_eth_is_addr_unspecified(struct net_eth_addr *addr)
631{
632 if (addr->addr[0] == 0x00 &&
633 addr->addr[1] == 0x00 &&
634 addr->addr[2] == 0x00 &&
635 addr->addr[3] == 0x00 &&
636 addr->addr[4] == 0x00 &&
637 addr->addr[5] == 0x00) {
638 return true;
639 }
640
641 return false;
642}
643
644static inline bool net_eth_is_addr_multicast(struct net_eth_addr *addr)
645{
646#if defined(CONFIG_NET_IPV6)
647 if (addr->addr[0] == 0x33 &&
648 addr->addr[1] == 0x33) {
649 return true;
650 }
651#endif
652
653#if defined(CONFIG_NET_IPV4)
654 if (addr->addr[0] == 0x01 &&
655 addr->addr[1] == 0x00 &&
656 addr->addr[2] == 0x5e) {
657 return true;
658 }
659#endif
660
661 return false;
662}
663
664static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
665{
666#if defined(CONFIG_NET_GPTP) || defined(CONFIG_NET_LLDP)
667 if (addr->addr[0] == 0x01 &&
668 addr->addr[1] == 0x80 &&
669 addr->addr[2] == 0xc2 &&
670 addr->addr[3] == 0x00 &&
671 addr->addr[4] == 0x00 &&
672 addr->addr[5] == 0x0e) {
673 return true;
674 }
675#endif
676
677 return false;
678}
679
680const struct net_eth_addr *net_eth_broadcast_addr(void);
681
690void net_eth_ipv6_mcast_to_mac_addr(const struct in6_addr *ipv6_addr,
691 struct net_eth_addr *mac_addr);
692
700static inline
702{
703 const struct ethernet_api *eth =
704 (struct ethernet_api *)net_if_get_device(iface)->api;
705
706 if (!eth->get_capabilities) {
707 return (enum ethernet_hw_caps)0;
708 }
709
710 return eth->get_capabilities(net_if_get_device(iface));
711}
712
721#if defined(CONFIG_NET_VLAN)
722int net_eth_vlan_enable(struct net_if *iface, uint16_t tag);
723#else
724static inline int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
725{
726 return -EINVAL;
727}
728#endif
729
738#if defined(CONFIG_NET_VLAN)
739int net_eth_vlan_disable(struct net_if *iface, uint16_t tag);
740#else
741static inline int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
742{
743 return -EINVAL;
744}
745#endif
746
755#if defined(CONFIG_NET_VLAN)
757#else
758static inline uint16_t net_eth_get_vlan_tag(struct net_if *iface)
759{
760 return NET_VLAN_TAG_UNSPEC;
761}
762#endif
763
774#if defined(CONFIG_NET_VLAN)
775struct net_if *net_eth_get_vlan_iface(struct net_if *iface, uint16_t tag);
776#else
777static inline
779{
780 return NULL;
781}
782#endif
783
792#if defined(CONFIG_NET_VLAN)
794 struct net_if *iface);
795#else
796static inline bool net_eth_is_vlan_enabled(struct ethernet_context *ctx,
797 struct net_if *iface)
798{
799 return false;
800}
801#endif
802
810#if defined(CONFIG_NET_VLAN)
811bool net_eth_get_vlan_status(struct net_if *iface);
812#else
813static inline bool net_eth_get_vlan_status(struct net_if *iface)
814{
815 return false;
816}
817#endif
818
819#if defined(CONFIG_NET_VLAN)
820#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
821 pm_control_fn, data, cfg, prio, api, mtu) \
822 Z_DEVICE_DEFINE(node_id, dev_name, drv_name, init_fn, \
823 pm_control_fn, data, cfg, POST_KERNEL, \
824 prio, api); \
825 NET_L2_DATA_INIT(dev_name, 0, NET_L2_GET_CTX_TYPE(ETHERNET_L2));\
826 NET_IF_INIT(dev_name, 0, ETHERNET_L2, mtu, NET_VLAN_MAX_COUNT)
827
828#else /* CONFIG_NET_VLAN */
829
830#define Z_ETH_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
831 pm_control_fn, data, cfg, prio, api, mtu) \
832 Z_NET_DEVICE_INIT(node_id, dev_name, drv_name, init_fn, \
833 pm_control_fn, data, cfg, prio, api, \
834 ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2),\
835 mtu)
836#endif /* CONFIG_NET_VLAN */
837
857#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, \
858 data, cfg, prio, api, mtu) \
859 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_name, drv_name, \
860 init_fn, pm_control_fn, data, cfg, prio, \
861 api, mtu)
862
881#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, data, \
882 cfg, prio, api, mtu) \
883 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
884 DT_PROP_OR(node_id, label, ""), \
885 init_fn, pm_control_fn, data, cfg, prio, \
886 api, mtu)
887
899#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
900 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
901
908void net_eth_carrier_on(struct net_if *iface);
909
916void net_eth_carrier_off(struct net_if *iface);
917
927int net_eth_promisc_mode(struct net_if *iface, bool enable);
928
937#if defined(CONFIG_PTP_CLOCK)
938const struct device *net_eth_get_ptp_clock(struct net_if *iface);
939#else
940static inline const struct device *net_eth_get_ptp_clock(struct net_if *iface)
941{
942 ARG_UNUSED(iface);
943
944 return NULL;
945}
946#endif
947
957__syscall const struct device *net_eth_get_ptp_clock_by_index(int index);
958
966#if defined(CONFIG_NET_GPTP)
967int net_eth_get_ptp_port(struct net_if *iface);
968#else
969static inline int net_eth_get_ptp_port(struct net_if *iface)
970{
971 ARG_UNUSED(iface);
972
973 return -ENODEV;
974}
975#endif /* CONFIG_NET_GPTP */
976
983#if defined(CONFIG_NET_GPTP)
984void net_eth_set_ptp_port(struct net_if *iface, int port);
985#endif /* CONFIG_NET_GPTP */
986
991#ifdef __cplusplus
992}
993#endif
994
995#include <syscalls/ethernet.h>
996
997#endif /* ZEPHYR_INCLUDE_NET_ETHERNET_H_ */
int atomic_t
Definition: atomic.h:21
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:113
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition: ethernet.h:724
static int net_eth_get_ptp_port(struct net_if *iface)
Return gPTP port number attached to this interface.
Definition: ethernet.h:969
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:940
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:758
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:813
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:109
ethernet_flags
Definition: ethernet.h:506
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:701
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition: ethernet.h:741
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:796
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:778
@ ETHERNET_HW_VLAN
Definition: ethernet.h:117
@ ETHERNET_PRIORITY_QUEUES
Definition: ethernet.h:144
@ ETHERNET_DUPLEX_SET
Definition: ethernet.h:132
@ ETHERNET_HW_VLAN_TAG_STRIP
Definition: ethernet.h:153
@ ETHERNET_LINK_10BASE_T
Definition: ethernet.h:123
@ ETHERNET_HW_FILTERING
Definition: ethernet.h:147
@ ETHERNET_PTP
Definition: ethernet.h:135
@ ETHERNET_QBU
Definition: ethernet.h:163
@ ETHERNET_LINK_100BASE_T
Definition: ethernet.h:126
@ ETHERNET_DSA_MASTER_PORT
Definition: ethernet.h:157
@ ETHERNET_DSA_SLAVE_PORT
Definition: ethernet.h:156
@ ETHERNET_QAV
Definition: ethernet.h:138
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
Definition: ethernet.h:114
@ ETHERNET_LINK_1000BASE_T
Definition: ethernet.h:129
@ ETHERNET_LLDP
Definition: ethernet.h:150
@ ETHERNET_AUTO_NEGOTIATION_SET
Definition: ethernet.h:120
@ ETHERNET_TXTIME
Definition: ethernet.h:166
@ ETHERNET_QBV
Definition: ethernet.h:160
@ ETHERNET_PROMISC_MODE
Definition: ethernet.h:141
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
Definition: ethernet.h:111
@ ETH_CARRIER_UP
Definition: ethernet.h:507
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:367
const void * api
Definition: device.h:373
Definition: ethernet_bridge.h:57
Definition: ethernet.h:395
struct net_if_api iface_api
Definition: ethernet.h:400
int(* start)(const struct device *dev)
Definition: ethernet.h:411
int(* get_config)(const struct device *dev, enum ethernet_config_type type, struct ethernet_config *config)
Definition: ethernet.h:425
int(* stop)(const struct device *dev)
Definition: ethernet.h:414
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev)
Definition: ethernet.h:417
int(* send)(const struct device *dev, struct net_pkt *pkt)
Definition: ethernet.h:445
int(* set_config)(const struct device *dev, enum ethernet_config_type type, const struct ethernet_config *config)
Definition: ethernet.h:420
Definition: ethernet.h:511
struct net_if * iface
Definition: ethernet.h:541
bool is_net_carrier_up
Definition: ethernet.h:585
enum net_l2_flags ethernet_l2_flags
Definition: ethernet.h:550
struct k_work carrier_work
Definition: ethernet.h:538
atomic_t flags
Definition: ethernet.h:515
bool is_init
Definition: ethernet.h:588
Definition: ethernet.h:341
struct net_eth_addr mac_address
Definition: ethernet.h:345
bool set
Definition: ethernet.h:347
enum ethernet_filter_type type
Definition: ethernet.h:343
Definition: ethernet.h:196
bool enabled
Definition: ethernet.h:203
unsigned int oper_idle_slope
Definition: ethernet.h:209
enum ethernet_qav_param_type type
Definition: ethernet.h:200
unsigned int traffic_class
Definition: ethernet.h:211
int queue_id
Definition: ethernet.h:198
unsigned int idle_slope
Definition: ethernet.h:207
unsigned int delta_bandwidth
Definition: ethernet.h:205
Definition: ethernet.h:301
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
Definition: ethernet.h:315
uint32_t release_advance
Definition: ethernet.h:311
enum ethernet_qbu_param_type type
Definition: ethernet.h:305
uint32_t hold_advance
Definition: ethernet.h:308
bool enabled
Definition: ethernet.h:319
bool link_partner_status
Definition: ethernet.h:322
int port_id
Definition: ethernet.h:303
uint8_t additional_fragment_size
Definition: ethernet.h:327
Definition: ethernet.h:237
int port_id
Definition: ethernet.h:239
bool enabled
Definition: ethernet.h:246
enum ethernet_qbv_param_type type
Definition: ethernet.h:241
uint16_t row
Definition: ethernet.h:259
enum ethernet_qbv_state_type state
Definition: ethernet.h:243
bool gate_status[NET_TC_TX_COUNT]
Definition: ethernet.h:250
struct net_ptp_extended_time base_time
Definition: ethernet.h:270
uint32_t extension_time
Definition: ethernet.h:276
enum ethernet_gate_state_operation operation
Definition: ethernet.h:253
uint32_t time_interval
Definition: ethernet.h:256
struct ethernet_qbv_param::@140::@142 gate_control
struct net_ptp_time cycle_time
Definition: ethernet.h:273
uint32_t gate_control_list_len
Definition: ethernet.h:263
Definition: ethernet.h:358
bool enable_txtime
Definition: ethernet.h:364
int queue_id
Definition: ethernet.h:362
enum ethernet_txtime_param_type type
Definition: ethernet.h:360
Definition: net_ip.h:139
A structure used to submit work.
Definition: kernel.h:3623
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.