Skip to content

Commit 0501be8

Browse files
yangbolu1991henrikbrixandersen
authored andcommitted
net: ethernet: use void pointer for dsa switch context
In ethernet_context structure, it just needs a void pointer for dsa switch context. Signed-off-by: Yangbo Lu <[email protected]>
1 parent e0c5c27 commit 0501be8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

drivers/ethernet/nxp_imx_netc/eth_nxp_imx_netc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static int netc_eth_rx(const struct device *dev)
7878
struct net_if *iface_dst = data->iface;
7979
#if defined(NETC_HAS_NO_SWITCH_TAG_SUPPORT)
8080
struct ethernet_context *ctx = net_if_l2_data(iface_dst);
81+
struct dsa_switch_context *dsa_switch_ctx = ctx->dsa_switch_ctx;
8182
#endif
8283
netc_frame_attr_t attr = {0};
8384
struct net_pkt *pkt;
@@ -111,7 +112,7 @@ static int netc_eth_rx(const struct device *dev)
111112

112113
#if defined(NETC_HAS_NO_SWITCH_TAG_SUPPORT)
113114
if (ctx->dsa_port == DSA_CONDUIT_PORT) {
114-
iface_dst = ctx->dsa_switch_ctx->iface_user[attr.srcPort];
115+
iface_dst = dsa_switch_ctx->iface_user[attr.srcPort];
115116
}
116117
#endif
117118
/* Copy to pkt */

include/zephyr/net/ethernet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ struct ethernet_context {
699699
enum dsa_port_type dsa_port;
700700

701701
/** DSA switch context pointer */
702-
struct dsa_switch_context *dsa_switch_ctx;
702+
void *dsa_switch_ctx;
703703
#endif
704704

705705
/** Is network carrier up */

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct dsa_tag_netc_to_port_header {
2828
struct net_if *dsa_tag_netc_recv(struct net_if *iface, struct net_pkt *pkt)
2929
{
3030
struct ethernet_context *eth_ctx = net_if_l2_data(iface);
31+
struct dsa_switch_context *dsa_switch_ctx = eth_ctx->dsa_switch_ctx;
3132
uint16_t header_len = sizeof(struct dsa_tag_netc_to_host_header);
3233
struct dsa_tag_netc_to_host_header *header;
3334
struct net_if *iface_dst = iface;
@@ -40,7 +41,7 @@ struct net_if *dsa_tag_netc_recv(struct net_if *iface, struct net_pkt *pkt)
4041

4142
/* redirect to user port */
4243
header = (struct dsa_tag_netc_to_host_header *)pkt->frags->data;
43-
iface_dst = eth_ctx->dsa_switch_ctx->iface_user[header->tag.comTag.port];
44+
iface_dst = dsa_switch_ctx->iface_user[header->tag.comTag.port];
4445

4546
/* drop tag */
4647
ptr = net_buf_pull(pkt->frags, sizeof(netc_swt_tag_host_t));

0 commit comments

Comments
 (0)