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()
47 list_for_each_entry_safe(chunk, tmp, &queue->in_chunk_list, list) { in sctp_inq_free()
48 list_del_init(&chunk->list); in sctp_inq_free()
55 if (queue->in_progress) { in sctp_inq_free()
56 sctp_chunk_free(queue->in_progress); in sctp_inq_free()
57 queue->in_progress = NULL; in sctp_inq_free()
62 * We assume that packet->sctp_hdr is set and in host byte order.
67 if (chunk->rcvr->dead) { in sctp_inq_push()
77 list_add_tail(&chunk->list, &q->in_chunk_list); in sctp_inq_push()
78 if (chunk->asoc) in sctp_inq_push()
79 chunk->asoc->stats.ipackets++; in sctp_inq_push()
80 q->immediate.func(&q->immediate); in sctp_inq_push()
87 struct sctp_chunkhdr *ch = NULL; in sctp_inq_peek() local
89 chunk = queue->in_progress; in sctp_inq_peek()
91 if (chunk->singleton || in sctp_inq_peek()
92 chunk->end_of_packet || in sctp_inq_peek()
93 chunk->pdiscard) in sctp_inq_peek()
96 ch = (struct sctp_chunkhdr *)chunk->chunk_end; in sctp_inq_peek()
98 return ch; in sctp_inq_peek()
110 struct sctp_chunkhdr *ch = NULL; in sctp_inq_pop() local
116 chunk = queue->in_progress; in sctp_inq_pop()
121 if (chunk->singleton || in sctp_inq_pop()
122 chunk->end_of_packet || in sctp_inq_pop()
123 chunk->pdiscard) { in sctp_inq_pop()
124 if (chunk->head_skb == chunk->skb) { in sctp_inq_pop()
125 chunk->skb = skb_shinfo(chunk->skb)->frag_list; in sctp_inq_pop()
128 if (chunk->skb->next) { in sctp_inq_pop()
129 chunk->skb = chunk->skb->next; in sctp_inq_pop()
133 if (chunk->head_skb) in sctp_inq_pop()
134 chunk->skb = chunk->head_skb; in sctp_inq_pop()
136 chunk = queue->in_progress = NULL; in sctp_inq_pop()
139 ch = (struct sctp_chunkhdr *)chunk->chunk_end; in sctp_inq_pop()
140 /* Force chunk->skb->data to chunk->chunk_end. */ in sctp_inq_pop()
141 skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); in sctp_inq_pop()
152 entry = sctp_list_dequeue(&queue->in_chunk_list); in sctp_inq_pop()
158 if (skb_is_gso(chunk->skb) && skb_is_gso_sctp(chunk->skb)) { in sctp_inq_pop()
159 /* GSO-marked skbs but without frags, handle in sctp_inq_pop()
162 if (skb_shinfo(chunk->skb)->frag_list) in sctp_inq_pop()
163 chunk->head_skb = chunk->skb; in sctp_inq_pop()
166 if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) in sctp_inq_pop()
167 chunk->skb = skb_shinfo(chunk->skb)->frag_list; in sctp_inq_pop()
169 if (WARN_ON(!chunk->skb)) { in sctp_inq_pop()
170 __SCTP_INC_STATS(dev_net(chunk->skb->dev), SCTP_MIB_IN_PKT_DISCARDS); in sctp_inq_pop()
176 if (chunk->asoc) in sctp_inq_pop()
177 sock_rps_save_rxhash(chunk->asoc->base.sk, chunk->skb); in sctp_inq_pop()
179 queue->in_progress = chunk; in sctp_inq_pop()
183 ch = (struct sctp_chunkhdr *)chunk->skb->data; in sctp_inq_pop()
184 chunk->singleton = 1; in sctp_inq_pop()
185 chunk->data_accepted = 0; in sctp_inq_pop()
186 chunk->pdiscard = 0; in sctp_inq_pop()
187 chunk->auth = 0; in sctp_inq_pop()
188 chunk->has_asconf = 0; in sctp_inq_pop()
189 chunk->end_of_packet = 0; in sctp_inq_pop()
190 if (chunk->head_skb) { in sctp_inq_pop()
192 *cb = SCTP_INPUT_CB(chunk->skb), in sctp_inq_pop()
193 *head_cb = SCTP_INPUT_CB(chunk->head_skb); in sctp_inq_pop()
195 cb->chunk = head_cb->chunk; in sctp_inq_pop()
196 cb->af = head_cb->af; in sctp_inq_pop()
200 chunk->chunk_hdr = ch; in sctp_inq_pop()
201 chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); in sctp_inq_pop()
202 skb_pull(chunk->skb, sizeof(*ch)); in sctp_inq_pop()
203 chunk->subh.v = NULL; /* Subheader is no longer valid. */ in sctp_inq_pop()
205 if (chunk->chunk_end + sizeof(*ch) <= skb_tail_pointer(chunk->skb)) { in sctp_inq_pop()
207 chunk->singleton = 0; in sctp_inq_pop()
208 } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { in sctp_inq_pop()
210 chunk->pdiscard = 1; in sctp_inq_pop()
211 chunk->chunk_end = skb_tail_pointer(chunk->skb); in sctp_inq_pop()
216 chunk->end_of_packet = 1; in sctp_inq_pop()
219 pr_debug("+++sctp_inq_pop+++ chunk:%p[%s], length:%d, skb->len:%d\n", in sctp_inq_pop()
220 chunk, sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)), in sctp_inq_pop()
221 ntohs(chunk->chunk_hdr->length), chunk->skb->len); in sctp_inq_pop()
226 /* Set a top-half handler.
228 * Originally, we the top-half handler was scheduled as a BH. We now
236 INIT_WORK(&q->immediate, callback); in sctp_inq_set_th_handler()