summaryrefslogtreecommitdiffstats
path: root/net/rxrpc/ar-internal.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-03-04 10:53:46 -0500
committerDavid Howells <dhowells@redhat.com>2016-03-04 10:53:46 -0500
commit5b8848d14912d5e9974d5d83d71ed6cba2b49345 (patch)
treea6c02244f92ba6fa0120576001c98e66300a867b /net/rxrpc/ar-internal.h
parente721498a63147618283d2a8093664809f300778c (diff)
rxrpc: Convert call flag and event numbers into enums
Convert call flag and event numbers into enums and move their definitions outside of the struct. Also move the call state enum outside of the struct and add an extra element to count the number of states. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/ar-internal.h')
-rw-r--r--net/rxrpc/ar-internal.h107
1 files changed, 62 insertions, 45 deletions
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 2934a73a5981..3aea424a88e4 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -293,6 +293,67 @@ struct rxrpc_connection {
293}; 293};
294 294
295/* 295/*
296 * Flags in call->flags.
297 */
298enum rxrpc_call_flag {
299 RXRPC_CALL_RELEASED, /* call has been released - no more message to userspace */
300 RXRPC_CALL_TERMINAL_MSG, /* call has given the socket its final message */
301 RXRPC_CALL_RCVD_LAST, /* all packets received */
302 RXRPC_CALL_RUN_RTIMER, /* Tx resend timer started */
303 RXRPC_CALL_TX_SOFT_ACK, /* sent some soft ACKs */
304 RXRPC_CALL_PROC_BUSY, /* the processor is busy */
305 RXRPC_CALL_INIT_ACCEPT, /* acceptance was initiated */
306 RXRPC_CALL_HAS_USERID, /* has a user ID attached */
307 RXRPC_CALL_EXPECT_OOS, /* expect out of sequence packets */
308};
309
310/*
311 * Events that can be raised on a call.
312 */
313enum rxrpc_call_event {
314 RXRPC_CALL_RCVD_ACKALL, /* ACKALL or reply received */
315 RXRPC_CALL_RCVD_BUSY, /* busy packet received */
316 RXRPC_CALL_RCVD_ABORT, /* abort packet received */
317 RXRPC_CALL_RCVD_ERROR, /* network error received */
318 RXRPC_CALL_ACK_FINAL, /* need to generate final ACK (and release call) */
319 RXRPC_CALL_ACK, /* need to generate ACK */
320 RXRPC_CALL_REJECT_BUSY, /* need to generate busy message */
321 RXRPC_CALL_ABORT, /* need to generate abort */
322 RXRPC_CALL_CONN_ABORT, /* local connection abort generated */
323 RXRPC_CALL_RESEND_TIMER, /* Tx resend timer expired */
324 RXRPC_CALL_RESEND, /* Tx resend required */
325 RXRPC_CALL_DRAIN_RX_OOS, /* drain the Rx out of sequence queue */
326 RXRPC_CALL_LIFE_TIMER, /* call's lifetimer ran out */
327 RXRPC_CALL_ACCEPTED, /* incoming call accepted by userspace app */
328 RXRPC_CALL_SECURED, /* incoming call's connection is now secure */
329 RXRPC_CALL_POST_ACCEPT, /* need to post an "accept?" message to the app */
330 RXRPC_CALL_RELEASE, /* need to release the call's resources */
331};
332
333/*
334 * The states that a call can be in.
335 */
336enum rxrpc_call_state {
337 RXRPC_CALL_CLIENT_SEND_REQUEST, /* - client sending request phase */
338 RXRPC_CALL_CLIENT_AWAIT_REPLY, /* - client awaiting reply */
339 RXRPC_CALL_CLIENT_RECV_REPLY, /* - client receiving reply phase */
340 RXRPC_CALL_CLIENT_FINAL_ACK, /* - client sending final ACK phase */
341 RXRPC_CALL_SERVER_SECURING, /* - server securing request connection */
342 RXRPC_CALL_SERVER_ACCEPTING, /* - server accepting request */
343 RXRPC_CALL_SERVER_RECV_REQUEST, /* - server receiving request */
344 RXRPC_CALL_SERVER_ACK_REQUEST, /* - server pending ACK of request */
345 RXRPC_CALL_SERVER_SEND_REPLY, /* - server sending reply */
346 RXRPC_CALL_SERVER_AWAIT_ACK, /* - server awaiting final ACK */
347 RXRPC_CALL_COMPLETE, /* - call completed */
348 RXRPC_CALL_SERVER_BUSY, /* - call rejected by busy server */
349 RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
350 RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
351 RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
352 RXRPC_CALL_DEAD, /* - call is dead */
353 NR__RXRPC_CALL_STATES
354};
355
356/*
296 * RxRPC call definition 357 * RxRPC call definition
297 * - matched by { connection, call_id } 358 * - matched by { connection, call_id }
298 */ 359 */
@@ -317,57 +378,13 @@ struct rxrpc_call {
317 unsigned long user_call_ID; /* user-defined call ID */ 378 unsigned long user_call_ID; /* user-defined call ID */
318 unsigned long creation_jif; /* time of call creation */ 379 unsigned long creation_jif; /* time of call creation */
319 unsigned long flags; 380 unsigned long flags;
320#define RXRPC_CALL_RELEASED 0 /* call has been released - no more message to userspace */
321#define RXRPC_CALL_TERMINAL_MSG 1 /* call has given the socket its final message */
322#define RXRPC_CALL_RCVD_LAST 2 /* all packets received */
323#define RXRPC_CALL_RUN_RTIMER 3 /* Tx resend timer started */
324#define RXRPC_CALL_TX_SOFT_ACK 4 /* sent some soft ACKs */
325#define RXRPC_CALL_PROC_BUSY 5 /* the processor is busy */
326#define RXRPC_CALL_INIT_ACCEPT 6 /* acceptance was initiated */
327#define RXRPC_CALL_HAS_USERID 7 /* has a user ID attached */
328#define RXRPC_CALL_EXPECT_OOS 8 /* expect out of sequence packets */
329 unsigned long events; 381 unsigned long events;
330#define RXRPC_CALL_RCVD_ACKALL 0 /* ACKALL or reply received */
331#define RXRPC_CALL_RCVD_BUSY 1 /* busy packet received */
332#define RXRPC_CALL_RCVD_ABORT 2 /* abort packet received */
333#define RXRPC_CALL_RCVD_ERROR 3 /* network error received */
334#define RXRPC_CALL_ACK_FINAL 4 /* need to generate final ACK (and release call) */
335#define RXRPC_CALL_ACK 5 /* need to generate ACK */
336#define RXRPC_CALL_REJECT_BUSY 6 /* need to generate busy message */
337#define RXRPC_CALL_ABORT 7 /* need to generate abort */
338#define RXRPC_CALL_CONN_ABORT 8 /* local connection abort generated */
339#define RXRPC_CALL_RESEND_TIMER 9 /* Tx resend timer expired */
340#define RXRPC_CALL_RESEND 10 /* Tx resend required */
341#define RXRPC_CALL_DRAIN_RX_OOS 11 /* drain the Rx out of sequence queue */
342#define RXRPC_CALL_LIFE_TIMER 12 /* call's lifetimer ran out */
343#define RXRPC_CALL_ACCEPTED 13 /* incoming call accepted by userspace app */
344#define RXRPC_CALL_SECURED 14 /* incoming call's connection is now secure */
345#define RXRPC_CALL_POST_ACCEPT 15 /* need to post an "accept?" message to the app */
346#define RXRPC_CALL_RELEASE 16 /* need to release the call's resources */
347
348 spinlock_t lock; 382 spinlock_t lock;
349 rwlock_t state_lock; /* lock for state transition */ 383 rwlock_t state_lock; /* lock for state transition */
350 atomic_t usage; 384 atomic_t usage;
351 atomic_t sequence; /* Tx data packet sequence counter */ 385 atomic_t sequence; /* Tx data packet sequence counter */
352 u32 abort_code; /* local/remote abort code */ 386 u32 abort_code; /* local/remote abort code */
353 enum { /* current state of call */ 387 enum rxrpc_call_state state : 8; /* current state of call */
354 RXRPC_CALL_CLIENT_SEND_REQUEST, /* - client sending request phase */
355 RXRPC_CALL_CLIENT_AWAIT_REPLY, /* - client awaiting reply */
356 RXRPC_CALL_CLIENT_RECV_REPLY, /* - client receiving reply phase */
357 RXRPC_CALL_CLIENT_FINAL_ACK, /* - client sending final ACK phase */
358 RXRPC_CALL_SERVER_SECURING, /* - server securing request connection */
359 RXRPC_CALL_SERVER_ACCEPTING, /* - server accepting request */
360 RXRPC_CALL_SERVER_RECV_REQUEST, /* - server receiving request */
361 RXRPC_CALL_SERVER_ACK_REQUEST, /* - server pending ACK of request */
362 RXRPC_CALL_SERVER_SEND_REPLY, /* - server sending reply */
363 RXRPC_CALL_SERVER_AWAIT_ACK, /* - server awaiting final ACK */
364 RXRPC_CALL_COMPLETE, /* - call completed */
365 RXRPC_CALL_SERVER_BUSY, /* - call rejected by busy server */
366 RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
367 RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
368 RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
369 RXRPC_CALL_DEAD, /* - call is dead */
370 } state;
371 int debug_id; /* debug ID for printks */ 388 int debug_id; /* debug ID for printks */
372 u8 channel; /* connection channel occupied by this call */ 389 u8 channel; /* connection channel occupied by this call */
373 390