linux/drivers/infiniband/core/nldev.c

/*
 * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. 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.
 * 3. Neither the names of the copyright holders nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <linux/module.h>
#include <linux/pid.h>
#include <linux/pid_namespace.h>
#include <linux/mutex.h>
#include <net/netlink.h>
#include <rdma/rdma_cm.h>
#include <rdma/rdma_netlink.h>

#include "core_priv.h"
#include "cma_priv.h"
#include "restrack.h"
#include "uverbs.h"

/*
 * This determines whether a non-privileged user is allowed to specify a
 * controlled QKEY or not, when true non-privileged user is allowed to specify
 * a controlled QKEY.
 */
static bool privileged_qkey;

res_fill_func_t;

/*
 * Sort array elements by the netlink attribute name
 */
static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] =;

static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
				      enum rdma_nldev_print_type print_type)
{}

static int _rdma_nl_put_driver_u32(struct sk_buff *msg, const char *name,
				   enum rdma_nldev_print_type print_type,
				   u32 value)
{}

static int _rdma_nl_put_driver_u64(struct sk_buff *msg, const char *name,
				   enum rdma_nldev_print_type print_type,
				   u64 value)
{}

int rdma_nl_put_driver_string(struct sk_buff *msg, const char *name,
			      const char *str)
{}
EXPORT_SYMBOL();

int rdma_nl_put_driver_u32(struct sk_buff *msg, const char *name, u32 value)
{}
EXPORT_SYMBOL();

int rdma_nl_put_driver_u32_hex(struct sk_buff *msg, const char *name,
			       u32 value)
{}
EXPORT_SYMBOL();

int rdma_nl_put_driver_u64(struct sk_buff *msg, const char *name, u64 value)
{}
EXPORT_SYMBOL();

int rdma_nl_put_driver_u64_hex(struct sk_buff *msg, const char *name, u64 value)
{}
EXPORT_SYMBOL();

bool rdma_nl_get_privileged_qkey(void)
{}
EXPORT_SYMBOL();

static int fill_nldev_handle(struct sk_buff *msg, struct ib_device *device)
{}

static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
{}

static int fill_port_info(struct sk_buff *msg,
			  struct ib_device *device, u32 port,
			  const struct net *net)
{}

static int fill_res_info_entry(struct sk_buff *msg,
			       const char *name, u64 curr)
{}

static int fill_res_info(struct sk_buff *msg, struct ib_device *device,
			 bool show_details)
{}

static int fill_res_name_pid(struct sk_buff *msg,
			     struct rdma_restrack_entry *res)
{}

static int fill_res_qp_entry_query(struct sk_buff *msg,
				   struct rdma_restrack_entry *res,
				   struct ib_device *dev,
				   struct ib_qp *qp)
{}

static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,
			     struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_qp_raw_entry(struct sk_buff *msg, bool has_cap_net_admin,
				 struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_cm_id_entry(struct sk_buff *msg, bool has_cap_net_admin,
				struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_cq_entry(struct sk_buff *msg, bool has_cap_net_admin,
			     struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_cq_raw_entry(struct sk_buff *msg, bool has_cap_net_admin,
				 struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,
			     struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_mr_raw_entry(struct sk_buff *msg, bool has_cap_net_admin,
				 struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_pd_entry(struct sk_buff *msg, bool has_cap_net_admin,
			     struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_ctx_entry(struct sk_buff *msg, bool has_cap_net_admin,
			      struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_range_qp_entry(struct sk_buff *msg, uint32_t min_range,
				   uint32_t max_range)
{}

static int fill_res_srq_qps(struct sk_buff *msg, struct ib_srq *srq)
{}

static int fill_res_srq_entry(struct sk_buff *msg, bool has_cap_net_admin,
			      struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_res_srq_raw_entry(struct sk_buff *msg, bool has_cap_net_admin,
				 struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_stat_counter_mode(struct sk_buff *msg,
				  struct rdma_counter *counter)
{}

static int fill_stat_counter_qp_entry(struct sk_buff *msg, u32 qpn)
{}

static int fill_stat_counter_qps(struct sk_buff *msg,
				 struct rdma_counter *counter)
{}

int rdma_nl_stat_hwcounter_entry(struct sk_buff *msg, const char *name,
				 u64 value)
{}
EXPORT_SYMBOL();

static int fill_stat_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,
			      struct rdma_restrack_entry *res, uint32_t port)
{}

static int fill_stat_counter_hwcounters(struct sk_buff *msg,
					struct rdma_counter *counter)
{}

static int fill_res_counter_entry(struct sk_buff *msg, bool has_cap_net_admin,
				  struct rdma_restrack_entry *res,
				  uint32_t port)
{}

static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			  struct netlink_ext_ack *extack)
{}

static int nldev_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			  struct netlink_ext_ack *extack)
{}

static int _nldev_get_dumpit(struct ib_device *device,
			     struct sk_buff *skb,
			     struct netlink_callback *cb,
			     unsigned int idx)
{}

static int nldev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
{}

static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			       struct netlink_ext_ack *extack)
{}

static int nldev_port_get_dumpit(struct sk_buff *skb,
				 struct netlink_callback *cb)
{}

static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			      struct netlink_ext_ack *extack)
{}

static int _nldev_res_get_dumpit(struct ib_device *device,
				 struct sk_buff *skb,
				 struct netlink_callback *cb,
				 unsigned int idx)
{}

static int nldev_res_get_dumpit(struct sk_buff *skb,
				struct netlink_callback *cb)
{}

struct nldev_fill_res_entry {};

enum nldev_res_flags {};

static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] =;

static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			       struct netlink_ext_ack *extack,
			       enum rdma_restrack_type res_type,
			       res_fill_func_t fill_func)
{}

static int res_get_common_dumpit(struct sk_buff *skb,
				 struct netlink_callback *cb,
				 enum rdma_restrack_type res_type,
				 res_fill_func_t fill_func)
{}

#define RES_GET_FUNCS(name, type)

RES_GET_FUNCS(qp, RDMA_RESTRACK_QP);
RES_GET_FUNCS(qp_raw, RDMA_RESTRACK_QP);
RES_GET_FUNCS(cm_id, RDMA_RESTRACK_CM_ID);
RES_GET_FUNCS(cq, RDMA_RESTRACK_CQ);
RES_GET_FUNCS(cq_raw, RDMA_RESTRACK_CQ);
RES_GET_FUNCS(pd, RDMA_RESTRACK_PD);
RES_GET_FUNCS(mr, RDMA_RESTRACK_MR);
RES_GET_FUNCS(mr_raw, RDMA_RESTRACK_MR);
RES_GET_FUNCS(counter, RDMA_RESTRACK_COUNTER);
RES_GET_FUNCS(ctx, RDMA_RESTRACK_CTX);
RES_GET_FUNCS(srq, RDMA_RESTRACK_SRQ);
RES_GET_FUNCS(srq_raw, RDMA_RESTRACK_SRQ);

static LIST_HEAD(link_ops);
static DECLARE_RWSEM(link_ops_rwsem);

static const struct rdma_link_ops *link_ops_get(const char *type)
{}

void rdma_link_register(struct rdma_link_ops *ops)
{}
EXPORT_SYMBOL();

void rdma_link_unregister(struct rdma_link_ops *ops)
{}
EXPORT_SYMBOL();

static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
			  struct netlink_ext_ack *extack)
{}

static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh,
			  struct netlink_ext_ack *extack)
{}

static int nldev_get_chardev(struct sk_buff *skb, struct nlmsghdr *nlh,
			     struct netlink_ext_ack *extack)
{}

static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			      struct netlink_ext_ack *extack)
{}

static int nldev_set_sys_set_netns_doit(struct nlattr *tb[])
{}

static int nldev_set_sys_set_pqkey_doit(struct nlattr *tb[])
{}

static int nldev_set_sys_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
				  struct netlink_ext_ack *extack)
{}


static int nldev_stat_set_mode_doit(struct sk_buff *msg,
				    struct netlink_ext_ack *extack,
				    struct nlattr *tb[],
				    struct ib_device *device, u32 port)
{}

static int nldev_stat_set_counter_dynamic_doit(struct nlattr *tb[],
					       struct ib_device *device,
					       u32 port)
{}

static int nldev_stat_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			       struct netlink_ext_ack *extack)
{}

static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			       struct netlink_ext_ack *extack)
{}

static int stat_get_doit_default_counter(struct sk_buff *skb,
					 struct nlmsghdr *nlh,
					 struct netlink_ext_ack *extack,
					 struct nlattr *tb[])
{}

static int stat_get_doit_qp(struct sk_buff *skb, struct nlmsghdr *nlh,
			    struct netlink_ext_ack *extack, struct nlattr *tb[])

{}

static int nldev_stat_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
			       struct netlink_ext_ack *extack)
{}

static int nldev_stat_get_dumpit(struct sk_buff *skb,
				 struct netlink_callback *cb)
{}

static int nldev_stat_get_counter_status_doit(struct sk_buff *skb,
					      struct nlmsghdr *nlh,
					      struct netlink_ext_ack *extack)
{}

static int nldev_newdev(struct sk_buff *skb, struct nlmsghdr *nlh,
			struct netlink_ext_ack *extack)
{}

static int nldev_deldev(struct sk_buff *skb, struct nlmsghdr *nlh,
			struct netlink_ext_ack *extack)
{}

static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] =;

void __init nldev_init(void)
{}

void nldev_exit(void)
{}

MODULE_ALIAS_RDMA_NETLINK();