xref: /illumos-gate/usr/src/uts/common/io/bnxe/577xx/include/l4debug.h (revision d14abf155341d55053c76eeec58b787a456b753b)
1 /*******************************************************************************
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  *
21  * Copyright 2014 QLogic Corporation
22  * The contents of this file are subject to the terms of the
23  * QLogic End User License (the "License").
24  * You may not use this file except in compliance with the License.
25  *
26  * You can obtain a copy of the License at
27  * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/
28  * QLogic_End_User_Software_License.txt
29  * See the License for the specific language governing permissions
30  * and limitations under the License.
31  *
32  *
33  *
34  * Module Description:
35  *
36  ******************************************************************************/
37 
38 #ifndef _L4DEBUG_H
39 #define _L4DEBUG_H
40 
41 #include "bcmtype.h"
42 
43 #define L4_DEBUG_BIT_FIELDS 0
44 // Use _l4_tcp_const_state_t _pad[0] for L4 debug
45 // PbfQueue		- bits 7-5
46 // VOQ          - bits 4-2
47 // cos			- bits 1-0
48 #define L4_DEBUG_PBF_Q_MASK 		0xE0
49 #define L4_DEBUG_PBF_Q_SHIFT 		5
50 
51 #define L4_DEBUG_VOQ_MASK    		0x1C
52 #define L4_DEBUG_VOQ_SHIFT 	    	2
53 
54 #define L4_DEBUG_COS_MASK 			0x3
55 #define L4_DEBUG_COS_SHIFT 			0
56 
57 
58 
59 #define L4_DEBUG_FLAGS 1
60 // DPM test EN     - bit 4
61 // QmOpportunistic - bit 3
62 // TestingEn	   - bit 2
63 // LbEn 		   - bit 1
64 // CosEn 		   - bit 0
65 
66 #define L4_DEBUG_DPM_TEST_EN_MASK	0x10
67 #define L4_DEBUG_QM_OPPORT_EN_MASK	0x08
68 #define L4_DEBUG_TESTING_EN_MASK 	0x04
69 #define L4_DEBUG_LB_EN_MASK 		0x02
70 #define L4_DEBUG_COS_EN_MASK 		0x01
71 
72 
73 
74 #define L4_DEBUG_GET_COS(_data)		 		((_data[L4_DEBUG_BIT_FIELDS] & L4_DEBUG_COS_MASK) >> L4_DEBUG_COS_SHIFT)
75 #define L4_DEBUG_GET_PBFQUEUE(_data) 		((_data[L4_DEBUG_BIT_FIELDS] & L4_DEBUG_PBF_Q_MASK) >> L4_DEBUG_PBF_Q_SHIFT)
76 #define L4_DEBUG_GET_VOQ(_data) 		    ((_data[L4_DEBUG_BIT_FIELDS] & L4_DEBUG_VOQ_MASK) >> L4_DEBUG_VOQ_SHIFT)
77 #define L4_DEBUG_GET_FLAGS(_data)           (_data[L4_DEBUG_FLAGS])
78 
79 #define L4_DEBUG_SET_COS(_data, cos) 		\
80     (_data[L4_DEBUG_BIT_FIELDS] &= (~L4_DEBUG_COS_MASK)); \
81     (_data[L4_DEBUG_BIT_FIELDS] |= ((cos << L4_DEBUG_COS_SHIFT) & L4_DEBUG_COS_MASK))
82 
83 #define L4_DEBUG_SET_PBFQUEUE(_data, pbf_q) \
84     (_data[L4_DEBUG_BIT_FIELDS] &= (~L4_DEBUG_PBF_Q_MASK)); \
85     (_data[L4_DEBUG_BIT_FIELDS] |= ((pbf_q << L4_DEBUG_PBF_Q_SHIFT) & L4_DEBUG_PBF_Q_MASK))
86 
87 #define L4_DEBUG_SET_VOQ(_data, voq)        \
88     (_data[L4_DEBUG_BIT_FIELDS] &= (~L4_DEBUG_VOQ_MASK)); \
89     (_data[L4_DEBUG_BIT_FIELDS] |= ((voq << L4_DEBUG_VOQ_SHIFT) & L4_DEBUG_VOQ_MASK))
90 
91 #define L4_DEBUG_SET_FLAGS(_data, flags) (_data[L4_DEBUG_FLAGS] |= flags)
92 
93 
94 
95 #endif /* _L4DEBUG_H */
96 
97