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()
125 sctp_packet_append_chunk(packet, chunk); in sctp_packet_config()
137 packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size in sctp_packet_config()
143 void sctp_packet_init(struct sctp_packet *packet, in sctp_packet_init() argument
147 pr_debug("%s: packet:%p transport:%p\n", __func__, packet, transport); in sctp_packet_init()
149 packet->transport = transport; in sctp_packet_init()
150 packet->source_port = sport; in sctp_packet_init()
151 packet->destination_port = dport; in sctp_packet_init()
152 INIT_LIST_HEAD(&packet->chunk_list); in sctp_packet_init()
154 packet->overhead = 0; in sctp_packet_init()
155 sctp_packet_reset(packet); in sctp_packet_init()
156 packet->vtag = 0; in sctp_packet_init()
160 void sctp_packet_free(struct sctp_packet *packet) in sctp_packet_free() argument
164 pr_debug("%s: packet:%p\n", __func__, packet); in sctp_packet_free()
166 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_free()
179 enum sctp_xmit sctp_packet_transmit_chunk(struct sctp_packet *packet, in sctp_packet_transmit_chunk() argument
186 packet, packet->size, chunk, chunk->skb ? chunk->skb->len : -1); in sctp_packet_transmit_chunk()
188 switch ((retval = (sctp_packet_append_chunk(packet, chunk)))) { in sctp_packet_transmit_chunk()
190 if (!packet->has_cookie_echo) { in sctp_packet_transmit_chunk()
193 error = sctp_packet_transmit(packet, gfp); in sctp_packet_transmit_chunk()
201 retval = sctp_packet_append_chunk(packet, in sctp_packet_transmit_chunk()
327 static enum sctp_xmit __sctp_packet_append_chunk(struct sctp_packet *packet, in __sctp_packet_append_chunk() argument
334 retval = sctp_packet_will_fit(packet, chunk, chunk_len); in __sctp_packet_append_chunk()
343 sctp_packet_append_data(packet, chunk); in __sctp_packet_append_chunk()
345 packet->has_sack = 1; in __sctp_packet_append_chunk()
347 packet->has_auth = 1; in __sctp_packet_append_chunk()
349 packet->has_data = 1; in __sctp_packet_append_chunk()
356 packet->has_cookie_echo = 1; in __sctp_packet_append_chunk()
360 packet->has_sack = 1; in __sctp_packet_append_chunk()
366 packet->has_auth = 1; in __sctp_packet_append_chunk()
367 packet->auth = chunk; in __sctp_packet_append_chunk()
372 list_add_tail(&chunk->list, &packet->chunk_list); in __sctp_packet_append_chunk()
373 packet->size += chunk_len; in __sctp_packet_append_chunk()
374 chunk->transport = packet->transport; in __sctp_packet_append_chunk()
382 enum sctp_xmit sctp_packet_append_chunk(struct sctp_packet *packet, in sctp_packet_append_chunk() argument
387 pr_debug("%s: packet:%p chunk:%p\n", __func__, packet, chunk); in sctp_packet_append_chunk()
394 retval = sctp_packet_can_append_data(packet, chunk); in sctp_packet_append_chunk()
400 retval = sctp_packet_bundle_auth(packet, chunk); in sctp_packet_append_chunk()
405 retval = sctp_packet_bundle_sack(packet, chunk); in sctp_packet_append_chunk()
409 retval = __sctp_packet_append_chunk(packet, chunk); in sctp_packet_append_chunk()
413 retval = sctp_packet_bundle_pad(packet, chunk); in sctp_packet_append_chunk()
435 static int sctp_packet_pack(struct sctp_packet *packet, in sctp_packet_pack() argument
438 struct sctp_transport *tp = packet->transport; in sctp_packet_pack()
451 pkt_size = packet->size; in sctp_packet_pack()
457 pkt_size = packet->overhead; in sctp_packet_pack()
458 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, in sctp_packet_pack()
462 if (chunk == packet->auth) in sctp_packet_pack()
464 else if (auth_len + padded + packet->overhead > in sctp_packet_pack()
474 skb_reserve(nskb, packet->overhead + MAX_HEADER); in sctp_packet_pack()
478 pkt_size -= packet->overhead; in sctp_packet_pack()
479 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_pack()
495 if (chunk == packet->auth) in sctp_packet_pack()
511 if (!sctp_chunk_is_data(chunk) && chunk != packet->auth) in sctp_packet_pack()
520 packet->auth->shkey, gfp); in sctp_packet_pack()
522 if (list_empty(&packet->chunk_list)) in sctp_packet_pack()
523 sctp_chunk_free(packet->auth); in sctp_packet_pack()
525 list_add(&packet->auth->list, in sctp_packet_pack()
526 &packet->chunk_list); in sctp_packet_pack()
533 } while (!list_empty(&packet->chunk_list)); in sctp_packet_pack()
547 dst_xfrm(tp->dst) || packet->ipfragok || tp->encap_port) { in sctp_packet_pack()
568 int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) in sctp_packet_transmit() argument
570 struct sctp_transport *tp = packet->transport; in sctp_packet_transmit()
578 pr_debug("%s: packet:%p\n", __func__, packet); in sctp_packet_transmit()
579 if (list_empty(&packet->chunk_list)) in sctp_packet_transmit()
581 chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list); in sctp_packet_transmit()
584 if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) { in sctp_packet_transmit()
586 packet->ipfragok = 1; in sctp_packet_transmit()
597 head = alloc_skb((gso ? packet->overhead : packet->size) + in sctp_packet_transmit()
601 skb_reserve(head, packet->overhead + MAX_HEADER); in sctp_packet_transmit()
607 sh->source = htons(packet->source_port); in sctp_packet_transmit()
608 sh->dest = htons(packet->destination_port); in sctp_packet_transmit()
609 sh->vtag = htonl(packet->vtag); in sctp_packet_transmit()
620 pkt_count = sctp_packet_pack(packet, head, gso, gfp); in sctp_packet_transmit()
628 if (packet->has_data && sctp_state(asoc, ESTABLISHED) && in sctp_packet_transmit()
646 head->ignore_df = packet->ipfragok; in sctp_packet_transmit()
657 list_for_each_entry_safe(chunk, tmp, &packet->chunk_list, list) { in sctp_packet_transmit()
662 sctp_packet_reset(packet); in sctp_packet_transmit()
671 static enum sctp_xmit sctp_packet_can_append_data(struct sctp_packet *packet, in sctp_packet_can_append_data() argument
675 struct sctp_transport *transport = packet->transport; in sctp_packet_can_append_data()
731 if (!sctp_packet_empty(packet)) in sctp_packet_can_append_data()
742 packet->overhead - sctp_datachk_len(&chunk->asoc->stream) - 4) in sctp_packet_can_append_data()
755 static void sctp_packet_append_data(struct sctp_packet *packet, in sctp_packet_append_data() argument
758 struct sctp_transport *transport = packet->transport; in sctp_packet_append_data()
780 static enum sctp_xmit sctp_packet_will_fit(struct sctp_packet *packet, in sctp_packet_will_fit() argument
792 if ((packet->auth && chunk->shkey != packet->auth->shkey) || in sctp_packet_will_fit()
793 (!packet->auth && chunk->shkey && in sctp_packet_will_fit()
797 psize = packet->size; in sctp_packet_will_fit()
798 if (packet->transport->asoc) in sctp_packet_will_fit()
799 pmtu = packet->transport->asoc->pathmtu; in sctp_packet_will_fit()
801 pmtu = packet->transport->pathmtu; in sctp_packet_will_fit()
812 if (sctp_packet_empty(packet) || in sctp_packet_will_fit()
813 (!packet->has_data && chunk->auth)) { in sctp_packet_will_fit()
818 packet->ipfragok = 1; in sctp_packet_will_fit()
827 maxsize = pmtu - packet->overhead; in sctp_packet_will_fit()
828 if (packet->auth) in sctp_packet_will_fit()
829 maxsize -= SCTP_PAD4(packet->auth->skb->len); in sctp_packet_will_fit()
839 if (!sctp_chunk_is_data(chunk) && packet->has_data) in sctp_packet_will_fit()
842 if (psize + chunk_len > packet->max_size) in sctp_packet_will_fit()
846 if (!packet->transport->burst_limited && in sctp_packet_will_fit()
847 psize + chunk_len > (packet->transport->cwnd >> 1)) in sctp_packet_will_fit()
853 if (packet->transport->burst_limited && in sctp_packet_will_fit()
854 psize + chunk_len > (packet->transport->burst_limited >> 1)) in sctp_packet_will_fit()