Skip to content

Commit eabc1b3

Browse files
yangbolu1991nashif
authored andcommitted
net: dsa: support tagger data and connecting device to tag protocol
Supported tagger data and connecting device to tag protocol, so that some device specific work could be handled. Signed-off-by: Yangbo Lu <[email protected]>
1 parent ea6bdfe commit eabc1b3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/zephyr/net/dsa_core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ struct dsa_switch_context {
8989

9090
/** Number of initialized ports in the DSA switch */
9191
uint8_t init_ports;
92+
93+
/** DSA tagger data provided by instance when connecting to tag protocol */
94+
void *tagger_data;
9295
};
9396

9497
/**
@@ -116,6 +119,9 @@ struct dsa_api {
116119

117120
/** Switch setup */
118121
int (*switch_setup)(const struct dsa_switch_context *dsa_switch_ctx);
122+
123+
/** Connect the switch to the tag protocol */
124+
int (*connect_tag_protocol)(struct dsa_switch_context *dsa_switch_ctx, int tag_proto);
119125
};
120126

121127
/**

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ void dsa_tag_setup(const struct device *dev_cpu)
6060
default:
6161
LOG_ERR("DSA tag protocol %d not supported", cfg->tag_proto);
6262
}
63+
64+
if (dsa_switch_ctx->dapi->connect_tag_protocol != NULL &&
65+
dsa_switch_ctx->dapi->connect_tag_protocol(dsa_switch_ctx, cfg->tag_proto) != 0) {
66+
LOG_ERR("Failed to connect tag protocol");
67+
}
6368
}

0 commit comments

Comments
 (0)