Lines Matching +full:dsa +full:- +full:slave +full:- +full:ports
2 * @brief DSA related functions
8 * SPDX-License-Identifier: Apache-2.0
20 #include <zephyr/net/dsa.h>
30 ctx->dsa_send = fn; in dsa_register_master_tx()
56 * RECEIVE HANDLING CODE - ingress (ETH -> DSA slave ports)
62 return -ENOENT; in dsa_check_iface()
67 return -ESRCH; in dsa_check_iface()
86 ctx->dsa_recv_cb = cb; in dsa_register_recv_callback()
104 ctx = c->dsa_ctx; in dsa_net_recv()
106 if (ctx == NULL || ctx->dapi == NULL) { in dsa_net_recv()
110 if (ctx->dapi->dsa_get_iface == NULL) { in dsa_net_recv()
111 NET_ERR("DSA: No callback to set LAN interfaces!"); in dsa_net_recv()
115 iface_sw = ctx->dapi->dsa_get_iface(iface, *pkt); in dsa_net_recv()
128 * protocols - i.e. UDP. ICMP, TCP. in dsa_net_recv()
131 if (c->dsa_recv_cb) { in dsa_net_recv()
132 if (c->dsa_recv_cb(iface_sw, *pkt)) { in dsa_net_recv()
141 * TRANSMISSION HANDLING CODE egress (DSA slave ports -> ETH)
154 * The wrapper (i.e. dsa_tx()) is needed to modify packet - in dsa_tx()
158 context = ctx->dsa_ctx; in dsa_tx()
159 return ctx->dsa_send(dev, in dsa_tx()
160 context->dapi->dsa_xmit_pkt(iface, pkt)); in dsa_tx()
163 context = dev->data; in dsa_tx()
164 iface_master = context->iface_master; in dsa_tx()
167 NET_ERR("DSA: No master interface!"); in dsa_tx()
168 return -ENODEV; in dsa_tx()
180 /* Adjust packet for DSA routing and send it via master interface */ in dsa_tx()
182 return ctx->dsa_send(net_if_get_device(iface_master), in dsa_tx()
183 context->dapi->dsa_xmit_pkt(iface, pkt)); in dsa_tx()
197 dsa_ctx = eth_ctx->dsa_ctx; in dsa_get_slave_port()
199 if (slave_num < 0 || slave_num >= dsa_ctx->num_slave_ports) { in dsa_get_slave_port()
203 return dsa_ctx->iface_slave[slave_num]; in dsa_get_slave_port()
209 struct dsa_context *context = dev->data; in dsa_switch_read()
211 (const struct dsa_api *)context->dapi; in dsa_switch_read()
213 return api->switch_read(dev, reg_addr, value); in dsa_switch_read()
219 struct dsa_context *context = dev->data; in dsa_switch_write()
221 (const struct dsa_api *)context->dapi; in dsa_switch_write()
223 return api->switch_write(dev, reg_addr, value); in dsa_switch_write()
229 * @param iface DSA interface
244 struct dsa_context *context = dev->data; in dsa_switch_set_mac_table_entry()
246 (const struct dsa_api *)context->dapi; in dsa_switch_set_mac_table_entry()
248 return api->switch_set_mac_table_entry(dev, mac, fw_port, in dsa_switch_set_mac_table_entry()
255 * @param iface DSA interface
266 struct dsa_context *context = dev->data; in dsa_switch_get_mac_table_entry()
268 (const struct dsa_api *)context->dapi; in dsa_switch_get_mac_table_entry()
270 return api->switch_get_mac_table_entry(dev, buf, tbl_entry_idx); in dsa_switch_get_mac_table_entry()