Zephyr API Documentation
3.5.0
A Scalable Open Source RTOS
|
|
3.5.0 |
Ethernet support functions. More...
Modules | |
Ethernet MII Support Functions | |
Ethernet MII (media independent interface) functions. | |
IEEE 802.3 management interface | |
Definitions for IEEE 802.3 management interface. | |
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 |
Ethernet L2 context that is needed for VLAN. More... | |
Macros | |
#define | ETH_NET_DEVICE_INIT(dev_id, name, init_fn, pm, data, config, prio, api, mtu) |
Create an Ethernet network interface and bind it to network device. | |
#define | ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, prio, api, mtu) |
Like ETH_NET_DEVICE_INIT but taking metadata from a devicetree. | |
#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. | |
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) } |
Ethernet hardware capabilities. More... | |
enum | ethernet_if_types { L2_ETH_IF_TYPE_ETHERNET , L2_ETH_IF_TYPE_WIFI } |
Types of Ethernet L2. More... | |
enum | ethernet_flags { ETH_CARRIER_UP } |
Functions | |
void | ethernet_init (struct net_if *iface) |
Initialize Ethernet L2 stack for a given interface. | |
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. | |
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. | |
static int | net_eth_vlan_enable (struct net_if *iface, uint16_t tag) |
Add VLAN tag to the interface. | |
static int | net_eth_vlan_disable (struct net_if *iface, uint16_t tag) |
Remove VLAN tag from the interface. | |
static uint16_t | net_eth_get_vlan_tag (struct net_if *iface) |
Return VLAN tag specified to network 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. | |
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. | |
static bool | net_eth_get_vlan_status (struct net_if *iface) |
Get VLAN status for a given network interface (enabled or not). | |
void | net_eth_carrier_on (struct net_if *iface) |
Inform ethernet L2 driver that ethernet carrier is detected. | |
void | net_eth_carrier_off (struct net_if *iface) |
Inform ethernet L2 driver that ethernet carrier was lost. | |
int | net_eth_promisc_mode (struct net_if *iface, bool enable) |
Set promiscuous mode either ON or OFF. | |
static const struct device * | net_eth_get_ptp_clock (struct net_if *iface) |
Return PTP clock that is tied to this ethernet network interface. | |
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 int | net_eth_get_ptp_port (struct net_if *iface) |
Return PTP port number attached to this interface. | |
static void | net_eth_set_ptp_port (struct net_if *iface, int port) |
Set PTP port number attached to this interface. | |
static bool | net_eth_type_is_wifi (struct net_if *iface) |
Check if the Ethernet L2 network interface can perform Wi-Fi. | |
Ethernet support functions.
#define ETH_NET_DEVICE_DT_DEFINE | ( | node_id, | |
init_fn, | |||
pm, | |||
data, | |||
config, | |||
prio, | |||
api, | |||
mtu | |||
) |
#include <zephyr/net/ethernet.h>
Like ETH_NET_DEVICE_INIT but taking metadata from a devicetree.
Create an Ethernet network interface and bind it to network device.
node_id | The devicetree node identifier. |
init_fn | Address to the init function of the driver. |
pm | Reference to struct pm_device associated with the device. (optional). |
data | Pointer to the device's private data. |
config | The address to the structure containing the configuration information for this instance of the driver. |
prio | The initialization level at which configuration occurs. |
api | Provides an initial pointer to the API function struct used by the driver. Can be NULL. |
mtu | Maximum transfer unit in bytes for this network interface. |
#define ETH_NET_DEVICE_DT_INST_DEFINE | ( | inst, | |
... | |||
) | ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) |
#include <zephyr/net/ethernet.h>
Like ETH_NET_DEVICE_DT_DEFINE for an instance of a DT_DRV_COMPAT compatible.
inst | instance number. This is replaced by DT_DRV_COMPAT(inst) in the call to ETH_NET_DEVICE_DT_DEFINE. |
... | other parameters as expected by ETH_NET_DEVICE_DT_DEFINE. |
#define ETH_NET_DEVICE_INIT | ( | dev_id, | |
name, | |||
init_fn, | |||
pm, | |||
data, | |||
config, | |||
prio, | |||
api, | |||
mtu | |||
) |
#include <zephyr/net/ethernet.h>
Create an Ethernet network interface and bind it to network device.
dev_id | Network device id. |
name | The name this instance of the driver exposes to the system. |
init_fn | Address to the init function of the driver. |
pm | Reference to struct pm_device associated with the device. (optional). |
data | Pointer to the device's private data. |
config | The address to the structure containing the configuration information for this instance of the driver. |
prio | The initialization level at which configuration occurs. |
api | Provides an initial pointer to the API function struct used by the driver. Can be NULL. |
mtu | Maximum transfer unit in bytes for this network interface. |
enum ethernet_flags |
#include <zephyr/net/ethernet.h>
Enumerator | |
---|---|
ETH_CARRIER_UP |
enum ethernet_hw_caps |
#include <zephyr/net/ethernet.h>
Ethernet hardware capabilities.
enum ethernet_if_types |
#include <zephyr/net/ethernet.h>
Types of Ethernet L2.
Enumerator | |
---|---|
L2_ETH_IF_TYPE_ETHERNET | IEEE 802.3 Ethernet (default) |
L2_ETH_IF_TYPE_WIFI | IEEE 802.11 Wi-Fi. |
void ethernet_init | ( | struct net_if * | iface | ) |
#include <zephyr/net/ethernet.h>
Initialize Ethernet L2 stack for a given interface.
iface | A valid pointer to a network interface |
void net_eth_carrier_off | ( | struct net_if * | iface | ) |
#include <zephyr/net/ethernet.h>
Inform ethernet L2 driver that ethernet carrier was lost.
This happens when cable is disconnected.
iface | Network interface |
void net_eth_carrier_on | ( | struct net_if * | iface | ) |
#include <zephyr/net/ethernet.h>
Inform ethernet L2 driver that ethernet carrier is detected.
This happens when cable is connected.
iface | Network interface |
|
inlinestatic |
#include <zephyr/net/ethernet.h>
Return ethernet device hardware capability information.
iface | Network interface |
#include <zephyr/net/ethernet.h>
Return PTP clock that is tied to this ethernet network interface.
iface | Network interface |
const struct device * net_eth_get_ptp_clock_by_index | ( | int | index | ) |
#include <zephyr/net/ethernet.h>
Return PTP clock that is tied to this ethernet network interface index.
index | Network interface index |
|
inlinestatic |
#include <zephyr/net/ethernet.h>
Return PTP port number attached to this interface.
iface | Network interface |
#include <zephyr/net/ethernet.h>
Return network interface related to this VLAN tag.
iface | Master network interface. This is used to get the pointer to ethernet L2 context |
tag | VLAN tag |
#include <zephyr/net/ethernet.h>
Get VLAN status for a given network interface (enabled or not).
iface | Network interface |
#include <zephyr/net/ethernet.h>
Return VLAN tag specified to network interface.
iface | Network interface. |
void net_eth_ipv4_mcast_to_mac_addr | ( | const struct in_addr * | ipv4_addr, |
struct net_eth_addr * | mac_addr | ||
) |
#include <zephyr/net/ethernet.h>
Convert IPv4 multicast address to Ethernet address.
ipv4_addr | IPv4 multicast address |
mac_addr | Output buffer for Ethernet address |
void net_eth_ipv6_mcast_to_mac_addr | ( | const struct in6_addr * | ipv6_addr, |
struct net_eth_addr * | mac_addr | ||
) |
#include <zephyr/net/ethernet.h>
Convert IPv6 multicast address to Ethernet address.
ipv6_addr | IPv6 multicast address |
mac_addr | Output buffer for Ethernet address |
|
inlinestatic |
#include <zephyr/net/ethernet.h>
Check if VLAN is enabled for a specific network interface.
ctx | Ethernet context |
iface | Network interface |
#include <zephyr/net/ethernet.h>
Set promiscuous mode either ON or OFF.
iface | Network interface |
enable | on (true) or off (false) |
|
inlinestatic |
#include <zephyr/net/ethernet.h>
Set PTP port number attached to this interface.
iface | Network interface |
port | Port number to set |
#include <zephyr/net/ethernet.h>
Check if the Ethernet L2 network interface can perform Wi-Fi.
iface | Pointer to network interface |
#include <zephyr/net/ethernet.h>
Remove VLAN tag from the interface.
iface | Interface to use. |
tag | VLAN tag to remove |
#include <zephyr/net/ethernet.h>
Add VLAN tag to the interface.
iface | Interface to use. |
tag | VLAN tag to add |