c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CDDL HEADER START
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
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 *
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 *
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 *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * CDDL HEADER END
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * This is the Solaris uCMA header file. This contains Solaris specific
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * data structures and defines for the sol_ucma driver.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifndef _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikarextern "C" {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/types.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ksynch.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/ofa_solaris.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_ofs/sol_ofs_common.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#include <sys/ib/clients/of/sol_ucma/sol_rdma_user_cm.h>
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * MAX Number of PATHS supported. This is the same as
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * supported by RDMA CM library API revisit - TBD
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar *
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * MAX Number of Listens supported
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_MAX_PATHS 2
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_MAX_LISTEN 128
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/* Defines for file_evt_close_flag */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_EVT_NONE 0x00
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_EVT_PROGRESS 0x01
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_EVT_DISABLED 0x02
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * RDMA-CM Event File structure
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_t file_uobj;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kmutex_t file_mutex;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_t file_id_list;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Events data
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * pollhead - for chpoll(9e)
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * event_cv - for blocking wait at GET_EVENT
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * evt_list - List of Events
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * pending_evt_cnt - Pending Events to be pushed
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * to userland.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct pollhead *file_pollhead;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kcondvar_t file_evt_cv;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kcondvar_t file_evt_close_cv;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_t file_evt_list;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t file_pending_evt_cnt;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t file_evt_close_flag;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_file_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef enum {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar SOL_UCMA_FLUSH_QP_NONE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar SOL_UCMA_FLUSH_QP_DONE,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar SOL_UCMA_FLUSH_QP_PENDING,
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_flush_qp_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Structure for each IDs created using rdma_create_id()
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_CHAN_CONNECT_FLAG 0x01
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_t chan_uobj;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kmutex_t chan_mutex;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar genlist_entry_t *chan_list_ent;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_file_t *chan_file;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Channel id and user ID for this Channel */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t chan_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t chan_user_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Total events for this channel */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t chan_evt_cnt;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* rdma_cm_id for this channel */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct rdma_cm_id *chan_rdma_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t chan_qp_num;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *chan_qp_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Flush QP flag for this channel */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_flush_qp_t chan_flush_qp_flag;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar int chan_backlog;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint16_t chan_flags;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_chan_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct sol_ucma_mcast_s {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ofs_uobj_t mcast_uobj;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint64_t mcast_uid;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t mcast_id;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_chan_t *mcast_chan;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar struct sockaddr mcast_addr;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint32_t mcast_events;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_mcast_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * UCMA Event Structure
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct sol_ucma_event_s {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_event_resp_t event_resp;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_chan_t *event_chan;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar sol_ucma_mcast_t *event_mcast;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_event_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar/*
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar * Global structure for Solaris UCMA Driver.
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_CLNT_HDL_UNINITIALIZED 0x00
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_CLNT_HDL_INITIALIZING 0x01
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#define SOL_UCMA_CLNT_HDL_INITIALIZED 0x02
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikartypedef struct sol_ucma_s {
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kmutex_t ucma_mutex;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar kcondvar_t ucma_open_cv;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar dev_info_t *ucma_dip;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint_t ucma_num_file;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ldi_ident_t ucma_ldi_ident;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ldi_handle_t ucma_ldi_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar ddi_modhandle_t ucma_mod_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *ucma_ib_clnt_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar void *ucma_iw_clnt_hdl;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar /* Client Handle flag */
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar uint8_t ucma_clnt_hdl_flag;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar} sol_ucma_t;
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#ifdef __cplusplus
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar}
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar
c39526b769298791ff5b0b6c5e761f49aabaeb4ePramod Gunjikar#endif /* _SYS_IB_CLIENTS_OF_SOL_UCMA_SOL_UCMA_H */