linux/drivers/net/ethernet/intel/ice/ice_parser.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2024 Intel Corporation */

#ifndef _ICE_PARSER_H_
#define _ICE_PARSER_H_

#define ICE_SEC_DATA_OFFSET
#define ICE_SID_RXPARSER_IMEM_ENTRY_SIZE
#define ICE_SID_RXPARSER_METADATA_INIT_ENTRY_SIZE
#define ICE_SID_RXPARSER_CAM_ENTRY_SIZE
#define ICE_SID_RXPARSER_PG_SPILL_ENTRY_SIZE
#define ICE_SID_RXPARSER_NOMATCH_CAM_ENTRY_SIZE
#define ICE_SID_RXPARSER_NOMATCH_SPILL_ENTRY_SIZE
#define ICE_SID_RXPARSER_BOOST_TCAM_ENTRY_SIZE
#define ICE_SID_RXPARSER_MARKER_TYPE_ENTRY_SIZE
#define ICE_SID_RXPARSER_MARKER_GRP_ENTRY_SIZE
#define ICE_SID_RXPARSER_PROTO_GRP_ENTRY_SIZE
#define ICE_SID_RXPARSER_FLAG_REDIR_ENTRY_SIZE

#define ICE_SEC_LBL_DATA_OFFSET
#define ICE_SID_LBL_ENTRY_SIZE

/*** ICE_SID_RXPARSER_IMEM section ***/
#define ICE_IMEM_TABLE_SIZE

/* TCAM boost Master; if bit is set, and TCAM hit, TCAM output overrides iMEM
 * output.
 */
struct ice_bst_main {};

struct ice_bst_keybuilder {};

/* Next protocol Key builder */
struct ice_np_keybuilder {};

enum ice_np_keybuilder_opcode {};

/* Parse Graph Key builder */
struct ice_pg_keybuilder {};

enum ice_alu_idx {};

enum ice_alu_opcode {};

enum ice_proto_off_opcode {};

struct ice_alu {};

/* Parser program code (iMEM) */
struct ice_imem_item {};

/*** ICE_SID_RXPARSER_METADATA_INIT section ***/
#define ICE_METAINIT_TABLE_SIZE

/* Metadata Initialization item  */
struct ice_metainit_item {};

/*** ICE_SID_RXPARSER_CAM, ICE_SID_RXPARSER_PG_SPILL,
 *    ICE_SID_RXPARSER_NOMATCH_CAM and ICE_SID_RXPARSER_NOMATCH_CAM
 *    sections ***/
#define ICE_PG_CAM_TABLE_SIZE
#define ICE_PG_SP_CAM_TABLE_SIZE
#define ICE_PG_NM_CAM_TABLE_SIZE
#define ICE_PG_NM_SP_CAM_TABLE_SIZE

struct ice_pg_cam_key {};

struct ice_pg_nm_cam_key {};

struct ice_pg_cam_action {};

/* Parse Graph item */
struct ice_pg_cam_item {};

/* Parse Graph No Match item */
struct ice_pg_nm_cam_item {};

struct ice_pg_cam_item *ice_pg_cam_match(struct ice_pg_cam_item *table,
					 int size, struct ice_pg_cam_key *key);
struct ice_pg_nm_cam_item *
ice_pg_nm_cam_match(struct ice_pg_nm_cam_item *table, int size,
		    struct ice_pg_cam_key *key);

/*** ICE_SID_RXPARSER_BOOST_TCAM and ICE_SID_LBL_RXPARSER_TMEM sections ***/
#define ICE_BST_TCAM_TABLE_SIZE
#define ICE_BST_TCAM_KEY_SIZE
#define ICE_BST_KEY_TCAM_SIZE

/* Boost TCAM item */
struct ice_bst_tcam_item {};

#define ICE_LBL_LEN
#define ICE_LBL_BST_DVM
#define ICE_LBL_BST_SVM
#define ICE_LBL_TNL_VXLAN
#define ICE_LBL_TNL_GENEVE
#define ICE_LBL_TNL_UDP_ECPRI

enum ice_lbl_type {};

struct ice_lbl_item {};

struct ice_bst_tcam_item *
ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat);
struct ice_bst_tcam_item *
ice_bst_tcam_search(struct ice_bst_tcam_item *tcam_table,
		    struct ice_lbl_item *lbl_table,
		    enum ice_lbl_type type, u16 *start);

/*** ICE_SID_RXPARSER_MARKER_PTYPE section ***/
#define ICE_PTYPE_MK_TCAM_TABLE_SIZE
#define ICE_PTYPE_MK_TCAM_KEY_SIZE

struct ice_ptype_mk_tcam_item {} __packed;

struct ice_ptype_mk_tcam_item *
ice_ptype_mk_tcam_match(struct ice_ptype_mk_tcam_item *table,
			u8 *pat, int len);
/*** ICE_SID_RXPARSER_MARKER_GRP section ***/
#define ICE_MK_GRP_TABLE_SIZE
#define ICE_MK_COUNT_PER_GRP

/*  Marker Group item */
struct ice_mk_grp_item {};

/*** ICE_SID_RXPARSER_PROTO_GRP section ***/
#define ICE_PROTO_COUNT_PER_GRP
#define ICE_PROTO_GRP_TABLE_SIZE
#define ICE_PROTO_GRP_ITEM_SIZE
struct ice_proto_off {};

/*  Protocol Group item */
struct ice_proto_grp_item {};

/*** ICE_SID_RXPARSER_FLAG_REDIR section ***/
#define ICE_FLG_RD_TABLE_SIZE
#define ICE_FLG_RDT_SIZE

/* Flags Redirection item */
struct ice_flg_rd_item {};

u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg);

/*** ICE_SID_XLT_KEY_BUILDER_SW, ICE_SID_XLT_KEY_BUILDER_ACL,
 * ICE_SID_XLT_KEY_BUILDER_FD and ICE_SID_XLT_KEY_BUILDER_RSS
 * sections ***/
#define ICE_XLT_KB_FLAG0_14_CNT
#define ICE_XLT_KB_TBL_CNT
#define ICE_XLT_KB_TBL_ENTRY_SIZE

struct ice_xlt_kb_entry {};

/* XLT Key Builder */
struct ice_xlt_kb {};

u16 ice_xlt_kb_flag_get(struct ice_xlt_kb *kb, u64 pkt_flag);

/*** Parser API ***/
#define ICE_GPR_HV_IDX
#define ICE_GPR_HV_SIZE
#define ICE_GPR_ERR_IDX
#define ICE_GPR_FLG_IDX
#define ICE_GPR_FLG_SIZE

#define ICE_GPR_TSR_IDX
#define ICE_GPR_NN_IDX
#define ICE_GPR_HO_IDX
#define ICE_GPR_NP_IDX

#define ICE_PARSER_MAX_PKT_LEN
#define ICE_PARSER_PKT_REV
#define ICE_PARSER_GPR_NUM
#define ICE_PARSER_FLG_NUM
#define ICE_PARSER_ERR_NUM
#define ICE_BST_KEY_SIZE
#define ICE_MARKER_ID_SIZE
#define ICE_MARKER_MAX_SIZE
#define ICE_MARKER_ID_NUM
#define ICE_PO_PAIR_SIZE

struct ice_gpr_pu {};

enum ice_pg_prio {};

struct ice_parser_rt {};

struct ice_parser_proto_off {};

#define ICE_PARSER_PROTO_OFF_PAIR_SIZE
#define ICE_PARSER_FLAG_PSR_SIZE
#define ICE_PARSER_FV_SIZE
#define ICE_PARSER_FV_MAX
#define ICE_BT_TUN_PORT_OFF_H
#define ICE_BT_TUN_PORT_OFF_L
#define ICE_BT_VM_OFF
#define ICE_UDP_PORT_OFF_H
#define ICE_UDP_PORT_OFF_L

struct ice_parser_result {};

void ice_parser_rt_reset(struct ice_parser_rt *rt);
void ice_parser_rt_pktbuf_set(struct ice_parser_rt *rt, const u8 *pkt_buf,
			      int pkt_len);
int ice_parser_rt_execute(struct ice_parser_rt *rt,
			  struct ice_parser_result *rslt);

struct ice_parser {};

struct ice_parser *ice_parser_create(struct ice_hw *hw);
void ice_parser_destroy(struct ice_parser *psr);
void ice_parser_dvm_set(struct ice_parser *psr, bool on);
int ice_parser_vxlan_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on);
int ice_parser_geneve_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on);
int ice_parser_ecpri_tunnel_set(struct ice_parser *psr, u16 udp_port, bool on);
int ice_parser_run(struct ice_parser *psr, const u8 *pkt_buf,
		   int pkt_len, struct ice_parser_result *rslt);
void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt);

struct ice_parser_fv {};

struct ice_parser_profile {};

int ice_parser_profile_init(struct ice_parser_result *rslt,
			    const u8 *pkt_buf, const u8 *msk_buf,
			    int buf_len, enum ice_block blk,
			    struct ice_parser_profile *prof);
void ice_parser_profile_dump(struct ice_hw *hw,
			     struct ice_parser_profile *prof);
#endif /* _ICE_PARSER_H_ */