dscpmkddi.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <ipp/ipp_config.h>
#define D_SM_COMMENT "IPP dscpmk marker module"
/* DDI file for dscpmk ipp module */
/* default dscp map - dscp unchanged */
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
16, 17, 18, 19,
20, 21, 22, 23,
24, 25, 26, 27,
28, 29, 30, 31,
32, 33, 34, 35,
36, 37, 38, 39,
40, 41, 42, 43,
44, 45, 46, 47,
48, 49, 50, 51,
52, 53, 54, 55,
56, 57, 58, 59,
60, 61, 62, 63
};
/* Creating and updating summary stats */
static int dscpmk_update_stats(ipp_stat_t *, void *, int);
/* Creating and updating per-dscp stats */
static int dscpmk_update_det_stats(ipp_stat_t *, void *, int);
/* Entry points for this IPP module */
ipp_ops_t dscpmk_ops = {
dscpmk_create_action, /* ippo_action_create */
dscpmk_modify_action, /* ippo_action_modify */
dscpmk_destroy_action, /* ippo_action_destroy */
dscpmk_info, /* ippo_action_info */
dscpmk_invoke_action /* ippo_action_invoke */
};
extern struct mod_ops mod_ippops;
/*
* Module linkage information for the kernel.
*/
D_SM_COMMENT " %I%",
};
static struct modlinkage modlinkage = {
(void *)&modlipp,
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}
static int
{
char *next_action;
return (ENOMEM);
}
/* parse next action name */
&next_action)) != 0) {
dscpmk0dbg(("dscpmk_create_action: invalid config, " \
"next_action name missing\n"));
return (err);
}
== IPP_ACTION_INVAL) {
dscpmk0dbg(("dscpmk_create_action: next_action "\
"invalid\n"));
return (EINVAL);
}
/* Fill in the default value */
sizeof (default_dscp_map));
/*
* parse dscp_map, if present. Note that the module gets
* the entire array with unchanged entries marked with -1.
*/
}
}
}
/* parse summary_stats boolean */
!= 0) {
} else {
/* If stats is needed, initialize the stats structure */
if (dscpmk_data->summary_stats) {
!= 0) {
return (err);
}
}
}
/*
* Initialize per-dscp stats; B_FALSE in present indicates a dscp
* with this value (count) is not present in the map.
*/
}
/* parse detailed_stats boolean */
!= 0) {
} else {
/* If stats is needed, initialize the stats structure */
if (dscpmk_data->detailed_stats) {
continue;
}
val)) != 0) {
return (err);
}
}
}
}
/* Free the nvlist */
/* set action chain reference */
dscpmk0dbg(("dscpmk_create_action: ipp_action_ref " \
"returned with error %d\n", err));
if (dscpmk_data->summary_stats) {
}
if (dscpmk_data->detailed_stats) {
}
}
}
return (err);
}
return (0);
}
static int
{
char *next_action_name;
!= 0) {
dscpmk0dbg(("dscpmk_modify_action: invalid cfg. type\n"));
return (err);
}
if (config_type != IPP_SET) {
dscpmk0dbg(("dscpmk_modify_action: invalid cfg. type " \
"%d\n", config_type));
return (EINVAL);
}
/* parse next action name, if present */
&next_action_name)) == 0) {
/* lookup action name to get action id */
== IPP_ACTION_INVAL) {
dscpmk0dbg(("dscpmk_modify_action: next_action "\
"invalid\n"));
return (EINVAL);
}
/* reference new action */
dscpmk0dbg(("dscpmk_modify_action: ipp_action_ref " \
"returned with error %d\n", err));
return (err);
}
/* unref old action */
}
/*
* parse dscp_map, if present. Note that the module gets
* the entire array with unchanged entries marked with -1.
* If this array is absent during modification, it means revert to
* the default table.
*/
}
}
} else {
sizeof (default_dscp_map));
}
/* parse summary_stats boolean, if present */
== 0) {
/* Turning on stats */
!= 0) {
return (err);
}
/* Turning off stats */
}
}
/* parse detailed_stats boolean */
== 0) {
}
}
}
}
/* The map might have changed */
if (dscpmk_data->detailed_stats) {
val)) != 0) {
return (err);
}
}
}
}
/* Free the nvlist */
return (0);
}
static int
{
/* Destroy stats, if gathered */
if (dscpmk_data->summary_stats) {
}
if (dscpmk_data->detailed_stats) {
stats);
}
}
}
/* unreference the action */
return (0);
}
static int
{
int err;
/* get mblk from ipp_packet structure */
/* dscpmk packet as configured */
return (err);
} else {
/* return packet with next action set */
}
}
static int
{
int err = 0;
char stats_string[15];
/* install stats entry */
dscpmk0dbg(("dscpmk_det_statinit: ipp_stat_create returned "\
"with error %d\n", err));
return (err);
}
statp = (dscpmk_dscp_stats_t *)
dscpmk0dbg(("dscpmk_det_statinit: ipp_stat_named_init "\
"returned with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_det_statinit: ipp_stat_named_init "\
"returned with error %d\n", err));
return (err);
}
return (0);
}
static int
{
int err = 0;
/* install stats entry */
dscpmk0dbg(("dscpmk_create_action: ipp_stat_create returned " \
"with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_summ_statinit: ipp_stat_named_init " \
"returned with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_summ_statinit: ipp_stat_named_init " \
"returned with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_summ_statinit: ipp_stat_named_init " \
"returned with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_summ_statinit: ipp_stat_named_init " \
"returned with error %d\n", err));
return (err);
}
dscpmk0dbg(("dscpmk_summ_statinit: ipp_stat_named_init " \
"returned with error %d\n", err));
return (err);
}
return (0);
}
/* ARGSUSED */
static int
{
continue;
statp = (dscpmk_dscp_stats_t *)
}
return (0);
}
static int
{
rw);
return (0);
}
/* ARGSUSED */
static int
{
char *next_action;
/* allocate nvlist to be passed back */
dscpmk0dbg(("dscpmk_info: error allocating memory\n"));
return (err);
}
/* look up next action with the next action id */
&next_action)) != 0) {
dscpmk0dbg(("dscpmk_info: next action not available\n"));
return (err);
}
/* add next action name */
next_action)) != 0) {
dscpmk0dbg(("dscpmk_info: error adding next action\n"));
return (err);
}
/* free action name */
/* add config type */
dscpmk0dbg(("dscpmk_info: error adding config type\n"));
return (err);
}
/* add dscp map */
}
dscp_map, DSCPMK_ARRAY_COUNT)) != 0) {
dscpmk0dbg(("dscpmk_info: error adding dscp map\n"));
return (err);
}
/* add summary stats boolean */
dscpmk0dbg(("dscpmk_info: error adding stats status\n"));
return (err);
}
/* add detailed stats boolean */
dscpmk0dbg(("dscpmk_info: error adding det stats status\n"));
return (err);
}
/* call back with nvlist */
return (err);
}