linux/net/smc/smc.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  Shared Memory Communications over RDMA (SMC-R) and RoCE
 *
 *  Definitions for the SMC module (socket related)
 *
 *  Copyright IBM Corp. 2016
 *
 *  Author(s):  Ursula Braun <[email protected]>
 */
#ifndef __SMC_H
#define __SMC_H

#include <linux/socket.h>
#include <linux/types.h>
#include <linux/compiler.h> /* __aligned */
#include <net/genetlink.h>
#include <net/sock.h>

#include "smc_ib.h"

#define SMC_V1
#define SMC_V2

#define SMC_RELEASE_0
#define SMC_RELEASE_1
#define SMC_RELEASE

#define SMCPROTO_SMC
#define SMCPROTO_SMC6

#define SMC_AUTOCORKING_DEFAULT_SIZE

extern struct proto smc_proto;
extern struct proto smc_proto6;

extern struct smc_hashinfo smc_v4_hashinfo;
extern struct smc_hashinfo smc_v6_hashinfo;

int smc_hash_sk(struct sock *sk);
void smc_unhash_sk(struct sock *sk);
void smc_release_cb(struct sock *sk);

int smc_release(struct socket *sock);
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
	     int addr_len);
int smc_connect(struct socket *sock, struct sockaddr *addr,
		int alen, int flags);
int smc_accept(struct socket *sock, struct socket *new_sock,
	       struct proto_accept_arg *arg);
int smc_getname(struct socket *sock, struct sockaddr *addr,
		int peer);
__poll_t smc_poll(struct file *file, struct socket *sock,
		  poll_table *wait);
int smc_ioctl(struct socket *sock, unsigned int cmd,
	      unsigned long arg);
int smc_listen(struct socket *sock, int backlog);
int smc_shutdown(struct socket *sock, int how);
int smc_setsockopt(struct socket *sock, int level, int optname,
		   sockptr_t optval, unsigned int optlen);
int smc_getsockopt(struct socket *sock, int level, int optname,
		   char __user *optval, int __user *optlen);
int smc_sendmsg(struct socket *sock, struct msghdr *msg, size_t len);
int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
		int flags);
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
			struct pipe_inode_info *pipe, size_t len,
			unsigned int flags);

/* smc sock initialization */
void smc_sk_init(struct net *net, struct sock *sk, int protocol);
/* clcsock initialization */
int smc_create_clcsk(struct net *net, struct sock *sk, int family);

#ifdef ATOMIC64_INIT
#define KERNEL_HAS_ATOMIC64
#endif

enum smc_state {};

enum smc_supplemental_features {};

#define SMC_FEATURE_MASK

struct smc_link_group;

struct smc_wr_rx_hdr {} __aligned();

struct smc_cdc_conn_state_flags {};

struct smc_cdc_producer_flags {};

/* in host byte order */
smc_host_cursor __aligned();

/* in host byte order, except for flag bitfields in network byte order */
struct smc_host_cdc_msg {} __aligned();

enum smc_urg_state {};

struct smc_mark_woken {};

struct smc_connection {};

struct smc_sock {};

#define smc_sk(ptr)

static inline void smc_init_saved_callbacks(struct smc_sock *smc)
{}

static inline struct smc_sock *smc_clcsock_user_data(const struct sock *clcsk)
{}

/* save target_cb in saved_cb, and replace target_cb with new_cb */
static inline void smc_clcsock_replace_cb(void (**target_cb)(struct sock *),
					  void (*new_cb)(struct sock *),
					  void (**saved_cb)(struct sock *))
{}

/* restore target_cb to saved_cb, and reset saved_cb to NULL */
static inline void smc_clcsock_restore_cb(void (**target_cb)(struct sock *),
					  void (**saved_cb)(struct sock *))
{}

extern struct workqueue_struct	*smc_hs_wq;	/* wq for handshake work */
extern struct workqueue_struct	*smc_close_wq;	/* wq for close work */

#define SMC_SYSTEMID_LEN

extern u8	local_systemid[SMC_SYSTEMID_LEN]; /* unique system identifier */

#define ntohll(x)
#define htonll(x)

/* convert an u32 value into network byte order, store it into a 3 byte field */
static inline void hton24(u8 *net, u32 host)
{}

/* convert a received 3 byte field into host byte order*/
static inline u32 ntoh24(u8 *net)
{}

#ifdef CONFIG_XFRM
static inline bool using_ipsec(struct smc_sock *smc)
{}
#else
static inline bool using_ipsec(struct smc_sock *smc)
{
	return false;
}
#endif

struct smc_gidlist;

struct sock *smc_accept_dequeue(struct sock *parent, struct socket *new_sock);
void smc_close_non_accepted(struct sock *sk);
void smc_fill_gid_list(struct smc_link_group *lgr,
		       struct smc_gidlist *gidlist,
		       struct smc_ib_device *known_dev, u8 *known_gid);

/* smc handshake limitation interface for netlink  */
int smc_nl_dump_hs_limitation(struct sk_buff *skb, struct netlink_callback *cb);
int smc_nl_enable_hs_limitation(struct sk_buff *skb, struct genl_info *info);
int smc_nl_disable_hs_limitation(struct sk_buff *skb, struct genl_info *info);

static inline void smc_sock_set_flag(struct sock *sk, enum sock_flags flag)
{}

#endif	/* __SMC_H */