Lines Matching refs:frag
95 static inline void set_up_frag_hdr(struct net_buf *frag, uint16_t size, uint8_t offset) in set_up_frag_hdr() argument
100 uint8_t pos = frag->len; in set_up_frag_hdr()
104 net_buf_add(frag, NET_6LO_FRAG1_HDR_LEN); in set_up_frag_hdr()
105 frag->data[pos] = NET_6LO_DISPATCH_FRAG1; in set_up_frag_hdr()
107 net_buf_add(frag, NET_6LO_FRAGN_HDR_LEN); in set_up_frag_hdr()
108 frag->data[pos] = NET_6LO_DISPATCH_FRAGN; in set_up_frag_hdr()
111 set_datagram_size(frag->data + pos, size); in set_up_frag_hdr()
114 set_datagram_tag(frag->data + pos, datagram_tag); in set_up_frag_hdr()
118 frag->data[pos] = offset; in set_up_frag_hdr()
122 static inline uint8_t calc_payload_capacity(struct net_buf *frag) in calc_payload_capacity() argument
124 uint8_t capacity = frag->size - frag->len; in calc_payload_capacity()
345 static inline void fragment_append(struct net_pkt *pkt, struct net_buf *frag) in fragment_append() argument
347 if (get_datagram_type(frag->data) == NET_6LO_DISPATCH_FRAG1) { in fragment_append()
351 frag->frags = pkt->buffer; in fragment_append()
352 pkt->buffer = frag; in fragment_append()
354 net_pkt_append_buffer(pkt, frag); in fragment_append()
361 struct net_buf *frag; in fragment_cached_pkt_len() local
365 frag = pkt->buffer; in fragment_cached_pkt_len()
366 while (frag) { in fragment_cached_pkt_len()
369 if (get_datagram_type(frag->data) == NET_6LO_DISPATCH_FRAG1) { in fragment_cached_pkt_len()
373 len += frag->len - frag_hdr_len; in fragment_cached_pkt_len()
375 frag = frag->frags; in fragment_cached_pkt_len()
395 static inline uint16_t fragment_offset(struct net_buf *frag) in fragment_offset() argument
397 if (get_datagram_type(frag->data) == NET_6LO_DISPATCH_FRAG1) { in fragment_offset()
401 return ((uint16_t)frag->data[NET_FRAG_OFFSET_POS] << 3); in fragment_offset()
404 static void fragment_move_back(struct net_pkt *pkt, struct net_buf *frag, struct net_buf *stop) in fragment_move_back() argument
412 if (fragment_offset(frag) < fragment_offset(current)) { in fragment_move_back()
414 prev->frags = frag; in fragment_move_back()
417 frag->frags = current; in fragment_move_back()
428 struct net_buf *frag; in fragment_remove_headers() local
430 frag = pkt->buffer; in fragment_remove_headers()
431 while (frag) { in fragment_remove_headers()
434 if (get_datagram_type(frag->data) == NET_6LO_DISPATCH_FRAG1) { in fragment_remove_headers()
438 memmove(frag->data, frag->data + frag_hdr_len, frag->len - frag_hdr_len); in fragment_remove_headers()
439 frag->len -= frag_hdr_len; in fragment_remove_headers()
441 frag = frag->frags; in fragment_remove_headers()
485 struct net_buf *frag; in fragment_add_to_cache() local
490 frag = pkt->buffer; in fragment_add_to_cache()
491 type = get_datagram_type(frag->data); in fragment_add_to_cache()
493 if ((type == NET_6LO_DISPATCH_FRAG1 && frag->len < NET_6LO_FRAG1_HDR_LEN) || in fragment_add_to_cache()
494 (type == NET_6LO_DISPATCH_FRAGN && frag->len < NET_6LO_FRAGN_HDR_LEN)) { in fragment_add_to_cache()
495 NET_ERR("Fragment too short (%u): fragment dropped", frag->len); in fragment_add_to_cache()
500 size = get_datagram_size(frag->data); in fragment_add_to_cache()
503 tag = get_datagram_tag(frag->data + NET_6LO_FRAG_DATAGRAM_SIZE_LEN); in fragment_add_to_cache()
517 pkt->buffer = frag; in fragment_add_to_cache()
524 fragment_append(fcache->pkt, frag); in fragment_add_to_cache()