13#ifndef ZEPHYR_INCLUDE_NET_ETHERNET_H_
14#define ZEPHYR_INCLUDE_NET_ETHERNET_H_
29#if defined(CONFIG_NET_DSA_DEPRECATED)
33#if defined(CONFIG_NET_ETHERNET_BRIDGE)
50#define NET_ETH_ADDR_LEN 6U
59#define NET_ETH_HDR(pkt) ((struct net_eth_hdr *)net_pkt_data(pkt))
63#define NET_ETH_PTYPE_ALL 0x0003
64#define NET_ETH_PTYPE_ARP 0x0806
65#define NET_ETH_PTYPE_CAN 0x000C
66#define NET_ETH_PTYPE_CANFD 0x000D
67#define NET_ETH_PTYPE_EAPOL 0x888e
68#define NET_ETH_PTYPE_ECAT 0x88a4
69#define NET_ETH_PTYPE_HDLC 0x0019
70#define NET_ETH_PTYPE_IEEE802154 0x00F6
71#define NET_ETH_PTYPE_IP 0x0800
72#define NET_ETH_PTYPE_IPV6 0x86dd
73#define NET_ETH_PTYPE_LLDP 0x88cc
74#define NET_ETH_PTYPE_OAM 0x8902
75#define NET_ETH_PTYPE_PTP 0x88f7
76#define NET_ETH_PTYPE_TSN 0x22f0
77#define NET_ETH_PTYPE_VLAN 0x8100
82#if !defined(ETH_P_8021Q)
83#define ETH_P_8021Q NET_ETH_PTYPE_VLAN
85#if !defined(ETH_P_ALL)
86#define ETH_P_ALL NET_ETH_PTYPE_ALL
88#if !defined(ETH_P_ARP)
89#define ETH_P_ARP NET_ETH_PTYPE_ARP
91#if !defined(ETH_P_CAN)
92#define ETH_P_CAN NET_ETH_PTYPE_CAN
94#if !defined(ETH_P_CANFD)
95#define ETH_P_CANFD NET_ETH_PTYPE_CANFD
97#if !defined(ETH_P_EAPOL)
98#define ETH_P_EAPOL NET_ETH_PTYPE_EAPOL
100#if !defined(ETH_P_ECAT)
101#define ETH_P_ECAT NET_ETH_PTYPE_ECAT
103#if !defined(ETH_P_HDLC)
104#define ETH_P_HDLC NET_ETH_PTYPE_HDLC
106#if !defined(ETH_P_IEEE802154)
107#define ETH_P_IEEE802154 NET_ETH_PTYPE_IEEE802154
109#if !defined(ETH_P_IP)
110#define ETH_P_IP NET_ETH_PTYPE_IP
112#if !defined(ETH_P_IPV6)
113#define ETH_P_IPV6 NET_ETH_PTYPE_IPV6
115#if !defined(ETH_P_TSN)
116#define ETH_P_TSN NET_ETH_PTYPE_TSN
122#define NET_ETH_MINIMAL_FRAME_SIZE 60
123#define NET_ETH_MTU 1500
127#if defined(CONFIG_NET_VLAN)
128#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_vlan_hdr))
130#define _NET_ETH_MAX_HDR_SIZE (sizeof(struct net_eth_hdr))
133#define _NET_ETH_MAX_FRAME_SIZE (NET_ETH_MTU + _NET_ETH_MAX_HDR_SIZE)
135#if defined(CONFIG_DSA_TAG_SIZE)
136#define DSA_TAG_SIZE CONFIG_DSA_TAG_SIZE
138#define DSA_TAG_SIZE 0
141#define NET_ETH_MAX_FRAME_SIZE (_NET_ETH_MAX_FRAME_SIZE + DSA_TAG_SIZE)
142#define NET_ETH_MAX_HDR_SIZE (_NET_ETH_MAX_HDR_SIZE + DSA_TAG_SIZE)
144#define NET_ETH_VLAN_HDR_SIZE 4
216#if !defined(CONFIG_NET_DSA_DEPRECATED)
226enum ethernet_config_type {
227 ETHERNET_CONFIG_TYPE_MAC_ADDRESS,
228 ETHERNET_CONFIG_TYPE_QAV_PARAM,
229 ETHERNET_CONFIG_TYPE_QBV_PARAM,
230 ETHERNET_CONFIG_TYPE_QBU_PARAM,
231 ETHERNET_CONFIG_TYPE_TXTIME_PARAM,
232 ETHERNET_CONFIG_TYPE_PROMISC_MODE,
233 ETHERNET_CONFIG_TYPE_PRIORITY_QUEUES_NUM,
234 ETHERNET_CONFIG_TYPE_FILTER,
235 ETHERNET_CONFIG_TYPE_PORTS_NUM,
236 ETHERNET_CONFIG_TYPE_T1S_PARAM,
237 ETHERNET_CONFIG_TYPE_TXINJECTION_MODE,
238 ETHERNET_CONFIG_TYPE_RX_CHECKSUM_SUPPORT,
239 ETHERNET_CONFIG_TYPE_TX_CHECKSUM_SUPPORT,
240 ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM,
243enum ethernet_qav_param_type {
244 ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH,
245 ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE,
246 ETHERNET_QAV_PARAM_TYPE_OPER_IDLE_SLOPE,
247 ETHERNET_QAV_PARAM_TYPE_TRAFFIC_CLASS,
248 ETHERNET_QAV_PARAM_TYPE_STATUS,
251enum ethernet_t1s_param_type {
252 ETHERNET_T1S_PARAM_TYPE_PLCA_CONFIG,
260 enum ethernet_t1s_param_type
type;
307 enum ethernet_qav_param_type
type;
324enum ethernet_qbv_param_type {
325 ETHERNET_QBV_PARAM_TYPE_STATUS,
326 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST,
327 ETHERNET_QBV_PARAM_TYPE_GATE_CONTROL_LIST_LEN,
328 ETHERNET_QBV_PARAM_TYPE_TIME,
331enum ethernet_qbv_state_type {
332 ETHERNET_QBV_STATE_TYPE_ADMIN,
333 ETHERNET_QBV_STATE_TYPE_OPER,
336enum ethernet_gate_state_operation {
337 ETHERNET_SET_GATE_STATE,
338 ETHERNET_SET_AND_HOLD_MAC_STATE,
339 ETHERNET_SET_AND_RELEASE_MAC_STATE,
349 enum ethernet_qbv_param_type
type;
393enum ethernet_qbu_param_type {
394 ETHERNET_QBU_PARAM_TYPE_STATUS,
395 ETHERNET_QBU_PARAM_TYPE_RELEASE_ADVANCE,
396 ETHERNET_QBU_PARAM_TYPE_HOLD_ADVANCE,
397 ETHERNET_QBU_PARAM_TYPE_PREEMPTION_STATUS_TABLE,
400 ETHERNET_QBR_PARAM_TYPE_LINK_PARTNER_STATUS,
401 ETHERNET_QBR_PARAM_TYPE_ADDITIONAL_FRAGMENT_SIZE,
404enum ethernet_qbu_preempt_status {
405 ETHERNET_QBU_STATUS_EXPRESS,
406 ETHERNET_QBU_STATUS_PREEMPTABLE
416 enum ethernet_qbu_param_type
type;
425 enum ethernet_qbu_preempt_status
444enum ethernet_filter_type {
445 ETHERNET_FILTER_TYPE_SRC_MAC_ADDRESS,
446 ETHERNET_FILTER_TYPE_DST_MAC_ADDRESS,
463 enum ethernet_filter_type
type;
472enum ethernet_txtime_param_type {
473 ETHERNET_TXTIME_PARAM_TYPE_ENABLE_QUEUES,
481 enum ethernet_txtime_param_type
type;
508struct ethernet_config {
511 bool txinjection_mode;
513 struct net_eth_addr mac_address;
515 struct ethernet_t1s_param t1s_param;
516 struct ethernet_qav_param qav_param;
517 struct ethernet_qbv_param qbv_param;
518 struct ethernet_qbu_param qbu_param;
519 struct ethernet_txtime_param txtime_param;
521 int priority_queues_num;
526 struct ethernet_filter filter;
546#if defined(CONFIG_NET_STATISTICS_ETHERNET)
561 enum ethernet_config_type type,
562 const struct ethernet_config *config);
566 enum ethernet_config_type type,
567 struct ethernet_config *config);
574#if defined(CONFIG_NET_VLAN)
575 int (*vlan_setup)(
const struct device *dev,
struct net_if *iface,
580#if defined(CONFIG_PTP_CLOCK)
581 const struct device *(*get_ptp_clock)(
const struct device *dev);
585 const struct device *(*get_phy)(
const struct device *dev);
604struct ethernet_vlan {
606 struct net_if *iface;
612#if defined(CONFIG_NET_VLAN_COUNT)
613#define NET_VLAN_MAX_COUNT CONFIG_NET_VLAN_COUNT
615#define NET_VLAN_MAX_COUNT 0
654struct ethernet_context {
660#if defined(CONFIG_NET_ETHERNET_BRIDGE)
661 struct net_if *bridge;
670 struct k_work carrier_work;
673 struct net_if *iface;
675#if defined(CONFIG_NET_LLDP)
676#if NET_VLAN_MAX_COUNT > 0
677#define NET_LLDP_MAX_COUNT NET_VLAN_MAX_COUNT
679#define NET_LLDP_MAX_COUNT 1
683 struct ethernet_lldp lldp[NET_LLDP_MAX_COUNT];
691#if defined(CONFIG_NET_L2_PTP)
699#if defined(CONFIG_NET_DSA_DEPRECATED)
709 struct dsa_context *dsa_ctx;
714#elif defined(CONFIG_NET_DSA)
716 enum dsa_port_type dsa_port;
719 void *dsa_switch_ctx;
723 bool is_net_carrier_up : 1;
737void ethernet_init(
struct net_if *iface);
739#define ETHERNET_L2_CTX_TYPE struct ethernet_context
744struct net_eth_vlan_hdr {
745 struct net_eth_addr dst;
746 struct net_eth_addr src;
765 if (addr->
addr[0] == 0xff &&
766 addr->
addr[1] == 0xff &&
767 addr->
addr[2] == 0xff &&
768 addr->
addr[3] == 0xff &&
769 addr->
addr[4] == 0xff &&
770 addr->
addr[5] == 0xff) {
786 if (addr->
addr[0] == 0x00 &&
787 addr->
addr[1] == 0x00 &&
788 addr->
addr[2] == 0x00 &&
789 addr->
addr[3] == 0x00 &&
790 addr->
addr[4] == 0x00 &&
791 addr->
addr[5] == 0x00) {
807 if (addr->
addr[0] == 0x00 &&
808 addr->
addr[1] == 0x00 &&
809 addr->
addr[2] == 0x00 &&
810 addr->
addr[3] == 0x00 &&
811 addr->
addr[4] == 0x00 &&
812 addr->
addr[5] == 0x00) {
828#if defined(CONFIG_NET_IPV6)
829 if (addr->
addr[0] == 0x33 &&
830 addr->
addr[1] == 0x33) {
835#if defined(CONFIG_NET_IPV4)
836 if (addr->
addr[0] == 0x01 &&
837 addr->
addr[1] == 0x00 &&
838 addr->
addr[2] == 0x5e) {
855 return addr->
addr[0] & 0x01;
879#if defined(CONFIG_NET_GPTP) || defined(CONFIG_NET_LLDP)
880 if (addr->
addr[0] == 0x01 &&
881 addr->
addr[1] == 0x80 &&
882 addr->
addr[2] == 0xc2 &&
883 addr->
addr[3] == 0x00 &&
884 addr->
addr[4] == 0x00 &&
885 addr->
addr[5] == 0x0e) {
904#if defined(CONFIG_NET_GPTP)
905 if (addr->
addr[0] == 0x01 &&
906 addr->
addr[1] == 0x1b &&
907 addr->
addr[2] == 0x19 &&
908 addr->
addr[3] == 0x00 &&
909 addr->
addr[4] == 0x00 &&
910 addr->
addr[5] == 0x00) {
958#if defined(CONFIG_NET_DSA) && !defined(CONFIG_NET_DSA_DEPRECATED)
961 if (eth_ctx->dsa_port == DSA_CONDUIT_PORT) {
963 }
else if (eth_ctx->dsa_port == DSA_USER_PORT) {
985 struct ethernet_config *config)
1006#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1026#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1049#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1069#if defined(CONFIG_NET_VLAN)
1091#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1116#if defined(CONFIG_NET_VLAN)
1137#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1155#if defined(CONFIG_NET_VLAN) && NET_VLAN_MAX_COUNT > 0
1168#if !defined(CONFIG_ETH_DRIVER_RAW_MODE)
1170#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1171 init_fn, pm, data, config, prio, \
1173 Z_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1174 init_fn, pm, data, config, prio, \
1176 NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu)
1180#define Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, instance, \
1181 init_fn, pm, data, config, prio, \
1183 Z_DEVICE_STATE_DEFINE(dev_id); \
1184 Z_DEVICE_DEFINE(node_id, dev_id, name, init_fn, NULL, \
1185 Z_DEVICE_DT_FLAGS(node_id), pm, data, \
1186 config, POST_KERNEL, prio, api, \
1187 &Z_DEVICE_STATE_NAME(dev_id));
1191#define Z_ETH_NET_DEVICE_INIT(node_id, dev_id, name, init_fn, pm, data, \
1192 config, prio, api, mtu) \
1193 Z_ETH_NET_DEVICE_INIT_INSTANCE(node_id, dev_id, name, 0, \
1194 init_fn, pm, data, config, prio, \
1216#define ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, \
1218 Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
1219 pm, data, config, prio, api, mtu)
1243#define ETH_NET_DEVICE_INIT_INSTANCE(dev_id, name, instance, init_fn, \
1244 pm, data, config, prio, api, mtu) \
1245 Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
1246 instance, init_fn, pm, data, \
1247 config, prio, api, mtu)
1265#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
1267 Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
1268 DEVICE_DT_NAME(node_id), init_fn, pm, \
1269 data, config, prio, api, mtu)
1280#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \
1281 ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
1290#define ETH_NET_L3_REGISTER(name, ptype, handler) \
1291 NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
1342 enum ethernet_filter_type type,
bool enable);
1361#if defined(CONFIG_PTP_CLOCK)
1390#if defined(CONFIG_NET_L2_PTP)
1407#if defined(CONFIG_NET_L2_PTP)
1426 const struct ethernet_context *ctx = (
struct ethernet_context *)
1440#include <zephyr/syscalls/ethernet.h>
long atomic_t
Definition atomic_types.h:15
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:70
int(* dsa_send_t)(const struct device *dev, struct net_pkt *pkt)
Pointer to master interface send function.
Definition dsa.h:96
static struct net_if * net_eth_get_vlan_main(struct net_if *iface)
Return main network interface that is attached to this VLAN tag.
Definition ethernet.h:1095
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:984
ethernet_if_types
Types of Ethernet L2.
Definition ethernet.h:452
static void net_eth_set_ptp_port(struct net_if *iface, int port)
Set PTP port number attached to this interface.
Definition ethernet.h:1410
static int net_eth_vlan_enable(struct net_if *iface, uint16_t tag)
Add VLAN tag to the interface.
Definition ethernet.h:1009
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:784
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:826
static int net_eth_get_ptp_port(struct net_if *iface)
Return PTP port number attached to this interface.
Definition ethernet.h:1393
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:1364
#define NET_ETH_ADDR_LEN
Ethernet MAC address length.
Definition ethernet.h:50
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:1052
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:1424
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:763
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:1140
static bool net_eth_is_addr_group(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a group address.
Definition ethernet.h:853
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:805
static bool net_eth_is_vlan_interface(struct net_if *iface)
Check if the given interface is a VLAN interface.
Definition ethernet.h:1158
ethernet_hw_caps
Ethernet hardware capabilities.
Definition ethernet.h:149
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 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:953
static int net_eth_vlan_disable(struct net_if *iface, uint16_t tag)
Remove VLAN tag from the interface.
Definition ethernet.h:1029
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:489
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:1120
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:1073
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.
const struct net_eth_addr * net_eth_broadcast_addr(void)
Return Ethernet broadcast address.
static bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
Check if the Ethernet MAC address is a LLDP multicast address.
Definition ethernet.h:877
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:902
static bool net_eth_is_addr_valid(struct net_eth_addr *addr)
Check if the Ethernet MAC address is valid.
Definition ethernet.h:865
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:454
@ L2_ETH_IF_TYPE_WIFI
IEEE 802.11 Wi-Fi.
Definition ethernet.h:457
@ ETHERNET_HW_VLAN
VLAN supported.
Definition ethernet.h:157
@ ETHERNET_DSA_USER_PORT
DSA switch user port.
Definition ethernet.h:196
@ ETHERNET_PRIORITY_QUEUES
Priority queues available.
Definition ethernet.h:184
@ ETHERNET_HW_VLAN_TAG_STRIP
VLAN Tag stripping.
Definition ethernet.h:193
@ ETHERNET_LINK_100BASE
100 Mbits link supported
Definition ethernet.h:163
@ ETHERNET_DSA_CONDUIT_PORT
DSA switch conduit port.
Definition ethernet.h:199
@ ETHERNET_LINK_10BASE
10 Mbits link supported
Definition ethernet.h:160
@ ETHERNET_HW_FILTERING
MAC address filtering supported.
Definition ethernet.h:187
@ ETHERNET_LINK_1000BASE
1 Gbits link supported
Definition ethernet.h:166
@ ETHERNET_PTP
IEEE 802.1AS (gPTP) clock supported.
Definition ethernet.h:175
@ ETHERNET_QBU
IEEE 802.1Qbu (frame preemption) supported.
Definition ethernet.h:205
@ ETHERNET_TXINJECTION_MODE
TX-Injection supported.
Definition ethernet.h:211
@ ETHERNET_QAV
IEEE 802.1Qav (credit-based shaping) supported.
Definition ethernet.h:178
@ ETHERNET_HW_RX_CHKSUM_OFFLOAD
RX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:154
@ ETHERNET_LLDP
Link Layer Discovery Protocol supported.
Definition ethernet.h:190
@ ETHERNET_LINK_5000BASE
5 Gbits link supported
Definition ethernet.h:172
@ ETHERNET_TXTIME
TXTIME supported.
Definition ethernet.h:208
@ ETHERNET_QBV
IEEE 802.1Qbv (scheduled traffic) supported.
Definition ethernet.h:202
@ ETHERNET_PROMISC_MODE
Promiscuous mode supported.
Definition ethernet.h:181
@ ETHERNET_HW_TX_CHKSUM_OFFLOAD
TX Checksum offloading supported for all of IPv4, UDP, TCP.
Definition ethernet.h:151
@ ETHERNET_LINK_2500BASE
2.5 Gbits link supported
Definition ethernet.h:169
@ ETHERNET_CHECKSUM_SUPPORT_UDP
Device supports UDP checksum offloading for all supported IP protocols.
Definition ethernet.h:503
@ ETHERNET_CHECKSUM_SUPPORT_TCP
Device supports TCP checksum offloading for all supported IP protocols.
Definition ethernet.h:501
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER
Device supports checksum offloading for the IPv6 header.
Definition ethernet.h:497
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP
Device supports checksum offloading for ICMPv4 payload (implies IPv4 header)
Definition ethernet.h:495
@ ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER
Device supports checksum offloading for the IPv4 header.
Definition ethernet.h:493
@ ETHERNET_CHECKSUM_SUPPORT_NONE
Device does not support any L3/L4 checksum offloading.
Definition ethernet.h:491
@ ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP
Device supports checksum offloading for ICMPv6 payload (implies IPv6 header)
Definition ethernet.h:499
enum net_verdict(* net_lldp_recv_cb_t)(struct net_if *iface, struct net_pkt *pkt)
LLDP Receive packet callback.
Definition lldp.h:218
static void * net_if_l2_data(struct net_if *iface)
Get a pointer to the interface L2 private data.
Definition net_if.h:1034
static const struct device * net_if_get_device(struct net_if *iface)
Get an network interface's device.
Definition net_if.h:1050
net_l2_flags
L2 flags.
Definition net_l2.h:37
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 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
LLDP definitions and handler.
Public API for network interface.
IPv6 and IPv4 definitions.
Network packet buffer descriptor API.
flags
Definition parser.h:97
Public functions for the Precision Time Protocol time specification.
__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
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:516
Ethernet L2 API operations.
Definition ethernet.h:535
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:540
int(* start)(const struct device *dev)
Collect optional ethernet specific statistics.
Definition ethernet.h:551
int(* get_config)(const struct device *dev, enum ethernet_config_type type, struct ethernet_config *config)
Get hardware specific configuration.
Definition ethernet.h:565
int(* stop)(const struct device *dev)
Stop the device.
Definition ethernet.h:554
enum ethernet_hw_caps(* get_capabilities)(const struct device *dev)
Get the device capabilities.
Definition ethernet.h:557
int(* send)(const struct device *dev, struct net_pkt *pkt)
Send a network packet.
Definition ethernet.h:588
int(* set_config)(const struct device *dev, enum ethernet_config_type type, const struct ethernet_config *config)
Set specific hardware configuration.
Definition ethernet.h:560
Ethernet filter description.
Definition ethernet.h:461
struct net_eth_addr mac_address
MAC address to filter.
Definition ethernet.h:465
bool set
Set (true) or unset (false) the filter.
Definition ethernet.h:467
enum ethernet_filter_type type
Type of filter.
Definition ethernet.h:463
Ethernet LLDP specific parameters.
Definition ethernet.h:621
const uint8_t * optional_du
LLDP Data Unit optional TLVs for the interface.
Definition ethernet.h:629
sys_snode_t node
Used for track timers.
Definition ethernet.h:623
net_lldp_recv_cb_t cb
LLDP RX callback function.
Definition ethernet.h:644
size_t optional_len
Length of the optional Data Unit TLVs.
Definition ethernet.h:632
struct net_if * iface
Network interface that has LLDP supported.
Definition ethernet.h:635
const struct net_lldpdu * lldpdu
LLDP Data Unit mandatory TLVs for the interface.
Definition ethernet.h:626
uint32_t tx_timer_timeout
LLDP TX timeout.
Definition ethernet.h:641
int64_t tx_timer_start
LLDP TX timer start time.
Definition ethernet.h:638
Ethernet Qav specific parameters.
Definition ethernet.h:303
bool enabled
True if Qav is enabled for queue.
Definition ethernet.h:310
unsigned int oper_idle_slope
Oper Idle Slope (bits per second)
Definition ethernet.h:316
enum ethernet_qav_param_type type
Type of Qav parameter.
Definition ethernet.h:307
unsigned int traffic_class
Traffic class the queue is bound to.
Definition ethernet.h:318
int queue_id
ID of the priority queue to use.
Definition ethernet.h:305
unsigned int idle_slope
Idle Slope (bits per second)
Definition ethernet.h:314
unsigned int delta_bandwidth
Delta Bandwidth (percentage of bandwidth)
Definition ethernet.h:312
Ethernet Qbu specific parameters.
Definition ethernet.h:412
enum ethernet_qbu_preempt_status frame_preempt_statuses[NET_TC_TX_COUNT]
sequence of framePreemptionAdminStatus values
Definition ethernet.h:425
uint32_t release_advance
Release advance (nanoseconds)
Definition ethernet.h:422
enum ethernet_qbu_param_type type
Type of Qbu parameter.
Definition ethernet.h:416
uint32_t hold_advance
Hold advance (nanoseconds)
Definition ethernet.h:419
bool enabled
True if Qbu is enabled or not.
Definition ethernet.h:429
bool link_partner_status
Link partner status (from Qbr)
Definition ethernet.h:432
int port_id
Port id.
Definition ethernet.h:414
uint8_t additional_fragment_size
Additional fragment size (from Qbr).
Definition ethernet.h:438
Ethernet Qbv specific parameters.
Definition ethernet.h:345
int port_id
Port id.
Definition ethernet.h:347
bool enabled
True if Qbv is enabled or not.
Definition ethernet.h:354
enum ethernet_qbv_param_type type
Type of Qbv parameter.
Definition ethernet.h:349
uint16_t row
Gate control list row.
Definition ethernet.h:368
enum ethernet_qbv_state_type state
What state (Admin/Oper) parameters are these.
Definition ethernet.h:351
bool gate_status[NET_TC_TX_COUNT]
True = open, False = closed.
Definition ethernet.h:359
struct ethernet_qbv_param::@216245142047156057050100137262377130033073153043::@021257345011254116250333267163357325114370122157 gate_control
Gate control information.
struct net_ptp_extended_time base_time
Base time.
Definition ethernet.h:380
uint32_t extension_time
Extension time (nanoseconds)
Definition ethernet.h:386
enum ethernet_gate_state_operation operation
GateState operation.
Definition ethernet.h:362
uint32_t time_interval
Time interval ticks (nanoseconds)
Definition ethernet.h:365
struct net_ptp_time cycle_time
Cycle time.
Definition ethernet.h:383
uint32_t gate_control_list_len
Number of entries in gate control list.
Definition ethernet.h:372
Ethernet T1S specific parameters.
Definition ethernet.h:258
uint8_t burst_count
T1S PLCA burst count range: 0x0 to 0xFF.
Definition ethernet.h:293
struct ethernet_t1s_param::@137043030202105122307127043270351011340051121123::@143362007131123250037113307322214063224345127206 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:291
uint8_t to_timer
T1S PLCA TO value.
Definition ethernet.h:297
uint8_t burst_timer
T1S PLCA burst timer.
Definition ethernet.h:295
uint8_t node_id
T1S PLCA node id range: 0 to 254.
Definition ethernet.h:289
enum ethernet_t1s_param_type type
Type of T1S parameter.
Definition ethernet.h:260
bool enable
T1S PLCA enabled.
Definition ethernet.h:287
Ethernet TXTIME specific parameters.
Definition ethernet.h:479
bool enable_txtime
Enable or disable TXTIME per queue.
Definition ethernet.h:485
int queue_id
Queue number for configuring TXTIME.
Definition ethernet.h:483
enum ethernet_txtime_param_type type
Type of TXTIME parameter.
Definition ethernet.h:481
IPv6 address struct.
Definition net_ip.h:143
IPv4 address struct.
Definition net_ip.h:155
Ethernet address.
Definition ethernet.h:53
uint8_t addr[6U]
Buffer storing the address.
Definition ethernet.h:54
Network Interface structure.
Definition net_if.h:726
LLDP Data Unit (LLDPDU) shall contain the following ordered TLVs as stated in "8.2 LLDPDU format" fro...
Definition lldp.h:172
Network packet.
Definition net_pkt.h:91
Generalized Precision Time Protocol Extended Timestamp format.
Definition ptp_time.h:154
(Generalized) Precision Time Protocol Timestamp format.
Definition ptp_time.h:111
All Ethernet specific statistics.
Definition net_stats.h:625