xref: /freebsd/sys/dev/ice/ice_flex_pipe.h (revision 8923de59054358980102ea5acda6c6dd58273957)
171d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */
2*8923de59SPiotr Kubaj /*  Copyright (c) 2022, Intel Corporation
371d10453SEric Joyner  *  All rights reserved.
471d10453SEric Joyner  *
571d10453SEric Joyner  *  Redistribution and use in source and binary forms, with or without
671d10453SEric Joyner  *  modification, are permitted provided that the following conditions are met:
771d10453SEric Joyner  *
871d10453SEric Joyner  *   1. Redistributions of source code must retain the above copyright notice,
971d10453SEric Joyner  *      this list of conditions and the following disclaimer.
1071d10453SEric Joyner  *
1171d10453SEric Joyner  *   2. Redistributions in binary form must reproduce the above copyright
1271d10453SEric Joyner  *      notice, this list of conditions and the following disclaimer in the
1371d10453SEric Joyner  *      documentation and/or other materials provided with the distribution.
1471d10453SEric Joyner  *
1571d10453SEric Joyner  *   3. Neither the name of the Intel Corporation nor the names of its
1671d10453SEric Joyner  *      contributors may be used to endorse or promote products derived from
1771d10453SEric Joyner  *      this software without specific prior written permission.
1871d10453SEric Joyner  *
1971d10453SEric Joyner  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2071d10453SEric Joyner  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2171d10453SEric Joyner  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2271d10453SEric Joyner  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2371d10453SEric Joyner  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2471d10453SEric Joyner  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2571d10453SEric Joyner  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2671d10453SEric Joyner  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2771d10453SEric Joyner  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2871d10453SEric Joyner  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2971d10453SEric Joyner  *  POSSIBILITY OF SUCH DAMAGE.
3071d10453SEric Joyner  */
3171d10453SEric Joyner /*$FreeBSD$*/
3271d10453SEric Joyner 
3371d10453SEric Joyner #ifndef _ICE_FLEX_PIPE_H_
3471d10453SEric Joyner #define _ICE_FLEX_PIPE_H_
3571d10453SEric Joyner 
3671d10453SEric Joyner #include "ice_type.h"
3771d10453SEric Joyner 
3871d10453SEric Joyner enum ice_status
3971d10453SEric Joyner ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx,
4071d10453SEric Joyner 		  u8 *prot, u16 *off);
4171d10453SEric Joyner enum ice_status
4271d10453SEric Joyner ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type,
4371d10453SEric Joyner 		     u16 *value);
4471d10453SEric Joyner void
4571d10453SEric Joyner ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type type,
4671d10453SEric Joyner 		     ice_bitmap_t *bm);
4771d10453SEric Joyner void
4871d10453SEric Joyner ice_init_prof_result_bm(struct ice_hw *hw);
4971d10453SEric Joyner enum ice_status
509cf1841cSEric Joyner ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
519cf1841cSEric Joyner 		      u16 buf_size, struct ice_sq_cd *cd);
5271d10453SEric Joyner bool
5371d10453SEric Joyner ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,
5471d10453SEric Joyner 			 u16 *port);
5571d10453SEric Joyner enum ice_status
5671d10453SEric Joyner ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port);
5771d10453SEric Joyner enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all);
5871d10453SEric Joyner bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index);
5971d10453SEric Joyner bool
6071d10453SEric Joyner ice_tunnel_get_type(struct ice_hw *hw, u16 port, enum ice_tunnel_type *type);
6171d10453SEric Joyner enum ice_status ice_replay_tunnels(struct ice_hw *hw);
6271d10453SEric Joyner 
6371d10453SEric Joyner /* XLT1/PType group functions */
6471d10453SEric Joyner enum ice_status ice_ptg_update_xlt1(struct ice_hw *hw, enum ice_block blk);
6571d10453SEric Joyner void ice_ptg_free(struct ice_hw *hw, enum ice_block blk, u8 ptg);
6671d10453SEric Joyner 
6771d10453SEric Joyner /* XLT2/VSI group functions */
6871d10453SEric Joyner enum ice_status ice_vsig_update_xlt2(struct ice_hw *hw, enum ice_block blk);
6971d10453SEric Joyner enum ice_status
7071d10453SEric Joyner ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig);
7171d10453SEric Joyner enum ice_status
72*8923de59SPiotr Kubaj ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
73*8923de59SPiotr Kubaj 	     ice_bitmap_t *ptypes, struct ice_fv_word *es);
7471d10453SEric Joyner struct ice_prof_map *
7571d10453SEric Joyner ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id);
7671d10453SEric Joyner enum ice_status
7771d10453SEric Joyner ice_add_vsi_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig);
7871d10453SEric Joyner enum ice_status
7971d10453SEric Joyner ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
8071d10453SEric Joyner enum ice_status
8171d10453SEric Joyner ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
827d7af7f8SEric Joyner enum ice_status
8371d10453SEric Joyner ice_set_prof_context(struct ice_hw *hw, enum ice_block blk, u64 id, u64 cntxt);
847d7af7f8SEric Joyner enum ice_status
8571d10453SEric Joyner ice_get_prof_context(struct ice_hw *hw, enum ice_block blk, u64 id, u64 *cntxt);
8671d10453SEric Joyner enum ice_status ice_init_hw_tbls(struct ice_hw *hw);
8771d10453SEric Joyner void ice_fill_blk_tbls(struct ice_hw *hw);
8871d10453SEric Joyner void ice_clear_hw_tbls(struct ice_hw *hw);
8971d10453SEric Joyner void ice_free_hw_tbls(struct ice_hw *hw);
9071d10453SEric Joyner enum ice_status
9171d10453SEric Joyner ice_add_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi[], u8 count,
9271d10453SEric Joyner 	     u64 id);
9371d10453SEric Joyner enum ice_status
9471d10453SEric Joyner ice_rem_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi[], u8 count,
9571d10453SEric Joyner 	     u64 id);
9671d10453SEric Joyner enum ice_status
9771d10453SEric Joyner ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
98*8923de59SPiotr Kubaj 
99*8923de59SPiotr Kubaj void ice_fill_blk_tbls(struct ice_hw *hw);
100*8923de59SPiotr Kubaj 
101*8923de59SPiotr Kubaj /* To support tunneling entries by PF, the package will append the PF number to
102*8923de59SPiotr Kubaj  * the label; for example TNL_VXLAN_PF0, TNL_VXLAN_PF1, TNL_VXLAN_PF2, etc.
103*8923de59SPiotr Kubaj  */
104*8923de59SPiotr Kubaj #define ICE_TNL_PRE	"TNL_"
105*8923de59SPiotr Kubaj 
106*8923de59SPiotr Kubaj void ice_add_tunnel_hint(struct ice_hw *hw, char *label_name, u16 val);
10771d10453SEric Joyner 
10871d10453SEric Joyner #endif /* _ICE_FLEX_PIPE_H_ */
109