xref: /linux/drivers/net/ethernet/chelsio/cxgb4/t4_values.h (revision 3ccc6cf74d8c0059ae076aee3bf83c9124815404)
1f612b815SHariprasad Shenai /*
2f612b815SHariprasad Shenai  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3f612b815SHariprasad Shenai  *
4f612b815SHariprasad Shenai  * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
5f612b815SHariprasad Shenai  *
6f612b815SHariprasad Shenai  * This software is available to you under a choice of one of two
7f612b815SHariprasad Shenai  * licenses.  You may choose to be licensed under the terms of the GNU
8f612b815SHariprasad Shenai  * General Public License (GPL) Version 2, available from the file
9f612b815SHariprasad Shenai  * COPYING in the main directory of this source tree, or the
10f612b815SHariprasad Shenai  * OpenIB.org BSD license below:
11f612b815SHariprasad Shenai  *
12f612b815SHariprasad Shenai  *     Redistribution and use in source and binary forms, with or
13f612b815SHariprasad Shenai  *     without modification, are permitted provided that the following
14f612b815SHariprasad Shenai  *     conditions are met:
15f612b815SHariprasad Shenai  *
16f612b815SHariprasad Shenai  *      - Redistributions of source code must retain the above
17f612b815SHariprasad Shenai  *        copyright notice, this list of conditions and the following
18f612b815SHariprasad Shenai  *        disclaimer.
19f612b815SHariprasad Shenai  *
20f612b815SHariprasad Shenai  *      - Redistributions in binary form must reproduce the above
21f612b815SHariprasad Shenai  *        copyright notice, this list of conditions and the following
22f612b815SHariprasad Shenai  *        disclaimer in the documentation and/or other materials
23f612b815SHariprasad Shenai  *        provided with the distribution.
24f612b815SHariprasad Shenai  *
25f612b815SHariprasad Shenai  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26f612b815SHariprasad Shenai  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27f612b815SHariprasad Shenai  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28f612b815SHariprasad Shenai  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29f612b815SHariprasad Shenai  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30f612b815SHariprasad Shenai  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31f612b815SHariprasad Shenai  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32f612b815SHariprasad Shenai  * SOFTWARE.
33f612b815SHariprasad Shenai  */
34f612b815SHariprasad Shenai 
35f612b815SHariprasad Shenai #ifndef __T4_VALUES_H__
36f612b815SHariprasad Shenai #define __T4_VALUES_H__
37f612b815SHariprasad Shenai 
38f612b815SHariprasad Shenai /* This file contains definitions for various T4 register value hardware
39f612b815SHariprasad Shenai  * constants.  The types of values encoded here are predominantly those for
40f612b815SHariprasad Shenai  * register fields which control "modal" behavior.  For the most part, we do
41f612b815SHariprasad Shenai  * not include definitions for register fields which are simple numeric
42f612b815SHariprasad Shenai  * metrics, etc.
43f612b815SHariprasad Shenai  */
44f612b815SHariprasad Shenai 
45f612b815SHariprasad Shenai /* SGE register field values.
46f612b815SHariprasad Shenai  */
47f612b815SHariprasad Shenai 
48f612b815SHariprasad Shenai /* CONTROL1 register */
49f612b815SHariprasad Shenai #define RXPKTCPLMODE_SPLIT_X		1
50f612b815SHariprasad Shenai 
51f612b815SHariprasad Shenai #define INGPCIEBOUNDARY_SHIFT_X		5
52f612b815SHariprasad Shenai #define INGPCIEBOUNDARY_32B_X		0
53f612b815SHariprasad Shenai 
54f612b815SHariprasad Shenai #define INGPADBOUNDARY_SHIFT_X		5
55f612b815SHariprasad Shenai 
56f612b815SHariprasad Shenai /* CONTROL2 register */
57f612b815SHariprasad Shenai #define INGPACKBOUNDARY_SHIFT_X		5
58f612b815SHariprasad Shenai #define INGPACKBOUNDARY_16B_X		0
59f612b815SHariprasad Shenai 
60f612b815SHariprasad Shenai /* GTS register */
61f612b815SHariprasad Shenai #define SGE_TIMERREGS			6
623a336cb1SHariprasad Shenai #define TIMERREG_COUNTER0_X		0
63f612b815SHariprasad Shenai 
641ecc7b7aSHariprasad Shenai #define FETCHBURSTMIN_64B_X		2
651ecc7b7aSHariprasad Shenai 
66*3ccc6cf7SHariprasad Shenai #define FETCHBURSTMAX_256B_X		2
671ecc7b7aSHariprasad Shenai #define FETCHBURSTMAX_512B_X		3
681ecc7b7aSHariprasad Shenai 
691ecc7b7aSHariprasad Shenai #define HOSTFCMODE_STATUS_PAGE_X	2
701ecc7b7aSHariprasad Shenai 
711ecc7b7aSHariprasad Shenai #define CIDXFLUSHTHRESH_32_X		5
721ecc7b7aSHariprasad Shenai 
731ecc7b7aSHariprasad Shenai #define UPDATEDELIVERY_INTERRUPT_X	1
741ecc7b7aSHariprasad Shenai 
751ecc7b7aSHariprasad Shenai #define RSPD_TYPE_FLBUF_X		0
761ecc7b7aSHariprasad Shenai #define RSPD_TYPE_CPL_X			1
771ecc7b7aSHariprasad Shenai #define RSPD_TYPE_INTR_X		2
781ecc7b7aSHariprasad Shenai 
79b8b1ae99SHariprasad Shenai /* Congestion Manager Definitions.
80b8b1ae99SHariprasad Shenai  */
81b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_S		19
82b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_V(x)		((x) << CONMCTXT_CNGTPMODE_S)
83b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGCHMAP_S		0
84b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGCHMAP_V(x)		((x) << CONMCTXT_CNGCHMAP_S)
85b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_CHANNEL_X	2
86b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_QUEUE_X	1
87b8b1ae99SHariprasad Shenai 
88f612b815SHariprasad Shenai /* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
89f612b815SHariprasad Shenai  * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
90f612b815SHariprasad Shenai  * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
91f612b815SHariprasad Shenai  * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
92f612b815SHariprasad Shenai  * we have a Going To Sleep register at offsets 8x+4.
93f612b815SHariprasad Shenai  *
94f612b815SHariprasad Shenai  * As noted above, we have many instances of the Simple Doorbell and Going To
95f612b815SHariprasad Shenai  * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
96f612b815SHariprasad Shenai  * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
97f612b815SHariprasad Shenai  * avoid buffering of the writes to the Simple Doorbell and we want to use a
98f612b815SHariprasad Shenai  * non-contiguous offset for the Going To Sleep writes in order to avoid
99f612b815SHariprasad Shenai  * possible combining between them.
100f612b815SHariprasad Shenai  */
101f612b815SHariprasad Shenai #define SGE_UDB_SIZE		128
102f612b815SHariprasad Shenai #define SGE_UDB_KDOORBELL	8
103f612b815SHariprasad Shenai #define SGE_UDB_GTS		20
104f612b815SHariprasad Shenai #define SGE_UDB_WCDOORBELL	64
105f612b815SHariprasad Shenai 
106bf7c781dSHariprasad Shenai /* CIM register field values.
107bf7c781dSHariprasad Shenai  */
108bf7c781dSHariprasad Shenai #define X_MBOWNER_FW			1
109bf7c781dSHariprasad Shenai #define X_MBOWNER_PL			2
110bf7c781dSHariprasad Shenai 
111f061de42SHariprasad Shenai /* PCI-E definitions */
112f061de42SHariprasad Shenai #define WINDOW_SHIFT_X		10
113f061de42SHariprasad Shenai #define PCIEOFST_SHIFT_X	10
114f061de42SHariprasad Shenai 
1150d804338SHariprasad Shenai /* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
1160d804338SHariprasad Shenai  * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
1170d804338SHariprasad Shenai  * selects for a particular field being present.  These fields, when present
1180d804338SHariprasad Shenai  * in the Compressed Filter Tuple, have the following widths in bits.
1190d804338SHariprasad Shenai  */
1200d804338SHariprasad Shenai #define FT_FCOE_W                       1
1210d804338SHariprasad Shenai #define FT_PORT_W                       3
1220d804338SHariprasad Shenai #define FT_VNIC_ID_W                    17
1230d804338SHariprasad Shenai #define FT_VLAN_W                       17
1240d804338SHariprasad Shenai #define FT_TOS_W                        8
1250d804338SHariprasad Shenai #define FT_PROTOCOL_W                   8
1260d804338SHariprasad Shenai #define FT_ETHERTYPE_W                  16
1270d804338SHariprasad Shenai #define FT_MACMATCH_W                   9
1280d804338SHariprasad Shenai #define FT_MPSHITTYPE_W                 3
1290d804338SHariprasad Shenai #define FT_FRAGMENTATION_W              1
1300d804338SHariprasad Shenai 
1310d804338SHariprasad Shenai /* Some of the Compressed Filter Tuple fields have internal structure.  These
1320d804338SHariprasad Shenai  * bit shifts/masks describe those structures.  All shifts are relative to the
1330d804338SHariprasad Shenai  * base position of the fields within the Compressed Filter Tuple
1340d804338SHariprasad Shenai  */
1350d804338SHariprasad Shenai #define FT_VLAN_VLD_S                   16
1360d804338SHariprasad Shenai #define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
1370d804338SHariprasad Shenai #define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
1380d804338SHariprasad Shenai 
1390d804338SHariprasad Shenai #define FT_VNID_ID_VF_S                 0
1400d804338SHariprasad Shenai #define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
1410d804338SHariprasad Shenai 
1420d804338SHariprasad Shenai #define FT_VNID_ID_PF_S                 7
1430d804338SHariprasad Shenai #define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
1440d804338SHariprasad Shenai 
1450d804338SHariprasad Shenai #define FT_VNID_ID_VLD_S                16
1460d804338SHariprasad Shenai #define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
1470d804338SHariprasad Shenai 
148f612b815SHariprasad Shenai #endif /* __T4_VALUES_H__ */
149