162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright (c) 2018, Intel Corporation. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _ICE_SWITCH_H_ 562306a36Sopenharmony_ci#define _ICE_SWITCH_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include "ice_common.h" 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define ICE_SW_CFG_MAX_BUF_LEN 2048 1062306a36Sopenharmony_ci#define ICE_DFLT_VSI_INVAL 0xff 1162306a36Sopenharmony_ci#define ICE_FLTR_RX BIT(0) 1262306a36Sopenharmony_ci#define ICE_FLTR_TX BIT(1) 1362306a36Sopenharmony_ci#define ICE_VSI_INVAL_ID 0xffff 1462306a36Sopenharmony_ci#define ICE_INVAL_Q_HANDLE 0xFFFF 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* Switch Profile IDs for Profile related switch rules */ 1762306a36Sopenharmony_ci#define ICE_PROFID_IPV4_GTPC_TEID 41 1862306a36Sopenharmony_ci#define ICE_PROFID_IPV4_GTPC_NO_TEID 42 1962306a36Sopenharmony_ci#define ICE_PROFID_IPV4_GTPU_TEID 43 2062306a36Sopenharmony_ci#define ICE_PROFID_IPV6_GTPC_TEID 44 2162306a36Sopenharmony_ci#define ICE_PROFID_IPV6_GTPC_NO_TEID 45 2262306a36Sopenharmony_ci#define ICE_PROFID_IPV6_GTPU_TEID 46 2362306a36Sopenharmony_ci#define ICE_PROFID_IPV6_GTPU_IPV6_TCP_INNER 70 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define ICE_SW_RULE_VSI_LIST_SIZE(s, n) struct_size((s), vsi, (n)) 2662306a36Sopenharmony_ci#define ICE_SW_RULE_RX_TX_HDR_SIZE(s, l) struct_size((s), hdr_data, (l)) 2762306a36Sopenharmony_ci#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE(s) \ 2862306a36Sopenharmony_ci ICE_SW_RULE_RX_TX_HDR_SIZE((s), DUMMY_ETH_HDR_LEN) 2962306a36Sopenharmony_ci#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE(s) \ 3062306a36Sopenharmony_ci ICE_SW_RULE_RX_TX_HDR_SIZE((s), 0) 3162306a36Sopenharmony_ci#define ICE_SW_RULE_LG_ACT_SIZE(s, n) struct_size((s), act, (n)) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define DUMMY_ETH_HDR_LEN 16 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci/* VSI context structure for add/get/update/free operations */ 3662306a36Sopenharmony_cistruct ice_vsi_ctx { 3762306a36Sopenharmony_ci u16 vsi_num; 3862306a36Sopenharmony_ci u16 vsis_allocd; 3962306a36Sopenharmony_ci u16 vsis_unallocated; 4062306a36Sopenharmony_ci u16 flags; 4162306a36Sopenharmony_ci struct ice_aqc_vsi_props info; 4262306a36Sopenharmony_ci struct ice_sched_vsi_info sched; 4362306a36Sopenharmony_ci u8 alloc_from_pool; 4462306a36Sopenharmony_ci u8 vf_num; 4562306a36Sopenharmony_ci u16 num_lan_q_entries[ICE_MAX_TRAFFIC_CLASS]; 4662306a36Sopenharmony_ci struct ice_q_ctx *lan_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 4762306a36Sopenharmony_ci u16 num_rdma_q_entries[ICE_MAX_TRAFFIC_CLASS]; 4862306a36Sopenharmony_ci struct ice_q_ctx *rdma_q_ctx[ICE_MAX_TRAFFIC_CLASS]; 4962306a36Sopenharmony_ci}; 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/* Switch recipe ID enum values are specific to hardware */ 5262306a36Sopenharmony_cienum ice_sw_lkup_type { 5362306a36Sopenharmony_ci ICE_SW_LKUP_ETHERTYPE = 0, 5462306a36Sopenharmony_ci ICE_SW_LKUP_MAC = 1, 5562306a36Sopenharmony_ci ICE_SW_LKUP_MAC_VLAN = 2, 5662306a36Sopenharmony_ci ICE_SW_LKUP_PROMISC = 3, 5762306a36Sopenharmony_ci ICE_SW_LKUP_VLAN = 4, 5862306a36Sopenharmony_ci ICE_SW_LKUP_DFLT = 5, 5962306a36Sopenharmony_ci ICE_SW_LKUP_ETHERTYPE_MAC = 8, 6062306a36Sopenharmony_ci ICE_SW_LKUP_PROMISC_VLAN = 9, 6162306a36Sopenharmony_ci ICE_SW_LKUP_LAST 6262306a36Sopenharmony_ci}; 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* type of filter src ID */ 6562306a36Sopenharmony_cienum ice_src_id { 6662306a36Sopenharmony_ci ICE_SRC_ID_UNKNOWN = 0, 6762306a36Sopenharmony_ci ICE_SRC_ID_VSI, 6862306a36Sopenharmony_ci ICE_SRC_ID_QUEUE, 6962306a36Sopenharmony_ci ICE_SRC_ID_LPORT, 7062306a36Sopenharmony_ci}; 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_cistruct ice_fltr_info { 7362306a36Sopenharmony_ci /* Look up information: how to look up packet */ 7462306a36Sopenharmony_ci enum ice_sw_lkup_type lkup_type; 7562306a36Sopenharmony_ci /* Forward action: filter action to do after lookup */ 7662306a36Sopenharmony_ci enum ice_sw_fwd_act_type fltr_act; 7762306a36Sopenharmony_ci /* rule ID returned by firmware once filter rule is created */ 7862306a36Sopenharmony_ci u16 fltr_rule_id; 7962306a36Sopenharmony_ci u16 flag; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 8262306a36Sopenharmony_ci u16 src; 8362306a36Sopenharmony_ci enum ice_src_id src_id; 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci union { 8662306a36Sopenharmony_ci struct { 8762306a36Sopenharmony_ci u8 mac_addr[ETH_ALEN]; 8862306a36Sopenharmony_ci } mac; 8962306a36Sopenharmony_ci struct { 9062306a36Sopenharmony_ci u8 mac_addr[ETH_ALEN]; 9162306a36Sopenharmony_ci u16 vlan_id; 9262306a36Sopenharmony_ci } mac_vlan; 9362306a36Sopenharmony_ci struct { 9462306a36Sopenharmony_ci u16 vlan_id; 9562306a36Sopenharmony_ci u16 tpid; 9662306a36Sopenharmony_ci u8 tpid_valid; 9762306a36Sopenharmony_ci } vlan; 9862306a36Sopenharmony_ci /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE 9962306a36Sopenharmony_ci * if just using ethertype as filter. Set lkup_type as 10062306a36Sopenharmony_ci * ICE_SW_LKUP_ETHERTYPE_MAC if MAC also needs to be 10162306a36Sopenharmony_ci * passed in as filter. 10262306a36Sopenharmony_ci */ 10362306a36Sopenharmony_ci struct { 10462306a36Sopenharmony_ci u16 ethertype; 10562306a36Sopenharmony_ci u8 mac_addr[ETH_ALEN]; /* optional */ 10662306a36Sopenharmony_ci } ethertype_mac; 10762306a36Sopenharmony_ci } l_data; /* Make sure to zero out the memory of l_data before using 10862306a36Sopenharmony_ci * it or only set the data associated with lookup match 10962306a36Sopenharmony_ci * rest everything should be zero 11062306a36Sopenharmony_ci */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci /* Depending on filter action */ 11362306a36Sopenharmony_ci union { 11462306a36Sopenharmony_ci /* queue ID in case of ICE_FWD_TO_Q and starting 11562306a36Sopenharmony_ci * queue ID in case of ICE_FWD_TO_QGRP. 11662306a36Sopenharmony_ci */ 11762306a36Sopenharmony_ci u16 q_id:11; 11862306a36Sopenharmony_ci u16 hw_vsi_id:10; 11962306a36Sopenharmony_ci u16 vsi_list_id:10; 12062306a36Sopenharmony_ci } fwd_id; 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci /* Sw VSI handle */ 12362306a36Sopenharmony_ci u16 vsi_handle; 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci /* Set to num_queues if action is ICE_FWD_TO_QGRP. This field 12662306a36Sopenharmony_ci * determines the range of queues the packet needs to be forwarded to. 12762306a36Sopenharmony_ci * Note that qgrp_size must be set to a power of 2. 12862306a36Sopenharmony_ci */ 12962306a36Sopenharmony_ci u8 qgrp_size; 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci /* Rule creations populate these indicators basing on the switch type */ 13262306a36Sopenharmony_ci u8 lb_en; /* Indicate if packet can be looped back */ 13362306a36Sopenharmony_ci u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_cistruct ice_update_recipe_lkup_idx_params { 13762306a36Sopenharmony_ci u16 rid; 13862306a36Sopenharmony_ci u16 fv_idx; 13962306a36Sopenharmony_ci bool ignore_valid; 14062306a36Sopenharmony_ci u16 mask; 14162306a36Sopenharmony_ci bool mask_valid; 14262306a36Sopenharmony_ci u8 lkup_idx; 14362306a36Sopenharmony_ci}; 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_cistruct ice_adv_lkup_elem { 14662306a36Sopenharmony_ci enum ice_protocol_type type; 14762306a36Sopenharmony_ci union { 14862306a36Sopenharmony_ci union ice_prot_hdr h_u; /* Header values */ 14962306a36Sopenharmony_ci /* Used to iterate over the headers */ 15062306a36Sopenharmony_ci u16 h_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 15162306a36Sopenharmony_ci }; 15262306a36Sopenharmony_ci union { 15362306a36Sopenharmony_ci union ice_prot_hdr m_u; /* Mask of header values to match */ 15462306a36Sopenharmony_ci /* Used to iterate over header mask */ 15562306a36Sopenharmony_ci u16 m_raw[sizeof(union ice_prot_hdr) / sizeof(u16)]; 15662306a36Sopenharmony_ci }; 15762306a36Sopenharmony_ci}; 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_cistruct ice_sw_act_ctrl { 16062306a36Sopenharmony_ci /* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ 16162306a36Sopenharmony_ci u16 src; 16262306a36Sopenharmony_ci u16 flag; 16362306a36Sopenharmony_ci enum ice_sw_fwd_act_type fltr_act; 16462306a36Sopenharmony_ci /* Depending on filter action */ 16562306a36Sopenharmony_ci union { 16662306a36Sopenharmony_ci /* This is a queue ID in case of ICE_FWD_TO_Q and starting 16762306a36Sopenharmony_ci * queue ID in case of ICE_FWD_TO_QGRP. 16862306a36Sopenharmony_ci */ 16962306a36Sopenharmony_ci u16 q_id:11; 17062306a36Sopenharmony_ci u16 vsi_id:10; 17162306a36Sopenharmony_ci u16 hw_vsi_id:10; 17262306a36Sopenharmony_ci u16 vsi_list_id:10; 17362306a36Sopenharmony_ci } fwd_id; 17462306a36Sopenharmony_ci /* software VSI handle */ 17562306a36Sopenharmony_ci u16 vsi_handle; 17662306a36Sopenharmony_ci u8 qgrp_size; 17762306a36Sopenharmony_ci}; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_cistruct ice_rule_query_data { 18062306a36Sopenharmony_ci /* Recipe ID for which the requested rule was added */ 18162306a36Sopenharmony_ci u16 rid; 18262306a36Sopenharmony_ci /* Rule ID that was added or is supposed to be removed */ 18362306a36Sopenharmony_ci u16 rule_id; 18462306a36Sopenharmony_ci /* vsi_handle for which Rule was added or is supposed to be removed */ 18562306a36Sopenharmony_ci u16 vsi_handle; 18662306a36Sopenharmony_ci}; 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci/* This structure allows to pass info about lb_en and lan_en 18962306a36Sopenharmony_ci * flags to ice_add_adv_rule. Values in act would be used 19062306a36Sopenharmony_ci * only if act_valid was set to true, otherwise default 19162306a36Sopenharmony_ci * values would be used. 19262306a36Sopenharmony_ci */ 19362306a36Sopenharmony_cistruct ice_adv_rule_flags_info { 19462306a36Sopenharmony_ci u32 act; 19562306a36Sopenharmony_ci u8 act_valid; /* indicate if flags in act are valid */ 19662306a36Sopenharmony_ci}; 19762306a36Sopenharmony_ci 19862306a36Sopenharmony_cistruct ice_adv_rule_info { 19962306a36Sopenharmony_ci /* Store metadata values in rule info */ 20062306a36Sopenharmony_ci enum ice_sw_tunnel_type tun_type; 20162306a36Sopenharmony_ci u16 vlan_type; 20262306a36Sopenharmony_ci u16 fltr_rule_id; 20362306a36Sopenharmony_ci u32 priority; 20462306a36Sopenharmony_ci u16 need_pass_l2:1; 20562306a36Sopenharmony_ci u16 allow_pass_l2:1; 20662306a36Sopenharmony_ci u16 src_vsi; 20762306a36Sopenharmony_ci struct ice_sw_act_ctrl sw_act; 20862306a36Sopenharmony_ci struct ice_adv_rule_flags_info flags_info; 20962306a36Sopenharmony_ci}; 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci/* A collection of one or more four word recipe */ 21262306a36Sopenharmony_cistruct ice_sw_recipe { 21362306a36Sopenharmony_ci /* For a chained recipe the root recipe is what should be used for 21462306a36Sopenharmony_ci * programming rules 21562306a36Sopenharmony_ci */ 21662306a36Sopenharmony_ci u8 is_root; 21762306a36Sopenharmony_ci u8 root_rid; 21862306a36Sopenharmony_ci u8 recp_created; 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci /* Number of extraction words */ 22162306a36Sopenharmony_ci u8 n_ext_words; 22262306a36Sopenharmony_ci /* Protocol ID and Offset pair (extraction word) to describe the 22362306a36Sopenharmony_ci * recipe 22462306a36Sopenharmony_ci */ 22562306a36Sopenharmony_ci struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS]; 22662306a36Sopenharmony_ci u16 word_masks[ICE_MAX_CHAIN_WORDS]; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci /* if this recipe is a collection of other recipe */ 22962306a36Sopenharmony_ci u8 big_recp; 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci /* if this recipe is part of another bigger recipe then chain index 23262306a36Sopenharmony_ci * corresponding to this recipe 23362306a36Sopenharmony_ci */ 23462306a36Sopenharmony_ci u8 chain_idx; 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci /* if this recipe is a collection of other recipe then count of other 23762306a36Sopenharmony_ci * recipes and recipe IDs of those recipes 23862306a36Sopenharmony_ci */ 23962306a36Sopenharmony_ci u8 n_grp_count; 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci /* Bit map specifying the IDs associated with this group of recipe */ 24262306a36Sopenharmony_ci DECLARE_BITMAP(r_bitmap, ICE_MAX_NUM_RECIPES); 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci enum ice_sw_tunnel_type tun_type; 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci /* List of type ice_fltr_mgmt_list_entry or adv_rule */ 24762306a36Sopenharmony_ci u8 adv_rule; 24862306a36Sopenharmony_ci struct list_head filt_rules; 24962306a36Sopenharmony_ci struct list_head filt_replay_rules; 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci struct mutex filt_rule_lock; /* protect filter rule structure */ 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci /* Profiles this recipe should be associated with */ 25462306a36Sopenharmony_ci struct list_head fv_list; 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci /* Profiles this recipe is associated with */ 25762306a36Sopenharmony_ci u8 num_profs, *prof_ids; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci /* Bit map for possible result indexes */ 26062306a36Sopenharmony_ci DECLARE_BITMAP(res_idxs, ICE_MAX_FV_WORDS); 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci /* This allows user to specify the recipe priority. 26362306a36Sopenharmony_ci * For now, this becomes 'fwd_priority' when recipe 26462306a36Sopenharmony_ci * is created, usually recipes can have 'fwd' and 'join' 26562306a36Sopenharmony_ci * priority. 26662306a36Sopenharmony_ci */ 26762306a36Sopenharmony_ci u8 priority; 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci u8 need_pass_l2:1; 27062306a36Sopenharmony_ci u8 allow_pass_l2:1; 27162306a36Sopenharmony_ci 27262306a36Sopenharmony_ci struct list_head rg_list; 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci /* AQ buffer associated with this recipe */ 27562306a36Sopenharmony_ci struct ice_aqc_recipe_data_elem *root_buf; 27662306a36Sopenharmony_ci /* This struct saves the fv_words for a given lookup */ 27762306a36Sopenharmony_ci struct ice_prot_lkup_ext lkup_exts; 27862306a36Sopenharmony_ci}; 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci/* Bookkeeping structure to hold bitmap of VSIs corresponding to VSI list ID */ 28162306a36Sopenharmony_cistruct ice_vsi_list_map_info { 28262306a36Sopenharmony_ci struct list_head list_entry; 28362306a36Sopenharmony_ci DECLARE_BITMAP(vsi_map, ICE_MAX_VSI); 28462306a36Sopenharmony_ci u16 vsi_list_id; 28562306a36Sopenharmony_ci /* counter to track how many rules are reusing this VSI list */ 28662306a36Sopenharmony_ci u16 ref_cnt; 28762306a36Sopenharmony_ci}; 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_cistruct ice_fltr_list_entry { 29062306a36Sopenharmony_ci struct list_head list_entry; 29162306a36Sopenharmony_ci int status; 29262306a36Sopenharmony_ci struct ice_fltr_info fltr_info; 29362306a36Sopenharmony_ci}; 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci/* This defines an entry in the list that maintains MAC or VLAN membership 29662306a36Sopenharmony_ci * to HW list mapping, since multiple VSIs can subscribe to the same MAC or 29762306a36Sopenharmony_ci * VLAN. As an optimization the VSI list should be created only when a 29862306a36Sopenharmony_ci * second VSI becomes a subscriber to the same MAC address. VSI lists are always 29962306a36Sopenharmony_ci * used for VLAN membership. 30062306a36Sopenharmony_ci */ 30162306a36Sopenharmony_cistruct ice_fltr_mgmt_list_entry { 30262306a36Sopenharmony_ci /* back pointer to VSI list ID to VSI list mapping */ 30362306a36Sopenharmony_ci struct ice_vsi_list_map_info *vsi_list_info; 30462306a36Sopenharmony_ci u16 vsi_count; 30562306a36Sopenharmony_ci#define ICE_INVAL_LG_ACT_INDEX 0xffff 30662306a36Sopenharmony_ci u16 lg_act_idx; 30762306a36Sopenharmony_ci#define ICE_INVAL_SW_MARKER_ID 0xffff 30862306a36Sopenharmony_ci u16 sw_marker_id; 30962306a36Sopenharmony_ci struct list_head list_entry; 31062306a36Sopenharmony_ci struct ice_fltr_info fltr_info; 31162306a36Sopenharmony_ci#define ICE_INVAL_COUNTER_ID 0xff 31262306a36Sopenharmony_ci u8 counter_index; 31362306a36Sopenharmony_ci}; 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_cistruct ice_adv_fltr_mgmt_list_entry { 31662306a36Sopenharmony_ci struct list_head list_entry; 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci struct ice_adv_lkup_elem *lkups; 31962306a36Sopenharmony_ci struct ice_adv_rule_info rule_info; 32062306a36Sopenharmony_ci u16 lkups_cnt; 32162306a36Sopenharmony_ci struct ice_vsi_list_map_info *vsi_list_info; 32262306a36Sopenharmony_ci u16 vsi_count; 32362306a36Sopenharmony_ci}; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_cienum ice_promisc_flags { 32662306a36Sopenharmony_ci ICE_PROMISC_UCAST_RX = 0x1, 32762306a36Sopenharmony_ci ICE_PROMISC_UCAST_TX = 0x2, 32862306a36Sopenharmony_ci ICE_PROMISC_MCAST_RX = 0x4, 32962306a36Sopenharmony_ci ICE_PROMISC_MCAST_TX = 0x8, 33062306a36Sopenharmony_ci ICE_PROMISC_BCAST_RX = 0x10, 33162306a36Sopenharmony_ci ICE_PROMISC_BCAST_TX = 0x20, 33262306a36Sopenharmony_ci ICE_PROMISC_VLAN_RX = 0x40, 33362306a36Sopenharmony_ci ICE_PROMISC_VLAN_TX = 0x80, 33462306a36Sopenharmony_ci}; 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_ci/* VSI related commands */ 33762306a36Sopenharmony_ciint 33862306a36Sopenharmony_ciice_add_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 33962306a36Sopenharmony_ci struct ice_sq_cd *cd); 34062306a36Sopenharmony_ciint 34162306a36Sopenharmony_ciice_free_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 34262306a36Sopenharmony_ci bool keep_vsi_alloc, struct ice_sq_cd *cd); 34362306a36Sopenharmony_ciint 34462306a36Sopenharmony_ciice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, 34562306a36Sopenharmony_ci struct ice_sq_cd *cd); 34662306a36Sopenharmony_cibool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 34762306a36Sopenharmony_cistruct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 34862306a36Sopenharmony_civoid ice_clear_all_vsi_ctx(struct ice_hw *hw); 34962306a36Sopenharmony_ci/* Switch config */ 35062306a36Sopenharmony_ciint ice_get_initial_sw_cfg(struct ice_hw *hw); 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ciint 35362306a36Sopenharmony_ciice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 35462306a36Sopenharmony_ci u16 *counter_id); 35562306a36Sopenharmony_ciint 35662306a36Sopenharmony_ciice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, 35762306a36Sopenharmony_ci u16 counter_id); 35862306a36Sopenharmony_ciint ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id); 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci/* Switch/bridge related commands */ 36162306a36Sopenharmony_civoid ice_rule_add_tunnel_metadata(struct ice_adv_lkup_elem *lkup); 36262306a36Sopenharmony_civoid ice_rule_add_direction_metadata(struct ice_adv_lkup_elem *lkup); 36362306a36Sopenharmony_civoid ice_rule_add_vlan_metadata(struct ice_adv_lkup_elem *lkup); 36462306a36Sopenharmony_civoid ice_rule_add_src_vsi_metadata(struct ice_adv_lkup_elem *lkup); 36562306a36Sopenharmony_ciint 36662306a36Sopenharmony_ciice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, 36762306a36Sopenharmony_ci u16 lkups_cnt, struct ice_adv_rule_info *rinfo, 36862306a36Sopenharmony_ci struct ice_rule_query_data *added_entry); 36962306a36Sopenharmony_ciint ice_update_sw_rule_bridge_mode(struct ice_hw *hw); 37062306a36Sopenharmony_ciint ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); 37162306a36Sopenharmony_ciint ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); 37262306a36Sopenharmony_ciint ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); 37362306a36Sopenharmony_ciint ice_remove_mac(struct ice_hw *hw, struct list_head *m_lst); 37462306a36Sopenharmony_cibool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle); 37562306a36Sopenharmony_ciint ice_add_eth_mac(struct ice_hw *hw, struct list_head *em_list); 37662306a36Sopenharmony_ciint ice_remove_eth_mac(struct ice_hw *hw, struct list_head *em_list); 37762306a36Sopenharmony_ciint ice_cfg_rdma_fltr(struct ice_hw *hw, u16 vsi_handle, bool enable); 37862306a36Sopenharmony_civoid ice_remove_vsi_fltr(struct ice_hw *hw, u16 vsi_handle); 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci/* Promisc/defport setup for VSIs */ 38162306a36Sopenharmony_ciint 38262306a36Sopenharmony_ciice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, 38362306a36Sopenharmony_ci u8 direction); 38462306a36Sopenharmony_cibool 38562306a36Sopenharmony_ciice_check_if_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, 38662306a36Sopenharmony_ci bool *rule_exists); 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ciint 38962306a36Sopenharmony_ciice_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 39062306a36Sopenharmony_ci u16 vid); 39162306a36Sopenharmony_ciint 39262306a36Sopenharmony_ciice_clear_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 39362306a36Sopenharmony_ci u16 vid); 39462306a36Sopenharmony_ciint 39562306a36Sopenharmony_ciice_set_vlan_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, 39662306a36Sopenharmony_ci bool rm_vlan_promisc); 39762306a36Sopenharmony_ci 39862306a36Sopenharmony_ciint 39962306a36Sopenharmony_ciice_rem_adv_rule_by_id(struct ice_hw *hw, 40062306a36Sopenharmony_ci struct ice_rule_query_data *remove_entry); 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ciint ice_init_def_sw_recp(struct ice_hw *hw); 40362306a36Sopenharmony_ciu16 ice_get_hw_vsi_num(struct ice_hw *hw, u16 vsi_handle); 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ciint ice_replay_vsi_all_fltr(struct ice_hw *hw, u16 vsi_handle); 40662306a36Sopenharmony_civoid ice_rm_all_sw_replay_rule_info(struct ice_hw *hw); 40762306a36Sopenharmony_civoid ice_fill_eth_hdr(u8 *eth_hdr); 40862306a36Sopenharmony_ci 40962306a36Sopenharmony_ciint 41062306a36Sopenharmony_ciice_aq_sw_rules(struct ice_hw *hw, void *rule_list, u16 rule_list_sz, 41162306a36Sopenharmony_ci u8 num_rules, enum ice_adminq_opc opc, struct ice_sq_cd *cd); 41262306a36Sopenharmony_ciint 41362306a36Sopenharmony_ciice_update_recipe_lkup_idx(struct ice_hw *hw, 41462306a36Sopenharmony_ci struct ice_update_recipe_lkup_idx_params *params); 41562306a36Sopenharmony_civoid ice_change_proto_id_to_dvm(void); 41662306a36Sopenharmony_cistruct ice_vsi_list_map_info * 41762306a36Sopenharmony_ciice_find_vsi_list_entry(struct ice_hw *hw, u8 recp_id, u16 vsi_handle, 41862306a36Sopenharmony_ci u16 *vsi_list_id); 41962306a36Sopenharmony_ciint ice_alloc_recipe(struct ice_hw *hw, u16 *rid); 42062306a36Sopenharmony_ciint ice_aq_get_recipe(struct ice_hw *hw, 42162306a36Sopenharmony_ci struct ice_aqc_recipe_data_elem *s_recipe_list, 42262306a36Sopenharmony_ci u16 *num_recipes, u16 recipe_root, struct ice_sq_cd *cd); 42362306a36Sopenharmony_ciint ice_aq_add_recipe(struct ice_hw *hw, 42462306a36Sopenharmony_ci struct ice_aqc_recipe_data_elem *s_recipe_list, 42562306a36Sopenharmony_ci u16 num_recipes, struct ice_sq_cd *cd); 42662306a36Sopenharmony_ciint 42762306a36Sopenharmony_ciice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, 42862306a36Sopenharmony_ci struct ice_sq_cd *cd); 42962306a36Sopenharmony_ciint 43062306a36Sopenharmony_ciice_aq_map_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u8 *r_bitmap, 43162306a36Sopenharmony_ci struct ice_sq_cd *cd); 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_ci#endif /* _ICE_SWITCH_H_ */ 434