Lines Matching refs:pkt
42 struct net_pkt *pkt; /* Reassemble packet */ member
229 static void update_protocol_header_lengths(struct net_pkt *pkt, uint16_t size) in update_protocol_header_lengths() argument
234 ipv6 = (struct net_ipv6_hdr *)net_pkt_get_data(pkt, &ipv6_access); in update_protocol_header_lengths()
240 net_pkt_set_ip_hdr_len(pkt, NET_IPV6H_LEN); in update_protocol_header_lengths()
243 net_pkt_set_data(pkt, &ipv6_access); in update_protocol_header_lengths()
249 udp = (struct net_udp_hdr *)net_pkt_get_data(pkt, &udp_access); in update_protocol_header_lengths()
252 net_pkt_set_data(pkt, &udp_access); in update_protocol_header_lengths()
268 if (cache[i].pkt) { in clear_reass_cache()
269 net_pkt_unref(cache[i].pkt); in clear_reass_cache()
272 cache[i].pkt = NULL; in clear_reass_cache()
289 if (fcache->pkt) { in reass_timeout()
290 net_pkt_unref(fcache->pkt); in reass_timeout()
293 fcache->pkt = NULL; in reass_timeout()
304 static inline struct frag_cache *set_reass_cache(struct net_pkt *pkt, uint16_t size, uint16_t tag) in set_reass_cache() argument
313 cache[i].pkt = pkt; in set_reass_cache()
345 static inline void fragment_append(struct net_pkt *pkt, struct net_buf *frag) in fragment_append() argument
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()
358 static inline size_t fragment_cached_pkt_len(struct net_pkt *pkt) in fragment_cached_pkt_len() argument
365 frag = pkt->buffer; in fragment_cached_pkt_len()
381 data = pkt->buffer->data; in fragment_cached_pkt_len()
382 pkt->buffer->data += NET_6LO_FRAG1_HDR_LEN; in fragment_cached_pkt_len()
384 hdr_diff = net_6lo_uncompress_hdr_diff(pkt); in fragment_cached_pkt_len()
386 pkt->buffer->data = data; in fragment_cached_pkt_len()
404 static void fragment_move_back(struct net_pkt *pkt, struct net_buf *frag, struct net_buf *stop) in fragment_move_back() argument
409 current = pkt->buffer; in fragment_move_back()
426 static inline void fragment_remove_headers(struct net_pkt *pkt) in fragment_remove_headers() argument
430 frag = pkt->buffer; in fragment_remove_headers()
445 static inline void fragment_reconstruct_packet(struct net_pkt *pkt) in fragment_reconstruct_packet() argument
450 current = pkt->buffer; in fragment_reconstruct_packet()
458 fragment_move_back(pkt, current, prev); in fragment_reconstruct_packet()
465 fragment_remove_headers(pkt); in fragment_reconstruct_packet()
468 static inline bool fragment_packet_valid(struct net_pkt *pkt) in fragment_packet_valid() argument
470 return (get_datagram_type(pkt->buffer->data) == NET_6LO_DISPATCH_FRAG1); in fragment_packet_valid()
481 static inline enum net_verdict fragment_add_to_cache(struct net_pkt *pkt) in fragment_add_to_cache() argument
490 frag = pkt->buffer; in fragment_add_to_cache()
508 pkt->buffer = NULL; in fragment_add_to_cache()
512 fcache = set_reass_cache(pkt, size, tag); 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()
526 if (fragment_cached_pkt_len(fcache->pkt) == fcache->size) { in fragment_add_to_cache()
531 pkt->buffer = fcache->pkt->buffer; in fragment_add_to_cache()
532 fcache->pkt->buffer = NULL; in fragment_add_to_cache()
537 fcache->pkt = NULL; in fragment_add_to_cache()
542 if (!fragment_packet_valid(pkt)) { in fragment_add_to_cache()
547 fragment_reconstruct_packet(pkt); in fragment_add_to_cache()
549 if (!net_6lo_uncompress(pkt)) { in fragment_add_to_cache()
554 net_pkt_cursor_init(pkt); in fragment_add_to_cache()
556 update_protocol_header_lengths(pkt, size); in fragment_add_to_cache()
558 net_pkt_cursor_init(pkt); in fragment_add_to_cache()
567 net_pkt_unref(pkt); in fragment_add_to_cache()
573 enum net_verdict ieee802154_6lo_reassemble(struct net_pkt *pkt) in ieee802154_6lo_reassemble() argument
575 if (!pkt || !pkt->buffer) { in ieee802154_6lo_reassemble()
580 if (get_datagram_type(pkt->buffer->data) >= NET_6LO_DISPATCH_FRAG1) { in ieee802154_6lo_reassemble()
581 return fragment_add_to_cache(pkt); in ieee802154_6lo_reassemble()
583 NET_DBG("No frag dispatch (%02x)", pkt->buffer->data[0]); in ieee802154_6lo_reassemble()
585 if (net_6lo_uncompress(pkt)) { in ieee802154_6lo_reassemble()