1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Applied Micro X-Gene SoC Ethernet Classifier structures
4 * Copyright (c) 2016, Applied Micro Circuits Corporation
5 * Authors: Khuong Dinh <kdinh@apm.com>
6 * Tanmay Inamdar <tinamdar@apm.com>
7 * Iyappan Subramanian <isubramanian@apm.com>
10 #ifndef __XGENE_ENET_CLE_H__
11 #define __XGENE_ENET_CLE_H__
14 #include <linux/random.h>
16 /* Register offsets */
19 #define INDCMD_STATUS 0x0c
20 #define DATA_RAM0 0x10
23 #define DFCLSRESDBPTR0 0x0108
24 #define DFCLSRESDB00 0x010c
25 #define RSS_CTRL0 0x0000013c
27 #define CLE_CMD_TO 10 /* ms */
28 #define CLE_PKTRAM_SIZE 256 /* bytes */
29 #define CLE_PORT_OFFSET 0x200
30 #define CLE_DRAM_REGS 17
32 #define CLE_DN_TYPE_LEN 2
33 #define CLE_DN_TYPE_POS 0
34 #define CLE_DN_LASTN_LEN 1
35 #define CLE_DN_LASTN_POS 2
36 #define CLE_DN_HLS_LEN 1
37 #define CLE_DN_HLS_POS 3
38 #define CLE_DN_EXT_LEN 2
39 #define CLE_DN_EXT_POS 4
40 #define CLE_DN_BSTOR_LEN 2
41 #define CLE_DN_BSTOR_POS 6
42 #define CLE_DN_SBSTOR_LEN 2
43 #define CLE_DN_SBSTOR_POS 8
44 #define CLE_DN_RPTR_LEN 12
45 #define CLE_DN_RPTR_POS 12
47 #define CLE_BR_VALID_LEN 1
48 #define CLE_BR_VALID_POS 0
49 #define CLE_BR_NPPTR_LEN 9
50 #define CLE_BR_NPPTR_POS 1
51 #define CLE_BR_JB_LEN 1
52 #define CLE_BR_JB_POS 10
53 #define CLE_BR_JR_LEN 1
54 #define CLE_BR_JR_POS 11
55 #define CLE_BR_OP_LEN 3
56 #define CLE_BR_OP_POS 12
57 #define CLE_BR_NNODE_LEN 9
58 #define CLE_BR_NNODE_POS 15
59 #define CLE_BR_NBR_LEN 5
60 #define CLE_BR_NBR_POS 24
62 #define CLE_BR_DATA_LEN 16
63 #define CLE_BR_DATA_POS 0
64 #define CLE_BR_MASK_LEN 16
65 #define CLE_BR_MASK_POS 16
67 #define CLE_KN_PRIO_POS 0
68 #define CLE_KN_PRIO_LEN 3
69 #define CLE_KN_RPTR_POS 3
70 #define CLE_KN_RPTR_LEN 10
71 #define CLE_TYPE_POS 0
72 #define CLE_TYPE_LEN 2
74 #define CLE_DROP_POS 28
75 #define CLE_DROP_LEN 1
76 #define CLE_DSTQIDL_POS 25
77 #define CLE_DSTQIDL_LEN 7
78 #define CLE_DSTQIDH_POS 0
79 #define CLE_DSTQIDH_LEN 5
80 #define CLE_FPSEL_POS 21
81 #define CLE_FPSEL_LEN 4
82 #define CLE_NFPSEL_POS 17
83 #define CLE_NFPSEL_LEN 4
84 #define CLE_PRIORITY_POS 5
85 #define CLE_PRIORITY_LEN 3
92 enum xgene_cle_ptree_nodes
{
102 enum xgene_cle_byte_store
{
109 /* Preclassification operation types */
110 enum xgene_cle_node_type
{
117 /* Preclassification operation types */
118 enum xgene_cle_op_type
{
127 enum xgene_cle_parser
{
134 #define XGENE_CLE_DRAM(type) (((type) & 0xf) << 28)
135 enum xgene_cle_dram_type
{
144 enum xgene_cle_cmd_type
{
148 CLE_CMD_AVL_DEL
= 16,
149 CLE_CMD_AVL_SRCH
= 32
152 enum xgene_cle_ipv4_rss_hashtype
{
157 enum xgene_cle_prot_type
{
164 enum xgene_cle_prot_version
{
168 enum xgene_cle_ptree_dbptrs
{
175 /* RSS sideband signal info */
176 #define SB_IPFRAG_POS 0
177 #define SB_IPFRAG_LEN 1
178 #define SB_IPPROT_POS 1
179 #define SB_IPPROT_LEN 2
180 #define SB_IPVER_POS 3
181 #define SB_IPVER_LEN 1
182 #define SB_HDRLEN_POS 4
183 #define SB_HDRLEN_LEN 12
185 /* RSS indirection table */
186 #define XGENE_CLE_IDT_ENTRIES 128
187 #define IDT_DSTQID_POS 0
188 #define IDT_DSTQID_LEN 12
189 #define IDT_FPSEL_POS 12
190 #define IDT_FPSEL_LEN 5
191 #define IDT_NFPSEL_POS 17
192 #define IDT_NFPSEL_LEN 5
193 #define IDT_FPSEL1_POS 12
194 #define IDT_FPSEL1_LEN 4
195 #define IDT_NFPSEL1_POS 16
196 #define IDT_NFPSEL1_LEN 4
198 struct xgene_cle_ptree_branch
{
200 u16 next_packet_pointer
;
210 struct xgene_cle_ptree_ewdn
{
216 u8 search_byte_store
;
219 struct xgene_cle_ptree_branch branch
[6];
222 struct xgene_cle_ptree_key
{
227 struct xgene_cle_ptree_kn
{
230 struct xgene_cle_ptree_key key
[32];
233 struct xgene_cle_dbptr
{
253 u8 cle_insert_timestamp
;
261 u8 mirror_nxtfpsel_msb
;
268 struct xgene_cle_ptree
{
269 struct xgene_cle_ptree_kn
*kn
;
270 struct xgene_cle_dbptr
*dbptr
;
278 struct xgene_enet_cle
{
280 struct xgene_cle_ptree ptree
;
281 enum xgene_cle_parser active_parser
;
288 extern const struct xgene_cle_ops xgene_cle3in_ops
;
290 #endif /* __XGENE_ENET_CLE_H__ */