dld_drv.c revision ba2e4443695ee6a6f420a35cd4fc3d3346d22932
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Data-Link Driver
*/
#include <sys/dld_impl.h>
#include <sys/dls_impl.h>
/*
* dld control node state, one per open control node session.
*/
typedef struct dld_ctl_str_s {
static void drv_init(void);
static int drv_fini(void);
/*
* The following entry points are private to dld and are used for control
* operations only. The entry points exported to mac drivers are defined
*/
static void drv_uw_srv(queue_t *);
static struct module_info drv_info = {
0, /* mi_idnum */
DLD_DRIVER_NAME, /* mi_idname */
0, /* mi_minpsz */
(64 * 1024), /* mi_maxpsz */
1, /* mi_hiwat */
0 /* mi_lowat */
};
static struct qinit drv_ur_init = {
NULL, /* qi_putp */
NULL, /* qi_srvp */
drv_open, /* qi_qopen */
drv_close, /* qi_qclose */
NULL, /* qi_qadmin */
&drv_info, /* qi_minfo */
NULL /* qi_mstat */
};
static struct qinit drv_uw_init = {
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&drv_info, /* qi_minfo */
NULL /* qi_mstat */
};
static struct streamtab drv_stream = {
&drv_ur_init, /* st_rdinit */
&drv_uw_init, /* st_wrinit */
NULL, /* st_muxrinit */
NULL /* st_muxwinit */
};
/*
* Module linkage information for the kernel.
*/
extern struct mod_ops mod_driverops;
static struct modldrv drv_modldrv = {
};
static struct modlinkage drv_modlinkage = {
};
int
_init(void)
{
int err;
drv_init();
return (err);
return (0);
}
int
_fini(void)
{
int err;
return (err);
if (drv_fini() != 0) {
(void) mod_install(&drv_modlinkage);
return (DDI_FAILURE);
}
return (err);
}
int
{
}
/*
* Initialize component modules.
*/
static void
drv_init(void)
{
dld_str_init();
}
static int
drv_fini(void)
{
int err;
if ((err = dld_str_fini()) != 0)
return (err);
return (0);
}
/*
* devo_getinfo: getinfo(9e)
*/
/*ARGSUSED*/
static int
{
return (DDI_FAILURE);
switch (cmd) {
case DDI_INFO_DEVT2INSTANCE:
*resp = (void *)0;
break;
case DDI_INFO_DEVT2DEVINFO:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* Check properties to set options. (See dld.h for property definitions).
*/
static void
{
DLD_PROP_NO_FASTPATH, 0) != 0) {
}
DLD_PROP_NO_POLL, 0) != 0) {
}
DLD_PROP_NO_ZEROCOPY, 0) != 0) {
}
}
/*
* devo_attach: attach(9e)
*/
static int
{
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
/*
* Create control node. DLPI provider nodes will be created on demand.
*/
return (DDI_FAILURE);
/*
* Log the fact that the driver is now attached.
*/
return (DDI_SUCCESS);
}
/*
* devo_detach: detach(9e)
*/
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
/*
* Remove the control node.
*/
return (DDI_SUCCESS);
}
/*
* dld control node open procedure.
*/
/*ARGSUSED*/
static int
{
return (ENOTSUP);
/*
* This is a cloning driver and therefore each queue should only
* ever get opened once.
*/
return (EBUSY);
if (minor == 0)
return (ENOMEM);
return (ENOMEM);
}
/*
* Enable the queue srv(9e) routine.
*/
/*
* Construct a cloned dev_t to hand back.
*/
return (0);
}
/*
* dld control node close procedure.
*/
static int
{
/*
* Disable the queue srv(9e) routine.
*/
return (0);
}
/*
* DLDIOCATTR
*/
static void
{
int err;
goto failed;
goto failed;
}
return;
char devname[MAXNAMELEN];
/*
* Try to detect if the specified device is gldv3
* and return ENODEV if it is not.
*/
}
}
/*
* DLDIOCVLAN
*/
typedef struct dld_ioc_vlan_state {
static int
{
/*
* passed buffer space is limited to 65536 bytes. So
* copy only the vlans associated with the passed link.
*/
return (ENOSPC);
}
return (0);
}
static void
{
goto failed;
goto failed;
if (err != 0)
goto failed;
return;
}
/*
* Process an IOCTL message received by the control node.
*/
static void
{
switch (cmd) {
case DLDIOCATTR:
return;
case DLDIOCVLAN:
return;
default:
return;
}
}
/*
* Write side put routine of the dld control node.
*/
static void
{
case M_IOCTL:
break;
default:
break;
}
}
/*
* Write-side service procedure.
*/
void
drv_uw_srv(queue_t *q)
{
drv_uw_put(q, mp);
}