linux/include/linux/sunrpc/xprt.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  linux/include/linux/sunrpc/xprt.h
 *
 *  Declarations for the RPC transport interface.
 *
 *  Copyright (C) 1995, 1996 Olaf Kirch <[email protected]>
 */

#ifndef _LINUX_SUNRPC_XPRT_H
#define _LINUX_SUNRPC_XPRT_H

#include <linux/uio.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/ktime.h>
#include <linux/kref.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/msg_prot.h>

#define RPC_MIN_SLOT_TABLE
#define RPC_DEF_SLOT_TABLE
#define RPC_MAX_SLOT_TABLE_LIMIT
#define RPC_MAX_SLOT_TABLE

#define RPC_CWNDSHIFT
#define RPC_CWNDSCALE
#define RPC_INITCWND
#define RPC_MAXCWND(xprt)
#define RPCXPRT_CONGESTED(xprt)

enum rpc_display_format_t {};

struct rpc_task;
struct rpc_xprt;
struct xprt_class;
struct seq_file;
struct svc_serv;
struct net;
#include <linux/lwq.h>

/*
 * This describes a complete RPC request
 */
struct rpc_rqst {};
#define rq_svec
#define rq_slen

/* RPC transport layer security policies */
enum xprtsec_policies {};

struct xprtsec_parms {};

struct rpc_xprt_ops {};

/*
 * RPC transport identifiers
 *
 * To preserve compatibility with the historical use of raw IP protocol
 * id's for transport selection, UDP and TCP identifiers are specified
 * with the previous values. No such restriction exists for new transports,
 * except that they may not collide with these values (17 and 6,
 * respectively).
 */
#define XPRT_TRANSPORT_BC
enum xprt_transports {};

struct rpc_sysfs_xprt;
struct rpc_xprt {};

#if defined(CONFIG_SUNRPC_BACKCHANNEL)
/*
 * Backchannel flags
 */
#define RPC_BC_PA_IN_USE
						/* buffer in use */
#endif /* CONFIG_SUNRPC_BACKCHANNEL */

#if defined(CONFIG_SUNRPC_BACKCHANNEL)
static inline int bc_prealloc(struct rpc_rqst *req)
{}
#else
static inline int bc_prealloc(struct rpc_rqst *req)
{
	return 0;
}
#endif /* CONFIG_SUNRPC_BACKCHANNEL */

#define XPRT_CREATE_INFINITE_SLOTS
#define XPRT_CREATE_NO_IDLE_TIMEOUT

struct xprt_create {};

struct xprt_class {};

/*
 * Generic internal transport functions
 */
struct rpc_xprt		*xprt_create_transport(struct xprt_create *args);
void			xprt_connect(struct rpc_task *task);
unsigned long		xprt_reconnect_delay(const struct rpc_xprt *xprt);
void			xprt_reconnect_backoff(struct rpc_xprt *xprt,
					       unsigned long init_to);
void			xprt_reserve(struct rpc_task *task);
void			xprt_retry_reserve(struct rpc_task *task);
int			xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
int			xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
void			xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
void			xprt_free_slot(struct rpc_xprt *xprt,
				       struct rpc_rqst *req);
bool			xprt_prepare_transmit(struct rpc_task *task);
void			xprt_request_enqueue_transmit(struct rpc_task *task);
int			xprt_request_enqueue_receive(struct rpc_task *task);
void			xprt_request_wait_receive(struct rpc_task *task);
void			xprt_request_dequeue_xprt(struct rpc_task *task);
bool			xprt_request_need_retransmit(struct rpc_task *task);
void			xprt_transmit(struct rpc_task *task);
void			xprt_end_transmit(struct rpc_task *task);
int			xprt_adjust_timeout(struct rpc_rqst *req);
void			xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
void			xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
void			xprt_release(struct rpc_task *task);
struct rpc_xprt *	xprt_get(struct rpc_xprt *xprt);
void			xprt_put(struct rpc_xprt *xprt);
struct rpc_xprt *	xprt_alloc(struct net *net, size_t size,
				unsigned int num_prealloc,
				unsigned int max_req);
void			xprt_free(struct rpc_xprt *);
void			xprt_add_backlog(struct rpc_xprt *xprt, struct rpc_task *task);
bool			xprt_wake_up_backlog(struct rpc_xprt *xprt, struct rpc_rqst *req);
void			xprt_cleanup_ids(void);

static inline int
xprt_enable_swap(struct rpc_xprt *xprt)
{}

static inline void
xprt_disable_swap(struct rpc_xprt *xprt)
{}

/*
 * Transport switch helper functions
 */
int			xprt_register_transport(struct xprt_class *type);
int			xprt_unregister_transport(struct xprt_class *type);
int			xprt_find_transport_ident(const char *);
void			xprt_wait_for_reply_request_def(struct rpc_task *task);
void			xprt_wait_for_reply_request_rtt(struct rpc_task *task);
void			xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
void			xprt_wait_for_buffer_space(struct rpc_xprt *xprt);
bool			xprt_write_space(struct rpc_xprt *xprt);
void			xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
struct rpc_rqst *	xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
void			xprt_update_rtt(struct rpc_task *task);
void			xprt_complete_rqst(struct rpc_task *task, int copied);
void			xprt_pin_rqst(struct rpc_rqst *req);
void			xprt_unpin_rqst(struct rpc_rqst *req);
void			xprt_release_rqst_cong(struct rpc_task *task);
bool			xprt_request_get_cong(struct rpc_xprt *xprt, struct rpc_rqst *req);
void			xprt_disconnect_done(struct rpc_xprt *xprt);
void			xprt_force_disconnect(struct rpc_xprt *xprt);
void			xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);

bool			xprt_lock_connect(struct rpc_xprt *, struct rpc_task *, void *);
void			xprt_unlock_connect(struct rpc_xprt *, void *);
void			xprt_release_write(struct rpc_xprt *, struct rpc_task *);

/*
 * Reserved bit positions in xprt->state
 */
#define XPRT_LOCKED
#define XPRT_CONNECTED
#define XPRT_CONNECTING
#define XPRT_CLOSE_WAIT
#define XPRT_BOUND
#define XPRT_BINDING
#define XPRT_CLOSING
#define XPRT_OFFLINE
#define XPRT_REMOVE
#define XPRT_CONGESTED
#define XPRT_CWND_WAIT
#define XPRT_WRITE_SPACE
#define XPRT_SND_IS_COOKIE

static inline void xprt_set_connected(struct rpc_xprt *xprt)
{}

static inline void xprt_clear_connected(struct rpc_xprt *xprt)
{}

static inline int xprt_connected(struct rpc_xprt *xprt)
{}

static inline int xprt_test_and_set_connected(struct rpc_xprt *xprt)
{}

static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt)
{}

static inline void xprt_clear_connecting(struct rpc_xprt *xprt)
{}

static inline int xprt_connecting(struct rpc_xprt *xprt)
{}

static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt)
{}

static inline void xprt_set_bound(struct rpc_xprt *xprt)
{}

static inline int xprt_bound(struct rpc_xprt *xprt)
{}

static inline void xprt_clear_bound(struct rpc_xprt *xprt)
{}

static inline void xprt_clear_binding(struct rpc_xprt *xprt)
{}

static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
{}

void xprt_set_offline_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps);
void xprt_set_online_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps);
void xprt_delete_locked(struct rpc_xprt *xprt, struct rpc_xprt_switch *xps);
#endif /* _LINUX_SUNRPC_XPRT_H */