Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
ethernet.h File Reference

Ethernet. More...

#include <kernel.h>
#include <zephyr/types.h>
#include <stdbool.h>
#include <sys/atomic.h>
#include <net/net_ip.h>
#include <net/net_pkt.h>
#include <sys/util.h>
#include <net/net_if.h>
#include <net/ethernet_vlan.h>
#include <net/ptp_time.h>
#include <syscalls/ethernet.h>

Go to the source code of this file.

Data Structures

struct  ethernet_qav_param
 
struct  ethernet_qbv_param
 
struct  ethernet_qbu_param
 
struct  ethernet_filter
 
struct  ethernet_txtime_param
 
struct  ethernet_api
 
struct  ethernet_context
 

Macros

#define ETH_NET_DEVICE_INIT(dev_name, drv_name, init_fn, pm_control_fn, data, cfg, prio, api, mtu)
 Create an Ethernet network interface and bind it to network device. More...
 
#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm_control_fn, data, cfg, prio, api, mtu)
 Like ETH_NET_DEVICE_INIT but taking metadata from a devicetree. Create an Ethernet network interface and bind it to network device. More...
 
#define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...)    ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
 Like ETH_NET_DEVICE_DT_DEFINE for an instance of a DT_DRV_COMPAT compatible. More...
 

Enumerations

enum  ethernet_hw_caps {
  ETHERNET_HW_TX_CHKSUM_OFFLOAD = BIT(0) , ETHERNET_HW_RX_CHKSUM_OFFLOAD = BIT(1) , ETHERNET_HW_VLAN = BIT(2) , ETHERNET_AUTO_NEGOTIATION_SET = BIT(3) ,
  ETHERNET_LINK_10BASE_T = BIT(4) , ETHERNET_LINK_100BASE_T = BIT(5) , ETHERNET_LINK_1000BASE_T = BIT(6) , ETHERNET_DUPLEX_SET = BIT(7) ,
  ETHERNET_PTP = BIT(8) , ETHERNET_QAV = BIT(9) , ETHERNET_PROMISC_MODE = BIT(10) , ETHERNET_PRIORITY_QUEUES = BIT(11) ,
  ETHERNET_HW_FILTERING = BIT(12) , ETHERNET_LLDP = BIT(13) , ETHERNET_HW_VLAN_TAG_STRIP = BIT(14) , ETHERNET_DSA_SLAVE_PORT = BIT(15) ,
  ETHERNET_DSA_MASTER_PORT = BIT(16) , ETHERNET_QBV = BIT(17) , ETHERNET_QBU = BIT(18) , ETHERNET_TXTIME = BIT(19)
}
 
enum  ethernet_flags { ETH_CARRIER_UP }
 

Functions

void ethernet_init (struct net_if *iface)
 Initialize Ethernet L2 stack for a given interface. More...
 
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. More...
 
static enum ethernet_hw_caps net_eth_get_hw_capabilities (struct net_if *iface)
 Return ethernet device hardware capability information. More...
 
static int net_eth_vlan_enable (struct net_if *iface, uint16_t tag)
 Add VLAN tag to the interface. More...
 
static int net_eth_vlan_disable (struct net_if *iface, uint16_t tag)
 Remove VLAN tag from the interface. More...
 
static uint16_t net_eth_get_vlan_tag (struct net_if *iface)
 Return VLAN tag specified to network interface. More...
 
static struct net_ifnet_eth_get_vlan_iface (struct net_if *iface, uint16_t tag)
 Return network interface related to this VLAN tag. More...
 
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. More...
 
static bool net_eth_get_vlan_status (struct net_if *iface)
 Get VLAN status for a given network interface (enabled or not). More...
 
void net_eth_carrier_on (struct net_if *iface)
 Inform ethernet L2 driver that ethernet carrier is detected. This happens when cable is connected. More...
 
void net_eth_carrier_off (struct net_if *iface)
 Inform ethernet L2 driver that ethernet carrier was lost. This happens when cable is disconnected. More...
 
int net_eth_promisc_mode (struct net_if *iface, bool enable)
 Set promiscuous mode either ON or OFF. More...
 
static const struct devicenet_eth_get_ptp_clock (struct net_if *iface)
 Return PTP clock that is tied to this ethernet network interface. More...
 
const struct devicenet_eth_get_ptp_clock_by_index (int index)
 Return PTP clock that is tied to this ethernet network interface index. More...
 
static int net_eth_get_ptp_port (struct net_if *iface)
 Return gPTP port number attached to this interface. More...
 

Detailed Description

Ethernet.

This is not to be included by the application.