net/enic: allow to change RSS settings
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
index f88ece1..bf718f8 100644 (file)
@@ -391,7 +391,6 @@ static const struct mlx5_flow_items mlx5_flow_items[] = {
 /** Structure to pass to the conversion function. */
 struct mlx5_flow_parse {
        uint32_t inner; /**< Set once VXLAN is encountered. */
-       uint32_t allmulti:1; /**< Set once allmulti dst MAC is encountered. */
        uint32_t create:1;
        /**< Whether resources should remain after a validate. */
        uint32_t drop:1; /**< Target is a drop queue. */
@@ -913,6 +912,16 @@ priv_flow_convert_finalise(struct priv *priv, struct mlx5_flow_parse *parser)
        unsigned int i;
 
        (void)priv;
+       /* Remove any other flow not matching the pattern. */
+       if (parser->queues_n == 1) {
+               for (i = 0; i != hash_rxq_init_n; ++i) {
+                       if (i == HASH_RXQ_ETH)
+                               continue;
+                       rte_free(parser->queue[i].ibv_attr);
+                       parser->queue[i].ibv_attr = NULL;
+               }
+               return;
+       }
        if (parser->layer == HASH_RXQ_ETH) {
                goto fill;
        } else {
@@ -1128,17 +1137,6 @@ priv_flow_convert(struct priv *priv,
                        attr->priority +
                        hash_rxq_init[parser->layer].flow_priority;
        }
-       if (parser->allmulti &&
-           parser->layer == HASH_RXQ_ETH) {
-               for (i = 0; i != hash_rxq_init_n; ++i) {
-                       if (!parser->queue[i].ibv_attr)
-                               continue;
-                       if (parser->queue[i].ibv_attr->num_of_specs != 1)
-                               break;
-                       parser->queue[i].ibv_attr->type =
-                                               IBV_FLOW_ATTR_MC_DEFAULT;
-               }
-       }
 exit_free:
        /* Only verification is expected, all resources should be released. */
        if (!parser->create) {
@@ -1246,7 +1244,6 @@ mlx5_flow_create_eth(const struct rte_flow_item *item,
                eth.val.ether_type &= eth.mask.ether_type;
        }
        mlx5_flow_create_copy(parser, &eth, eth_size);
-       parser->allmulti = eth.val.dst_mac[0] & 1;
        return 0;
 }
 
@@ -1771,6 +1768,7 @@ priv_flow_create_action_queue(struct priv *priv,
 {
        int err = 0;
        unsigned int i;
+       unsigned int flows_n = 0;
 
        assert(priv->pd);
        assert(priv->ctx);
@@ -1795,11 +1793,17 @@ priv_flow_create_action_queue(struct priv *priv,
                        err = ENOMEM;
                        goto error;
                }
+               ++flows_n;
                DEBUG("%p type %d QP %p ibv_flow %p",
                      (void *)flow, i,
                      (void *)flow->frxq[i].hrxq,
                      (void *)flow->frxq[i].ibv_flow);
        }
+       if (!flows_n) {
+               rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE,
+                                  NULL, "internal error in flow creation");
+               goto error;
+       }
        for (i = 0; i != parser->queues_n; ++i) {
                struct mlx5_rxq_data *q =
                        (*priv->rxqs)[parser->queues[i]];
@@ -1894,6 +1898,7 @@ priv_flow_create(struct priv *priv,
        DEBUG("Flow created %p", (void *)flow);
        return flow;
 exit:
+       ERROR("flow creation error: %s", error->message);
        for (i = 0; i != hash_rxq_init_n; ++i) {
                if (parser.queue[i].ibv_attr)
                        rte_free(parser.queue[i].ibv_attr);