Lines Matching refs:packet
45 static enum sctp_xmit __sctp_packet_append_chunk(struct sctp_packet *packet,
47 static enum sctp_xmit sctp_packet_can_append_data(struct sctp_packet *packet,
49 static void sctp_packet_append_data(struct sctp_packet *packet,
51 static enum sctp_xmit sctp_packet_will_fit(struct sctp_packet *packet,
55 static void sctp_packet_reset(struct sctp_packet *packet) in sctp_packet_reset() argument
60 packet->size = packet->overhead; in sctp_packet_reset()
62 packet->has_cookie_echo = 0; in sctp_packet_reset()
63 packet->has_sack = 0; in sctp_packet_reset()
64 packet->has_data = 0; in sctp_packet_reset()
65 packet->has_auth = 0; in sctp_packet_reset()
66 packet->ipfragok = 0; in sctp_packet_reset()
67 packet->auth = NULL; in sctp_packet_reset()
73 void sctp_packet_config(struct sctp_packet *packet, __u32 vtag, in sctp_packet_config() argument
76 struct sctp_transport *tp = packet->transport; in sctp_packet_config()
81 pr_debug("%s: packet:%p vtag:0x%x\n", __func__, packet, vtag); in sctp_packet_config()
82 packet->vtag = vtag; in sctp_packet_config()
85 if (!sctp_packet_empty(packet)) in sctp_packet_config()
89 packet->max_size = tp->pathmtu; in sctp_packet_config()
95 packet->overhead = sctp_mtu_payload(sp, 0, 0); in sctp_packet_config()
96 packet->size = packet->overhead; in sctp_packet_config()
124 sctp_packet_append_chunk(packet, chunk); in sctp_packet_config()
136 packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size in sctp_packet_config()
142 void sctp_packet_init(struct sctp_packet *packet, in sctp_packet_init() argument
146 pr_debug("%s: packet:%p transport:%p\n", __func__, packet, transport); in sctp_packet_init()
148 packet->transport = transport; in sctp_packet_init()
149 packet->source_port = sport; in sctp_packet_init()
150 packet->destination_port = dport; in sctp_packet_init()
151 INIT_LIST_HEAD(&packet->chunk_list); in sctp_packet_init()
153 packet->overhead = 0; in sctp_packet_init()
154 sctp_packet_reset(packet); in sctp_packet_init()
155 packet->vtag = 0; in sctp_packet_init()
159 void sctp_packet_free(struct sctp_packet *packet) in sctp_packet_free() argument
163 pr_debug("%s: packet:%p\n", __func__, packet); in sctp_packet_free()
165 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_free()
178 enum sctp_xmit sctp_packet_transmit_chunk(struct sctp_packet *packet, in sctp_packet_transmit_chunk() argument
185 packet, packet->size, chunk, chunk->skb ? chunk->skb->len : -1); in sctp_packet_transmit_chunk()
187 switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { in sctp_packet_transmit_chunk()
189 if (!packet->has_cookie_echo) { in sctp_packet_transmit_chunk()
192 error = sctp_packet_transmit(packet, gfp); in sctp_packet_transmit_chunk()
200 retval = sctp_packet_append_chunk(packet, in sctp_packet_transmit_chunk()
302 static enum sctp_xmit __sctp_packet_append_chunk(struct sctp_packet *packet, in __sctp_packet_append_chunk() argument
309 retval = sctp_packet_will_fit(packet, chunk, chunk_len); in __sctp_packet_append_chunk()
318 sctp_packet_append_data(packet, chunk); in __sctp_packet_append_chunk()
320 packet->has_sack = 1; in __sctp_packet_append_chunk()
322 packet->has_auth = 1; in __sctp_packet_append_chunk()
324 packet->has_data = 1; in __sctp_packet_append_chunk()
331 packet->has_cookie_echo = 1; in __sctp_packet_append_chunk()
335 packet->has_sack = 1; in __sctp_packet_append_chunk()
341 packet->has_auth = 1; in __sctp_packet_append_chunk()
342 packet->auth = chunk; in __sctp_packet_append_chunk()
347 list_add_tail(&chunk->list, &packet->chunk_list); in __sctp_packet_append_chunk()
348 packet->size += chunk_len; in __sctp_packet_append_chunk()
349 chunk->transport = packet->transport; in __sctp_packet_append_chunk()
357 enum sctp_xmit sctp_packet_append_chunk(struct sctp_packet *packet, in sctp_packet_append_chunk() argument
362 pr_debug("%s: packet:%p chunk:%p\n", __func__, packet, chunk); in sctp_packet_append_chunk()
369 retval = sctp_packet_can_append_data(packet, chunk); in sctp_packet_append_chunk()
375 retval = sctp_packet_bundle_auth(packet, chunk); in sctp_packet_append_chunk()
380 retval = sctp_packet_bundle_sack(packet, chunk); in sctp_packet_append_chunk()
384 retval = __sctp_packet_append_chunk(packet, chunk); in sctp_packet_append_chunk()
406 static int sctp_packet_pack(struct sctp_packet *packet, in sctp_packet_pack() argument
409 struct sctp_transport *tp = packet->transport; in sctp_packet_pack()
422 pkt_size = packet->size; in sctp_packet_pack()
428 pkt_size = packet->overhead; in sctp_packet_pack()
429 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, in sctp_packet_pack()
433 if (chunk == packet->auth) in sctp_packet_pack()
435 else if (auth_len + padded + packet->overhead > in sctp_packet_pack()
445 skb_reserve(nskb, packet->overhead + MAX_HEADER); in sctp_packet_pack()
449 pkt_size -= packet->overhead; in sctp_packet_pack()
450 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_pack()
466 if (chunk == packet->auth) in sctp_packet_pack()
482 if (!sctp_chunk_is_data(chunk) && chunk != packet->auth) in sctp_packet_pack()
491 packet->auth->shkey, gfp); in sctp_packet_pack()
493 if (list_empty(&packet->chunk_list)) in sctp_packet_pack()
494 sctp_chunk_free(packet->auth); in sctp_packet_pack()
496 list_add(&packet->auth->list, in sctp_packet_pack()
497 &packet->chunk_list); in sctp_packet_pack()
504 } while (!list_empty(&packet->chunk_list)); in sctp_packet_pack()
524 dst_xfrm(skb_dst(head)) || packet->ipfragok) { in sctp_packet_pack()
545 int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) in sctp_packet_transmit() argument
547 struct sctp_transport *tp = packet->transport; in sctp_packet_transmit()
556 pr_debug("%s: packet:%p\n", __func__, packet); in sctp_packet_transmit()
557 if (list_empty(&packet->chunk_list)) in sctp_packet_transmit()
559 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); in sctp_packet_transmit()
563 if (packet->size > tp->pathmtu && !packet->ipfragok) { in sctp_packet_transmit()
572 head = alloc_skb((gso ? packet->overhead : packet->size) + in sctp_packet_transmit()
576 skb_reserve(head, packet->overhead + MAX_HEADER); in sctp_packet_transmit()
582 sh->source = htons(packet->source_port); in sctp_packet_transmit()
583 sh->dest = htons(packet->destination_port); in sctp_packet_transmit()
584 sh->vtag = htonl(packet->vtag); in sctp_packet_transmit()
597 pkt_count = sctp_packet_pack(packet, head, gso, gfp); in sctp_packet_transmit()
605 if (packet->has_data && sctp_state(asoc, ESTABLISHED) && in sctp_packet_transmit()
623 head->ignore_df = packet->ipfragok; in sctp_packet_transmit()
634 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_transmit()
639 sctp_packet_reset(packet); in sctp_packet_transmit()
648 static enum sctp_xmit sctp_packet_can_append_data(struct sctp_packet *packet, in sctp_packet_can_append_data() argument
652 struct sctp_transport *transport = packet->transport; in sctp_packet_can_append_data()
708 if (!sctp_packet_empty(packet)) in sctp_packet_can_append_data()
719 packet->overhead - sctp_datachk_len(&chunk->asoc->stream) - 4) in sctp_packet_can_append_data()
732 static void sctp_packet_append_data(struct sctp_packet *packet, in sctp_packet_append_data() argument
735 struct sctp_transport *transport = packet->transport; in sctp_packet_append_data()
757 static enum sctp_xmit sctp_packet_will_fit(struct sctp_packet *packet, in sctp_packet_will_fit() argument
769 if ((packet->auth && chunk->shkey != packet->auth->shkey) || in sctp_packet_will_fit()
770 (!packet->auth && chunk->shkey && in sctp_packet_will_fit()
774 psize = packet->size; in sctp_packet_will_fit()
775 if (packet->transport->asoc) in sctp_packet_will_fit()
776 pmtu = packet->transport->asoc->pathmtu; in sctp_packet_will_fit()
778 pmtu = packet->transport->pathmtu; in sctp_packet_will_fit()
789 if (sctp_packet_empty(packet) || in sctp_packet_will_fit()
790 (!packet->has_data && chunk->auth)) { in sctp_packet_will_fit()
795 packet->ipfragok = 1; in sctp_packet_will_fit()
804 maxsize = pmtu - packet->overhead; in sctp_packet_will_fit()
805 if (packet->auth) in sctp_packet_will_fit()
806 maxsize -= SCTP_PAD4(packet->auth->skb->len); in sctp_packet_will_fit()
816 if (!sctp_chunk_is_data(chunk) && packet->has_data) in sctp_packet_will_fit()
819 if (psize + chunk_len > packet->max_size) in sctp_packet_will_fit()
823 if (!packet->transport->burst_limited && in sctp_packet_will_fit()
824 psize + chunk_len > (packet->transport->cwnd >> 1)) in sctp_packet_will_fit()
830 if (packet->transport->burst_limited && in sctp_packet_will_fit()
831 psize + chunk_len > (packet->transport->burst_limited >> 1)) in sctp_packet_will_fit()