net/mlx5: support match on IPv4 fragment packets
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.h
index 586fea2..b6efbff 100644 (file)
@@ -331,6 +331,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
                                          sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+               (RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED   false
+#define MLX5_ITEM_RANGE_ACCEPTED       true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4          1
 #define MLX5_ACT_NUM_MDF_IPV6          4
@@ -527,6 +535,8 @@ struct mlx5_flow_sub_actions_list {
        void *dr_queue_action;
        void *dr_tag_action;
        void *dr_cnt_action;
+       void *dr_port_id_action;
+       void *dr_encap_action;
 };
 
 /* Sample sub-actions resource list. */
@@ -534,6 +544,8 @@ struct mlx5_flow_sub_actions_idx {
        uint32_t rix_hrxq; /**< Hash Rx queue object index. */
        uint32_t rix_tag; /**< Index to the tag action. */
        uint32_t cnt;
+       uint32_t rix_port_id_action; /**< Index to port ID action resource. */
+       uint32_t rix_encap_decap; /**< Index to encap/decap resource. */
 };
 
 /* Sample action resource structure. */
@@ -553,6 +565,21 @@ struct mlx5_flow_dv_sample_resource {
        /**< Action resources. */
 };
 
+#define MLX5_MAX_DEST_NUM      2
+
+/* Destination array action resource structure. */
+struct mlx5_flow_dv_dest_array_resource {
+       ILIST_ENTRY(uint32_t)next; /**< Pointer to next element. */
+       uint32_t refcnt; /**< Reference counter. */
+       uint8_t ft_type; /** Flow Table Type */
+       uint8_t num_of_dest; /**< Number of destination actions. */
+       void *action; /**< Pointer to the rdma core action. */
+       struct mlx5_flow_sub_actions_idx sample_idx[MLX5_MAX_DEST_NUM];
+       /**< Action index resources. */
+       struct mlx5_flow_sub_actions_list sample_act[MLX5_MAX_DEST_NUM];
+       /**< Action resources. */
+};
+
 /* Verbs specification header. */
 struct ibv_spec_header {
        enum ibv_flow_spec_type type;
@@ -587,6 +614,8 @@ struct mlx5_flow_handle_dv {
        /**< Index to the tag action. */
        uint32_t rix_sample;
        /**< Index to sample action resource in cache. */
+       uint32_t rix_dest_array;
+       /**< Index to destination array resource in cache. */
 } __rte_packed;
 
 /** Device flow handle structure: used both for creating & destroying. */
@@ -654,6 +683,8 @@ struct mlx5_flow_dv_workspace {
        /**< Holds the value that the packet is compared to. */
        struct mlx5_flow_dv_sample_resource *sample_res;
        /**< Pointer to the sample action resource. */
+       struct mlx5_flow_dv_dest_array_resource *dest_array_res;
+       /**< Pointer to the destination array resource. */
 };
 
 /*
@@ -1023,6 +1054,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
                              const uint8_t *mask,
                              const uint8_t *nic_mask,
                              unsigned int size,
+                             bool range_accepted,
                              struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
                                uint64_t item_flags,
@@ -1040,6 +1072,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
                                 uint64_t last_item,
                                 uint16_t ether_type,
                                 const struct rte_flow_item_ipv4 *acc_mask,
+                                bool range_accepted,
                                 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
                                 uint64_t item_flags,