linux/drivers/net/ethernet/intel/ice/ice_flow.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2019, Intel Corporation. */

#ifndef _ICE_FLOW_H_
#define _ICE_FLOW_H_

#include "ice_flex_type.h"
#include "ice_parser.h"

#define ICE_FLOW_ENTRY_HANDLE_INVAL
#define ICE_FLOW_FLD_OFF_INVAL

/* Generate flow hash field from flow field type(s) */
#define ICE_FLOW_HASH_ETH
#define ICE_FLOW_HASH_IPV4
#define ICE_FLOW_HASH_IPV6
#define ICE_FLOW_HASH_TCP_PORT
#define ICE_FLOW_HASH_UDP_PORT
#define ICE_FLOW_HASH_SCTP_PORT

#define ICE_HASH_INVALID
#define ICE_HASH_TCP_IPV4
#define ICE_HASH_TCP_IPV6
#define ICE_HASH_UDP_IPV4
#define ICE_HASH_UDP_IPV6
#define ICE_HASH_SCTP_IPV4
#define ICE_HASH_SCTP_IPV6

#define ICE_FLOW_HASH_GTP_C_TEID

#define ICE_FLOW_HASH_GTP_C_IPV4_TEID
#define ICE_FLOW_HASH_GTP_C_IPV6_TEID

#define ICE_FLOW_HASH_GTP_U_TEID

#define ICE_FLOW_HASH_GTP_U_IPV4_TEID
#define ICE_FLOW_HASH_GTP_U_IPV6_TEID

#define ICE_FLOW_HASH_GTP_U_EH_TEID

#define ICE_FLOW_HASH_GTP_U_EH_QFI

#define ICE_FLOW_HASH_GTP_U_IPV4_EH
#define ICE_FLOW_HASH_GTP_U_IPV6_EH

#define ICE_FLOW_HASH_GTP_U_UP
#define ICE_FLOW_HASH_GTP_U_DWN

#define ICE_FLOW_HASH_GTP_U_IPV4_UP
#define ICE_FLOW_HASH_GTP_U_IPV6_UP
#define ICE_FLOW_HASH_GTP_U_IPV4_DWN
#define ICE_FLOW_HASH_GTP_U_IPV6_DWN

#define ICE_FLOW_HASH_PPPOE_SESS_ID

#define ICE_FLOW_HASH_PPPOE_SESS_ID_ETH
#define ICE_FLOW_HASH_PPPOE_TCP_ID
#define ICE_FLOW_HASH_PPPOE_UDP_ID

#define ICE_FLOW_HASH_PFCP_SEID
#define ICE_FLOW_HASH_PFCP_IPV4_SEID
#define ICE_FLOW_HASH_PFCP_IPV6_SEID

#define ICE_FLOW_HASH_L2TPV3_SESS_ID
#define ICE_FLOW_HASH_L2TPV3_IPV4_SESS_ID
#define ICE_FLOW_HASH_L2TPV3_IPV6_SESS_ID

#define ICE_FLOW_HASH_ESP_SPI
#define ICE_FLOW_HASH_ESP_IPV4_SPI
#define ICE_FLOW_HASH_ESP_IPV6_SPI

#define ICE_FLOW_HASH_AH_SPI
#define ICE_FLOW_HASH_AH_IPV4_SPI
#define ICE_FLOW_HASH_AH_IPV6_SPI

#define ICE_FLOW_HASH_NAT_T_ESP_SPI
#define ICE_FLOW_HASH_NAT_T_ESP_IPV4_SPI
#define ICE_FLOW_HASH_NAT_T_ESP_IPV6_SPI

/* Protocol header fields within a packet segment. A segment consists of one or
 * more protocol headers that make up a logical group of protocol headers. Each
 * logical group of protocol headers encapsulates or is encapsulated using/by
 * tunneling or encapsulation protocols for network virtualization such as GRE,
 * VxLAN, etc.
 */
enum ice_flow_seg_hdr {};

/* These segments all have the same PTYPES, but are otherwise distinguished by
 * the value of the gtp_eh_pdu and gtp_eh_pdu_link flags:
 *
 *                                gtp_eh_pdu     gtp_eh_pdu_link
 * ICE_FLOW_SEG_HDR_GTPU_IP           0              0
 * ICE_FLOW_SEG_HDR_GTPU_EH           1              don't care
 * ICE_FLOW_SEG_HDR_GTPU_DWN          1              0
 * ICE_FLOW_SEG_HDR_GTPU_UP           1              1
 */
#define ICE_FLOW_SEG_HDR_GTPU
#define ICE_FLOW_SEG_HDR_PFCP

enum ice_flow_field {};

#define ICE_FLOW_HASH_FLD_IPV4_SA
#define ICE_FLOW_HASH_FLD_IPV6_SA
#define ICE_FLOW_HASH_FLD_IPV4_DA
#define ICE_FLOW_HASH_FLD_IPV6_DA
#define ICE_FLOW_HASH_FLD_TCP_SRC_PORT
#define ICE_FLOW_HASH_FLD_TCP_DST_PORT
#define ICE_FLOW_HASH_FLD_UDP_SRC_PORT
#define ICE_FLOW_HASH_FLD_UDP_DST_PORT
#define ICE_FLOW_HASH_FLD_SCTP_SRC_PORT
#define ICE_FLOW_HASH_FLD_SCTP_DST_PORT

#define ICE_FLOW_HASH_FLD_GTPC_TEID
#define ICE_FLOW_HASH_FLD_GTPU_IP_TEID
#define ICE_FLOW_HASH_FLD_GTPU_EH_TEID
#define ICE_FLOW_HASH_FLD_GTPU_UP_TEID
#define ICE_FLOW_HASH_FLD_GTPU_DWN_TEID

/* Flow headers and fields for AVF support */
enum ice_flow_avf_hdr_field {};

/* Supported RSS offloads  This macro is defined to support
 * VIRTCHNL_OP_GET_RSS_HENA_CAPS ops. PF driver sends the RSS hardware
 * capabilities to the caller of this ops.
 */
#define ICE_DEFAULT_RSS_HENA

enum ice_rss_cfg_hdr_type {};

struct ice_vsi;
struct ice_rss_hash_cfg {};

enum ice_flow_dir {};

enum ice_flow_priority {};

#define ICE_FLOW_SEG_SINGLE
#define ICE_FLOW_SEG_MAX
#define ICE_FLOW_SEG_RAW_FLD_MAX
#define ICE_FLOW_SW_FIELD_VECTOR_MAX
#define ICE_FLOW_FV_EXTRACT_SZ

#define ICE_FLOW_SET_HDRS(seg, val)

struct ice_flow_seg_xtrct {};

enum ice_flow_fld_match_type {};

struct ice_flow_fld_loc {};

struct ice_flow_fld_info {};

struct ice_flow_seg_fld_raw {};

struct ice_flow_seg_info {};

/* This structure describes a flow entry, and is tracked only in this file */
struct ice_flow_entry {};

#define ICE_FLOW_ENTRY_HNDL(e)
#define ICE_FLOW_ENTRY_PTR(h)

struct ice_flow_prof {};

struct ice_rss_cfg {};

int
ice_flow_add_prof(struct ice_hw *hw, enum ice_block blk, enum ice_flow_dir dir,
		  struct ice_flow_seg_info *segs, u8 segs_cnt,
		  bool symm, struct ice_flow_prof **prof);
int ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id);
int
ice_flow_set_parser_prof(struct ice_hw *hw, u16 dest_vsi, u16 fdir_vsi,
			 struct ice_parser_profile *prof, enum ice_block blk);
int
ice_flow_add_entry(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
		   u64 entry_id, u16 vsi, enum ice_flow_priority prio,
		   void *data, u64 *entry_h);
int ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk, u64 entry_h);
void
ice_flow_set_fld(struct ice_flow_seg_info *seg, enum ice_flow_field fld,
		 u16 val_loc, u16 mask_loc, u16 last_loc, bool range);
void
ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len,
		     u16 val_loc, u16 mask_loc);
int ice_flow_rem_vsi_prof(struct ice_hw *hw, u16 vsi_handle, u64 prof_id);
void ice_rem_vsi_rss_list(struct ice_hw *hw, u16 vsi_handle);
int ice_replay_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
int ice_set_rss_cfg_symm(struct ice_hw *hw, struct ice_vsi *vsi, bool symm);
int ice_add_avf_rss_cfg(struct ice_hw *hw, struct ice_vsi *vsi,
			u64 hashed_flds);
int ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle);
int ice_add_rss_cfg(struct ice_hw *hw, struct ice_vsi *vsi,
		    const struct ice_rss_hash_cfg *cfg);
int ice_rem_rss_cfg(struct ice_hw *hw, u16 vsi_handle,
		    const struct ice_rss_hash_cfg *cfg);
u64 ice_get_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u32 hdrs, bool *symm);
#endif /* _ICE_FLOW_H_ */