summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSaeed Mahameed <saeedm@mellanox.com>2018-02-01 03:32:00 -0800
committerSaeed Mahameed <saeedm@mellanox.com>2018-02-15 00:30:01 -0800
commitf105b45bf77ced96e516e1cd771c41bb7e8c830b (patch)
treebc86d8533f9f0ffc3187d7bf13565610f2e3f15e /include
parentd5c07157dd4f5ab9123eaab7db572ca360c19a55 (diff)
net/mlx5: CQ hold/put API
Now as the CQ table is per EQ, add an API to hold/put CQ to be used from eq.c in downstream patch. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Reviewed-by: Gal Pressman <galp@mellanox.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mlx5/cq.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index 06ba425a6ad7..445ad194e0fe 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -172,6 +172,17 @@ static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, NULL);
}
+static inline void mlx5_cq_hold(struct mlx5_core_cq *cq)
+{
+ refcount_inc(&cq->refcount);
+}
+
+static inline void mlx5_cq_put(struct mlx5_core_cq *cq)
+{
+ if (refcount_dec_and_test(&cq->refcount))
+ complete(&cq->free);
+}
+
int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
u32 *in, int inlen);
int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);