linux/drivers/infiniband/core/device.c

/*
 * Copyright (c) 2004 Topspin Communications.  All rights reserved.
 * Copyright (c) 2005 Sun Microsystems, Inc. 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/module.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <net/net_namespace.h>
#include <linux/security.h>
#include <linux/notifier.h>
#include <linux/hashtable.h>
#include <rdma/rdma_netlink.h>
#include <rdma/ib_addr.h>
#include <rdma/ib_cache.h>
#include <rdma/rdma_counter.h>

#include "core_priv.h"
#include "restrack.h"

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

struct workqueue_struct *ib_comp_wq;
struct workqueue_struct *ib_comp_unbound_wq;
struct workqueue_struct *ib_wq;
EXPORT_SYMBOL_GPL();
static struct workqueue_struct *ib_unreg_wq;

/*
 * Each of the three rwsem locks (devices, clients, client_data) protects the
 * xarray of the same name. Specifically it allows the caller to assert that
 * the MARK will/will not be changing under the lock, and for devices and
 * clients, that the value in the xarray is still a valid pointer. Change of
 * the MARK is linked to the object state, so holding the lock and testing the
 * MARK also asserts that the contained object is in a certain state.
 *
 * This is used to build a two stage register/unregister flow where objects
 * can continue to be in the xarray even though they are still in progress to
 * register/unregister.
 *
 * The xarray itself provides additional locking, and restartable iteration,
 * which is also relied on.
 *
 * Locks should not be nested, with the exception of client_data, which is
 * allowed to nest under the read side of the other two locks.
 *
 * The devices_rwsem also protects the device name list, any change or
 * assignment of device name must also hold the write side to guarantee unique
 * names.
 */

/*
 * devices contains devices that have had their names assigned. The
 * devices may not be registered. Users that care about the registration
 * status need to call ib_device_try_get() on the device to ensure it is
 * registered, and keep it registered, for the required duration.
 *
 */
static DEFINE_XARRAY_FLAGS(devices, XA_FLAGS_ALLOC);
static DECLARE_RWSEM(devices_rwsem);
#define DEVICE_REGISTERED

static u32 highest_client_id;
#define CLIENT_REGISTERED
static DEFINE_XARRAY_FLAGS(clients, XA_FLAGS_ALLOC);
static DECLARE_RWSEM(clients_rwsem);

static void ib_client_put(struct ib_client *client)
{}

/*
 * If client_data is registered then the corresponding client must also still
 * be registered.
 */
#define CLIENT_DATA_REGISTERED

unsigned int rdma_dev_net_id;

/*
 * A list of net namespaces is maintained in an xarray. This is necessary
 * because we can't get the locking right using the existing net ns list. We
 * would require a init_net callback after the list is updated.
 */
static DEFINE_XARRAY_FLAGS(rdma_nets, XA_FLAGS_ALLOC);
/*
 * rwsem to protect accessing the rdma_nets xarray entries.
 */
static DECLARE_RWSEM(rdma_nets_rwsem);

bool ib_devices_shared_netns =;
module_param_named(netns_mode, ib_devices_shared_netns, bool, 0444);
MODULE_PARM_DESC();
/**
 * rdma_dev_access_netns() - Return whether an rdma device can be accessed
 *			     from a specified net namespace or not.
 * @dev:	Pointer to rdma device which needs to be checked
 * @net:	Pointer to net namesapce for which access to be checked
 *
 * When the rdma device is in shared mode, it ignores the net namespace.
 * When the rdma device is exclusive to a net namespace, rdma device net
 * namespace is checked against the specified one.
 */
bool rdma_dev_access_netns(const struct ib_device *dev, const struct net *net)
{}
EXPORT_SYMBOL();

/*
 * xarray has this behavior where it won't iterate over NULL values stored in
 * allocated arrays.  So we need our own iterator to see all values stored in
 * the array. This does the same thing as xa_for_each except that it also
 * returns NULL valued entries if the array is allocating. Simplified to only
 * work on simple xarrays.
 */
static void *xan_find_marked(struct xarray *xa, unsigned long *indexp,
			     xa_mark_t filter)
{}
#define xan_for_each_marked(xa, index, entry, filter)

/* RCU hash table mapping netdevice pointers to struct ib_port_data */
static DEFINE_SPINLOCK(ndev_hash_lock);
static DECLARE_HASHTABLE(ndev_hash, 5);

static void free_netdevs(struct ib_device *ib_dev);
static void ib_unregister_work(struct work_struct *work);
static void __ib_unregister_device(struct ib_device *device);
static int ib_security_change(struct notifier_block *nb, unsigned long event,
			      void *lsm_data);
static void ib_policy_change_task(struct work_struct *work);
static DECLARE_WORK(ib_policy_change_work, ib_policy_change_task);

static void __ibdev_printk(const char *level, const struct ib_device *ibdev,
			   struct va_format *vaf)
{}

void ibdev_printk(const char *level, const struct ib_device *ibdev,
		  const char *format, ...)
{}
EXPORT_SYMBOL();

#define define_ibdev_printk_level(func, level)

define_ibdev_printk_level(ibdev_emerg, KERN_EMERG);
define_ibdev_printk_level(ibdev_alert, KERN_ALERT);
define_ibdev_printk_level(ibdev_crit, KERN_CRIT);
define_ibdev_printk_level(ibdev_err, KERN_ERR);
define_ibdev_printk_level(ibdev_warn, KERN_WARNING);
define_ibdev_printk_level(ibdev_notice, KERN_NOTICE);
define_ibdev_printk_level(ibdev_info, KERN_INFO);

static struct notifier_block ibdev_lsm_nb =;

static int rdma_dev_change_netns(struct ib_device *device, struct net *cur_net,
				 struct net *net);

/* Pointer to the RCU head at the start of the ib_port_data array */
struct ib_port_data_rcu {};

static void ib_device_check_mandatory(struct ib_device *device)
{}

/*
 * Caller must perform ib_device_put() to return the device reference count
 * when ib_device_get_by_index() returns valid device pointer.
 */
struct ib_device *ib_device_get_by_index(const struct net *net, u32 index)
{}

/**
 * ib_device_put - Release IB device reference
 * @device: device whose reference to be released
 *
 * ib_device_put() releases reference to the IB device to allow it to be
 * unregistered and eventually free.
 */
void ib_device_put(struct ib_device *device)
{}
EXPORT_SYMBOL();

static struct ib_device *__ib_device_get_by_name(const char *name)
{}

/**
 * ib_device_get_by_name - Find an IB device by name
 * @name: The name to look for
 * @driver_id: The driver ID that must match (RDMA_DRIVER_UNKNOWN matches all)
 *
 * Find and hold an ib_device by its name. The caller must call
 * ib_device_put() on the returned pointer.
 */
struct ib_device *ib_device_get_by_name(const char *name,
					enum rdma_driver_id driver_id)
{}
EXPORT_SYMBOL();

static int rename_compat_devs(struct ib_device *device)
{}

int ib_device_rename(struct ib_device *ibdev, const char *name)
{}

int ib_device_set_dim(struct ib_device *ibdev, u8 use_dim)
{}

static int alloc_name(struct ib_device *ibdev, const char *name)
{}

static void ib_device_release(struct device *device)
{}

static int ib_device_uevent(const struct device *device,
			    struct kobj_uevent_env *env)
{}

static const void *net_namespace(const struct device *d)
{}

static struct class ib_class =;

static void rdma_init_coredev(struct ib_core_device *coredev,
			      struct ib_device *dev, struct net *net)
{}

/**
 * _ib_alloc_device - allocate an IB device struct
 * @size:size of structure to allocate
 *
 * Low-level drivers should use ib_alloc_device() to allocate &struct
 * ib_device.  @size is the size of the structure to be allocated,
 * including any private data used by the low-level driver.
 * ib_dealloc_device() must be used to free structures allocated with
 * ib_alloc_device().
 */
struct ib_device *_ib_alloc_device(size_t size)
{}
EXPORT_SYMBOL();

/**
 * ib_dealloc_device - free an IB device struct
 * @device:structure to free
 *
 * Free a structure allocated with ib_alloc_device().
 */
void ib_dealloc_device(struct ib_device *device)
{}
EXPORT_SYMBOL();

/*
 * add_client_context() and remove_client_context() must be safe against
 * parallel calls on the same device - registration/unregistration of both the
 * device and client can be occurring in parallel.
 *
 * The routines need to be a fence, any caller must not return until the add
 * or remove is fully completed.
 */
static int add_client_context(struct ib_device *device,
			      struct ib_client *client)
{}

static void remove_client_context(struct ib_device *device,
				  unsigned int client_id)
{}

static int alloc_port_data(struct ib_device *device)
{}

static int verify_immutable(const struct ib_device *dev, u32 port)
{}

static int setup_port_data(struct ib_device *device)
{}

/**
 * ib_port_immutable_read() - Read rdma port's immutable data
 * @dev: IB device
 * @port: port number whose immutable data to read. It starts with index 1 and
 *        valid upto including rdma_end_port().
 */
const struct ib_port_immutable*
ib_port_immutable_read(struct ib_device *dev, unsigned int port)
{}
EXPORT_SYMBOL();

void ib_get_device_fw_str(struct ib_device *dev, char *str)
{}
EXPORT_SYMBOL();

static void ib_policy_change_task(struct work_struct *work)
{}

static int ib_security_change(struct notifier_block *nb, unsigned long event,
			      void *lsm_data)
{}

static void compatdev_release(struct device *dev)
{}

static int add_one_compat_dev(struct ib_device *device,
			      struct rdma_dev_net *rnet)
{}

static void remove_one_compat_dev(struct ib_device *device, u32 id)
{}

static void remove_compat_devs(struct ib_device *device)
{}

static int add_compat_devs(struct ib_device *device)
{}

static void remove_all_compat_devs(void)
{}

static int add_all_compat_devs(void)
{}

int rdma_compatdev_set(u8 enable)
{}

static void rdma_dev_exit_net(struct net *net)
{}

static __net_init int rdma_dev_init_net(struct net *net)
{}

/*
 * Assign the unique string device name and the unique device index. This is
 * undone by ib_dealloc_device.
 */
static int assign_name(struct ib_device *device, const char *name)
{}

/*
 * setup_device() allocates memory and sets up data that requires calling the
 * device ops, this is the only reason these actions are not done during
 * ib_alloc_device. It is undone by ib_dealloc_device().
 */
static int setup_device(struct ib_device *device)
{}

static void disable_device(struct ib_device *device)
{}

/*
 * An enabled device is visible to all clients and to all the public facing
 * APIs that return a device pointer. This always returns with a new get, even
 * if it fails.
 */
static int enable_device_and_get(struct ib_device *device)
{}

static void prevent_dealloc_device(struct ib_device *ib_dev)
{}

/**
 * ib_register_device - Register an IB device with IB core
 * @device: Device to register
 * @name: unique string device name. This may include a '%' which will
 * 	  cause a unique index to be added to the passed device name.
 * @dma_device: pointer to a DMA-capable device. If %NULL, then the IB
 *	        device will be used. In this case the caller should fully
 *		setup the ibdev for DMA. This usually means using dma_virt_ops.
 *
 * Low-level drivers use ib_register_device() to register their
 * devices with the IB core.  All registered clients will receive a
 * callback for each device that is added. @device must be allocated
 * with ib_alloc_device().
 *
 * If the driver uses ops.dealloc_driver and calls any ib_unregister_device()
 * asynchronously then the device pointer may become freed as soon as this
 * function returns.
 */
int ib_register_device(struct ib_device *device, const char *name,
		       struct device *dma_device)
{}
EXPORT_SYMBOL();

/* Callers must hold a get on the device. */
static void __ib_unregister_device(struct ib_device *ib_dev)
{}

/**
 * ib_unregister_device - Unregister an IB device
 * @ib_dev: The device to unregister
 *
 * Unregister an IB device.  All clients will receive a remove callback.
 *
 * Callers should call this routine only once, and protect against races with
 * registration. Typically it should only be called as part of a remove
 * callback in an implementation of driver core's struct device_driver and
 * related.
 *
 * If ops.dealloc_driver is used then ib_dev will be freed upon return from
 * this function.
 */
void ib_unregister_device(struct ib_device *ib_dev)
{}
EXPORT_SYMBOL();

/**
 * ib_unregister_device_and_put - Unregister a device while holding a 'get'
 * @ib_dev: The device to unregister
 *
 * This is the same as ib_unregister_device(), except it includes an internal
 * ib_device_put() that should match a 'get' obtained by the caller.
 *
 * It is safe to call this routine concurrently from multiple threads while
 * holding the 'get'. When the function returns the device is fully
 * unregistered.
 *
 * Drivers using this flow MUST use the driver_unregister callback to clean up
 * their resources associated with the device and dealloc it.
 */
void ib_unregister_device_and_put(struct ib_device *ib_dev)
{}
EXPORT_SYMBOL();

/**
 * ib_unregister_driver - Unregister all IB devices for a driver
 * @driver_id: The driver to unregister
 *
 * This implements a fence for device unregistration. It only returns once all
 * devices associated with the driver_id have fully completed their
 * unregistration and returned from ib_unregister_device*().
 *
 * If device's are not yet unregistered it goes ahead and starts unregistering
 * them.
 *
 * This does not block creation of new devices with the given driver_id, that
 * is the responsibility of the caller.
 */
void ib_unregister_driver(enum rdma_driver_id driver_id)
{}
EXPORT_SYMBOL();

static void ib_unregister_work(struct work_struct *work)
{}

/**
 * ib_unregister_device_queued - Unregister a device using a work queue
 * @ib_dev: The device to unregister
 *
 * This schedules an asynchronous unregistration using a WQ for the device. A
 * driver should use this to avoid holding locks while doing unregistration,
 * such as holding the RTNL lock.
 *
 * Drivers using this API must use ib_unregister_driver before module unload
 * to ensure that all scheduled unregistrations have completed.
 */
void ib_unregister_device_queued(struct ib_device *ib_dev)
{}
EXPORT_SYMBOL();

/*
 * The caller must pass in a device that has the kref held and the refcount
 * released. If the device is in cur_net and still registered then it is moved
 * into net.
 */
static int rdma_dev_change_netns(struct ib_device *device, struct net *cur_net,
				 struct net *net)
{}

int ib_device_set_netns_put(struct sk_buff *skb,
			    struct ib_device *dev, u32 ns_fd)
{}

static struct pernet_operations rdma_dev_net_ops =;

static int assign_client_id(struct ib_client *client)
{}

static void remove_client_id(struct ib_client *client)
{}

/**
 * ib_register_client - Register an IB client
 * @client:Client to register
 *
 * Upper level users of the IB drivers can use ib_register_client() to
 * register callbacks for IB device addition and removal.  When an IB
 * device is added, each registered client's add method will be called
 * (in the order the clients were registered), and when a device is
 * removed, each client's remove method will be called (in the reverse
 * order that clients were registered).  In addition, when
 * ib_register_client() is called, the client will receive an add
 * callback for all devices already registered.
 */
int ib_register_client(struct ib_client *client)
{}
EXPORT_SYMBOL();

/**
 * ib_unregister_client - Unregister an IB client
 * @client:Client to unregister
 *
 * Upper level users use ib_unregister_client() to remove their client
 * registration.  When ib_unregister_client() is called, the client
 * will receive a remove callback for each IB device still registered.
 *
 * This is a full fence, once it returns no client callbacks will be called,
 * or are running in another thread.
 */
void ib_unregister_client(struct ib_client *client)
{}
EXPORT_SYMBOL();

static int __ib_get_global_client_nl_info(const char *client_name,
					  struct ib_client_nl_info *res)
{}

static int __ib_get_client_nl_info(struct ib_device *ibdev,
				   const char *client_name,
				   struct ib_client_nl_info *res)
{}

/**
 * ib_get_client_nl_info - Fetch the nl_info from a client
 * @ibdev: IB device
 * @client_name: Name of the client
 * @res: Result of the query
 */
int ib_get_client_nl_info(struct ib_device *ibdev, const char *client_name,
			  struct ib_client_nl_info *res)
{}

/**
 * ib_set_client_data - Set IB client context
 * @device:Device to set context for
 * @client:Client to set context for
 * @data:Context to set
 *
 * ib_set_client_data() sets client context data that can be retrieved with
 * ib_get_client_data(). This can only be called while the client is
 * registered to the device, once the ib_client remove() callback returns this
 * cannot be called.
 */
void ib_set_client_data(struct ib_device *device, struct ib_client *client,
			void *data)
{}
EXPORT_SYMBOL();

/**
 * ib_register_event_handler - Register an IB event handler
 * @event_handler:Handler to register
 *
 * ib_register_event_handler() registers an event handler that will be
 * called back when asynchronous IB events occur (as defined in
 * chapter 11 of the InfiniBand Architecture Specification). This
 * callback occurs in workqueue context.
 */
void ib_register_event_handler(struct ib_event_handler *event_handler)
{}
EXPORT_SYMBOL();

/**
 * ib_unregister_event_handler - Unregister an event handler
 * @event_handler:Handler to unregister
 *
 * Unregister an event handler registered with
 * ib_register_event_handler().
 */
void ib_unregister_event_handler(struct ib_event_handler *event_handler)
{}
EXPORT_SYMBOL();

void ib_dispatch_event_clients(struct ib_event *event)
{}

static int iw_query_port(struct ib_device *device,
			   u32 port_num,
			   struct ib_port_attr *port_attr)
{}

static int __ib_query_port(struct ib_device *device,
			   u32 port_num,
			   struct ib_port_attr *port_attr)
{}

/**
 * ib_query_port - Query IB port attributes
 * @device:Device to query
 * @port_num:Port number to query
 * @port_attr:Port attributes
 *
 * ib_query_port() returns the attributes of a port through the
 * @port_attr pointer.
 */
int ib_query_port(struct ib_device *device,
		  u32 port_num,
		  struct ib_port_attr *port_attr)
{}
EXPORT_SYMBOL();

static void add_ndev_hash(struct ib_port_data *pdata)
{}

/**
 * ib_device_set_netdev - Associate the ib_dev with an underlying net_device
 * @ib_dev: Device to modify
 * @ndev: net_device to affiliate, may be NULL
 * @port: IB port the net_device is connected to
 *
 * Drivers should use this to link the ib_device to a netdev so the netdev
 * shows up in interfaces like ib_enum_roce_netdev. Only one netdev may be
 * affiliated with any port.
 *
 * The caller must ensure that the given ndev is not unregistered or
 * unregistering, and that either the ib_device is unregistered or
 * ib_device_set_netdev() is called with NULL when the ndev sends a
 * NETDEV_UNREGISTER event.
 */
int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
			 u32 port)
{}
EXPORT_SYMBOL();

static void free_netdevs(struct ib_device *ib_dev)
{}

struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,
					u32 port)
{}

/**
 * ib_device_get_by_netdev - Find an IB device associated with a netdev
 * @ndev: netdev to locate
 * @driver_id: The driver ID that must match (RDMA_DRIVER_UNKNOWN matches all)
 *
 * Find and hold an ib_device that is associated with a netdev via
 * ib_device_set_netdev(). The caller must call ib_device_put() on the
 * returned pointer.
 */
struct ib_device *ib_device_get_by_netdev(struct net_device *ndev,
					  enum rdma_driver_id driver_id)
{}
EXPORT_SYMBOL();

/**
 * ib_enum_roce_netdev - enumerate all RoCE ports
 * @ib_dev : IB device we want to query
 * @filter: Should we call the callback?
 * @filter_cookie: Cookie passed to filter
 * @cb: Callback to call for each found RoCE ports
 * @cookie: Cookie passed back to the callback
 *
 * Enumerates all of the physical RoCE ports of ib_dev
 * which are related to netdevice and calls callback() on each
 * device for which filter() function returns non zero.
 */
void ib_enum_roce_netdev(struct ib_device *ib_dev,
			 roce_netdev_filter filter,
			 void *filter_cookie,
			 roce_netdev_callback cb,
			 void *cookie)
{}

/**
 * ib_enum_all_roce_netdevs - enumerate all RoCE devices
 * @filter: Should we call the callback?
 * @filter_cookie: Cookie passed to filter
 * @cb: Callback to call for each found RoCE ports
 * @cookie: Cookie passed back to the callback
 *
 * Enumerates all RoCE devices' physical ports which are related
 * to netdevices and calls callback() on each device for which
 * filter() function returns non zero.
 */
void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
			      void *filter_cookie,
			      roce_netdev_callback cb,
			      void *cookie)
{}

/*
 * ib_enum_all_devs - enumerate all ib_devices
 * @cb: Callback to call for each found ib_device
 *
 * Enumerates all ib_devices and calls callback() on each device.
 */
int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb,
		     struct netlink_callback *cb)
{}

/**
 * ib_query_pkey - Get P_Key table entry
 * @device:Device to query
 * @port_num:Port number to query
 * @index:P_Key table index to query
 * @pkey:Returned P_Key
 *
 * ib_query_pkey() fetches the specified P_Key table entry.
 */
int ib_query_pkey(struct ib_device *device,
		  u32 port_num, u16 index, u16 *pkey)
{}
EXPORT_SYMBOL();

/**
 * ib_modify_device - Change IB device attributes
 * @device:Device to modify
 * @device_modify_mask:Mask of attributes to change
 * @device_modify:New attribute values
 *
 * ib_modify_device() changes a device's attributes as specified by
 * the @device_modify_mask and @device_modify structure.
 */
int ib_modify_device(struct ib_device *device,
		     int device_modify_mask,
		     struct ib_device_modify *device_modify)
{}
EXPORT_SYMBOL();

/**
 * ib_modify_port - Modifies the attributes for the specified port.
 * @device: The device to modify.
 * @port_num: The number of the port to modify.
 * @port_modify_mask: Mask used to specify which attributes of the port
 *   to change.
 * @port_modify: New attribute values for the port.
 *
 * ib_modify_port() changes a port's attributes as specified by the
 * @port_modify_mask and @port_modify structure.
 */
int ib_modify_port(struct ib_device *device,
		   u32 port_num, int port_modify_mask,
		   struct ib_port_modify *port_modify)
{}
EXPORT_SYMBOL();

/**
 * ib_find_gid - Returns the port number and GID table index where
 *   a specified GID value occurs. Its searches only for IB link layer.
 * @device: The device to query.
 * @gid: The GID value to search for.
 * @port_num: The port number of the device where the GID value was found.
 * @index: The index into the GID table where the GID was found.  This
 *   parameter may be NULL.
 */
int ib_find_gid(struct ib_device *device, union ib_gid *gid,
		u32 *port_num, u16 *index)
{}
EXPORT_SYMBOL();

/**
 * ib_find_pkey - Returns the PKey table index where a specified
 *   PKey value occurs.
 * @device: The device to query.
 * @port_num: The port number of the device to search for the PKey.
 * @pkey: The PKey value to search for.
 * @index: The index into the PKey table where the PKey was found.
 */
int ib_find_pkey(struct ib_device *device,
		 u32 port_num, u16 pkey, u16 *index)
{}
EXPORT_SYMBOL();

/**
 * ib_get_net_dev_by_params() - Return the appropriate net_dev
 * for a received CM request
 * @dev:	An RDMA device on which the request has been received.
 * @port:	Port number on the RDMA device.
 * @pkey:	The Pkey the request came on.
 * @gid:	A GID that the net_dev uses to communicate.
 * @addr:	Contains the IP address that the request specified as its
 *		destination.
 *
 */
struct net_device *ib_get_net_dev_by_params(struct ib_device *dev,
					    u32 port,
					    u16 pkey,
					    const union ib_gid *gid,
					    const struct sockaddr *addr)
{}
EXPORT_SYMBOL();

void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
{}
EXPORT_SYMBOL();

int ib_add_sub_device(struct ib_device *parent,
		      enum rdma_nl_dev_type type,
		      const char *name)
{}
EXPORT_SYMBOL();

int ib_del_sub_device_and_put(struct ib_device *sub)
{}
EXPORT_SYMBOL();

#ifdef CONFIG_INFINIBAND_VIRT_DMA
int ib_dma_virt_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents)
{}
EXPORT_SYMBOL();
#endif /* CONFIG_INFINIBAND_VIRT_DMA */

static const struct rdma_nl_cbs ibnl_ls_cb_table[RDMA_NL_LS_NUM_OPS] =;

static int __init ib_core_init(void)
{}

static void __exit ib_core_cleanup(void)
{}

MODULE_ALIAS_RDMA_NETLINK();

/* ib core relies on netdev stack to first register net_ns_type_operations
 * ns kobject type before ib_core initialization.
 */
fs_initcall(ib_core_init);
module_exit(ib_core_cleanup);