Lines Matching full:chunk

46 						 struct sctp_chunk *chunk);
48 struct sctp_chunk *chunk);
50 struct sctp_chunk *chunk);
52 struct sctp_chunk *chunk,
118 /* If there a is a prepend chunk stick it on the list before in sctp_packet_config()
122 struct sctp_chunk *chunk = sctp_get_ecne_prepend(asoc); in sctp_packet_config() local
124 if (chunk) in sctp_packet_config()
125 sctp_packet_append_chunk(packet, chunk); in sctp_packet_config()
163 struct sctp_chunk *chunk, *tmp; in sctp_packet_free() local
167 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_free()
168 list_del_init(&chunk->list); in sctp_packet_free()
169 sctp_chunk_free(chunk); in sctp_packet_free()
173 /* This routine tries to append the chunk to the offered packet. If adding
174 * the chunk causes the packet to exceed the path MTU and COOKIE_ECHO chunk
176 * Data can be bundled with a packet containing a COOKIE_ECHO chunk as long
181 struct sctp_chunk *chunk, in sctp_packet_transmit_chunk() argument
186 pr_debug("%s: packet:%p size:%zu chunk:%p size:%d\n", __func__, in sctp_packet_transmit_chunk()
187 packet, packet->size, chunk, chunk->skb ? chunk->skb->len : -1); in sctp_packet_transmit_chunk()
189 switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { in sctp_packet_transmit_chunk()
196 chunk->skb->sk->sk_err = -error; in sctp_packet_transmit_chunk()
203 chunk); in sctp_packet_transmit_chunk()
216 /* Try to bundle a pad chunk into a packet with a heartbeat chunk for PLPMTUTD probe */
217 static enum sctp_xmit sctp_packet_bundle_pad(struct sctp_packet *pkt, struct sctp_chunk *chunk) in sctp_packet_bundle_pad() argument
223 if (!chunk->pmtu_probe) in sctp_packet_bundle_pad()
226 /* calculate the Padding Data size for the pad chunk */ in sctp_packet_bundle_pad()
235 chunk->transport = t; in sctp_packet_bundle_pad()
240 /* Try to bundle an auth chunk into the packet. */
242 struct sctp_chunk *chunk) in sctp_packet_bundle_auth() argument
252 /* See if this is an auth chunk we are bundling or if in sctp_packet_bundle_auth()
255 if (chunk->chunk_hdr->type == SCTP_CID_AUTH || pkt->has_auth) in sctp_packet_bundle_auth()
258 /* if the peer did not request this chunk to be authenticated, in sctp_packet_bundle_auth()
261 if (!chunk->auth) in sctp_packet_bundle_auth()
264 auth = sctp_make_auth(asoc, chunk->shkey->key_id); in sctp_packet_bundle_auth()
268 auth->shkey = chunk->shkey; in sctp_packet_bundle_auth()
281 struct sctp_chunk *chunk) in sctp_packet_bundle_sack() argument
288 if (sctp_chunk_is_data(chunk) && !pkt->has_sack && in sctp_packet_bundle_sack()
325 /* Append a chunk to the offered packet reporting back any inability to do
329 struct sctp_chunk *chunk) in __sctp_packet_append_chunk() argument
331 __u16 chunk_len = SCTP_PAD4(ntohs(chunk->chunk_hdr->length)); in __sctp_packet_append_chunk()
334 /* Check to see if this chunk will fit into the packet */ in __sctp_packet_append_chunk()
335 retval = sctp_packet_will_fit(packet, chunk, chunk_len); in __sctp_packet_append_chunk()
339 /* We believe that this chunk is OK to add to the packet */ in __sctp_packet_append_chunk()
340 switch (chunk->chunk_hdr->type) { in __sctp_packet_append_chunk()
344 sctp_packet_append_data(packet, chunk); in __sctp_packet_append_chunk()
351 /* timestamp the chunk for rtx purposes */ in __sctp_packet_append_chunk()
352 chunk->sent_at = jiffies; in __sctp_packet_append_chunk()
354 chunk->sent_count++; in __sctp_packet_append_chunk()
362 if (chunk->asoc) in __sctp_packet_append_chunk()
363 chunk->asoc->stats.osacks++; in __sctp_packet_append_chunk()
368 packet->auth = chunk; in __sctp_packet_append_chunk()
372 /* It is OK to send this chunk. */ in __sctp_packet_append_chunk()
373 list_add_tail(&chunk->list, &packet->chunk_list); in __sctp_packet_append_chunk()
375 chunk->transport = packet->transport; in __sctp_packet_append_chunk()
380 /* Append a chunk to the offered packet reporting back any inability to do
384 struct sctp_chunk *chunk) in sctp_packet_append_chunk() argument
388 pr_debug("%s: packet:%p chunk:%p\n", __func__, packet, chunk); in sctp_packet_append_chunk()
394 if (sctp_chunk_is_data(chunk)) { in sctp_packet_append_chunk()
395 retval = sctp_packet_can_append_data(packet, chunk); in sctp_packet_append_chunk()
400 /* Try to bundle AUTH chunk */ in sctp_packet_append_chunk()
401 retval = sctp_packet_bundle_auth(packet, chunk); in sctp_packet_append_chunk()
405 /* Try to bundle SACK chunk */ in sctp_packet_append_chunk()
406 retval = sctp_packet_bundle_sack(packet, chunk); in sctp_packet_append_chunk()
410 retval = __sctp_packet_append_chunk(packet, chunk); in sctp_packet_append_chunk()
414 retval = sctp_packet_bundle_pad(packet, chunk); in sctp_packet_append_chunk()
441 struct sctp_chunk *chunk, *tmp; in sctp_packet_pack() local
459 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, in sctp_packet_pack()
461 int padded = SCTP_PAD4(chunk->skb->len); in sctp_packet_pack()
463 if (chunk == packet->auth) in sctp_packet_pack()
480 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_pack()
483 list_del_init(&chunk->list); in sctp_packet_pack()
484 if (sctp_chunk_is_data(chunk)) { in sctp_packet_pack()
485 if (!sctp_chunk_retransmitted(chunk) && in sctp_packet_pack()
487 chunk->rtt_in_progress = 1; in sctp_packet_pack()
492 padding = SCTP_PAD4(chunk->skb->len) - chunk->skb->len; in sctp_packet_pack()
494 skb_put_zero(chunk->skb, padding); in sctp_packet_pack()
496 if (chunk == packet->auth) in sctp_packet_pack()
500 skb_put_data(nskb, chunk->skb->data, chunk->skb->len); in sctp_packet_pack()
502 pr_debug("*** Chunk:%p[%s] %s 0x%x, length:%d, chunk->skb->len:%d, rtt_in_progress:%d\n", in sctp_packet_pack()
503 chunk, in sctp_packet_pack()
504 sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)), in sctp_packet_pack()
505 chunk->has_tsn ? "TSN" : "No TSN", in sctp_packet_pack()
506 chunk->has_tsn ? ntohl(chunk->subh.data_hdr->tsn) : 0, in sctp_packet_pack()
507 ntohs(chunk->chunk_hdr->length), chunk->skb->len, in sctp_packet_pack()
508 chunk->rtt_in_progress); in sctp_packet_pack()
510 pkt_size -= SCTP_PAD4(chunk->skb->len); in sctp_packet_pack()
512 if (!sctp_chunk_is_data(chunk) && chunk != packet->auth) in sctp_packet_pack()
513 sctp_chunk_free(chunk); in sctp_packet_pack()
573 struct sctp_chunk *chunk, *tmp; in sctp_packet_transmit() local
582 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); in sctp_packet_transmit()
583 sk = chunk->skb->sk; in sctp_packet_transmit()
585 if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) { in sctp_packet_transmit()
658 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_transmit()
659 list_del_init(&chunk->list); in sctp_packet_transmit()
660 if (!sctp_chunk_is_data(chunk)) in sctp_packet_transmit()
661 sctp_chunk_free(chunk); in sctp_packet_transmit()
671 /* This private function check to see if a chunk can be added */
673 struct sctp_chunk *chunk) in sctp_packet_can_append_data() argument
686 * is 0), the data sender can always have one DATA chunk in flight to in sctp_packet_can_append_data()
697 datasize = sctp_data_size(chunk); in sctp_packet_can_append_data()
700 /* We have (at least) one data chunk in flight, in sctp_packet_can_append_data()
717 if (chunk->fast_retransmit != SCTP_NEED_FRTX && in sctp_packet_can_append_data()
739 /* Check whether this chunk and all the rest of pending data will fit in sctp_packet_can_append_data()
742 if (chunk->skb->len + q->out_qlen > transport->pathmtu - in sctp_packet_can_append_data()
743 packet->overhead - sctp_datachk_len(&chunk->asoc->stream) - 4) in sctp_packet_can_append_data()
748 if (!chunk->msg->can_delay) in sctp_packet_can_append_data()
755 /* This private function does management things when adding DATA chunk */
757 struct sctp_chunk *chunk) in sctp_packet_append_data() argument
760 size_t datasize = sctp_data_size(chunk); in sctp_packet_append_data()
777 sctp_chunk_assign_tsn(chunk); in sctp_packet_append_data()
778 asoc->stream.si->assign_number(chunk); in sctp_packet_append_data()
782 struct sctp_chunk *chunk, in sctp_packet_will_fit() argument
788 /* Don't bundle in this packet if this chunk's auth key doesn't in sctp_packet_will_fit()
790 * don't bundle the chunk with auth key if other chunks in this in sctp_packet_will_fit()
793 if ((packet->auth && chunk->shkey != packet->auth->shkey) || in sctp_packet_will_fit()
794 (!packet->auth && chunk->shkey && in sctp_packet_will_fit()
795 chunk->chunk_hdr->type != SCTP_CID_AUTH)) in sctp_packet_will_fit()
808 * 1. The packet is empty (meaning this chunk is greater in sctp_packet_will_fit()
814 (!packet->has_data && chunk->auth)) { in sctp_packet_will_fit()
823 /* Similarly, if this chunk was built before a PMTU in sctp_packet_will_fit()
834 /* It is also okay to fragment if the chunk we are in sctp_packet_will_fit()
835 * adding is a control chunk, but only if current packet in sctp_packet_will_fit()
840 if (!sctp_chunk_is_data(chunk) && packet->has_data) in sctp_packet_will_fit()