// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright(c) 2016 - 2018 Intel Corporation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/dma-mapping.h> #include "vt.h" #include "cq.h" #include "trace.h" #define RVT_UVERBS_ABI_VERSION … MODULE_LICENSE(…) …; MODULE_DESCRIPTION(…) …; static int __init rvt_init(void) { … } module_init(…) …; static void __exit rvt_cleanup(void) { … } module_exit(rvt_cleanup); /** * rvt_alloc_device - allocate rdi * @size: how big of a structure to allocate * @nports: number of ports to allocate array slots for * * Use IB core device alloc to allocate space for the rdi which is assumed to be * inside of the ib_device. Any extra space that drivers require should be * included in size. * * We also allocate a port array based on the number of ports. * * Return: pointer to allocated rdi */ struct rvt_dev_info *rvt_alloc_device(size_t size, int nports) { … } EXPORT_SYMBOL(…); /** * rvt_dealloc_device - deallocate rdi * @rdi: structure to free * * Free a structure allocated with rvt_alloc_device() */ void rvt_dealloc_device(struct rvt_dev_info *rdi) { … } EXPORT_SYMBOL(…); static int rvt_query_device(struct ib_device *ibdev, struct ib_device_attr *props, struct ib_udata *uhw) { … } static int rvt_get_numa_node(struct ib_device *ibdev) { … } static int rvt_modify_device(struct ib_device *device, int device_modify_mask, struct ib_device_modify *device_modify) { … } /** * rvt_query_port - Passes the query port call to the driver * @ibdev: Verbs IB dev * @port_num: port number, 1 based from ib core * @props: structure to hold returned properties * * Return: 0 on success */ static int rvt_query_port(struct ib_device *ibdev, u32 port_num, struct ib_port_attr *props) { … } /** * rvt_modify_port - modify port * @ibdev: Verbs IB dev * @port_num: Port number, 1 based from ib core * @port_modify_mask: How to change the port * @props: Structure to fill in * * Return: 0 on success */ static int rvt_modify_port(struct ib_device *ibdev, u32 port_num, int port_modify_mask, struct ib_port_modify *props) { … } /** * rvt_query_pkey - Return a pkey from the table at a given index * @ibdev: Verbs IB dev * @port_num: Port number, 1 based from ib core * @index: Index into pkey table * @pkey: returned pkey from the port pkey table * * Return: 0 on failure pkey otherwise */ static int rvt_query_pkey(struct ib_device *ibdev, u32 port_num, u16 index, u16 *pkey) { … } /** * rvt_query_gid - Return a gid from the table * @ibdev: Verbs IB dev * @port_num: Port number, 1 based from ib core * @guid_index: Index in table * @gid: Gid to return * * Return: 0 on success */ static int rvt_query_gid(struct ib_device *ibdev, u32 port_num, int guid_index, union ib_gid *gid) { … } /** * rvt_alloc_ucontext - Allocate a user context * @uctx: Verbs context * @udata: User data allocated */ static int rvt_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) { … } /** * rvt_dealloc_ucontext - Free a user context * @context: Unused */ static void rvt_dealloc_ucontext(struct ib_ucontext *context) { … } static int rvt_get_port_immutable(struct ib_device *ibdev, u32 port_num, struct ib_port_immutable *immutable) { … } enum { … }; static const struct ib_device_ops rvt_dev_ops = …; static noinline int check_support(struct rvt_dev_info *rdi, int verb) { … } /** * rvt_register_device - register a driver * @rdi: main dev structure for all of rdmavt operations * * It is up to drivers to allocate the rdi and fill in the appropriate * information. * * Return: 0 on success otherwise an errno. */ int rvt_register_device(struct rvt_dev_info *rdi) { … } EXPORT_SYMBOL(…); /** * rvt_unregister_device - remove a driver * @rdi: rvt dev struct */ void rvt_unregister_device(struct rvt_dev_info *rdi) { … } EXPORT_SYMBOL(…); /** * rvt_init_port - init internal data for driver port * @rdi: rvt_dev_info struct * @port: rvt port * @port_index: 0 based index of ports, different from IB core port num * @pkey_table: pkey_table for @port * * Keep track of a list of ports. No need to have a detach port. * They persist until the driver goes away. * * Return: always 0 */ int rvt_init_port(struct rvt_dev_info *rdi, struct rvt_ibport *port, int port_index, u16 *pkey_table) { … } EXPORT_SYMBOL(…);