ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_layer3_switch.h File Reference

Layer-3 Ethernet switch driver – placeholder. More...

#include <stdint.h>
#include "ra8_err.h"
Include dependency graph for ra8_layer3_switch.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_layer3_switch_cfg_t
 Configuration descriptor for ra8_layer3_switch_open. More...
struct  ra8_layer3_switch_route_t
 A single forwarding-table entry. More...

Functions

ra8_err_t ra8_layer3_switch_open (const ra8_layer3_switch_cfg_t *cfg)
 Open the Layer-3 switch driver.
ra8_err_t ra8_layer3_switch_route_add (const ra8_layer3_switch_route_t *route)
 Add a route to the forwarding table.
ra8_err_t ra8_layer3_switch_route_delete (uint32_t dst_ip, uint32_t mask)
 Remove a route from the forwarding table.
ra8_err_t ra8_layer3_switch_status_get (uint8_t *out_open, uint8_t *out_promisc)
 Snapshot the open / promiscuous flags.
ra8_err_t ra8_layer3_switch_close (void)
 Close the Layer-3 switch driver.

Detailed Description

Layer-3 Ethernet switch driver – placeholder.

Mirrors the FSP r_layer3_switch API shape (open / route-add / route-delete / status / close). The Layer-3 switch is a forwarding engine attached to the on-chip Ethernet MAC on RZ-class parts and a subset of RA8 networking variants.

Warning
The Renesas RA8D2 silicon does not carry a Layer-3 switch block (HUM Ch 1 "Overview" feature matrix lists only ETHERC + GMAC-style controllers). This file ships a host-testable placeholder that exposes the FSP-shaped API and rejects route-table operations with k_ra8_err_not_supported.

Reference: FSP r_layer3_switch driver shape.

Definition in file ra8_layer3_switch.h.

Function Documentation

◆ ra8_layer3_switch_close()

ra8_err_t ra8_layer3_switch_close ( void )
nodiscard

Close the Layer-3 switch driver.

Returns
ra8_err_t error code.
Return values
k_ra8_okReleased.
k_ra8_err_invalid_stateDriver was never opened.
Precondition
Single-threaded shutdown context.
Postcondition
Subsequent operations return k_ra8_err_not_initialized.
ra8_layer3_switch_open may be called again.
Note
Not thread-safe.
Since
0.1.0

Definition at line 80 of file ra8_layer3_switch.c.

References k_ra8_err_invalid_state, k_ra8_ok, and s_state.

Referenced by l3_run_facade().

◆ ra8_layer3_switch_open()

ra8_err_t ra8_layer3_switch_open ( const ra8_layer3_switch_cfg_t * cfg)
nodiscard

Open the Layer-3 switch driver.

Parameters
[in]cfgConfiguration. Must not be NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_okDriver opened.
k_ra8_err_null_ptrcfg was NULL.
k_ra8_err_invalid_argport_count zero or mtu_bytes zero.
k_ra8_err_existsDriver already opened.
Precondition
Single-threaded init context.
Postcondition
Driver in open state.
ra8_layer3_switch_close will succeed.
Note
Not thread-safe.
Since
0.1.0

Definition at line 34 of file ra8_layer3_switch.c.

References k_ra8_err_exists, k_ra8_err_invalid_arg, k_ra8_ok, ra8_layer3_switch_cfg_t::mtu_bytes, ra8_layer3_switch_cfg_t::port_count, ra8_layer3_switch_cfg_t::promiscuous, RA8_CHECK_NULL_PTR, ra8_log_info_val, s_state, and s_tag.

Referenced by l3_run_facade().

◆ ra8_layer3_switch_route_add()

ra8_err_t ra8_layer3_switch_route_add ( const ra8_layer3_switch_route_t * route)
nodiscard

Add a route to the forwarding table.

Parameters
[in]routeRoute entry. Must not be NULL.
Returns
ra8_err_t error code.
Return values
k_ra8_err_null_ptrroute was NULL.
k_ra8_err_not_initializedDriver was never opened.
k_ra8_err_not_supportedPlaceholder.
Precondition
ra8_layer3_switch_open succeeded.
Postcondition
On real silicon: route installed.
Note
Not thread-safe.
Since
0.1.0

Definition at line 52 of file ra8_layer3_switch.c.

References k_ra8_err_not_initialized, k_ra8_err_not_supported, RA8_CHECK_NULL_PTR, s_state, and s_tag.

Referenced by l3_run_facade().

◆ ra8_layer3_switch_route_delete()

ra8_err_t ra8_layer3_switch_route_delete ( uint32_t dst_ip,
uint32_t mask )
nodiscard

Remove a route from the forwarding table.

Parameters
[in]dst_ipDestination IPv4 of the route to drop.
[in]maskSubnet mask of the route to drop.
Returns
ra8_err_t error code.
Return values
k_ra8_err_not_initializedDriver was never opened.
k_ra8_err_not_supportedPlaceholder.
Precondition
ra8_layer3_switch_open succeeded.
Postcondition
On real silicon: route removed.
Note
Not thread-safe.
Since
0.1.0

Definition at line 61 of file ra8_layer3_switch.c.

References k_ra8_err_not_initialized, k_ra8_err_not_supported, and s_state.

◆ ra8_layer3_switch_status_get()

ra8_err_t ra8_layer3_switch_status_get ( uint8_t * out_open,
uint8_t * out_promisc )
nodiscard

Snapshot the open / promiscuous flags.

Parameters
[out]out_openReceives 1 if open.
[out]out_promiscReceives 1 if promiscuous mode is active.
Returns
ra8_err_t error code.
Return values
k_ra8_okStatus copied.
k_ra8_err_null_ptrEither pointer NULL.
Precondition
Pointers reference writable memory.
Postcondition
*out_open and *out_promisc reflect driver state.
Note
Not thread-safe.
Since
0.1.0

Definition at line 71 of file ra8_layer3_switch.c.

References k_ra8_ok, RA8_CHECK_NULL_PTR, s_state, and s_tag.

Referenced by l3_run_facade().