Lines Matching refs:ctx
800 static void sctp_outq_select_transport(struct sctp_flush_ctx *ctx, in sctp_outq_select_transport() argument
816 if (ctx->transport && sctp_cmp_addr_exact(&chunk->dest, in sctp_outq_select_transport()
817 &ctx->transport->ipaddr)) in sctp_outq_select_transport()
818 new_transport = ctx->transport; in sctp_outq_select_transport()
820 new_transport = sctp_assoc_lookup_paddr(ctx->asoc, in sctp_outq_select_transport()
828 new_transport = ctx->asoc->peer.active_path; in sctp_outq_select_transport()
853 new_transport = ctx->asoc->peer.active_path; in sctp_outq_select_transport()
861 if (new_transport != ctx->transport) { in sctp_outq_select_transport()
862 ctx->transport = new_transport; in sctp_outq_select_transport()
863 ctx->packet = &ctx->transport->packet; in sctp_outq_select_transport()
865 if (list_empty(&ctx->transport->send_ready)) in sctp_outq_select_transport()
866 list_add_tail(&ctx->transport->send_ready, in sctp_outq_select_transport()
867 &ctx->transport_list); in sctp_outq_select_transport()
869 sctp_packet_config(ctx->packet, in sctp_outq_select_transport()
870 ctx->asoc->peer.i.init_tag, in sctp_outq_select_transport()
871 ctx->asoc->peer.ecn_capable); in sctp_outq_select_transport()
875 sctp_transport_burst_limited(ctx->transport); in sctp_outq_select_transport()
879 static void sctp_outq_flush_ctrl(struct sctp_flush_ctx *ctx) in sctp_outq_flush_ctrl() argument
885 list_for_each_entry_safe(chunk, tmp, &ctx->q->control_chunk_list, list) { in sctp_outq_flush_ctrl()
894 if (ctx->asoc->src_out_of_asoc_ok && in sctp_outq_flush_ctrl()
903 sctp_outq_select_transport(ctx, chunk); in sctp_outq_flush_ctrl()
914 error = sctp_packet_singleton(ctx->transport, chunk, in sctp_outq_flush_ctrl()
915 ctx->gfp); in sctp_outq_flush_ctrl()
917 ctx->asoc->base.sk->sk_err = -error; in sctp_outq_flush_ctrl()
920 ctx->asoc->stats.octrlchunks++; in sctp_outq_flush_ctrl()
925 ctx->packet->vtag = ctx->asoc->c.my_vtag; in sctp_outq_flush_ctrl()
945 error = sctp_packet_singleton(ctx->transport, in sctp_outq_flush_ctrl()
946 chunk, ctx->gfp); in sctp_outq_flush_ctrl()
948 ctx->asoc->stats.octrlchunks++; in sctp_outq_flush_ctrl()
959 status = sctp_packet_transmit_chunk(ctx->packet, chunk, in sctp_outq_flush_ctrl()
960 one_packet, ctx->gfp); in sctp_outq_flush_ctrl()
963 list_add(&chunk->list, &ctx->q->control_chunk_list); in sctp_outq_flush_ctrl()
967 ctx->asoc->stats.octrlchunks++; in sctp_outq_flush_ctrl()
974 sctp_transport_reset_t3_rtx(ctx->transport); in sctp_outq_flush_ctrl()
975 ctx->transport->last_time_sent = jiffies; in sctp_outq_flush_ctrl()
978 if (chunk == ctx->asoc->strreset_chunk) in sctp_outq_flush_ctrl()
979 sctp_transport_reset_reconf_timer(ctx->transport); in sctp_outq_flush_ctrl()
991 static bool sctp_outq_flush_rtx(struct sctp_flush_ctx *ctx, in sctp_outq_flush_rtx() argument
996 if (ctx->asoc->peer.retran_path->state == SCTP_UNCONFIRMED) in sctp_outq_flush_rtx()
999 if (ctx->transport != ctx->asoc->peer.retran_path) { in sctp_outq_flush_rtx()
1001 ctx->transport = ctx->asoc->peer.retran_path; in sctp_outq_flush_rtx()
1002 ctx->packet = &ctx->transport->packet; in sctp_outq_flush_rtx()
1004 if (list_empty(&ctx->transport->send_ready)) in sctp_outq_flush_rtx()
1005 list_add_tail(&ctx->transport->send_ready, in sctp_outq_flush_rtx()
1006 &ctx->transport_list); in sctp_outq_flush_rtx()
1008 sctp_packet_config(ctx->packet, ctx->asoc->peer.i.init_tag, in sctp_outq_flush_rtx()
1009 ctx->asoc->peer.ecn_capable); in sctp_outq_flush_rtx()
1012 error = __sctp_outq_flush_rtx(ctx->q, ctx->packet, rtx_timeout, in sctp_outq_flush_rtx()
1013 &start_timer, ctx->gfp); in sctp_outq_flush_rtx()
1015 ctx->asoc->base.sk->sk_err = -error; in sctp_outq_flush_rtx()
1018 sctp_transport_reset_t3_rtx(ctx->transport); in sctp_outq_flush_rtx()
1019 ctx->transport->last_time_sent = jiffies; in sctp_outq_flush_rtx()
1025 if (ctx->packet->has_cookie_echo) in sctp_outq_flush_rtx()
1031 if (!list_empty(&ctx->q->retransmit)) in sctp_outq_flush_rtx()
1037 static void sctp_outq_flush_data(struct sctp_flush_ctx *ctx, in sctp_outq_flush_data() argument
1044 switch (ctx->asoc->state) { in sctp_outq_flush_data()
1049 if (!ctx->packet || !ctx->packet->has_cookie_echo) in sctp_outq_flush_data()
1071 if (!list_empty(&ctx->q->retransmit) && in sctp_outq_flush_data()
1072 !sctp_outq_flush_rtx(ctx, rtx_timeout)) in sctp_outq_flush_data()
1080 if (ctx->transport) in sctp_outq_flush_data()
1081 sctp_transport_burst_limited(ctx->transport); in sctp_outq_flush_data()
1084 while ((chunk = sctp_outq_dequeue_data(ctx->q)) != NULL) { in sctp_outq_flush_data()
1086 __u8 stream_state = SCTP_SO(&ctx->asoc->stream, sid)->state; in sctp_outq_flush_data()
1090 sctp_sched_dequeue_done(ctx->q, chunk); in sctp_outq_flush_data()
1097 sctp_outq_head_data(ctx->q, chunk); in sctp_outq_flush_data()
1101 sctp_outq_select_transport(ctx, chunk); in sctp_outq_flush_data()
1104 __func__, ctx->q, chunk, chunk && chunk->chunk_hdr ? in sctp_outq_flush_data()
1111 status = sctp_packet_transmit_chunk(ctx->packet, chunk, 0, in sctp_outq_flush_data()
1112 ctx->gfp); in sctp_outq_flush_data()
1121 sctp_outq_head_data(ctx->q, chunk); in sctp_outq_flush_data()
1129 if (ctx->asoc->state == SCTP_STATE_SHUTDOWN_PENDING) in sctp_outq_flush_data()
1132 ctx->asoc->stats.ouodchunks++; in sctp_outq_flush_data()
1134 ctx->asoc->stats.oodchunks++; in sctp_outq_flush_data()
1139 sctp_sched_dequeue_done(ctx->q, chunk); in sctp_outq_flush_data()
1142 &ctx->transport->transmitted); in sctp_outq_flush_data()
1144 sctp_transport_reset_t3_rtx(ctx->transport); in sctp_outq_flush_data()
1145 ctx->transport->last_time_sent = jiffies; in sctp_outq_flush_data()
1150 if (ctx->packet->has_cookie_echo) in sctp_outq_flush_data()
1155 static void sctp_outq_flush_transports(struct sctp_flush_ctx *ctx) in sctp_outq_flush_transports() argument
1157 struct sock *sk = ctx->asoc->base.sk; in sctp_outq_flush_transports()
1163 while ((ltransport = sctp_list_dequeue(&ctx->transport_list)) != NULL) { in sctp_outq_flush_transports()
1173 error = sctp_packet_transmit(packet, ctx->gfp); in sctp_outq_flush_transports()
1175 ctx->q->asoc->base.sk->sk_err = -error; in sctp_outq_flush_transports()
1194 struct sctp_flush_ctx ctx = { in sctp_outq_flush() local
1197 .transport_list = LIST_HEAD_INIT(ctx.transport_list), in sctp_outq_flush()
1212 sctp_outq_flush_ctrl(&ctx); in sctp_outq_flush()
1217 sctp_outq_flush_data(&ctx, rtx_timeout); in sctp_outq_flush()
1221 sctp_outq_flush_transports(&ctx); in sctp_outq_flush()