Lines Matching +full:packet +full:- +full:processor

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* connection-level event handling
17 #include "ar-internal.h"
28 if (conn->state != RXRPC_CONN_ABORTED) { in rxrpc_set_conn_aborted()
29 spin_lock(&conn->state_lock); in rxrpc_set_conn_aborted()
30 if (conn->state != RXRPC_CONN_ABORTED) { in rxrpc_set_conn_aborted()
31 conn->abort_code = abort_code; in rxrpc_set_conn_aborted()
32 conn->error = err; in rxrpc_set_conn_aborted()
33 conn->completion = compl; in rxrpc_set_conn_aborted()
35 smp_store_release(&conn->state, RXRPC_CONN_ABORTED); in rxrpc_set_conn_aborted()
36 set_bit(RXRPC_CONN_DONT_REUSE, &conn->flags); in rxrpc_set_conn_aborted()
37 set_bit(RXRPC_CONN_EV_ABORT_CALLS, &conn->events); in rxrpc_set_conn_aborted()
40 spin_unlock(&conn->state_lock); in rxrpc_set_conn_aborted()
56 trace_rxrpc_abort(0, why, sp->hdr.cid, sp->hdr.callNumber, in rxrpc_abort_conn()
57 sp->hdr.seq, abort_code, err); in rxrpc_abort_conn()
60 return -EPROTO; in rxrpc_abort_conn()
69 return rxrpc_set_conn_aborted(conn, skb, skb->priority, -ECONNABORTED, in rxrpc_input_conn_abort()
96 _enter("%d", conn->debug_id); in rxrpc_conn_retransmit_call()
98 if (sp && sp->hdr.type == RXRPC_PACKET_TYPE_ACK) { in rxrpc_conn_retransmit_call()
106 chan = &conn->channels[channel]; in rxrpc_conn_retransmit_call()
109 * ignore this packet. in rxrpc_conn_retransmit_call()
111 call_id = chan->last_call; in rxrpc_conn_retransmit_call()
112 if (skb && call_id != sp->hdr.callNumber) in rxrpc_conn_retransmit_call()
115 msg.msg_name = &conn->peer->srx.transport; in rxrpc_conn_retransmit_call()
116 msg.msg_namelen = conn->peer->srx.transport_len; in rxrpc_conn_retransmit_call()
130 pkt.whdr.epoch = htonl(conn->proto.epoch); in rxrpc_conn_retransmit_call()
131 pkt.whdr.cid = htonl(conn->proto.cid | channel); in rxrpc_conn_retransmit_call()
135 pkt.whdr.type = chan->last_type; in rxrpc_conn_retransmit_call()
136 pkt.whdr.flags = conn->out_clientflag; in rxrpc_conn_retransmit_call()
138 pkt.whdr.securityIndex = conn->security_ix; in rxrpc_conn_retransmit_call()
140 pkt.whdr.serviceId = htons(conn->service_id); in rxrpc_conn_retransmit_call()
143 switch (chan->last_type) { in rxrpc_conn_retransmit_call()
145 pkt.abort_code = htonl(chan->last_abort); in rxrpc_conn_retransmit_call()
152 mtu = conn->peer->if_mtu; in rxrpc_conn_retransmit_call()
153 mtu -= conn->peer->hdrsize; in rxrpc_conn_retransmit_call()
155 pkt.ack.maxSkew = htons(skb ? skb->priority : 0); in rxrpc_conn_retransmit_call()
156 pkt.ack.firstPacket = htonl(chan->last_seq + 1); in rxrpc_conn_retransmit_call()
157 pkt.ack.previousPacket = htonl(chan->last_seq); in rxrpc_conn_retransmit_call()
158 pkt.ack.serial = htonl(skb ? sp->hdr.serial : 0); in rxrpc_conn_retransmit_call()
171 trace_rxrpc_tx_ack(chan->call_debug_id, serial, in rxrpc_conn_retransmit_call()
181 ret = kernel_sendmsg(conn->local->socket, &msg, iov, ioc, len); in rxrpc_conn_retransmit_call()
182 conn->peer->last_tx_at = ktime_get_seconds(); in rxrpc_conn_retransmit_call()
184 trace_rxrpc_tx_fail(chan->call_debug_id, serial, ret, in rxrpc_conn_retransmit_call()
187 trace_rxrpc_tx_packet(chan->call_debug_id, &pkt.whdr, in rxrpc_conn_retransmit_call()
194 * pass a connection-level abort onto all calls on that connection
201 _enter("{%d},%x", conn->debug_id, conn->abort_code); in rxrpc_abort_calls()
204 call = conn->channels[i].call; in rxrpc_abort_calls()
207 conn->completion, in rxrpc_abort_calls()
208 conn->abort_code, in rxrpc_abort_calls()
209 conn->error); in rxrpc_abort_calls()
216 * mark a call as being on a now-secured channel
217 * - must be called with BH's disabled.
228 * connection-level Rx packet processor
236 if (conn->state == RXRPC_CONN_ABORTED) in rxrpc_process_event()
237 return -ECONNABORTED; in rxrpc_process_event()
239 _enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, sp->hdr.serial); in rxrpc_process_event()
241 switch (sp->hdr.type) { in rxrpc_process_event()
243 return conn->security->respond_to_challenge(conn, skb); in rxrpc_process_event()
246 ret = conn->security->verify_response(conn, skb); in rxrpc_process_event()
250 ret = conn->security->init_connection_security( in rxrpc_process_event()
251 conn, conn->key->payload.data[0]); in rxrpc_process_event()
255 spin_lock(&conn->state_lock); in rxrpc_process_event()
256 if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) in rxrpc_process_event()
257 conn->state = RXRPC_CONN_SERVICE; in rxrpc_process_event()
258 spin_unlock(&conn->state_lock); in rxrpc_process_event()
260 if (conn->state == RXRPC_CONN_SERVICE) { in rxrpc_process_event()
262 * we've already received the packet, put it on the in rxrpc_process_event()
265 skb->mark = RXRPC_SKB_MARK_SERVICE_CONN_SECURED; in rxrpc_process_event()
267 skb_queue_head(&conn->local->rx_queue, skb); in rxrpc_process_event()
268 rxrpc_wake_up_io_thread(conn->local); in rxrpc_process_event()
274 return -EPROTO; in rxrpc_process_event()
283 if (conn->security->issue_challenge(conn) < 0) in rxrpc_secure_connection()
284 rxrpc_abort_conn(conn, NULL, RX_CALL_DEAD, -ENOMEM, in rxrpc_secure_connection()
301 struct rxrpc_channel *chan = &conn->channels[channel]; in rxrpc_process_delayed_final_acks()
304 if (!test_bit(RXRPC_CONN_FINAL_ACK_0 + channel, &conn->flags)) in rxrpc_process_delayed_final_acks()
307 ack_at = chan->final_ack_at; in rxrpc_process_delayed_final_acks()
317 &conn->flags)) in rxrpc_process_delayed_final_acks()
329 * connection-level event processor
336 if (test_and_clear_bit(RXRPC_CONN_EV_CHALLENGE, &conn->events)) in rxrpc_do_process_connection()
339 /* go through the conn-level event packets, releasing the ref on this in rxrpc_do_process_connection()
341 while ((skb = skb_dequeue(&conn->rx_queue))) { in rxrpc_do_process_connection()
345 case -ENOMEM: in rxrpc_do_process_connection()
346 case -EAGAIN: in rxrpc_do_process_connection()
347 skb_queue_head(&conn->rx_queue, skb); in rxrpc_do_process_connection()
360 container_of(work, struct rxrpc_connection, processor); in rxrpc_process_connection()
364 if (__rxrpc_use_local(conn->local, rxrpc_local_use_conn_work)) { in rxrpc_process_connection()
366 rxrpc_unuse_local(conn->local, rxrpc_local_unuse_conn_work); in rxrpc_process_connection()
371 * post connection-level events to the connection
372 * - this includes challenges, responses, some aborts and call terminal packet
381 skb_queue_tail(&conn->rx_queue, skb); in rxrpc_post_packet_to_conn()
386 * Input a connection-level packet.
392 switch (sp->hdr.type) { in rxrpc_input_conn_packet()
407 if (conn->completion == RXRPC_CALL_LOCALLY_ABORTED) in rxrpc_input_conn_packet()
427 if (test_and_clear_bit(RXRPC_CONN_EV_ABORT_CALLS, &conn->events)) in rxrpc_input_conn_event()
430 switch (skb->mark) { in rxrpc_input_conn_event()
432 if (conn->state != RXRPC_CONN_SERVICE) in rxrpc_input_conn_event()
436 rxrpc_call_is_secure(conn->channels[loop].call); in rxrpc_input_conn_event()
441 if (conn->flags & RXRPC_CONN_FINAL_ACK_MASK) in rxrpc_input_conn_event()