[PATCH 2/2] rxe: Translate wr opcodes between kernel and user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The kernel rxe driver and the userspace library have different enums for
specifying wr opcodes. SInce these enums don't always correspond, it is
necessary to translate between them when placing wrs on the shared
queue.

Signed-off-by: Seth Howell <seth.howell@xxxxxxxxx>
---
 providers/rxe/rxe.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index b9b6c6f9..8ccfd9f1 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -56,6 +56,28 @@
 #include "rxe-abi.h"
 #include "rxe.h"
 
+/*
+ * The userspace ibv_wr_opcode enum does not have a 1:1 correspondence with the kernel's
+ * ib_wr_opcode enum. This translation is used to mitigate that difference.
+ * Notes:
+ * IBV_WR_BIND_MR does not have a corresponding value in the kernel enum. Keeping the value the same
+ * will ensure old behavior is preserved. Binding is done locally and will not affect the kernel qp.
+ * TCP Segmentation Offload (TSO) and Large Send Offload (LSO) are two names for the same operation.
+ */
+static const uint32_t rxe_ib_opcode[] = {
+	[IBV_WR_SEND] = IB_WR_SEND,
+	[IBV_WR_SEND_WITH_INV] = IB_WR_SEND_WITH_INV,
+	[IBV_WR_SEND_WITH_IMM] = IB_WR_SEND_WITH_IMM,
+	[IBV_WR_RDMA_WRITE] = IB_WR_RDMA_WRITE,
+	[IBV_WR_RDMA_WRITE_WITH_IMM] = IB_WR_RDMA_WRITE_WITH_IMM,
+	[IBV_WR_RDMA_READ] = IB_WR_RDMA_READ,
+	[IBV_WR_ATOMIC_CMP_AND_SWP] = IB_WR_ATOMIC_CMP_AND_SWP,
+	[IBV_WR_ATOMIC_FETCH_AND_ADD] = IB_WR_ATOMIC_FETCH_AND_ADD,
+	[IBV_WR_BIND_MW] = IBV_WR_BIND_MW,
+	[IBV_WR_LOCAL_INV] = IB_WR_LOCAL_INV,
+	[IBV_WR_TSO] = IB_WR_LSO,
+};
+
 static const struct verbs_match_ent hca_table[] = {
 	/* FIXME: rxe needs a more reliable way to detect the rxe device */
 	VERBS_NAME_MATCH("rxe", NULL),
@@ -555,7 +577,7 @@ static void convert_send_wr(struct rxe_send_wr *kwr, struct ibv_send_wr *uwr)
 
 	kwr->wr_id		= uwr->wr_id;
 	kwr->num_sge		= uwr->num_sge;
-	kwr->opcode		= uwr->opcode;
+	kwr->opcode		= rxe_ib_opcode[uwr->opcode];
 	kwr->send_flags		= uwr->send_flags;
 	kwr->ex.imm_data	= uwr->imm_data;
 
-- 
2.14.4




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux