linux/drivers/infiniband/core/uverbs_cmd.c

/*
 * Copyright (c) 2005 Topspin Communications.  All rights reserved.
 * Copyright (c) 2005, 2006, 2007 Cisco Systems.  All rights reserved.
 * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
 * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
 *
 * This software is available to you under a choice of one of two
 * licenses.  You may choose to be licensed under the terms of the GNU
 * General Public License (GPL) Version 2, available from the file
 * COPYING in the main directory of this source tree, or the
 * OpenIB.org BSD license below:
 *
 *     Redistribution and use in source and binary forms, with or
 *     without modification, are permitted provided that the following
 *     conditions are met:
 *
 *      - Redistributions of source code must retain the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer.
 *
 *      - Redistributions in binary form must reproduce the above
 *        copyright notice, this list of conditions and the following
 *        disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include <linux/file.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/sched.h>

#include <linux/uaccess.h>

#include <rdma/uverbs_types.h>
#include <rdma/uverbs_std_types.h>
#include "rdma_core.h"

#include "uverbs.h"
#include "core_priv.h"

/*
 * Copy a response to userspace. If the provided 'resp' is larger than the
 * user buffer it is silently truncated. If the user provided a larger buffer
 * then the trailing portion is zero filled.
 *
 * These semantics are intended to support future extension of the output
 * structures.
 */
static int uverbs_response(struct uverbs_attr_bundle *attrs, const void *resp,
			   size_t resp_len)
{}

/*
 * Copy a request from userspace. If the provided 'req' is larger than the
 * user buffer then the user buffer is zero extended into the 'req'. If 'req'
 * is smaller than the user buffer then the uncopied bytes in the user buffer
 * must be zero.
 */
static int uverbs_request(struct uverbs_attr_bundle *attrs, void *req,
			  size_t req_len)
{}

/*
 * Generate the value for the 'response_length' protocol used by write_ex.
 * This is the number of bytes the kernel actually wrote. Userspace can use
 * this to detect what structure members in the response the kernel
 * understood.
 */
static u32 uverbs_response_length(struct uverbs_attr_bundle *attrs,
				  size_t resp_len)
{}

/*
 * The iterator version of the request interface is for handlers that need to
 * step over a flex array at the end of a command header.
 */
struct uverbs_req_iter {};

static int uverbs_request_start(struct uverbs_attr_bundle *attrs,
				struct uverbs_req_iter *iter,
				void *req,
				size_t req_len)
{}

static int uverbs_request_next(struct uverbs_req_iter *iter, void *val,
			       size_t len)
{}

static const void __user *uverbs_request_next_ptr(struct uverbs_req_iter *iter,
						  size_t len)
{}

static int uverbs_request_finish(struct uverbs_req_iter *iter)
{}

/*
 * When calling a destroy function during an error unwind we need to pass in
 * the udata that is sanitized of all user arguments. Ie from the driver
 * perspective it looks like no udata was passed.
 */
struct ib_udata *uverbs_get_cleared_udata(struct uverbs_attr_bundle *attrs)
{}

static struct ib_uverbs_completion_event_file *
_ib_uverbs_lookup_comp_file(s32 fd, struct uverbs_attr_bundle *attrs)
{}
#define ib_uverbs_lookup_comp_file(_fd, _ufile)

int ib_alloc_ucontext(struct uverbs_attr_bundle *attrs)
{}

int ib_init_ucontext(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_get_context(struct uverbs_attr_bundle *attrs)
{}

static void copy_query_dev_fields(struct ib_ucontext *ucontext,
				  struct ib_uverbs_query_device_resp *resp,
				  struct ib_device_attr *attr)
{}

static int ib_uverbs_query_device(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_query_port(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_alloc_pd(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_dealloc_pd(struct uverbs_attr_bundle *attrs)
{}

struct xrcd_table_entry {};

static int xrcd_table_insert(struct ib_uverbs_device *dev,
			    struct inode *inode,
			    struct ib_xrcd *xrcd)
{}

static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev,
						  struct inode *inode)
{}

static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode)
{}

static void xrcd_table_delete(struct ib_uverbs_device *dev,
			      struct inode *inode)
{}

static int ib_uverbs_open_xrcd(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_close_xrcd(struct uverbs_attr_bundle *attrs)
{}

int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,
			   enum rdma_remove_reason why,
			   struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_dereg_mr(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_dealloc_mw(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_create_comp_channel(struct uverbs_attr_bundle *attrs)
{}

static int create_cq(struct uverbs_attr_bundle *attrs,
		     struct ib_uverbs_ex_create_cq *cmd)
{}

static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
{}

static int copy_wc_to_user(struct ib_device *ib_dev, void __user *dest,
			   struct ib_wc *wc)
{}

static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_destroy_cq(struct uverbs_attr_bundle *attrs)
{}

static int create_qp(struct uverbs_attr_bundle *attrs,
		     struct ib_uverbs_ex_create_qp *cmd)
{}

static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_open_qp(struct uverbs_attr_bundle *attrs)
{}

static void copy_ah_attr_to_uverbs(struct ib_uverbs_qp_dest *uverb_attr,
				   struct rdma_ah_attr *rdma_attr)
{}

static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs)
{}

/* Remove ignored fields set in the attribute mask */
static int modify_qp_mask(enum ib_qp_type qp_type, int mask)
{}

static void copy_ah_attr_from_uverbs(struct ib_device *dev,
				     struct rdma_ah_attr *rdma_attr,
				     struct ib_uverbs_qp_dest *uverb_attr)
{}

static int modify_qp(struct uverbs_attr_bundle *attrs,
		     struct ib_uverbs_ex_modify_qp *cmd)
{}

static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_destroy_qp(struct uverbs_attr_bundle *attrs)
{}

static void *alloc_wr(size_t wr_size, __u32 num_sge)
{}

static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)
{}

static struct ib_recv_wr *
ib_uverbs_unmarshall_recv(struct uverbs_req_iter *iter, u32 wr_count,
			  u32 wqe_size, u32 sge_count)
{}

static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_destroy_ah(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs)
{}

struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
{}
EXPORT_SYMBOL();

void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res)
{}
EXPORT_SYMBOL();

void flow_resources_add(struct ib_uflow_resources *uflow_res,
			enum ib_flow_spec_type type,
			void *ibobj)
{}
EXPORT_SYMBOL();

static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,
				       struct ib_uverbs_flow_spec *kern_spec,
				       union ib_flow_spec *ib_spec,
				       struct ib_uflow_resources *uflow_res)
{}

static ssize_t spec_filter_size(const void *kern_spec_filter, u16 kern_filter_size,
				u16 ib_real_filter_sz)
{}

int ib_uverbs_kern_spec_to_ib_spec_filter(enum ib_flow_spec_type type,
					  const void *kern_spec_mask,
					  const void *kern_spec_val,
					  size_t kern_filter_sz,
					  union ib_flow_spec *ib_spec)
{}

static int kern_spec_to_ib_spec_filter(struct ib_uverbs_flow_spec *kern_spec,
				       union ib_flow_spec *ib_spec)
{}

static int kern_spec_to_ib_spec(struct uverbs_attr_bundle *attrs,
				struct ib_uverbs_flow_spec *kern_spec,
				union ib_flow_spec *ib_spec,
				struct ib_uflow_resources *uflow_res)
{}

static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_destroy_wq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_destroy_rwq_ind_table(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_destroy_flow(struct uverbs_attr_bundle *attrs)
{}

static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,
				struct ib_uverbs_create_xsrq *cmd,
				struct ib_udata *udata)
{}

static int ib_uverbs_create_srq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_create_xsrq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_destroy_srq(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs)
{}

static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
{}

/*
 * Describe the input structs for write(). Some write methods have an input
 * only struct, most have an input and output. If the struct has an output then
 * the 'response' u64 must be the first field in the request structure.
 *
 * If udata is present then both the request and response structs have a
 * trailing driver_data flex array. In this case the size of the base struct
 * cannot be changed.
 */
#define UAPI_DEF_WRITE_IO(req, resp)

#define UAPI_DEF_WRITE_I(req)

#define UAPI_DEF_WRITE_UDATA_IO(req, resp)

#define UAPI_DEF_WRITE_UDATA_I(req)

/*
 * The _EX versions are for use with WRITE_EX and allow the last struct member
 * to be specified. Buffers that do not include that member will be rejected.
 */
#define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member)

#define UAPI_DEF_WRITE_I_EX(req, req_last_member)

const struct uapi_definition uverbs_def_write_intf[] =;