Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 2 | /* RxRPC kernel service interface definitions |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 3 | * |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 4 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 5 | * Written by David Howells (dhowells@redhat.com) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _NET_RXRPC_H |
| 9 | #define _NET_RXRPC_H |
| 10 | |
| 11 | #include <linux/rxrpc.h> |
David Howells | 2070a3e | 2018-10-04 09:42:29 +0100 | [diff] [blame] | 12 | #include <linux/ktime.h> |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 13 | |
David Howells | 4de48af | 2016-08-30 12:00:48 +0100 | [diff] [blame] | 14 | struct key; |
| 15 | struct sock; |
| 16 | struct socket; |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 17 | struct rxrpc_call; |
| 18 | |
David Howells | e138aa7 | 2020-03-13 09:22:09 +0000 | [diff] [blame] | 19 | enum rxrpc_interruptibility { |
| 20 | RXRPC_INTERRUPTIBLE, /* Call is interruptible */ |
| 21 | RXRPC_PREINTERRUPTIBLE, /* Call can be cancelled whilst waiting for a slot */ |
| 22 | RXRPC_UNINTERRUPTIBLE, /* Call should not be interruptible at all */ |
| 23 | }; |
| 24 | |
David Howells | c038a58 | 2017-08-29 10:19:01 +0100 | [diff] [blame] | 25 | /* |
David Howells | a25e21f | 2018-03-27 23:03:00 +0100 | [diff] [blame] | 26 | * Debug ID counter for tracing. |
| 27 | */ |
| 28 | extern atomic_t rxrpc_debug_id; |
| 29 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 30 | typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *, |
| 31 | unsigned long); |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 32 | typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *, |
| 33 | unsigned long); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 34 | typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *, |
| 35 | unsigned long); |
| 36 | typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long); |
| 37 | typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long); |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 38 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 39 | void rxrpc_kernel_new_call_notification(struct socket *, |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 40 | rxrpc_notify_new_call_t, |
| 41 | rxrpc_discard_new_call_t); |
Joe Perches | cd2cf63 | 2013-07-31 17:31:34 -0700 | [diff] [blame] | 42 | struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *, |
| 43 | struct sockaddr_rxrpc *, |
| 44 | struct key *, |
| 45 | unsigned long, |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 46 | s64, |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 47 | gfp_t, |
David Howells | a68f4a2 | 2017-10-18 11:36:39 +0100 | [diff] [blame] | 48 | rxrpc_notify_rx_t, |
David Howells | a25e21f | 2018-03-27 23:03:00 +0100 | [diff] [blame] | 49 | bool, |
David Howells | e138aa7 | 2020-03-13 09:22:09 +0000 | [diff] [blame] | 50 | enum rxrpc_interruptibility, |
David Howells | a25e21f | 2018-03-27 23:03:00 +0100 | [diff] [blame] | 51 | unsigned int); |
David Howells | 4de48af | 2016-08-30 12:00:48 +0100 | [diff] [blame] | 52 | int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *, |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 53 | struct msghdr *, size_t, |
| 54 | rxrpc_notify_end_tx_t); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 55 | int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *, |
David Howells | eb9950e | 2018-08-03 17:06:56 +0100 | [diff] [blame] | 56 | struct iov_iter *, bool, u32 *, u16 *); |
David Howells | 84a4c09 | 2017-04-06 10:11:59 +0100 | [diff] [blame] | 57 | bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, |
David Howells | 5a42976 | 2016-09-06 22:19:51 +0100 | [diff] [blame] | 58 | u32, int, const char *); |
David Howells | 4de48af | 2016-08-30 12:00:48 +0100 | [diff] [blame] | 59 | void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); |
David Howells | 8324f0b | 2016-08-30 09:49:29 +0100 | [diff] [blame] | 60 | void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, |
| 61 | struct sockaddr_rxrpc *); |
David Howells | f4d15fb | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 62 | u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 63 | int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, |
David Howells | a25e21f | 2018-03-27 23:03:00 +0100 | [diff] [blame] | 64 | rxrpc_user_attach_call_t, unsigned long, gfp_t, |
| 65 | unsigned int); |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 66 | void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); |
David Howells | 7d7587d | 2020-03-12 21:40:06 +0000 | [diff] [blame] | 67 | bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); |
David Howells | e908bcf | 2018-10-04 09:54:29 +0100 | [diff] [blame] | 68 | u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); |
David Howells | 2070a3e | 2018-10-04 09:42:29 +0100 | [diff] [blame] | 69 | bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, |
| 70 | ktime_t *); |
Marc Dionne | 4611da3 | 2019-04-12 16:33:47 +0100 | [diff] [blame] | 71 | bool rxrpc_kernel_call_is_complete(struct rxrpc_call *); |
David Howells | bbd172e | 2019-05-16 13:50:31 +0100 | [diff] [blame] | 72 | void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *, |
| 73 | unsigned long); |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 74 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 75 | #endif /* _NET_RXRPC_H */ |