net/mlx5: prepare meter flow tables
[dpdk.git] / drivers / net / mlx5 / mlx5_prm.h
index c687cfb..ebedc90 100644 (file)
 /* Default mark value used when none is provided. */
 #define MLX5_FLOW_MARK_DEFAULT 0xffffff
 
+/* Default mark mask for metadata legacy mode. */
+#define MLX5_FLOW_MARK_MASK 0xffffff
+
 /* Maximum number of DS in WQE. Limited by 6-bit field. */
 #define MLX5_DSEG_MAX 63
 
@@ -354,12 +357,14 @@ struct mlx5_cqe {
        uint16_t hdr_type_etc;
        uint16_t vlan_info;
        uint8_t lro_num_seg;
-       uint8_t rsvd3[11];
+       uint8_t rsvd3[3];
+       uint32_t flow_table_metadata;
+       uint8_t rsvd4[4];
        uint32_t byte_cnt;
        uint64_t timestamp;
        uint32_t sop_drop_qpn;
        uint16_t wqe_counter;
-       uint8_t rsvd4;
+       uint8_t rsvd5;
        uint8_t op_own;
 };
 
@@ -383,14 +388,16 @@ struct mlx5_cqe {
 /* CQE format value. */
 #define MLX5_COMPRESSED 0x3
 
-/* Write a specific data value to a field. */
-#define MLX5_MODIFICATION_TYPE_SET 1
-
-/* Add a specific data value to a field. */
-#define MLX5_MODIFICATION_TYPE_ADD 2
+/* Action type of header modification. */
+enum {
+       MLX5_MODIFICATION_TYPE_SET = 0x1,
+       MLX5_MODIFICATION_TYPE_ADD = 0x2,
+       MLX5_MODIFICATION_TYPE_COPY = 0x3,
+};
 
 /* The field of packet to be modified. */
 enum mlx5_modification_field {
+       MLX5_MODI_OUT_NONE = -1,
        MLX5_MODI_OUT_SMAC_47_16 = 1,
        MLX5_MODI_OUT_SMAC_15_0,
        MLX5_MODI_OUT_ETHERTYPE,
@@ -454,6 +461,23 @@ enum mlx5_modification_field {
        MLX5_MODI_IN_TCP_ACK_NUM = 0x5C,
 };
 
+/* Total number of metadata reg_c's. */
+#define MLX5_MREG_C_NUM (MLX5_MODI_META_REG_C_7 - MLX5_MODI_META_REG_C_0 + 1)
+
+enum modify_reg {
+       REG_NONE = 0,
+       REG_A,
+       REG_B,
+       REG_C_0,
+       REG_C_1,
+       REG_C_2,
+       REG_C_3,
+       REG_C_4,
+       REG_C_5,
+       REG_C_6,
+       REG_C_7,
+};
+
 /* Modification sub command. */
 struct mlx5_modification_cmd {
        union {
@@ -470,6 +494,13 @@ struct mlx5_modification_cmd {
        union {
                uint32_t data1;
                uint8_t data[4];
+               struct {
+                       unsigned int rsvd2:8;
+                       unsigned int dst_offset:5;
+                       unsigned int rsvd3:3;
+                       unsigned int dst_field:12;
+                       unsigned int rsvd4:4;
+               };
        };
 };
 
@@ -628,7 +659,8 @@ struct mlx5_ifc_fte_match_set_misc2_bits {
        u8 metadata_reg_c_1[0x20];
        u8 metadata_reg_c_0[0x20];
        u8 metadata_reg_a[0x20];
-       u8 reserved_at_1a0[0x60];
+       u8 metadata_reg_b[0x20];
+       u8 reserved_at_1c0[0x40];
 };
 
 struct mlx5_ifc_fte_match_set_misc3_bits {
@@ -1628,6 +1660,12 @@ struct mlx5_ifc_create_rqt_in_bits {
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
+enum {
+       MLX5_SQC_STATE_RST  = 0x0,
+       MLX5_SQC_STATE_RDY  = 0x1,
+       MLX5_SQC_STATE_ERR  = 0x3,
+};
+
 struct mlx5_ifc_sqc_bits {
        u8 rlky[0x1];
        u8 cd_master[0x1];
@@ -1730,6 +1768,19 @@ struct mlx5_mini_cqe8 {
        uint32_t byte_cnt;
 };
 
+/* srTCM PRM flow meter parameters. */
+enum {
+       MLX5_FLOW_COLOR_RED = 0,
+       MLX5_FLOW_COLOR_YELLOW,
+       MLX5_FLOW_COLOR_GREEN,
+       MLX5_FLOW_COLOR_UNDEFINED,
+};
+
+/* Maximum value of srTCM metering parameters. */
+#define MLX5_SRTCM_CBS_MAX (0xFF * (1ULL << 0x1F))
+#define MLX5_SRTCM_CIR_MAX (8 * (1ULL << 30) * 0xFF)
+#define MLX5_SRTCM_EBS_MAX 0
+
 /**
  * Convert a user mark to flow mark.
  *