1 /* Applied Micro X-Gene SoC Ethernet Classifier structures
3 * Copyright (c) 2016, Applied Micro Circuits Corporation
4 * Authors: Khuong Dinh <kdinh@apm.com>
5 * Tanmay Inamdar <tinamdar@apm.com>
6 * Iyappan Subramanian <isubramanian@apm.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __XGENE_ENET_CLE_H__
23 #define __XGENE_ENET_CLE_H__
26 #include <linux/random.h>
28 /* Register offsets */
31 #define INDCMD_STATUS 0x0c
32 #define DATA_RAM0 0x10
35 #define DFCLSRESDBPTR0 0x0108
36 #define DFCLSRESDB00 0x010c
37 #define RSS_CTRL0 0x0000013c
39 #define CLE_CMD_TO 10 /* ms */
40 #define CLE_PKTRAM_SIZE 256 /* bytes */
41 #define CLE_PORT_OFFSET 0x200
42 #define CLE_DRAM_REGS 17
44 #define CLE_DN_TYPE_LEN 2
45 #define CLE_DN_TYPE_POS 0
46 #define CLE_DN_LASTN_LEN 1
47 #define CLE_DN_LASTN_POS 2
48 #define CLE_DN_HLS_LEN 1
49 #define CLE_DN_HLS_POS 3
50 #define CLE_DN_EXT_LEN 2
51 #define CLE_DN_EXT_POS 4
52 #define CLE_DN_BSTOR_LEN 2
53 #define CLE_DN_BSTOR_POS 6
54 #define CLE_DN_SBSTOR_LEN 2
55 #define CLE_DN_SBSTOR_POS 8
56 #define CLE_DN_RPTR_LEN 12
57 #define CLE_DN_RPTR_POS 12
59 #define CLE_BR_VALID_LEN 1
60 #define CLE_BR_VALID_POS 0
61 #define CLE_BR_NPPTR_LEN 9
62 #define CLE_BR_NPPTR_POS 1
63 #define CLE_BR_JB_LEN 1
64 #define CLE_BR_JB_POS 10
65 #define CLE_BR_JR_LEN 1
66 #define CLE_BR_JR_POS 11
67 #define CLE_BR_OP_LEN 3
68 #define CLE_BR_OP_POS 12
69 #define CLE_BR_NNODE_LEN 9
70 #define CLE_BR_NNODE_POS 15
71 #define CLE_BR_NBR_LEN 5
72 #define CLE_BR_NBR_POS 24
74 #define CLE_BR_DATA_LEN 16
75 #define CLE_BR_DATA_POS 0
76 #define CLE_BR_MASK_LEN 16
77 #define CLE_BR_MASK_POS 16
79 #define CLE_KN_PRIO_POS 0
80 #define CLE_KN_PRIO_LEN 3
81 #define CLE_KN_RPTR_POS 3
82 #define CLE_KN_RPTR_LEN 10
83 #define CLE_TYPE_POS 0
84 #define CLE_TYPE_LEN 2
86 #define CLE_DROP_POS 28
87 #define CLE_DROP_LEN 1
88 #define CLE_DSTQIDL_POS 25
89 #define CLE_DSTQIDL_LEN 7
90 #define CLE_DSTQIDH_POS 0
91 #define CLE_DSTQIDH_LEN 5
92 #define CLE_FPSEL_POS 21
93 #define CLE_FPSEL_LEN 4
94 #define CLE_NFPSEL_POS 17
95 #define CLE_NFPSEL_LEN 4
96 #define CLE_PRIORITY_POS 5
97 #define CLE_PRIORITY_LEN 3
104 enum xgene_cle_ptree_nodes
{
109 RSS_IPV4_OTHERS_NODE
,
114 enum xgene_cle_byte_store
{
121 /* Preclassification operation types */
122 enum xgene_cle_node_type
{
129 /* Preclassification operation types */
130 enum xgene_cle_op_type
{
139 enum xgene_cle_parser
{
146 #define XGENE_CLE_DRAM(type) (((type) & 0xf) << 28)
147 enum xgene_cle_dram_type
{
156 enum xgene_cle_cmd_type
{
160 CLE_CMD_AVL_DEL
= 16,
161 CLE_CMD_AVL_SRCH
= 32
164 enum xgene_cle_ipv4_rss_hashtype
{
169 enum xgene_cle_prot_type
{
176 enum xgene_cle_prot_version
{
180 enum xgene_cle_ptree_dbptrs
{
187 /* RSS sideband signal info */
188 #define SB_IPFRAG_POS 0
189 #define SB_IPFRAG_LEN 1
190 #define SB_IPPROT_POS 1
191 #define SB_IPPROT_LEN 2
192 #define SB_IPVER_POS 3
193 #define SB_IPVER_LEN 1
194 #define SB_HDRLEN_POS 4
195 #define SB_HDRLEN_LEN 12
197 /* RSS indirection table */
198 #define XGENE_CLE_IDT_ENTRIES 128
199 #define IDT_DSTQID_POS 0
200 #define IDT_DSTQID_LEN 12
201 #define IDT_FPSEL_POS 12
202 #define IDT_FPSEL_LEN 5
203 #define IDT_NFPSEL_POS 17
204 #define IDT_NFPSEL_LEN 5
205 #define IDT_FPSEL1_POS 12
206 #define IDT_FPSEL1_LEN 4
207 #define IDT_NFPSEL1_POS 16
208 #define IDT_NFPSEL1_LEN 4
210 struct xgene_cle_ptree_branch
{
212 u16 next_packet_pointer
;
222 struct xgene_cle_ptree_ewdn
{
228 u8 search_byte_store
;
231 struct xgene_cle_ptree_branch branch
[6];
234 struct xgene_cle_ptree_key
{
239 struct xgene_cle_ptree_kn
{
242 struct xgene_cle_ptree_key key
[32];
245 struct xgene_cle_dbptr
{
265 u8 cle_insert_timestamp
;
273 u8 mirror_nxtfpsel_msb
;
280 struct xgene_cle_ptree
{
281 struct xgene_cle_ptree_kn
*kn
;
282 struct xgene_cle_dbptr
*dbptr
;
290 struct xgene_enet_cle
{
292 struct xgene_cle_ptree ptree
;
293 enum xgene_cle_parser active_parser
;
300 extern const struct xgene_cle_ops xgene_cle3in_ops
;
302 #endif /* __XGENE_ENET_CLE_H__ */