^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* AF_RXRPC internal definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/atomic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/seqlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/win_minmax.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/net_namespace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <net/netns/generic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <net/af_rxrpc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "protocol.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define CHECK_SLAB_OKAY(X) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) BUG_ON(atomic_read((X)) >> (sizeof(atomic_t) - 2) == \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) (POISON_FREE << 8 | POISON_FREE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define CHECK_SLAB_OKAY(X) do {} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define FCRYPT_BSIZE 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct rxrpc_crypt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) u8 x[FCRYPT_BSIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) __be32 n[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) } __attribute__((aligned(8)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define rxrpc_queue_work(WS) queue_work(rxrpc_workqueue, (WS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define rxrpc_queue_delayed_work(WS,D) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) queue_delayed_work(rxrpc_workqueue, (WS), (D))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) struct rxrpc_connection;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * Mark applied to socket buffers in skb->mark. skb->priority is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * to pass supplementary information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) enum rxrpc_skb_mark {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) RXRPC_SKB_MARK_REJECT_BUSY, /* Reject with BUSY */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) RXRPC_SKB_MARK_REJECT_ABORT, /* Reject with ABORT (code in skb->priority) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * sk_state for RxRPC sockets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) RXRPC_UNBOUND = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) RXRPC_CLIENT_UNBOUND, /* Unbound socket used as client */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) RXRPC_CLIENT_BOUND, /* client local address bound */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) RXRPC_SERVER_BOUND, /* server local address bound */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) RXRPC_SERVER_BOUND2, /* second server local address bound */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) RXRPC_SERVER_LISTENING, /* server listening for connections */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) RXRPC_SERVER_LISTEN_DISABLED, /* server listening disabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) RXRPC_CLOSE, /* socket is being closed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * Per-network namespace data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct rxrpc_net {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct proc_dir_entry *proc_net; /* Subdir in /proc/net */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) u32 epoch; /* Local epoch for detecting local-end reset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct list_head calls; /* List of calls active in this namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) rwlock_t call_lock; /* Lock for ->calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) atomic_t nr_calls; /* Count of allocated calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) atomic_t nr_conns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct list_head conn_proc_list; /* List of conns in this namespace for proc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct list_head service_conns; /* Service conns in this namespace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) rwlock_t conn_lock; /* Lock for ->conn_proc_list, ->service_conns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct work_struct service_conn_reaper;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct timer_list service_conn_reap_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) bool live;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) bool kill_all_client_conns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) atomic_t nr_client_conns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) spinlock_t client_conn_cache_lock; /* Lock for ->*_client_conns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) spinlock_t client_conn_discard_lock; /* Prevent multiple discarders */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct list_head idle_client_conns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct work_struct client_conn_reaper;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct timer_list client_conn_reap_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct list_head local_endpoints;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct mutex local_mutex; /* Lock for ->local_endpoints */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) DECLARE_HASHTABLE (peer_hash, 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) spinlock_t peer_hash_lock; /* Lock for ->peer_hash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define RXRPC_KEEPALIVE_TIME 20 /* NAT keepalive time in seconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) u8 peer_keepalive_cursor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) time64_t peer_keepalive_base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) struct list_head peer_keepalive[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct list_head peer_keepalive_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) struct timer_list peer_keepalive_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct work_struct peer_keepalive_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * Service backlog preallocation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * This contains circular buffers of preallocated peers, connections and calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * for incoming service calls and their head and tail pointers. This allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * calls to be set up in the data_ready handler, thereby avoiding the need to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * shuffle packets around so much.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct rxrpc_backlog {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned short peer_backlog_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) unsigned short peer_backlog_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) unsigned short conn_backlog_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) unsigned short conn_backlog_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) unsigned short call_backlog_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) unsigned short call_backlog_tail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define RXRPC_BACKLOG_MAX 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct rxrpc_peer *peer_backlog[RXRPC_BACKLOG_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) struct rxrpc_connection *conn_backlog[RXRPC_BACKLOG_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct rxrpc_call *call_backlog[RXRPC_BACKLOG_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * RxRPC socket definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) struct rxrpc_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /* WARNING: sk has to be the first member */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct sock sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) rxrpc_notify_new_call_t notify_new_call; /* Func to notify of new call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) rxrpc_discard_new_call_t discard_new_call; /* Func to discard a new call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) struct rxrpc_local *local; /* local endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct rxrpc_backlog *backlog; /* Preallocation for services */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) spinlock_t incoming_lock; /* Incoming call vs service shutdown lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct list_head sock_calls; /* List of calls owned by this socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct list_head to_be_accepted; /* calls awaiting acceptance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct list_head recvmsg_q; /* Calls awaiting recvmsg's attention */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) rwlock_t recvmsg_lock; /* Lock for recvmsg_q */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct key *key; /* security for this socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct key *securities; /* list of server security descriptors */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct rb_root calls; /* User ID -> call mapping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define RXRPC_SOCK_CONNECTED 0 /* connect_srx is set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) rwlock_t call_lock; /* lock for calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) u32 min_sec_level; /* minimum security level */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define RXRPC_SECURITY_MAX RXRPC_SECURITY_ENCRYPT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) bool exclusive; /* Exclusive connection for a client socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) u16 second_service; /* Additional service bound to the endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* Service upgrade information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) u16 from; /* Service ID to upgrade (if not 0) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) u16 to; /* service ID to upgrade to */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) } service_upgrade;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) sa_family_t family; /* Protocol family created with */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) struct sockaddr_rxrpc srx; /* Primary Service/local addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct sockaddr_rxrpc connect_srx; /* Default client address from connect() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #define rxrpc_sk(__sk) container_of((__sk), struct rxrpc_sock, sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * CPU-byteorder normalised Rx packet header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct rxrpc_host_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) u32 epoch; /* client boot timestamp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) u32 cid; /* connection and channel ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u32 callNumber; /* call ID (0 for connection-level packets) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) u32 seq; /* sequence number of pkt in call stream */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) u32 serial; /* serial number of pkt sent to network */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) u8 type; /* packet type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) u8 flags; /* packet flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) u8 userStatus; /* app-layer defined status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) u8 securityIndex; /* security protocol ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) u16 _rsvd; /* reserved */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) u16 cksum; /* kerberos security checksum */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) u16 serviceId; /* service ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) * RxRPC socket buffer private variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * - max 48 bytes (struct sk_buff::cb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct rxrpc_skb_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) atomic_t nr_ring_pins; /* Number of rxtx ring pins */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) u8 nr_subpackets; /* Number of subpackets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) u8 rx_flags; /* Received packet flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #define RXRPC_SKB_INCL_LAST 0x01 /* - Includes last packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #define RXRPC_SKB_TX_BUFFER 0x02 /* - Is transmit buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) int remain; /* amount of space remaining for next write */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* List of requested ACKs on subpackets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) unsigned long rx_req_ack[(RXRPC_MAX_NR_JUMBO + BITS_PER_LONG - 1) /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) BITS_PER_LONG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct rxrpc_host_header hdr; /* RxRPC packet header from this packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #define rxrpc_skb(__skb) ((struct rxrpc_skb_priv *) &(__skb)->cb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * RxRPC security module interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct rxrpc_security {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) const char *name; /* name of this service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) u8 security_index; /* security type provided */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) u32 no_key_abort; /* Abort code indicating no key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* Initialise a security service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int (*init)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /* Clean up a security service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) void (*exit)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) /* initialise a connection's security */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) int (*init_connection_security)(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) /* prime a connection's packet security */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int (*prime_packet_security)(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) /* impose security on a packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int (*secure_packet)(struct rxrpc_call *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) size_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /* verify the security on a received packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) int (*verify_packet)(struct rxrpc_call *, struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) unsigned int, unsigned int, rxrpc_seq_t, u16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) /* Free crypto request on a call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) void (*free_call_crypto)(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /* Locate the data in a received packet that has been verified. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) void (*locate_data)(struct rxrpc_call *, struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) unsigned int *, unsigned int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* issue a challenge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) int (*issue_challenge)(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /* respond to a challenge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) int (*respond_to_challenge)(struct rxrpc_connection *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) u32 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /* verify a response */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) int (*verify_response)(struct rxrpc_connection *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) u32 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /* clear connection security */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) void (*clear)(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) * RxRPC local transport endpoint description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) * - owned by a single AF_RXRPC socket
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) * - pointed to by transport socket struct sk_user_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) struct rxrpc_local {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) atomic_t active_users; /* Number of users of the local endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) atomic_t usage; /* Number of references to the structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) struct rxrpc_net *rxnet; /* The network ns in which this resides */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) struct list_head link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) struct socket *socket; /* my UDP socket */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) struct work_struct processor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) struct rxrpc_sock __rcu *service; /* Service(s) listening on this endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) struct sk_buff_head reject_queue; /* packets awaiting rejection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) struct sk_buff_head event_queue; /* endpoint event packets awaiting processing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) struct rb_root client_bundles; /* Client connection bundles by socket params */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) spinlock_t client_bundles_lock; /* Lock for client_bundles */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) spinlock_t lock; /* access lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) rwlock_t services_lock; /* lock for services list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) int debug_id; /* debug ID for printks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) bool dead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) bool service_closed; /* Service socket closed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct sockaddr_rxrpc srx; /* local address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * RxRPC remote transport endpoint definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) * - matched by local endpoint, remote port, address and protocol type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) struct rxrpc_peer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) struct rcu_head rcu; /* This must be first */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) atomic_t usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) unsigned long hash_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) struct hlist_node hash_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) struct rxrpc_local *local;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct hlist_head error_targets; /* targets for net error distribution */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) struct rb_root service_conns; /* Service connections */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) struct list_head keepalive_link; /* Link in net->peer_keepalive[] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) time64_t last_tx_at; /* Last time packet sent here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) seqlock_t service_conn_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) spinlock_t lock; /* access lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) unsigned int if_mtu; /* interface MTU for this peer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) unsigned int mtu; /* network MTU for this peer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) unsigned int maxdata; /* data size (MTU - hdrsize) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) unsigned short hdrsize; /* header size (IP + UDP + RxRPC) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) int debug_id; /* debug ID for printks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) struct sockaddr_rxrpc srx; /* remote address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) /* calculated RTT cache */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) #define RXRPC_RTT_CACHE_SIZE 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) spinlock_t rtt_input_lock; /* RTT lock for input routine */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) ktime_t rtt_last_req; /* Time of last RTT request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) unsigned int rtt_count; /* Number of samples we've got */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) u32 srtt_us; /* smoothed round trip time << 3 in usecs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) u32 mdev_us; /* medium deviation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) u32 mdev_max_us; /* maximal mdev for the last rtt period */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) u32 rttvar_us; /* smoothed mdev_max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) u32 rto_j; /* Retransmission timeout in jiffies */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) u8 backoff; /* Backoff timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) u8 cong_cwnd; /* Congestion window size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * Keys for matching a connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) struct rxrpc_conn_proto {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) u32 epoch; /* epoch of this connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) u32 cid; /* connection ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) u64 index_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct rxrpc_conn_parameters {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) struct rxrpc_local *local; /* Representation of local endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) struct rxrpc_peer *peer; /* Remote endpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) struct key *key; /* Security details */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) bool exclusive; /* T if conn is exclusive */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) bool upgrade; /* T if service ID can be upgraded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) u16 service_id; /* Service ID for this connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) u32 security_level; /* Security level selected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * Bits in the connection flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) enum rxrpc_conn_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) RXRPC_CONN_HAS_IDR, /* Has a client conn ID assigned */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) RXRPC_CONN_IN_SERVICE_CONNS, /* Conn is in peer->service_conns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) RXRPC_CONN_DONT_REUSE, /* Don't reuse this connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) RXRPC_CONN_PROBING_FOR_UPGRADE, /* Probing for service upgrade */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) RXRPC_CONN_FINAL_ACK_0, /* Need final ACK for channel 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) RXRPC_CONN_FINAL_ACK_1, /* Need final ACK for channel 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) RXRPC_CONN_FINAL_ACK_2, /* Need final ACK for channel 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) RXRPC_CONN_FINAL_ACK_3, /* Need final ACK for channel 3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) #define RXRPC_CONN_FINAL_ACK_MASK ((1UL << RXRPC_CONN_FINAL_ACK_0) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) (1UL << RXRPC_CONN_FINAL_ACK_1) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) (1UL << RXRPC_CONN_FINAL_ACK_2) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) (1UL << RXRPC_CONN_FINAL_ACK_3))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) * Events that can be raised upon a connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) enum rxrpc_conn_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) RXRPC_CONN_EV_CHALLENGE, /* Send challenge packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) * The connection protocol state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) enum rxrpc_conn_proto_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) RXRPC_CONN_UNUSED, /* Connection not yet attempted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) RXRPC_CONN_CLIENT, /* Client connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) RXRPC_CONN_SERVICE_PREALLOC, /* Service connection preallocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) RXRPC_CONN_SERVICE_UNSECURED, /* Service unsecured connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) RXRPC_CONN_SERVICE_CHALLENGING, /* Service challenging for security */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) RXRPC_CONN_SERVICE, /* Service secured connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) RXRPC_CONN_REMOTELY_ABORTED, /* Conn aborted by peer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) RXRPC_CONN_LOCALLY_ABORTED, /* Conn aborted locally */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) RXRPC_CONN__NR_STATES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) * RxRPC client connection bundle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) struct rxrpc_bundle {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) struct rxrpc_conn_parameters params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) atomic_t usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) unsigned int debug_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) bool try_upgrade; /* True if the bundle is attempting upgrade */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) bool alloc_conn; /* True if someone's getting a conn */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) short alloc_error; /* Error from last conn allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) spinlock_t channel_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) struct rb_node local_node; /* Node in local->client_conns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) struct list_head waiting_calls; /* Calls waiting for channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) unsigned long avail_chans; /* Mask of available channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) struct rxrpc_connection *conns[4]; /* The connections in the bundle (max 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * RxRPC connection definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * - matched by { local, peer, epoch, conn_id, direction }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) * - each connection can only handle four simultaneous calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) struct rxrpc_connection {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) struct rxrpc_conn_proto proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) struct rxrpc_conn_parameters params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) atomic_t usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) struct list_head cache_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) unsigned char act_chans; /* Mask of active channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) struct rxrpc_channel {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) unsigned long final_ack_at; /* Time at which to issue final ACK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) struct rxrpc_call __rcu *call; /* Active call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) unsigned int call_debug_id; /* call->debug_id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) u32 call_id; /* ID of current call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) u32 call_counter; /* Call ID counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) u32 last_call; /* ID of last call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) u8 last_type; /* Type of last packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) u32 last_seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) u32 last_abort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) } channels[RXRPC_MAXCALLS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) struct timer_list timer; /* Conn event timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) struct work_struct processor; /* connection event processor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) struct rxrpc_bundle *bundle; /* Client connection bundle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) struct rb_node service_node; /* Node in peer->service_conns */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) struct list_head proc_link; /* link in procfs list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) struct list_head link; /* link in master connection list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct sk_buff_head rx_queue; /* received conn-level packets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) const struct rxrpc_security *security; /* applied security module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) struct key *server_key; /* security for this service */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) struct crypto_sync_skcipher *cipher; /* encryption handle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) struct rxrpc_crypt csum_iv; /* packet checksum base */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) unsigned long events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) unsigned long idle_timestamp; /* Time at which last became idle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) spinlock_t state_lock; /* state-change lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) enum rxrpc_conn_proto_state state; /* current state of connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) u32 abort_code; /* Abort code of connection abort */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) int debug_id; /* debug ID for printks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) atomic_t serial; /* packet serial number counter */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) unsigned int hi_serial; /* highest serial number received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) u32 security_nonce; /* response re-use preventer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) u32 service_id; /* Service ID, possibly upgraded */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) u8 size_align; /* data size alignment (for security) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) u8 security_size; /* security header size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) u8 security_ix; /* security type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) u8 bundle_shift; /* Index into bundle->avail_chans */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) short error; /* Local error code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) static inline bool rxrpc_to_server(const struct rxrpc_skb_priv *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) return sp->hdr.flags & RXRPC_CLIENT_INITIATED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) static inline bool rxrpc_to_client(const struct rxrpc_skb_priv *sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) return !rxrpc_to_server(sp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * Flags in call->flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) enum rxrpc_call_flag {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) RXRPC_CALL_RELEASED, /* call has been released - no more message to userspace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) RXRPC_CALL_HAS_USERID, /* has a user ID attached */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) RXRPC_CALL_IS_SERVICE, /* Call is service call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) RXRPC_CALL_EXPOSED, /* The call was exposed to the world */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) RXRPC_CALL_RX_UNDERRUN, /* Got data underrun */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) RXRPC_CALL_DISCONNECTED, /* The call has been disconnected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) RXRPC_CALL_KERNEL, /* The call was made by the kernel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) RXRPC_CALL_UPGRADE, /* Service upgrade was requested for the call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * Events that can be raised on a call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) enum rxrpc_call_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) RXRPC_CALL_EV_ACK, /* need to generate ACK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) RXRPC_CALL_EV_ABORT, /* need to generate abort */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) RXRPC_CALL_EV_RESEND, /* Tx resend required */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) RXRPC_CALL_EV_PING, /* Ping send required */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) RXRPC_CALL_EV_EXPIRED, /* Expiry occurred */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) RXRPC_CALL_EV_ACK_LOST, /* ACK may be lost, send ping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) * The states that a call can be in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) enum rxrpc_call_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) RXRPC_CALL_UNINITIALISED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) RXRPC_CALL_CLIENT_AWAIT_CONN, /* - client waiting for connection to become available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) RXRPC_CALL_CLIENT_SEND_REQUEST, /* - client sending request phase */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) RXRPC_CALL_CLIENT_AWAIT_REPLY, /* - client awaiting reply */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) RXRPC_CALL_CLIENT_RECV_REPLY, /* - client receiving reply phase */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) RXRPC_CALL_SERVER_PREALLOC, /* - service preallocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) RXRPC_CALL_SERVER_SECURING, /* - server securing request connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) RXRPC_CALL_SERVER_RECV_REQUEST, /* - server receiving request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) RXRPC_CALL_SERVER_ACK_REQUEST, /* - server pending ACK of request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) RXRPC_CALL_SERVER_SEND_REPLY, /* - server sending reply */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) RXRPC_CALL_SERVER_AWAIT_ACK, /* - server awaiting final ACK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) RXRPC_CALL_COMPLETE, /* - call complete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) NR__RXRPC_CALL_STATES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) * Call completion condition (state == RXRPC_CALL_COMPLETE).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) enum rxrpc_call_completion {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) RXRPC_CALL_SUCCEEDED, /* - Normal termination */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) NR__RXRPC_CALL_COMPLETIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) * Call Tx congestion management modes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) enum rxrpc_congest_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) RXRPC_CALL_SLOW_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) RXRPC_CALL_CONGEST_AVOIDANCE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) RXRPC_CALL_PACKET_LOSS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) RXRPC_CALL_FAST_RETRANSMIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) NR__RXRPC_CONGEST_MODES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) * RxRPC call definition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) * - matched by { connection, call_id }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) struct rxrpc_call {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) struct rcu_head rcu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) struct rxrpc_connection *conn; /* connection carrying call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) struct rxrpc_peer *peer; /* Peer record for remote address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) struct rxrpc_sock __rcu *socket; /* socket responsible */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) struct rxrpc_net *rxnet; /* Network namespace to which call belongs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) const struct rxrpc_security *security; /* applied security module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) struct mutex user_mutex; /* User access mutex */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) unsigned long ack_at; /* When deferred ACK needs to happen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) unsigned long ack_lost_at; /* When ACK is figured as lost */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) unsigned long resend_at; /* When next resend needs to happen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) unsigned long ping_at; /* When next to send a ping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) unsigned long keepalive_at; /* When next to send a keepalive ping */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) unsigned long expect_rx_by; /* When we expect to get a packet by */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) unsigned long expect_req_by; /* When we expect to get a request DATA packet by */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) unsigned long expect_term_by; /* When we expect call termination by */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) u32 next_rx_timo; /* Timeout for next Rx packet (jif) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) u32 next_req_timo; /* Timeout for next Rx request packet (jif) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) struct skcipher_request *cipher_req; /* Packet cipher request buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) struct timer_list timer; /* Combined event timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) struct work_struct processor; /* Event processor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) rxrpc_notify_rx_t notify_rx; /* kernel service Rx notification function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) struct list_head link; /* link in master call list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) struct list_head chan_wait_link; /* Link in conn->bundle->waiting_calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) struct hlist_node error_link; /* link in error distribution list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) struct list_head accept_link; /* Link in rx->acceptq */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) struct list_head recvmsg_link; /* Link in rx->recvmsg_q */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) struct list_head sock_link; /* Link in rx->sock_calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) struct rb_node sock_node; /* Node in rx->calls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) struct sk_buff *tx_pending; /* Tx socket buffer being filled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) wait_queue_head_t waitq; /* Wait queue for channel or Tx */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) s64 tx_total_len; /* Total length left to be transmitted (or -1) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) __be32 crypto_buf[2]; /* Temporary packet crypto buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) unsigned long user_call_ID; /* user-defined call ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) unsigned long events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) spinlock_t notify_lock; /* Kernel notification lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) rwlock_t state_lock; /* lock for state transition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) u32 abort_code; /* Local/remote abort code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) int error; /* Local error incurred */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) enum rxrpc_call_state state; /* current state of call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) enum rxrpc_call_completion completion; /* Call completion condition */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) atomic_t usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) u16 service_id; /* service ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) u8 security_ix; /* Security type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) enum rxrpc_interruptibility interruptibility; /* At what point call may be interrupted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) u32 call_id; /* call ID on connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) u32 cid; /* connection ID plus channel index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) int debug_id; /* debug ID for printks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) unsigned short rx_pkt_offset; /* Current recvmsg packet offset */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) unsigned short rx_pkt_len; /* Current recvmsg packet len */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) bool rx_pkt_last; /* Current recvmsg packet is last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) /* Rx/Tx circular buffer, depending on phase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) * In the Rx phase, packets are annotated with 0 or the number of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) * segment of a jumbo packet each buffer refers to. There can be up to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) * 47 segments in a maximum-size UDP packet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) * In the Tx phase, packets are annotated with which buffers have been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) * acked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) #define RXRPC_RXTX_BUFF_SIZE 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) #define RXRPC_RXTX_BUFF_MASK (RXRPC_RXTX_BUFF_SIZE - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) #define RXRPC_INIT_RX_WINDOW_SIZE 63
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) struct sk_buff **rxtx_buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) u8 *rxtx_annotations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) #define RXRPC_TX_ANNO_ACK 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) #define RXRPC_TX_ANNO_UNACK 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) #define RXRPC_TX_ANNO_NAK 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) #define RXRPC_TX_ANNO_RETRANS 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) #define RXRPC_TX_ANNO_MASK 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) #define RXRPC_TX_ANNO_LAST 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) #define RXRPC_TX_ANNO_RESENT 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) #define RXRPC_RX_ANNO_SUBPACKET 0x3f /* Subpacket number in jumbogram */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) #define RXRPC_RX_ANNO_VERIFIED 0x80 /* Set if verified and decrypted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) rxrpc_seq_t tx_hard_ack; /* Dead slot in buffer; the first transmitted but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) * not hard-ACK'd packet follows this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) rxrpc_seq_t tx_top; /* Highest Tx slot allocated. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) u16 tx_backoff; /* Delay to insert due to Tx failure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) /* TCP-style slow-start congestion control [RFC5681]. Since the SMSS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) * is fixed, we keep these numbers in terms of segments (ie. DATA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) * packets) rather than bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) #define RXRPC_TX_SMSS RXRPC_JUMBO_DATALEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) u8 cong_cwnd; /* Congestion window size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) u8 cong_extra; /* Extra to send for congestion management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) u8 cong_ssthresh; /* Slow-start threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) enum rxrpc_congest_mode cong_mode:8; /* Congestion management mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) u8 cong_dup_acks; /* Count of ACKs showing missing packets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) u8 cong_cumul_acks; /* Cumulative ACK count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) ktime_t cong_tstamp; /* Last time cwnd was changed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) rxrpc_seq_t rx_hard_ack; /* Dead slot in buffer; the first received but not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) * consumed packet follows this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) rxrpc_seq_t rx_top; /* Highest Rx slot allocated. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) rxrpc_seq_t rx_expect_next; /* Expected next packet sequence number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) rxrpc_serial_t rx_serial; /* Highest serial received for this call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) u8 rx_winsize; /* Size of Rx window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) u8 tx_winsize; /* Maximum size of Tx window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) bool tx_phase; /* T if transmission phase, F if receive phase */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) u8 nr_jumbo_bad; /* Number of jumbo dups/exceeds-windows */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) spinlock_t input_lock; /* Lock for packet input to this call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) /* receive-phase ACK management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) u8 ackr_reason; /* reason to ACK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) rxrpc_serial_t ackr_serial; /* serial of packet being ACK'd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) rxrpc_serial_t ackr_first_seq; /* first sequence number received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) rxrpc_seq_t ackr_prev_seq; /* previous sequence number received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) rxrpc_seq_t ackr_seen; /* Highest packet shown seen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) /* RTT management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) rxrpc_serial_t rtt_serial[4]; /* Serial number of DATA or PING sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) ktime_t rtt_sent_at[4]; /* Time packet sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) unsigned long rtt_avail; /* Mask of available slots in bits 0-3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) * Mask of pending samples in 8-11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) #define RXRPC_CALL_RTT_AVAIL_MASK 0xf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) #define RXRPC_CALL_RTT_PEND_SHIFT 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) /* transmission-phase ACK management */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) ktime_t acks_latest_ts; /* Timestamp of latest ACK received */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) rxrpc_seq_t acks_lowest_nak; /* Lowest NACK in the buffer (or ==tx_hard_ack) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) rxrpc_seq_t acks_lost_top; /* tx_top at the time lost-ack ping sent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) rxrpc_serial_t acks_lost_ping; /* Serial number of probe ACK */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) * Summary of a new ACK and the changes it made to the Tx buffer packet states.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) struct rxrpc_ack_summary {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) u8 ack_reason;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) u8 nr_acks; /* Number of ACKs in packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) u8 nr_nacks; /* Number of NACKs in packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) u8 nr_new_acks; /* Number of new ACKs in packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) u8 nr_new_nacks; /* Number of new NACKs in packet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) u8 nr_rot_new_acks; /* Number of rotated new ACKs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) bool new_low_nack; /* T if new low NACK found */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) bool retrans_timeo; /* T if reTx due to timeout happened */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) u8 flight_size; /* Number of unreceived transmissions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) /* Place to stash values for tracing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) enum rxrpc_congest_mode mode:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) u8 cwnd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) u8 ssthresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) u8 dup_acks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) u8 cumulative_acks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) * sendmsg() cmsg-specified parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) enum rxrpc_command {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) RXRPC_CMD_SEND_DATA, /* send data message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) RXRPC_CMD_SEND_ABORT, /* request abort generation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) RXRPC_CMD_REJECT_BUSY, /* [server] reject a call as busy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) RXRPC_CMD_CHARGE_ACCEPT, /* [server] charge accept preallocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) struct rxrpc_call_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) s64 tx_total_len; /* Total Tx data length (if send data) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) unsigned long user_call_ID; /* User's call ID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) u32 hard; /* Maximum lifetime (sec) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) u32 idle; /* Max time since last data packet (msec) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) u32 normal; /* Max time since last call packet (msec) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) } timeouts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) u8 nr_timeouts; /* Number of timeouts specified */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) bool kernel; /* T if kernel is making the call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) enum rxrpc_interruptibility interruptibility; /* How is interruptible is the call? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) struct rxrpc_send_params {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) struct rxrpc_call_params call;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) u32 abort_code; /* Abort code to Tx (if abort) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) enum rxrpc_command command : 8; /* The command to implement */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) bool exclusive; /* Shared or exclusive call */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) bool upgrade; /* If the connection is upgradeable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) #include <trace/events/rxrpc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) * af_rxrpc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) extern atomic_t rxrpc_n_tx_skbs, rxrpc_n_rx_skbs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) extern struct workqueue_struct *rxrpc_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) * call_accept.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) void rxrpc_discard_prealloc(struct rxrpc_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) struct rxrpc_sock *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) void rxrpc_accept_incoming_calls(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) int rxrpc_user_charge_accept(struct rxrpc_sock *, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) * call_event.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) void rxrpc_propose_ACK(struct rxrpc_call *, u8, u32, bool, bool,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) enum rxrpc_propose_ack_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) void rxrpc_process_call(struct work_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) void rxrpc_reduce_call_timer(struct rxrpc_call *call,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) unsigned long expire_at,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) unsigned long now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) enum rxrpc_timer_trace why);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) void rxrpc_delete_call_timer(struct rxrpc_call *call);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) * call_object.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) extern const char *const rxrpc_call_states[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) extern const char *const rxrpc_call_completions[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) extern unsigned int rxrpc_max_call_lifetime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) extern struct kmem_cache *rxrpc_call_jar;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) struct rxrpc_call *rxrpc_find_call_by_user_ID(struct rxrpc_sock *, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *, gfp_t, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) struct rxrpc_conn_parameters *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) struct sockaddr_rxrpc *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) struct rxrpc_call_params *, gfp_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) void rxrpc_incoming_call(struct rxrpc_sock *, struct rxrpc_call *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) void rxrpc_release_call(struct rxrpc_sock *, struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) bool __rxrpc_queue_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) bool rxrpc_queue_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) void rxrpc_see_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) bool rxrpc_try_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) void rxrpc_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) void rxrpc_put_call(struct rxrpc_call *, enum rxrpc_call_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) void rxrpc_cleanup_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) void rxrpc_destroy_all_calls(struct rxrpc_net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) static inline bool rxrpc_is_service_call(const struct rxrpc_call *call)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) return test_bit(RXRPC_CALL_IS_SERVICE, &call->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) static inline bool rxrpc_is_client_call(const struct rxrpc_call *call)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) return !rxrpc_is_service_call(call);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) * conn_client.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) extern unsigned int rxrpc_reap_client_connections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) extern unsigned long rxrpc_conn_idle_client_expiry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) extern unsigned long rxrpc_conn_idle_client_fast_expiry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) extern struct idr rxrpc_client_conn_ids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) void rxrpc_destroy_client_conn_ids(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) void rxrpc_put_bundle(struct rxrpc_bundle *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) int rxrpc_connect_call(struct rxrpc_sock *, struct rxrpc_call *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) struct rxrpc_conn_parameters *, struct sockaddr_rxrpc *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) void rxrpc_expose_client_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) void rxrpc_disconnect_client_call(struct rxrpc_bundle *, struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) void rxrpc_put_client_conn(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) void rxrpc_discard_expired_client_conns(struct work_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826) void rxrpc_destroy_all_client_connections(struct rxrpc_net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) void rxrpc_clean_up_local_conns(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) * conn_event.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) void rxrpc_process_connection(struct work_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) void rxrpc_process_delayed_final_acks(struct rxrpc_connection *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) * conn_object.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) extern unsigned int rxrpc_connection_expiry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) extern unsigned int rxrpc_closed_conn_expiry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) struct rxrpc_connection *rxrpc_alloc_connection(gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) struct rxrpc_peer **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) void __rxrpc_disconnect_call(struct rxrpc_connection *, struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) void rxrpc_disconnect_call(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) void rxrpc_kill_connection(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) bool rxrpc_queue_conn(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) void rxrpc_see_connection(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) struct rxrpc_connection *rxrpc_get_connection(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851) struct rxrpc_connection *rxrpc_get_connection_maybe(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) void rxrpc_put_service_conn(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) void rxrpc_service_connection_reaper(struct work_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) void rxrpc_destroy_all_connections(struct rxrpc_net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) static inline bool rxrpc_conn_is_client(const struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) return conn->out_clientflag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) static inline bool rxrpc_conn_is_service(const struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) return !rxrpc_conn_is_client(conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) static inline void rxrpc_put_connection(struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) if (!conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) if (rxrpc_conn_is_client(conn))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) rxrpc_put_client_conn(conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) rxrpc_put_service_conn(conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) static inline void rxrpc_reduce_conn_timer(struct rxrpc_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) unsigned long expire_at)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) timer_reduce(&conn->timer, expire_at);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) * conn_service.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) void rxrpc_new_incoming_connection(struct rxrpc_sock *, struct rxrpc_connection *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) const struct rxrpc_security *, struct key *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) void rxrpc_unpublish_service_conn(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) * input.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897) int rxrpc_input_packet(struct sock *, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) * insecure.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902) extern const struct rxrpc_security rxrpc_no_security;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) * key.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) extern struct key_type key_type_rxrpc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) extern struct key_type key_type_rxrpc_s;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) int rxrpc_request_key(struct rxrpc_sock *, sockptr_t , int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) int rxrpc_server_keyring(struct rxrpc_sock *, sockptr_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) int rxrpc_get_server_data_key(struct rxrpc_connection *, const void *, time64_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) u32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) * local_event.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) extern void rxrpc_process_local_events(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) * local_object.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) void rxrpc_put_local(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) void rxrpc_unuse_local(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) void rxrpc_queue_local(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) void rxrpc_destroy_all_locals(struct rxrpc_net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) static inline bool __rxrpc_unuse_local(struct rxrpc_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) return atomic_dec_return(&local->active_users) == 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) static inline bool __rxrpc_use_local(struct rxrpc_local *local)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) return atomic_fetch_add_unless(&local->active_users, 1, 0) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) * misc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) extern unsigned int rxrpc_max_backlog __read_mostly;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) extern unsigned long rxrpc_requested_ack_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) extern unsigned long rxrpc_soft_ack_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) extern unsigned long rxrpc_idle_ack_delay;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) extern unsigned int rxrpc_rx_window_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) extern unsigned int rxrpc_rx_mtu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) extern unsigned int rxrpc_rx_jumbo_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) extern const s8 rxrpc_ack_priority[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) * net_ns.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) extern unsigned int rxrpc_net_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) extern struct pernet_operations rxrpc_net_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) static inline struct rxrpc_net *rxrpc_net(struct net *net)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) return net_generic(net, rxrpc_net_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) * output.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) int rxrpc_send_ack_packet(struct rxrpc_call *, bool, rxrpc_serial_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) int rxrpc_send_abort_packet(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) int rxrpc_send_data_packet(struct rxrpc_call *, struct sk_buff *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) void rxrpc_reject_packets(struct rxrpc_local *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) void rxrpc_send_keepalive(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) * peer_event.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) void rxrpc_error_report(struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) void rxrpc_peer_keepalive_worker(struct work_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982) * peer_object.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) const struct sockaddr_rxrpc *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *, struct rxrpc_local *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) struct sockaddr_rxrpc *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988) struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) void rxrpc_new_incoming_peer(struct rxrpc_sock *, struct rxrpc_local *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991) void rxrpc_destroy_all_peers(struct rxrpc_net *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994) void rxrpc_put_peer(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) void rxrpc_put_peer_locked(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998) * proc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) extern const struct seq_operations rxrpc_call_seq_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) extern const struct seq_operations rxrpc_connection_seq_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) extern const struct seq_operations rxrpc_peer_seq_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) * recvmsg.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) void rxrpc_notify_socket(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) bool __rxrpc_set_call_completion(struct rxrpc_call *, enum rxrpc_call_completion, u32, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) bool rxrpc_set_call_completion(struct rxrpc_call *, enum rxrpc_call_completion, u32, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) bool __rxrpc_call_completed(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) bool rxrpc_call_completed(struct rxrpc_call *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) bool __rxrpc_abort_call(const char *, struct rxrpc_call *, rxrpc_seq_t, u32, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) bool rxrpc_abort_call(const char *, struct rxrpc_call *, rxrpc_seq_t, u32, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) int rxrpc_recvmsg(struct socket *, struct msghdr *, size_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) * Abort a call due to a protocol error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) static inline bool __rxrpc_abort_eproto(struct rxrpc_call *call,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) const char *eproto_why,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) const char *why,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) u32 abort_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) trace_rxrpc_rx_eproto(call, sp->hdr.serial, eproto_why);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) return rxrpc_abort_call(why, call, sp->hdr.seq, abort_code, -EPROTO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) #define rxrpc_abort_eproto(call, skb, eproto_why, abort_why, abort_code) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) __rxrpc_abort_eproto((call), (skb), tracepoint_string(eproto_why), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) (abort_why), (abort_code))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) * rtt.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) void rxrpc_peer_init_rtt(struct rxrpc_peer *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) * rxkad.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) #ifdef CONFIG_RXKAD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) extern const struct rxrpc_security rxkad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) * security.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) int __init rxrpc_init_security(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) void rxrpc_exit_security(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) int rxrpc_init_client_conn_security(struct rxrpc_connection *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) bool rxrpc_look_up_server_security(struct rxrpc_local *, struct rxrpc_sock *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) const struct rxrpc_security **, struct key **,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) * sendmsg.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) int rxrpc_do_sendmsg(struct rxrpc_sock *, struct msghdr *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) * skbuff.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) void rxrpc_kernel_data_consumed(struct rxrpc_call *, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) void rxrpc_packet_destructor(struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) void rxrpc_new_skb(struct sk_buff *, enum rxrpc_skb_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) void rxrpc_see_skb(struct sk_buff *, enum rxrpc_skb_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) void rxrpc_eaten_skb(struct sk_buff *, enum rxrpc_skb_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) void rxrpc_get_skb(struct sk_buff *, enum rxrpc_skb_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) void rxrpc_free_skb(struct sk_buff *, enum rxrpc_skb_trace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) void rxrpc_purge_queue(struct sk_buff_head *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) * sysctl.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) #ifdef CONFIG_SYSCTL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) extern int __init rxrpc_sysctl_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) extern void rxrpc_sysctl_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) static inline int __init rxrpc_sysctl_init(void) { return 0; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) static inline void rxrpc_sysctl_exit(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) * utils.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) int rxrpc_extract_addr_from_skb(struct sockaddr_rxrpc *, struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) static inline bool before(u32 seq1, u32 seq2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) return (s32)(seq1 - seq2) < 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) static inline bool before_eq(u32 seq1, u32 seq2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) return (s32)(seq1 - seq2) <= 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) static inline bool after(u32 seq1, u32 seq2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) return (s32)(seq1 - seq2) > 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) static inline bool after_eq(u32 seq1, u32 seq2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) return (s32)(seq1 - seq2) >= 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) * debug tracing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) extern unsigned int rxrpc_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) #define dbgprintk(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) #define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) #define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) #define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) #define kproto(FMT,...) dbgprintk("### "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) #define knet(FMT,...) dbgprintk("@@@ "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) #if defined(__KDEBUG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) #define _enter(FMT,...) kenter(FMT,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) #define _leave(FMT,...) kleave(FMT,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) #define _debug(FMT,...) kdebug(FMT,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) #define _proto(FMT,...) kproto(FMT,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) #define _net(FMT,...) knet(FMT,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) #elif defined(CONFIG_AF_RXRPC_DEBUG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) #define RXRPC_DEBUG_KENTER 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) #define RXRPC_DEBUG_KLEAVE 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) #define RXRPC_DEBUG_KDEBUG 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) #define RXRPC_DEBUG_KPROTO 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) #define RXRPC_DEBUG_KNET 0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) #define _enter(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) if (unlikely(rxrpc_debug & RXRPC_DEBUG_KENTER)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) kenter(FMT,##__VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) #define _leave(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) if (unlikely(rxrpc_debug & RXRPC_DEBUG_KLEAVE)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) kleave(FMT,##__VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) #define _debug(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) if (unlikely(rxrpc_debug & RXRPC_DEBUG_KDEBUG)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) kdebug(FMT,##__VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) #define _proto(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) if (unlikely(rxrpc_debug & RXRPC_DEBUG_KPROTO)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) kproto(FMT,##__VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) #define _net(FMT,...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) if (unlikely(rxrpc_debug & RXRPC_DEBUG_KNET)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) knet(FMT,##__VA_ARGS__); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) #define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) #define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) #define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) #define _proto(FMT,...) no_printk("### "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) #define _net(FMT,...) no_printk("@@@ "FMT ,##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) * debug assertion checking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) #if 1 // defined(__KDEBUGALL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) #define ASSERT(X) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) if (unlikely(!(X))) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) pr_err("Assertion failed\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) BUG(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) #define ASSERTCMP(X, OP, Y) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) __typeof__(X) _x = (X); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) __typeof__(Y) _y = (__typeof__(X))(Y); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) if (unlikely(!(_x OP _y))) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) (unsigned long)_x, (unsigned long)_x, #OP, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) (unsigned long)_y, (unsigned long)_y); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) BUG(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) #define ASSERTIF(C, X) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) if (unlikely((C) && !(X))) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) pr_err("Assertion failed\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) BUG(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) #define ASSERTIFCMP(C, X, OP, Y) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) __typeof__(X) _x = (X); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) __typeof__(Y) _y = (__typeof__(X))(Y); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) if (unlikely((C) && !(_x OP _y))) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) pr_err("Assertion failed - %lu(0x%lx) %s %lu(0x%lx) is false\n", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) (unsigned long)_x, (unsigned long)_x, #OP, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) (unsigned long)_y, (unsigned long)_y); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) BUG(); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) #define ASSERT(X) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) #define ASSERTCMP(X, OP, Y) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) #define ASSERTIF(C, X) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) #define ASSERTIFCMP(C, X, OP, Y) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) #endif /* __KDEBUGALL */