From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5oTl-00061O-NO for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:55:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5oTd-00051i-Ez for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:55:33 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:34878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5oTd-00051d-8M for qemu-devel@nongnu.org; Sat, 03 Aug 2013 22:55:25 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 3 Aug 2013 20:55:24 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 722113E40030 for ; Sat, 3 Aug 2013 20:54:47 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r742tAXF181922 for ; Sat, 3 Aug 2013 20:55:10 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r742t95S020316 for ; Sat, 3 Aug 2013 20:55:09 -0600 From: mrhines@linux.vnet.ibm.com Date: Sat, 3 Aug 2013 22:54:52 -0400 Message-Id: <1375584894-9917-6-git-send-email-mrhines@linux.vnet.ibm.com> In-Reply-To: <1375584894-9917-1-git-send-email-mrhines@linux.vnet.ibm.com> References: <1375584894-9917-1-git-send-email-mrhines@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v3 For-1.6 5/7] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: yamahata@private.email.ne.jp, aliguori@us.ibm.com, quintela@redhat.com, owasserm@redhat.com, mrhines@us.ibm.com, pbonzini@redhat.com From: Isaku Yamahata RDMA_WRID_CONTROL should be used. And remove related work around. Reviewed-by: Michael R. Hines Signed-off-by: Isaku Yamahata Signed-off-by: Michael R. Hines --- migration-rdma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/migration-rdma.c b/migration-rdma.c index 7266803..ea16f0e 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 @@ -1399,7 +1399,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), @@ -2054,7 +2054,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); @@ -2136,7 +2136,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!", @@ -2248,7 +2248,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) struct addrinfo *res; char port_str[16]; - 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; } @@ -2705,7 +2705,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