ar-internal.h (0d6bf319bc5aba4535bb46e1b607973688a2248a) ar-internal.h (9d35d880e0e4a3ab32d8c12f9e4d76198aadd42d)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* AF_RXRPC internal definitions
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/atomic.h>

--- 278 unchanged lines hidden (view full) ---

287 struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */
288 struct sk_buff_head rx_queue; /* Received packets */
289 struct list_head conn_attend_q; /* Conns requiring immediate attention */
290 struct list_head call_attend_q; /* Calls requiring immediate attention */
291
292 struct rb_root client_bundles; /* Client connection bundles by socket params */
293 spinlock_t client_bundles_lock; /* Lock for client_bundles */
294 bool kill_all_client_conns;
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* AF_RXRPC internal definitions
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
6 */
7
8#include <linux/atomic.h>

--- 278 unchanged lines hidden (view full) ---

287 struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */
288 struct sk_buff_head rx_queue; /* Received packets */
289 struct list_head conn_attend_q; /* Conns requiring immediate attention */
290 struct list_head call_attend_q; /* Calls requiring immediate attention */
291
292 struct rb_root client_bundles; /* Client connection bundles by socket params */
293 spinlock_t client_bundles_lock; /* Lock for client_bundles */
294 bool kill_all_client_conns;
295 spinlock_t client_conn_cache_lock; /* Lock for ->*_client_conns */
296 struct list_head idle_client_conns;
297 struct timer_list client_conn_reap_timer;
298 unsigned long client_conn_flags;
299#define RXRPC_CLIENT_CONN_REAP_TIMER 0 /* The client conn reap timer expired */
300
301 spinlock_t lock; /* access lock */
302 rwlock_t services_lock; /* lock for services list */
303 int debug_id; /* debug ID for printks */
304 bool dead;
305 bool service_closed; /* Service socket closed */
306 struct idr conn_ids; /* List of connection IDs */
295 struct list_head idle_client_conns;
296 struct timer_list client_conn_reap_timer;
297 unsigned long client_conn_flags;
298#define RXRPC_CLIENT_CONN_REAP_TIMER 0 /* The client conn reap timer expired */
299
300 spinlock_t lock; /* access lock */
301 rwlock_t services_lock; /* lock for services list */
302 int debug_id; /* debug ID for printks */
303 bool dead;
304 bool service_closed; /* Service socket closed */
305 struct idr conn_ids; /* List of connection IDs */
307 spinlock_t conn_lock; /* Lock for client connection pool */
306 struct list_head new_client_calls; /* Newly created client calls need connection */
307 spinlock_t client_call_lock; /* Lock for ->new_client_calls */
308 struct sockaddr_rxrpc srx; /* local address */
309};
310
311/*
312 * RxRPC remote transport endpoint definition
313 * - matched by local endpoint, remote port, address and protocol type
314 */
315struct rxrpc_peer {

--- 64 unchanged lines hidden (view full) ---

380 RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
381 NR__RXRPC_CALL_COMPLETIONS
382};
383
384/*
385 * Bits in the connection flags.
386 */
387enum rxrpc_conn_flag {
308 struct sockaddr_rxrpc srx; /* local address */
309};
310
311/*
312 * RxRPC remote transport endpoint definition
313 * - matched by local endpoint, remote port, address and protocol type
314 */
315struct rxrpc_peer {

--- 64 unchanged lines hidden (view full) ---

380 RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
381 NR__RXRPC_CALL_COMPLETIONS
382};
383
384/*
385 * Bits in the connection flags.
386 */
387enum rxrpc_conn_flag {
388 RXRPC_CONN_HAS_IDR, /* Has a client conn ID assigned */
389 RXRPC_CONN_IN_SERVICE_CONNS, /* Conn is in peer->service_conns */
390 RXRPC_CONN_DONT_REUSE, /* Don't reuse this connection */
391 RXRPC_CONN_PROBING_FOR_UPGRADE, /* Probing for service upgrade */
392 RXRPC_CONN_FINAL_ACK_0, /* Need final ACK for channel 0 */
393 RXRPC_CONN_FINAL_ACK_1, /* Need final ACK for channel 1 */
394 RXRPC_CONN_FINAL_ACK_2, /* Need final ACK for channel 2 */
395 RXRPC_CONN_FINAL_ACK_3, /* Need final ACK for channel 3 */
396};

--- 11 unchanged lines hidden (view full) ---

408 RXRPC_CONN_EV_ABORT_CALLS, /* Abort attached calls */
409};
410
411/*
412 * The connection protocol state.
413 */
414enum rxrpc_conn_proto_state {
415 RXRPC_CONN_UNUSED, /* Connection not yet attempted */
388 RXRPC_CONN_IN_SERVICE_CONNS, /* Conn is in peer->service_conns */
389 RXRPC_CONN_DONT_REUSE, /* Don't reuse this connection */
390 RXRPC_CONN_PROBING_FOR_UPGRADE, /* Probing for service upgrade */
391 RXRPC_CONN_FINAL_ACK_0, /* Need final ACK for channel 0 */
392 RXRPC_CONN_FINAL_ACK_1, /* Need final ACK for channel 1 */
393 RXRPC_CONN_FINAL_ACK_2, /* Need final ACK for channel 2 */
394 RXRPC_CONN_FINAL_ACK_3, /* Need final ACK for channel 3 */
395};

--- 11 unchanged lines hidden (view full) ---

407 RXRPC_CONN_EV_ABORT_CALLS, /* Abort attached calls */
408};
409
410/*
411 * The connection protocol state.
412 */
413enum rxrpc_conn_proto_state {
414 RXRPC_CONN_UNUSED, /* Connection not yet attempted */
415 RXRPC_CONN_CLIENT_UNSECURED, /* Client connection needs security init */
416 RXRPC_CONN_CLIENT, /* Client connection */
417 RXRPC_CONN_SERVICE_PREALLOC, /* Service connection preallocation */
418 RXRPC_CONN_SERVICE_UNSECURED, /* Service unsecured connection */
419 RXRPC_CONN_SERVICE_CHALLENGING, /* Service challenging for security */
420 RXRPC_CONN_SERVICE, /* Service secured connection */
421 RXRPC_CONN_ABORTED, /* Conn aborted */
422 RXRPC_CONN__NR_STATES
423};

--- 7 unchanged lines hidden (view full) ---

431 struct key *key; /* Security details */
432 const struct rxrpc_security *security; /* applied security module */
433 refcount_t ref;
434 atomic_t active; /* Number of active users */
435 unsigned int debug_id;
436 u32 security_level; /* Security level selected */
437 u16 service_id; /* Service ID for this connection */
438 bool try_upgrade; /* True if the bundle is attempting upgrade */
416 RXRPC_CONN_CLIENT, /* Client connection */
417 RXRPC_CONN_SERVICE_PREALLOC, /* Service connection preallocation */
418 RXRPC_CONN_SERVICE_UNSECURED, /* Service unsecured connection */
419 RXRPC_CONN_SERVICE_CHALLENGING, /* Service challenging for security */
420 RXRPC_CONN_SERVICE, /* Service secured connection */
421 RXRPC_CONN_ABORTED, /* Conn aborted */
422 RXRPC_CONN__NR_STATES
423};

--- 7 unchanged lines hidden (view full) ---

431 struct key *key; /* Security details */
432 const struct rxrpc_security *security; /* applied security module */
433 refcount_t ref;
434 atomic_t active; /* Number of active users */
435 unsigned int debug_id;
436 u32 security_level; /* Security level selected */
437 u16 service_id; /* Service ID for this connection */
438 bool try_upgrade; /* True if the bundle is attempting upgrade */
439 bool alloc_conn; /* True if someone's getting a conn */
440 bool exclusive; /* T if conn is exclusive */
441 bool upgrade; /* T if service ID can be upgraded */
439 bool exclusive; /* T if conn is exclusive */
440 bool upgrade; /* T if service ID can be upgraded */
442 short alloc_error; /* Error from last conn allocation */
443 spinlock_t channel_lock;
441 unsigned short alloc_error; /* Error from last conn allocation */
444 struct rb_node local_node; /* Node in local->client_conns */
445 struct list_head waiting_calls; /* Calls waiting for channels */
446 unsigned long avail_chans; /* Mask of available channels */
447 struct rxrpc_connection *conns[4]; /* The connections in the bundle (max 4) */
448};
449
450/*
451 * RxRPC connection definition

--- 11 unchanged lines hidden (view full) ---

463 refcount_t ref;
464 atomic_t active; /* Active count for service conns */
465 struct rcu_head rcu;
466 struct list_head cache_link;
467
468 unsigned char act_chans; /* Mask of active channels */
469 struct rxrpc_channel {
470 unsigned long final_ack_at; /* Time at which to issue final ACK */
442 struct rb_node local_node; /* Node in local->client_conns */
443 struct list_head waiting_calls; /* Calls waiting for channels */
444 unsigned long avail_chans; /* Mask of available channels */
445 struct rxrpc_connection *conns[4]; /* The connections in the bundle (max 4) */
446};
447
448/*
449 * RxRPC connection definition

--- 11 unchanged lines hidden (view full) ---

461 refcount_t ref;
462 atomic_t active; /* Active count for service conns */
463 struct rcu_head rcu;
464 struct list_head cache_link;
465
466 unsigned char act_chans; /* Mask of active channels */
467 struct rxrpc_channel {
468 unsigned long final_ack_at; /* Time at which to issue final ACK */
471 struct rxrpc_call __rcu *call; /* Active call */
469 struct rxrpc_call *call; /* Active call */
472 unsigned int call_debug_id; /* call->debug_id */
473 u32 call_id; /* ID of current call */
474 u32 call_counter; /* Call ID counter */
475 u32 last_call; /* ID of last call */
476 u8 last_type; /* Type of last packet */
477 union {
478 u32 last_seq;
479 u32 last_abort;

--- 4 unchanged lines hidden (view full) ---

484 struct work_struct processor; /* connection event processor */
485 struct work_struct destructor; /* In-process-context destroyer */
486 struct rxrpc_bundle *bundle; /* Client connection bundle */
487 struct rb_node service_node; /* Node in peer->service_conns */
488 struct list_head proc_link; /* link in procfs list */
489 struct list_head link; /* link in master connection list */
490 struct sk_buff_head rx_queue; /* received conn-level packets */
491
470 unsigned int call_debug_id; /* call->debug_id */
471 u32 call_id; /* ID of current call */
472 u32 call_counter; /* Call ID counter */
473 u32 last_call; /* ID of last call */
474 u8 last_type; /* Type of last packet */
475 union {
476 u32 last_seq;
477 u32 last_abort;

--- 4 unchanged lines hidden (view full) ---

482 struct work_struct processor; /* connection event processor */
483 struct work_struct destructor; /* In-process-context destroyer */
484 struct rxrpc_bundle *bundle; /* Client connection bundle */
485 struct rb_node service_node; /* Node in peer->service_conns */
486 struct list_head proc_link; /* link in procfs list */
487 struct list_head link; /* link in master connection list */
488 struct sk_buff_head rx_queue; /* received conn-level packets */
489
490 struct mutex security_lock; /* Lock for security management */
492 const struct rxrpc_security *security; /* applied security module */
493 union {
494 struct {
495 struct crypto_sync_skcipher *cipher; /* encryption handle */
496 struct rxrpc_crypt csum_iv; /* packet checksum base */
497 u32 nonce; /* response re-use preventer */
498 } rxkad;
499 };

--- 114 unchanged lines hidden (view full) ---

614 unsigned long expect_req_by; /* When we expect to get a request DATA packet by */
615 unsigned long expect_term_by; /* When we expect call termination by */
616 u32 next_rx_timo; /* Timeout for next Rx packet (jif) */
617 u32 next_req_timo; /* Timeout for next Rx request packet (jif) */
618 struct timer_list timer; /* Combined event timer */
619 struct work_struct destroyer; /* In-process-context destroyer */
620 rxrpc_notify_rx_t notify_rx; /* kernel service Rx notification function */
621 struct list_head link; /* link in master call list */
491 const struct rxrpc_security *security; /* applied security module */
492 union {
493 struct {
494 struct crypto_sync_skcipher *cipher; /* encryption handle */
495 struct rxrpc_crypt csum_iv; /* packet checksum base */
496 u32 nonce; /* response re-use preventer */
497 } rxkad;
498 };

--- 114 unchanged lines hidden (view full) ---

613 unsigned long expect_req_by; /* When we expect to get a request DATA packet by */
614 unsigned long expect_term_by; /* When we expect call termination by */
615 u32 next_rx_timo; /* Timeout for next Rx packet (jif) */
616 u32 next_req_timo; /* Timeout for next Rx request packet (jif) */
617 struct timer_list timer; /* Combined event timer */
618 struct work_struct destroyer; /* In-process-context destroyer */
619 rxrpc_notify_rx_t notify_rx; /* kernel service Rx notification function */
620 struct list_head link; /* link in master call list */
622 struct list_head chan_wait_link; /* Link in conn->bundle->waiting_calls */
621 struct list_head wait_link; /* Link in local->new_client_calls */
623 struct hlist_node error_link; /* link in error distribution list */
624 struct list_head accept_link; /* Link in rx->acceptq */
625 struct list_head recvmsg_link; /* Link in rx->recvmsg_q */
626 struct list_head sock_link; /* Link in rx->sock_calls */
627 struct rb_node sock_node; /* Node in rx->calls */
628 struct list_head attend_link; /* Link in local->call_attend_q */
629 struct rxrpc_txbuf *tx_pending; /* Tx buffer being filled */
630 wait_queue_head_t waitq; /* Wait queue for channel or Tx */

--- 230 unchanged lines hidden (view full) ---

861void rxrpc_poke_call(struct rxrpc_call *call, enum rxrpc_call_poke_trace what);
862struct rxrpc_call *rxrpc_find_call_by_user_ID(struct rxrpc_sock *, unsigned long);
863struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *, gfp_t, unsigned int);
864struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *,
865 struct rxrpc_conn_parameters *,
866 struct sockaddr_rxrpc *,
867 struct rxrpc_call_params *, gfp_t,
868 unsigned int);
622 struct hlist_node error_link; /* link in error distribution list */
623 struct list_head accept_link; /* Link in rx->acceptq */
624 struct list_head recvmsg_link; /* Link in rx->recvmsg_q */
625 struct list_head sock_link; /* Link in rx->sock_calls */
626 struct rb_node sock_node; /* Node in rx->calls */
627 struct list_head attend_link; /* Link in local->call_attend_q */
628 struct rxrpc_txbuf *tx_pending; /* Tx buffer being filled */
629 wait_queue_head_t waitq; /* Wait queue for channel or Tx */

--- 230 unchanged lines hidden (view full) ---

860void rxrpc_poke_call(struct rxrpc_call *call, enum rxrpc_call_poke_trace what);
861struct rxrpc_call *rxrpc_find_call_by_user_ID(struct rxrpc_sock *, unsigned long);
862struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *, gfp_t, unsigned int);
863struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *,
864 struct rxrpc_conn_parameters *,
865 struct sockaddr_rxrpc *,
866 struct rxrpc_call_params *, gfp_t,
867 unsigned int);
868void rxrpc_start_call_timer(struct rxrpc_call *call);
869void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *,
870 struct sk_buff *);
871void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *);
872void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
873void rxrpc_see_call(struct rxrpc_call *, enum rxrpc_call_trace);
874struct rxrpc_call *rxrpc_try_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
875void rxrpc_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
876void rxrpc_put_call(struct rxrpc_call *, enum rxrpc_call_trace);

--- 23 unchanged lines hidden (view full) ---

900void rxrpc_prefail_call(struct rxrpc_call *call, enum rxrpc_call_completion compl,
901 int error);
902
903static inline void rxrpc_set_call_state(struct rxrpc_call *call,
904 enum rxrpc_call_state state)
905{
906 /* Order write of completion info before write of ->state. */
907 smp_store_release(&call->_state, state);
869void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *,
870 struct sk_buff *);
871void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *);
872void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
873void rxrpc_see_call(struct rxrpc_call *, enum rxrpc_call_trace);
874struct rxrpc_call *rxrpc_try_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
875void rxrpc_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
876void rxrpc_put_call(struct rxrpc_call *, enum rxrpc_call_trace);

--- 23 unchanged lines hidden (view full) ---

900void rxrpc_prefail_call(struct rxrpc_call *call, enum rxrpc_call_completion compl,
901 int error);
902
903static inline void rxrpc_set_call_state(struct rxrpc_call *call,
904 enum rxrpc_call_state state)
905{
906 /* Order write of completion info before write of ->state. */
907 smp_store_release(&call->_state, state);
908 wake_up(&call->waitq);
908}
909
910static inline enum rxrpc_call_state __rxrpc_call_state(const struct rxrpc_call *call)
911{
912 return call->_state; /* Only inside I/O thread */
913}
914
915static inline bool __rxrpc_call_is_complete(const struct rxrpc_call *call)

--- 19 unchanged lines hidden (view full) ---

935
936/*
937 * conn_client.c
938 */
939extern unsigned int rxrpc_reap_client_connections;
940extern unsigned long rxrpc_conn_idle_client_expiry;
941extern unsigned long rxrpc_conn_idle_client_fast_expiry;
942
909}
910
911static inline enum rxrpc_call_state __rxrpc_call_state(const struct rxrpc_call *call)
912{
913 return call->_state; /* Only inside I/O thread */
914}
915
916static inline bool __rxrpc_call_is_complete(const struct rxrpc_call *call)

--- 19 unchanged lines hidden (view full) ---

936
937/*
938 * conn_client.c
939 */
940extern unsigned int rxrpc_reap_client_connections;
941extern unsigned long rxrpc_conn_idle_client_expiry;
942extern unsigned long rxrpc_conn_idle_client_fast_expiry;
943
943void rxrpc_destroy_client_conn_ids(struct rxrpc_local *local);
944void rxrpc_purge_client_connections(struct rxrpc_local *local);
944struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace);
945void rxrpc_put_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace);
945struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace);
946void rxrpc_put_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace);
946int rxrpc_connect_call(struct rxrpc_call *call, gfp_t gfp);
947int rxrpc_look_up_bundle(struct rxrpc_call *call, gfp_t gfp);
948void rxrpc_connect_client_calls(struct rxrpc_local *local);
947void rxrpc_expose_client_call(struct rxrpc_call *);
948void rxrpc_disconnect_client_call(struct rxrpc_bundle *, struct rxrpc_call *);
949void rxrpc_deactivate_bundle(struct rxrpc_bundle *bundle);
950void rxrpc_put_client_conn(struct rxrpc_connection *, enum rxrpc_conn_trace);
951void rxrpc_discard_expired_client_conns(struct rxrpc_local *local);
952void rxrpc_clean_up_local_conns(struct rxrpc_local *);
953
954/*

--- 443 unchanged lines hidden ---
949void rxrpc_expose_client_call(struct rxrpc_call *);
950void rxrpc_disconnect_client_call(struct rxrpc_bundle *, struct rxrpc_call *);
951void rxrpc_deactivate_bundle(struct rxrpc_bundle *bundle);
952void rxrpc_put_client_conn(struct rxrpc_connection *, enum rxrpc_conn_trace);
953void rxrpc_discard_expired_client_conns(struct rxrpc_local *local);
954void rxrpc_clean_up_local_conns(struct rxrpc_local *);
955
956/*

--- 443 unchanged lines hidden ---