Lines Matching +full:ch +full:- +full:func
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
17 * lksctp developers <linux-sctp@vger.kernel.org>
34 INIT_LIST_HEAD(&queue->in_chunk_list); in sctp_inq_init()
35 queue->in_progress = NULL; in sctp_inq_init()
38 INIT_WORK(&queue->immediate, NULL); in sctp_inq_init()
44 if (chunk->head_skb) in sctp_inq_chunk_free()
45 chunk->skb = chunk->head_skb; in sctp_inq_chunk_free()
55 list_for_each_entry_safe(chunk, tmp, &queue->in_chunk_list, list) { in sctp_inq_free()
56 list_del_init(&chunk->list); in sctp_inq_free()
63 if (queue->in_progress) { in sctp_inq_free()
64 sctp_inq_chunk_free(queue->in_progress); in sctp_inq_free()
65 queue->in_progress = NULL; in sctp_inq_free()
70 * We assume that packet->sctp_hdr is set and in host byte order.
75 if (chunk->rcvr->dead) { in sctp_inq_push()
85 list_add_tail(&chunk->list, &q->in_chunk_list); in sctp_inq_push()
86 if (chunk->asoc) in sctp_inq_push()
87 chunk->asoc->stats.ipackets++; in sctp_inq_push()
88 q->immediate.func(&q->immediate); in sctp_inq_push()
95 struct sctp_chunkhdr *ch = NULL; in sctp_inq_peek() local
97 chunk = queue->in_progress; in sctp_inq_peek()
99 if (chunk->singleton || in sctp_inq_peek()
100 chunk->end_of_packet || in sctp_inq_peek()
101 chunk->pdiscard) in sctp_inq_peek()
104 ch = (struct sctp_chunkhdr *)chunk->chunk_end; in sctp_inq_peek()
106 return ch; in sctp_inq_peek()
118 struct sctp_chunkhdr *ch = NULL; in sctp_inq_pop() local
124 chunk = queue->in_progress; in sctp_inq_pop()
129 if (chunk->singleton || in sctp_inq_pop()
130 chunk->end_of_packet || in sctp_inq_pop()
131 chunk->pdiscard) { in sctp_inq_pop()
132 if (chunk->head_skb == chunk->skb) { in sctp_inq_pop()
133 chunk->skb = skb_shinfo(chunk->skb)->frag_list; in sctp_inq_pop()
136 if (chunk->skb->next) { in sctp_inq_pop()
137 chunk->skb = chunk->skb->next; in sctp_inq_pop()
142 chunk = queue->in_progress = NULL; in sctp_inq_pop()
145 ch = (struct sctp_chunkhdr *)chunk->chunk_end; in sctp_inq_pop()
146 /* Force chunk->skb->data to chunk->chunk_end. */ in sctp_inq_pop()
147 skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); in sctp_inq_pop()
158 entry = sctp_list_dequeue(&queue->in_chunk_list); in sctp_inq_pop()
164 if (skb_is_gso(chunk->skb) && skb_is_gso_sctp(chunk->skb)) { in sctp_inq_pop()
165 /* GSO-marked skbs but without frags, handle in sctp_inq_pop()
168 if (skb_shinfo(chunk->skb)->frag_list) in sctp_inq_pop()
169 chunk->head_skb = chunk->skb; in sctp_inq_pop()
172 if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) in sctp_inq_pop()
173 chunk->skb = skb_shinfo(chunk->skb)->frag_list; in sctp_inq_pop()
175 if (WARN_ON(!chunk->skb)) { in sctp_inq_pop()
176 __SCTP_INC_STATS(dev_net(chunk->skb->dev), SCTP_MIB_IN_PKT_DISCARDS); in sctp_inq_pop()
182 if (chunk->asoc) in sctp_inq_pop()
183 sock_rps_save_rxhash(chunk->asoc->base.sk, chunk->skb); in sctp_inq_pop()
185 queue->in_progress = chunk; in sctp_inq_pop()
189 ch = (struct sctp_chunkhdr *)chunk->skb->data; in sctp_inq_pop()
190 chunk->singleton = 1; in sctp_inq_pop()
191 chunk->data_accepted = 0; in sctp_inq_pop()
192 chunk->pdiscard = 0; in sctp_inq_pop()
193 chunk->auth = 0; in sctp_inq_pop()
194 chunk->has_asconf = 0; in sctp_inq_pop()
195 chunk->end_of_packet = 0; in sctp_inq_pop()
196 if (chunk->head_skb) { in sctp_inq_pop()
198 *cb = SCTP_INPUT_CB(chunk->skb), in sctp_inq_pop()
199 *head_cb = SCTP_INPUT_CB(chunk->head_skb); in sctp_inq_pop()
201 cb->chunk = head_cb->chunk; in sctp_inq_pop()
202 cb->af = head_cb->af; in sctp_inq_pop()
206 chunk->chunk_hdr = ch; in sctp_inq_pop()
207 chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); in sctp_inq_pop()
208 skb_pull(chunk->skb, sizeof(*ch)); in sctp_inq_pop()
209 chunk->subh.v = NULL; /* Subheader is no longer valid. */ in sctp_inq_pop()
211 if (chunk->chunk_end + sizeof(*ch) <= skb_tail_pointer(chunk->skb)) { in sctp_inq_pop()
213 chunk->singleton = 0; in sctp_inq_pop()
214 } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { in sctp_inq_pop()
216 chunk->pdiscard = 1; in sctp_inq_pop()
217 chunk->chunk_end = skb_tail_pointer(chunk->skb); in sctp_inq_pop()
222 chunk->end_of_packet = 1; in sctp_inq_pop()
225 pr_debug("+++sctp_inq_pop+++ chunk:%p[%s], length:%d, skb->len:%d\n", in sctp_inq_pop()
226 chunk, sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)), in sctp_inq_pop()
227 ntohs(chunk->chunk_hdr->length), chunk->skb->len); in sctp_inq_pop()
232 /* Set a top-half handler.
234 * Originally, we the top-half handler was scheduled as a BH. We now
242 INIT_WORK(&q->immediate, callback); in sctp_inq_set_th_handler()