diff mbox

[rdma-core,2/7] mlx4: Add CQE fields

Message ID 1498736828-17875-3-git-send-email-yishaih@mellanox.com (mailing list archive)
State Accepted
Headers show

Commit Message

Yishai Hadas June 29, 2017, 11:47 a.m. UTC
From: Maor Gottlieb <maorg@mellanox.com>

Introduce inline calls to get/set for most
commonly used CQE data path fields.

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
---
 providers/mlx4/mlx4dv.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
diff mbox

Patch

diff --git a/providers/mlx4/mlx4dv.h b/providers/mlx4/mlx4dv.h
index 86b4e13..e677fe1 100644
--- a/providers/mlx4/mlx4dv.h
+++ b/providers/mlx4/mlx4dv.h
@@ -37,6 +37,13 @@ 
 #include <endian.h>
 #include <infiniband/verbs.h>
 
+/* Always inline the functions */
+#ifdef __GNUC__
+#define MLX4DV_ALWAYS_INLINE inline __attribute__((always_inline))
+#else
+#define MLX4DV_ALWAYS_INLINE inline
+#endif
+
 enum {
 	MLX4_OPCODE_NOP			= 0x00,
 	MLX4_OPCODE_SEND_INVAL		= 0x01,
@@ -219,6 +226,25 @@  enum mlx4dv_obj_type {
  */
 int mlx4dv_init_obj(struct mlx4dv_obj *obj, uint64_t obj_type);
 
+static MLX4DV_ALWAYS_INLINE
+uint8_t mlx4dv_get_cqe_owner(struct mlx4_cqe *cqe)
+{
+	return cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK;
+}
+
+static MLX4DV_ALWAYS_INLINE
+void mlx4dv_set_cqe_owner(struct mlx4_cqe *cqe, uint8_t val)
+{
+	cqe->owner_sr_opcode = (val & MLX4_CQE_OWNER_MASK) |
+		(cqe->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK);
+}
+
+static MLX4DV_ALWAYS_INLINE
+uint8_t mlx4dv_get_cqe_opcode(struct mlx4_cqe *cqe)
+{
+	return cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK;
+}
+
 /*
  * WQE related part
  */