|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Rapid Spanning Tree Protocol for Ethernet bridges. More...
Data Structures | |
| struct | eth_bridge_stp_status |
| Spanning tree state of a bridge. More... | |
| struct | eth_bridge_stp_port_status |
| Spanning tree state of a bridge port. More... | |
| struct | eth_bridge_stp_port_event |
| Information of the NET_EVENT_ETHERNET_BRIDGE_PORT_STATE event. More... | |
| struct | eth_bridge_stp_root_event |
| Information of the NET_EVENT_ETHERNET_BRIDGE_NEW_ROOT event. More... | |
| struct | eth_bridge_stp_topology_event |
| Information of the NET_EVENT_ETHERNET_BRIDGE_TOPOLOGY_CHANGE event. More... | |
Enumerations | |
| enum | eth_bridge_stp_role { ETH_BRIDGE_STP_ROLE_DISABLED , ETH_BRIDGE_STP_ROLE_ROOT , ETH_BRIDGE_STP_ROLE_DESIGNATED , ETH_BRIDGE_STP_ROLE_ALTERNATE , ETH_BRIDGE_STP_ROLE_BACKUP } |
| Port Role (IEEE Std 802.1Q-2014 13.27.66). More... | |
| enum | eth_bridge_stp_version { ETH_BRIDGE_STP_VERSION_STP = 0 , ETH_BRIDGE_STP_VERSION_RSTP = 2 } |
| Force Protocol Version (IEEE Std 802.1Q-2014 13.7.2). More... | |
| enum | eth_bridge_stp_p2p { ETH_BRIDGE_STP_P2P_AUTO , ETH_BRIDGE_STP_P2P_ON , ETH_BRIDGE_STP_P2P_OFF } |
| Point-to-point setting of a port (IEEE Std 802.1Q-2014 13.28.16). More... | |
Functions | |
| int | eth_bridge_stp_enable (struct net_if *br, bool enable) |
| Start or stop the spanning tree protocol on a bridge. | |
| int | eth_bridge_stp_get_status (struct net_if *br, struct eth_bridge_stp_status *status) |
| Get the spanning tree state of a bridge. | |
| int | eth_bridge_stp_port_get_status (struct net_if *br, struct net_if *iface, struct eth_bridge_stp_port_status *status) |
| Get the spanning tree state of a bridge port. | |
| int | eth_bridge_stp_set_bridge_priority (struct net_if *br, uint16_t priority) |
| Set the Bridge Priority. | |
| int | eth_bridge_stp_set_times (struct net_if *br, uint8_t max_age, uint8_t forward_delay) |
| Set the Bridge Max Age and Bridge Forward Delay. | |
| int | eth_bridge_stp_set_tx_hold_count (struct net_if *br, uint8_t count) |
| Set the Transmit Hold Count. | |
| int | eth_bridge_stp_set_version (struct net_if *br, enum eth_bridge_stp_version version) |
| Set the Force Protocol Version. | |
| int | eth_bridge_stp_port_set_priority (struct net_if *br, struct net_if *iface, uint8_t priority) |
| Set the priority of a bridge port. | |
| int | eth_bridge_stp_port_set_path_cost (struct net_if *br, struct net_if *iface, uint32_t cost) |
| Set the Port Path Cost of a bridge port. | |
| int | eth_bridge_stp_port_set_edge (struct net_if *br, struct net_if *iface, bool admin_edge, bool auto_edge) |
| Set how a bridge port detects that it is an Edge Port. | |
| int | eth_bridge_stp_port_set_p2p (struct net_if *br, struct net_if *iface, enum eth_bridge_stp_p2p p2p) |
| Set whether a bridge port is attached to a point-to-point link. | |
| int | eth_bridge_stp_port_mcheck (struct net_if *br, struct net_if *iface) |
| Make a bridge port check whether STP bridges are still attached. | |
Rapid Spanning Tree Protocol for Ethernet bridges.
| enum eth_bridge_stp_p2p |
#include <zephyr/net/ethernet_bridge_stp.h>
Point-to-point setting of a port (IEEE Std 802.1Q-2014 13.28.16).
| enum eth_bridge_stp_role |
#include <zephyr/net/ethernet_bridge_stp.h>
Port Role (IEEE Std 802.1Q-2014 13.27.66).
#include <zephyr/net/ethernet_bridge_stp.h>
Force Protocol Version (IEEE Std 802.1Q-2014 13.7.2).
| Enumerator | |
|---|---|
| ETH_BRIDGE_STP_VERSION_STP | STP compatible: STP BPDUs and no rapid transitions. |
| ETH_BRIDGE_STP_VERSION_RSTP | RSTP, the default. |
#include <zephyr/net/ethernet_bridge_stp.h>
Start or stop the spanning tree protocol on a bridge.
The protocol is off by default and the bridge then forwards on every port. When started, every port discards frames until the protocol has decided its role. When stopped, every port forwards again and the learned FDB entries of the bridge are removed.
The protocol blocks a port by not forwarding frames from and to it in software. A port whose device forwards frames to its other ports in hardware (a DSA user port or ETHERNET_HW_PORT_FORWARDING) cannot be blocked that way, unless the device also reports ETHERNET_HW_STP_PORT_STATE: the protocol then sets the port state and flushes the learned addresses in hardware too. Without it the protocol does not start on a bridge with such a port, and such a port cannot be added while it runs.
The Bridge Identifier is made of the Bridge Priority and the MAC address of the bridge interface. Use a stable bridge MAC address, as a random one changes the Bridge Identifier on every boot.
| br | Bridge interface |
| enable | true to start, false to stop |
| 0 | The protocol was started or stopped. |
| -EALREADY | The protocol was already in that state. |
| -EINVAL | br is not a bridge interface. |
| -ENOTSUP | A port of br forwards frames to other ports in hardware, as DSA switch ports and the ADIN2111 do, and its device cannot block it. |
| int eth_bridge_stp_get_status | ( | struct net_if * | br, |
| struct eth_bridge_stp_status * | status ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Get the spanning tree state of a bridge.
| br | Bridge interface |
| status | Filled with the state of br |
| 0 | The status was filled. |
| -EINVAL | br is not a bridge interface. |
| int eth_bridge_stp_port_get_status | ( | struct net_if * | br, |
| struct net_if * | iface, | ||
| struct eth_bridge_stp_port_status * | status ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Get the spanning tree state of a bridge port.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| status | Filled with the state of the port of iface |
| 0 | The status was filled. |
| -EINVAL | br is not a bridge interface. |
| -ENOENT | iface is not a port of br. |
#include <zephyr/net/ethernet_bridge_stp.h>
Make a bridge port check whether STP bridges are still attached.
A port that has heard an STP bridge keeps sending STP BPDUs. This makes it send RST BPDUs again, and fall back once more if an STP bridge is still there.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| 0 | The check was started. |
| -EINVAL | br is not a bridge interface. |
| -ENOENT | iface is not a port of br. |
| int eth_bridge_stp_port_set_edge | ( | struct net_if * | br, |
| struct net_if * | iface, | ||
| bool | admin_edge, | ||
| bool | auto_edge ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Set how a bridge port detects that it is an Edge Port.
An Edge Port has no bridge behind it and forwards without delay.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| admin_edge | The port is an Edge Port from the start, false by default |
| auto_edge | The port becomes an Edge Port when it receives no BPDU, true by default |
| 0 | The setting was stored. |
| -EINVAL | br is not a bridge interface. |
| -ENOENT | iface is not a port of br. |
| int eth_bridge_stp_port_set_p2p | ( | struct net_if * | br, |
| struct net_if * | iface, | ||
| enum eth_bridge_stp_p2p | p2p ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Set whether a bridge port is attached to a point-to-point link.
Rapid transitions to forwarding need a point-to-point link.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| p2p | Point-to-point setting, ETH_BRIDGE_STP_P2P_AUTO by default |
| 0 | The setting was stored. |
| -EINVAL | br is not a bridge interface or p2p is not valid. |
| -ENOENT | iface is not a port of br. |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the Port Path Cost of a bridge port.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| cost | 1 to 200000000, or 0 to derive it from the link speed (IEEE Std 802.1Q-2014 Table 13-4), the default |
| 0 | The cost was set. |
| -EINVAL | br is not a bridge interface or cost is not valid. |
| -ENOENT | iface is not a port of br. |
| int eth_bridge_stp_port_set_priority | ( | struct net_if * | br, |
| struct net_if * | iface, | ||
| uint8_t | priority ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the priority of a bridge port.
| br | Bridge interface |
| iface | Ethernet interface bridged by br |
| priority | 0 to 240 in steps of 16, 128 by default |
| 0 | The priority was set. |
| -EINVAL | br is not a bridge interface or priority is not valid. |
| -ENOENT | iface is not a port of br. |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the Bridge Priority.
The bridge with the best (numerically lowest) priority becomes the root.
| br | Bridge interface |
| priority | 0 to 61440 in steps of 4096, 32768 by default |
| 0 | The priority was set. |
| -EINVAL | br is not a bridge interface or priority is not valid. |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the Bridge Max Age and Bridge Forward Delay.
The values must satisfy 2 * (forward_delay - 1) >= max_age >= 6.
| br | Bridge interface |
| max_age | Bridge Max Age, 6 to 40 seconds, 20 by default |
| forward_delay | Bridge Forward Delay, 4 to 30 seconds, 15 by default |
| 0 | The times were set. |
| -EINVAL | br is not a bridge interface or a value is not valid. |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the Transmit Hold Count.
| br | Bridge interface |
| count | Most BPDUs a port sends in one second, 1 to 10, 6 by default |
| 0 | The count was set. |
| -EINVAL | br is not a bridge interface or count is not valid. |
| int eth_bridge_stp_set_version | ( | struct net_if * | br, |
| enum eth_bridge_stp_version | version ) |
#include <zephyr/net/ethernet_bridge_stp.h>
Set the Force Protocol Version.
Restarts the protocol on all ports of a running bridge.
| br | Bridge interface |
| version | Protocol version |
| 0 | The version was set. |
| -EINVAL | br is not a bridge interface or version is not valid. |