#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/file.h>
#include <linux/cdev.h>
#include <linux/anon_inodes.h>
#include <linux/slab.h>
#include <linux/sched/mm.h>
#include <linux/uaccess.h>
#include <rdma/ib.h>
#include <rdma/uverbs_std_types.h>
#include <rdma/rdma_netlink.h>
#include "uverbs.h"
#include "core_priv.h"
#include "rdma_core.h"
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
enum { … };
#define IB_UVERBS_BASE_DEV …
static dev_t dynamic_uverbs_dev;
static DEFINE_IDA(uverbs_ida);
static int ib_uverbs_add_one(struct ib_device *device);
static void ib_uverbs_remove_one(struct ib_device *device, void *client_data);
static char *uverbs_devnode(const struct device *dev, umode_t *mode)
{ … }
static const struct class uverbs_class = …;
struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile)
{ … }
EXPORT_SYMBOL(…);
int uverbs_dealloc_mw(struct ib_mw *mw)
{ … }
static void ib_uverbs_release_dev(struct device *device)
{ … }
void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file,
struct ib_ucq_object *uobj)
{ … }
void ib_uverbs_release_uevent(struct ib_uevent_object *uobj)
{ … }
void ib_uverbs_detach_umcast(struct ib_qp *qp,
struct ib_uqp_object *uobj)
{ … }
static void ib_uverbs_comp_dev(struct ib_uverbs_device *dev)
{ … }
void ib_uverbs_release_file(struct kref *ref)
{ … }
static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_queue *ev_queue,
struct file *filp, char __user *buf,
size_t count, loff_t *pos,
size_t eventsz)
{ … }
static ssize_t ib_uverbs_async_event_read(struct file *filp, char __user *buf,
size_t count, loff_t *pos)
{ … }
static ssize_t ib_uverbs_comp_event_read(struct file *filp, char __user *buf,
size_t count, loff_t *pos)
{ … }
static __poll_t ib_uverbs_event_poll(struct ib_uverbs_event_queue *ev_queue,
struct file *filp,
struct poll_table_struct *wait)
{ … }
static __poll_t ib_uverbs_async_event_poll(struct file *filp,
struct poll_table_struct *wait)
{ … }
static __poll_t ib_uverbs_comp_event_poll(struct file *filp,
struct poll_table_struct *wait)
{ … }
static int ib_uverbs_async_event_fasync(int fd, struct file *filp, int on)
{ … }
static int ib_uverbs_comp_event_fasync(int fd, struct file *filp, int on)
{ … }
const struct file_operations uverbs_event_fops = …;
const struct file_operations uverbs_async_event_fops = …;
void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)
{ … }
void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
__u64 element, __u64 event,
struct list_head *obj_list, u32 *counter)
{ … }
static void uverbs_uobj_event(struct ib_uevent_object *eobj,
struct ib_event *event)
{ … }
void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr)
{ … }
void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr)
{ … }
void ib_uverbs_wq_event_handler(struct ib_event *event, void *context_ptr)
{ … }
void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr)
{ … }
static void ib_uverbs_event_handler(struct ib_event_handler *handler,
struct ib_event *event)
{ … }
void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue)
{ … }
void ib_uverbs_init_async_event_file(
struct ib_uverbs_async_event_file *async_file)
{ … }
static ssize_t verify_hdr(struct ib_uverbs_cmd_hdr *hdr,
struct ib_uverbs_ex_cmd_hdr *ex_hdr, size_t count,
const struct uverbs_api_write_method *method_elm)
{ … }
static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
size_t count, loff_t *pos)
{ … }
static const struct vm_operations_struct rdma_umap_ops;
static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma)
{ … }
static void rdma_umap_open(struct vm_area_struct *vma)
{ … }
static void rdma_umap_close(struct vm_area_struct *vma)
{ … }
static vm_fault_t rdma_umap_fault(struct vm_fault *vmf)
{ … }
static const struct vm_operations_struct rdma_umap_ops = …;
void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile)
{ … }
static int ib_uverbs_open(struct inode *inode, struct file *filp)
{ … }
static int ib_uverbs_close(struct inode *inode, struct file *filp)
{ … }
static const struct file_operations uverbs_fops = …;
static const struct file_operations uverbs_mmap_fops = …;
static int ib_uverbs_get_nl_info(struct ib_device *ibdev, void *client_data,
struct ib_client_nl_info *res)
{ … }
static struct ib_client uverbs_client = …;
MODULE_ALIAS_RDMA_CLIENT(…) …;
static ssize_t ibdev_show(struct device *device, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(ibdev);
static ssize_t abi_version_show(struct device *device,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(abi_version);
static struct attribute *ib_dev_attrs[] = …;
static const struct attribute_group dev_attr_group = …;
static CLASS_ATTR_STRING(abi_version, S_IRUGO,
__stringify(IB_USER_VERBS_ABI_VERSION));
static int ib_uverbs_create_uapi(struct ib_device *device,
struct ib_uverbs_device *uverbs_dev)
{ … }
static int ib_uverbs_add_one(struct ib_device *device)
{ … }
static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,
struct ib_device *ib_dev)
{ … }
static void ib_uverbs_remove_one(struct ib_device *device, void *client_data)
{ … }
static int __init ib_uverbs_init(void)
{ … }
static void __exit ib_uverbs_cleanup(void)
{ … }
module_init(…) …;
module_exit(ib_uverbs_cleanup);