18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*  Marvell OcteonTx2 RVU Admin Function driver
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2018 Marvell International Ltd.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
78c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License version 2 as
88c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef NPC_H
128c2ecf20Sopenharmony_ci#define NPC_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cienum NPC_LID_E {
158c2ecf20Sopenharmony_ci	NPC_LID_LA = 0,
168c2ecf20Sopenharmony_ci	NPC_LID_LB,
178c2ecf20Sopenharmony_ci	NPC_LID_LC,
188c2ecf20Sopenharmony_ci	NPC_LID_LD,
198c2ecf20Sopenharmony_ci	NPC_LID_LE,
208c2ecf20Sopenharmony_ci	NPC_LID_LF,
218c2ecf20Sopenharmony_ci	NPC_LID_LG,
228c2ecf20Sopenharmony_ci	NPC_LID_LH,
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define NPC_LT_NA 0
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cienum npc_kpu_la_ltype {
288c2ecf20Sopenharmony_ci	NPC_LT_LA_8023 = 1,
298c2ecf20Sopenharmony_ci	NPC_LT_LA_ETHER,
308c2ecf20Sopenharmony_ci	NPC_LT_LA_IH_NIX_ETHER,
318c2ecf20Sopenharmony_ci	NPC_LT_LA_IH_8_ETHER,
328c2ecf20Sopenharmony_ci	NPC_LT_LA_IH_4_ETHER,
338c2ecf20Sopenharmony_ci	NPC_LT_LA_IH_2_ETHER,
348c2ecf20Sopenharmony_ci	NPC_LT_LA_HIGIG2_ETHER,
358c2ecf20Sopenharmony_ci	NPC_LT_LA_IH_NIX_HIGIG2_ETHER,
368c2ecf20Sopenharmony_ci	NPC_LT_LA_CUSTOM0 = 0xE,
378c2ecf20Sopenharmony_ci	NPC_LT_LA_CUSTOM1 = 0xF,
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cienum npc_kpu_lb_ltype {
418c2ecf20Sopenharmony_ci	NPC_LT_LB_ETAG = 1,
428c2ecf20Sopenharmony_ci	NPC_LT_LB_CTAG,
438c2ecf20Sopenharmony_ci	NPC_LT_LB_STAG_QINQ,
448c2ecf20Sopenharmony_ci	NPC_LT_LB_BTAG,
458c2ecf20Sopenharmony_ci	NPC_LT_LB_ITAG,
468c2ecf20Sopenharmony_ci	NPC_LT_LB_DSA,
478c2ecf20Sopenharmony_ci	NPC_LT_LB_DSA_VLAN,
488c2ecf20Sopenharmony_ci	NPC_LT_LB_EDSA,
498c2ecf20Sopenharmony_ci	NPC_LT_LB_EDSA_VLAN,
508c2ecf20Sopenharmony_ci	NPC_LT_LB_EXDSA,
518c2ecf20Sopenharmony_ci	NPC_LT_LB_EXDSA_VLAN,
528c2ecf20Sopenharmony_ci	NPC_LT_LB_FDSA,
538c2ecf20Sopenharmony_ci	NPC_LT_LB_CUSTOM0 = 0xE,
548c2ecf20Sopenharmony_ci	NPC_LT_LB_CUSTOM1 = 0xF,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cienum npc_kpu_lc_ltype {
588c2ecf20Sopenharmony_ci	NPC_LT_LC_IP = 1,
598c2ecf20Sopenharmony_ci	NPC_LT_LC_IP_OPT,
608c2ecf20Sopenharmony_ci	NPC_LT_LC_IP6,
618c2ecf20Sopenharmony_ci	NPC_LT_LC_IP6_EXT,
628c2ecf20Sopenharmony_ci	NPC_LT_LC_ARP,
638c2ecf20Sopenharmony_ci	NPC_LT_LC_RARP,
648c2ecf20Sopenharmony_ci	NPC_LT_LC_MPLS,
658c2ecf20Sopenharmony_ci	NPC_LT_LC_NSH,
668c2ecf20Sopenharmony_ci	NPC_LT_LC_PTP,
678c2ecf20Sopenharmony_ci	NPC_LT_LC_FCOE,
688c2ecf20Sopenharmony_ci	NPC_LT_LC_CUSTOM0 = 0xE,
698c2ecf20Sopenharmony_ci	NPC_LT_LC_CUSTOM1 = 0xF,
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* Don't modify Ltypes upto SCTP, otherwise it will
738c2ecf20Sopenharmony_ci * effect flow tag calculation and thus RSS.
748c2ecf20Sopenharmony_ci */
758c2ecf20Sopenharmony_cienum npc_kpu_ld_ltype {
768c2ecf20Sopenharmony_ci	NPC_LT_LD_TCP = 1,
778c2ecf20Sopenharmony_ci	NPC_LT_LD_UDP,
788c2ecf20Sopenharmony_ci	NPC_LT_LD_ICMP,
798c2ecf20Sopenharmony_ci	NPC_LT_LD_SCTP,
808c2ecf20Sopenharmony_ci	NPC_LT_LD_ICMP6,
818c2ecf20Sopenharmony_ci	NPC_LT_LD_CUSTOM0,
828c2ecf20Sopenharmony_ci	NPC_LT_LD_CUSTOM1,
838c2ecf20Sopenharmony_ci	NPC_LT_LD_IGMP = 8,
848c2ecf20Sopenharmony_ci	NPC_LT_LD_AH,
858c2ecf20Sopenharmony_ci	NPC_LT_LD_GRE,
868c2ecf20Sopenharmony_ci	NPC_LT_LD_NVGRE,
878c2ecf20Sopenharmony_ci	NPC_LT_LD_NSH,
888c2ecf20Sopenharmony_ci	NPC_LT_LD_TU_MPLS_IN_NSH,
898c2ecf20Sopenharmony_ci	NPC_LT_LD_TU_MPLS_IN_IP,
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cienum npc_kpu_le_ltype {
938c2ecf20Sopenharmony_ci	NPC_LT_LE_VXLAN = 1,
948c2ecf20Sopenharmony_ci	NPC_LT_LE_GENEVE,
958c2ecf20Sopenharmony_ci	NPC_LT_LE_ESP,
968c2ecf20Sopenharmony_ci	NPC_LT_LE_GTPU = 4,
978c2ecf20Sopenharmony_ci	NPC_LT_LE_VXLANGPE,
988c2ecf20Sopenharmony_ci	NPC_LT_LE_GTPC,
998c2ecf20Sopenharmony_ci	NPC_LT_LE_NSH,
1008c2ecf20Sopenharmony_ci	NPC_LT_LE_TU_MPLS_IN_GRE,
1018c2ecf20Sopenharmony_ci	NPC_LT_LE_TU_NSH_IN_GRE,
1028c2ecf20Sopenharmony_ci	NPC_LT_LE_TU_MPLS_IN_UDP,
1038c2ecf20Sopenharmony_ci	NPC_LT_LE_CUSTOM0 = 0xE,
1048c2ecf20Sopenharmony_ci	NPC_LT_LE_CUSTOM1 = 0xF,
1058c2ecf20Sopenharmony_ci};
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_cienum npc_kpu_lf_ltype {
1088c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_ETHER = 1,
1098c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_PPP,
1108c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_MPLS_IN_VXLANGPE,
1118c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_NSH_IN_VXLANGPE,
1128c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_MPLS_IN_NSH,
1138c2ecf20Sopenharmony_ci	NPC_LT_LF_TU_3RD_NSH,
1148c2ecf20Sopenharmony_ci	NPC_LT_LF_CUSTOM0 = 0xE,
1158c2ecf20Sopenharmony_ci	NPC_LT_LF_CUSTOM1 = 0xF,
1168c2ecf20Sopenharmony_ci};
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_cienum npc_kpu_lg_ltype {
1198c2ecf20Sopenharmony_ci	NPC_LT_LG_TU_IP = 1,
1208c2ecf20Sopenharmony_ci	NPC_LT_LG_TU_IP6,
1218c2ecf20Sopenharmony_ci	NPC_LT_LG_TU_ARP,
1228c2ecf20Sopenharmony_ci	NPC_LT_LG_TU_ETHER_IN_NSH,
1238c2ecf20Sopenharmony_ci	NPC_LT_LG_CUSTOM0 = 0xE,
1248c2ecf20Sopenharmony_ci	NPC_LT_LG_CUSTOM1 = 0xF,
1258c2ecf20Sopenharmony_ci};
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Don't modify Ltypes upto SCTP, otherwise it will
1288c2ecf20Sopenharmony_ci * effect flow tag calculation and thus RSS.
1298c2ecf20Sopenharmony_ci */
1308c2ecf20Sopenharmony_cienum npc_kpu_lh_ltype {
1318c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_TCP = 1,
1328c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_UDP,
1338c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_ICMP,
1348c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_SCTP,
1358c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_ICMP6,
1368c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_IGMP = 8,
1378c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_ESP,
1388c2ecf20Sopenharmony_ci	NPC_LT_LH_TU_AH,
1398c2ecf20Sopenharmony_ci	NPC_LT_LH_CUSTOM0 = 0xE,
1408c2ecf20Sopenharmony_ci	NPC_LT_LH_CUSTOM1 = 0xF,
1418c2ecf20Sopenharmony_ci};
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/* NPC port kind defines how the incoming or outgoing packets
1448c2ecf20Sopenharmony_ci * are processed. NPC accepts packets from up to 64 pkinds.
1458c2ecf20Sopenharmony_ci * Software assigns pkind for each incoming port such as CGX
1468c2ecf20Sopenharmony_ci * Ethernet interfaces, LBK interfaces, etc.
1478c2ecf20Sopenharmony_ci */
1488c2ecf20Sopenharmony_cienum npc_pkind_type {
1498c2ecf20Sopenharmony_ci	NPC_TX_DEF_PKIND = 63ULL,	/* NIX-TX PKIND */
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistruct npc_kpu_profile_cam {
1538c2ecf20Sopenharmony_ci	u8 state;
1548c2ecf20Sopenharmony_ci	u8 state_mask;
1558c2ecf20Sopenharmony_ci	u16 dp0;
1568c2ecf20Sopenharmony_ci	u16 dp0_mask;
1578c2ecf20Sopenharmony_ci	u16 dp1;
1588c2ecf20Sopenharmony_ci	u16 dp1_mask;
1598c2ecf20Sopenharmony_ci	u16 dp2;
1608c2ecf20Sopenharmony_ci	u16 dp2_mask;
1618c2ecf20Sopenharmony_ci};
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cistruct npc_kpu_profile_action {
1648c2ecf20Sopenharmony_ci	u8 errlev;
1658c2ecf20Sopenharmony_ci	u8 errcode;
1668c2ecf20Sopenharmony_ci	u8 dp0_offset;
1678c2ecf20Sopenharmony_ci	u8 dp1_offset;
1688c2ecf20Sopenharmony_ci	u8 dp2_offset;
1698c2ecf20Sopenharmony_ci	u8 bypass_count;
1708c2ecf20Sopenharmony_ci	u8 parse_done;
1718c2ecf20Sopenharmony_ci	u8 next_state;
1728c2ecf20Sopenharmony_ci	u8 ptr_advance;
1738c2ecf20Sopenharmony_ci	u8 cap_ena;
1748c2ecf20Sopenharmony_ci	u8 lid;
1758c2ecf20Sopenharmony_ci	u8 ltype;
1768c2ecf20Sopenharmony_ci	u8 flags;
1778c2ecf20Sopenharmony_ci	u8 offset;
1788c2ecf20Sopenharmony_ci	u8 mask;
1798c2ecf20Sopenharmony_ci	u8 right;
1808c2ecf20Sopenharmony_ci	u8 shift;
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_cistruct npc_kpu_profile {
1848c2ecf20Sopenharmony_ci	int cam_entries;
1858c2ecf20Sopenharmony_ci	int action_entries;
1868c2ecf20Sopenharmony_ci	const struct npc_kpu_profile_cam *cam;
1878c2ecf20Sopenharmony_ci	const struct npc_kpu_profile_action *action;
1888c2ecf20Sopenharmony_ci};
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci/* NPC KPU register formats */
1918c2ecf20Sopenharmony_cistruct npc_kpu_cam {
1928c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
1938c2ecf20Sopenharmony_ci	u64 rsvd_63_56     : 8;
1948c2ecf20Sopenharmony_ci	u64 state          : 8;
1958c2ecf20Sopenharmony_ci	u64 dp2_data       : 16;
1968c2ecf20Sopenharmony_ci	u64 dp1_data       : 16;
1978c2ecf20Sopenharmony_ci	u64 dp0_data       : 16;
1988c2ecf20Sopenharmony_ci#else
1998c2ecf20Sopenharmony_ci	u64 dp0_data       : 16;
2008c2ecf20Sopenharmony_ci	u64 dp1_data       : 16;
2018c2ecf20Sopenharmony_ci	u64 dp2_data       : 16;
2028c2ecf20Sopenharmony_ci	u64 state          : 8;
2038c2ecf20Sopenharmony_ci	u64 rsvd_63_56     : 8;
2048c2ecf20Sopenharmony_ci#endif
2058c2ecf20Sopenharmony_ci};
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_cistruct npc_kpu_action0 {
2088c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
2098c2ecf20Sopenharmony_ci	u64 rsvd_63_57     : 7;
2108c2ecf20Sopenharmony_ci	u64 byp_count      : 3;
2118c2ecf20Sopenharmony_ci	u64 capture_ena    : 1;
2128c2ecf20Sopenharmony_ci	u64 parse_done     : 1;
2138c2ecf20Sopenharmony_ci	u64 next_state     : 8;
2148c2ecf20Sopenharmony_ci	u64 rsvd_43        : 1;
2158c2ecf20Sopenharmony_ci	u64 capture_lid    : 3;
2168c2ecf20Sopenharmony_ci	u64 capture_ltype  : 4;
2178c2ecf20Sopenharmony_ci	u64 capture_flags  : 8;
2188c2ecf20Sopenharmony_ci	u64 ptr_advance    : 8;
2198c2ecf20Sopenharmony_ci	u64 var_len_offset : 8;
2208c2ecf20Sopenharmony_ci	u64 var_len_mask   : 8;
2218c2ecf20Sopenharmony_ci	u64 var_len_right  : 1;
2228c2ecf20Sopenharmony_ci	u64 var_len_shift  : 3;
2238c2ecf20Sopenharmony_ci#else
2248c2ecf20Sopenharmony_ci	u64 var_len_shift  : 3;
2258c2ecf20Sopenharmony_ci	u64 var_len_right  : 1;
2268c2ecf20Sopenharmony_ci	u64 var_len_mask   : 8;
2278c2ecf20Sopenharmony_ci	u64 var_len_offset : 8;
2288c2ecf20Sopenharmony_ci	u64 ptr_advance    : 8;
2298c2ecf20Sopenharmony_ci	u64 capture_flags  : 8;
2308c2ecf20Sopenharmony_ci	u64 capture_ltype  : 4;
2318c2ecf20Sopenharmony_ci	u64 capture_lid    : 3;
2328c2ecf20Sopenharmony_ci	u64 rsvd_43        : 1;
2338c2ecf20Sopenharmony_ci	u64 next_state     : 8;
2348c2ecf20Sopenharmony_ci	u64 parse_done     : 1;
2358c2ecf20Sopenharmony_ci	u64 capture_ena    : 1;
2368c2ecf20Sopenharmony_ci	u64 byp_count      : 3;
2378c2ecf20Sopenharmony_ci	u64 rsvd_63_57     : 7;
2388c2ecf20Sopenharmony_ci#endif
2398c2ecf20Sopenharmony_ci};
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistruct npc_kpu_action1 {
2428c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
2438c2ecf20Sopenharmony_ci	u64 rsvd_63_36     : 28;
2448c2ecf20Sopenharmony_ci	u64 errlev         : 4;
2458c2ecf20Sopenharmony_ci	u64 errcode        : 8;
2468c2ecf20Sopenharmony_ci	u64 dp2_offset     : 8;
2478c2ecf20Sopenharmony_ci	u64 dp1_offset     : 8;
2488c2ecf20Sopenharmony_ci	u64 dp0_offset     : 8;
2498c2ecf20Sopenharmony_ci#else
2508c2ecf20Sopenharmony_ci	u64 dp0_offset     : 8;
2518c2ecf20Sopenharmony_ci	u64 dp1_offset     : 8;
2528c2ecf20Sopenharmony_ci	u64 dp2_offset     : 8;
2538c2ecf20Sopenharmony_ci	u64 errcode        : 8;
2548c2ecf20Sopenharmony_ci	u64 errlev         : 4;
2558c2ecf20Sopenharmony_ci	u64 rsvd_63_36     : 28;
2568c2ecf20Sopenharmony_ci#endif
2578c2ecf20Sopenharmony_ci};
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistruct npc_kpu_pkind_cpi_def {
2608c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
2618c2ecf20Sopenharmony_ci	u64 ena            : 1;
2628c2ecf20Sopenharmony_ci	u64 rsvd_62_59     : 4;
2638c2ecf20Sopenharmony_ci	u64 lid            : 3;
2648c2ecf20Sopenharmony_ci	u64 ltype_match    : 4;
2658c2ecf20Sopenharmony_ci	u64 ltype_mask     : 4;
2668c2ecf20Sopenharmony_ci	u64 flags_match    : 8;
2678c2ecf20Sopenharmony_ci	u64 flags_mask     : 8;
2688c2ecf20Sopenharmony_ci	u64 add_offset     : 8;
2698c2ecf20Sopenharmony_ci	u64 add_mask       : 8;
2708c2ecf20Sopenharmony_ci	u64 rsvd_15        : 1;
2718c2ecf20Sopenharmony_ci	u64 add_shift      : 3;
2728c2ecf20Sopenharmony_ci	u64 rsvd_11_10     : 2;
2738c2ecf20Sopenharmony_ci	u64 cpi_base       : 10;
2748c2ecf20Sopenharmony_ci#else
2758c2ecf20Sopenharmony_ci	u64 cpi_base       : 10;
2768c2ecf20Sopenharmony_ci	u64 rsvd_11_10     : 2;
2778c2ecf20Sopenharmony_ci	u64 add_shift      : 3;
2788c2ecf20Sopenharmony_ci	u64 rsvd_15        : 1;
2798c2ecf20Sopenharmony_ci	u64 add_mask       : 8;
2808c2ecf20Sopenharmony_ci	u64 add_offset     : 8;
2818c2ecf20Sopenharmony_ci	u64 flags_mask     : 8;
2828c2ecf20Sopenharmony_ci	u64 flags_match    : 8;
2838c2ecf20Sopenharmony_ci	u64 ltype_mask     : 4;
2848c2ecf20Sopenharmony_ci	u64 ltype_match    : 4;
2858c2ecf20Sopenharmony_ci	u64 lid            : 3;
2868c2ecf20Sopenharmony_ci	u64 rsvd_62_59     : 4;
2878c2ecf20Sopenharmony_ci	u64 ena            : 1;
2888c2ecf20Sopenharmony_ci#endif
2898c2ecf20Sopenharmony_ci};
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_cistruct nix_rx_action {
2928c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
2938c2ecf20Sopenharmony_ci	u64	rsvd_63_61	:3;
2948c2ecf20Sopenharmony_ci	u64	flow_key_alg	:5;
2958c2ecf20Sopenharmony_ci	u64	match_id	:16;
2968c2ecf20Sopenharmony_ci	u64	index		:20;
2978c2ecf20Sopenharmony_ci	u64	pf_func		:16;
2988c2ecf20Sopenharmony_ci	u64	op		:4;
2998c2ecf20Sopenharmony_ci#else
3008c2ecf20Sopenharmony_ci	u64	op		:4;
3018c2ecf20Sopenharmony_ci	u64	pf_func		:16;
3028c2ecf20Sopenharmony_ci	u64	index		:20;
3038c2ecf20Sopenharmony_ci	u64	match_id	:16;
3048c2ecf20Sopenharmony_ci	u64	flow_key_alg	:5;
3058c2ecf20Sopenharmony_ci	u64	rsvd_63_61	:3;
3068c2ecf20Sopenharmony_ci#endif
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/* NPC_AF_INTFX_KEX_CFG field masks */
3108c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE		GENMASK_ULL(30, 0)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/* NPC_PARSE_KEX_S nibble definitions for each field */
3138c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_CHAN		GENMASK_ULL(2, 0)
3148c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_ERRLEV		BIT_ULL(3)
3158c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_ERRCODE	GENMASK_ULL(5, 4)
3168c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_L2L3_BCAST	BIT_ULL(6)
3178c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LA_FLAGS	GENMASK_ULL(8, 7)
3188c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LA_LTYPE	BIT_ULL(9)
3198c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LB_FLAGS	GENMASK_ULL(11, 10)
3208c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LB_LTYPE	BIT_ULL(12)
3218c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LC_FLAGS	GENMASK_ULL(14, 13)
3228c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LC_LTYPE	BIT_ULL(15)
3238c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LD_FLAGS	GENMASK_ULL(17, 16)
3248c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LD_LTYPE	BIT_ULL(18)
3258c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LE_FLAGS	GENMASK_ULL(20, 19)
3268c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LE_LTYPE	BIT_ULL(21)
3278c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LF_FLAGS	GENMASK_ULL(23, 22)
3288c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LF_LTYPE	BIT_ULL(24)
3298c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LG_FLAGS	GENMASK_ULL(26, 25)
3308c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LG_LTYPE	BIT_ULL(27)
3318c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LH_FLAGS	GENMASK_ULL(29, 28)
3328c2ecf20Sopenharmony_ci#define NPC_PARSE_NIBBLE_LH_LTYPE	BIT_ULL(30)
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/* NIX Receive Vtag Action Structure */
3358c2ecf20Sopenharmony_ci#define VTAG0_VALID_BIT		BIT_ULL(15)
3368c2ecf20Sopenharmony_ci#define VTAG0_TYPE_MASK		GENMASK_ULL(14, 12)
3378c2ecf20Sopenharmony_ci#define VTAG0_LID_MASK		GENMASK_ULL(10, 8)
3388c2ecf20Sopenharmony_ci#define VTAG0_RELPTR_MASK	GENMASK_ULL(7, 0)
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_cistruct npc_mcam_kex {
3418c2ecf20Sopenharmony_ci	/* MKEX Profle Header */
3428c2ecf20Sopenharmony_ci	u64 mkex_sign; /* "mcam-kex-profile" (8 bytes/ASCII characters) */
3438c2ecf20Sopenharmony_ci	u8 name[MKEX_NAME_LEN];   /* MKEX Profile name */
3448c2ecf20Sopenharmony_ci	u64 cpu_model;   /* Format as profiled by CPU hardware */
3458c2ecf20Sopenharmony_ci	u64 kpu_version; /* KPU firmware/profile version */
3468c2ecf20Sopenharmony_ci	u64 reserved; /* Reserved for extension */
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci	/* MKEX Profle Data */
3498c2ecf20Sopenharmony_ci	u64 keyx_cfg[NPC_MAX_INTF]; /* NPC_AF_INTF(0..1)_KEX_CFG */
3508c2ecf20Sopenharmony_ci	/* NPC_AF_KEX_LDATA(0..1)_FLAGS_CFG */
3518c2ecf20Sopenharmony_ci	u64 kex_ld_flags[NPC_MAX_LD];
3528c2ecf20Sopenharmony_ci	/* NPC_AF_INTF(0..1)_LID(0..7)_LT(0..15)_LD(0..1)_CFG */
3538c2ecf20Sopenharmony_ci	u64 intf_lid_lt_ld[NPC_MAX_INTF][NPC_MAX_LID][NPC_MAX_LT][NPC_MAX_LD];
3548c2ecf20Sopenharmony_ci	/* NPC_AF_INTF(0..1)_LDATA(0..1)_FLAGS(0..15)_CFG */
3558c2ecf20Sopenharmony_ci	u64 intf_ld_flags[NPC_MAX_INTF][NPC_MAX_LD][NPC_MAX_LFL];
3568c2ecf20Sopenharmony_ci} __packed;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cistruct npc_lt_def {
3598c2ecf20Sopenharmony_ci	u8	ltype_mask;
3608c2ecf20Sopenharmony_ci	u8	ltype_match;
3618c2ecf20Sopenharmony_ci	u8	lid;
3628c2ecf20Sopenharmony_ci} __packed;
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistruct npc_lt_def_ipsec {
3658c2ecf20Sopenharmony_ci	u8	ltype_mask;
3668c2ecf20Sopenharmony_ci	u8	ltype_match;
3678c2ecf20Sopenharmony_ci	u8	lid;
3688c2ecf20Sopenharmony_ci	u8	spi_offset;
3698c2ecf20Sopenharmony_ci	u8	spi_nz;
3708c2ecf20Sopenharmony_ci} __packed;
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_cistruct npc_lt_def_cfg {
3738c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_ol2;
3748c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_oip4;
3758c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_iip4;
3768c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_oip6;
3778c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_iip6;
3788c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_otcp;
3798c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_itcp;
3808c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_oudp;
3818c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_iudp;
3828c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_osctp;
3838c2ecf20Sopenharmony_ci	struct npc_lt_def	rx_isctp;
3848c2ecf20Sopenharmony_ci	struct npc_lt_def_ipsec	rx_ipsec[2];
3858c2ecf20Sopenharmony_ci	struct npc_lt_def	pck_ol2;
3868c2ecf20Sopenharmony_ci	struct npc_lt_def	pck_oip4;
3878c2ecf20Sopenharmony_ci	struct npc_lt_def	pck_oip6;
3888c2ecf20Sopenharmony_ci	struct npc_lt_def	pck_iip4;
3898c2ecf20Sopenharmony_ci};
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci#endif /* NPC_H */
392