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