Skip to content

Commit c4de410

Browse files
committed
net: dsa: add dsa_cpu_iface in ethernet context
Added dsa_cpu_iface in ethernet context. Signed-off-by: Yangbo Lu <[email protected]>
1 parent 72172ad commit c4de410

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

include/zephyr/net/ethernet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,9 @@ struct ethernet_context {
700700

701701
/** DSA switch context pointer */
702702
struct dsa_switch_context *dsa_switch_ctx;
703+
704+
/** DSA CPU port connected. */
705+
struct net_if *dsa_cpu_iface;
703706
#endif
704707

705708
/** Is network carrier up */

subsys/net/l2/ethernet/dsa/dsa_port.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int dsa_port_initialize(const struct device *dev)
2828

2929
dsa_switch_ctx->init_ports++;
3030

31-
/* Find conduit port */
31+
/* Find the connection of conduit port and cpu port */
3232
if (dsa_switch_ctx->iface_conduit == NULL && cfg->ethernet_connection != NULL) {
3333
dsa_switch_ctx->iface_conduit = net_if_lookup_by_dev(cfg->ethernet_connection);
3434
if (dsa_switch_ctx->iface_conduit == NULL) {
@@ -37,13 +37,11 @@ int dsa_port_initialize(const struct device *dev)
3737

3838
eth_ctx->dsa_port = DSA_CPU_PORT;
3939

40-
/*
41-
* Provide pointer to DSA switch context to conduit's eth interface
42-
* struct ethernet_context
43-
*/
40+
/* Provide DSA information to the conduit port */
4441
eth_ctx_conduit = net_if_l2_data(dsa_switch_ctx->iface_conduit);
4542
eth_ctx_conduit->dsa_switch_ctx = dsa_switch_ctx;
4643
eth_ctx_conduit->dsa_port = DSA_CONDUIT_PORT;
44+
eth_ctx_conduit->dsa_cpu_iface = iface;
4745
}
4846

4947
if (cfg->ethernet_connection == NULL) {

0 commit comments

Comments
 (0)