Bottom: cfb4e06d73107deeb818771d285c201b7e0eb692
-Top: 7f75ab2faf5a23755d593d5c77a94121b8c88a7c
+Top: 9e9be02403dd00064b5f95e25a4b658e94df193f
Author: Sean Hefty <sean.hefty@intel.com>
Date: 2014-04-16 22:01:51 -0700
---
diff --git a/src/rsocket.c b/src/rsocket.c
-index 77b3979..07cd8d3 100644
+index 77b3979..86eedd2 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -61,7 +61,7 @@
ret = ds_add_qp_dest(qp, src_addr, addrlen);
if (ret)
goto err;
-@@ -1613,28 +1608,55 @@ int rconnect(int socket, const struct sockaddr *addr, socklen_t addrlen)
+@@ -1613,6 +1608,59 @@ int rconnect(int socket, const struct sockaddr *addr, socklen_t addrlen)
return ret;
}
--static int rs_post_msg(struct rsocket *rs, uint32_t msg)
+static void *rs_get_ctrl_buf(struct rsocket *rs)
+{
+ return rs->sbuf + rs->sbuf_size +
+ RS_MAX_CTRL_MSG * (rs->ctrl_seqno & (RS_QP_CTRL_SIZE - 1));
+}
+
-+static int rs_post_send_msg(struct rsocket *rs, uint64_t wr_id, uint32_t msg)
- {
- struct ibv_send_wr wr, *bad;
- struct ibv_sge sge;
-+ void *ctrl_buf;
-
-- wr.wr_id = rs_send_wr_id(msg);
-+ wr.wr_id = wr_id;
- wr.next = NULL;
-- if (!(rs->opts & RS_OPT_MSG_SEND)) {
-- wr.sg_list = NULL;
-- wr.num_sge = 0;
-- wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
-+ if (rs->sq_inline < sizeof msg) {
-+ ctrl_buf = rs_get_ctrl_buf(rs);
-+ memcpy(ctrl_buf, &msg, sizeof msg);
-+ sge.addr = (uintptr_t) ctrl_buf;
-+ sge.lkey = rs->smr->lkey;
-+ sge.length = sizeof msg;
- wr.send_flags = 0;
-- wr.imm_data = htonl(msg);
- } else {
- sge.addr = (uintptr_t) &msg;
- sge.lkey = 0;
- sge.length = sizeof msg;
-- wr.sg_list = &sge;
-- wr.num_sge = 1;
-- wr.opcode = IBV_WR_SEND;
- wr.send_flags = IBV_SEND_INLINE;
- }
-+ wr.sg_list = &sge;
-+ wr.num_sge = 1;
-+ wr.opcode = IBV_WR_SEND;
-+
-+ return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
-+}
-+
-+static int rs_post_msg(struct rsocket *rs, uint32_t msg)
-+{
-+ struct ibv_send_wr wr, *bad;
-+ struct ibv_sge sge;
++//static int rs_post_send_msg(struct rsocket *rs, uint64_t wr_id, uint32_t msg)
++//{
++// struct ibv_send_wr wr, *bad;
++// struct ibv_sge sge;
++// void *ctrl_buf;
++//
++// wr.wr_id = wr_id;
++// wr.next = NULL;
++// if (rs->sq_inline < sizeof msg) {
++// ctrl_buf = rs_get_ctrl_buf(rs);
++// memcpy(ctrl_buf, &msg, sizeof msg);
++// sge.addr = (uintptr_t) ctrl_buf;
++// sge.lkey = rs->smr->lkey;
++// sge.length = sizeof msg;
++// wr.send_flags = 0;
++// } else {
++// sge.addr = (uintptr_t) &msg;
++// sge.lkey = 0;
++// sge.length = sizeof msg;
++// wr.send_flags = IBV_SEND_INLINE;
++// }
++// wr.sg_list = &sge;
++// wr.num_sge = 1;
++// wr.opcode = IBV_WR_SEND;
++//
++// return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
++//}
++//
++//static int rs_post_msg(struct rsocket *rs, uint32_t msg)
++//{
++// struct ibv_send_wr wr, *bad;
++// struct ibv_sge sge;
++//
++// if (rs->opts & RS_OPT_MSG_SEND)
++// return rs_post_send_msg(rs, rs_send_wr_id(msg), msg);
++//
++// wr.wr_id = rs_send_wr_id(msg);
++// wr.next = NULL;
++// wr.sg_list = NULL;
++// wr.num_sge = 0;
++// wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
++// wr.send_flags = 0;
++// wr.imm_data = htonl(msg);
++//
++// return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
++//}
+
-+ if (rs->opts & RS_OPT_MSG_SEND)
-+ return rs_post_send_msg(rs, rs_send_wr_id(msg), msg);
-+
-+ wr.wr_id = rs_send_wr_id(msg);
-+ wr.next = NULL;
-+ wr.sg_list = NULL;
-+ wr.num_sge = 0;
-+ wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
-+ wr.send_flags = 0;
-+ wr.imm_data = htonl(msg);
-
- return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
- }
-@@ -1658,10 +1680,9 @@ static int rs_post_write(struct rsocket *rs,
- return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
- }
-
--static int rs_post_write_msg(struct rsocket *rs,
-- struct ibv_sge *sgl, int nsge,
-- uint32_t msg, int flags,
-- uint64_t addr, uint32_t rkey)
-+static int
-+rs_post_write_with_msg(struct rsocket *rs, struct ibv_sge *sgl, int nsge,
-+ uint32_t msg, int flags, uint64_t addr, uint32_t rkey)
+ static int rs_post_msg(struct rsocket *rs, uint32_t msg)
{
struct ibv_send_wr wr, *bad;
- struct ibv_sge sge;
-@@ -1682,17 +1703,9 @@ static int rs_post_write_msg(struct rsocket *rs,
- } else {
- ret = rs_post_write(rs, sgl, nsge, msg, flags, addr, rkey);
- if (!ret) {
-- wr.wr_id = rs_send_wr_id(rs_msg_set(rs_msg_op(msg), 0)) |
-- RS_WR_ID_FLAG_MSG_SEND;
-- sge.addr = (uintptr_t) &msg;
-- sge.lkey = 0;
-- sge.length = sizeof msg;
-- wr.sg_list = &sge;
-- wr.num_sge = 1;
-- wr.opcode = IBV_WR_SEND;
-- wr.send_flags = IBV_SEND_INLINE;
--
-- ret = rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
-+ ret = rs_post_send_msg(rs,
-+ rs_send_wr_id(rs_msg_set(rs_msg_op(msg), 0)) |
-+ RS_WR_ID_FLAG_MSG_SEND, msg);
- }
- return ret;
- }
-@@ -1744,8 +1757,8 @@ static int rs_write_data(struct rsocket *rs,
- rs->target_sge = 0;
- }
-
-- return rs_post_write_msg(rs, sgl, nsge, rs_msg_set(RS_OP_DATA, length),
-- flags, addr, rkey);
-+ return rs_post_write_with_msg(rs, sgl, nsge, rs_msg_set(RS_OP_DATA, length),
-+ flags, addr, rkey);
- }
-
- static int rs_write_direct(struct rsocket *rs, struct rs_iomap *iom, uint64_t offset,
-@@ -1773,8 +1786,9 @@ static int rs_write_iomap(struct rsocket *rs, struct rs_iomap_mr *iomr,
+@@ -1773,8 +1821,9 @@ static int rs_write_iomap(struct rsocket *rs, struct rs_iomap_mr *iomr,
rs->sbuf_bytes_avail -= sizeof(struct rs_iomap);
addr = rs->remote_iomap.addr + iomr->index * sizeof(struct rs_iomap);
- return rs_post_write_msg(rs, sgl, nsge, rs_msg_set(RS_OP_IOMAP_SGL, iomr->index),
- flags, addr, rs->remote_iomap.key);
-+ return rs_post_write_with_msg(rs, sgl, nsge,
++ return rs_post_write_msg(rs, sgl, nsge,
+ rs_msg_set(RS_OP_IOMAP_SGL, iomr->index), flags, addr,
+ rs->remote_iomap.key);
}
static uint32_t rs_sbuf_left(struct rsocket *rs)
-@@ -1808,12 +1822,11 @@ static void rs_send_credits(struct rsocket *rs)
- ibsge.lkey = 0;
+@@ -1809,11 +1858,10 @@ static void rs_send_credits(struct rsocket *rs)
ibsge.length = sizeof(sge);
-- rs_post_write_msg(rs, &ibsge, 1,
+ rs_post_write_msg(rs, &ibsge, 1,
- rs_msg_set(RS_OP_SGL, rs->rseq_no + rs->rq_size),
- IBV_SEND_INLINE,
- rs->remote_sgl.addr +
- rs->remote_sge * sizeof(struct rs_sge),
- rs->remote_sgl.key);
-+ rs_post_write_with_msg(rs, &ibsge, 1,
+ rs_msg_set(RS_OP_SGL, rs->rseq_no + rs->rq_size),
+ IBV_SEND_INLINE,
+ rs->remote_sgl.addr + rs->remote_sge * sizeof(struct rs_sge),
rs->rbuf_bytes_avail -= rs->rbuf_size >> 1;
rs->rbuf_free_offset += rs->rbuf_size >> 1;
-@@ -3456,8 +3469,6 @@ int rsetsockopt(int socket, int level, int optname,
+@@ -3456,8 +3504,6 @@ int rsetsockopt(int socket, int level, int optname,
break;
case RDMA_INLINE:
rs->sq_inline = min(*(uint32_t *) optval, RS_QP_MAX_SIZE);
+++ /dev/null
-Bottom: 7f75ab2faf5a23755d593d5c77a94121b8c88a7c
-Top: 9e9be02403dd00064b5f95e25a4b658e94df193f
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2014-04-17 18:15:38 -0700
-
-Refresh of inline0
-
----
-
-diff --git a/src/rsocket.c b/src/rsocket.c
-index 07cd8d3..86eedd2 100644
---- a/src/rsocket.c
-+++ b/src/rsocket.c
-@@ -1614,49 +1614,75 @@ static void *rs_get_ctrl_buf(struct rsocket *rs)
- RS_MAX_CTRL_MSG * (rs->ctrl_seqno & (RS_QP_CTRL_SIZE - 1));
- }
-
--static int rs_post_send_msg(struct rsocket *rs, uint64_t wr_id, uint32_t msg)
-+//static int rs_post_send_msg(struct rsocket *rs, uint64_t wr_id, uint32_t msg)
-+//{
-+// struct ibv_send_wr wr, *bad;
-+// struct ibv_sge sge;
-+// void *ctrl_buf;
-+//
-+// wr.wr_id = wr_id;
-+// wr.next = NULL;
-+// if (rs->sq_inline < sizeof msg) {
-+// ctrl_buf = rs_get_ctrl_buf(rs);
-+// memcpy(ctrl_buf, &msg, sizeof msg);
-+// sge.addr = (uintptr_t) ctrl_buf;
-+// sge.lkey = rs->smr->lkey;
-+// sge.length = sizeof msg;
-+// wr.send_flags = 0;
-+// } else {
-+// sge.addr = (uintptr_t) &msg;
-+// sge.lkey = 0;
-+// sge.length = sizeof msg;
-+// wr.send_flags = IBV_SEND_INLINE;
-+// }
-+// wr.sg_list = &sge;
-+// wr.num_sge = 1;
-+// wr.opcode = IBV_WR_SEND;
-+//
-+// return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
-+//}
-+//
-+//static int rs_post_msg(struct rsocket *rs, uint32_t msg)
-+//{
-+// struct ibv_send_wr wr, *bad;
-+// struct ibv_sge sge;
-+//
-+// if (rs->opts & RS_OPT_MSG_SEND)
-+// return rs_post_send_msg(rs, rs_send_wr_id(msg), msg);
-+//
-+// wr.wr_id = rs_send_wr_id(msg);
-+// wr.next = NULL;
-+// wr.sg_list = NULL;
-+// wr.num_sge = 0;
-+// wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
-+// wr.send_flags = 0;
-+// wr.imm_data = htonl(msg);
-+//
-+// return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
-+//}
-+
-+static int rs_post_msg(struct rsocket *rs, uint32_t msg)
- {
- struct ibv_send_wr wr, *bad;
- struct ibv_sge sge;
-- void *ctrl_buf;
-
-- wr.wr_id = wr_id;
-+ wr.wr_id = rs_send_wr_id(msg);
- wr.next = NULL;
-- if (rs->sq_inline < sizeof msg) {
-- ctrl_buf = rs_get_ctrl_buf(rs);
-- memcpy(ctrl_buf, &msg, sizeof msg);
-- sge.addr = (uintptr_t) ctrl_buf;
-- sge.lkey = rs->smr->lkey;
-- sge.length = sizeof msg;
-+ if (!(rs->opts & RS_OPT_MSG_SEND)) {
-+ wr.sg_list = NULL;
-+ wr.num_sge = 0;
-+ wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
- wr.send_flags = 0;
-+ wr.imm_data = htonl(msg);
- } else {
- sge.addr = (uintptr_t) &msg;
- sge.lkey = 0;
- sge.length = sizeof msg;
-+ wr.sg_list = &sge;
-+ wr.num_sge = 1;
-+ wr.opcode = IBV_WR_SEND;
- wr.send_flags = IBV_SEND_INLINE;
- }
-- wr.sg_list = &sge;
-- wr.num_sge = 1;
-- wr.opcode = IBV_WR_SEND;
--
-- return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
--}
--
--static int rs_post_msg(struct rsocket *rs, uint32_t msg)
--{
-- struct ibv_send_wr wr, *bad;
-- struct ibv_sge sge;
--
-- if (rs->opts & RS_OPT_MSG_SEND)
-- return rs_post_send_msg(rs, rs_send_wr_id(msg), msg);
--
-- wr.wr_id = rs_send_wr_id(msg);
-- wr.next = NULL;
-- wr.sg_list = NULL;
-- wr.num_sge = 0;
-- wr.opcode = IBV_WR_RDMA_WRITE_WITH_IMM;
-- wr.send_flags = 0;
-- wr.imm_data = htonl(msg);
-
- return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
- }
-@@ -1680,9 +1706,10 @@ static int rs_post_write(struct rsocket *rs,
- return rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
- }
-
--static int
--rs_post_write_with_msg(struct rsocket *rs, struct ibv_sge *sgl, int nsge,
-- uint32_t msg, int flags, uint64_t addr, uint32_t rkey)
-+static int rs_post_write_msg(struct rsocket *rs,
-+ struct ibv_sge *sgl, int nsge,
-+ uint32_t msg, int flags,
-+ uint64_t addr, uint32_t rkey)
- {
- struct ibv_send_wr wr, *bad;
- struct ibv_sge sge;
-@@ -1703,9 +1730,17 @@ rs_post_write_with_msg(struct rsocket *rs, struct ibv_sge *sgl, int nsge,
- } else {
- ret = rs_post_write(rs, sgl, nsge, msg, flags, addr, rkey);
- if (!ret) {
-- ret = rs_post_send_msg(rs,
-- rs_send_wr_id(rs_msg_set(rs_msg_op(msg), 0)) |
-- RS_WR_ID_FLAG_MSG_SEND, msg);
-+ wr.wr_id = rs_send_wr_id(rs_msg_set(rs_msg_op(msg), 0)) |
-+ RS_WR_ID_FLAG_MSG_SEND;
-+ sge.addr = (uintptr_t) &msg;
-+ sge.lkey = 0;
-+ sge.length = sizeof msg;
-+ wr.sg_list = &sge;
-+ wr.num_sge = 1;
-+ wr.opcode = IBV_WR_SEND;
-+ wr.send_flags = IBV_SEND_INLINE;
-+
-+ ret = rdma_seterrno(ibv_post_send(rs->cm_id->qp, &wr, &bad));
- }
- return ret;
- }
-@@ -1757,8 +1792,8 @@ static int rs_write_data(struct rsocket *rs,
- rs->target_sge = 0;
- }
-
-- return rs_post_write_with_msg(rs, sgl, nsge, rs_msg_set(RS_OP_DATA, length),
-- flags, addr, rkey);
-+ return rs_post_write_msg(rs, sgl, nsge, rs_msg_set(RS_OP_DATA, length),
-+ flags, addr, rkey);
- }
-
- static int rs_write_direct(struct rsocket *rs, struct rs_iomap *iom, uint64_t offset,
-@@ -1786,7 +1821,7 @@ static int rs_write_iomap(struct rsocket *rs, struct rs_iomap_mr *iomr,
- rs->sbuf_bytes_avail -= sizeof(struct rs_iomap);
-
- addr = rs->remote_iomap.addr + iomr->index * sizeof(struct rs_iomap);
-- return rs_post_write_with_msg(rs, sgl, nsge,
-+ return rs_post_write_msg(rs, sgl, nsge,
- rs_msg_set(RS_OP_IOMAP_SGL, iomr->index), flags, addr,
- rs->remote_iomap.key);
- }
-@@ -1822,7 +1857,7 @@ static void rs_send_credits(struct rsocket *rs)
- ibsge.lkey = 0;
- ibsge.length = sizeof(sge);
-
-- rs_post_write_with_msg(rs, &ibsge, 1,
-+ rs_post_write_msg(rs, &ibsge, 1,
- rs_msg_set(RS_OP_SGL, rs->rseq_no + rs->rq_size),
- IBV_SEND_INLINE,
- rs->remote_sgl.addr + rs->remote_sge * sizeof(struct rs_sge),