meter_impl.h 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.
*/
#ifndef _IPP_METERS_METER_IMPL_H
#define _IPP_METERS_METER_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <inet/ipp_common.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Header file for implementation of all the metering modules */
#ifdef _KERNEL
/* for a colour aware meter */
enum meter_colour {
TOKENMT_GREEN = 0x01,
TOKENMT_YELLOW = 0x02,
TOKENMT_RED = 0x04
};
/* If yellow action is not provided, set it to infinity */
#define TOKENMT_NO_ACTION 0x7fffffff
#define METER_SEC_TO_NSEC 1000000000
#define METER_MSEC_TO_NSEC 1000000
#define _TOKENMT_DEBUG
#define _TSWTCL_DEBUG
#ifdef _TOKENMT_DEBUG
#define tokenmt0dbg(a) printf a
#else
#define tokenmt0dbg(a) /* */
#define tokenmt1dbg(a) /* */
#define tokenmt2dbg(a) /* */
#endif /* _TOKENMT_DEBUG */
#ifdef _TSWTCL_DEBUG
#define tswtcl0dbg(a) printf a
#else
#define tswtcl0dbg(a) /* */
#define tswtcl1dbg(a) /* */
#define tswtcl2dbg(a) /* */
#endif /* _TSWTCL_DEBUG */
#define SRTCL_TOKENMT 0x01
#define TRTCL_TOKENMT 0x02
#define DROP_PRECD_MASK 0x07
/* Stat structure for the tokenmts */
typedef struct meter_stat_t {
} meter_stat_t;
#define TOKENMT_STATS_STRING "tokenmt statistics"
#define TSWTCL_STATS_STRING "tswtclmtr statistics"
#define METER_STATS_COUNT 7
/* Configuration paratokenmts for tokenmt */
typedef struct tokenmt_cfg_s {
/* Next action for Green, Yellow and Red packets */
/* Meter type - SRTCL_TOKENMT or TRTCL_TOKENMT */
/* Committed and Peak burst sizes in bits */
/* Needs stats or not */
/* Meter Colour aware or not */
/* Meter dscp to colour mapping, if colour aware */
/* timer */
typedef struct tokenmt_data_s {
/* stats for this instance */
/* # packets classified as Red, Yellow and Green for this instance */
/* configured paratokenmts */
/* No. of tokens at the committed and peak burst */
/* For replenishing the token buckets */
/* Lock to protect data structures */
typedef struct tswtcl_cfg_s {
/* Next action for Green, Yellow and Red packets */
/* Window size in ms */
/* Need stats or not */
/* For aiding computations */
typedef struct tswtcl_data_s {
/* stats for this instance */
/* Computed average rate */
/* Front of the sliding window */
/* # packets classified as Red, Yellow and Green for this instance */
/* Configured paramters */
/* Lock to protect data structures */
#define TOKENMT_DATA_SZ sizeof (tokenmt_data_t)
#define TOKENMT_CFG_SZ sizeof (tokenmt_cfg_t)
#define TSWTCL_DATA_SZ sizeof (tswtcl_data_t)
#define TSWTCL_CFG_SZ sizeof (tswtcl_cfg_t)
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _IPP_METERS_METER_IMPL_H */