softmac_dev.c revision 193974072f41a843678abf5f61979c748687e66b
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/softmac_impl.h>
static int softmac_close(queue_t *);
static void softmac_rsrv(queue_t *);
static void softmac_wsrv(queue_t *);
static struct module_info softmac_modinfo = {
0,
0,
65536,
1024
};
/*
* hi-water mark is 1 because of the flow control mechanism implemented in
* dld. Refer to the comments in dld_str.c for details.
*/
static struct module_info softmac_dld_modinfo = {
0,
0,
1,
0
};
static struct qinit softmac_urinit = {
softmac_open, /* qi_qopen */
softmac_close, /* qi_qclose */
NULL, /* qi_qadmin */
&softmac_modinfo /* qi_minfo */
};
static struct qinit softmac_uwinit = {
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&softmac_modinfo /* qi_minfo */
};
static struct streamtab softmac_tab = {
&softmac_urinit, /* st_rdinit */
&softmac_uwinit /* st_wrinit */
};
static struct qinit softmac_dld_r_qinit = {
};
static struct qinit softmac_dld_w_qinit = {
};
static struct fmodsw softmac_fmodsw = {
};
static struct modldrv softmac_modldrv = {
"softmac driver",
};
static struct modlstrmod softmac_modlstrmod = {
"softmac module",
};
static struct modlinkage softmac_modlinkage = {
};
int
_init(void)
{
int err;
softmac_init();
softmac_fini();
return (err);
}
return (0);
}
int
_fini(void)
{
int err;
if (softmac_busy())
return (EBUSY);
return (err);
softmac_fini();
return (0);
}
int
{
}
static int
{
/*
* This is a self-cloning driver so that each queue should only
* get opened once.
*/
return (EBUSY);
/*
* This is the softmac module pushed over an underlying
* legacy device. Initialize the lower structure.
*/
return (ENOMEM);
return (0);
}
/*
* Regular device open of a softmac DLPI node. We modify
* the queues' q_qinfo pointer such that all future STREAMS
* operations will go through dld's entry points (including
* dld_close()).
*/
}
static int
{
/*
* Call the appropriate delete routine depending on whether this is
* a module or device.
*/
/*
* slp->sl_handle could be non-NULL if it is in the aggregation.
*/
return (0);
}
static void
{
union DL_primitives *dlp;
/*
* This is the softmac module.
*/
case M_DATA:
/*
* Some drivers start to send up packets even if not in the
* DL_IDLE state, where sl_softmac is not set yet. Drop the
* packet in this case.
*/
return;
}
/*
* This is the most common case.
*/
/*
* We don't need any locks to protect sl_handle
* because ip_input() can tolerate if sl_handle
* is reset to NULL when DL_CAPAB_POLL is
* disabled.
*/
return;
} else {
}
break;
case M_PROTO:
case M_PCPROTO:
break;
}
break;
}
/*FALLTHROUGH*/
default:
break;
}
}
/* ARGSUSED */
static void
{
}
static void
{
/*
* This is the softmac module
*/
case M_IOCTL: {
case SMAC_IOC_START: {
break;
}
/*
* Assign the devname and perstream handle of the
* specific lower stream and return it as a part
* of the ioctl.
*/
break;
}
default:
break;
}
break;
}
default:
break;
}
}
static void
{
/*
* This is the softmac module
*/
/*
* Inform that the tx resource is available; mac_tx_update() will
* inform all the upper streams sharing this lower stream.
*/
}
static int
{
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
softmac_dip = dip;
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
softmac_dip = NULL;
return (DDI_SUCCESS);
}
/* ARGSUSED */
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
if (softmac_dip != NULL) {
*result = softmac_dip;
return (DDI_SUCCESS);
}
break;
case DDI_INFO_DEVT2INSTANCE:
return (DDI_SUCCESS);
}
return (DDI_FAILURE);
}