net/mlx5: prefix Rx structures and functions
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
index fb30803..99dbd8c 100644 (file)
@@ -99,7 +99,7 @@ struct rte_flow {
        uint32_t mark:1; /**< Set if the flow is marked. */
        uint32_t drop:1; /**< Drop queue. */
        uint64_t hash_fields; /**< Fields that participate in the hash. */
-       struct rxq *rxqs[]; /**< Pointer to the queues array. */
+       struct mlx5_rxq_data *rxqs[]; /**< Pointer to the queues array. */
 };
 
 /** Static initializer for items. */
@@ -298,6 +298,49 @@ struct rte_flow_drop {
        struct ibv_cq *cq; /**< Verbs completion queue. */
 };
 
+static const struct rte_flow_ops mlx5_flow_ops = {
+       .validate = mlx5_flow_validate,
+       .create = mlx5_flow_create,
+       .destroy = mlx5_flow_destroy,
+       .flush = mlx5_flow_flush,
+       .query = NULL,
+       .isolate = mlx5_flow_isolate,
+};
+
+/**
+ * Manage filter operations.
+ *
+ * @param dev
+ *   Pointer to Ethernet device structure.
+ * @param filter_type
+ *   Filter type.
+ * @param filter_op
+ *   Operation to perform.
+ * @param arg
+ *   Pointer to operation-specific structure.
+ *
+ * @return
+ *   0 on success, negative errno value on failure.
+ */
+int
+mlx5_dev_filter_ctrl(struct rte_eth_dev *dev,
+                    enum rte_filter_type filter_type,
+                    enum rte_filter_op filter_op,
+                    void *arg)
+{
+       int ret = EINVAL;
+
+       if (filter_type == RTE_ETH_FILTER_GENERIC) {
+               if (filter_op != RTE_ETH_FILTER_GET)
+                       return -EINVAL;
+               *(const void **)arg = &mlx5_flow_ops;
+               return 0;
+       }
+       ERROR("%p: filter type (%d) not supported",
+             (void *)dev, filter_type);
+       return -ret;
+}
+
 /**
  * Check support for a given item.
  *
@@ -1062,10 +1105,10 @@ priv_flow_create_action_queue(struct priv *priv,
                return NULL;
        }
        for (i = 0; i < flow->actions.queues_n; ++i) {
-               struct rxq_ctrl *rxq;
+               struct mlx5_rxq_ctrl *rxq;
 
                rxq = container_of((*priv->rxqs)[flow->actions.queues[i]],
-                                  struct rxq_ctrl, rxq);
+                                  struct mlx5_rxq_ctrl, rxq);
                wqs[i] = rxq->wq;
                rte_flow->rxqs[i] = &rxq->rxq;
                ++rte_flow->rxqs_n;
@@ -1258,7 +1301,7 @@ priv_flow_destroy(struct priv *priv,
                claim_zero(ibv_destroy_rwq_ind_table(flow->ind_table));
        if (flow->mark) {
                struct rte_flow *tmp;
-               struct rxq *rxq;
+               struct mlx5_rxq_data *rxq;
                uint32_t mark_n = 0;
                uint32_t queue_n;
 
@@ -1278,7 +1321,7 @@ priv_flow_destroy(struct priv *priv,
                                for (tqueue_n = 0;
                                     tqueue_n < tmp->rxqs_n;
                                     ++tqueue_n) {
-                                       struct rxq *trxq;
+                                       struct mlx5_rxq_data *trxq;
 
                                        trxq = tmp->rxqs[tqueue_n];
                                        if (rxq == trxq)
@@ -1542,7 +1585,7 @@ priv_flow_start(struct priv *priv)
  *   Nonzero if the queue is used by a flow.
  */
 int
-priv_flow_rxq_in_use(struct priv *priv, struct rxq *rxq)
+priv_flow_rxq_in_use(struct priv *priv, struct mlx5_rxq_data *rxq)
 {
        struct rte_flow *flow;