Lines Matching full:chunk
7 * This file contains the code relating the chunk abstraction.
60 struct sctp_chunk *chunk; in sctp_datamsg_free() local
65 list_for_each_entry(chunk, &msg->chunks, frag_list) in sctp_datamsg_free()
66 sctp_chunk_free(chunk); in sctp_datamsg_free()
76 struct sctp_chunk *chunk; in sctp_datamsg_destroy() local
83 chunk = list_entry(pos, struct sctp_chunk, frag_list); in sctp_datamsg_destroy()
86 sctp_chunk_put(chunk); in sctp_datamsg_destroy()
90 asoc = chunk->asoc; in sctp_datamsg_destroy()
92 sent = chunk->has_tsn ? SCTP_DATA_SENT : SCTP_DATA_UNSENT; in sctp_datamsg_destroy()
96 ev = sctp_ulpevent_make_send_failed(asoc, chunk, sent, in sctp_datamsg_destroy()
104 ev = sctp_ulpevent_make_send_failed_event(asoc, chunk, in sctp_datamsg_destroy()
111 sctp_chunk_put(chunk); in sctp_datamsg_destroy()
131 /* Assign a chunk to this datamsg. */
132 static void sctp_datamsg_assign(struct sctp_datamsg *msg, struct sctp_chunk *chunk) in sctp_datamsg_assign() argument
135 chunk->msg = msg; in sctp_datamsg_assign()
139 /* A data chunk can have a maximum payload of (2^16 - 20). Break
154 struct sctp_chunk *chunk; in sctp_datamsg_from_user() local
171 /* This is the biggest possible DATA chunk that can fit into in sctp_datamsg_from_user()
254 * last DATA chunk of a user message when providing in sctp_datamsg_from_user()
262 chunk = asoc->stream.si->make_datafrag(asoc, sinfo, len, frag, in sctp_datamsg_from_user()
264 if (!chunk) { in sctp_datamsg_from_user()
269 err = sctp_user_addto_chunk(chunk, len, from); in sctp_datamsg_from_user()
273 chunk->shkey = shkey; in sctp_datamsg_from_user()
275 /* Put the chunk->skb back into the form expected by send. */ in sctp_datamsg_from_user()
276 __skb_pull(chunk->skb, (__u8 *)chunk->chunk_hdr - in sctp_datamsg_from_user()
277 chunk->skb->data); in sctp_datamsg_from_user()
279 sctp_datamsg_assign(msg, chunk); in sctp_datamsg_from_user()
280 list_add_tail(&chunk->frag_list, &msg->chunks); in sctp_datamsg_from_user()
286 sctp_chunk_free(chunk); in sctp_datamsg_from_user()
291 chunk = list_entry(pos, struct sctp_chunk, frag_list); in sctp_datamsg_from_user()
292 sctp_chunk_free(chunk); in sctp_datamsg_from_user()
300 int sctp_chunk_abandoned(struct sctp_chunk *chunk) in sctp_chunk_abandoned() argument
302 if (!chunk->asoc->peer.prsctp_capable) in sctp_chunk_abandoned()
305 if (chunk->msg->abandoned) in sctp_chunk_abandoned()
308 if (!chunk->has_tsn && in sctp_chunk_abandoned()
309 !(chunk->chunk_hdr->flags & SCTP_DATA_FIRST_FRAG)) in sctp_chunk_abandoned()
312 if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && in sctp_chunk_abandoned()
313 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
315 SCTP_SO(&chunk->asoc->stream, in sctp_chunk_abandoned()
316 chunk->sinfo.sinfo_stream); in sctp_chunk_abandoned()
318 if (chunk->sent_count) { in sctp_chunk_abandoned()
319 chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; in sctp_chunk_abandoned()
322 chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++; in sctp_chunk_abandoned()
325 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
327 } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) && in sctp_chunk_abandoned()
328 chunk->sent_count > chunk->sinfo.sinfo_timetolive) { in sctp_chunk_abandoned()
330 SCTP_SO(&chunk->asoc->stream, in sctp_chunk_abandoned()
331 chunk->sinfo.sinfo_stream); in sctp_chunk_abandoned()
333 chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; in sctp_chunk_abandoned()
335 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
337 } else if (!SCTP_PR_POLICY(chunk->sinfo.sinfo_flags) && in sctp_chunk_abandoned()
338 chunk->msg->expires_at && in sctp_chunk_abandoned()
339 time_after(jiffies, chunk->msg->expires_at)) { in sctp_chunk_abandoned()
340 chunk->msg->abandoned = 1; in sctp_chunk_abandoned()
348 /* This chunk (and consequently entire message) has failed in its sending. */
349 void sctp_chunk_fail(struct sctp_chunk *chunk, int error) in sctp_chunk_fail() argument
351 chunk->msg->send_failed = 1; in sctp_chunk_fail()
352 chunk->msg->send_error = error; in sctp_chunk_fail()