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_DLCOSMK_DLCOSMK_IMPL_H
28 #define _IPP_DLCOSMK_DLCOSMK_IMPL_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
33 #include <sys/cmn_err.h>
35 #include <ipp/dlcosmk/dlcosmk.h>
36 #include <inet/ipp_common.h>
42 /* Header file for implementation of DL CoS marker ipp action module */
44 #define _DLCOSMK_DEBUG
46 /* The 3-MSB in the ToS/Dsfield are used to map to the 802.1D user priority */
47 #define TOS_CLASS_MASK 5
48 /* 802.1D user priority is 3 bits - 0-7 */
49 #define UPRI_MAP_COUNT 8
50 /* This will be used it the ToS/Dsfield needs to be mapped */
51 #define MAP_TOS_TO_UPRI 8
54 #include <sys/debug.h>
55 #define dlcosmk0dbg(a) printf a
56 #define dlcosmk1dbg(a) if (dlcosmk_debug > 2) printf a
57 #define dlcosmk2dbg(a) if (dlcosmk_debug > 3) printf a
59 #define dlcosmk0dbg(a)
60 #define dlcosmk1dbg(a)
61 #define dlcosmk2dbg(a)
62 #endif /* _DLCOSMK_DEBUG */
64 /* dlcosmk stats info. available using kstats */
65 typedef struct dlcosmk_stat_s
{
66 ipp_named_t npackets
; /* no. of pkts seen by this instance */
67 ipp_named_t ipackets
; /* no. of pkts not processed */
68 ipp_named_t epackets
; /* no. of pkts in error */
69 ipp_named_t usr_pri
; /* configured 802.1D priority */
70 ipp_named_t b_band
; /* Mapped b_band for the priority */
71 ipp_named_t dl_max
; /* Mapped dl_max for the priority */
75 * If the above structure is changed, the count will have to be updated
78 #define DLCOSMK_STATS_COUNT 6
79 #define DLCOSMK_STATS_STRING "dlcosmk statistics"
82 * Table containing 802.1D user_priority -> b_band/dl_max mappings.
83 * The mappings have been taken from the VLAN driver.
85 typedef struct usrpri_tbl_s
{
90 extern usrpri_tbl_t usrpri_tbl
[UPRI_MAP_COUNT
];
92 #define UPRI_TBL_SZ sizeof (usrpri_tbl_t)
94 /* Per-instance data structure */
95 typedef struct dlcosmk_data_s
{
96 ipp_action_id_t next_action
; /* action id of next action */
97 ipp_stat_t
*stats
; /* stats for this instance */
98 uint8_t usr_pri
; /* 802.1d user priority */
99 uchar_t b_band
; /* corresponding bband */
100 t_scalar_t dl_max
; /* corresponding dl_max */
101 boolean_t gather_stats
; /* stats collected or not */
102 uint64_t npackets
; /* no. of pkts. for this instance */
103 uint64_t epackets
; /* no. of pkts. in error */
104 uint64_t ipackets
; /* no. of pkts. not processed */
107 #define DLCOSMK_DATA_SZ sizeof (dlcosmk_data_t)
110 * ToS -> user_priority mapping. This mapping is local to this implementation
111 * i.e., the ToS -> 802.1D mapping is not a standard.
113 extern uint8_t tos_to_usrpri
[UPRI_MAP_COUNT
];
116 extern int dlcosmk_debug
;
117 extern int dlcosmk_process(mblk_t
**, dlcosmk_data_t
*, uint32_t, ip_proc_t
);
124 #endif /* _IPP_DLCOSMK_DLCOSMK_IMPL_H */