samples: net: dsa: rename master/slave to conduit/user

Renamed master/slave to conduit/user.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
This commit is contained in:
Yangbo Lu 2025-03-20 17:39:56 +08:00 committed by Benjamin Cabé
commit 14e4e12441
7 changed files with 19 additions and 19 deletions

View file

@ -7,12 +7,12 @@ mainmenu "DSA sample application"
if NET_DSA
config NET_SAMPLE_DSA_MAX_SLAVE_PORTS
int "DSA slave ports maximum number"
config NET_SAMPLE_DSA_MAX_USER_PORTS
int "DSA user ports maximum number"
range 2 10
default 3
help
DSA slave ports maximum number.
DSA user ports maximum number.
config NET_SAMPLE_DSA_LLDP
bool "DSA LLDP example"

View file

@ -2,4 +2,4 @@ CONFIG_NET_IF_MAX_IPV4_COUNT=7
CONFIG_NET_IF_MAX_IPV6_COUNT=7
CONFIG_NET_SAMPLE_DSA_LLDP=n
CONFIG_NET_SAMPLE_DSA_MAX_SLAVE_PORTS=5
CONFIG_NET_SAMPLE_DSA_MAX_USER_PORTS=5

View file

@ -2,4 +2,4 @@ CONFIG_NET_IF_MAX_IPV4_COUNT=7
CONFIG_NET_IF_MAX_IPV6_COUNT=7
CONFIG_NET_SAMPLE_DSA_LLDP=n
CONFIG_NET_SAMPLE_DSA_MAX_SLAVE_PORTS=5
CONFIG_NET_SAMPLE_DSA_MAX_USER_PORTS=5

View file

@ -15,8 +15,8 @@ extern struct ud user_data;
/* User data for the interface callback */
struct ud {
struct net_if *lan[CONFIG_NET_SAMPLE_DSA_MAX_SLAVE_PORTS];
struct net_if *master;
struct net_if *lan[CONFIG_NET_SAMPLE_DSA_MAX_USER_PORTS];
struct net_if *conduit;
};
#endif

View file

@ -54,7 +54,7 @@ enum net_verdict dsa_ll_addr_switch_cb(struct net_if *iface, struct net_pkt *pkt
return NET_OK;
}
int start_slave_port_packet_socket(struct net_if *iface, struct instance_data *pd)
int start_user_port_packet_socket(struct net_if *iface, struct instance_data *pd)
{
struct sockaddr_ll dst;
int ret;
@ -83,7 +83,7 @@ void dsa_lldp(struct ud *user_data)
/*
* Set static table to forward LLDP protocol packets
* to master port.
* to conduit port.
*/
dsa_switch_set_mac_table_entry(user_data->lan[0], &eth_filter_l2_addr_base[0][0], BIT(4), 0,
0);

View file

@ -46,7 +46,7 @@ static inline void dsa_buf_write_be16(uint16_t tl, uint8_t **p)
(*p)++;
}
int start_slave_port_packet_socket(struct net_if *iface, struct instance_data *pd);
int start_user_port_packet_socket(struct net_if *iface, struct instance_data *pd);
enum net_verdict dsa_ll_addr_switch_cb(struct net_if *iface, struct net_pkt *pkt);
@ -74,9 +74,9 @@ void dsa_lldp(struct ud *user_data);
iface = user_data.lan[ID - 1]; \
\
data.if_name = "lan" #ID; \
ret = start_slave_port_packet_socket(iface, &data); \
ret = start_user_port_packet_socket(iface, &data); \
if (ret < 0) { \
LOG_ERR("start_slave_port_packet_socket failed %d", ret); \
LOG_ERR("start_user_port_packet_socket failed %d", ret); \
return; \
} \
dsa_register_recv_callback(iface, dsa_ll_addr_switch_cb); \

View file

@ -25,19 +25,19 @@ static void dsa_iface_find_cb(struct net_if *iface, void *user_data)
}
if (net_eth_get_hw_capabilities(iface) & ETHERNET_DSA_CONDUIT_PORT) {
if (ifaces->master == NULL) {
ifaces->master = iface;
if (ifaces->conduit == NULL) {
ifaces->conduit = iface;
/* Get slave interfaces */
/* Get user interfaces */
for (int i = 0; i < ARRAY_SIZE(ifaces->lan); i++) {
struct net_if *slave = dsa_get_slave_port(iface, i);
struct net_if *user = dsa_get_slave_port(iface, i);
if (slave == NULL) {
if (user == NULL) {
continue;
}
LOG_INF("Slave interface %d found.", i);
LOG_INF("User interface %d found.", i);
ifaces->lan[i] = slave;
ifaces->lan[i] = user;
}
return;
}