Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Ethernet Support Functions

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  net_eth_addr
 Ethernet address. More...
 
struct  ethernet_t1s_param
 Ethernet T1S specific parameters. More...
 
struct  ethernet_qav_param
 Ethernet Qav specific parameters. More...
 
struct  ethernet_qbv_param
 Ethernet Qbv specific parameters. More...
 
struct  ethernet_qbu_param
 Ethernet Qbu specific parameters. More...
 
struct  ethernet_filter
 Ethernet filter description. More...
 
struct  ethernet_txtime_param
 Ethernet TXTIME specific parameters. More...
 
struct  ethernet_api
 Ethernet L2 API operations. More...
 
struct  ethernet_lldp
 Ethernet LLDP specific parameters. More...
 

Macros

#define NET_ETH_ADDR_LEN   6U
 Ethernet MAC address length.
 
#define NET_ETH_MINIMAL_FRAME_SIZE   60
 Minimum Ethernet frame size.
 
#define NET_ETH_MTU   1500
 Ethernet MTU size.
 
#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_INIT_INSTANCE(dev_id, name, instance, init_fn, pm, data, config, prio, api, mtu)
 Create multiple Ethernet network interfaces and bind them to network devices.
 
#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_TXINJECTION_MODE = BIT(20)
}
 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_checksum_support {
  ETHERNET_CHECKSUM_SUPPORT_NONE = NET_IF_CHECKSUM_NONE_BIT , ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER = NET_IF_CHECKSUM_IPV4_HEADER_BIT , ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP = NET_IF_CHECKSUM_IPV4_ICMP_BIT , ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER = NET_IF_CHECKSUM_IPV6_HEADER_BIT ,
  ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP = NET_IF_CHECKSUM_IPV6_ICMP_BIT , ETHERNET_CHECKSUM_SUPPORT_TCP = NET_IF_CHECKSUM_TCP_BIT , ETHERNET_CHECKSUM_SUPPORT_UDP = NET_IF_CHECKSUM_UDP_BIT
}
 Protocols that are supported by checksum offloading. More...
 

Functions

static bool net_eth_is_addr_broadcast (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a broadcast address.
 
static bool net_eth_is_addr_all_zeroes (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a all zeroes address.
 
static bool net_eth_is_addr_unspecified (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is unspecified.
 
static bool net_eth_is_addr_multicast (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a multicast address.
 
static bool net_eth_is_addr_group (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a group address.
 
static bool net_eth_is_addr_valid (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is valid.
 
static bool net_eth_is_addr_lldp_multicast (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a LLDP multicast address.
 
static bool net_eth_is_addr_ptp_multicast (struct net_eth_addr *addr)
 Check if the Ethernet MAC address is a PTP multicast address.
 
const struct net_eth_addrnet_eth_broadcast_addr (void)
 Return Ethernet broadcast address.
 
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_get_hw_config (struct net_if *iface, enum ethernet_config_type type, struct ethernet_config *config)
 Return ethernet device hardware configuration 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_ifnet_eth_get_vlan_iface (struct net_if *iface, uint16_t tag)
 Return network interface related to this VLAN tag.
 
static struct net_ifnet_eth_get_vlan_main (struct net_if *iface)
 Return main network interface that is attached to this VLAN tag.
 
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.
 
static bool net_eth_get_vlan_status (struct net_if *iface)
 Get VLAN status for a given network interface (enabled or not).
 
static bool net_eth_is_vlan_interface (struct net_if *iface)
 Check if the given interface is a VLAN interface.
 
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.
 
int net_eth_txinjection_mode (struct net_if *iface, bool enable)
 Set TX-Injection mode either ON or OFF.
 
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.
 
static const struct devicenet_eth_get_ptp_clock (struct net_if *iface)
 Return PTP clock that is tied to this ethernet network interface.
 
const struct devicenet_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.
 

Detailed Description

Ethernet support functions.

Macro Definition Documentation

◆ ETH_NET_DEVICE_DT_DEFINE

#define ETH_NET_DEVICE_DT_DEFINE (   node_id,
  init_fn,
  pm,
  data,
  config,
  prio,
  api,
  mtu 
)

#include <include/zephyr/net/ethernet.h>

Value:
Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
DEVICE_DT_NAME(node_id), init_fn, pm, \
data, config, prio, api, mtu)
#define DEVICE_DT_NAME(node_id)
Return a string name for a devicetree node.
Definition device.h:152
static int init_fn(void)
Definition main.c:263
static fdata_t data[2]
Definition test_fifo_contexts.c:15

Like ETH_NET_DEVICE_INIT but taking metadata from a devicetree.

Create an Ethernet network interface and bind it to network device.

Parameters
node_idThe devicetree node identifier.
init_fnAddress to the init function of the driver.
pmReference to struct pm_device associated with the device. (optional).
dataPointer to the device's private data.
configThe address to the structure containing the configuration information for this instance of the driver.
prioThe initialization level at which configuration occurs.
apiProvides an initial pointer to the API function struct used by the driver. Can be NULL.
mtuMaximum transfer unit in bytes for this network interface.

◆ ETH_NET_DEVICE_DT_INST_DEFINE

#define ETH_NET_DEVICE_DT_INST_DEFINE (   inst,
  ... 
)     ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)

#include <include/zephyr/net/ethernet.h>

Like ETH_NET_DEVICE_DT_DEFINE for an instance of a DT_DRV_COMPAT compatible.

Parameters
instinstance 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.

◆ ETH_NET_DEVICE_INIT

#define ETH_NET_DEVICE_INIT (   dev_id,
  name,
  init_fn,
  pm,
  data,
  config,
  prio,
  api,
  mtu 
)

#include <include/zephyr/net/ethernet.h>

Value:
Z_ETH_NET_DEVICE_INIT(DT_INVALID_NODE, dev_id, name, init_fn, \
pm, data, config, prio, api, mtu)
#define DT_INVALID_NODE
Name for an invalid node identifier.
Definition devicetree.h:87

Create an Ethernet network interface and bind it to network device.

Parameters
dev_idNetwork device id.
nameThe name this instance of the driver exposes to the system.
init_fnAddress to the init function of the driver.
pmReference to struct pm_device associated with the device. (optional).
dataPointer to the device's private data.
configThe address to the structure containing the configuration information for this instance of the driver.
prioThe initialization level at which configuration occurs.
apiProvides an initial pointer to the API function struct used by the driver. Can be NULL.
mtuMaximum transfer unit in bytes for this network interface.

◆ ETH_NET_DEVICE_INIT_INSTANCE

#define ETH_NET_DEVICE_INIT_INSTANCE (   dev_id,
  name,
  instance,
  init_fn,
  pm,
  data,
  config,
  prio,
  api,
  mtu 
)

#include <include/zephyr/net/ethernet.h>

Value:
Z_ETH_NET_DEVICE_INIT_INSTANCE(DT_INVALID_NODE, dev_id, name, \
instance, init_fn, pm, data, \
config, prio, api, mtu)

Create multiple Ethernet network interfaces and bind them to network devices.

If your network device needs more than one instance of a network interface, use this macro below and provide a different instance suffix each time (0, 1, 2, ... or a, b, c ... whatever works for you)

Parameters
dev_idNetwork device id.
nameThe name this instance of the driver exposes to the system.
instanceInstance identifier.
init_fnAddress to the init function of the driver.
pmReference to struct pm_device associated with the device. (optional).
dataPointer to the device's private data.
configThe address to the structure containing the configuration information for this instance of the driver.
prioThe initialization level at which configuration occurs.
apiProvides an initial pointer to the API function struct used by the driver. Can be NULL.
mtuMaximum transfer unit in bytes for this network interface.

◆ NET_ETH_ADDR_LEN

#define NET_ETH_ADDR_LEN   6U

#include <include/zephyr/net/ethernet.h>

Ethernet MAC address length.

◆ NET_ETH_MINIMAL_FRAME_SIZE

#define NET_ETH_MINIMAL_FRAME_SIZE   60

#include <include/zephyr/net/ethernet.h>

Minimum Ethernet frame size.

◆ NET_ETH_MTU

#define NET_ETH_MTU   1500

#include <include/zephyr/net/ethernet.h>

Ethernet MTU size.

Enumeration Type Documentation

◆ ethernet_checksum_support

#include <include/zephyr/net/ethernet.h>

Protocols that are supported by checksum offloading.

Enumerator
ETHERNET_CHECKSUM_SUPPORT_NONE 

Device does not support any L3/L4 checksum offloading.

ETHERNET_CHECKSUM_SUPPORT_IPV4_HEADER 

Device supports checksum offloading for the IPv4 header.

ETHERNET_CHECKSUM_SUPPORT_IPV4_ICMP 

Device supports checksum offloading for ICMPv4 payload (implies IPv4 header)

ETHERNET_CHECKSUM_SUPPORT_IPV6_HEADER 

Device supports checksum offloading for the IPv6 header.

ETHERNET_CHECKSUM_SUPPORT_IPV6_ICMP 

Device supports checksum offloading for ICMPv6 payload (implies IPv6 header)

ETHERNET_CHECKSUM_SUPPORT_TCP 

Device supports TCP checksum offloading for all supported IP protocols.

ETHERNET_CHECKSUM_SUPPORT_UDP 

Device supports UDP checksum offloading for all supported IP protocols.

◆ ethernet_hw_caps

#include <include/zephyr/net/ethernet.h>

Ethernet hardware capabilities.

Enumerator
ETHERNET_HW_TX_CHKSUM_OFFLOAD 

TX Checksum offloading supported for all of IPv4, UDP, TCP.

ETHERNET_HW_RX_CHKSUM_OFFLOAD 

RX Checksum offloading supported for all of IPv4, UDP, TCP.

ETHERNET_HW_VLAN 

VLAN supported.

ETHERNET_AUTO_NEGOTIATION_SET 

Enabling/disabling auto negotiation supported.

ETHERNET_LINK_10BASE_T 

10 Mbits link supported

ETHERNET_LINK_100BASE_T 

100 Mbits link supported

ETHERNET_LINK_1000BASE_T 

1 Gbits link supported

ETHERNET_DUPLEX_SET 

Changing duplex (half/full) supported.

ETHERNET_PTP 

IEEE 802.1AS (gPTP) clock supported.

ETHERNET_QAV 

IEEE 802.1Qav (credit-based shaping) supported.

ETHERNET_PROMISC_MODE 

Promiscuous mode supported.

ETHERNET_PRIORITY_QUEUES 

Priority queues available.

ETHERNET_HW_FILTERING 

MAC address filtering supported.

ETHERNET_LLDP 

Link Layer Discovery Protocol supported.

ETHERNET_HW_VLAN_TAG_STRIP 

VLAN Tag stripping.

ETHERNET_DSA_SLAVE_PORT 

DSA switch slave port.

ETHERNET_DSA_MASTER_PORT 

DSA switch master port.

ETHERNET_QBV 

IEEE 802.1Qbv (scheduled traffic) supported.

ETHERNET_QBU 

IEEE 802.1Qbu (frame preemption) supported.

ETHERNET_TXTIME 

TXTIME supported.

ETHERNET_TXINJECTION_MODE 

TX-Injection supported.

◆ ethernet_if_types

#include <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.

Function Documentation

◆ net_eth_broadcast_addr()

const struct net_eth_addr * net_eth_broadcast_addr ( void  )

#include <include/zephyr/net/ethernet.h>

Return Ethernet broadcast address.

Returns
Ethernet broadcast address.

◆ net_eth_carrier_off()

void net_eth_carrier_off ( struct net_if iface)

#include <include/zephyr/net/ethernet.h>

Inform ethernet L2 driver that ethernet carrier was lost.

This happens when cable is disconnected.

Parameters
ifaceNetwork interface

◆ net_eth_carrier_on()

void net_eth_carrier_on ( struct net_if iface)

#include <include/zephyr/net/ethernet.h>

Inform ethernet L2 driver that ethernet carrier is detected.

This happens when cable is connected.

Parameters
ifaceNetwork interface

◆ net_eth_get_hw_capabilities()

static enum ethernet_hw_caps net_eth_get_hw_capabilities ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return ethernet device hardware capability information.

Parameters
ifaceNetwork interface
Returns
Hardware capabilities

◆ net_eth_get_hw_config()

static int net_eth_get_hw_config ( struct net_if iface,
enum ethernet_config_type  type,
struct ethernet_config *  config 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return ethernet device hardware configuration information.

Parameters
ifaceNetwork interface
typeconfiguration type
configEthernet configuration
Returns
0 if ok, <0 if error

◆ net_eth_get_ptp_clock()

static const struct device * net_eth_get_ptp_clock ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return PTP clock that is tied to this ethernet network interface.

Parameters
ifaceNetwork interface
Returns
Pointer to PTP clock if found, NULL if not found or if this ethernet interface does not support PTP.

◆ net_eth_get_ptp_clock_by_index()

const struct device * net_eth_get_ptp_clock_by_index ( int  index)

#include <include/zephyr/net/ethernet.h>

Return PTP clock that is tied to this ethernet network interface index.

Parameters
indexNetwork interface index
Returns
Pointer to PTP clock if found, NULL if not found or if this ethernet interface index does not support PTP.

◆ net_eth_get_ptp_port()

static int net_eth_get_ptp_port ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return PTP port number attached to this interface.

Parameters
ifaceNetwork interface
Returns
Port number, no such port if < 0

◆ net_eth_get_vlan_iface()

static struct net_if * net_eth_get_vlan_iface ( struct net_if iface,
uint16_t  tag 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return network interface related to this VLAN tag.

Parameters
ifaceMain network interface (not the VLAN one).
tagVLAN tag
Returns
Network interface related to this tag or NULL if no such interface exists.

◆ net_eth_get_vlan_main()

static struct net_if * net_eth_get_vlan_main ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return main network interface that is attached to this VLAN tag.

Parameters
ifaceVLAN network interface. This is used to get the pointer to ethernet L2 context
Returns
Network interface related to this tag or NULL if no such interface exists.

◆ net_eth_get_vlan_status()

static bool net_eth_get_vlan_status ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Get VLAN status for a given network interface (enabled or not).

Parameters
ifaceNetwork interface
Returns
True if VLAN is enabled for this network interface, false if not.

◆ net_eth_get_vlan_tag()

static uint16_t net_eth_get_vlan_tag ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Return VLAN tag specified to network interface.

Note that the interface parameter must be the VLAN interface, and not the Ethernet one.

Parameters
ifaceVLAN network interface.
Returns
VLAN tag for this interface or NET_VLAN_TAG_UNSPEC if VLAN is not configured for that interface.

◆ net_eth_ipv4_mcast_to_mac_addr()

void net_eth_ipv4_mcast_to_mac_addr ( const struct in_addr ipv4_addr,
struct net_eth_addr mac_addr 
)

#include <include/zephyr/net/ethernet.h>

Convert IPv4 multicast address to Ethernet address.

Parameters
ipv4_addrIPv4 multicast address
mac_addrOutput buffer for Ethernet address

◆ net_eth_ipv6_mcast_to_mac_addr()

void net_eth_ipv6_mcast_to_mac_addr ( const struct in6_addr ipv6_addr,
struct net_eth_addr mac_addr 
)

#include <include/zephyr/net/ethernet.h>

Convert IPv6 multicast address to Ethernet address.

Parameters
ipv6_addrIPv6 multicast address
mac_addrOutput buffer for Ethernet address

◆ net_eth_is_addr_all_zeroes()

static bool net_eth_is_addr_all_zeroes ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a all zeroes address.

Parameters
addrA valid pointer to an Ethernet MAC address.
Returns
true if address is an all zeroes address, false if not

◆ net_eth_is_addr_broadcast()

static bool net_eth_is_addr_broadcast ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a broadcast address.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is a broadcast address, false if not

◆ net_eth_is_addr_group()

static bool net_eth_is_addr_group ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a group address.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is a group address, false if not

◆ net_eth_is_addr_lldp_multicast()

static bool net_eth_is_addr_lldp_multicast ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a LLDP multicast address.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is a LLDP multicast address, false if not

◆ net_eth_is_addr_multicast()

static bool net_eth_is_addr_multicast ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a multicast address.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is a multicast address, false if not

◆ net_eth_is_addr_ptp_multicast()

static bool net_eth_is_addr_ptp_multicast ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is a PTP multicast address.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is a PTP multicast address, false if not

◆ net_eth_is_addr_unspecified()

static bool net_eth_is_addr_unspecified ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is unspecified.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is unspecified, false if not

◆ net_eth_is_addr_valid()

static bool net_eth_is_addr_valid ( struct net_eth_addr addr)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet MAC address is valid.

Parameters
addrA valid pointer to a Ethernet MAC address.
Returns
true if address is valid, false if not

◆ net_eth_is_vlan_enabled()

static bool net_eth_is_vlan_enabled ( struct ethernet_context *  ctx,
struct net_if iface 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if there are any VLAN interfaces enabled to this specific Ethernet network interface.

Note that the iface must be the actual Ethernet interface and not the virtual VLAN interface.

Parameters
ctxEthernet context
ifaceEthernet network interface
Returns
True if there are enabled VLANs for this network interface, false if not.

◆ net_eth_is_vlan_interface()

static bool net_eth_is_vlan_interface ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the given interface is a VLAN interface.

Parameters
ifaceNetwork interface
Returns
True if this network interface is VLAN one, false if not.

◆ net_eth_mac_filter()

int net_eth_mac_filter ( struct net_if iface,
struct net_eth_addr mac,
enum ethernet_filter_type  type,
bool  enable 
)

#include <include/zephyr/net/ethernet.h>

Set or unset HW filtering for MAC address mac.

Parameters
ifaceNetwork interface
macPointer to an ethernet MAC address
typeFilter type, either source or destination
enableSet (true) or unset (false)
Returns
0 if filter set or unset was successful, <0 otherwise.

◆ net_eth_promisc_mode()

int net_eth_promisc_mode ( struct net_if iface,
bool  enable 
)

#include <include/zephyr/net/ethernet.h>

Set promiscuous mode either ON or OFF.

Parameters
ifaceNetwork interface
enableon (true) or off (false)
Returns
0 if mode set or unset was successful, <0 otherwise.

◆ net_eth_set_ptp_port()

static void net_eth_set_ptp_port ( struct net_if iface,
int  port 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Set PTP port number attached to this interface.

Parameters
ifaceNetwork interface
portPort number to set

◆ net_eth_txinjection_mode()

int net_eth_txinjection_mode ( struct net_if iface,
bool  enable 
)

#include <include/zephyr/net/ethernet.h>

Set TX-Injection mode either ON or OFF.

Parameters
ifaceNetwork interface
enableon (true) or off (false)
Returns
0 if mode set or unset was successful, <0 otherwise.

◆ net_eth_type_is_wifi()

static bool net_eth_type_is_wifi ( struct net_if iface)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Check if the Ethernet L2 network interface can perform Wi-Fi.

Parameters
ifacePointer to network interface
Returns
True if interface supports Wi-Fi, False otherwise.

◆ net_eth_vlan_disable()

static int net_eth_vlan_disable ( struct net_if iface,
uint16_t  tag 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Remove VLAN tag from the interface.

Parameters
ifaceInterface to use.
tagVLAN tag to remove
Returns
0 if ok, <0 if error

◆ net_eth_vlan_enable()

static int net_eth_vlan_enable ( struct net_if iface,
uint16_t  tag 
)
inlinestatic

#include <include/zephyr/net/ethernet.h>

Add VLAN tag to the interface.

Parameters
ifaceInterface to use.
tagVLAN tag to add
Returns
0 if ok, <0 if error