Lines Matching full:chunk

41 /* Properly release the chunk which is being worked on. */
42 static inline void sctp_inq_chunk_free(struct sctp_chunk *chunk) in sctp_inq_chunk_free() argument
44 if (chunk->head_skb) in sctp_inq_chunk_free()
45 chunk->skb = chunk->head_skb; in sctp_inq_chunk_free()
46 sctp_chunk_free(chunk); in sctp_inq_chunk_free()
52 struct sctp_chunk *chunk, *tmp; in sctp_inq_free() local
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()
57 sctp_chunk_free(chunk); in sctp_inq_free()
72 void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) in sctp_inq_push() argument
75 if (chunk->rcvr->dead) { in sctp_inq_push()
76 sctp_chunk_free(chunk); 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()
91 /* Peek at the next chunk on the inqeue. */
94 struct sctp_chunk *chunk; 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()
110 /* Extract a chunk from an SCTP inqueue.
112 * WARNING: If you need to put the chunk on another queue, you need to
117 struct sctp_chunk *chunk; in sctp_inq_pop() local
124 chunk = queue->in_progress; in sctp_inq_pop()
125 if (chunk) { 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()
141 sctp_inq_chunk_free(chunk); in sctp_inq_pop()
142 chunk = queue->in_progress = NULL; in sctp_inq_pop()
144 /* Nothing to do. Next chunk in the packet, please. */ 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()
153 if (!chunk) { in sctp_inq_pop()
162 chunk = list_entry(entry, struct sctp_chunk, list); in sctp_inq_pop()
164 if (skb_is_gso(chunk->skb) && skb_is_gso_sctp(chunk->skb)) { 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()
177 sctp_chunk_free(chunk); 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()
188 /* This is the first chunk in the packet. */ 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()
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()
219 /* We are at the end of the packet, so mark the chunk 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()
229 return chunk; in sctp_inq_pop()