Lines Matching +full:dummy +full:- +full:bytes +full:- +full:count

4  * SPDX-License-Identifier: Apache-2.0
29 #include <zephyr/net/dummy.h>
99 if (!pkt->buffer) { in slip_send()
101 return -ENODATA; in slip_send()
106 for (buf = pkt->buffer; buf; buf = buf->frags) { in slip_send()
107 ptr = buf->data; in slip_send()
108 for (i = 0U; i < buf->len; ++i) { in slip_send()
114 LOG_DBG("sent data %d bytes", buf->len); in slip_send()
116 if (buf->len) { in slip_send()
117 LOG_HEXDUMP_DBG(buf->data, in slip_send()
118 buf->len, "<slip "); in slip_send()
130 if (slip->last && slip->last->len) { in slip_poll_handler()
131 return slip->rx; in slip_poll_handler()
143 iface = net_eth_get_vlan_iface(context->iface, vlan_tag); in get_iface()
145 return context->iface; in get_iface()
152 return context->iface; in get_iface()
162 if (!pkt || !pkt->buffer) { in process_msg()
170 if (ntohs(hdr->type) == NET_ETH_PTYPE_VLAN) { in process_msg()
174 net_pkt_set_vlan_tci(pkt, ntohs(hdr_vlan->vlan.tci)); in process_msg()
184 slip->rx = NULL; in process_msg()
185 slip->last = NULL; in process_msg()
191 switch (slip->state) { in slip_input_byte()
194 slip->state = STATE_OK; in slip_input_byte()
204 slip->state = STATE_GARBAGE; in slip_input_byte()
205 SLIP_STATS(slip->garbage++); in slip_input_byte()
209 slip->state = STATE_OK; in slip_input_byte()
214 slip->state = STATE_ESC; in slip_input_byte()
219 slip->state = STATE_OK; in slip_input_byte()
220 slip->first = false; in slip_input_byte()
222 if (slip->rx) { in slip_input_byte()
229 if (slip->first && !slip->rx) { in slip_input_byte()
234 if (!slip->first) { in slip_input_byte()
235 slip->first = true; in slip_input_byte()
237 slip->rx = net_pkt_rx_alloc_on_iface(slip->iface, in slip_input_byte()
239 if (!slip->rx) { in slip_input_byte()
244 slip->last = net_pkt_get_frag(slip->rx, SLIP_FRAG_LEN, in slip_input_byte()
246 if (!slip->last) { in slip_input_byte()
249 net_pkt_unref(slip->rx); in slip_input_byte()
250 slip->rx = NULL; in slip_input_byte()
254 net_pkt_append_buffer(slip->rx, slip->last); in slip_input_byte()
255 slip->ptr = net_pkt_ip_data(slip->rx); in slip_input_byte()
261 /* It is possible that slip->last is not set during the startup in slip_input_byte()
265 if (!slip->last) { in slip_input_byte()
269 if (!net_buf_tailroom(slip->last)) { in slip_input_byte()
276 net_pkt_unref(slip->rx); in slip_input_byte()
277 slip->rx = NULL; in slip_input_byte()
278 slip->last = NULL; in slip_input_byte()
283 net_buf_frag_insert(slip->last, buf); in slip_input_byte()
284 slip->last = buf; in slip_input_byte()
285 slip->ptr = slip->last->data; in slip_input_byte()
291 if (slip->ptr < slip->last->data) { in slip_input_byte()
292 *slip->ptr = c; in slip_input_byte()
294 slip->ptr = net_buf_add_u8(slip->last, c); in slip_input_byte()
297 slip->ptr++; in slip_input_byte()
308 if (!slip->init_done) { in recv_cb()
317 struct net_buf *rx_buf = slip->rx->buffer; in recv_cb()
318 int bytes = net_buf_frags_len(rx_buf); in recv_cb() local
319 int count = 0; in recv_cb() local
321 while (bytes && rx_buf) { in recv_cb()
325 ">slip %2d", count); in recv_cb()
327 LOG_HEXDUMP_DBG(rx_buf->data, rx_buf->len, in recv_cb()
330 rx_buf = rx_buf->frags; in recv_cb()
331 count++; in recv_cb()
334 LOG_DBG("[%p] received data %d bytes", slip, in recv_cb()
335 bytes); in recv_cb()
350 struct slip_context *slip = dev->data; in slip_init()
354 slip->state = STATE_OK; in slip_init()
355 slip->rx = NULL; in slip_init()
356 slip->first = false; in slip_init()
362 uart_pipe_register(slip->buf, sizeof(slip->buf), recv_cb); in slip_init()
369 slip->ll_addr.addr = slip->mac_addr; in slip_get_mac()
370 slip->ll_addr.len = sizeof(slip->mac_addr); in slip_get_mac()
372 return &slip->ll_addr; in slip_get_mac()
377 struct slip_context *slip = net_if_get_device(iface)->data; in slip_iface_init()
388 if (slip->init_done) { in slip_iface_init()
394 slip->init_done = true; in slip_iface_init()
395 slip->iface = iface; in slip_iface_init()
398 if (net_bytes_from_str(slip->mac_addr, sizeof(slip->mac_addr), in slip_iface_init()
404 /* 00-00-5E-00-53-xx Documentation RFC 7042 */ in slip_iface_init()
405 slip->mac_addr[0] = 0x00; in slip_iface_init()
406 slip->mac_addr[1] = 0x00; in slip_iface_init()
407 slip->mac_addr[2] = 0x5E; in slip_iface_init()
408 slip->mac_addr[3] = 0x00; in slip_iface_init()
409 slip->mac_addr[4] = 0x53; in slip_iface_init()
410 slip->mac_addr[5] = sys_rand8_get(); in slip_iface_init()
412 net_if_set_link_addr(iface, ll_addr->addr, ll_addr->len, in slip_iface_init()