xref: /OK3568_Linux_fs/kernel/drivers/net/ethernet/chelsio/cxgb4/t4_values.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This software is available to you under a choice of one of two
7*4882a593Smuzhiyun  * licenses.  You may choose to be licensed under the terms of the GNU
8*4882a593Smuzhiyun  * General Public License (GPL) Version 2, available from the file
9*4882a593Smuzhiyun  * COPYING in the main directory of this source tree, or the
10*4882a593Smuzhiyun  * OpenIB.org BSD license below:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  *     Redistribution and use in source and binary forms, with or
13*4882a593Smuzhiyun  *     without modification, are permitted provided that the following
14*4882a593Smuzhiyun  *     conditions are met:
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  *      - Redistributions of source code must retain the above
17*4882a593Smuzhiyun  *        copyright notice, this list of conditions and the following
18*4882a593Smuzhiyun  *        disclaimer.
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  *      - Redistributions in binary form must reproduce the above
21*4882a593Smuzhiyun  *        copyright notice, this list of conditions and the following
22*4882a593Smuzhiyun  *        disclaimer in the documentation and/or other materials
23*4882a593Smuzhiyun  *        provided with the distribution.
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28*4882a593Smuzhiyun  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29*4882a593Smuzhiyun  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30*4882a593Smuzhiyun  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31*4882a593Smuzhiyun  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32*4882a593Smuzhiyun  * SOFTWARE.
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #ifndef __T4_VALUES_H__
36*4882a593Smuzhiyun #define __T4_VALUES_H__
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /* This file contains definitions for various T4 register value hardware
39*4882a593Smuzhiyun  * constants.  The types of values encoded here are predominantly those for
40*4882a593Smuzhiyun  * register fields which control "modal" behavior.  For the most part, we do
41*4882a593Smuzhiyun  * not include definitions for register fields which are simple numeric
42*4882a593Smuzhiyun  * metrics, etc.
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /* SGE register field values.
46*4882a593Smuzhiyun  */
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /* CONTROL1 register */
49*4882a593Smuzhiyun #define RXPKTCPLMODE_SPLIT_X		1
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #define INGPCIEBOUNDARY_SHIFT_X		5
52*4882a593Smuzhiyun #define INGPCIEBOUNDARY_32B_X		0
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun #define INGPADBOUNDARY_SHIFT_X		5
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun #define T6_INGPADBOUNDARY_SHIFT_X	3
57*4882a593Smuzhiyun #define T6_INGPADBOUNDARY_8B_X		0
58*4882a593Smuzhiyun #define T6_INGPADBOUNDARY_32B_X		2
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun #define INGPADBOUNDARY_32B_X		0
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun /* CONTROL2 register */
63*4882a593Smuzhiyun #define INGPACKBOUNDARY_SHIFT_X		5
64*4882a593Smuzhiyun #define INGPACKBOUNDARY_16B_X		0
65*4882a593Smuzhiyun #define INGPACKBOUNDARY_64B_X		1
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun /* GTS register */
68*4882a593Smuzhiyun #define SGE_TIMERREGS			6
69*4882a593Smuzhiyun #define TIMERREG_COUNTER0_X		0
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun #define FETCHBURSTMIN_64B_X		2
72*4882a593Smuzhiyun #define FETCHBURSTMIN_128B_X		3
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /* T6 and later use a single-bit encoding for FetchBurstMin */
75*4882a593Smuzhiyun #define FETCHBURSTMIN_64B_T6_X		0
76*4882a593Smuzhiyun #define FETCHBURSTMIN_128B_T6_X		1
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun #define FETCHBURSTMAX_256B_X		2
79*4882a593Smuzhiyun #define FETCHBURSTMAX_512B_X		3
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun #define HOSTFCMODE_INGRESS_QUEUE_X	1
82*4882a593Smuzhiyun #define HOSTFCMODE_STATUS_PAGE_X	2
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun #define CIDXFLUSHTHRESH_32_X		5
85*4882a593Smuzhiyun #define CIDXFLUSHTHRESH_128_X		7
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun #define UPDATEDELIVERY_INTERRUPT_X	1
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun #define RSPD_TYPE_FLBUF_X		0
90*4882a593Smuzhiyun #define RSPD_TYPE_CPL_X			1
91*4882a593Smuzhiyun #define RSPD_TYPE_INTR_X		2
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun /* Congestion Manager Definitions.
94*4882a593Smuzhiyun  */
95*4882a593Smuzhiyun #define CONMCTXT_CNGTPMODE_S		19
96*4882a593Smuzhiyun #define CONMCTXT_CNGTPMODE_V(x)		((x) << CONMCTXT_CNGTPMODE_S)
97*4882a593Smuzhiyun #define CONMCTXT_CNGCHMAP_S		0
98*4882a593Smuzhiyun #define CONMCTXT_CNGCHMAP_V(x)		((x) << CONMCTXT_CNGCHMAP_S)
99*4882a593Smuzhiyun #define CONMCTXT_CNGTPMODE_CHANNEL_X	2
100*4882a593Smuzhiyun #define CONMCTXT_CNGTPMODE_QUEUE_X	1
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun /* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
103*4882a593Smuzhiyun  * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
104*4882a593Smuzhiyun  * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
105*4882a593Smuzhiyun  * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
106*4882a593Smuzhiyun  * we have a Going To Sleep register at offsets 8x+4.
107*4882a593Smuzhiyun  *
108*4882a593Smuzhiyun  * As noted above, we have many instances of the Simple Doorbell and Going To
109*4882a593Smuzhiyun  * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
110*4882a593Smuzhiyun  * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
111*4882a593Smuzhiyun  * avoid buffering of the writes to the Simple Doorbell and we want to use a
112*4882a593Smuzhiyun  * non-contiguous offset for the Going To Sleep writes in order to avoid
113*4882a593Smuzhiyun  * possible combining between them.
114*4882a593Smuzhiyun  */
115*4882a593Smuzhiyun #define SGE_UDB_SIZE		128
116*4882a593Smuzhiyun #define SGE_UDB_KDOORBELL	8
117*4882a593Smuzhiyun #define SGE_UDB_GTS		20
118*4882a593Smuzhiyun #define SGE_UDB_WCDOORBELL	64
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun /* CIM register field values.
121*4882a593Smuzhiyun  */
122*4882a593Smuzhiyun #define X_MBOWNER_FW			1
123*4882a593Smuzhiyun #define X_MBOWNER_PL			2
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun /* PCI-E definitions */
126*4882a593Smuzhiyun #define WINDOW_SHIFT_X		10
127*4882a593Smuzhiyun #define PCIEOFST_SHIFT_X	10
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun /* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
130*4882a593Smuzhiyun  * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
131*4882a593Smuzhiyun  * selects for a particular field being present.  These fields, when present
132*4882a593Smuzhiyun  * in the Compressed Filter Tuple, have the following widths in bits.
133*4882a593Smuzhiyun  */
134*4882a593Smuzhiyun #define FT_FCOE_W                       1
135*4882a593Smuzhiyun #define FT_PORT_W                       3
136*4882a593Smuzhiyun #define FT_VNIC_ID_W                    17
137*4882a593Smuzhiyun #define FT_VLAN_W                       17
138*4882a593Smuzhiyun #define FT_TOS_W                        8
139*4882a593Smuzhiyun #define FT_PROTOCOL_W                   8
140*4882a593Smuzhiyun #define FT_ETHERTYPE_W                  16
141*4882a593Smuzhiyun #define FT_MACMATCH_W                   9
142*4882a593Smuzhiyun #define FT_MPSHITTYPE_W                 3
143*4882a593Smuzhiyun #define FT_FRAGMENTATION_W              1
144*4882a593Smuzhiyun 
145*4882a593Smuzhiyun /* Some of the Compressed Filter Tuple fields have internal structure.  These
146*4882a593Smuzhiyun  * bit shifts/masks describe those structures.  All shifts are relative to the
147*4882a593Smuzhiyun  * base position of the fields within the Compressed Filter Tuple
148*4882a593Smuzhiyun  */
149*4882a593Smuzhiyun #define FT_VLAN_VLD_S                   16
150*4882a593Smuzhiyun #define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
151*4882a593Smuzhiyun #define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun #define FT_VNID_ID_VF_S                 0
154*4882a593Smuzhiyun #define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
155*4882a593Smuzhiyun 
156*4882a593Smuzhiyun #define FT_VNID_ID_PF_S                 7
157*4882a593Smuzhiyun #define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
158*4882a593Smuzhiyun 
159*4882a593Smuzhiyun #define FT_VNID_ID_VLD_S                16
160*4882a593Smuzhiyun #define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
161*4882a593Smuzhiyun 
162*4882a593Smuzhiyun #endif /* __T4_VALUES_H__ */
163