From 4eb1669ac683691dfeded96826cfdb66cd595e10 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Thu, 20 Mar 2025 17:43:30 +0800 Subject: [PATCH] samples: net: dsa: convert to new dsa core driver Converted to new dsa core driver. And adapted mimxrt1180_evk to it. Signed-off-by: Yangbo Lu --- samples/net/dsa/boards/ip_k66f.conf | 1 + samples/net/dsa/prj.conf | 1 - samples/net/dsa/src/dsa.h | 4 ++++ samples/net/dsa/src/main.c | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/net/dsa/boards/ip_k66f.conf b/samples/net/dsa/boards/ip_k66f.conf index eb7d269a4e1..a4407f29db3 100644 --- a/samples/net/dsa/boards/ip_k66f.conf +++ b/samples/net/dsa/boards/ip_k66f.conf @@ -5,6 +5,7 @@ CONFIG_SHELL_BACKEND_RTT=y CONFIG_SHELL_BACKEND_SERIAL=n CONFIG_LOG_BACKEND_RTT=n +CONFIG_NET_DSA_DEPRECATED=y CONFIG_NET_CONFIG_SETTINGS=y CONFIG_NET_CONFIG_NEED_IPV6=y CONFIG_NET_CONFIG_NEED_IPV4=y diff --git a/samples/net/dsa/prj.conf b/samples/net/dsa/prj.conf index f55de37694e..39edbd32639 100644 --- a/samples/net/dsa/prj.conf +++ b/samples/net/dsa/prj.conf @@ -25,7 +25,6 @@ CONFIG_NET_SHELL=y # DSA support CONFIG_NET_DSA=y -CONFIG_NET_DSA_DEPRECATED=y # Ethernet is needed for LLDP CONFIG_NET_L2_ETHERNET=y diff --git a/samples/net/dsa/src/dsa.h b/samples/net/dsa/src/dsa.h index ea2d345428b..cd8a28bca45 100644 --- a/samples/net/dsa/src/dsa.h +++ b/samples/net/dsa/src/dsa.h @@ -8,7 +8,11 @@ #ifndef __DSA_SAMPLE__ #define __DSA_SAMPLE__ +#if defined(CONFIG_NET_DSA_DEPRECATED) #include +#else +#include +#endif #include extern struct ud user_data; diff --git a/samples/net/dsa/src/main.c b/samples/net/dsa/src/main.c index 4199d3991bf..5e13473d374 100644 --- a/samples/net/dsa/src/main.c +++ b/samples/net/dsa/src/main.c @@ -30,7 +30,11 @@ static void dsa_iface_find_cb(struct net_if *iface, void *user_data) /* Get user interfaces */ for (int i = 0; i < ARRAY_SIZE(ifaces->lan); i++) { +#if defined(CONFIG_NET_DSA_DEPRECATED) struct net_if *user = dsa_get_slave_port(iface, i); +#else + struct net_if *user = dsa_user_get_iface(iface, i); +#endif if (user == NULL) { continue;