RDMA_WRID_CONTROL should be used. And remove related work around. Cc: Michael R. Hines <mrhi...@us.ibm.com> Signed-off-by: Isaku Yamahata <yamah...@private.email.ne.jp> --- migration-rdma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/migration-rdma.c b/migration-rdma.c index edbae9f..67069d2 100644 --- a/migration-rdma.c +++ b/migration-rdma.c @@ -322,7 +322,7 @@ typedef struct RDMAContext { char *host; int port; - RDMAWorkRequestData wr_data[RDMA_WRID_MAX + 1]; + RDMAWorkRequestData wr_data[RDMA_WRID_MAX]; /* * This is used by *_exchange_send() to figure out whether or not @@ -1397,7 +1397,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf, RDMAControlHeader *head) { int ret = 0; - RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_MAX]; + RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_CONTROL]; struct ibv_send_wr *bad_wr; struct ibv_sge sge = { .addr = (uint64_t)(wr->control), @@ -2052,7 +2052,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma) g_free(rdma->block); rdma->block = NULL; - for (idx = 0; idx <= RDMA_WRID_MAX; idx++) { + for (idx = 0; idx < RDMA_WRID_MAX; idx++) { if (rdma->wr_data[idx].control_mr) { rdma->total_registrations--; ibv_dereg_mr(rdma->wr_data[idx].control_mr); @@ -2134,7 +2134,7 @@ static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all) goto err_rdma_source_init; } - for (idx = 0; idx <= RDMA_WRID_MAX; idx++) { + for (idx = 0; idx < RDMA_WRID_MAX; idx++) { ret = qemu_rdma_reg_control(rdma, idx); if (ret) { ERROR(temp, "rdma migration: error registering %d control!\n", @@ -2243,7 +2243,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) struct rdma_cm_id *listen_id; char ip[40] = "unknown"; - for (idx = 0; idx <= RDMA_WRID_MAX; idx++) { + for (idx = 0; idx < RDMA_WRID_MAX; idx++) { rdma->wr_data[idx].control_len = 0; rdma->wr_data[idx].control_curr = NULL; } @@ -2696,7 +2696,7 @@ static int qemu_rdma_accept(RDMAContext *rdma) goto err_rdma_dest_wait; } - for (idx = 0; idx <= RDMA_WRID_MAX; idx++) { + for (idx = 0; idx < RDMA_WRID_MAX; idx++) { ret = qemu_rdma_reg_control(rdma, idx); if (ret) { fprintf(stderr, "rdma: error registering %d control!\n", idx); -- 1.7.10.4