Skip to content

Commit a00ce28

Browse files
committed
rxrpc: Clean up connection abort
Clean up connection abort, using the connection state_lock to gate access to change that state, and use an rxrpc_call_completion value to indicate the difference between local and remote aborts as these can be pasted directly into the call state. Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected]
1 parent f2cce89 commit a00ce28

File tree

8 files changed

+188
-213
lines changed

8 files changed

+188
-213
lines changed

include/trace/events/rxrpc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
EM(rxrpc_conn_get_call_input, "GET inp-call") \
112112
EM(rxrpc_conn_get_conn_input, "GET inp-conn") \
113113
EM(rxrpc_conn_get_idle, "GET idle ") \
114+
EM(rxrpc_conn_get_poke_abort, "GET pk-abort") \
114115
EM(rxrpc_conn_get_poke_timer, "GET poke ") \
115116
EM(rxrpc_conn_get_service_conn, "GET svc-conn") \
116117
EM(rxrpc_conn_new_client, "NEW client ") \
@@ -128,6 +129,7 @@
128129
EM(rxrpc_conn_put_unidle, "PUT unidle ") \
129130
EM(rxrpc_conn_put_work, "PUT work ") \
130131
EM(rxrpc_conn_queue_challenge, "QUE chall ") \
132+
EM(rxrpc_conn_queue_retry_work, "QUE retry-wk") \
131133
EM(rxrpc_conn_queue_rx_work, "QUE rx-work ") \
132134
EM(rxrpc_conn_see_new_service_conn, "SEE new-svc ") \
133135
EM(rxrpc_conn_see_reap_service, "SEE reap-svc") \

net/rxrpc/ar-internal.h

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,11 @@ struct rxrpc_security {
263263

264264
/* respond to a challenge */
265265
int (*respond_to_challenge)(struct rxrpc_connection *,
266-
struct sk_buff *,
267-
u32 *);
266+
struct sk_buff *);
268267

269268
/* verify a response */
270269
int (*verify_response)(struct rxrpc_connection *,
271-
struct sk_buff *,
272-
u32 *);
270+
struct sk_buff *);
273271

274272
/* clear connection security */
275273
void (*clear)(struct rxrpc_connection *);
@@ -367,6 +365,18 @@ struct rxrpc_conn_parameters {
367365
u32 security_level; /* Security level selected */
368366
};
369367

368+
/*
369+
* Call completion condition (state == RXRPC_CALL_COMPLETE).
370+
*/
371+
enum rxrpc_call_completion {
372+
RXRPC_CALL_SUCCEEDED, /* - Normal termination */
373+
RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
374+
RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
375+
RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
376+
RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
377+
NR__RXRPC_CALL_COMPLETIONS
378+
};
379+
370380
/*
371381
* Bits in the connection flags.
372382
*/
@@ -391,6 +401,7 @@ enum rxrpc_conn_flag {
391401
*/
392402
enum rxrpc_conn_event {
393403
RXRPC_CONN_EV_CHALLENGE, /* Send challenge packet */
404+
RXRPC_CONN_EV_ABORT_CALLS, /* Abort attached calls */
394405
};
395406

396407
/*
@@ -403,8 +414,7 @@ enum rxrpc_conn_proto_state {
403414
RXRPC_CONN_SERVICE_UNSECURED, /* Service unsecured connection */
404415
RXRPC_CONN_SERVICE_CHALLENGING, /* Service challenging for security */
405416
RXRPC_CONN_SERVICE, /* Service secured connection */
406-
RXRPC_CONN_REMOTELY_ABORTED, /* Conn aborted by peer */
407-
RXRPC_CONN_LOCALLY_ABORTED, /* Conn aborted locally */
417+
RXRPC_CONN_ABORTED, /* Conn aborted */
408418
RXRPC_CONN__NR_STATES
409419
};
410420

@@ -487,7 +497,8 @@ struct rxrpc_connection {
487497
unsigned long idle_timestamp; /* Time at which last became idle */
488498
spinlock_t state_lock; /* state-change lock */
489499
enum rxrpc_conn_proto_state state; /* current state of connection */
490-
u32 abort_code; /* Abort code of connection abort */
500+
enum rxrpc_call_completion completion; /* Completion condition */
501+
s32 abort_code; /* Abort code of connection abort */
491502
int debug_id; /* debug ID for printks */
492503
atomic_t serial; /* packet serial number counter */
493504
unsigned int hi_serial; /* highest serial number received */
@@ -561,18 +572,6 @@ enum rxrpc_call_state {
561572
NR__RXRPC_CALL_STATES
562573
};
563574

564-
/*
565-
* Call completion condition (state == RXRPC_CALL_COMPLETE).
566-
*/
567-
enum rxrpc_call_completion {
568-
RXRPC_CALL_SUCCEEDED, /* - Normal termination */
569-
RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
570-
RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
571-
RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
572-
RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
573-
NR__RXRPC_CALL_COMPLETIONS
574-
};
575-
576575
/*
577576
* Call Tx congestion management modes.
578577
*/
@@ -905,11 +904,19 @@ void rxrpc_clean_up_local_conns(struct rxrpc_local *);
905904
*/
906905
void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn, struct sk_buff *skb,
907906
unsigned int channel);
907+
int rxrpc_abort_conn(struct rxrpc_connection *conn, struct sk_buff *skb,
908+
s32 abort_code, int err, const char *why);
908909
void rxrpc_process_connection(struct work_struct *);
909910
void rxrpc_process_delayed_final_acks(struct rxrpc_connection *, bool);
910911
int rxrpc_input_conn_packet(struct rxrpc_connection *conn, struct sk_buff *skb);
911912
void rxrpc_input_conn_event(struct rxrpc_connection *conn, struct sk_buff *skb);
912913

914+
static inline bool rxrpc_is_conn_aborted(const struct rxrpc_connection *conn)
915+
{
916+
/* Order reading the abort info after the state check. */
917+
return smp_load_acquire(&conn->state) == RXRPC_CONN_ABORTED;
918+
}
919+
913920
/*
914921
* conn_object.c
915922
*/
@@ -1059,6 +1066,7 @@ static inline struct rxrpc_net *rxrpc_net(struct net *net)
10591066
int rxrpc_send_ack_packet(struct rxrpc_call *call, struct rxrpc_txbuf *txb);
10601067
int rxrpc_send_abort_packet(struct rxrpc_call *);
10611068
int rxrpc_send_data_packet(struct rxrpc_call *, struct rxrpc_txbuf *);
1069+
void rxrpc_send_conn_abort(struct rxrpc_connection *conn);
10621070
void rxrpc_reject_packet(struct rxrpc_local *local, struct sk_buff *skb);
10631071
void rxrpc_send_keepalive(struct rxrpc_peer *);
10641072
void rxrpc_transmit_one(struct rxrpc_call *call, struct rxrpc_txbuf *txb);

net/rxrpc/call_object.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,10 @@ void rxrpc_incoming_call(struct rxrpc_sock *rx,
443443
call->state = RXRPC_CALL_SERVER_RECV_REQUEST;
444444
break;
445445

446-
case RXRPC_CONN_REMOTELY_ABORTED:
447-
__rxrpc_set_call_completion(call, RXRPC_CALL_REMOTELY_ABORTED,
446+
case RXRPC_CONN_ABORTED:
447+
__rxrpc_set_call_completion(call, conn->completion,
448448
conn->abort_code, conn->error);
449449
break;
450-
case RXRPC_CONN_LOCALLY_ABORTED:
451-
__rxrpc_abort_call("CON", call, 1,
452-
conn->abort_code, conn->error);
453-
break;
454450
default:
455451
BUG();
456452
}

0 commit comments

Comments
 (0)