Lines Matching +full:dummy +full:- +full:bytes +full:- +full:count
4 * SPDX-License-Identifier: Apache-2.0
44 /* -1 is used as a not configured link type */
54 struct cooked_context *ctx = net_if_get_device(iface)->data; in iface_init()
66 if (net_if_l2(net_if_get_by_index(ifindex)) != &NET_L2_GET_NAME(DUMMY)) { in iface_init()
71 if (ctx->init_done) { in iface_init()
75 ctx->iface = iface; in iface_init()
90 ret = net_virtual_interface_attach(ctx->iface, any_iface); in iface_init()
98 net_if_get_by_iface(ctx->iface), in iface_init()
101 ctx->init_done = true; in iface_init()
106 struct cooked_context *ctx = dev->data; in dev_init()
108 memset(ctx->link_types, -1, sizeof(ctx->link_types)); in dev_init()
115 struct cooked_context *ctx = dev->data; in interface_start()
118 if (ctx->status) { in interface_start()
119 return -EALREADY; in interface_start()
122 ctx->status = true; in interface_start()
124 NET_DBG("Starting iface %d", net_if_get_by_iface(ctx->iface)); in interface_start()
131 struct cooked_context *ctx = dev->data; in interface_stop()
133 if (!ctx->status) { in interface_stop()
134 return -EALREADY; in interface_stop()
137 ctx->status = false; in interface_stop()
139 NET_DBG("Stopping iface %d", net_if_get_by_iface(ctx->iface)); in interface_stop()
146 struct cooked_context *ctx = net_if_get_device(iface)->data; in interface_recv()
159 for (int i = 0; i < ctx->link_type_count; i++) { in interface_recv()
160 if (ctx->link_types[i] == ptype) { in interface_recv()
194 return -ENOENT; in interface_attach()
197 ctx = net_if_get_device(iface)->data; in interface_attach()
198 ctx->attached_to = lower_iface; in interface_attach()
207 struct cooked_context *ctx = net_if_get_device(iface)->data; in interface_set_config()
211 if (config->link_types.count > ARRAY_SIZE(ctx->link_types)) { in interface_set_config()
212 return -ERANGE; in interface_set_config()
215 for (int i = 0; i < config->link_types.count; i++) { in interface_set_config()
216 NET_DBG("Adding link type %u", config->link_types.type[i]); in interface_set_config()
218 ctx->link_types[i] = (int)config->link_types.type[i]; in interface_set_config()
221 ctx->link_type_count = config->link_types.count; in interface_set_config()
224 for (int i = ctx->link_type_count; i < ARRAY_SIZE(ctx->link_types); i++) { in interface_set_config()
225 ctx->link_types[i] = -1; in interface_set_config()
232 net_if_get_by_iface(iface), config->mtu); in interface_set_config()
233 net_if_set_mtu(iface, config->mtu); in interface_set_config()
240 return -ENOTSUP; in interface_set_config()
247 struct cooked_context *ctx = net_if_get_device(iface)->data; in interface_get_config()
252 for (i = 0; i < ctx->link_type_count; i++) { in interface_get_config()
253 if (ctx->link_types[i] < 0) { in interface_get_config()
257 config->link_types.type[i] = (uint16_t)ctx->link_types[i]; in interface_get_config()
260 config->link_types.count = i; in interface_get_config()
261 NET_ASSERT(config->link_types.count == ctx->link_type_count); in interface_get_config()
265 config->mtu = net_if_get_mtu(iface); in interface_get_config()
272 return -ENOTSUP; in interface_get_config()
299 return -EINVAL; in net_capture_cooked_setup()
304 ctx->hatype = hatype; in net_capture_cooked_setup()
305 ctx->halen = halen; in net_capture_cooked_setup()
307 memcpy(ctx->addr, addr, halen); in net_capture_cooked_setup()
326 hdr1.sll_hatype = htons(ctx->hatype); in create_sll_header()
327 hdr1.sll_halen = htons(ctx->halen); in create_sll_header()
328 memcpy(hdr1.sll_addr, ctx->addr, sizeof(ctx->addr)); in create_sll_header()
338 hdr2.sll2_hatype = htons(ctx->hatype); in create_sll_header()
340 hdr2.sll2_halen = htons(ctx->halen); in create_sll_header()
341 memcpy(hdr2.sll2_addr, ctx->addr, sizeof(ctx->addr)); in create_sll_header()
394 NET_DBG("Cannot allocate %s %zd bytes (%d)", "net_buf for", in net_capture_data()
417 * When using capture API or net-shell capture command, one in net_capture_data()
420 iface = ((struct cooked_context *)dev->data)->attached_to; in net_capture_data()
424 NET_DBG("Cannot write %s %zd bytes (%d)", "header", in net_capture_data()
432 NET_DBG("Cannot write %s %zd bytes (%d)", "payload", in net_capture_data()
449 net_pkt_lladdr_src(pkt)->addr = NULL; in net_capture_data()
450 net_pkt_lladdr_src(pkt)->len = 0U; in net_capture_data()
451 net_pkt_lladdr_src(pkt)->type = NET_LINK_DUMMY; in net_capture_data()
452 net_pkt_lladdr_dst(pkt)->addr = NULL; in net_capture_data()
453 net_pkt_lladdr_dst(pkt)->len = 0U; in net_capture_data()
454 net_pkt_lladdr_dst(pkt)->type = NET_LINK_DUMMY; in net_capture_data()