Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
DSA definitions and helpers . More...
Data Structures | |
struct | dsa_slave_config |
Structure to provide mac address for each LAN interface. More... | |
Typedefs | |
typedef enum net_verdict(* | dsa_net_recv_cb_t) (struct net_if *iface, struct net_pkt *pkt) |
DSA (MGMT) Receive packet callback. | |
typedef int(* | dsa_send_t) (const struct device *dev, struct net_pkt *pkt) |
Pointer to master interface send function. | |
Functions | |
int | dsa_tx (const struct device *dev, struct net_pkt *pkt) |
DSA generic transmit function. | |
int | dsa_register_recv_callback (struct net_if *iface, dsa_net_recv_cb_t cb) |
Register DSA Rx callback functions. | |
struct net_if * | dsa_net_recv (struct net_if *iface, struct net_pkt **pkt) |
Set DSA interface to packet. | |
int | dsa_register_master_tx (struct net_if *iface, dsa_send_t fn) |
DSA helper function to register transmit function for master. | |
bool | dsa_is_port_master (struct net_if *iface) |
DSA helper function to check if port is master. | |
struct net_if * | dsa_get_slave_port (struct net_if *iface, int slave_num) |
Get network interface of a slave port. | |
int | dsa_switch_read (struct net_if *iface, uint16_t reg_addr, uint8_t *value) |
Read from DSA switch register. | |
int | dsa_switch_write (struct net_if *iface, uint16_t reg_addr, uint8_t value) |
Write to DSA switch. | |
int | dsa_switch_set_mac_table_entry (struct net_if *iface, const uint8_t *mac, uint8_t fw_port, uint16_t tbl_entry_idx, uint16_t flags) |
Write static MAC table entry. | |
int | dsa_switch_get_mac_table_entry (struct net_if *iface, uint8_t *buf, uint16_t tbl_entry_idx) |
Read static MAC table entry. | |
DSA definitions and helpers .
typedef enum net_verdict(* dsa_net_recv_cb_t) (struct net_if *iface, struct net_pkt *pkt) |
#include <zephyr/net/dsa.h>
DSA (MGMT) Receive packet callback.
Callback gets called upon receiving packet. It is responsible for freeing packet or indicating to the stack that it needs to free packet by returning correct net_verdict.
Returns:
#include <zephyr/net/dsa.h>
Pointer to master interface send function.
#include <zephyr/net/dsa.h>
Get network interface of a slave port.
iface | Master port | |
[in] | slave_num | Slave port number |
#include <zephyr/net/dsa.h>
DSA helper function to check if port is master.
iface | Network interface (master) |
Returns:
#include <zephyr/net/dsa.h>
Set DSA interface to packet.
iface | Network interface (master) |
pkt | Network packet |
int dsa_register_master_tx | ( | struct net_if * | iface, |
dsa_send_t | fn ) |
#include <zephyr/net/dsa.h>
DSA helper function to register transmit function for master.
iface | Network interface (master) |
fn | Pointer to master interface send method |
Returns:
int dsa_register_recv_callback | ( | struct net_if * | iface, |
dsa_net_recv_cb_t | cb ) |
#include <zephyr/net/dsa.h>
Register DSA Rx callback functions.
iface | Network interface |
cb | Receive callback function |
#include <zephyr/net/dsa.h>
Read static MAC table entry.
iface | Master DSA interface | |
buf | Buffer to receive MAC address | |
[in] | tbl_entry_idx | Table entry index |
#include <zephyr/net/dsa.h>
Read from DSA switch register.
iface | The interface | |
[in] | reg_addr | The register address |
value | The value |
int dsa_switch_set_mac_table_entry | ( | struct net_if * | iface, |
const uint8_t * | mac, | ||
uint8_t | fw_port, | ||
uint16_t | tbl_entry_idx, | ||
uint16_t | flags ) |
#include <zephyr/net/dsa.h>
Write static MAC table entry.
iface | Master DSA interface | |
[in] | mac | MAC address |
[in] | fw_port | The firmware port |
[in] | tbl_entry_idx | Table entry index |
[in] | flags | Flags |
#include <zephyr/net/dsa.h>
Write to DSA switch.
iface | The interface | |
[in] | reg_addr | The register address |
[in] | value | The value |
#include <zephyr/net/dsa.h>
DSA generic transmit function.
This is a generic function for passing packets from slave DSA interface to master.
dev | Device |
pkt | Network packet |
Returns: