net/mlx5: process flows actions before of items
authorNélio Laranjeiro <nelio.laranjeiro@6wind.com>
Mon, 9 Oct 2017 14:44:59 +0000 (16:44 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 12 Oct 2017 00:36:58 +0000 (01:36 +0100)
In case the pattern contains an RSS actions, the RSS configuration to
use is the one provided by the user.  To make the correct conversion
from DPDK RSS hash fields to Verbs ones according to the users requests
the actions must be processed first.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
drivers/net/mlx5/mlx5_flow.c

index 13bd250..6a58194 100644 (file)
@@ -484,51 +484,6 @@ priv_flow_convert(struct priv *priv,
                                   "only ingress is supported");
                return -rte_errno;
        }
-       for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) {
-               const struct mlx5_flow_items *token = NULL;
-               unsigned int i;
-               int err;
-
-               if (items->type == RTE_FLOW_ITEM_TYPE_VOID)
-                       continue;
-               for (i = 0;
-                    cur_item->items &&
-                    cur_item->items[i] != RTE_FLOW_ITEM_TYPE_END;
-                    ++i) {
-                       if (cur_item->items[i] == items->type) {
-                               token = &mlx5_flow_items[items->type];
-                               break;
-                       }
-               }
-               if (!token)
-                       goto exit_item_not_supported;
-               cur_item = token;
-               err = mlx5_flow_item_validate(items,
-                                             (const uint8_t *)cur_item->mask,
-                                             cur_item->mask_sz);
-               if (err)
-                       goto exit_item_not_supported;
-               if (flow->ibv_attr && cur_item->convert) {
-                       err = cur_item->convert(items,
-                                               (cur_item->default_mask ?
-                                                cur_item->default_mask :
-                                                cur_item->mask),
-                                               flow);
-                       if (err)
-                               goto exit_item_not_supported;
-               } else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
-                       if (flow->inner) {
-                               rte_flow_error_set(error, ENOTSUP,
-                                                  RTE_FLOW_ERROR_TYPE_ITEM,
-                                                  items,
-                                                  "cannot recognize multiple"
-                                                  " VXLAN encapsulations");
-                               return -rte_errno;
-                       }
-                       flow->inner = 1;
-               }
-               flow->offset += cur_item->dst_sz;
-       }
        for (; actions->type != RTE_FLOW_ACTION_TYPE_END; ++actions) {
                if (actions->type == RTE_FLOW_ACTION_TYPE_VOID) {
                        continue;
@@ -644,6 +599,51 @@ priv_flow_convert(struct priv *priv,
                                   NULL, "no valid action");
                return -rte_errno;
        }
+       for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) {
+               const struct mlx5_flow_items *token = NULL;
+               unsigned int i;
+               int err;
+
+               if (items->type == RTE_FLOW_ITEM_TYPE_VOID)
+                       continue;
+               for (i = 0;
+                    cur_item->items &&
+                    cur_item->items[i] != RTE_FLOW_ITEM_TYPE_END;
+                    ++i) {
+                       if (cur_item->items[i] == items->type) {
+                               token = &mlx5_flow_items[items->type];
+                               break;
+                       }
+               }
+               if (!token)
+                       goto exit_item_not_supported;
+               cur_item = token;
+               err = mlx5_flow_item_validate(items,
+                                             (const uint8_t *)cur_item->mask,
+                                             cur_item->mask_sz);
+               if (err)
+                       goto exit_item_not_supported;
+               if (flow->ibv_attr && cur_item->convert) {
+                       err = cur_item->convert(items,
+                                               (cur_item->default_mask ?
+                                                cur_item->default_mask :
+                                                cur_item->mask),
+                                               flow);
+                       if (err)
+                               goto exit_item_not_supported;
+               } else if (items->type == RTE_FLOW_ITEM_TYPE_VXLAN) {
+                       if (flow->inner) {
+                               rte_flow_error_set(error, ENOTSUP,
+                                                  RTE_FLOW_ERROR_TYPE_ITEM,
+                                                  items,
+                                                  "cannot recognize multiple"
+                                                  " VXLAN encapsulations");
+                               return -rte_errno;
+                       }
+                       flow->inner = 1;
+               }
+               flow->offset += cur_item->dst_sz;
+       }
        return 0;
 exit_item_not_supported:
        rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM,