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