e1000g_ndd.c revision 25f2d433de915875c8393f0b0dc14aa155997ad0
/*
* This file is provided under a CDDLv1 license. When using or
* redistributing this file, you may do so under this license.
* In redistributing this file this license must be included
* and no other modification of this header file is permitted.
*
* CDDL LICENSE SUMMARY
*
* Copyright(c) 1999 - 2007 Intel Corporation. All rights reserved.
*
* The contents of this file are subject to the terms of Version
* 1.0 of the Common Development and Distribution License (the "License").
*
* You should have received a copy of the License with this software.
* You can obtain a copy of the License at
* See the License for the specific language governing permissions
* and limitations under the License.
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms of the CDDLv1.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "e1000g_sw.h"
#include "e1000g_debug.h"
/*
* Notes:
* status of the parameter:
* '-' => read-only
* '!' => invisible!
*
* For writable parameters, we check for a driver property with the
* same name; if found, and its value is in range, we initialise
* the parameter from the property, overriding the default in the
* table below.
*
* A NULL in the <name> field terminates the array.
*
* The <info> field is used here to provide the index of the
* parameter to be initialised; thus it doesn't matter whether
* this table is kept ordered or not.
*
* The <info> field in the per-instance copy, on the other hand,
* is used to count assignments so that we can tell when a magic
* parameter has been set via ndd (see e1000g_nd_set()).
*/
static const nd_param_t nd_template[] = {
/* info min max init adapter r/w+name */
/* Our hardware capabilities */
/* Our advertised capabilities */
/* Partner's advertised capabilities */
/* Force Speed and Duplex */
NULL, "?force_speed_duplex" },
/* Current operating modes */
/* Tx Bcopy Threshold */
NULL, "+tx_bcopy_threshold" },
/* Tx Interrupt Enable */
NULL, "+tx_interrupt_enable" },
/* Tx Interrupt Delay */
NULL, "+tx_intr_delay" },
/* Tx Interrupt Delay */
NULL, "+tx_intr_abs_delay" },
/* Rx Bcopy Threshold */
NULL, "+rx_bcopy_threshold" },
/* Rx Max Receive Packets Per Interrupt */
NULL, "+max_num_rcv_packets" },
/* Receive Delay Timer Register */
NULL, "+rx_intr_delay" },
/* Receive Interrupt Absolute Delay Register */
NULL, "+rx_intr_abs_delay" },
/* Terminator */
};
static int
{
return (0);
}
static int
{
long new_value;
char *end;
return (EINVAL);
return (EINVAL);
return (0);
}
static int
{
const nd_param_t *tmplp;
char *nm;
int pval;
/*
* Copy the template from nd_template[] into the
* proper slot in the per-instance parameters,
* then register the parameter with nd_load()
*/
switch (*nm) {
default:
break;
case '?':
break;
}
}
switch (*nm) {
default:
case '!':
continue;
case '+':
case '?':
break;
case '-':
break;
}
goto nd_fail;
/*
* If the parameter is writable, and there's a property
* with the same name, and its value is in range, we use
* it to initialise the parameter. If it exists but is
* out of range, it's ignored.
*/
}
}
return (DDI_SUCCESS);
"e1000g_nd_param_load: FAILED at index %d [info %d]",
return (DDI_FAILURE);
}
static void
{
/* Hardware Capabilities */
case PARAM_AUTONEG_CAP:
break;
case PARAM_PAUSE_CAP:
break;
case PARAM_ASYM_PAUSE_CAP:
break;
case PARAM_1000FDX_CAP:
break;
case PARAM_1000HDX_CAP:
break;
case PARAM_100T4_CAP:
break;
case PARAM_100FDX_CAP:
break;
case PARAM_100HDX_CAP:
break;
case PARAM_10FDX_CAP:
break;
case PARAM_10HDX_CAP:
break;
/* Auto-Negotiation Advertisement Capabilities */
case PARAM_ADV_AUTONEG_CAP:
break;
case PARAM_ADV_PAUSE_CAP:
break;
case PARAM_ADV_ASYM_PAUSE_CAP:
break;
case PARAM_ADV_1000FDX_CAP:
break;
case PARAM_ADV_1000HDX_CAP:
break;
case PARAM_ADV_100T4_CAP:
break;
case PARAM_ADV_100FDX_CAP:
break;
case PARAM_ADV_100HDX_CAP:
break;
case PARAM_ADV_10FDX_CAP:
break;
case PARAM_ADV_10HDX_CAP:
break;
/* Link-Partner's Advertisement Capabilities */
case PARAM_LP_AUTONEG_CAP:
break;
case PARAM_LP_PAUSE_CAP:
break;
case PARAM_LP_ASYM_PAUSE_CAP:
break;
case PARAM_LP_1000FDX_CAP:
break;
case PARAM_LP_1000HDX_CAP:
break;
case PARAM_LP_100T4_CAP:
break;
case PARAM_LP_100FDX_CAP:
break;
case PARAM_LP_100HDX_CAP:
break;
case PARAM_LP_10FDX_CAP:
break;
case PARAM_LP_10HDX_CAP:
break;
/* Force Speed and Duplex Parameter */
case PARAM_FORCE_SPEED_DUPLEX:
case ADVERTISE_10_HALF:
break;
case ADVERTISE_10_FULL:
break;
case ADVERTISE_100_HALF:
break;
case ADVERTISE_100_FULL:
break;
}
break;
/* Link States */
case PARAM_LINK_STATUS:
break;
case PARAM_LINK_SPEED:
break;
case PARAM_LINK_DUPLEX:
break;
case PARAM_LINK_AUTONEG:
break;
/* Driver Properties */
case PARAM_MAX_FRAME_SIZE:
break;
case PARAM_LOOP_MODE:
break;
case PARAM_INTR_TYPE:
break;
/* Tunable Driver Properties */
case PARAM_TX_BCOPY_THRESHOLD:
break;
case PARAM_TX_INTR_ENABLE:
break;
case PARAM_TX_TIDV:
break;
case PARAM_TX_TADV:
break;
case PARAM_RX_BCOPY_THRESHOLD:
break;
case PARAM_RX_PKT_ON_INTR:
break;
case PARAM_RX_RDTR:
break;
case PARAM_RX_RADV:
break;
default:
break;
}
}
static void
{
autoneg_advertised = 0;
forced_speed_duplex = 0;
case PARAM_TX_BCOPY_THRESHOLD:
goto finished;
case PARAM_TX_INTR_ENABLE:
if (Adapter->tx_intr_enable)
else
goto finished;
case PARAM_TX_TIDV:
/* A value of zero is not allowed for TIDV */
if (Adapter->tx_intr_delay) {
}
goto finished;
case PARAM_TX_TADV:
goto finished;
case PARAM_RX_BCOPY_THRESHOLD:
goto finished;
case PARAM_RX_PKT_ON_INTR:
goto finished;
case PARAM_RX_RDTR:
goto finished;
case PARAM_RX_RADV:
goto finished;
default:
break;
}
/*
* ndd params that will impact link status
*/
if (Adapter->param_adv_1000fdx) {
}
if (Adapter->param_adv_100fdx) {
}
if (Adapter->param_adv_100hdx) {
}
if (Adapter->param_adv_10fdx) {
}
if (Adapter->param_adv_10hdx) {
}
switch (Adapter->param_force_speed_duplex) {
case GDIAG_10_HALF:
break;
case GDIAG_10_FULL:
break;
case GDIAG_100_HALF:
break;
case GDIAG_100_FULL:
break;
default:
break;
}
/* Auto-Negotiation Advertisement Capabilities */
case PARAM_ADV_AUTONEG_CAP:
}
break;
case PARAM_ADV_1000FDX_CAP:
if (Adapter->param_adv_autoneg == 0) {
"ndd set: adv_1000fdx requires "
"adv_autoneg_cap enabled");
goto finished;
}
if (value == 1) {
} else {
}
}
break;
case PARAM_ADV_100FDX_CAP:
if (Adapter->param_adv_autoneg == 0) {
"ndd set: adv_100fdx requires "
"adv_autoneg_cap enabled");
goto finished;
}
if (value == 1) {
} else {
}
}
break;
case PARAM_ADV_100HDX_CAP:
if (Adapter->param_adv_autoneg == 0) {
"ndd set: adv_100hdx requires "
"adv_autoneg_cap enabled");
goto finished;
}
if (value == 1) {
} else {
}
}
break;
case PARAM_ADV_10FDX_CAP:
if (Adapter->param_adv_autoneg == 0) {
"ndd set: adv_10fdx requires "
"adv_autoneg_cap enabled");
goto finished;
}
if (value == 1) {
} else {
}
}
break;
case PARAM_ADV_10HDX_CAP:
if (Adapter->param_adv_autoneg == 0) {
"ndd set: adv_10hdx requires "
"adv_autoneg_cap enabled");
goto finished;
}
if (value == 1) {
} else {
}
}
break;
case PARAM_FORCE_SPEED_DUPLEX:
"ndd set: force_speed_duplex requires "
"adv_autoneg_cap disabled");
goto finished;
}
switch (value) {
case GDIAG_10_HALF:
break;
case GDIAG_10_FULL:
break;
case GDIAG_100_HALF:
break;
case GDIAG_100_FULL:
break;
default:
break;
}
}
break;
default:
goto finished;
}
if (link_change) {
if (autoneg_enable) {
if (autoneg_advertised == 0) {
"ndd set: there must be at least one "
"advertised capability enabled");
goto finished;
}
} else {
}
}
}
int
{
int duplex;
int speed;
/*
* Register all the per-instance properties, initialising
* them from the table above or from driver properties set
* in the .conf file
*/
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
/* Free the Named Dispatch Table by calling nd_free */
void
{
}
enum ioc_reply
{
int info;
int cmd;
switch (cmd) {
default:
/* NOTREACHED */
return (IOC_INVAL);
case ND_GET:
/*
* If nd_getset() returns B_FALSE, the command was
* not valid (e.g. unknown name), so we just tell the
* top-level ioctl code to send a NAK (with code EINVAL).
*
* Otherwise, nd_getset() will have built the reply to
* be sent (but not actually sent it), so we tell the
* caller to send the prepared reply.
*/
case ND_SET:
/*
* All adv_* parameters are locked (read-only) while
* the device is in any sort of loopback mode ...
*/
return (IOC_INVAL);
}
if (!ok)
return (IOC_INVAL);
return (IOC_REPLY);
}
}