Lines Matching +full:pkt +full:- +full:size
3 /*-
4 * SPDX-License-Identifier: BSD-2-Clause
40 packet_t *pkt; in packet_alloc() local
42 pkt = malloc(sizeof(packet_t) + chan->mru); in packet_alloc()
43 if (pkt == NULL) { in packet_alloc()
48 memset(pkt, 0, sizeof(packet_t)); in packet_alloc()
49 STAILQ_INIT(&pkt->extlist); in packet_alloc()
50 pkt->ptr = pkt->buf; in packet_alloc()
52 pkt->chan = chan; in packet_alloc()
53 chan->refcnt++; in packet_alloc()
55 return pkt; in packet_alloc()
59 packet_free(packet_t *pkt) in packet_free() argument
63 if (pkt->refcnt-- > 0) in packet_free()
66 while ((eh = STAILQ_FIRST(&pkt->extlist)) != NULL) { in packet_free()
67 STAILQ_REMOVE_HEAD(&pkt->extlist, next); in packet_free()
71 pkt->chan->refcnt--; in packet_free()
72 if (pkt->chan->refcnt == 0) in packet_free()
73 channel_free(pkt->chan); in packet_free()
75 free(pkt); in packet_free()
79 packet_adj(packet_t *pkt, size_t size) in packet_adj() argument
82 assert(pkt->refcnt == 0); in packet_adj()
83 assert(pkt->len >= size); in packet_adj()
85 pkt->ptr += size; in packet_adj()
86 pkt->len -= size; in packet_adj()
90 pkthdr_alloc(packet_t *pkt) in pkthdr_alloc() argument
100 ph->data = pkt; in pkthdr_alloc()
101 pkt->refcnt++; in pkthdr_alloc()
110 packet_free(ph->data); in pkthdr_free()