net/ice/base: support eCPRI over UDP type 0 flow
[dpdk.git] / drivers / net / ice / base / ice_fdir.h
index 86b532b..e138639 100644 (file)
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2001-2020
+ * Copyright(c) 2001-2020 Intel Corporation
  */
 
 #ifndef _ICE_FDIR_H_
@@ -7,50 +7,6 @@
 
 #include "ice_common.h"
 
-/* Flow Director (FD) Filter Programming descriptor */
-struct ice_fd_fltr_desc_ctx {
-       u32 fdid;
-       u16 qindex;
-       u16 cnt_index;
-       u16 fd_vsi;
-       u16 flex_val;
-       u8 comp_q;
-       u8 comp_report;
-       u8 fd_space;
-       u8 cnt_ena;
-       u8 evict_ena;
-       u8 toq;
-       u8 toq_prio;
-       u8 dpu_recipe;
-       u8 drop;
-       u8 flex_prio;
-       u8 flex_mdid;
-       u8 dtype;
-       u8 pcmd;
-       u8 desc_prof_prio;
-       u8 desc_prof;
-       u8 swap;
-       u8 fdid_prio;
-       u8 fdid_mdid;
-};
-
-enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
-enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
-void
-ice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx,
-                   struct ice_fltr_desc *fdir_desc);
-void ice_set_dflt_val_fd_desc(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx);
-enum ice_status
-ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
-enum ice_status
-ice_free_fd_guar_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
-enum ice_status
-ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
-enum ice_status
-ice_free_fd_shrd_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
-enum ice_status ice_clear_vsi_fd_table(struct ice_hw *hw, u16 vsi_num);
-enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
-
 #define ICE_FDIR_IP_PROTOCOLS
 #define ICE_IP_PROTO_TCP               6
 #define ICE_IP_PROTO_UDP               17
@@ -61,7 +17,6 @@ enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
 #define ICE_FDIR_TUN_PKT_OFF           50
 #define ICE_FDIR_MAX_RAW_PKT_SIZE      (512 + ICE_FDIR_TUN_PKT_OFF)
 #define ICE_FDIR_BUF_FULL_MARGIN       10
-#define ICE_FDIR_BUF_HEAD_ROOM         32
 
 /* macros for offsets into packets for flow director programming */
 #define ICE_IPV4_SRC_ADDR_OFFSET       26
@@ -82,6 +37,7 @@ enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
 #define ICE_IPV6_SCTP_SRC_PORT_OFFSET  54
 #define ICE_IPV6_SCTP_DST_PORT_OFFSET  56
 
+#define ICE_MAC_ETHTYPE_OFFSET         12
 #define ICE_IPV4_TOS_OFFSET            15
 #define ICE_IPV4_TTL_OFFSET            22
 #define ICE_IPV6_TC_OFFSET             14
@@ -89,6 +45,19 @@ enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
 #define ICE_IPV6_PROTO_OFFSET          20
 #define ICE_IPV4_GTPU_TEID_OFFSET      46
 #define ICE_IPV4_GTPU_QFI_OFFSET       56
+#define ICE_IPV6_GTPU_TEID_OFFSET      66
+#define ICE_IPV6_GTPU_QFI_OFFSET       76
+#define ICE_IPV4_L2TPV3_SESS_ID_OFFSET 34
+#define ICE_IPV6_L2TPV3_SESS_ID_OFFSET 54
+#define ICE_IPV4_ESP_SPI_OFFSET                34
+#define ICE_IPV6_ESP_SPI_OFFSET                54
+#define ICE_IPV4_AH_SPI_OFFSET         38
+#define ICE_IPV6_AH_SPI_OFFSET         58
+#define ICE_IPV4_NAT_T_ESP_SPI_OFFSET  42
+#define ICE_IPV6_NAT_T_ESP_SPI_OFFSET  62
+#define ICE_IPV4_VXLAN_VNI_OFFSET      45
+#define ICE_ECPRI_TP0_PC_ID_OFFSET     18
+#define ICE_IPV4_UDP_ECPRI_TP0_PC_ID_OFFSET                    46
 
 #define ICE_FDIR_MAX_FLTRS             16384
 
@@ -113,6 +82,33 @@ enum ice_fltr_prgm_desc_fd_status {
        ICE_FLTR_PRGM_DESC_FD_STATUS_8FLEX_BYTES,
 };
 
+/* Flow Director (FD) Filter Programming descriptor */
+struct ice_fd_fltr_desc_ctx {
+       u32 fdid;
+       u16 qindex;
+       u16 cnt_index;
+       u16 fd_vsi;
+       u16 flex_val;
+       u8 comp_q;
+       u8 comp_report;
+       u8 fd_space;
+       u8 cnt_ena;
+       u8 evict_ena;
+       u8 toq;
+       u8 toq_prio;
+       u8 dpu_recipe;
+       u8 drop;
+       u8 flex_prio;
+       u8 flex_mdid;
+       u8 dtype;
+       u8 pcmd;
+       u8 desc_prof_prio;
+       u8 desc_prof;
+       u8 swap;
+       u8 fdid_prio;
+       u8 fdid_mdid;
+};
+
 #define ICE_FLTR_PRGM_FLEX_WORD_SIZE   sizeof(__be16)
 
 struct ice_rx_flow_userdef {
@@ -151,9 +147,9 @@ struct ice_fdir_v6 {
 struct ice_fdir_udp_gtp {
        u8 flags;
        u8 msg_type;
-       u16 rsrvd_len;
-       u32 teid;
-       u16 rsrvd_seq_nbr;
+       __be16 rsrvd_len;
+       __be32 teid;
+       __be16 rsrvd_seq_nbr;
        u8 rsrvd_n_pdu_nbr;
        u8 rsrvd_next_ext_type;
        u8 rsvrd_ext_len;
@@ -166,8 +162,22 @@ struct ice_fdir_udp_gtp {
        u8 next_ext;
 };
 
+struct ice_fdir_l2tpv3 {
+       __be32 session_id;
+};
+
+struct ice_fdir_udp_vxlan {
+       __be32 vni; /* 8 bits reserved, always be zero */
+};
+
+struct ice_fdir_ecpri {
+       __be16 pc_id;
+};
+
 struct ice_fdir_extra {
        u8 dst_mac[ETH_ALEN];   /* dest MAC address */
+       u8 src_mac[ETH_ALEN];   /* src MAC address */
+       __be16 ether_type;      /* for NON_IP_L2 */
        u32 usr_def[2];         /* user data */
        __be16 vlan_type;       /* VLAN ethertype */
        __be16 vlan_tag;        /* VLAN tag info */
@@ -182,9 +192,27 @@ struct ice_fdir_fltr {
                struct ice_fdir_v6 v6;
        } ip, mask;
 
+       /* for tunnel outer part */
+       union {
+               struct ice_fdir_v4 v4;
+               struct ice_fdir_v6 v6;
+       } ip_outer, mask_outer;
+
+       struct ice_fdir_extra ext_data_outer;
+       struct ice_fdir_extra ext_mask_outer;
+
+       struct ice_fdir_udp_vxlan vxlan_data;
+       struct ice_fdir_udp_vxlan vxlan_mask;
+
        struct ice_fdir_udp_gtp gtpu_data;
        struct ice_fdir_udp_gtp gtpu_mask;
 
+       struct ice_fdir_l2tpv3 l2tpv3_data;
+       struct ice_fdir_l2tpv3 l2tpv3_mask;
+
+       struct ice_fdir_ecpri ecpri_data;
+       struct ice_fdir_ecpri ecpri_mask;
+
        struct ice_fdir_extra ext_data;
        struct ice_fdir_extra ext_mask;
 
@@ -202,13 +230,14 @@ struct ice_fdir_fltr {
        u8 cnt_ena;
        u8 fltr_status;
        u16 cnt_index;
-       u8 fdid_prio;
        u32 fltr_id;
+       u8 fdid_prio;
+       u8 comp_report;
        /* Set to true for an ACL filter */
        bool acl_fltr;
 };
 
-/* Dummy packet filter definition structure. */
+/* Dummy packet filter definition structure */
 struct ice_fdir_base_pkt {
        enum ice_fltr_ptype flow;
        u16 pkt_len;
@@ -217,6 +246,17 @@ struct ice_fdir_base_pkt {
        const u8 *tun_pkt;
 };
 
+enum ice_status ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id);
+enum ice_status ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id);
+enum ice_status
+ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
+enum ice_status
+ice_free_fd_guar_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
+enum ice_status
+ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr);
+enum ice_status
+ice_free_fd_shrd_item(struct ice_hw *hw, u16 cntr_id, u16 num_fltr);
+enum ice_status ice_clear_pf_fd_table(struct ice_hw *hw);
 void
 ice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
                       struct ice_fltr_desc *fdesc, bool add);
@@ -225,13 +265,8 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
                          u8 *pkt, bool frag, bool tun);
 enum ice_status
 ice_fdir_get_prgm_pkt(struct ice_fdir_fltr *input, u8 *pkt, bool frag);
-enum ice_status
-ice_add_del_fdir(struct ice_hw *hw, struct ice_fdir_fltr *input, bool add);
 int ice_get_fdir_cnt_all(struct ice_hw *hw);
 bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input);
-enum ice_status
-ice_update_fdir_list_entry(struct ice_hw *hw, struct ice_fdir_fltr *input,
-                          u16 sw_idx);
 bool ice_fdir_has_frag(enum ice_fltr_ptype flow);
 struct ice_fdir_fltr *
 ice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx);