rdsib.c revision 276df1e91366009d02eabe9e2c9a6f0b9dab2bba
/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Global Configuration Variables
* As defined in RDS proposal
*/
extern int rdsib_open_ib();
extern void rdsib_close_ib();
};
/* global */
#ifdef DEBUG
#else
#endif
#define RDS_NUM_TASKQ_THREADS 4
void **result);
/* Driver entry points */
static struct cb_ops rdsib_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 */
rdsib_info, /* info */
nulldev, /* identify */
nulldev, /* probe */
rdsib_attach, /* attach */
rdsib_detach, /* detach */
nodev, /* reset */
&rdsib_cb_ops, /* driver ops - devctl interfaces */
NULL, /* bus operations */
NULL, /* power */
ddi_quiesce_not_needed, /* devo_quiesce */
};
/*
* Module linkage information.
*/
#define RDS_DEVDESC "RDS IB driver"
static struct modldrv rdsib_modldrv = {
&mod_driverops, /* Driver module */
RDS_DEVDESC, /* Driver name and version */
&rdsib_ops, /* Driver ops */
};
static struct modlinkage rdsib_modlinkage = {
(void *)&rdsib_modldrv,
};
/* Called from _init */
int
{
/* RDS supports only one instance */
/* Initialize logging */
return (0);
}
/* Called from _fini */
void
{
/* Stop logging */
}
int
_init(void)
{
int ret;
if (ibt_hw_is_present() == 0) {
return (ENODEV);
}
ret = rdsib_init();
if (ret != 0) {
return (ret);
}
if (ret != 0) {
/*
* Could not load module
*/
rdsib_fini();
return (ret);
}
return (0);
}
int
_fini()
{
int ret;
/*
* Remove module
*/
return (ret);
}
rdsib_fini();
return (0);
}
int
{
}
static int
{
int ret;
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
if (rdsib_dev_info != NULL) {
" not supported (rds_dev_info: 0x%p)", rdsib_dev_info);
return (DDI_FAILURE);
}
TASKQ_DEFAULTPRI, 0);
RDS_DPRINTF1("rdsib_attach",
"ddi_taskq_create failed for rds_taskq");
return (DDI_FAILURE);
}
if (ret != DDI_SUCCESS) {
RDS_DPRINTF1("rdsib_attach",
"ddi_create_minor_node failed: %d", ret);
return (DDI_FAILURE);
}
/* Max number of receive buffers on the system */
/*
* High water mark for the receive buffers in the system. If the
* number of buffers used crosses this mark then all sockets in
* would be stalled. The port quota for the sockets is set based
* on this limit.
*/
ret = rdsib_initialize_ib();
if (ret != 0) {
RDS_DPRINTF1("rdsib_attach",
"rdsib_initialize_ib failed: %d", ret);
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
/* destroy taskq */
}
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
int ret = DDI_FAILURE;
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
if (rdsib_dev_info != NULL) {
*result = (void *)rdsib_dev_info;
ret = DDI_SUCCESS;
}
break;
case DDI_INFO_DEVT2INSTANCE:
ret = DDI_SUCCESS;
break;
default:
break;
}
return (ret);
}
static void
{
"MaxNodes", RDS_MAX_NODES);
"MinRnrRetry", RDS_IB_RNR_RETRY);
"rdsdbglvl", RDS_LOG_L2);
if (MaxNodes < 2) {
MaxNodes = 2;
}
}