xref: /freebsd/sys/dev/ice/ice_flex_pipe.h (revision f2635e844dd138ac9dfba676f27d41750049af26)
171d10453SEric Joyner /* SPDX-License-Identifier: BSD-3-Clause */
2015f8cc5SEric Joyner /*  Copyright (c) 2024, 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 
3271d10453SEric Joyner #ifndef _ICE_FLEX_PIPE_H_
3371d10453SEric Joyner #define _ICE_FLEX_PIPE_H_
3471d10453SEric Joyner 
3571d10453SEric Joyner #include "ice_type.h"
3671d10453SEric Joyner 
37*f2635e84SEric Joyner int
3871d10453SEric Joyner ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx,
3971d10453SEric Joyner 		  u8 *prot, u16 *off);
40*f2635e84SEric Joyner int
4171d10453SEric Joyner ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type,
4271d10453SEric Joyner 		     u16 *value);
4371d10453SEric Joyner void
4471d10453SEric Joyner ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type type,
4571d10453SEric Joyner 		     ice_bitmap_t *bm);
4671d10453SEric Joyner void
4771d10453SEric Joyner ice_init_prof_result_bm(struct ice_hw *hw);
48*f2635e84SEric Joyner int
499cf1841cSEric Joyner ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
509cf1841cSEric Joyner 		      u16 buf_size, struct ice_sq_cd *cd);
5171d10453SEric Joyner bool
5271d10453SEric Joyner ice_get_open_tunnel_port(struct ice_hw *hw, enum ice_tunnel_type type,
5371d10453SEric Joyner 			 u16 *port);
54*f2635e84SEric Joyner int
5571d10453SEric Joyner ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port);
56*f2635e84SEric Joyner int ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all);
5771d10453SEric Joyner bool ice_tunnel_port_in_use(struct ice_hw *hw, u16 port, u16 *index);
5871d10453SEric Joyner bool
5971d10453SEric Joyner ice_tunnel_get_type(struct ice_hw *hw, u16 port, enum ice_tunnel_type *type);
60*f2635e84SEric Joyner int ice_replay_tunnels(struct ice_hw *hw);
6171d10453SEric Joyner 
6271d10453SEric Joyner /* XLT1/PType group functions */
63*f2635e84SEric Joyner int ice_ptg_update_xlt1(struct ice_hw *hw, enum ice_block blk);
6471d10453SEric Joyner void ice_ptg_free(struct ice_hw *hw, enum ice_block blk, u8 ptg);
6571d10453SEric Joyner 
6671d10453SEric Joyner /* XLT2/VSI group functions */
67*f2635e84SEric Joyner int ice_vsig_update_xlt2(struct ice_hw *hw, enum ice_block blk);
68*f2635e84SEric Joyner int
6971d10453SEric Joyner ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig);
70*f2635e84SEric Joyner int
718923de59SPiotr Kubaj ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id,
728923de59SPiotr Kubaj 	     ice_bitmap_t *ptypes, struct ice_fv_word *es);
7371d10453SEric Joyner struct ice_prof_map *
7471d10453SEric Joyner ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id);
75*f2635e84SEric Joyner int
7671d10453SEric Joyner ice_add_vsi_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig);
77*f2635e84SEric Joyner int
7871d10453SEric Joyner ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
79*f2635e84SEric Joyner int
8071d10453SEric Joyner ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
81*f2635e84SEric Joyner int
8271d10453SEric Joyner ice_set_prof_context(struct ice_hw *hw, enum ice_block blk, u64 id, u64 cntxt);
83*f2635e84SEric Joyner int
8471d10453SEric Joyner ice_get_prof_context(struct ice_hw *hw, enum ice_block blk, u64 id, u64 *cntxt);
85*f2635e84SEric Joyner int ice_init_hw_tbls(struct ice_hw *hw);
8671d10453SEric Joyner void ice_fill_blk_tbls(struct ice_hw *hw);
8771d10453SEric Joyner void ice_clear_hw_tbls(struct ice_hw *hw);
8871d10453SEric Joyner void ice_free_hw_tbls(struct ice_hw *hw);
89*f2635e84SEric Joyner int
9071d10453SEric Joyner ice_add_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi[], u8 count,
9171d10453SEric Joyner 	     u64 id);
92*f2635e84SEric Joyner int
9371d10453SEric Joyner ice_rem_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi[], u8 count,
9471d10453SEric Joyner 	     u64 id);
95*f2635e84SEric Joyner int
9671d10453SEric Joyner ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id);
978923de59SPiotr Kubaj 
988923de59SPiotr Kubaj void ice_fill_blk_tbls(struct ice_hw *hw);
998923de59SPiotr Kubaj 
1008923de59SPiotr Kubaj /* To support tunneling entries by PF, the package will append the PF number to
1018923de59SPiotr Kubaj  * the label; for example TNL_VXLAN_PF0, TNL_VXLAN_PF1, TNL_VXLAN_PF2, etc.
1028923de59SPiotr Kubaj  */
1038923de59SPiotr Kubaj #define ICE_TNL_PRE	"TNL_"
1048923de59SPiotr Kubaj 
1058923de59SPiotr Kubaj void ice_add_tunnel_hint(struct ice_hw *hw, char *label_name, u16 val);
10671d10453SEric Joyner 
10771d10453SEric Joyner #endif /* _ICE_FLEX_PIPE_H_ */
108