Skip to contentSkip to conversation

start moving user space visible constants to uapi headers

PATCH In review Christoph Hellwig 5 participants 18 messages Dec 24, 2015 – Jan 4, 2016 11 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Currently very little of the uverbs user interface is actually exposed in uapi headers, and it's a constant struggle to figure out what's kernel internal and what is actually exposed in public. This series starts sorting this out by creating the infrastructure for a uapi header shared between uverbs and the core IB stack, and starts moving all WR and WC constants as well as the device capabilitity flags there.

A lot more work will have to follow, and I hope others will help out as well.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#2 lore raw

PATCH 1/6 IB/uapi: expose uverbs WR opcodes

This exposes the WR opcodes supported by uverbs as part of the uapi headers. For this I had to create a new uapi/rdma/ib_verbs.h headers so that we don't have to drag ib_user_verbs.h into the main ib_verbs.h.

There are now three tiers of WR opcodes: uapi ones that are fixeѕ and must not change [1], kernel-wide ones that follow the uapi ones and can be reordered at will, and driver-private ones that follow the kernel-wide ones, and will also be frequently reordered.

[1] we also assign explicitly values to them just so that this is obvious!

---
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  2 +-
 include/rdma/ib_verbs.h              | 39 ++++++++++++++++--------------------
 include/uapi/rdma/ib_user_verbs.h    |  2 ++
 include/uapi/rdma/ib_verbs.h         | 23 +++++++++++++++++++++
 4 files changed, 43 insertions(+), 23 deletions(-)
 create mode 100644 include/uapi/rdma/ib_verbs.h
drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -1
index d4b2271..2f82a08 100644
@@ -122,7 +122,7 @@ struct mlx5_ib_pd {
 #define MLX5_IB_SEND_UMR_FAIL_IF_FREE (IB_SEND_RESERVED_START << 1)
 #define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2)
 #define MLX5_IB_QPT_REG_UMR	IB_QPT_RESERVED1
-#define MLX5_IB_WR_UMR		IB_WR_RESERVED1
+#define MLX5_IB_WR_UMR		(IB_WR_END + 0)
 
 struct wr_list {
 	u16	opcode;
include/rdma/ib_verbs.h +17 -22
index 75fcc97..94509e0 100644
@@ -60,6 +60,8 @@
 #include <linux/mmu_notifier.h>
 #include <asm/uaccess.h>
 
+#include <uapi/rdma/ib_verbs.h>
+
 extern struct workqueue_struct *ib_wq;
 extern struct workqueue_struct *ib_comp_wq;
 
@@ -1108,34 +1110,27 @@ struct ib_qp_attr {
 };
 
 enum ib_wr_opcode {
-	IB_WR_RDMA_WRITE,
-	IB_WR_RDMA_WRITE_WITH_IMM,
-	IB_WR_SEND,
-	IB_WR_SEND_WITH_IMM,
-	IB_WR_RDMA_READ,
-	IB_WR_ATOMIC_CMP_AND_SWP,
-	IB_WR_ATOMIC_FETCH_AND_ADD,
-	IB_WR_LSO,
-	IB_WR_SEND_WITH_INV,
+	/* opcodes directly passed through from userspace: */
+	IB_WR_RDMA_WRITE		= IB_UVERBS_WR_RDMA_WRITE,
+	IB_WR_RDMA_WRITE_WITH_IMM	= IB_UVERBS_WR_RDMA_WRITE_WITH_IMM,
+	IB_WR_SEND			= IB_UVERBS_WR_SEND,
+	IB_WR_SEND_WITH_IMM		= IB_UVERBS_WR_SEND_WITH_IMM,
+	IB_WR_RDMA_READ			= IB_UVERBS_WR_RDMA_READ,
+	IB_WR_ATOMIC_CMP_AND_SWP	= IB_UVERBS_WR_ATOMIC_CMP_AND_SWP,
+	IB_WR_ATOMIC_FETCH_AND_ADD	= IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD,
+	IB_WR_SEND_WITH_INV		= IB_UVERBS_WR_SEND_WITH_INV,
+
+	/* kernel-internal opcodes: */
+	IB_WR_LSO			= IB_UVERBS_WR_END,
 	IB_WR_RDMA_READ_WITH_INV,
 	IB_WR_LOCAL_INV,
 	IB_WR_REG_MR,
 	IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
 	IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
 	IB_WR_REG_SIG_MR,
-	/* reserve values for low level drivers' internal use.
-	 * These values will not be used at all in the ib core layer.
-	 */
-	IB_WR_RESERVED1 = 0xf0,
-	IB_WR_RESERVED2,
-	IB_WR_RESERVED3,
-	IB_WR_RESERVED4,
-	IB_WR_RESERVED5,
-	IB_WR_RESERVED6,
-	IB_WR_RESERVED7,
-	IB_WR_RESERVED8,
-	IB_WR_RESERVED9,
-	IB_WR_RESERVED10,
+
+	/* drivers may use any value greater or equal to IB_WR_END internally */
+	IB_WR_END,
 };
 
 enum ib_send_flags {
include/uapi/rdma/ib_user_verbs.h +2 -0
index 8126c14..358a656 100644
@@ -38,6 +38,8 @@
 
 #include <linux/types.h>
 
+#include <uapi/rdma/ib_verbs.h>
+
 /*
  * Increment this value if any changes that break userspace ABI
  * compatibility are made.
include/uapi/rdma/ib_verbs.h new file +23 -0
new file mode 100644
index 0000000..330175e
@@ -0,0 +1,23 @@
+#ifndef _UAPI_RDMA_IB_VERBS_H
+#define _UAPI_RDMA_IB_VERBS_H 1
+
+/*
+ * This file contains constants exposed through the uverbs ABI that are also
+ * used internall by the RDMA stack.  It is separte from ib_user_verbs.h to
+ * having to pull that into the kernel-internal internal ib_verbs.h
+ */
+
+enum ib_uverbs_wr_opcode {
+	IB_UVERBS_WR_RDMA_WRITE			= 0,
+	IB_UVERBS_WR_RDMA_WRITE_WITH_IMM	= 1,
+	IB_UVERBS_WR_SEND			= 2,
+	IB_UVERBS_WR_SEND_WITH_IMM		= 3,
+	IB_UVERBS_WR_RDMA_READ			= 4,
+	IB_UVERBS_WR_ATOMIC_CMP_AND_SWP		= 5,
+	IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD	= 6,
+	/* 7 is still available */
+	IB_UVERBS_WR_SEND_WITH_INV		= 8,
+	IB_UVERBS_WR_END			= 9,
+};
+
+#endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#4 lore raw

Re: [PATCH 1/6] IB/uapi: expose uverbs WR opcodes

On Thu, Dec 24, 2015 at 03:39:22PM +0100, Christoph Hellwig wrote:
....

Quoted 4 lines

#define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2)
#define MLX5_IB_QPT_REG_UMR IB_QPT_RESERVED1

drivers/infiniband/hw/mlx5/mlx5_ib.h +1 -1
-#define MLX5_IB_WR_UMR		IB_WR_RESERVED1
+#define MLX5_IB_WR_UMR		(IB_WR_END + 0)

....

include/rdma/ib_verbs.h struct ib_qp_attr { · line 1133

Quoted 5 lines
include/rdma/ib_verbs.h +3 -1
-	IB_WR_RESERVED10,
+
+	/* drivers may use any value greater or equal to IB_WR_END internally */
+	IB_WR_END,

IB_WR_END --> IB_WR_KERNEL_LAST

Quoted 2 lines

};

....

include/uapi/rdma/ib_verbs.h line 20

Quoted 1 line
include/uapi/rdma/ib_verbs.h new file +1 -0
+	IB_UVERBS_WR_END			= 9,

I think name IB_UVERBS_WR_LAST describes better than IB_UVERBS_WR_END.

include/uapi/rdma/ib_verbs.h line 22

Quoted 2 lines
include/uapi/rdma/ib_verbs.h new file +2 -0
+};
+

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH 2/6 IB/uapi: expose uverbs send WR flags

In reply to a message not in the archive

This exposes the send WR flags supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  6 +++---
 include/rdma/ib_verbs.h              | 14 ++++++--------
 include/uapi/rdma/ib_verbs.h         |  9 +++++++++
 3 files changed, 18 insertions(+), 11 deletions(-)
drivers/infiniband/hw/mlx5/mlx5_ib.h +3 -3
index 2f82a08..6c264f0 100644
@@ -118,9 +118,9 @@ struct mlx5_ib_pd {
  * enum ib_send_flags and enum ib_qp_type for low-level driver
  */
 
-#define MLX5_IB_SEND_UMR_UNREG	IB_SEND_RESERVED_START
-#define MLX5_IB_SEND_UMR_FAIL_IF_FREE (IB_SEND_RESERVED_START << 1)
-#define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2)
+#define MLX5_IB_SEND_UMR_UNREG	IB_SEND_END
+#define MLX5_IB_SEND_UMR_FAIL_IF_FREE (IB_SEND_END << 1)
+#define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_END << 2)
 #define MLX5_IB_QPT_REG_UMR	IB_QPT_RESERVED1
 #define MLX5_IB_WR_UMR		(IB_WR_END + 0)
 
include/rdma/ib_verbs.h +6 -8
index 94509e0..5dccc6a 100644
@@ -1134,15 +1134,13 @@ enum ib_wr_opcode {
 };
 
 enum ib_send_flags {
-	IB_SEND_FENCE		= 1,
-	IB_SEND_SIGNALED	= (1<<1),
-	IB_SEND_SOLICITED	= (1<<2),
-	IB_SEND_INLINE		= (1<<3),
-	IB_SEND_IP_CSUM		= (1<<4),
+	IB_SEND_FENCE		= IB_UVERBS_SEND_FENCE,
+	IB_SEND_SIGNALED	= IB_UVERBS_SEND_SIGNALED,
+	IB_SEND_SOLICITED	= IB_UVERBS_SEND_SOLICITED,
+	IB_SEND_INLINE		= IB_UVERBS_SEND_INLINE,
+	IB_SEND_IP_CSUM		= IB_UVERBS_SEND_IP_CSUM,
 
-	/* reserve bits 26-31 for low level drivers' internal use */
-	IB_SEND_RESERVED_START	= (1 << 26),
-	IB_SEND_RESERVED_END	= (1 << 31),
+	IB_SEND_END		= IB_UVERBS_SEND_END,
 };
 
 struct ib_sge {
include/uapi/rdma/ib_verbs.h +9 -0
index 330175e..3be3152 100644
@@ -20,4 +20,13 @@ enum ib_uverbs_wr_opcode {
 	IB_UVERBS_WR_END			= 9,
 };
 
+enum ib_uverbs_send_flags {
+	IB_UVERBS_SEND_FENCE			= (1 << 0),
+	IB_UVERBS_SEND_SIGNALED			= (1 << 1),
+	IB_UVERBS_SEND_SOLICITED		= (1 << 2),
+	IB_UVERBS_SEND_INLINE			= (1 << 3),
+	IB_UVERBS_SEND_IP_CSUM			= (1 << 4),
+	IB_UVERBS_SEND_END			= (1 << 5),
+};
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-3-git-send-email-hch-jcswGhMUV9g@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH 2/6] IB/uapi: expose uverbs send WR flags

Quoted 16 lines · Christoph Hellwig

This exposes the send WR flags supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  6 +++---
 include/rdma/ib_verbs.h              | 14 ++++++--------
 include/uapi/rdma/ib_verbs.h         |  9 +++++++++
 3 files changed, 18 insertions(+), 11 deletions(-)
include/uapi/rdma/ib_verbs.h +0 -0
index 330175e..3be3152 100644

include/uapi/rdma/ib_verbs.h enum ib_uverbs_wr_opcode { · line 29

Quoted 10 lines
include/uapi/rdma/ib_verbs.h +7 -0
@@ -20,4 +20,13 @@ enum ib_uverbs_wr_opcode {
 	IB_UVERBS_WR_END			= 9,
 };
 
+enum ib_uverbs_send_flags {
+	IB_UVERBS_SEND_FENCE			= (1 << 0),
+	IB_UVERBS_SEND_SIGNALED			= (1 << 1),
+	IB_UVERBS_SEND_SOLICITED		= (1 << 2),
+	IB_UVERBS_SEND_INLINE			= (1 << 3),
+	IB_UVERBS_SEND_IP_CSUM			= (1 << 4),
+	IB_UVERBS_SEND_END			= (1 << 5),

Do you think we need a check in ib_uverbs_post_send to see only user flags are passed? I think it would be safer.

Other than that,

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH 3/6 IB/uapi: expose uverbs WC opcodes

In reply to a message not in the archive

This exposes the WC opcodes supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 29 +++++++++++++----------------
 include/uapi/rdma/ib_verbs.h | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 16 deletions(-)
include/rdma/ib_verbs.h +13 -16
index 5dccc6a..7dce204 100644
@@ -819,22 +819,19 @@ enum ib_wc_status {
 const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
 
 enum ib_wc_opcode {
-	IB_WC_SEND,
-	IB_WC_RDMA_WRITE,
-	IB_WC_RDMA_READ,
-	IB_WC_COMP_SWAP,
-	IB_WC_FETCH_ADD,
-	IB_WC_LSO,
-	IB_WC_LOCAL_INV,
-	IB_WC_REG_MR,
-	IB_WC_MASKED_COMP_SWAP,
-	IB_WC_MASKED_FETCH_ADD,
-/*
- * Set value of IB_WC_RECV so consumers can test if a completion is a
- * receive by testing (opcode & IB_WC_RECV).
- */
-	IB_WC_RECV			= 1 << 7,
-	IB_WC_RECV_RDMA_WITH_IMM
+	IB_WC_SEND		= IB_UVERBS_WC_SEND,
+	IB_WC_RDMA_WRITE	= IB_UVERBS_WC_RDMA_WRITE,
+	IB_WC_RDMA_READ		= IB_UVERBS_WC_RDMA_READ,
+	IB_WC_COMP_SWAP		= IB_UVERBS_WC_COMP_SWAP,
+	IB_WC_FETCH_ADD		= IB_UVERBS_WC_FETCH_ADD,
+	IB_WC_LSO		= IB_UVERBS_WC_SEND_END,
+	IB_WC_LOCAL_INV		= IB_UVERBS_WC_SEND_END + 1,
+	IB_WC_REG_MR		= IB_UVERBS_WC_SEND_END + 2,
+	IB_WC_MASKED_COMP_SWAP	= IB_UVERBS_WC_SEND_END + 3,
+	IB_WC_MASKED_FETCH_ADD	= IB_UVERBS_WC_SEND_END + 4,
+
+	IB_WC_RECV		= IB_UVERBS_WC_RECV,
+	IB_WC_RECV_RDMA_WITH_IMM = IB_UVERBS_WC_RECV_END,
 };
 
 enum ib_wc_flags {
include/uapi/rdma/ib_verbs.h +16 -0
index 3be3152..fd7a393 100644
@@ -29,4 +29,20 @@ enum ib_uverbs_send_flags {
 	IB_UVERBS_SEND_END			= (1 << 5),
 };
 
+enum ib_uverbs_wc_opcode {
+	IB_UVERBS_WC_SEND			= 0,
+	IB_UVERBS_WC_RDMA_WRITE			= 1,
+	IB_UVERBS_WC_RDMA_READ			= 2,
+	IB_UVERBS_WC_COMP_SWAP			= 3,
+	IB_UVERBS_WC_FETCH_ADD			= 4,
+	IB_UVERBS_WC_SEND_END			= 5,
+
+	/*
+	 * Set value of IB_WC_RECV so consumers can test if a completion is a
+	 * receive by testing (opcode & IB_WC_RECV).
+	 */
+	IB_UVERBS_WC_RECV			= 1 << 7,
+	IB_UVERBS_WC_RECV_END			= (1 << 7) + 1,
+};
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#10 lore raw

Re: [PATCH 3/6] IB/uapi: expose uverbs WC opcodes

Quoted 33 lines · Christoph Hellwig

This exposes the WC opcodes supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 29 +++++++++++++----------------
 include/uapi/rdma/ib_verbs.h | 16 ++++++++++++++++
 2 files changed, 29 insertions(+), 16 deletions(-)
include/rdma/ib_verbs.h +0 -16
index 5dccc6a..7dce204 100644
@@ -819,22 +819,19 @@ enum ib_wc_status {
 const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
 
 enum ib_wc_opcode {
-	IB_WC_SEND,
-	IB_WC_RDMA_WRITE,
-	IB_WC_RDMA_READ,
-	IB_WC_COMP_SWAP,
-	IB_WC_FETCH_ADD,
-	IB_WC_LSO,
-	IB_WC_LOCAL_INV,
-	IB_WC_REG_MR,
-	IB_WC_MASKED_COMP_SWAP,
-	IB_WC_MASKED_FETCH_ADD,
-/*
- * Set value of IB_WC_RECV so consumers can test if a completion is a
- * receive by testing (opcode & IB_WC_RECV).
- */
-	IB_WC_RECV			= 1 << 7,
-	IB_WC_RECV_RDMA_WITH_IMM

include/rdma/ib_verbs.h enum ib_wc_status { · line 831

Quoted 10 lines
include/rdma/ib_verbs.h +10 -0
+	IB_WC_SEND		= IB_UVERBS_WC_SEND,
+	IB_WC_RDMA_WRITE	= IB_UVERBS_WC_RDMA_WRITE,
+	IB_WC_RDMA_READ		= IB_UVERBS_WC_RDMA_READ,
+	IB_WC_COMP_SWAP		= IB_UVERBS_WC_COMP_SWAP,
+	IB_WC_FETCH_ADD		= IB_UVERBS_WC_FETCH_ADD,
+	IB_WC_LSO		= IB_UVERBS_WC_SEND_END,
+	IB_WC_LOCAL_INV		= IB_UVERBS_WC_SEND_END + 1,
+	IB_WC_REG_MR		= IB_UVERBS_WC_SEND_END + 2,
+	IB_WC_MASKED_COMP_SWAP	= IB_UVERBS_WC_SEND_END + 3,
+	IB_WC_MASKED_FETCH_ADD	= IB_UVERBS_WC_SEND_END + 4,

As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself.

Quoted 38 lines
include/rdma/ib_verbs.h +3 -0
+
+	IB_WC_RECV		= IB_UVERBS_WC_RECV,
+	IB_WC_RECV_RDMA_WITH_IMM = IB_UVERBS_WC_RECV_END,
 };
 
 enum ib_wc_flags {
include/uapi/rdma/ib_verbs.h +16 -0
index 3be3152..fd7a393 100644
@@ -29,4 +29,20 @@ enum ib_uverbs_send_flags {
 	IB_UVERBS_SEND_END			= (1 << 5),
 };
 
+enum ib_uverbs_wc_opcode {
+	IB_UVERBS_WC_SEND			= 0,
+	IB_UVERBS_WC_RDMA_WRITE			= 1,
+	IB_UVERBS_WC_RDMA_READ			= 2,
+	IB_UVERBS_WC_COMP_SWAP			= 3,
+	IB_UVERBS_WC_FETCH_ADD			= 4,
+	IB_UVERBS_WC_SEND_END			= 5,
+
+	/*
+	 * Set value of IB_WC_RECV so consumers can test if a completion is a
+	 * receive by testing (opcode & IB_WC_RECV).
+	 */
+	IB_UVERBS_WC_RECV			= 1 << 7,
+	IB_UVERBS_WC_RECV_END			= (1 << 7) + 1,
+};
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20151227061202.GB8501-2ukJVAZIZ/[email protected]

#12 lore raw

Re: [PATCH 3/6] IB/uapi: expose uverbs WC opcodes

Quoted 13 lines

include/rdma/ib_verbs.h enum ib_wc_status { · line 831

Quoted 11 lines
include/rdma/ib_verbs.h +10 -0
+	IB_WC_SEND		= IB_UVERBS_WC_SEND,
+	IB_WC_RDMA_WRITE	= IB_UVERBS_WC_RDMA_WRITE,
+	IB_WC_RDMA_READ		= IB_UVERBS_WC_RDMA_READ,
+	IB_WC_COMP_SWAP		= IB_UVERBS_WC_COMP_SWAP,
+	IB_WC_FETCH_ADD		= IB_UVERBS_WC_FETCH_ADD,
+	IB_WC_LSO		= IB_UVERBS_WC_SEND_END,
+	IB_WC_LOCAL_INV		= IB_UVERBS_WC_SEND_END + 1,
+	IB_WC_REG_MR		= IB_UVERBS_WC_SEND_END + 2,
+	IB_WC_MASKED_COMP_SWAP	= IB_UVERBS_WC_SEND_END + 3,
+	IB_WC_MASKED_FETCH_ADD	= IB_UVERBS_WC_SEND_END + 4,

As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself.

I disagree, I'd say its better to keep the code verbosity level here... --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 3/6] IB/uapi: expose uverbs WC opcodes

Quoted 4 lines · Sagi Grimberg
Quoted 2 lines

As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself.

I disagree, I'd say its better to keep the code verbosity level here...

I really don't like enum auto assignment for constants that are fixe as part of an ABI. There is too much chance of things going wrong. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [PATCH 3/6] IB/uapi: expose uverbs WC opcodes

Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Sagi Grimberg
Quoted 2 lines

As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV. Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself.

I disagree, I'd say its better to keep the code verbosity level here...

I really don't like enum auto assignment for constants that are fixe as part of an ABI. There is too much chance of things going wrong.

It is up to you, just be constant in your enums assignments.

Thanks.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

PATCH 4/6 IB/uapi: expose uverbs WC flags

In reply to a message not in the archive

This exposes the WC flags supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 14 +++++++-------
 include/uapi/rdma/ib_verbs.h | 10 ++++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)
include/rdma/ib_verbs.h +7 -7
index 7dce204..337db70 100644
@@ -835,13 +835,13 @@ enum ib_wc_opcode {
 };
 
 enum ib_wc_flags {
-	IB_WC_GRH		= 1,
-	IB_WC_WITH_IMM		= (1<<1),
-	IB_WC_WITH_INVALIDATE	= (1<<2),
-	IB_WC_IP_CSUM_OK	= (1<<3),
-	IB_WC_WITH_SMAC		= (1<<4),
-	IB_WC_WITH_VLAN		= (1<<5),
-	IB_WC_WITH_NETWORK_HDR_TYPE	= (1<<6),
+	IB_WC_GRH			= IB_UVERBS_WC_GRH,
+	IB_WC_WITH_IMM			= IB_UVERBS_WC_WITH_IMM,
+	IB_WC_WITH_INVALIDATE		= IB_UVERBS_WC_WITH_INVALIDATE,
+	IB_WC_IP_CSUM_OK		= IB_UVERBS_WC_IP_CSUM_OK,
+	IB_WC_WITH_SMAC			= IB_UVERBS_WC_WITH_SMAC,
+	IB_WC_WITH_VLAN			= IB_UVERBS_WC_WITH_VLAN,
+	IB_WC_WITH_NETWORK_HDR_TYPE	= IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE,
 };
 
 struct ib_wc {
include/uapi/rdma/ib_verbs.h +10 -0
index fd7a393..c40c00b 100644
@@ -45,4 +45,14 @@ enum ib_uverbs_wc_opcode {
 	IB_UVERBS_WC_RECV_END			= (1 << 7) + 1,
 };
 
+enum ib_uverbs_wc_flags {
+	IB_UVERBS_WC_GRH			= (1 << 0),
+	IB_UVERBS_WC_WITH_IMM			= (1 << 1),
+	IB_UVERBS_WC_WITH_INVALIDATE		= (1 << 2),
+	IB_UVERBS_WC_IP_CSUM_OK			= (1 << 3),
+	IB_UVERBS_WC_WITH_SMAC			= (1 << 4),
+	IB_UVERBS_WC_WITH_VLAN			= (1 << 5),
+	IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE	= (1 << 6),
+};
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#19 lore raw

Re: [PATCH 4/6] IB/uapi: expose uverbs WC flags

Quoted 41 lines · Christoph Hellwig

This exposes the WC flags supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 14 +++++++-------
 include/uapi/rdma/ib_verbs.h | 10 ++++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)
include/rdma/ib_verbs.h +7 -7
index 7dce204..337db70 100644
@@ -835,13 +835,13 @@ enum ib_wc_opcode {
 };
 
 enum ib_wc_flags {
-	IB_WC_GRH		= 1,
-	IB_WC_WITH_IMM		= (1<<1),
-	IB_WC_WITH_INVALIDATE	= (1<<2),
-	IB_WC_IP_CSUM_OK	= (1<<3),
-	IB_WC_WITH_SMAC		= (1<<4),
-	IB_WC_WITH_VLAN		= (1<<5),
-	IB_WC_WITH_NETWORK_HDR_TYPE	= (1<<6),
+	IB_WC_GRH			= IB_UVERBS_WC_GRH,
+	IB_WC_WITH_IMM			= IB_UVERBS_WC_WITH_IMM,
+	IB_WC_WITH_INVALIDATE		= IB_UVERBS_WC_WITH_INVALIDATE,
+	IB_WC_IP_CSUM_OK		= IB_UVERBS_WC_IP_CSUM_OK,
+	IB_WC_WITH_SMAC			= IB_UVERBS_WC_WITH_SMAC,
+	IB_WC_WITH_VLAN			= IB_UVERBS_WC_WITH_VLAN,
+	IB_WC_WITH_NETWORK_HDR_TYPE	= IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE,
 };
 
 struct ib_wc {
include/uapi/rdma/ib_verbs.h +0 -0
index fd7a393..c40c00b 100644
@@ -45,4 +45,14 @@ enum ib_uverbs_wc_opcode {
 	IB_UVERBS_WC_RECV_END			= (1 << 7) + 1,
 };

include/uapi/rdma/ib_verbs.h enum ib_uverbs_wc_opcode { · line 56

Quoted 10 lines
include/uapi/rdma/ib_verbs.h +9 -0
 
+enum ib_uverbs_wc_flags {
+	IB_UVERBS_WC_GRH			= (1 << 0),
+	IB_UVERBS_WC_WITH_IMM			= (1 << 1),
+	IB_UVERBS_WC_WITH_INVALIDATE		= (1 << 2),
+	IB_UVERBS_WC_IP_CSUM_OK			= (1 << 3),
+	IB_UVERBS_WC_WITH_SMAC			= (1 << 4),
+	IB_UVERBS_WC_WITH_VLAN			= (1 << 5),
+	IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE	= (1 << 6),
+};

It will be great to add _FLAGS_ mark in the name and add _LAST too.

Quoted 9 lines
include/uapi/rdma/ib_verbs.h +1 -0
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20151227061545.GC8501-2ukJVAZIZ/[email protected]

#21 lore raw

Re: [PATCH 4/6] IB/uapi: expose uverbs WC flags

Quoted 11 lines

include/uapi/rdma/ib_verbs.h enum ib_uverbs_wc_opcode { · line 56

Quoted 10 lines
include/uapi/rdma/ib_verbs.h +9 -0
+enum ib_uverbs_wc_flags {
+	IB_UVERBS_WC_GRH			= (1 << 0),
+	IB_UVERBS_WC_WITH_IMM			= (1 << 1),
+	IB_UVERBS_WC_WITH_INVALIDATE		= (1 << 2),
+	IB_UVERBS_WC_IP_CSUM_OK			= (1 << 3),
+	IB_UVERBS_WC_WITH_SMAC			= (1 << 4),
+	IB_UVERBS_WC_WITH_VLAN			= (1 << 5),
+	IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE	= (1 << 6),
+};

It will be great to add _FLAGS_ mark in the name and add _LAST too.

Don't you prefer to stay consistent with the kernel enumeration? --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw

PATCH 5/6 IB/uapi: expose uverbs WC status codes

In reply to a message not in the archive

This exposes the WC status codes supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 44 ++++++++++++++++++++++----------------------
 include/uapi/rdma/ib_verbs.h | 25 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 22 deletions(-)
include/rdma/ib_verbs.h +22 -22
index 337db70..48bfcf5 100644
@@ -792,28 +792,28 @@ struct ib_ah_attr {
 };
 
 enum ib_wc_status {
-	IB_WC_SUCCESS,
-	IB_WC_LOC_LEN_ERR,
-	IB_WC_LOC_QP_OP_ERR,
-	IB_WC_LOC_EEC_OP_ERR,
-	IB_WC_LOC_PROT_ERR,
-	IB_WC_WR_FLUSH_ERR,
-	IB_WC_MW_BIND_ERR,
-	IB_WC_BAD_RESP_ERR,
-	IB_WC_LOC_ACCESS_ERR,
-	IB_WC_REM_INV_REQ_ERR,
-	IB_WC_REM_ACCESS_ERR,
-	IB_WC_REM_OP_ERR,
-	IB_WC_RETRY_EXC_ERR,
-	IB_WC_RNR_RETRY_EXC_ERR,
-	IB_WC_LOC_RDD_VIOL_ERR,
-	IB_WC_REM_INV_RD_REQ_ERR,
-	IB_WC_REM_ABORT_ERR,
-	IB_WC_INV_EECN_ERR,
-	IB_WC_INV_EEC_STATE_ERR,
-	IB_WC_FATAL_ERR,
-	IB_WC_RESP_TIMEOUT_ERR,
-	IB_WC_GENERAL_ERR
+	IB_WC_SUCCESS		= IB_UVERBS_WC_SUCCESS,
+	IB_WC_LOC_LEN_ERR	= IB_UVERBS_WC_LOC_LEN_ERR,
+	IB_WC_LOC_QP_OP_ERR	= IB_UVERBS_WC_LOC_QP_OP_ERR,
+	IB_WC_LOC_EEC_OP_ERR	= IB_UVERBS_WC_LOC_EEC_OP_ERR,
+	IB_WC_LOC_PROT_ERR	= IB_UVERBS_WC_LOC_PROT_ERR,
+	IB_WC_WR_FLUSH_ERR	= IB_UVERBS_WC_WR_FLUSH_ERR,
+	IB_WC_MW_BIND_ERR	= IB_UVERBS_WC_MW_BIND_ERR,
+	IB_WC_BAD_RESP_ERR	= IB_UVERBS_WC_BAD_RESP_ERR,
+	IB_WC_LOC_ACCESS_ERR	= IB_UVERBS_WC_LOC_ACCESS_ERR,
+	IB_WC_REM_INV_REQ_ERR	= IB_UVERBS_WC_REM_INV_REQ_ERR,
+	IB_WC_REM_ACCESS_ERR	= IB_UVERBS_WC_REM_ACCESS_ERR,
+	IB_WC_REM_OP_ERR	= IB_UVERBS_WC_REM_OP_ERR,
+	IB_WC_RETRY_EXC_ERR	= IB_UVERBS_WC_RETRY_EXC_ERR,
+	IB_WC_RNR_RETRY_EXC_ERR	= IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
+	IB_WC_LOC_RDD_VIOL_ERR	= IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
+	IB_WC_REM_INV_RD_REQ_ERR= IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
+	IB_WC_REM_ABORT_ERR	= IB_UVERBS_WC_REM_ABORT_ERR,
+	IB_WC_INV_EECN_ERR	= IB_UVERBS_WC_INV_EECN_ERR,
+	IB_WC_INV_EEC_STATE_ERR = IB_UVERBS_WC_INV_EEC_STATE_ERR,
+	IB_WC_FATAL_ERR		= IB_UVERBS_WC_FATAL_ERR,
+	IB_WC_RESP_TIMEOUT_ERR	= IB_UVERBS_WC_RESP_TIMEOUT_ERR,
+	IB_WC_GENERAL_ERR	= IB_UVERBS_WC_GENERAL_ERR,
 };
 
 const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
include/uapi/rdma/ib_verbs.h +25 -0
index c40c00b..fbadb29 100644
@@ -55,4 +55,29 @@ enum ib_uverbs_wc_flags {
 	IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE	= (1 << 6),
 };
 
+enum ib_uverbs_wc_status {
+	IB_UVERBS_WC_SUCCESS,
+	IB_UVERBS_WC_LOC_LEN_ERR,
+	IB_UVERBS_WC_LOC_QP_OP_ERR,
+	IB_UVERBS_WC_LOC_EEC_OP_ERR,
+	IB_UVERBS_WC_LOC_PROT_ERR,
+	IB_UVERBS_WC_WR_FLUSH_ERR,
+	IB_UVERBS_WC_MW_BIND_ERR,
+	IB_UVERBS_WC_BAD_RESP_ERR,
+	IB_UVERBS_WC_LOC_ACCESS_ERR,
+	IB_UVERBS_WC_REM_INV_REQ_ERR,
+	IB_UVERBS_WC_REM_ACCESS_ERR,
+	IB_UVERBS_WC_REM_OP_ERR,
+	IB_UVERBS_WC_RETRY_EXC_ERR,
+	IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
+	IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
+	IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
+	IB_UVERBS_WC_REM_ABORT_ERR,
+	IB_UVERBS_WC_INV_EECN_ERR,
+	IB_UVERBS_WC_INV_EEC_STATE_ERR,
+	IB_UVERBS_WC_FATAL_ERR,
+	IB_UVERBS_WC_RESP_TIMEOUT_ERR,
+	IB_UVERBS_WC_GENERAL_ERR
+};
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-6-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#24 lore raw

Re: [PATCH 5/6] IB/uapi: expose uverbs WC status codes

Quoted 86 lines · Christoph Hellwig

This exposes the WC status codes supported by uverbs as part of the uapi headers. It follows the same scheme as the WR opcodes.

---
 include/rdma/ib_verbs.h      | 44 ++++++++++++++++++++++----------------------
 include/uapi/rdma/ib_verbs.h | 25 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 22 deletions(-)
include/rdma/ib_verbs.h +22 -22
index 337db70..48bfcf5 100644
@@ -792,28 +792,28 @@ struct ib_ah_attr {
 };
 
 enum ib_wc_status {
-	IB_WC_SUCCESS,
-	IB_WC_LOC_LEN_ERR,
-	IB_WC_LOC_QP_OP_ERR,
-	IB_WC_LOC_EEC_OP_ERR,
-	IB_WC_LOC_PROT_ERR,
-	IB_WC_WR_FLUSH_ERR,
-	IB_WC_MW_BIND_ERR,
-	IB_WC_BAD_RESP_ERR,
-	IB_WC_LOC_ACCESS_ERR,
-	IB_WC_REM_INV_REQ_ERR,
-	IB_WC_REM_ACCESS_ERR,
-	IB_WC_REM_OP_ERR,
-	IB_WC_RETRY_EXC_ERR,
-	IB_WC_RNR_RETRY_EXC_ERR,
-	IB_WC_LOC_RDD_VIOL_ERR,
-	IB_WC_REM_INV_RD_REQ_ERR,
-	IB_WC_REM_ABORT_ERR,
-	IB_WC_INV_EECN_ERR,
-	IB_WC_INV_EEC_STATE_ERR,
-	IB_WC_FATAL_ERR,
-	IB_WC_RESP_TIMEOUT_ERR,
-	IB_WC_GENERAL_ERR
+	IB_WC_SUCCESS		= IB_UVERBS_WC_SUCCESS,
+	IB_WC_LOC_LEN_ERR	= IB_UVERBS_WC_LOC_LEN_ERR,
+	IB_WC_LOC_QP_OP_ERR	= IB_UVERBS_WC_LOC_QP_OP_ERR,
+	IB_WC_LOC_EEC_OP_ERR	= IB_UVERBS_WC_LOC_EEC_OP_ERR,
+	IB_WC_LOC_PROT_ERR	= IB_UVERBS_WC_LOC_PROT_ERR,
+	IB_WC_WR_FLUSH_ERR	= IB_UVERBS_WC_WR_FLUSH_ERR,
+	IB_WC_MW_BIND_ERR	= IB_UVERBS_WC_MW_BIND_ERR,
+	IB_WC_BAD_RESP_ERR	= IB_UVERBS_WC_BAD_RESP_ERR,
+	IB_WC_LOC_ACCESS_ERR	= IB_UVERBS_WC_LOC_ACCESS_ERR,
+	IB_WC_REM_INV_REQ_ERR	= IB_UVERBS_WC_REM_INV_REQ_ERR,
+	IB_WC_REM_ACCESS_ERR	= IB_UVERBS_WC_REM_ACCESS_ERR,
+	IB_WC_REM_OP_ERR	= IB_UVERBS_WC_REM_OP_ERR,
+	IB_WC_RETRY_EXC_ERR	= IB_UVERBS_WC_RETRY_EXC_ERR,
+	IB_WC_RNR_RETRY_EXC_ERR	= IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
+	IB_WC_LOC_RDD_VIOL_ERR	= IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
+	IB_WC_REM_INV_RD_REQ_ERR= IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
+	IB_WC_REM_ABORT_ERR	= IB_UVERBS_WC_REM_ABORT_ERR,
+	IB_WC_INV_EECN_ERR	= IB_UVERBS_WC_INV_EECN_ERR,
+	IB_WC_INV_EEC_STATE_ERR = IB_UVERBS_WC_INV_EEC_STATE_ERR,
+	IB_WC_FATAL_ERR		= IB_UVERBS_WC_FATAL_ERR,
+	IB_WC_RESP_TIMEOUT_ERR	= IB_UVERBS_WC_RESP_TIMEOUT_ERR,
+	IB_WC_GENERAL_ERR	= IB_UVERBS_WC_GENERAL_ERR,
 };
 
 const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
include/uapi/rdma/ib_verbs.h +14 -0
index c40c00b..fbadb29 100644
@@ -55,4 +55,29 @@ enum ib_uverbs_wc_flags {
 	IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE	= (1 << 6),
 };
 
+enum ib_uverbs_wc_status {
+	IB_UVERBS_WC_SUCCESS,
+	IB_UVERBS_WC_LOC_LEN_ERR,
+	IB_UVERBS_WC_LOC_QP_OP_ERR,
+	IB_UVERBS_WC_LOC_EEC_OP_ERR,
+	IB_UVERBS_WC_LOC_PROT_ERR,
+	IB_UVERBS_WC_WR_FLUSH_ERR,
+	IB_UVERBS_WC_MW_BIND_ERR,
+	IB_UVERBS_WC_BAD_RESP_ERR,
+	IB_UVERBS_WC_LOC_ACCESS_ERR,
+	IB_UVERBS_WC_REM_INV_REQ_ERR,
+	IB_UVERBS_WC_REM_ACCESS_ERR,
+	IB_UVERBS_WC_REM_OP_ERR,
+	IB_UVERBS_WC_RETRY_EXC_ERR,

include/uapi/rdma/ib_verbs.h enum ib_uverbs_wc_flags { · line 81

Quoted 10 lines
include/uapi/rdma/ib_verbs.h +10 -0
+	IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
+	IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
+	IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
+	IB_UVERBS_WC_REM_ABORT_ERR,
+	IB_UVERBS_WC_INV_EECN_ERR,
+	IB_UVERBS_WC_INV_EEC_STATE_ERR,
+	IB_UVERBS_WC_FATAL_ERR,
+	IB_UVERBS_WC_RESP_TIMEOUT_ERR,
+	IB_UVERBS_WC_GENERAL_ERR
+};

The same as in previous mail, mark it as a _STATUS_ in the name.

Quoted 9 lines
include/uapi/rdma/ib_verbs.h +1 -0
+
 #endif /* _UAPI_RDMA_IB_VERBS_H */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#25 lore raw

PATCH 6/6 IB/uapi: expose device capability flags

In reply to a message not in the archive

Expose the device capability flags which can be queried through uverbs in the uapi headers.

---
 include/rdma/ib_verbs.h      | 94 +++++++++++++++-----------------------------
 include/uapi/rdma/ib_verbs.h | 66 +++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 62 deletions(-)
include/rdma/ib_verbs.h +32 -62
index 48bfcf5..b8d4113 100644
@@ -151,68 +151,38 @@ enum rdma_link_layer {
 };
 
 enum ib_device_cap_flags {
-	IB_DEVICE_RESIZE_MAX_WR			= (1 << 0),
-	IB_DEVICE_BAD_PKEY_CNTR			= (1 << 1),
-	IB_DEVICE_BAD_QKEY_CNTR			= (1 << 2),
-	IB_DEVICE_RAW_MULTI			= (1 << 3),
-	IB_DEVICE_AUTO_PATH_MIG			= (1 << 4),
-	IB_DEVICE_CHANGE_PHY_PORT		= (1 << 5),
-	IB_DEVICE_UD_AV_PORT_ENFORCE		= (1 << 6),
-	IB_DEVICE_CURR_QP_STATE_MOD		= (1 << 7),
-	IB_DEVICE_SHUTDOWN_PORT			= (1 << 8),
-	IB_DEVICE_INIT_TYPE			= (1 << 9),
-	IB_DEVICE_PORT_ACTIVE_EVENT		= (1 << 10),
-	IB_DEVICE_SYS_IMAGE_GUID		= (1 << 11),
-	IB_DEVICE_RC_RNR_NAK_GEN		= (1 << 12),
-	IB_DEVICE_SRQ_RESIZE			= (1 << 13),
-	IB_DEVICE_N_NOTIFY_CQ			= (1 << 14),
-
-	/*
-	 * This device supports a per-device lkey or stag that can be
-	 * used without performing a memory registration for the local
-	 * memory.  Note that ULPs should never check this flag, but
-	 * instead of use the local_dma_lkey flag in the ib_pd structure,
-	 * which will always contain a usable lkey.
-	 */
-	IB_DEVICE_LOCAL_DMA_LKEY		= (1 << 15),
-	IB_DEVICE_RESERVED /* old SEND_W_INV */	= (1 << 16),
-	IB_DEVICE_MEM_WINDOW			= (1 << 17),
-	/*
-	 * Devices should set IB_DEVICE_UD_IP_SUM if they support
-	 * insertion of UDP and TCP checksum on outgoing UD IPoIB
-	 * messages and can verify the validity of checksum for
-	 * incoming messages.  Setting this flag implies that the
-	 * IPoIB driver may set NETIF_F_IP_CSUM for datagram mode.
-	 */
-	IB_DEVICE_UD_IP_CSUM			= (1 << 18),
-	IB_DEVICE_UD_TSO			= (1 << 19),
-	IB_DEVICE_XRC				= (1 << 20),
-
-	/*
-	 * This device supports the IB "base memory management extension",
-	 * which includes support for fast registrations (IB_WR_REG_MR,
-	 * IB_WR_LOCAL_INV and IB_WR_SEND_WITH_INV verbs).  This flag should
-	 * also be set by any iWarp device which must support FRs to comply
-	 * to the iWarp verbs spec.  iWarp devices also support the
-	 * IB_WR_RDMA_READ_WITH_INV verb for RDMA READs that invalidate the
-	 * stag.
-	 */
-	IB_DEVICE_MEM_MGT_EXTENSIONS		= (1 << 21),
-	IB_DEVICE_BLOCK_MULTICAST_LOOPBACK	= (1 << 22),
-	IB_DEVICE_MEM_WINDOW_TYPE_2A		= (1 << 23),
-	IB_DEVICE_MEM_WINDOW_TYPE_2B		= (1 << 24),
-	IB_DEVICE_RC_IP_CSUM			= (1 << 25),
-	IB_DEVICE_RAW_IP_CSUM			= (1 << 26),
-	/*
-	 * Devices should set IB_DEVICE_CROSS_CHANNEL if they
-	 * support execution of WQEs that involve synchronization
-	 * of I/O operations with single completion queue managed
-	 * by hardware.
-	 */
-	IB_DEVICE_CROSS_CHANNEL		= (1 << 27),
-	IB_DEVICE_MANAGED_FLOW_STEERING		= (1 << 29),
-	IB_DEVICE_SIGNATURE_HANDOVER		= (1 << 30),
-	IB_DEVICE_ON_DEMAND_PAGING		= (1 << 31),
+	IB_DEVICE_RESIZE_MAX_WR		= IB_UVERBS_DEVICE_RESIZE_MAX_WR,
+	IB_DEVICE_BAD_PKEY_CNTR		= IB_UVERBS_DEVICE_BAD_PKEY_CNTR,
+	IB_DEVICE_BAD_QKEY_CNTR		= IB_UVERBS_DEVICE_BAD_QKEY_CNTR,
+	IB_DEVICE_RAW_MULTI		= IB_UVERBS_DEVICE_RAW_MULTI,
+	IB_DEVICE_AUTO_PATH_MIG		= IB_UVERBS_DEVICE_AUTO_PATH_MIG,
+	IB_DEVICE_CHANGE_PHY_PORT	= IB_UVERBS_DEVICE_CHANGE_PHY_PORT,
+	IB_DEVICE_UD_AV_PORT_ENFORCE	= IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE,
+	IB_DEVICE_CURR_QP_STATE_MOD	= IB_UVERBS_DEVICE_UD_AV_PORT_ENFORCE,
+	IB_DEVICE_SHUTDOWN_PORT		= IB_UVERBS_DEVICE_SHUTDOWN_PORT,
+	IB_DEVICE_INIT_TYPE		= IB_UVERBS_DEVICE_INIT_TYPE,
+	IB_DEVICE_PORT_ACTIVE_EVENT	= IB_UVERBS_DEVICE_PORT_ACTIVE_EVENT,
+	IB_DEVICE_SYS_IMAGE_GUID	= IB_UVERBS_DEVICE_SYS_IMAGE_GUID,
+	IB_DEVICE_RC_RNR_NAK_GEN	= IB_UVERBS_DEVICE_RC_RNR_NAK_GEN,
+	IB_DEVICE_SRQ_RESIZE		= IB_UVERBS_DEVICE_SRQ_RESIZE,
+	IB_DEVICE_N_NOTIFY_CQ		= IB_UVERBS_DEVICE_N_NOTIFY_CQ,
+	IB_DEVICE_LOCAL_DMA_LKEY	= IB_UVERBS_DEVICE_LOCAL_DMA_LKEY,
+	IB_DEVICE_MEM_WINDOW		= IB_UVERBS_DEVICE_MEM_WINDOW,
+	IB_DEVICE_UD_IP_CSUM		= IB_UVERBS_DEVICE_UD_IP_CSUM,
+	IB_DEVICE_UD_TSO		= IB_UVERBS_DEVICE_UD_TSO,
+	IB_DEVICE_XRC			= IB_UVERBS_DEVICE_XRC,
+	IB_DEVICE_MEM_MGT_EXTENSIONS	= IB_UVERBS_DEVICE_MEM_MGT_EXTENSIONS,
+	IB_DEVICE_BLOCK_MULTICAST_LOOPBACK =
+			IB_UVERBS_DEVICE_BLOCK_MULTICAST_LOOPBACK,
+	IB_DEVICE_MEM_WINDOW_TYPE_2A	= IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2A,
+	IB_DEVICE_MEM_WINDOW_TYPE_2B	= IB_UVERBS_DEVICE_MEM_WINDOW_TYPE_2B,
+	IB_DEVICE_RC_IP_CSUM		= IB_UVERBS_DEVICE_RC_IP_CSUM,
+	IB_DEVICE_RAW_IP_CSUM		= IB_UVERBS_DEVICE_RAW_IP_CSUM,
+	IB_DEVICE_CROSS_CHANNEL		= IB_UVERBS_DEVICE_CROSS_CHANNEL,
+	IB_DEVICE_MANAGED_FLOW_STEERING	=
+			IB_UVERBS_DEVICE_MANAGED_FLOW_STEERING,
+	IB_DEVICE_SIGNATURE_HANDOVER	= IB_UVERBS_DEVICE_SIGNATURE_HANDOVER,
+	IB_DEVICE_ON_DEMAND_PAGING	= IB_UVERBS_DEVICE_ON_DEMAND_PAGING,
 };
 
 enum ib_signature_prot_cap {
include/uapi/rdma/ib_verbs.h +66 -0

72 lines not on this page · raw message

Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1450967967-12479-7-git-send-email-hch-jcswGhMUV9g@public.gmane.org

#27 lore raw

Re: [PATCH 6/6] IB/uapi: expose device capability flags

Quoted 32 lines · Christoph Hellwig

Expose the device capability flags which can be queried through uverbs in the uapi headers.

---
 include/rdma/ib_verbs.h      | 94 +++++++++++++++-----------------------------
 include/uapi/rdma/ib_verbs.h | 66 +++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 62 deletions(-)
include/rdma/ib_verbs.h +0 -15
index 48bfcf5..b8d4113 100644
@@ -151,68 +151,38 @@ enum rdma_link_layer {
 };
 
 enum ib_device_cap_flags {
-	IB_DEVICE_RESIZE_MAX_WR			= (1 << 0),
-	IB_DEVICE_BAD_PKEY_CNTR			= (1 << 1),
-	IB_DEVICE_BAD_QKEY_CNTR			= (1 << 2),
-	IB_DEVICE_RAW_MULTI			= (1 << 3),
-	IB_DEVICE_AUTO_PATH_MIG			= (1 << 4),
-	IB_DEVICE_CHANGE_PHY_PORT		= (1 << 5),
-	IB_DEVICE_UD_AV_PORT_ENFORCE		= (1 << 6),
-	IB_DEVICE_CURR_QP_STATE_MOD		= (1 << 7),
-	IB_DEVICE_SHUTDOWN_PORT			= (1 << 8),
-	IB_DEVICE_INIT_TYPE			= (1 << 9),
-	IB_DEVICE_PORT_ACTIVE_EVENT		= (1 << 10),
-	IB_DEVICE_SYS_IMAGE_GUID		= (1 << 11),
-	IB_DEVICE_RC_RNR_NAK_GEN		= (1 << 12),
-	IB_DEVICE_SRQ_RESIZE			= (1 << 13),
-	IB_DEVICE_N_NOTIFY_CQ			= (1 << 14),

include/rdma/ib_verbs.h enum rdma_link_layer { · line 178

Quoted 10 lines
include/rdma/ib_verbs.h +0 -10
-
-	/*
-	 * This device supports a per-device lkey or stag that can be
-	 * used without performing a memory registration for the local
-	 * memory.  Note that ULPs should never check this flag, but
-	 * instead of use the local_dma_lkey flag in the ib_pd structure,
-	 * which will always contain a usable lkey.
-	 */
-	IB_DEVICE_LOCAL_DMA_LKEY		= (1 << 15),
-	IB_DEVICE_RESERVED /* old SEND_W_INV */	= (1 << 16),

Was this ever used by user-space? If so, I think there should be a comment saying that bit 16 is reserved, perhaps pointing to commit 0f39cf3d54e6 ("IB/core: Add support for "send with invalidate" work requests").

include/rdma/ib_verbs.h enum rdma_link_layer { · line 161

Quoted 8 lines
include/rdma/ib_verbs.h +8 -0
+	/*
+	 * This device supports a per-device lkey or stag that can be
+	 * used without performing a memory registration for the local
+	 * memory.  Note that ULPs should never check this flag, but
+	 * instead of use the local_dma_lkey flag in the ib_pd structure,
+	 * which will always contain a usable lkey.
+	 */
+	IB_UVERBS_DEVICE_LOCAL_DMA_LKEY		= (1 << 15),

I don't think user-space should be able to use local_dma_lkey.

Regards,
Haggai
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#28 lore raw
In reply to a message not in the archive
Quoted 7 lines · Christoph Hellwig

Currently very little of the uverbs user interface is actually exposed in uapi headers, and it's a constant struggle to figure out what's kernel internal and what is actually exposed in public. This series starts sorting this out by creating the infrastructure for a uapi header shared between uverbs and the core IB stack, and starts moving all WR and WC constants as well as the device capabilitity flags there.

Quoted 7 lines

A lot more work will have to follow, and I hope others will help out as well.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Series looks ok to me.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html