#include <linux/socket.h>
#include <linux/if_vlan.h>
#include <linux/random.h>
#include <linux/workqueue.h>
#include <linux/wait.h>
#include <linux/reboot.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/smc.h>
#include <net/tcp.h>
#include <net/sock.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_cache.h>
#include "smc.h"
#include "smc_clc.h"
#include "smc_core.h"
#include "smc_ib.h"
#include "smc_wr.h"
#include "smc_llc.h"
#include "smc_cdc.h"
#include "smc_close.h"
#include "smc_ism.h"
#include "smc_netlink.h"
#include "smc_stats.h"
#include "smc_tracepoint.h"
#define SMC_LGR_NUM_INCR …
#define SMC_LGR_FREE_DELAY_SERV …
#define SMC_LGR_FREE_DELAY_CLNT …
struct smc_lgr_list smc_lgr_list = …;
static atomic_t lgr_cnt = …;
static DECLARE_WAIT_QUEUE_HEAD(lgrs_deleted);
static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
struct smc_buf_desc *buf_desc);
static void __smc_lgr_terminate(struct smc_link_group *lgr, bool soft);
static void smc_link_down_work(struct work_struct *work);
static inline struct list_head *smc_lgr_list_head(struct smc_link_group *lgr,
spinlock_t **lgr_lock)
{ … }
static void smc_ibdev_cnt_inc(struct smc_link *lnk)
{ … }
static void smc_ibdev_cnt_dec(struct smc_link *lnk)
{ … }
static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
{ … }
static void smc_lgr_add_alert_token(struct smc_connection *conn)
{ … }
static int smcr_lgr_conn_assign_link(struct smc_connection *conn, bool first)
{ … }
static int smc_lgr_register_conn(struct smc_connection *conn, bool first)
{ … }
static void __smc_lgr_unregister_conn(struct smc_connection *conn)
{ … }
static void smc_lgr_unregister_conn(struct smc_connection *conn)
{ … }
int smc_nl_get_sys_info(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
static int smc_nl_fill_lgr_v2_common(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb,
struct nlattr *v2_attrs)
{ … }
static int smc_nl_fill_smcr_lgr_v2(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static int smc_nl_fill_lgr(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static int smc_nl_fill_lgr_link(struct smc_link_group *lgr,
struct smc_link *link,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static int smc_nl_handle_lgr(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb,
bool list_links)
{ … }
static void smc_nl_fill_lgr_list(struct smc_lgr_list *smc_lgr,
struct sk_buff *skb,
struct netlink_callback *cb,
bool list_links)
{ … }
static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static int smc_nl_handle_smcd_lgr(struct smcd_dev *dev,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static int smc_nl_fill_smcd_dev(struct smcd_dev_list *dev_list,
struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
int smcr_nl_get_lgr(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int smcr_nl_get_link(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
int smcd_nl_get_lgr(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
void smc_lgr_cleanup_early(struct smc_link_group *lgr)
{ … }
static void smcr_lgr_link_deactivate_all(struct smc_link_group *lgr)
{ … }
static void smc_lgr_free(struct smc_link_group *lgr);
static void smc_lgr_free_work(struct work_struct *work)
{ … }
static void smc_lgr_terminate_work(struct work_struct *work)
{ … }
static u8 smcr_next_link_id(struct smc_link_group *lgr)
{ … }
static void smcr_copy_dev_info_to_link(struct smc_link *link)
{ … }
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini)
{ … }
static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
{ … }
static int smc_write_space(struct smc_connection *conn)
{ … }
static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
struct smc_wr_buf *wr_buf)
{ … }
void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk)
{ … }
struct smc_link *smc_switch_conns(struct smc_link_group *lgr,
struct smc_link *from_lnk, bool is_dev_err)
{ … }
static void smcr_buf_unuse(struct smc_buf_desc *buf_desc, bool is_rmb,
struct smc_link_group *lgr)
{ … }
static void smcd_buf_detach(struct smc_connection *conn)
{ … }
static void smc_buf_unuse(struct smc_connection *conn,
struct smc_link_group *lgr)
{ … }
void smc_conn_free(struct smc_connection *conn)
{ … }
static void smcr_buf_unmap_link(struct smc_buf_desc *buf_desc, bool is_rmb,
struct smc_link *lnk)
{ … }
static void smcr_buf_unmap_lgr(struct smc_link *lnk)
{ … }
static void smcr_rtoken_clear_link(struct smc_link *lnk)
{ … }
static void __smcr_link_clear(struct smc_link *lnk)
{ … }
void smcr_link_clear(struct smc_link *lnk, bool log)
{ … }
void smcr_link_hold(struct smc_link *lnk)
{ … }
void smcr_link_put(struct smc_link *lnk)
{ … }
static void smcr_buf_free(struct smc_link_group *lgr, bool is_rmb,
struct smc_buf_desc *buf_desc)
{ … }
static void smcd_buf_free(struct smc_link_group *lgr, bool is_dmb,
struct smc_buf_desc *buf_desc)
{ … }
static void smc_buf_free(struct smc_link_group *lgr, bool is_rmb,
struct smc_buf_desc *buf_desc)
{ … }
static void __smc_lgr_free_bufs(struct smc_link_group *lgr, bool is_rmb)
{ … }
static void smc_lgr_free_bufs(struct smc_link_group *lgr)
{ … }
static void __smc_lgr_free(struct smc_link_group *lgr)
{ … }
static void smc_lgr_free(struct smc_link_group *lgr)
{ … }
void smc_lgr_hold(struct smc_link_group *lgr)
{ … }
void smc_lgr_put(struct smc_link_group *lgr)
{ … }
static void smc_sk_wake_ups(struct smc_sock *smc)
{ … }
static void smc_conn_kill(struct smc_connection *conn, bool soft)
{ … }
static void smc_lgr_cleanup(struct smc_link_group *lgr)
{ … }
static void __smc_lgr_terminate(struct smc_link_group *lgr, bool soft)
{ … }
void smc_lgr_terminate_sched(struct smc_link_group *lgr)
{ … }
void smc_smcd_terminate(struct smcd_dev *dev, struct smcd_gid *peer_gid,
unsigned short vlan)
{ … }
void smc_smcd_terminate_all(struct smcd_dev *smcd)
{ … }
void smc_smcr_terminate_all(struct smc_ib_device *smcibdev)
{ … }
void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type)
{ … }
void smcr_lgr_set_type_asym(struct smc_link_group *lgr,
enum smc_lgr_type new_type, int asym_lnk_idx)
{ … }
static void smc_conn_abort_work(struct work_struct *work)
{ … }
void smcr_port_add(struct smc_ib_device *smcibdev, u8 ibport)
{ … }
static void smcr_link_down(struct smc_link *lnk)
{ … }
void smcr_link_down_cond(struct smc_link *lnk)
{ … }
void smcr_link_down_cond_sched(struct smc_link *lnk)
{ … }
void smcr_port_err(struct smc_ib_device *smcibdev, u8 ibport)
{ … }
static void smc_link_down_work(struct work_struct *work)
{ … }
static int smc_vlan_by_tcpsk_walk(struct net_device *lower_dev,
struct netdev_nested_priv *priv)
{ … }
int smc_vlan_by_tcpsk(struct socket *clcsock, struct smc_init_info *ini)
{ … }
static bool smcr_lgr_match(struct smc_link_group *lgr, u8 smcr_version,
u8 peer_systemid[],
u8 peer_gid[],
u8 peer_mac_v1[],
enum smc_lgr_role role, u32 clcqpn,
struct net *net)
{ … }
static bool smcd_lgr_match(struct smc_link_group *lgr,
struct smcd_dev *smcismdev,
struct smcd_gid *peer_gid)
{ … }
int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
{ … }
#define SMCD_DMBE_SIZES …
#define SMCR_RMBE_SIZES …
static u8 smc_compress_bufsize(int size, bool is_smcd, bool is_rmb)
{ … }
int smc_uncompress_bufsize(u8 compressed)
{ … }
static struct smc_buf_desc *smc_buf_get_slot(int compressed_bufsize,
struct rw_semaphore *lock,
struct list_head *buf_list)
{ … }
static inline int smc_rmb_wnd_update_limit(int rmbe_size)
{ … }
static int smcr_buf_map_link(struct smc_buf_desc *buf_desc, bool is_rmb,
struct smc_link *lnk)
{ … }
int smcr_link_reg_buf(struct smc_link *link, struct smc_buf_desc *buf_desc)
{ … }
static int _smcr_buf_map_lgr(struct smc_link *lnk, struct rw_semaphore *lock,
struct list_head *lst, bool is_rmb)
{ … }
int smcr_buf_map_lgr(struct smc_link *lnk)
{ … }
int smcr_buf_reg_lgr(struct smc_link *lnk)
{ … }
static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr,
bool is_rmb, int bufsize)
{ … }
static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
struct smc_buf_desc *buf_desc, bool is_rmb)
{ … }
static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr,
bool is_dmb, int bufsize)
{ … }
static int __smc_buf_create(struct smc_sock *smc, bool is_smcd, bool is_rmb)
{ … }
void smc_sndbuf_sync_sg_for_device(struct smc_connection *conn)
{ … }
void smc_rmb_sync_sg_for_cpu(struct smc_connection *conn)
{ … }
int smc_buf_create(struct smc_sock *smc, bool is_smcd)
{ … }
int smcd_buf_attach(struct smc_sock *smc)
{ … }
static inline int smc_rmb_reserve_rtoken_idx(struct smc_link_group *lgr)
{ … }
static int smc_rtoken_find_by_link(struct smc_link_group *lgr, int lnk_idx,
u32 rkey)
{ … }
void smc_rtoken_set(struct smc_link_group *lgr, int link_idx, int link_idx_new,
__be32 nw_rkey_known, __be64 nw_vaddr, __be32 nw_rkey)
{ … }
void smc_rtoken_set2(struct smc_link_group *lgr, int rtok_idx, int link_id,
__be64 nw_vaddr, __be32 nw_rkey)
{ … }
int smc_rtoken_add(struct smc_link *lnk, __be64 nw_vaddr, __be32 nw_rkey)
{ … }
int smc_rtoken_delete(struct smc_link *lnk, __be32 nw_rkey)
{ … }
int smc_rmb_rtoken_handling(struct smc_connection *conn,
struct smc_link *lnk,
struct smc_clc_msg_accept_confirm *clc)
{ … }
static void smc_core_going_away(void)
{ … }
static void smc_lgrs_shutdown(void)
{ … }
static int smc_core_reboot_event(struct notifier_block *this,
unsigned long event, void *ptr)
{ … }
static struct notifier_block smc_reboot_notifier = …;
int __init smc_core_init(void)
{ … }
void smc_core_exit(void)
{ … }