#include <linux/completion.h>
#include <linux/file.h>
#include <linux/mutex.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/idr.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/module.h>
#include <linux/nsproxy.h>
#include <linux/nospec.h>
#include <rdma/rdma_user_cm.h>
#include <rdma/ib_marshall.h>
#include <rdma/rdma_cm.h>
#include <rdma/rdma_cm_ib.h>
#include <rdma/ib_addr.h>
#include <rdma/ib.h>
#include <rdma/ib_cm.h>
#include <rdma/rdma_netlink.h>
#include "core_priv.h"
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static unsigned int max_backlog = …;
static struct ctl_table_header *ucma_ctl_table_hdr;
static struct ctl_table ucma_ctl_table[] = …;
struct ucma_file { … };
struct ucma_context { … };
struct ucma_multicast { … };
struct ucma_event { … };
static DEFINE_XARRAY_ALLOC(ctx_table);
static DEFINE_XARRAY_ALLOC(multicast_table);
static const struct file_operations ucma_fops;
static int ucma_destroy_private_ctx(struct ucma_context *ctx);
static inline struct ucma_context *_ucma_find_context(int id,
struct ucma_file *file)
{ … }
static struct ucma_context *ucma_get_ctx(struct ucma_file *file, int id)
{ … }
static void ucma_put_ctx(struct ucma_context *ctx)
{ … }
static struct ucma_context *ucma_get_ctx_dev(struct ucma_file *file, int id)
{ … }
static void ucma_close_id(struct work_struct *work)
{ … }
static struct ucma_context *ucma_alloc_ctx(struct ucma_file *file)
{ … }
static void ucma_set_ctx_cm_id(struct ucma_context *ctx,
struct rdma_cm_id *cm_id)
{ … }
static void ucma_finish_ctx(struct ucma_context *ctx)
{ … }
static void ucma_copy_conn_event(struct rdma_ucm_conn_param *dst,
struct rdma_conn_param *src)
{ … }
static void ucma_copy_ud_event(struct ib_device *device,
struct rdma_ucm_ud_param *dst,
struct rdma_ud_param *src)
{ … }
static struct ucma_event *ucma_create_uevent(struct ucma_context *ctx,
struct rdma_cm_event *event)
{ … }
static int ucma_connect_event_handler(struct rdma_cm_id *cm_id,
struct rdma_cm_event *event)
{ … }
static int ucma_event_handler(struct rdma_cm_id *cm_id,
struct rdma_cm_event *event)
{ … }
static ssize_t ucma_get_event(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static int ucma_get_qp_type(struct rdma_ucm_create_id *cmd, enum ib_qp_type *qp_type)
{ … }
static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static void ucma_cleanup_multicast(struct ucma_context *ctx)
{ … }
static void ucma_cleanup_mc_events(struct ucma_multicast *mc)
{ … }
static int ucma_cleanup_ctx_events(struct ucma_context *ctx)
{ … }
static int ucma_destroy_private_ctx(struct ucma_context *ctx)
{ … }
static ssize_t ucma_destroy_id(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_bind_ip(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_bind(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_resolve_ip(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_resolve_addr(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_resolve_route(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static void ucma_copy_ib_route(struct rdma_ucm_query_route_resp *resp,
struct rdma_route *route)
{ … }
static void ucma_copy_iboe_route(struct rdma_ucm_query_route_resp *resp,
struct rdma_route *route)
{ … }
static void ucma_copy_iw_route(struct rdma_ucm_query_route_resp *resp,
struct rdma_route *route)
{ … }
static ssize_t ucma_query_route(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static void ucma_query_device_addr(struct rdma_cm_id *cm_id,
struct rdma_ucm_query_addr_resp *resp)
{ … }
static ssize_t ucma_query_addr(struct ucma_context *ctx,
void __user *response, int out_len)
{ … }
static ssize_t ucma_query_path(struct ucma_context *ctx,
void __user *response, int out_len)
{ … }
static ssize_t ucma_query_gid(struct ucma_context *ctx,
void __user *response, int out_len)
{ … }
static ssize_t ucma_query(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static void ucma_copy_conn_param(struct rdma_cm_id *id,
struct rdma_conn_param *dst,
struct rdma_ucm_conn_param *src)
{ … }
static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_reject(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_disconnect(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_init_qp_attr(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static int ucma_set_option_id(struct ucma_context *ctx, int optname,
void *optval, size_t optlen)
{ … }
static int ucma_set_ib_path(struct ucma_context *ctx,
struct ib_path_rec_data *path_data, size_t optlen)
{ … }
static int ucma_set_option_ib(struct ucma_context *ctx, int optname,
void *optval, size_t optlen)
{ … }
static int ucma_set_option_level(struct ucma_context *ctx, int level,
int optname, void *optval, size_t optlen)
{ … }
static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_process_join(struct ucma_file *file,
struct rdma_ucm_join_mcast *cmd, int out_len)
{ … }
static ssize_t ucma_join_ip_multicast(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_join_multicast(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_leave_multicast(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t ucma_migrate_id(struct ucma_file *new_file,
const char __user *inbuf,
int in_len, int out_len)
{ … }
static ssize_t (*ucma_cmd_table[])(struct ucma_file *file,
const char __user *inbuf,
int in_len, int out_len) = …;
static ssize_t ucma_write(struct file *filp, const char __user *buf,
size_t len, loff_t *pos)
{ … }
static __poll_t ucma_poll(struct file *filp, struct poll_table_struct *wait)
{ … }
static int ucma_open(struct inode *inode, struct file *filp)
{ … }
static int ucma_close(struct inode *inode, struct file *filp)
{ … }
static const struct file_operations ucma_fops = …;
static struct miscdevice ucma_misc = …;
static int ucma_get_global_nl_info(struct ib_client_nl_info *res)
{ … }
static struct ib_client rdma_cma_client = …;
MODULE_ALIAS_RDMA_CLIENT(…) …;
static ssize_t abi_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(abi_version);
static int __init ucma_init(void)
{ … }
static void __exit ucma_cleanup(void)
{ … }
module_init(…) …;
module_exit(ucma_cleanup);