#define KMSG_COMPONENT …
#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/socket.h>
#include <linux/workqueue.h>
#include <linux/in.h>
#include <linux/sched/signal.h>
#include <linux/if_vlan.h>
#include <linux/rcupdate_wait.h>
#include <linux/ctype.h>
#include <linux/splice.h>
#include <net/sock.h>
#include <net/tcp.h>
#include <net/smc.h>
#include <asm/ioctls.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include "smc_netns.h"
#include "smc.h"
#include "smc_clc.h"
#include "smc_llc.h"
#include "smc_cdc.h"
#include "smc_core.h"
#include "smc_ib.h"
#include "smc_ism.h"
#include "smc_pnet.h"
#include "smc_netlink.h"
#include "smc_tx.h"
#include "smc_rx.h"
#include "smc_close.h"
#include "smc_stats.h"
#include "smc_tracepoint.h"
#include "smc_sysctl.h"
#include "smc_loopback.h"
#include "smc_inet.h"
static DEFINE_MUTEX(smc_server_lgr_pending);
static DEFINE_MUTEX(smc_client_lgr_pending);
static struct workqueue_struct *smc_tcp_ls_wq;
struct workqueue_struct *smc_hs_wq;
struct workqueue_struct *smc_close_wq;
static void smc_tcp_listen_work(struct work_struct *);
static void smc_connect_work(struct work_struct *);
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 void smc_set_keepalive(struct sock *sk, int val)
{ … }
static struct sock *smc_tcp_syn_recv_sock(const struct sock *sk,
struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst,
struct request_sock *req_unhash,
bool *own_req)
{ … }
static bool smc_hs_congested(const struct sock *sk)
{ … }
struct smc_hashinfo smc_v4_hashinfo = …;
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)
{ … }
struct proto smc_proto = …;
EXPORT_SYMBOL_GPL(…);
struct proto smc_proto6 = …;
EXPORT_SYMBOL_GPL(…);
static void smc_fback_restore_callbacks(struct smc_sock *smc)
{ … }
static void smc_restore_fallback_changes(struct smc_sock *smc)
{ … }
static int __smc_release(struct smc_sock *smc)
{ … }
int smc_release(struct socket *sock)
{ … }
static void smc_destruct(struct sock *sk)
{ … }
void smc_sk_init(struct net *net, struct sock *sk, int protocol)
{ … }
static struct sock *smc_sock_alloc(struct net *net, struct socket *sock,
int protocol)
{ … }
int smc_bind(struct socket *sock, struct sockaddr *uaddr,
int addr_len)
{ … }
#define SK_FLAGS_SMC_TO_CLC …
static void smc_adjust_sock_bufsizes(struct sock *nsk, struct sock *osk,
unsigned long mask)
{ … }
static void smc_copy_sock_settings(struct sock *nsk, struct sock *osk,
unsigned long mask)
{ … }
static void smc_copy_sock_settings_to_clc(struct smc_sock *smc)
{ … }
#define SK_FLAGS_CLC_TO_SMC …
static void smc_copy_sock_settings_to_smc(struct smc_sock *smc)
{ … }
static int smcr_lgr_reg_sndbufs(struct smc_link *link,
struct smc_buf_desc *snd_desc)
{ … }
static int smcr_lgr_reg_rmbs(struct smc_link *link,
struct smc_buf_desc *rmb_desc)
{ … }
static int smcr_clnt_conf_first_link(struct smc_sock *smc)
{ … }
static bool smc_isascii(char *hostname)
{ … }
static void smc_conn_save_peer_info_fce(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc)
{ … }
static void smcr_conn_save_peer_info(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc)
{ … }
static void smcd_conn_save_peer_info(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc)
{ … }
static void smc_conn_save_peer_info(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *clc)
{ … }
static void smc_link_save_peer_info(struct smc_link *link,
struct smc_clc_msg_accept_confirm *clc,
struct smc_init_info *ini)
{ … }
static void smc_stat_inc_fback_rsn_cnt(struct smc_sock *smc,
struct smc_stats_fback *fback_arr)
{ … }
static void smc_stat_fallback(struct smc_sock *smc)
{ … }
static void smc_fback_wakeup_waitqueue(struct smc_sock *smc, void *key)
{ … }
static int smc_fback_mark_woken(wait_queue_entry_t *wait,
unsigned int mode, int sync, void *key)
{ … }
static void smc_fback_forward_wakeup(struct smc_sock *smc, struct sock *clcsk,
void (*clcsock_callback)(struct sock *sk))
{ … }
static void smc_fback_state_change(struct sock *clcsk)
{ … }
static void smc_fback_data_ready(struct sock *clcsk)
{ … }
static void smc_fback_write_space(struct sock *clcsk)
{ … }
static void smc_fback_error_report(struct sock *clcsk)
{ … }
static void smc_fback_replace_callbacks(struct smc_sock *smc)
{ … }
static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
{ … }
static int smc_connect_fallback(struct smc_sock *smc, int reason_code)
{ … }
static int smc_connect_decline_fallback(struct smc_sock *smc, int reason_code,
u8 version)
{ … }
static void smc_conn_abort(struct smc_sock *smc, int local_first)
{ … }
static int smc_find_rdma_device(struct smc_sock *smc, struct smc_init_info *ini)
{ … }
static int smc_find_ism_device(struct smc_sock *smc, struct smc_init_info *ini)
{ … }
static bool smc_find_ism_v2_is_unique_chid(u16 chid, struct smc_init_info *ini,
int cnt)
{ … }
static int smc_find_ism_v2_device_clnt(struct smc_sock *smc,
struct smc_init_info *ini)
{ … }
static int smc_connect_ism_vlan_setup(struct smc_sock *smc,
struct smc_init_info *ini)
{ … }
static int smc_find_proposal_devices(struct smc_sock *smc,
struct smc_init_info *ini)
{ … }
static int smc_connect_ism_vlan_cleanup(struct smc_sock *smc,
struct smc_init_info *ini)
{ … }
#define SMC_CLC_MAX_ACCEPT_LEN …
static int smc_connect_clc(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *aclc,
struct smc_init_info *ini)
{ … }
void smc_fill_gid_list(struct smc_link_group *lgr,
struct smc_gidlist *gidlist,
struct smc_ib_device *known_dev, u8 *known_gid)
{ … }
static int smc_connect_rdma_v2_prepare(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *aclc,
struct smc_init_info *ini)
{ … }
static int smc_connect_rdma(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *aclc,
struct smc_init_info *ini)
{ … }
static int
smc_v2_determine_accepted_chid(struct smc_clc_msg_accept_confirm *aclc,
struct smc_init_info *ini)
{ … }
static int smc_connect_ism(struct smc_sock *smc,
struct smc_clc_msg_accept_confirm *aclc,
struct smc_init_info *ini)
{ … }
static int smc_connect_check_aclc(struct smc_init_info *ini,
struct smc_clc_msg_accept_confirm *aclc)
{ … }
static int __smc_connect(struct smc_sock *smc)
{ … }
static void smc_connect_work(struct work_struct *work)
{ … }
int smc_connect(struct socket *sock, struct sockaddr *addr,
int alen, int flags)
{ … }
static int smc_clcsock_accept(struct smc_sock *lsmc, struct smc_sock **new_smc)
{ … }
static void smc_accept_enqueue(struct sock *parent, struct sock *sk)
{ … }
static void smc_accept_unlink(struct sock *sk)
{ … }
struct sock *smc_accept_dequeue(struct sock *parent,
struct socket *new_sock)
{ … }
void smc_close_non_accepted(struct sock *sk)
{ … }
static int smcr_serv_conf_first_link(struct smc_sock *smc)
{ … }
static void smc_listen_out(struct smc_sock *new_smc)
{ … }
static void smc_listen_out_connected(struct smc_sock *new_smc)
{ … }
static void smc_listen_out_err(struct smc_sock *new_smc)
{ … }
static void smc_listen_decline(struct smc_sock *new_smc, int reason_code,
int local_first, u8 version)
{ … }
static int smc_listen_v2_check(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static int smc_listen_prfx_check(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc)
{ … }
static int smc_listen_rdma_init(struct smc_sock *new_smc,
struct smc_init_info *ini)
{ … }
static int smc_listen_ism_init(struct smc_sock *new_smc,
struct smc_init_info *ini)
{ … }
static bool smc_is_already_selected(struct smcd_dev *smcd,
struct smc_init_info *ini,
int matches)
{ … }
static void smc_check_ism_v2_match(struct smc_init_info *ini,
u16 proposed_chid,
struct smcd_gid *proposed_gid,
unsigned int *matches)
{ … }
static void smc_find_ism_store_rc(u32 rc, struct smc_init_info *ini)
{ … }
static void smc_find_ism_v2_device_serv(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static void smc_find_ism_v1_device_serv(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static int smc_listen_rdma_reg(struct smc_sock *new_smc, bool local_first)
{ … }
static void smc_find_rdma_v2_device_serv(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static int smc_find_rdma_v1_device_serv(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static int smc_listen_find_device(struct smc_sock *new_smc,
struct smc_clc_msg_proposal *pclc,
struct smc_init_info *ini)
{ … }
static int smc_listen_rdma_finish(struct smc_sock *new_smc,
struct smc_clc_msg_accept_confirm *cclc,
bool local_first,
struct smc_init_info *ini)
{ … }
static void smc_listen_work(struct work_struct *work)
{ … }
static void smc_tcp_listen_work(struct work_struct *work)
{ … }
static void smc_clcsock_data_ready(struct sock *listen_clcsock)
{ … }
int smc_listen(struct socket *sock, int backlog)
{ … }
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)
{ … }
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)
{ … }
static __poll_t smc_accept_poll(struct sock *parent)
{ … }
__poll_t smc_poll(struct file *file, struct socket *sock,
poll_table *wait)
{ … }
int smc_shutdown(struct socket *sock, int how)
{ … }
static int __smc_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{ … }
static int __smc_setsockopt(struct socket *sock, int level, int optname,
sockptr_t optval, unsigned int optlen)
{ … }
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_ioctl(struct socket *sock, unsigned int cmd,
unsigned long arg)
{ … }
ssize_t smc_splice_read(struct socket *sock, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags)
{ … }
static const struct proto_ops smc_sock_ops = …;
int smc_create_clcsk(struct net *net, struct sock *sk, int family)
{ … }
static int __smc_create(struct net *net, struct socket *sock, int protocol,
int kern, struct socket *clcsock)
{ … }
static int smc_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ … }
static const struct net_proto_family smc_sock_family_ops = …;
static int smc_ulp_init(struct sock *sk)
{ … }
static void smc_ulp_clone(const struct request_sock *req, struct sock *newsk,
const gfp_t priority)
{ … }
static struct tcp_ulp_ops smc_ulp_ops __read_mostly = …;
unsigned int smc_net_id;
static __net_init int smc_net_init(struct net *net)
{ … }
static void __net_exit smc_net_exit(struct net *net)
{ … }
static __net_init int smc_net_stat_init(struct net *net)
{ … }
static void __net_exit smc_net_stat_exit(struct net *net)
{ … }
static struct pernet_operations smc_net_ops = …;
static struct pernet_operations smc_net_stat_ops = …;
static int __init smc_init(void)
{ … }
static void __exit smc_exit(void)
{ … }
module_init(…) …;
module_exit(smc_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_NETPROTO(…);
MODULE_ALIAS_TCP_ULP(…) …;
MODULE_ALIAS_NET_PF_PROTO_TYPE(…);
#if IS_ENABLED(CONFIG_IPV6)
MODULE_ALIAS_NET_PF_PROTO_TYPE(…);
#endif
MODULE_ALIAS_GENL_FAMILY(…);