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_FLOW_H_ 3371d10453SEric Joyner #define _ICE_FLOW_H_ 3471d10453SEric Joyner 3571d10453SEric Joyner #include "ice_flex_type.h" 367d7af7f8SEric Joyner 3771d10453SEric Joyner #define ICE_IPV4_MAKE_PREFIX_MASK(prefix) ((u32)(~0) << (32 - (prefix))) 3871d10453SEric Joyner #define ICE_FLOW_PROF_ID_INVAL 0xfffffffffffffffful 3971d10453SEric Joyner #define ICE_FLOW_PROF_ID_BYPASS 0 4071d10453SEric Joyner #define ICE_FLOW_PROF_ID_DEFAULT 1 4171d10453SEric Joyner #define ICE_FLOW_ENTRY_HANDLE_INVAL 0 4271d10453SEric Joyner #define ICE_FLOW_VSI_INVAL 0xffff 4371d10453SEric Joyner #define ICE_FLOW_FLD_OFF_INVAL 0xffff 4471d10453SEric Joyner 4571d10453SEric Joyner /* Generate flow hash field from flow field type(s) */ 4671d10453SEric Joyner #define ICE_FLOW_HASH_IPV4 \ 4771d10453SEric Joyner (BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA) | \ 4871d10453SEric Joyner BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA)) 4971d10453SEric Joyner #define ICE_FLOW_HASH_IPV6 \ 5071d10453SEric Joyner (BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA) | \ 5171d10453SEric Joyner BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA)) 5271d10453SEric Joyner #define ICE_FLOW_HASH_TCP_PORT \ 5371d10453SEric Joyner (BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_SRC_PORT) | \ 5471d10453SEric Joyner BIT_ULL(ICE_FLOW_FIELD_IDX_TCP_DST_PORT)) 5571d10453SEric Joyner #define ICE_FLOW_HASH_UDP_PORT \ 5671d10453SEric Joyner (BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_SRC_PORT) | \ 5771d10453SEric Joyner BIT_ULL(ICE_FLOW_FIELD_IDX_UDP_DST_PORT)) 5871d10453SEric Joyner #define ICE_FLOW_HASH_SCTP_PORT \ 5971d10453SEric Joyner (BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT) | \ 6071d10453SEric Joyner BIT_ULL(ICE_FLOW_FIELD_IDX_SCTP_DST_PORT)) 6171d10453SEric Joyner 6271d10453SEric Joyner #define ICE_HASH_INVALID 0 6371d10453SEric Joyner #define ICE_HASH_TCP_IPV4 (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_TCP_PORT) 6471d10453SEric Joyner #define ICE_HASH_TCP_IPV6 (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_TCP_PORT) 6571d10453SEric Joyner #define ICE_HASH_UDP_IPV4 (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_UDP_PORT) 6671d10453SEric Joyner #define ICE_HASH_UDP_IPV6 (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_UDP_PORT) 6771d10453SEric Joyner #define ICE_HASH_SCTP_IPV4 (ICE_FLOW_HASH_IPV4 | ICE_FLOW_HASH_SCTP_PORT) 6871d10453SEric Joyner #define ICE_HASH_SCTP_IPV6 (ICE_FLOW_HASH_IPV6 | ICE_FLOW_HASH_SCTP_PORT) 6971d10453SEric Joyner 7071d10453SEric Joyner /* Protocol header fields within a packet segment. A segment consists of one or 7171d10453SEric Joyner * more protocol headers that make up a logical group of protocol headers. Each 7271d10453SEric Joyner * logical group of protocol headers encapsulates or is encapsulated using/by 7371d10453SEric Joyner * tunneling or encapsulation protocols for network virtualization such as GRE, 7471d10453SEric Joyner * VxLAN, etc. 7571d10453SEric Joyner */ 7671d10453SEric Joyner enum ice_flow_seg_hdr { 7771d10453SEric Joyner ICE_FLOW_SEG_HDR_NONE = 0x00000000, 7871d10453SEric Joyner ICE_FLOW_SEG_HDR_ETH = 0x00000001, 7971d10453SEric Joyner ICE_FLOW_SEG_HDR_VLAN = 0x00000002, 8071d10453SEric Joyner ICE_FLOW_SEG_HDR_IPV4 = 0x00000004, 8171d10453SEric Joyner ICE_FLOW_SEG_HDR_IPV6 = 0x00000008, 8271d10453SEric Joyner ICE_FLOW_SEG_HDR_ARP = 0x00000010, 8371d10453SEric Joyner ICE_FLOW_SEG_HDR_ICMP = 0x00000020, 8471d10453SEric Joyner ICE_FLOW_SEG_HDR_TCP = 0x00000040, 8571d10453SEric Joyner ICE_FLOW_SEG_HDR_UDP = 0x00000080, 8671d10453SEric Joyner ICE_FLOW_SEG_HDR_SCTP = 0x00000100, 8771d10453SEric Joyner ICE_FLOW_SEG_HDR_GRE = 0x00000200, 887d7af7f8SEric Joyner /* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and 8956429daeSEric Joyner * ICE_FLOW_SEG_HDR_IPV6. 907d7af7f8SEric Joyner */ 9156429daeSEric Joyner ICE_FLOW_SEG_HDR_IPV_FRAG = 0x40000000, 9256429daeSEric Joyner ICE_FLOW_SEG_HDR_IPV_OTHER = 0x80000000, 9371d10453SEric Joyner }; 9471d10453SEric Joyner 9571d10453SEric Joyner enum ice_flow_field { 9671d10453SEric Joyner /* L2 */ 9771d10453SEric Joyner ICE_FLOW_FIELD_IDX_ETH_DA, 9871d10453SEric Joyner ICE_FLOW_FIELD_IDX_ETH_SA, 9971d10453SEric Joyner ICE_FLOW_FIELD_IDX_S_VLAN, 10071d10453SEric Joyner ICE_FLOW_FIELD_IDX_C_VLAN, 10171d10453SEric Joyner ICE_FLOW_FIELD_IDX_ETH_TYPE, 10271d10453SEric Joyner /* L3 */ 10371d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV4_DSCP, 10471d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV6_DSCP, 10571d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV4_TTL, 10671d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV4_PROT, 10771d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV6_TTL, 10871d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV6_PROT, 10971d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV4_SA, 11071d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV4_DA, 11171d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV6_SA, 11271d10453SEric Joyner ICE_FLOW_FIELD_IDX_IPV6_DA, 11371d10453SEric Joyner /* L4 */ 11471d10453SEric Joyner ICE_FLOW_FIELD_IDX_TCP_SRC_PORT, 11571d10453SEric Joyner ICE_FLOW_FIELD_IDX_TCP_DST_PORT, 11671d10453SEric Joyner ICE_FLOW_FIELD_IDX_UDP_SRC_PORT, 11771d10453SEric Joyner ICE_FLOW_FIELD_IDX_UDP_DST_PORT, 11871d10453SEric Joyner ICE_FLOW_FIELD_IDX_SCTP_SRC_PORT, 11971d10453SEric Joyner ICE_FLOW_FIELD_IDX_SCTP_DST_PORT, 12071d10453SEric Joyner ICE_FLOW_FIELD_IDX_TCP_FLAGS, 12171d10453SEric Joyner /* ARP */ 12271d10453SEric Joyner ICE_FLOW_FIELD_IDX_ARP_SIP, 12371d10453SEric Joyner ICE_FLOW_FIELD_IDX_ARP_DIP, 12471d10453SEric Joyner ICE_FLOW_FIELD_IDX_ARP_SHA, 12571d10453SEric Joyner ICE_FLOW_FIELD_IDX_ARP_DHA, 12671d10453SEric Joyner ICE_FLOW_FIELD_IDX_ARP_OP, 12771d10453SEric Joyner /* ICMP */ 12871d10453SEric Joyner ICE_FLOW_FIELD_IDX_ICMP_TYPE, 12971d10453SEric Joyner ICE_FLOW_FIELD_IDX_ICMP_CODE, 13071d10453SEric Joyner /* GRE */ 13171d10453SEric Joyner ICE_FLOW_FIELD_IDX_GRE_KEYID, 13271d10453SEric Joyner /* The total number of enums must not exceed 64 */ 13371d10453SEric Joyner ICE_FLOW_FIELD_IDX_MAX 13471d10453SEric Joyner }; 13571d10453SEric Joyner 13671d10453SEric Joyner /* Flow headers and fields for AVF support */ 13771d10453SEric Joyner enum ice_flow_avf_hdr_field { 13871d10453SEric Joyner /* Values 0 - 28 are reserved for future use */ 13971d10453SEric Joyner ICE_AVF_FLOW_FIELD_INVALID = 0, 14071d10453SEric Joyner ICE_AVF_FLOW_FIELD_UNICAST_IPV4_UDP = 29, 14171d10453SEric Joyner ICE_AVF_FLOW_FIELD_MULTICAST_IPV4_UDP, 14271d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV4_UDP, 14371d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV4_TCP_SYN_NO_ACK, 14471d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV4_TCP, 14571d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV4_SCTP, 14671d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV4_OTHER, 14771d10453SEric Joyner ICE_AVF_FLOW_FIELD_FRAG_IPV4, 14871d10453SEric Joyner /* Values 37-38 are reserved */ 14971d10453SEric Joyner ICE_AVF_FLOW_FIELD_UNICAST_IPV6_UDP = 39, 15071d10453SEric Joyner ICE_AVF_FLOW_FIELD_MULTICAST_IPV6_UDP, 15171d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV6_UDP, 15271d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV6_TCP_SYN_NO_ACK, 15371d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV6_TCP, 15471d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV6_SCTP, 15571d10453SEric Joyner ICE_AVF_FLOW_FIELD_IPV6_OTHER, 15671d10453SEric Joyner ICE_AVF_FLOW_FIELD_FRAG_IPV6, 15771d10453SEric Joyner ICE_AVF_FLOW_FIELD_RSVD47, 15871d10453SEric Joyner ICE_AVF_FLOW_FIELD_FCOE_OX, 15971d10453SEric Joyner ICE_AVF_FLOW_FIELD_FCOE_RX, 16071d10453SEric Joyner ICE_AVF_FLOW_FIELD_FCOE_OTHER, 16171d10453SEric Joyner /* Values 51-62 are reserved */ 16271d10453SEric Joyner ICE_AVF_FLOW_FIELD_L2_PAYLOAD = 63, 16371d10453SEric Joyner ICE_AVF_FLOW_FIELD_MAX 16471d10453SEric Joyner }; 16571d10453SEric Joyner 16671d10453SEric Joyner /* Supported RSS offloads This macro is defined to support 16771d10453SEric Joyner * VIRTCHNL_OP_GET_RSS_HENA_CAPS ops. PF driver sends the RSS hardware 16871d10453SEric Joyner * capabilities to the caller of this ops. 16971d10453SEric Joyner */ 17071d10453SEric Joyner #define ICE_DEFAULT_RSS_HENA ( \ 17171d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV4_UDP) | \ 17271d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV4_SCTP) | \ 17371d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV4_TCP) | \ 17471d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV4_OTHER) | \ 17571d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_FRAG_IPV4) | \ 17671d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV6_UDP) | \ 17771d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV6_TCP) | \ 17871d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV6_SCTP) | \ 17971d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV6_OTHER) | \ 18071d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_FRAG_IPV6) | \ 18171d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV4_TCP_SYN_NO_ACK) | \ 18271d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_UNICAST_IPV4_UDP) | \ 18371d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_MULTICAST_IPV4_UDP) | \ 18471d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_IPV6_TCP_SYN_NO_ACK) | \ 18571d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_UNICAST_IPV6_UDP) | \ 18671d10453SEric Joyner BIT_ULL(ICE_AVF_FLOW_FIELD_MULTICAST_IPV6_UDP)) 18771d10453SEric Joyner 188d08b8680SEric Joyner enum ice_rss_cfg_hdr_type { 189d08b8680SEric Joyner ICE_RSS_OUTER_HEADERS, /* take outer headers as inputset. */ 190d08b8680SEric Joyner ICE_RSS_INNER_HEADERS, /* take inner headers as inputset. */ 1919e54973fSEric Joyner /* take inner headers as inputset for packet with outer IPv4. */ 192d08b8680SEric Joyner ICE_RSS_INNER_HEADERS_W_OUTER_IPV4, 1939e54973fSEric Joyner /* take inner headers as inputset for packet with outer IPv6. */ 194d08b8680SEric Joyner ICE_RSS_INNER_HEADERS_W_OUTER_IPV6, 195d08b8680SEric Joyner /* take outer headers first then inner headers as inputset */ 1969e54973fSEric Joyner /* take inner as inputset for GTPoGRE with outer IPv4 + GRE. */ 19756429daeSEric Joyner ICE_RSS_INNER_HEADERS_W_OUTER_IPV4_GRE, 1989e54973fSEric Joyner /* take inner as inputset for GTPoGRE with outer IPv6 + GRE. */ 19956429daeSEric Joyner ICE_RSS_INNER_HEADERS_W_OUTER_IPV6_GRE, 200d08b8680SEric Joyner ICE_RSS_ANY_HEADERS 2017d7af7f8SEric Joyner }; 2027d7af7f8SEric Joyner 2037d7af7f8SEric Joyner struct ice_rss_hash_cfg { 204d08b8680SEric Joyner u32 addl_hdrs; /* protocol header fields */ 205d08b8680SEric Joyner u64 hash_flds; /* hash bit field (ICE_FLOW_HASH_*) to configure */ 206d08b8680SEric Joyner enum ice_rss_cfg_hdr_type hdr_type; /* to specify inner or outer */ 207d08b8680SEric Joyner bool symm; /* symmetric or asymmetric hash */ 2087d7af7f8SEric Joyner }; 2097d7af7f8SEric Joyner 21071d10453SEric Joyner enum ice_flow_dir { 21171d10453SEric Joyner ICE_FLOW_DIR_UNDEFINED = 0, 21271d10453SEric Joyner ICE_FLOW_TX = 0x01, 21371d10453SEric Joyner ICE_FLOW_RX = 0x02, 21471d10453SEric Joyner ICE_FLOW_TX_RX = ICE_FLOW_RX | ICE_FLOW_TX 21571d10453SEric Joyner }; 21671d10453SEric Joyner 21771d10453SEric Joyner enum ice_flow_priority { 21871d10453SEric Joyner ICE_FLOW_PRIO_LOW, 21971d10453SEric Joyner ICE_FLOW_PRIO_NORMAL, 22071d10453SEric Joyner ICE_FLOW_PRIO_HIGH 22171d10453SEric Joyner }; 22271d10453SEric Joyner 223d08b8680SEric Joyner #define ICE_FLOW_SEG_SINGLE 1 22471d10453SEric Joyner #define ICE_FLOW_SEG_MAX 2 22571d10453SEric Joyner #define ICE_FLOW_PROFILE_MAX 1024 22671d10453SEric Joyner #define ICE_FLOW_ACL_FIELD_VECTOR_MAX 32 22771d10453SEric Joyner #define ICE_FLOW_FV_EXTRACT_SZ 2 22871d10453SEric Joyner 22971d10453SEric Joyner #define ICE_FLOW_SET_HDRS(seg, val) ((seg)->hdrs |= (u32)(val)) 23071d10453SEric Joyner 23171d10453SEric Joyner struct ice_flow_seg_xtrct { 23271d10453SEric Joyner u8 prot_id; /* Protocol ID of extracted header field */ 23371d10453SEric Joyner u16 off; /* Starting offset of the field in header in bytes */ 23471d10453SEric Joyner u8 idx; /* Index of FV entry used */ 23571d10453SEric Joyner u8 disp; /* Displacement of field in bits fr. FV entry's start */ 23671d10453SEric Joyner }; 23771d10453SEric Joyner 23871d10453SEric Joyner enum ice_flow_fld_match_type { 23971d10453SEric Joyner ICE_FLOW_FLD_TYPE_REG, /* Value, mask */ 24071d10453SEric Joyner ICE_FLOW_FLD_TYPE_RANGE, /* Value, mask, last (upper bound) */ 24171d10453SEric Joyner ICE_FLOW_FLD_TYPE_PREFIX, /* IP address, prefix, size of prefix */ 24271d10453SEric Joyner ICE_FLOW_FLD_TYPE_SIZE, /* Value, mask, size of match */ 24371d10453SEric Joyner }; 24471d10453SEric Joyner 24571d10453SEric Joyner struct ice_flow_fld_loc { 24671d10453SEric Joyner /* Describe offsets of field information relative to the beginning of 24771d10453SEric Joyner * input buffer provided when adding flow entries. 24871d10453SEric Joyner */ 24971d10453SEric Joyner u16 val; /* Offset where the value is located */ 25071d10453SEric Joyner u16 mask; /* Offset where the mask/prefix value is located */ 25171d10453SEric Joyner u16 last; /* Length or offset where the upper value is located */ 25271d10453SEric Joyner }; 25371d10453SEric Joyner 25471d10453SEric Joyner struct ice_flow_fld_info { 25571d10453SEric Joyner enum ice_flow_fld_match_type type; 25671d10453SEric Joyner /* Location where to retrieve data from an input buffer */ 25771d10453SEric Joyner struct ice_flow_fld_loc src; 25871d10453SEric Joyner /* Location where to put the data into the final entry buffer */ 25971d10453SEric Joyner struct ice_flow_fld_loc entry; 26071d10453SEric Joyner struct ice_flow_seg_xtrct xtrct; 26171d10453SEric Joyner }; 26271d10453SEric Joyner 26371d10453SEric Joyner struct ice_flow_seg_info { 26471d10453SEric Joyner u32 hdrs; /* Bitmask indicating protocol headers present */ 2659c30461dSEric Joyner /* Bitmask indicating header fields to be matched */ 2669c30461dSEric Joyner ice_declare_bitmap(match, ICE_FLOW_FIELD_IDX_MAX); 2679c30461dSEric Joyner /* Bitmask indicating header fields matched as ranges */ 2689c30461dSEric Joyner ice_declare_bitmap(range, ICE_FLOW_FIELD_IDX_MAX); 26971d10453SEric Joyner 27071d10453SEric Joyner struct ice_flow_fld_info fields[ICE_FLOW_FIELD_IDX_MAX]; 27171d10453SEric Joyner }; 27271d10453SEric Joyner 27371d10453SEric Joyner #define ICE_FLOW_ENTRY_HNDL(e) ((u64)e) 27471d10453SEric Joyner 27571d10453SEric Joyner struct ice_flow_prof { 27671d10453SEric Joyner struct LIST_ENTRY_TYPE l_entry; 27771d10453SEric Joyner 27871d10453SEric Joyner u64 id; 27971d10453SEric Joyner enum ice_flow_dir dir; 28071d10453SEric Joyner u8 segs_cnt; 28171d10453SEric Joyner 28271d10453SEric Joyner struct ice_flow_seg_info segs[ICE_FLOW_SEG_MAX]; 28371d10453SEric Joyner 28471d10453SEric Joyner /* software VSI handles referenced by this flow profile */ 28571d10453SEric Joyner ice_declare_bitmap(vsis, ICE_MAX_VSI); 28671d10453SEric Joyner 28771d10453SEric Joyner union { 28871d10453SEric Joyner /* struct sw_recipe */ 289d08b8680SEric Joyner bool symm; /* Symmetric Hash for RSS */ 29071d10453SEric Joyner } cfg; 29171d10453SEric Joyner }; 29271d10453SEric Joyner 29371d10453SEric Joyner struct ice_rss_cfg { 29471d10453SEric Joyner struct LIST_ENTRY_TYPE l_entry; 29571d10453SEric Joyner /* bitmap of VSIs added to the RSS entry */ 29671d10453SEric Joyner ice_declare_bitmap(vsis, ICE_MAX_VSI); 297d08b8680SEric Joyner struct ice_rss_hash_cfg hash; 29871d10453SEric Joyner }; 29971d10453SEric Joyner 30071d10453SEric Joyner enum ice_flow_action_type { 30171d10453SEric Joyner ICE_FLOW_ACT_NOP, 30271d10453SEric Joyner ICE_FLOW_ACT_ALLOW, 30371d10453SEric Joyner ICE_FLOW_ACT_DROP, 30471d10453SEric Joyner ICE_FLOW_ACT_CNTR_PKT, 30571d10453SEric Joyner ICE_FLOW_ACT_FWD_VSI, 30671d10453SEric Joyner ICE_FLOW_ACT_FWD_VSI_LIST, /* Should be abstracted away */ 30771d10453SEric Joyner ICE_FLOW_ACT_FWD_QUEUE, /* Can Queues be abstracted away? */ 30871d10453SEric Joyner ICE_FLOW_ACT_FWD_QUEUE_GROUP, /* Can Queues be abstracted away? */ 30971d10453SEric Joyner ICE_FLOW_ACT_PUSH, 31071d10453SEric Joyner ICE_FLOW_ACT_POP, 31171d10453SEric Joyner ICE_FLOW_ACT_MODIFY, 31271d10453SEric Joyner ICE_FLOW_ACT_CNTR_BYTES, 31371d10453SEric Joyner ICE_FLOW_ACT_CNTR_PKT_BYTES, 31471d10453SEric Joyner ICE_FLOW_ACT_GENERIC_0, 31571d10453SEric Joyner ICE_FLOW_ACT_GENERIC_1, 31671d10453SEric Joyner ICE_FLOW_ACT_GENERIC_2, 31771d10453SEric Joyner ICE_FLOW_ACT_GENERIC_3, 31871d10453SEric Joyner ICE_FLOW_ACT_GENERIC_4, 31971d10453SEric Joyner ICE_FLOW_ACT_RPT_FLOW_ID, 32071d10453SEric Joyner ICE_FLOW_ACT_BUILD_PROF_IDX, 32171d10453SEric Joyner }; 32271d10453SEric Joyner 32371d10453SEric Joyner struct ice_flow_action { 32471d10453SEric Joyner enum ice_flow_action_type type; 32571d10453SEric Joyner union { 32671d10453SEric Joyner u32 dummy; 32771d10453SEric Joyner } data; 32871d10453SEric Joyner }; 32971d10453SEric Joyner 33071d10453SEric Joyner u64 33171d10453SEric Joyner ice_flow_find_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir, 33271d10453SEric Joyner struct ice_flow_seg_info *segs, u8 segs_cnt); 333*f2635e84SEric Joyner int 33471d10453SEric Joyner ice_flow_assoc_vsig_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi_handle, 33571d10453SEric Joyner u16 vsig); 336*f2635e84SEric Joyner int 33771d10453SEric Joyner ice_flow_get_hw_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id, 33871d10453SEric Joyner u8 *hw_prof); 33971d10453SEric Joyner void 34071d10453SEric Joyner ice_flow_set_fld_prefix(struct ice_flow_seg_info *seg, enum ice_flow_field fld, 34171d10453SEric Joyner u16 val_loc, u16 prefix_loc, u8 prefix_sz); 34271d10453SEric Joyner void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle); 343*f2635e84SEric Joyner int ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle); 344*f2635e84SEric Joyner int 34571d10453SEric Joyner ice_add_avf_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds); 346*f2635e84SEric Joyner int ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle); 347*f2635e84SEric Joyner int 348d08b8680SEric Joyner ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, 349d08b8680SEric Joyner const struct ice_rss_hash_cfg *cfg); 350*f2635e84SEric Joyner int 351d08b8680SEric Joyner ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle, 352d08b8680SEric Joyner const struct ice_rss_hash_cfg *cfg); 35371d10453SEric Joyner u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs); 35471d10453SEric Joyner #endif /* _ICE_FLOW_H_ */ 355