rdsv3_ddi.c revision c0dd49bdd68c0d758a67d56f07826f3b45cfc664
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/socketvar.h>
extern int rdsv3_init(void);
extern void rdsv3_exit(void);
extern void rdsv3_cong_init(void);
extern void rdsv3_cong_exit(void);
extern void rdsv3_trans_init(void);
extern void rdsv3_trans_exit(void);
extern int rdsv3_sock_init(void);
extern void rdsv3_sock_exit(void);
/* global */
extern kmutex_t rdsv3_rdma_listen_id_lock;
extern struct rdma_cm_id *rdsv3_rdma_listen_id;
extern kmutex_t rdsv3_sock_lock;
extern list_t rdsv3_sock_list;
extern void rdsv3_bind_tree_init();
extern void rdsv3_bind_tree_exit();
int
{
if (rdsv3_alloc_cache == NULL) {
RDSV3_DPRINTF1("rdsv3_alloc_cache",
"kmem_cache_create(rdsv3_alloc_cache) failed");
return (-1);
}
return (0);
}
void
{
}
static int
{
int ret;
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
if (rdsv3_dev_info != NULL) {
" not supported (rdsv3_dev_info: 0x%p)", rdsv3_dev_info);
return (DDI_FAILURE);
}
ret = rdsv3_init();
if (ret) {
return (DDI_FAILURE);
}
ret = rdsv3_sock_init();
if (ret) {
rdsv3_exit();
return (DDI_FAILURE);
}
if (ret != DDI_SUCCESS) {
rdsv3_exit();
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
rdsv3_exit();
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
int ret = DDI_FAILURE;
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
if (rdsv3_dev_info != NULL) {
*result = (void *)rdsv3_dev_info;
ret = DDI_SUCCESS;
}
break;
case DDI_INFO_DEVT2INSTANCE:
ret = DDI_SUCCESS;
break;
default:
break;
}
return (ret);
}
/* Driver entry points */
static struct cb_ops rdsv3_cb_ops = {
nulldev, /* open */
nulldev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
ddi_prop_op, /* prop_op */
NULL, /* stream */
D_MP, /* cb_flag */
CB_REV, /* rev */
nodev, /* int (*cb_aread)() */
nodev, /* int (*cb_awrite)() */
};
/* Device options */
DEVO_REV, /* devo_rev, */
0, /* refcnt */
rdsv3_info, /* info */
nulldev, /* identify */
nulldev, /* probe */
rdsv3_attach, /* attach */
rdsv3_detach, /* detach */
nodev, /* reset */
&rdsv3_cb_ops, /* driver ops - devctl interfaces */
NULL, /* bus operations */
NULL, /* power */
ddi_quiesce_not_needed /* quiesce */
};
/*
* Module linkage information.
*/
#define RDSV3_DEVDESC "RDSv3 IB transport driver"
static struct modldrv rdsv3_modldrv = {
&mod_driverops, /* Driver module */
RDSV3_DEVDESC, /* Driver name and version */
&rdsv3_ops, /* Driver ops */
};
static struct modlinkage rdsv3_modlinkage = {
(void *)&rdsv3_modldrv,
};
int
_init(void)
{
int ret;
if (ibt_hw_is_present() == 0) {
return (ENODEV);
}
/* Initialize logging */
if (ret != 0) {
/*
* Could not load module
*/
return (ret);
}
return (0);
}
int
_fini()
{
int ret;
/*
* Remove module
*/
return (ret);
}
/* Stop logging */
return (0);
}
int
{
}