1c7648810STony Nguyen /* SPDX-License-Identifier: GPL-2.0 */
2c7648810STony Nguyen /* Copyright (c) 2019, Intel Corporation. */
3c7648810STony Nguyen 
4c7648810STony Nguyen #ifndef _ICE_FLEX_PIPE_H_
5c7648810STony Nguyen #define _ICE_FLEX_PIPE_H_
6c7648810STony Nguyen 
7c7648810STony Nguyen #include "ice_type.h"
8c7648810STony Nguyen 
9c7648810STony Nguyen /* Package minimal version supported */
10c7648810STony Nguyen #define ICE_PKG_SUPP_VER_MAJ	1
11c7648810STony Nguyen #define ICE_PKG_SUPP_VER_MNR	3
12c7648810STony Nguyen 
13c7648810STony Nguyen /* Package format version */
14c7648810STony Nguyen #define ICE_PKG_FMT_VER_MAJ	1
15c7648810STony Nguyen #define ICE_PKG_FMT_VER_MNR	0
16c7648810STony Nguyen #define ICE_PKG_FMT_VER_UPD	0
17c7648810STony Nguyen #define ICE_PKG_FMT_VER_DFT	0
18c7648810STony Nguyen 
19c7648810STony Nguyen #define ICE_PKG_CNT 4
20c7648810STony Nguyen 
21*247dd97dSWojciech Drewek enum ice_ddp_state {
22*247dd97dSWojciech Drewek 	/* Indicates that this call to ice_init_pkg
23*247dd97dSWojciech Drewek 	 * successfully loaded the requested DDP package
24*247dd97dSWojciech Drewek 	 */
25*247dd97dSWojciech Drewek 	ICE_DDP_PKG_SUCCESS			= 0,
26*247dd97dSWojciech Drewek 
27*247dd97dSWojciech Drewek 	/* Generic error for already loaded errors, it is mapped later to
28*247dd97dSWojciech Drewek 	 * the more specific one (one of the next 3)
29*247dd97dSWojciech Drewek 	 */
30*247dd97dSWojciech Drewek 	ICE_DDP_PKG_ALREADY_LOADED			= -1,
31*247dd97dSWojciech Drewek 
32*247dd97dSWojciech Drewek 	/* Indicates that a DDP package of the same version has already been
33*247dd97dSWojciech Drewek 	 * loaded onto the device by a previous call or by another PF
34*247dd97dSWojciech Drewek 	 */
35*247dd97dSWojciech Drewek 	ICE_DDP_PKG_SAME_VERSION_ALREADY_LOADED		= -2,
36*247dd97dSWojciech Drewek 
37*247dd97dSWojciech Drewek 	/* The device has a DDP package that is not supported by the driver */
38*247dd97dSWojciech Drewek 	ICE_DDP_PKG_ALREADY_LOADED_NOT_SUPPORTED	= -3,
39*247dd97dSWojciech Drewek 
40*247dd97dSWojciech Drewek 	/* The device has a compatible package
41*247dd97dSWojciech Drewek 	 * (but different from the request) already loaded
42*247dd97dSWojciech Drewek 	 */
43*247dd97dSWojciech Drewek 	ICE_DDP_PKG_COMPATIBLE_ALREADY_LOADED		= -4,
44*247dd97dSWojciech Drewek 
45*247dd97dSWojciech Drewek 	/* The firmware loaded on the device is not compatible with
46*247dd97dSWojciech Drewek 	 * the DDP package loaded
47*247dd97dSWojciech Drewek 	 */
48*247dd97dSWojciech Drewek 	ICE_DDP_PKG_FW_MISMATCH				= -5,
49*247dd97dSWojciech Drewek 
50*247dd97dSWojciech Drewek 	/* The DDP package file is invalid */
51*247dd97dSWojciech Drewek 	ICE_DDP_PKG_INVALID_FILE			= -6,
52*247dd97dSWojciech Drewek 
53*247dd97dSWojciech Drewek 	/* The version of the DDP package provided is higher than
54*247dd97dSWojciech Drewek 	 * the driver supports
55*247dd97dSWojciech Drewek 	 */
56*247dd97dSWojciech Drewek 	ICE_DDP_PKG_FILE_VERSION_TOO_HIGH		= -7,
57*247dd97dSWojciech Drewek 
58*247dd97dSWojciech Drewek 	/* The version of the DDP package provided is lower than the
59*247dd97dSWojciech Drewek 	 * driver supports
60*247dd97dSWojciech Drewek 	 */
61*247dd97dSWojciech Drewek 	ICE_DDP_PKG_FILE_VERSION_TOO_LOW		= -8,
62*247dd97dSWojciech Drewek 
63*247dd97dSWojciech Drewek 	/* The signature of the DDP package file provided is invalid */
64*247dd97dSWojciech Drewek 	ICE_DDP_PKG_FILE_SIGNATURE_INVALID		= -9,
65*247dd97dSWojciech Drewek 
66*247dd97dSWojciech Drewek 	/* The DDP package file security revision is too low and not
67*247dd97dSWojciech Drewek 	 * supported by firmware
68*247dd97dSWojciech Drewek 	 */
69*247dd97dSWojciech Drewek 	ICE_DDP_PKG_FILE_REVISION_TOO_LOW		= -10,
70*247dd97dSWojciech Drewek 
71*247dd97dSWojciech Drewek 	/* An error occurred in firmware while loading the DDP package */
72*247dd97dSWojciech Drewek 	ICE_DDP_PKG_LOAD_ERROR				= -11,
73*247dd97dSWojciech Drewek 
74*247dd97dSWojciech Drewek 	/* Other errors */
75*247dd97dSWojciech Drewek 	ICE_DDP_PKG_ERR					= -12
76*247dd97dSWojciech Drewek };
77*247dd97dSWojciech Drewek 
78fd2a6b71SDan Nowlin enum ice_status
79fd2a6b71SDan Nowlin ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access);
80fd2a6b71SDan Nowlin void ice_release_change_lock(struct ice_hw *hw);
81fd2a6b71SDan Nowlin enum ice_status
82fd2a6b71SDan Nowlin ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx,
83fd2a6b71SDan Nowlin 		  u8 *prot, u16 *off);
84450052a4SDan Nowlin void
85450052a4SDan Nowlin ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type type,
86450052a4SDan Nowlin 		     unsigned long *bm);
87450052a4SDan Nowlin void
88450052a4SDan Nowlin ice_init_prof_result_bm(struct ice_hw *hw);
89450052a4SDan Nowlin enum ice_status
90450052a4SDan Nowlin ice_get_sw_fv_list(struct ice_hw *hw, u8 *prot_ids, u16 ids_cnt,
91450052a4SDan Nowlin 		   unsigned long *bm, struct list_head *fv_list);
92cac2a27cSHenry Tieman bool
93de6acd1cSMichal Swiatkowski ice_get_open_tunnel_port(struct ice_hw *hw, u16 *port,
94de6acd1cSMichal Swiatkowski 			 enum ice_tunnel_type type);
95b20e6c17SJakub Kicinski int ice_udp_tunnel_set_port(struct net_device *netdev, unsigned int table,
96b20e6c17SJakub Kicinski 			    unsigned int idx, struct udp_tunnel_info *ti);
97b20e6c17SJakub Kicinski int ice_udp_tunnel_unset_port(struct net_device *netdev, unsigned int table,
98b20e6c17SJakub Kicinski 			      unsigned int idx, struct udp_tunnel_info *ti);
99a4e82a81STony Nguyen 
1008818b954SHaiyue Wang /* Rx parser PTYPE functions */
1018818b954SHaiyue Wang bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);
1028818b954SHaiyue Wang 
1038818b954SHaiyue Wang /* XLT2/VSI group functions */
104a4e82a81STony Nguyen enum ice_status
10531ad4e4eSTony Nguyen ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
106cbad5db8SQi Zhang 	     const struct ice_ptype_attributes *attr, u16 attr_cnt,
107b199dddbSQi Zhang 	     struct ice_fv_word *es, u16 *masks);
108451f2c44STony Nguyen enum ice_status
109451f2c44STony Nguyen ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
1102c61054cSTony Nguyen enum ice_status
1112c61054cSTony Nguyen ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
112*247dd97dSWojciech Drewek enum ice_ddp_state ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);
113*247dd97dSWojciech Drewek enum ice_ddp_state
114c7648810STony Nguyen ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
115*247dd97dSWojciech Drewek bool ice_is_init_pkg_successful(enum ice_ddp_state state);
11632d63fa1STony Nguyen enum ice_status ice_init_hw_tbls(struct ice_hw *hw);
117c7648810STony Nguyen void ice_free_seg(struct ice_hw *hw);
118462acf6aSTony Nguyen void ice_fill_blk_tbls(struct ice_hw *hw);
11932d63fa1STony Nguyen void ice_clear_hw_tbls(struct ice_hw *hw);
12032d63fa1STony Nguyen void ice_free_hw_tbls(struct ice_hw *hw);
1212c61054cSTony Nguyen enum ice_status
1222c61054cSTony Nguyen ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
123c7648810STony Nguyen #endif /* _ICE_FLEX_PIPE_H_ */
124