build: fix essential drivers in disable list
[dpdk.git] / drivers / net / mlx4 / mlx4_flow.c
index 96479b8..71ea91b 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <arpa/inet.h>
-#include <assert.h>
 #include <errno.h>
 #include <stdalign.h>
 #include <stddef.h>
@@ -28,7 +27,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_errno.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
 #include <rte_ether.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
@@ -547,7 +546,7 @@ mlx4_flow_item_check(const struct rte_flow_item *item,
        mask = item->mask ?
                (const uint8_t *)item->mask :
                (const uint8_t *)proc->mask_default;
-       assert(mask);
+       MLX4_ASSERT(mask);
        /*
         * Single-pass check to make sure that:
         * - Mask is supported, no bits are set outside proc->mask_support.
@@ -792,7 +791,8 @@ fill:
                        rss = action->conf;
                        /* Default RSS configuration if none is provided. */
                        if (rss->key_len) {
-                               rss_key = rss->key;
+                               rss_key = rss->key ?
+                                         rss->key : mlx4_rss_hash_key_default;
                                rss_key_len = rss->key_len;
                        } else {
                                rss_key = mlx4_rss_hash_key_default;
@@ -954,8 +954,8 @@ mlx4_drop_get(struct mlx4_priv *priv)
        struct mlx4_drop *drop = priv->drop;
 
        if (drop) {
-               assert(drop->refcnt);
-               assert(drop->priv == priv);
+               MLX4_ASSERT(drop->refcnt);
+               MLX4_ASSERT(drop->priv == priv);
                ++drop->refcnt;
                return drop;
        }
@@ -981,12 +981,13 @@ mlx4_drop_get(struct mlx4_priv *priv)
        priv->drop = drop;
        return drop;
 error:
-       if (drop->qp)
-               claim_zero(mlx4_glue->destroy_qp(drop->qp));
-       if (drop->cq)
-               claim_zero(mlx4_glue->destroy_cq(drop->cq));
-       if (drop)
+       if (drop) {
+               if (drop->qp)
+                       claim_zero(mlx4_glue->destroy_qp(drop->qp));
+               if (drop->cq)
+                       claim_zero(mlx4_glue->destroy_cq(drop->cq));
                rte_free(drop);
+       }
        rte_errno = ENOMEM;
        return NULL;
 }
@@ -1000,7 +1001,7 @@ error:
 static void
 mlx4_drop_put(struct mlx4_drop *drop)
 {
-       assert(drop->refcnt);
+       MLX4_ASSERT(drop->refcnt);
        if (--drop->refcnt)
                return;
        drop->priv->drop = NULL;
@@ -1045,7 +1046,7 @@ mlx4_flow_toggle(struct mlx4_priv *priv,
                        mlx4_rss_detach(flow->rss);
                return 0;
        }
-       assert(flow->ibv_attr);
+       MLX4_ASSERT(flow->ibv_attr);
        if (!flow->internal &&
            !priv->isolated &&
            flow->ibv_attr->priority == MLX4_FLOW_PRIORITY_LAST) {
@@ -1111,7 +1112,7 @@ mlx4_flow_toggle(struct mlx4_priv *priv,
                }
                qp = priv->drop->qp;
        }
-       assert(qp);
+       MLX4_ASSERT(qp);
        if (flow->ibv_flow)
                return 0;
        flow->ibv_flow = mlx4_glue->create_flow(qp, flow->ibv_attr);
@@ -1411,10 +1412,11 @@ next_vlan:
 
                        if (!flow->mac)
                                continue;
-                       assert(flow->ibv_attr->type == IBV_FLOW_ATTR_NORMAL);
-                       assert(flow->ibv_attr->num_of_specs == 1);
-                       assert(eth->type == IBV_FLOW_SPEC_ETH);
-                       assert(flow->rss);
+                       MLX4_ASSERT(flow->ibv_attr->type ==
+                                   IBV_FLOW_ATTR_NORMAL);
+                       MLX4_ASSERT(flow->ibv_attr->num_of_specs == 1);
+                       MLX4_ASSERT(eth->type == IBV_FLOW_SPEC_ETH);
+                       MLX4_ASSERT(flow->rss);
                        if (rule_vlan &&
                            (eth->val.vlan_tag != *rule_vlan ||
                             eth->mask.vlan_tag != RTE_BE16(0x0fff)))
@@ -1463,13 +1465,13 @@ next_vlan:
                                if (flow->promisc)
                                        break;
                        } else {
-                               assert(ETH_DEV(priv)->data->all_multicast);
+                               MLX4_ASSERT(ETH_DEV(priv)->data->all_multicast);
                                if (flow->allmulti)
                                        break;
                        }
                }
                if (flow && flow->internal) {
-                       assert(flow->rss);
+                       MLX4_ASSERT(flow->rss);
                        if (flow->rss->queues != queues ||
                            memcmp(flow->rss->queue_id, action_rss.queue,
                                   queues * sizeof(flow->rss->queue_id[0])))
@@ -1481,7 +1483,7 @@ next_vlan:
                                pattern[1].spec = NULL;
                                pattern[1].mask = NULL;
                        } else {
-                               assert(ETH_DEV(priv)->data->all_multicast);
+                               MLX4_ASSERT(ETH_DEV(priv)->data->all_multicast);
                                pattern[1].spec = &eth_allmulti;
                                pattern[1].mask = &eth_allmulti;
                        }
@@ -1493,7 +1495,7 @@ next_vlan:
                                goto error;
                        }
                }
-               assert(flow->promisc || flow->allmulti);
+               MLX4_ASSERT(flow->promisc || flow->allmulti);
                flow->select = 1;
        }
 error:
@@ -1557,7 +1559,7 @@ mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error)
                        return ret;
        }
        if (!priv->started)
-               assert(!priv->drop);
+               MLX4_ASSERT(!priv->drop);
        return 0;
 }
 
@@ -1577,7 +1579,7 @@ mlx4_flow_clean(struct mlx4_priv *priv)
 
        while ((flow = LIST_FIRST(&priv->flows)))
                mlx4_flow_destroy(ETH_DEV(priv), flow, NULL);
-       assert(LIST_EMPTY(&priv->rss));
+       MLX4_ASSERT(LIST_EMPTY(&priv->rss));
 }
 
 static const struct rte_flow_ops mlx4_flow_ops = {
@@ -1589,37 +1591,19 @@ static const struct rte_flow_ops mlx4_flow_ops = {
 };
 
 /**
- * Manage filter operations.
+ * Get rte_flow callbacks.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param filter_type
- *   Filter type.
- * @param filter_op
- *   Operation to perform.
- * @param arg
+ * @param ops
  *   Pointer to operation-specific structure.
  *
- * @return
- *   0 on success, negative errno value otherwise and rte_errno is set.
+ * @return 0
  */
 int
-mlx4_filter_ctrl(struct rte_eth_dev *dev,
-                enum rte_filter_type filter_type,
-                enum rte_filter_op filter_op,
-                void *arg)
+mlx4_flow_ops_get(struct rte_eth_dev *dev __rte_unused,
+                 const struct rte_flow_ops **ops)
 {
-       switch (filter_type) {
-       case RTE_ETH_FILTER_GENERIC:
-               if (filter_op != RTE_ETH_FILTER_GET)
-                       break;
-               *(const void **)arg = &mlx4_flow_ops;
-               return 0;
-       default:
-               ERROR("%p: filter type (%d) not supported",
-                     (void *)dev, filter_type);
-               break;
-       }
-       rte_errno = ENOTSUP;
-       return -rte_errno;
+       *ops = &mlx4_flow_ops;
+       return 0;
 }