c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CDDL HEADER START
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * The contents of this file are subject to the terms of the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Common Development and Distribution License (the "License").
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * You may not use this file except in compliance with the License.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * or http://www.opensolaris.org/os/licensing.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * See the License for the specific language governing permissions
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * and limitations under the License.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * When distributing Covered Code, include this CDDL HEADER in each
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * If applicable, add the following below this CDDL HEADER, with the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * fields enclosed by brackets "[]" replaced with your own identifying
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * information: Portions Copyright [yyyy] [name of copyright owner]
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CDDL HEADER END
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifndef _SYS_IB_CLIENTS_OF_SOL_UVERBS_SOL_UVERBS_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define _SYS_IB_CLIENTS_OF_SOL_UVERBS_SOL_UVERBS_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * DESC: Solaris OFED User Verbs Kernel Agent header file.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/rdma/ib_user_verbs.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_uverbs/sol_uverbs_hca.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_ofs/sol_ofs_common.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_uverbs/sol_uverbs2ucma.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Definitions
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Kernel User Verbs Events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User verbs kernel events (asynchronous and completion) representation.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * IBT events are mapped back to OFA events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Module Context.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * There is a single module context which maintains the list
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * of HCA's retrieved from IBT. A user process indicates the
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * target HCA open via the uverbs unique minor device number
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * associated with the HCA.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Underlying IBT HCA Info
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Support user asyncrhonous and completion event delivery via
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * user event filesystem.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User Event File.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Used for delivery of asynchronous and synchronous events to the user.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * An asynchronous event file is created during the allocation of
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * a user verbs consumer context, a completion event file is created
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * when the user verbs consumer creates a completion channel.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Type of user context -
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User Context.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * A user context is created when a user process opens a specific minor
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * device. The context maintains a list of resources created by this
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * user that allows the resources to be cleaned up on user close.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_uverbs_hca_t *hca; /* short cut to specific hca */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * List of user resource objects created by this context. The
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * objects themselves live in the associated object table, and
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * the code should use the table to access and use resources.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Any objects that remain in these list will be destroyed at
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * user close to free the associated resources.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * The user context "lock" should be held when invoking
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * routines to manipulate the lists.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Event filesystem interfaces for IB asyncrhonous events
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * and completion events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User context can be created for :
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 1. All Verbs API
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 2. For getting a file for async events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * 3. For getting a file for completion events.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * For (1) - pointers to (2) & (3) will be updated. For (2) and (3)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * pointer to (1) will be maintained.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User PD objects created at PD allocation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per user ctx list entry */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User MR objects created at MR registration
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per user ctx list entry */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User CQ objects created at CQ allocation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per user ctx list entry */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User Shared Receive CQ objects created at SRQ allocation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per user ctx list entry */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User address handle objects created at AH allocation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per user ctx list entry */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User QP objects created at QP allocation
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *list_entry; /* per uctx list */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_uctxt_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_upd_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_uah_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_umr_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_ucq_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_usrq_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_uqp_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern sol_ofs_uobj_table_t uverbs_ufile_uo_tbl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * The following structure is used currently to pass data back to
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * libmthca on user allocation context. This should be passed opaquely
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * to maintain a true hal, we'll look for a generic way to get this information
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * and deliver it opaquely post EA-1.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_dummy_command(uverbs_uctxt_uobj_t *uctxt, char *buf,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_get_context(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_alloc_pd(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_dealloc_pd(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_create_ah(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_destroy_ah(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_query_device(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_query_port(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_query_gid(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_query_pkey(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_reg_mr(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_dereg_mr(uverbs_uctxt_uobj_t *uctxt, char *buf, int in_len,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_create_comp_channel(uverbs_uctxt_uobj_t *uctxt, char *buf,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarsol_uverbs_ibt_to_of_device_cap_flags(ibt_hca_flags_t flags,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarsol_uverbs_ibt_to_of_page_sz(ibt_page_sizes_t page_szs);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint sol_uverbs_ibt_to_kernel_status(ibt_status_t status);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikaruint32_t sol_uverbs_qpnum2uqpid(uint32_t qp_num);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint uverbs_upd_free(uverbs_upd_uobj_t *, uverbs_uctxt_uobj_t *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint uverbs_uqp_free(uverbs_uqp_uobj_t *, uverbs_uctxt_uobj_t *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint uverbs_usrq_free(uverbs_usrq_uobj_t *, uverbs_uctxt_uobj_t *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarint uverbs_ucq_free(uverbs_ucq_uobj_t *, uverbs_uctxt_uobj_t *);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * The following helpers simply provide easy access for acquiring and locking
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * User Objects.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_uctxt_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_uctxt_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_upd_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_upd_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_umr_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_umr_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_ucq_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_ucq_uo_tbl, (int)id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_usrq_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_usrq_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_uah_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_uah_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_read(&uverbs_uqp_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_get_write(&uverbs_uqp_uo_tbl, id);
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif /* _SYS_IB_CLIENTS_OF_SOL_UVERBS_SOL_UVERBS_H */