Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #ifndef _ROC_NPC_PRIV_H_
6 : : #define _ROC_NPC_PRIV_H_
7 : :
8 : : #define NPC_IH_LENGTH 8
9 : : #define NPC_TPID_LENGTH 2
10 : : #define NPC_HIGIG2_LENGTH 16
11 : : #define NPC_MAX_RAW_ITEM_LEN 16
12 : : #define NPC_COUNTER_NONE (-1)
13 : :
14 : : #define NPC_RSS_GRPS 8
15 : :
16 : : #define NPC_ACTION_FLAG_DEFAULT 0xffff
17 : :
18 : : #define NPC_PFVF_FUNC_MASK 0x3FF
19 : :
20 : : /* 32 bytes from LDATA_CFG & 32 bytes from FLAGS_CFG */
21 : : #define NPC_MAX_EXTRACT_DATA_LEN (64)
22 : : #define NPC_MAX_EXTRACT_HW_LEN (4 * NPC_MAX_EXTRACT_DATA_LEN)
23 : : #define NPC_LDATA_LFLAG_LEN (16)
24 : : #define NPC_MAX_KEY_NIBBLES (31)
25 : :
26 : : /* Nibble offsets */
27 : : #define NPC_LAYER_KEYX_SZ (3)
28 : : #define NPC_PARSE_KEX_S_LA_OFFSET (7)
29 : : #define NPC_PARSE_KEX_S_LID_OFFSET(lid) \
30 : : ((((lid) - (NPC_LID_LA)) * NPC_LAYER_KEYX_SZ) + \
31 : : NPC_PARSE_KEX_S_LA_OFFSET)
32 : :
33 : : #define NPC_LAYER_KEYX_SZ_CN20K (2)
34 : : #define NPC_PARSE_KEX_S_LID_OFFSET_CN20K(lid) \
35 : : ((((lid) - (NPC_LID_LA)) * NPC_LAYER_KEYX_SZ_CN20K) + NPC_PARSE_KEX_S_LA_OFFSET)
36 : :
37 : : /* This mark value indicates flag action */
38 : : #define NPC_FLOW_FLAG_VAL (0xffff)
39 : :
40 : : #define NPC_RX_ACT_MATCH_OFFSET (40)
41 : : #define NPC_RX_ACT_MATCH_MASK (0xFFFF)
42 : :
43 : : #define NPC_RSS_ACT_GRP_OFFSET (20)
44 : : #define NPC_RSS_ACT_ALG_OFFSET (56)
45 : : #define NPC_RSS_ACT_GRP_MASK (0xFFFFF)
46 : : #define NPC_RSS_ACT_ALG_MASK (0x1F)
47 : :
48 : : #define NPC_MCAM_KEX_FIELD_MAX 23
49 : : #define NPC_MCAM_MAX_PROTO_FIELDS (NPC_MCAM_KEX_FIELD_MAX + 1)
50 : : #if defined(ROC_PLATFORM_CN20K)
51 : : #define NPC_MCAM_KEY_X4_WORDS 8 /* Number of 64-bit words */
52 : : #else
53 : : #define NPC_MCAM_KEY_X4_WORDS 7 /* Number of 64-bit words */
54 : : #endif
55 : :
56 : : #define NPC_RVUPF_MAX_9XXX 0x10 /* HRM: RVU_PRIV_CONST */
57 : : #define NPC_RVUPF_MAX_98XX 0x18 /* HRM: RVU_PRIV_CONST */
58 : : #define NPC_RVUPF_MAX_10XX 0x20 /* HRM: RVU_PRIV_CONST */
59 : : #define NPC_NIXLF_MAX 0x80 /* HRM: NIX_AF_CONST2 */
60 : : #define NPC_MCAME_PER_PF 3 /* DRV: RSVD_MCAM_ENTRIES_PER_PF */
61 : : #define NPC_MCAME_PER_LF 1 /* DRV: RSVD_MCAM_ENTRIES_PER_NIXLF */
62 : : #define NPC_NIXLF_MAX_98XX (2 * NPC_NIXLF_MAX) /*2 NIXLFs */
63 : : #define NPC_MCAME_RESVD_9XXX \
64 : : (NPC_NIXLF_MAX * NPC_MCAME_PER_LF + \
65 : : (NPC_RVUPF_MAX_9XXX - 1) * NPC_MCAME_PER_PF)
66 : :
67 : : #define NPC_MCAME_RESVD_10XX \
68 : : (NPC_NIXLF_MAX * NPC_MCAME_PER_LF + \
69 : : (NPC_RVUPF_MAX_10XX - 1) * NPC_MCAME_PER_PF)
70 : :
71 : : #define NPC_MCAME_RESVD_98XX \
72 : : (NPC_NIXLF_MAX_98XX * NPC_MCAME_PER_LF + \
73 : : (NPC_RVUPF_MAX_98XX - 1) * NPC_MCAME_PER_PF)
74 : :
75 : : #define NPC_ACTION_MAX_VLAN_PARAMS 3
76 : : #define NPC_ACTION_MAX_VLANS_STRIPPED 2
77 : :
78 : : #define NPC_LTYPE_OFFSET_START 7
79 : : /* LB OFFSET : START + LA (2b flags + 1b ltype) + LB (2b flags) */
80 : : #define NPC_LTYPE_LB_OFFSET (NPC_LTYPE_OFFSET_START + 5)
81 : : #define NPC_LFLAG_LB_OFFSET (NPC_LTYPE_OFFSET_START + 3)
82 : : /* LC OFFSET : START + LA (2b flags + 1b ltype) + LB (2b flags + 1b ltype) + LC
83 : : * (2b flags)
84 : : */
85 : : #define NPC_LFLAG_LC_OFFSET (NPC_LTYPE_OFFSET_START + 6)
86 : : #define NPC_LTYPE_LC_OFFSET (NPC_LTYPE_OFFSET_START + 8)
87 : :
88 : : /* LB OFFSET : START + LA (1b flags + 1b ltype) + LB (1b flags) */
89 : : #define NPC_CN20K_LTYPE_LB_OFFSET (NPC_LTYPE_OFFSET_START + 3)
90 : : #define NPC_CN20K_LFLAG_LB_OFFSET (NPC_LTYPE_OFFSET_START + 2)
91 : :
92 : : /* LC OFFSET : START + LA (1b flags + 1b ltype) + LB (1b flags + 1b ltype) + LC
93 : : * (1b flags)
94 : : */
95 : : #define NPC_CN20K_LFLAG_LC_OFFSET (NPC_LTYPE_OFFSET_START + 4)
96 : : #define NPC_CN20K_LTYPE_LC_OFFSET (NPC_LTYPE_OFFSET_START + 5)
97 : :
98 : : #define CN10K_SDP_CH_START 0x80
99 : : #define CN10K_SDP_CH_MASK 0xF80
100 : :
101 : : struct npc_action_vtag_info {
102 : : uint16_t vlan_id;
103 : : uint16_t vlan_ethtype;
104 : : uint8_t vlan_pcp;
105 : : };
106 : :
107 : : enum npc_err_status {
108 : : NPC_ERR_PARAM = -1024,
109 : : NPC_ERR_NO_MEM,
110 : : NPC_ERR_INVALID_SPEC,
111 : : NPC_ERR_INVALID_MASK,
112 : : NPC_ERR_INVALID_RANGE,
113 : : NPC_ERR_INVALID_KEX,
114 : : NPC_ERR_INVALID_SIZE,
115 : : NPC_ERR_INTERNAL,
116 : : NPC_ERR_MCAM_ALLOC,
117 : : NPC_ERR_ACTION_NOTSUP,
118 : : NPC_ERR_PATTERN_NOTSUP,
119 : : };
120 : :
121 : : enum npc_mcam_intf { NPC_MCAM_RX, NPC_MCAM_TX };
122 : :
123 : : typedef union npc_kex_cap_terms_t {
124 : : /** Packet Matching Rule term fields */
125 : : struct {
126 : : /** Total length of received packet */
127 : : uint64_t len : 1;
128 : : /** Initial (outer) Ethertype only */
129 : : uint64_t ethtype_0 : 1;
130 : : /** Ethertype of most inner VLAN tag */
131 : : uint64_t ethtype_x : 1;
132 : : /** First VLAN ID (outer) */
133 : : uint64_t vlan_id_0 : 1;
134 : : /** Last VLAN ID (inner) */
135 : : uint64_t vlan_id_x : 1;
136 : : /** PCP in the first VLAN header */
137 : : uint64_t vlan_pcp_0 : 1;
138 : : /** destination MAC address */
139 : : uint64_t dmac : 1;
140 : : /** IP Protocol or IPv6 Next Header */
141 : : uint64_t ip_proto : 1;
142 : : /** DSCP in IP header */
143 : : uint64_t ip_dscp : 1;
144 : : /** Destination UDP port, implies IPPROTO=17 */
145 : : uint64_t udp_dport : 1;
146 : : /** Destination TCP port implies IPPROTO=6 */
147 : : uint64_t tcp_dport : 1;
148 : : /** Source UDP Port */
149 : : uint64_t udp_sport : 1;
150 : : /** Source TCP port */
151 : : uint64_t tcp_sport : 1;
152 : : /** Source IP address */
153 : : uint64_t sip_addr : 1;
154 : : /** Destination IP address */
155 : : uint64_t dip_addr : 1;
156 : : /** Source IP address */
157 : : uint64_t sip6_addr : 1;
158 : : /** Destination IP address */
159 : : uint64_t dip6_addr : 1;
160 : : /** IPsec session identifier */
161 : : uint64_t ipsec_spi : 1;
162 : : /** NVGRE/VXLAN network identifier */
163 : : uint64_t ld_vni : 1;
164 : : /** Custom frame match rule. PMR offset is counted from
165 : : * the start of the packet.
166 : : */
167 : : uint64_t custom_frame : 1;
168 : : /** Custom layer 3 match rule. PMR offset is counted from
169 : : * the start of layer 3 in the packet.
170 : : */
171 : : uint64_t custom_l3 : 1;
172 : : /** IGMP Group address */
173 : : uint64_t igmp_grp_addr : 1;
174 : : /** ICMP identifier */
175 : : uint64_t icmp_id : 1;
176 : : /** ICMP type */
177 : : uint64_t icmp_type : 1;
178 : : /** ICMP code */
179 : : uint64_t icmp_code : 1;
180 : : /** Source SCTP port */
181 : : uint64_t sctp_sport : 1;
182 : : /** Destination SCTP port */
183 : : uint64_t sctp_dport : 1;
184 : : /** GTPv1 tunnel endpoint identifier */
185 : : uint64_t gtpv1_teid : 1;
186 : : } bit;
187 : :
188 : : /** All bits of the bit field structure */
189 : : uint64_t all_bits;
190 : :
191 : : } npc_kex_cap_terms_t;
192 : :
193 : : struct npc_parse_item_info {
194 : : const void *def_mask; /* default mask */
195 : : void *hw_mask; /* hardware supported mask */
196 : : int len; /* length of item */
197 : : uint8_t hw_hdr_len; /* Extra data len at each layer*/
198 : : const void *spec; /* spec to use, NULL implies match any */
199 : : const void *mask; /* mask to use */
200 : : };
201 : :
202 : : struct npc_parse_state {
203 : : struct npc *npc;
204 : : const struct roc_npc_item_info *pattern;
205 : : const struct roc_npc_item_info *last_pattern;
206 : : struct roc_npc_flow *flow;
207 : : uint8_t nix_intf;
208 : : uint8_t tunnel;
209 : : uint8_t terminate;
210 : : uint8_t layer_mask;
211 : : uint8_t lt[NPC_MAX_LID];
212 : : uint8_t flags[NPC_MAX_LID];
213 : : bool has_eth_type;
214 : : bool is_second_pass_rule;
215 : : bool set_ipv6ext_ltype_mask;
216 : : /* adjust ltype in MCAM to match at least one vlan */
217 : : bool set_vlan_ltype_mask;
218 : : uint8_t *mcam_data; /* point to flow->mcam_data + key_len */
219 : : uint8_t *mcam_mask; /* point to flow->mcam_mask + key_len */
220 : : bool is_vf;
221 : : uint16_t dst_pf_func;
222 : : uint16_t nb_tx_queues;
223 : : };
224 : :
225 : : enum npc_kpu_parser_flag {
226 : : NPC_F_NA = 0,
227 : : NPC_F_PKI,
228 : : NPC_F_PKI_VLAN,
229 : : NPC_F_PKI_ETAG,
230 : : NPC_F_PKI_ITAG,
231 : : NPC_F_PKI_MPLS,
232 : : NPC_F_PKI_NSH,
233 : : NPC_F_ETYPE_UNK,
234 : : NPC_F_ETHER_VLAN,
235 : : NPC_F_ETHER_ETAG,
236 : : NPC_F_ETHER_ITAG,
237 : : NPC_F_ETHER_MPLS,
238 : : NPC_F_ETHER_NSH,
239 : : NPC_F_STAG_CTAG,
240 : : NPC_F_STAG_CTAG_UNK,
241 : : NPC_F_STAG_STAG_CTAG,
242 : : NPC_F_STAG_STAG_STAG,
243 : : NPC_F_QINQ_CTAG,
244 : : NPC_F_QINQ_CTAG_UNK,
245 : : NPC_F_QINQ_QINQ_CTAG,
246 : : NPC_F_QINQ_QINQ_QINQ,
247 : : NPC_F_BTAG_ITAG,
248 : : NPC_F_BTAG_ITAG_STAG,
249 : : NPC_F_BTAG_ITAG_CTAG,
250 : : NPC_F_BTAG_ITAG_UNK,
251 : : NPC_F_ETAG_CTAG,
252 : : NPC_F_ETAG_BTAG_ITAG,
253 : : NPC_F_ETAG_STAG,
254 : : NPC_F_ETAG_QINQ,
255 : : NPC_F_ETAG_ITAG,
256 : : NPC_F_ETAG_ITAG_STAG,
257 : : NPC_F_ETAG_ITAG_CTAG,
258 : : NPC_F_ETAG_ITAG_UNK,
259 : : NPC_F_ITAG_STAG_CTAG,
260 : : NPC_F_ITAG_STAG,
261 : : NPC_F_ITAG_CTAG,
262 : : NPC_F_MPLS_4_LABELS,
263 : : NPC_F_MPLS_3_LABELS,
264 : : NPC_F_MPLS_2_LABELS,
265 : : NPC_F_IP_HAS_OPTIONS,
266 : : NPC_F_IP_IP_IN_IP,
267 : : NPC_F_IP_6TO4,
268 : : NPC_F_IP_MPLS_IN_IP,
269 : : NPC_F_IP_UNK_PROTO,
270 : : NPC_F_IP_IP_IN_IP_HAS_OPTIONS,
271 : : NPC_F_IP_6TO4_HAS_OPTIONS,
272 : : NPC_F_IP_MPLS_IN_IP_HAS_OPTIONS,
273 : : NPC_F_IP_UNK_PROTO_HAS_OPTIONS,
274 : : NPC_F_IP6_HAS_EXT,
275 : : NPC_F_IP6_TUN_IP6,
276 : : NPC_F_IP6_MPLS_IN_IP,
277 : : NPC_F_TCP_HAS_OPTIONS,
278 : : NPC_F_TCP_HTTP,
279 : : NPC_F_TCP_HTTPS,
280 : : NPC_F_TCP_PPTP,
281 : : NPC_F_TCP_UNK_PORT,
282 : : NPC_F_TCP_HTTP_HAS_OPTIONS,
283 : : NPC_F_TCP_HTTPS_HAS_OPTIONS,
284 : : NPC_F_TCP_PPTP_HAS_OPTIONS,
285 : : NPC_F_TCP_UNK_PORT_HAS_OPTIONS,
286 : : NPC_F_UDP_VXLAN,
287 : : NPC_F_UDP_VXLAN_NOVNI,
288 : : NPC_F_UDP_VXLAN_NOVNI_NSH,
289 : : NPC_F_UDP_VXLANGPE,
290 : : NPC_F_UDP_VXLANGPE_NSH,
291 : : NPC_F_UDP_VXLANGPE_MPLS,
292 : : NPC_F_UDP_VXLANGPE_NOVNI,
293 : : NPC_F_UDP_VXLANGPE_NOVNI_NSH,
294 : : NPC_F_UDP_VXLANGPE_NOVNI_MPLS,
295 : : NPC_F_UDP_VXLANGPE_UNK,
296 : : NPC_F_UDP_VXLANGPE_NONP,
297 : : NPC_F_UDP_GTP_GTPC,
298 : : NPC_F_UDP_GTP_GTPU_G_PDU,
299 : : NPC_F_UDP_GTP_GTPU_UNK,
300 : : NPC_F_UDP_UNK_PORT,
301 : : NPC_F_UDP_GENEVE,
302 : : NPC_F_UDP_GENEVE_OAM,
303 : : NPC_F_UDP_GENEVE_CRI_OPT,
304 : : NPC_F_UDP_GENEVE_OAM_CRI_OPT,
305 : : NPC_F_GRE_NVGRE,
306 : : NPC_F_GRE_HAS_SRE,
307 : : NPC_F_GRE_HAS_CSUM,
308 : : NPC_F_GRE_HAS_KEY,
309 : : NPC_F_GRE_HAS_SEQ,
310 : : NPC_F_GRE_HAS_CSUM_KEY,
311 : : NPC_F_GRE_HAS_CSUM_SEQ,
312 : : NPC_F_GRE_HAS_KEY_SEQ,
313 : : NPC_F_GRE_HAS_CSUM_KEY_SEQ,
314 : : NPC_F_GRE_HAS_ROUTE,
315 : : NPC_F_GRE_UNK_PROTO,
316 : : NPC_F_GRE_VER1,
317 : : NPC_F_GRE_VER1_HAS_SEQ,
318 : : NPC_F_GRE_VER1_HAS_ACK,
319 : : NPC_F_GRE_VER1_HAS_SEQ_ACK,
320 : : NPC_F_GRE_VER1_UNK_PROTO,
321 : : NPC_F_TU_ETHER_UNK,
322 : : NPC_F_TU_ETHER_CTAG,
323 : : NPC_F_TU_ETHER_CTAG_UNK,
324 : : NPC_F_TU_ETHER_STAG_CTAG,
325 : : NPC_F_TU_ETHER_STAG_CTAG_UNK,
326 : : NPC_F_TU_ETHER_STAG,
327 : : NPC_F_TU_ETHER_STAG_UNK,
328 : : NPC_F_TU_ETHER_QINQ_CTAG,
329 : : NPC_F_TU_ETHER_QINQ_CTAG_UNK,
330 : : NPC_F_TU_ETHER_QINQ,
331 : : NPC_F_TU_ETHER_QINQ_UNK,
332 : : NPC_F_LAST /* has to be the last item */
333 : : };
334 : :
335 : : #define NPC_ACTION_TERM \
336 : : (ROC_NPC_ACTION_TYPE_DROP | ROC_NPC_ACTION_TYPE_QUEUE | \
337 : : ROC_NPC_ACTION_TYPE_RSS | ROC_NPC_ACTION_TYPE_DUP | \
338 : : ROC_NPC_ACTION_TYPE_SEC)
339 : :
340 : : struct npc_xtract_info {
341 : : /* Length in bytes of pkt data extracted. len = 0
342 : : * indicates that extraction is disabled.
343 : : */
344 : : uint8_t len;
345 : : uint8_t hdr_off; /* Byte offset of proto hdr: extract_src */
346 : : uint8_t key_off; /* Byte offset in MCAM key where data is placed */
347 : : uint8_t enable; /* Extraction enabled or disabled */
348 : : uint8_t flags_enable; /* Flags extraction enabled */
349 : : uint8_t use_hash; /* Use field hash */
350 : : };
351 : :
352 : : /* Information for a given {LAYER, LTYPE} */
353 : : struct npc_lid_lt_xtract_info {
354 : : /* Info derived from parser configuration */
355 : : uint16_t npc_proto; /* Network protocol identified */
356 : : uint8_t valid_flags_mask; /* Flags applicable */
357 : : uint8_t is_terminating : 1; /* No more parsing */
358 : : struct npc_xtract_info xtract[NPC_MAX_LD];
359 : : };
360 : :
361 : : struct npc_lid_lt_xtract_info_cn20k {
362 : : /* Info derived from parser configuration */
363 : : uint16_t npc_proto; /* Network protocol identified */
364 : : uint8_t valid_flags_mask; /* Flags applicable */
365 : : uint8_t is_terminating : 1; /* No more parsing */
366 : : struct npc_xtract_info xtract;
367 : : };
368 : :
369 : : union npc_kex_ldata_flags_cfg {
370 : : struct {
371 : : uint64_t lid : 3;
372 : : uint64_t rvsd_62_1 : 61;
373 : : } s;
374 : :
375 : : uint64_t i;
376 : : };
377 : :
378 : : #define NPC_MAX_EXTRACTTORS 24
379 : : typedef struct npc_lid_lt_xtract_info_cn20k npc_dxcfg_cn20k_t[NPC_MAX_INTF][NPC_MAX_EXTRACTTORS]
380 : : [NPC_MAX_LT];
381 : : typedef union npc_kex_ldata_flags_cfg npc_lid_cn20k_t[NPC_MAX_INTF][NPC_MAX_EXTRACTTORS];
382 : :
383 : : typedef struct npc_lid_lt_xtract_info npc_dxcfg_t[NPC_MAX_INTF][NPC_MAX_LID]
384 : : [NPC_MAX_LT];
385 : : typedef struct npc_lid_lt_xtract_info npc_fxcfg_t[NPC_MAX_INTF][NPC_MAX_LD]
386 : : [NPC_MAX_LFL];
387 : : typedef union npc_kex_ldata_flags_cfg npc_ld_flags_t[NPC_MAX_LD];
388 : :
389 : : /* MBOX_MSG_NPC_GET_DATAX_CFG Response */
390 : : struct npc_get_datax_cfg {
391 : : /* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
392 : : union npc_kex_ldata_flags_cfg ld_flags[NPC_MAX_LD];
393 : : /* Extract information indexed with [LID][LTYPE] */
394 : : struct npc_lid_lt_xtract_info lid_lt_xtract[NPC_MAX_LID][NPC_MAX_LT];
395 : : /* Flags based extract indexed with [LDATA][FLAGS_LOWER_NIBBLE]
396 : : * Fields flags_ena_ld0, flags_ena_ld1 in
397 : : * struct npc_lid_lt_xtract_info indicate if this is applicable
398 : : * for a given {LAYER, LTYPE}
399 : : */
400 : : struct npc_xtract_info flag_xtract[NPC_MAX_LD][NPC_MAX_LT];
401 : : };
402 : :
403 : : TAILQ_HEAD(npc_flow_list, roc_npc_flow);
404 : :
405 : : struct npc_prio_flow_entry {
406 : : struct roc_npc_flow *flow;
407 : : TAILQ_ENTRY(npc_prio_flow_entry) next;
408 : : };
409 : :
410 : : TAILQ_HEAD(npc_prio_flow_list_head, npc_prio_flow_entry);
411 : :
412 : : struct npc_age_flow_entry {
413 : : struct roc_npc_flow *flow;
414 : : TAILQ_ENTRY(npc_age_flow_entry) next;
415 : : };
416 : :
417 : : TAILQ_HEAD(npc_age_flow_list_head, npc_age_flow_entry);
418 : :
419 : : struct npc {
420 : : struct mbox *mbox; /* Mbox */
421 : : uint64_t keyx_supp_nmask[NPC_MAX_INTF]; /* nibble mask */
422 : : uint8_t hash_extract_cap; /* hash extract support */
423 : : uint8_t profile_name[MKEX_NAME_LEN]; /* KEX profile name */
424 : : bool is_sdp_link;
425 : : uint16_t channel; /* RX Channel number */
426 : : uint32_t keyx_len[NPC_MAX_INTF]; /* per intf key len in bits */
427 : : uint32_t datax_len[NPC_MAX_INTF]; /* per intf data len in bits */
428 : : uint32_t keyw[NPC_MAX_INTF]; /* max key + data len bits */
429 : : uint32_t mcam_entries; /* mcam entries supported */
430 : : uint16_t switch_header_type; /* Supported switch header type */
431 : : uint16_t flow_max_priority; /* Max priority for flow */
432 : : uint16_t sdp_channel;
433 : : uint16_t sdp_channel_mask;
434 : : uint32_t rss_grps; /* rss groups supported */
435 : : uint16_t flow_prealloc_size; /* Pre allocated mcam size */
436 : : uint8_t exact_match_ena;
437 : : uint16_t pf_func; /* pf_func of device */
438 : : uint32_t mark_actions;
439 : : uint32_t vtag_strip_actions; /* vtag insert/strip actions */
440 : : npc_dxcfg_t prx_dxcfg; /* intf, lid, lt, extract */
441 : : npc_dxcfg_cn20k_t prx_dxcfg_cn20k; /* intf, ext, lt, extract */
442 : : npc_lid_cn20k_t lid_cfg; /* KEX LD_Flags CFG */
443 : : npc_fxcfg_t prx_fxcfg; /* Flag extract */
444 : : npc_ld_flags_t prx_lfcfg; /* KEX LD_Flags CFG */
445 : : struct npc_flow_list *flow_list;
446 : : struct npc_prio_flow_list_head *prio_flow_list;
447 : : struct npc_age_flow_list_head age_flow_list;
448 : : struct plt_bitmap *rss_grp_entries;
449 : : struct npc_flow_list ipsec_list;
450 : : uint8_t enable_debug;
451 : : };
452 : :
453 : : #define NPC_HASH_FIELD_LEN 16
454 : :
455 : : struct npc_hash_cfg {
456 : : uint64_t secret_key[3];
457 : : /* NPC_AF_INTF(0..1)_HASH(0..1)_MASK(0..1) */
458 : : uint64_t hash_mask[NPC_MAX_INTF][NPC_MAX_HASH][NPC_MAX_HASH_MASK];
459 : : /* NPC_AF_INTF(0..1)_HASH(0..1)_RESULT_CTRL */
460 : : uint64_t hash_ctrl[NPC_MAX_INTF][NPC_MAX_HASH];
461 : : };
462 : :
463 : : static inline struct npc *
464 : : roc_npc_to_npc_priv(struct roc_npc *npc)
465 : : {
466 [ # # # # : 0 : return (struct npc *)npc->reserved;
# # ]
467 : : }
468 : :
469 : : int npc_mcam_get_stats(struct mbox *mbox, struct roc_npc_flow *flow, uint64_t *count);
470 : : int npc_mcam_alloc_counter(struct mbox *mbox, uint16_t *ctr);
471 : : int npc_mcam_free_counter(struct mbox *mbox, uint16_t ctr_id);
472 : : int npc_mcam_read_counter(struct mbox *mbox, uint32_t ctr_id, uint64_t *count);
473 : : int npc_mcam_clear_counter(struct mbox *mbox, uint32_t ctr_id);
474 : : int npc_mcam_free_entry(struct mbox *mbox, uint32_t entry);
475 : : int npc_mcam_free_all_entries(struct npc *npc);
476 : : int npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
477 : : struct npc_parse_state *pst);
478 : : int npc_mcam_alloc_entry(struct npc *npc, struct roc_npc_flow *mcam, struct roc_npc_flow *ref_mcam,
479 : : uint8_t prio, int *resp_count);
480 : : int npc_mcam_alloc_entry_cn20k(struct npc *npc, struct roc_npc_flow *mcam, int *resp_count);
481 : :
482 : : int npc_mcam_alloc_entries(struct mbox *mbox, int ref_mcam, int *alloc_entry, int req_count,
483 : : int prio, int *resp_count, bool is_conti);
484 : :
485 : : int npc_mcam_ena_dis_entry(struct npc *npc, struct roc_npc_flow *mcam, bool enable);
486 : : int npc_mcam_write_entry(struct mbox *mbox, struct roc_npc_flow *mcam);
487 : : int npc_flow_enable_all_entries(struct npc *npc, bool enable);
488 : : int npc_update_parse_state(struct npc_parse_state *pst, struct npc_parse_item_info *info, int lid,
489 : : int lt, uint8_t flags);
490 : : void npc_get_hw_supp_mask(struct npc_parse_state *pst, struct npc_parse_item_info *info, int lid,
491 : : int lt);
492 : : uint8_t npc_get_key_type(struct npc *npc, struct roc_npc_flow *flow);
493 : : int npc_mask_is_supported(const char *mask, const char *hw_mask, int len);
494 : : int npc_parse_item_basic(const struct roc_npc_item_info *item, struct npc_parse_item_info *info);
495 : : int npc_parse_meta_items(struct npc_parse_state *pst);
496 : : int npc_parse_mark_item(struct npc_parse_state *pst);
497 : : int npc_parse_port_representor_id(struct npc_parse_state *pst);
498 : : int npc_parse_represented_port_id(struct npc_parse_state *pst);
499 : : int npc_parse_pre_l2(struct npc_parse_state *pst);
500 : : int npc_parse_higig2_hdr(struct npc_parse_state *pst);
501 : : int npc_parse_cpt_hdr(struct npc_parse_state *pst);
502 : : int npc_parse_tx_queue(struct npc_parse_state *pst);
503 : : int npc_parse_la(struct npc_parse_state *pst);
504 : : int npc_parse_lb(struct npc_parse_state *pst);
505 : : int npc_parse_lc(struct npc_parse_state *pst);
506 : : int npc_parse_ld(struct npc_parse_state *pst);
507 : : int npc_parse_le(struct npc_parse_state *pst);
508 : : int npc_parse_lf(struct npc_parse_state *pst);
509 : : int npc_parse_lg(struct npc_parse_state *pst);
510 : : int npc_parse_lh(struct npc_parse_state *pst);
511 : : int npc_mcam_fetch_kex_cfg(struct npc *npc);
512 : : int npc_mcam_fetch_hw_cap(struct npc *npc, uint8_t *npc_hw_cap);
513 : : int npc_get_free_mcam_entry(struct mbox *mbox, struct roc_npc_flow *flow, struct npc *npc);
514 : : void npc_delete_prio_list_entry(struct npc *npc, struct roc_npc_flow *flow);
515 : : int npc_flow_free_all_resources(struct npc *npc);
516 : : const struct roc_npc_item_info *
517 : : npc_parse_skip_void_and_any_items(const struct roc_npc_item_info *pattern);
518 : : int npc_program_mcam(struct npc *npc, struct npc_parse_state *pst, bool mcam_alloc);
519 : : uint64_t npc_get_kex_capability(struct npc *npc);
520 : : int npc_process_ipv6_field_hash(const struct roc_npc_flow_item_ipv6 *ipv6_spec,
521 : : const struct roc_npc_flow_item_ipv6 *ipv6_mask,
522 : : struct npc_parse_state *pst, uint8_t type);
523 : : int npc_rss_action_configure(struct roc_npc *roc_npc, const struct roc_npc_action_rss *rss,
524 : : uint8_t *alg_idx, uint32_t *rss_grp, uint32_t mcam_id,
525 : : uint16_t rss_repte_pf_func);
526 : : int npc_rss_action_program(struct roc_npc *roc_npc, const struct roc_npc_action actions[],
527 : : struct roc_npc_flow *flow);
528 : : int npc_rss_group_free(struct npc *npc, struct roc_npc_flow *flow);
529 : : int npc_mcam_init(struct npc *npc, struct roc_npc_flow *flow, int mcam_id);
530 : : int npc_mcam_move(struct mbox *mbox, uint16_t old_ent, uint16_t new_ent);
531 : : void npc_age_flow_list_entry_add(struct roc_npc *npc, struct roc_npc_flow *flow);
532 : : void npc_age_flow_list_entry_delete(struct roc_npc *npc, struct roc_npc_flow *flow);
533 : : uint32_t npc_aged_flows_get(void *args);
534 : : int npc_aged_flows_bitmap_alloc(struct roc_npc *roc_npc);
535 : : void npc_aged_flows_bitmap_free(struct roc_npc *roc_npc);
536 : : int npc_aging_ctrl_thread_create(struct roc_npc *roc_npc, const struct roc_npc_action_age *age,
537 : : struct roc_npc_flow *flow);
538 : : void npc_aging_ctrl_thread_destroy(struct roc_npc *roc_npc);
539 : : int npc_rss_free_grp_get(struct npc *npc, uint32_t *pos);
540 : : #endif /* _ROC_NPC_PRIV_H_ */
|