igb_ndd.c revision cf8dcc9bbabedca41ecfee13dec8172104e99968
/*
* CDDL HEADER START
*
* Copyright(c) 2007-2009 Intel Corporation. All rights reserved.
* 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:
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When using or redistributing this file, you may do so under the
* License only. No other modification of this header is permitted.
*
* 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 of the CDDL.
*/
#include "igb_sw.h"
/* Function prototypes */
static int igb_nd_param_load(igb_t *);
static void igb_nd_get_param_val(nd_param_t *);
/*
* 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 igb_nd_set()).
*/
static const nd_param_t nd_template[] = {
/* igb info min max init r/w+name */
/* Our hardware capabilities */
/* Our advertised capabilities */
/* Partner's advertised capabilities */
/* Current operating modes */
/* Terminator */
};
/*
* igb_nd_get - ndd get parameter values
*/
static int
{
return (0);
}
/*
* igb_nd_set - ndd set parameter values
*/
static int
{
long new_value;
char *end;
return (EINVAL);
return (EINVAL);
return (EIO);
return (0);
}
/*
* igb_nd_param_load
*/
static int
{
const nd_param_t *tmpnd;
nd_param_t *nd;
char *nm;
int value;
/*
* Copy the template from nd_template[] into the
* proper slot in the per-instance parameters,
* then register the parameter with nd_load()
*/
setfn = igb_nd_set;
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 (IGB_SUCCESS);
"igb_nd_param_load: failed at index %d [info %d]",
return (IGB_FAILURE);
}
/*
* igb_nd_get_param_val
*/
static void
{
case PARAM_LINK_STATUS:
break;
case PARAM_LINK_SPEED:
break;
case PARAM_LINK_DUPLEX:
break;
default:
break;
}
}
/*
* igb_nd_set_param_val
*/
static int
{
int result = IGB_SUCCESS;
return (IGB_SUCCESS);
}
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:
}
break;
default:
break;
}
return (result);
}
/*
* comment describing function
*/
int
{
/*
* Register all the per-instance properties, initialising
* them from the table above or from driver properties set
* in the .conf file
*/
return (IGB_FAILURE);
return (IGB_SUCCESS);
}
/*
* Free the Named Dispatch Table by calling nd_free
*/
void
{
}
/*
* comment describing function
*/
enum ioc_reply
{
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);
}
}
}