Lines Matching full:ctx
26 struct virtual_interface_context *ctx, *tmp; in virtual_recv() local
33 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(interfaces, ctx, tmp, node) { in virtual_recv()
34 if (ctx->virtual_iface == NULL) { in virtual_recv()
38 api = net_if_get_device(ctx->virtual_iface)->api; in virtual_recv()
43 if (!net_if_is_up(ctx->virtual_iface)) { in virtual_recv()
45 net_if_get_by_iface(ctx->virtual_iface)); in virtual_recv()
49 verdict = api->recv(ctx->virtual_iface, pkt); in virtual_recv()
61 net_stats_update_bytes_recv(ctx->virtual_iface, in virtual_recv()
66 net_stats_update_processing_error(ctx->virtual_iface); in virtual_recv()
112 struct virtual_interface_context *ctx; in virtual_enable() local
120 ctx = net_if_l2_data(iface); in virtual_enable()
127 while (ctx->iface) { in virtual_enable()
128 if (net_if_is_up(ctx->iface)) { in virtual_enable()
135 if (net_if_l2(ctx->iface) != in virtual_enable()
137 net_if_up(ctx->iface); in virtual_enable()
141 NET_DBG("Taking iface %d up", net_if_get_by_iface(ctx->iface)); in virtual_enable()
143 net_if_up(ctx->iface); in virtual_enable()
144 ctx = net_if_l2_data(ctx->iface); in virtual_enable()
163 struct virtual_interface_context *ctx = net_if_l2_data(iface); in virtual_flags() local
165 return ctx->virtual_l2_flags; in virtual_flags()
196 struct virtual_interface_context *ctx; in net_virtual_interface_attach() local
213 ctx = net_if_l2_data(virtual_iface); in net_virtual_interface_attach()
215 if (ctx->iface) { in net_virtual_interface_attach()
225 &ctx->iface->config.virtual_interfaces, in net_virtual_interface_attach()
226 &ctx->node); in net_virtual_interface_attach()
230 net_if_get_by_iface(ctx->iface)); in net_virtual_interface_attach()
232 ctx->iface = NULL; in net_virtual_interface_attach()
241 ctx->iface = iface; in net_virtual_interface_attach()
242 sys_slist_append(&ctx->iface->config.virtual_interfaces, in net_virtual_interface_attach()
243 &ctx->node); in net_virtual_interface_attach()
247 net_if_get_by_iface(ctx->iface)); in net_virtual_interface_attach()
259 random_linkaddr(ctx->lladdr.addr, sizeof(ctx->lladdr.addr)); in net_virtual_interface_attach()
261 ctx->lladdr.len = sizeof(ctx->lladdr.addr); in net_virtual_interface_attach()
262 ctx->lladdr.type = NET_LINK_UNKNOWN; in net_virtual_interface_attach()
264 net_if_set_link_addr(virtual_iface, ctx->lladdr.addr, in net_virtual_interface_attach()
265 ctx->lladdr.len, ctx->lladdr.type); in net_virtual_interface_attach()
280 struct virtual_interface_context *ctx, *tmp; in net_virtual_disable() local
288 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(interfaces, ctx, tmp, node) { in net_virtual_disable()
291 net_if_get_by_iface(ctx->virtual_iface)); in net_virtual_disable()
292 net_if_carrier_off(ctx->virtual_iface); in net_virtual_disable()
298 struct virtual_interface_context *ctx, *tmp; in net_virtual_enable() local
306 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(interfaces, ctx, tmp, node) { in net_virtual_enable()
309 net_if_get_by_iface(ctx->virtual_iface)); in net_virtual_enable()
310 net_if_carrier_on(ctx->virtual_iface); in net_virtual_enable()
316 struct virtual_interface_context *ctx; in net_virtual_get_iface() local
326 ctx = net_if_l2_data(iface); in net_virtual_get_iface()
328 return ctx->iface; in net_virtual_get_iface()
333 struct virtual_interface_context *ctx; in net_virtual_get_name() local
343 ctx = net_if_l2_data(iface); in net_virtual_get_name()
345 strncpy(buf, ctx->name, MIN(len, sizeof(ctx->name))); in net_virtual_get_name()
353 struct virtual_interface_context *ctx; in net_virtual_set_name() local
363 ctx = net_if_l2_data(iface); in net_virtual_set_name()
365 strncpy(ctx->name, name, CONFIG_NET_L2_VIRTUAL_MAX_NAME_LEN); in net_virtual_set_name()
366 ctx->name[CONFIG_NET_L2_VIRTUAL_MAX_NAME_LEN - 1] = '\0'; in net_virtual_set_name()
372 struct virtual_interface_context *ctx; in net_virtual_set_flags() local
383 ctx = net_if_l2_data(iface); in net_virtual_set_flags()
384 old_flags = ctx->virtual_l2_flags; in net_virtual_set_flags()
385 ctx->virtual_l2_flags = flags; in net_virtual_set_flags()
392 struct virtual_interface_context *ctx; in net_virtual_init() local
400 ctx = net_if_l2_data(iface); in net_virtual_init()
401 if (ctx->is_init) { in net_virtual_init()
405 NET_DBG("Initializing virtual L2 %p for iface %d (%p)", ctx, in net_virtual_init()
408 ctx->virtual_iface = iface; in net_virtual_init()
409 ctx->virtual_l2_flags = 0; in net_virtual_init()
410 ctx->is_init = true; in net_virtual_init()