/*
* 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>
/* DDI file for flowacct ipp module */
static int update_flowacct_kstats(ipp_stat_t *, void *, int);
flowacct_create_action, /* ippo_action_create */
flowacct_modify_action, /* ippo_action_modify */
flowacct_destroy_action, /* ippo_action_destroy */
flowacct_info, /* ippo_action_info */
flowacct_invoke_action /* ippo_action_invoke */
};
extern struct mod_ops mod_ippops;
/*
* Module linkage information for the kernel.
*/
D_SM_COMMENT " 1.12",
};
(void *)&modlipp,
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}
/* Update global stats */
static int
{
rw);
rw);
rw);
return (0);
}
/* Initialize global stats */
static int
{
int err = 0;
&flowacct_data->stats)) != 0) {
flowacct0dbg(("global_statinit: error creating flowacct "\
"stats\n"));
return (err);
}
flowacct0dbg(("global_statinit: ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
flowacct0dbg(("global_statinit: ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
flowacct0dbg(("global_statinit:ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
flowacct0dbg(("global_statinit:ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
flowacct0dbg(("global_statinit:ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
flowacct0dbg(("global_statinit:ipp_stat_named_init returned "\
"with error %d\n", err));
return (err);
}
return (err);
}
static int
{
char *next_action;
== NULL) {
return (ENOMEM);
}
/* parse next action name */
&next_action)) != 0) {
flowacct0dbg(("flowacct_create_action: invalid config, "\
"next_action missing\n"));
return (rc);
}
== IPP_ACTION_INVAL) {
flowacct0dbg(("flowacct_create_action: invalid next_action\n"));
return (EINVAL);
}
flowacct0dbg(("flowacct_create_action: invalid next aid\n"));
return (EINVAL);
}
/* parse flow timeout - in millisec, if present */
/* Convert to FLOWACCT_MSEC_TO_NSEC */
/* parse flow timer - in millisec, if present */
/* Convert to FLOWACCT_MSEC_TO_USEC */
&flowacct_data->max_limit)) != 0) {
flowacct0dbg(("flowacct_create_action: invalid config, "\
"max_limit missing\n"));
return (rc);
}
&bstats)) != 0) {
} else {
if (flowacct_data->global_stats) {
return (rc);
}
}
}
/* set action chain reference */
flags)) != 0) {
flowacct0dbg(("flowacct_create_action: ipp_action_ref " \
"returned with error %d\n", rc));
}
return (rc);
}
/* Initialize locks */
}
return (0);
}
static int
{
int rc = 0;
!= 0) {
flowacct0dbg(("flowacct_modify_action: invalid configuration "\
"type\n"));
return (rc);
}
if (config_type != IPP_SET) {
flowacct0dbg(("flowacct_modify_action: invalid configuration "\
"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) {
flowacct0dbg(("flowacct_modify_action: next_action "\
"invalid\n"));
return (EINVAL);
}
/* reference new action */
flowacct0dbg(("flowacct_modify_action: "\
"ipp_action_ref returned with error %d\n", rc));
return (rc);
}
flowacct0dbg(("flowacct_modify_action: invalid next "\
"aid\n"));
return (EINVAL);
}
/* unref old action */
}
/* parse timeout, if present */
== 0) {
}
/* parse timer, if present */
}
/* parse max_flow, if present */
== 0) {
}
/* parse gather_stats boolean, if present */
== 0) {
/* Turning global stats on */
if (rc == 0) {
} else {
flowacct0dbg(("flowacct_modify_action: error "\
"enabling stats\n"));
}
}
}
return (0);
}
static int
{
while (flowacct_data->flow_tid != 0) {
flowacct_data->flow_tid = 0;
}
}
/* Dump all the flows to the file */
+ 1));
/* Destroy the locks */
}
/* unreference the action */
return (0);
}
static int
{
int rc;
/* get mblk from ipp_packet structure */
/* flowacct packet as configured */
return (rc);
} else {
/* return packet with next action set */
}
}
/* ARGSUSED */
static int
{
char *next_action;
int rc;
/* allocate nvlist to be passed back */
flowacct0dbg(("flowacct_info: memory allocation failure\n"));
return (rc);
}
/* look up next action with the next action id */
&next_action)) != 0) {
flowacct0dbg(("flowacct_info: next action not available\n"));
return (rc);
}
/* add next action name */
next_action)) != 0) {
flowacct0dbg(("flowacct_info: error adding next action\n"));
return (rc);
}
/* free action name */
/* add config type */
flowacct0dbg(("flowacct_info: error adding config type\n"));
return (rc);
}
/* add timer */
flowacct0dbg(("flowacct_info: error adding timer info.\n"));
return (rc);
}
/* add max_limit */
flowacct_data->max_limit)) != 0) {
flowacct0dbg(("flowacct_info: error adding max_flow info.\n"));
return (rc);
}
/* add timeout */
flowacct0dbg(("flowacct_info: error adding timeout info.\n"));
return (rc);
}
/* add global stats boolean */
flowacct0dbg(("flowacct_info: error adding global stats "\
"info.\n"));
return (rc);
}
/* call back with nvlist */
return (rc);
}