net/mlx5: fix encap/decap limit for hairpin flow split
authorXiaoyu Min <jackmin@nvidia.com>
Mon, 16 Nov 2020 07:55:14 +0000 (15:55 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 22 Nov 2020 16:07:27 +0000 (17:07 +0100)
The rte_flow_item_eth and rte_flow_item_vlan items are refined.
The structs do not exactly represent the packet bits captured on the
wire anymore.
Should use real header instead of the whole struct.

Replace the rte_flow_item_* with the existing corresponding rte_*_hdr.

Fixes: 09315fc83861 ("ethdev: add VLAN attributes to ethernet and VLAN items")
Fixes: f9210259cac7 ("net/mlx5: fix raw encap/decap limit")

Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow.c

index 5dc0832..642516a 100644 (file)
@@ -3548,9 +3548,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev,
                        break;
                case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
                        raw_encap = actions->conf;
-                       if (raw_encap->size >
-                           (sizeof(struct rte_flow_item_eth) +
-                            sizeof(struct rte_flow_item_ipv4)))
+                       if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE)
                                split++;
                        action_n++;
                        break;
@@ -3985,9 +3983,7 @@ flow_hairpin_split(struct rte_eth_dev *dev,
                        break;
                case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
                        raw_encap = actions->conf;
-                       if (raw_encap->size >
-                           (sizeof(struct rte_flow_item_eth) +
-                            sizeof(struct rte_flow_item_ipv4))) {
+                       if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE) {
                                memcpy(actions_tx, actions,
                                       sizeof(struct rte_flow_action));
                                actions_tx++;
@@ -4000,9 +3996,7 @@ flow_hairpin_split(struct rte_eth_dev *dev,
                        break;
                case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
                        raw_decap = actions->conf;
-                       if (raw_decap->size <
-                           (sizeof(struct rte_flow_item_eth) +
-                            sizeof(struct rte_flow_item_ipv4))) {
+                       if (raw_decap->size < MLX5_ENCAPSULATION_DECISION_SIZE) {
                                memcpy(actions_tx, actions,
                                       sizeof(struct rte_flow_action));
                                actions_tx++;