c - rdma connection manager driver pattern -
i'm using ofed 3.18r2 implementation of infiniband drivers application. in particular i'm using rdma connection manager wrapper functions. understand better what's going on under hood i'm used @ source code. doing came looks pattern cannot understand it. let's make example. rdma connection manager functions in cma.c. looking example @ rdma_listen call (this common every functions defined in library start "rdma_"):
int rdma_listen(struct rdma_cm_id *id, int backlog) { struct ucma_abi_listen cmd; struct cma_id_private *id_priv; int ret; cma_init_cmd(&cmd, sizeof cmd, listen); id_priv = container_of(id, struct cma_id_private, id); cmd.id = id_priv->handle; cmd.backlog = backlog; ret = write(id->channel->fd, &cmd, sizeof cmd); if (ret != sizeof cmd) return (ret >= 0) ? err(enodata) : -1; if (af_ib_support) return ucma_query_addr(id); else return ucma_query_route(id); }
here can see pattern mentioned before:
ret = write(id->channel->fd, &cmd, sizeof cmd);
the first argument write call file descriptor associated /dev/infiniband/rdma_cm , cannot understand usage of cmd arguments. dig source find cmd struct comes abi definition of rdma cm function calls. don't understand if common pattern execute device driver calls , how works, real code associated cmd argument. please me?
using write()
system call execute commands common method executing commands in rdma subsystem. used among others rdma_ucm module , ib_uverbs module. kernel code associate rdma_ucm can found in drivers/infiniband/core/ucma.c file. specifically, write()
system call device implemented in ucma_write()
function.
i don't think there lot of documentation on method of calling driver. user_verbs.txt
document in kernel documentation states:
commands sent kernel via write()s on these device files. abi defined in drivers/infiniband/include/ib_user_verbs.h. structs commands require response kernel contain 64-bit field used pass pointer output buffer. status returned userspace return value of write() system call.
i think may small abuse of write()
system call implements more similar ioctl()
.
edit: note added link upstream kernel module, ofed source structure similar. edit: added documentation pointers.
Comments
Post a Comment