e1000g_ndd.c revision 9ce7e93c0e8e6d2b400f40e9c5742b1d6682611e
/*
* 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 2008 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 */
/* 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);
}
/*
* synchronize the adv* and en* parameters.
*
* parameters. The usage of ndd for setting adv parameters will
* synchronize all the en parameters with the e1000g parameters,
* implicity disalbing any settings made via dladm.
*/
static void
{
}
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
{
/* 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
{
case PARAM_TX_BCOPY_THRESHOLD:
break;
case PARAM_TX_INTR_ENABLE:
if (Adapter->tx_intr_enable)
else
break;
case PARAM_TX_TIDV:
/* A value of zero is not allowed for TIDV */
if (Adapter->tx_intr_delay) {
}
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;
case PARAM_ADV_AUTONEG_CAP:
case PARAM_ADV_1000FDX_CAP:
case PARAM_ADV_100FDX_CAP:
case PARAM_ADV_100HDX_CAP:
case PARAM_ADV_10FDX_CAP:
case PARAM_ADV_10HDX_CAP:
(void) e1000g_reset_link(Adapter);
break;
default:
break;
}
}
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);
}
}