4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _IPP_DSCPMK_DSCPMK_IMPL_H
28 #define _IPP_DSCPMK_DSCPMK_IMPL_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
33 #include <sys/cmn_err.h>
35 #include <ipp/dscpmk/dscpmk.h>
36 #include <inet/ipp_common.h>
42 /* Header file for implementation of DS/ToS dscp marker ipp action module */
46 /* Mask out all but the Traffic class for IPv6 header */
48 #define TCLASS_MASK 0xF00FFFFF
50 #define TCLASS_MASK 0xFFFF0FF0
53 /* Array count for dscp_policed_array 0-63 */
54 #define DSCPMK_ARRAY_COUNT 64
55 /* During modification, entries that are unchanged are signified with -1 */
56 #define DSCPMK_UNCHANGED_DSCP -1
59 #include <sys/debug.h>
60 #define dscpmk0dbg(a) printf a
61 #define dscpmk1dbg(a) if (dscpmk_debug > 2) printf a
62 #define dscpmk2dbg(a) if (dscpmk_debug > 3) printf a
67 #endif /* _DSCPMK_DEBUG */
69 /* dscpmk stats information available using kstats */
70 typedef struct dscpmk_stat_s
{
71 ipp_named_t npackets
; /* no. of pkts seen by this instance */
72 ipp_named_t dscp_changed
; /* no. of pkts. with dscp changed */
73 ipp_named_t dscp_unchanged
; /* no. of pkts. with dscp unchanged */
74 ipp_named_t ipackets
; /* no. of pkts. not processed */
75 ipp_named_t epackets
; /* no. of pkts. in error */
78 typedef struct dscpmk_dscp_stats_s
{
79 ipp_named_t dscp
; /* dscp value */
80 ipp_named_t npackets
; /* no. of packets for this dscp */
81 } dscpmk_dscp_stats_t
;
84 * If the above structure is changed, the count will have to be updated
87 #define DSCPMK_STATS_COUNT 5
88 #define DSCPMK_STATS_STRING "dscpmk_stats"
90 #define DSCPMK_DSCP_STATS_COUNT 2
92 typedef struct dscp_stats_s
{
93 boolean_t present
; /* Stats present for this DSCP */
94 uint64_t npackets
; /* no. of packets for this DSCP */
95 ipp_stat_t
*stats
; /* stats for this DSCP */
98 /* Per-instance structure */
99 typedef struct dscpmk_data_s
{
101 ipp_action_id_t next_action
; /* action id of next action */
102 ipp_stat_t
*stats
; /* structure for storing stats */
104 /* inbound DSCP -> outbound DSCP mapping table */
105 uint8_t dscp_map
[DSCPMK_ARRAY_COUNT
];
108 boolean_t summary_stats
;
109 uint64_t npackets
; /* no. of packets processed by action */
110 uint64_t changed
; /* packets with DSCP changed */
111 uint64_t unchanged
; /* packets with DSCP unchanged */
112 uint64_t ipackets
; /* packets not processed */
113 uint64_t epackets
; /* packets in error */
116 boolean_t detailed_stats
;
117 /* Stats count per DSCP value 0-63 */
118 dscp_stats_t dscp_stats
[DSCPMK_ARRAY_COUNT
];
121 #define DSCPMK_DATA_SZ sizeof (dscpmk_data_t)
124 extern int dscpmk_process(mblk_t
**, dscpmk_data_t
*, ip_proc_t
);
131 #endif /* _IPP_DSCPMK_DSCPMK_IMPL_H */