0a122b
From 4d2bc4b2e4d04efa0fd2f3cd10f6bc22b9c0af9f Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <4d2bc4b2e4d04efa0fd2f3cd10f6bc22b9c0af9f.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:53:00 +0100
0a122b
Subject: [PATCH 24/46] rdma: qemu_rdma_post_send_control uses wrongly
0a122b
 RDMA_WRID_MAX
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-25-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55708
0a122b
O-Subject: [RHEL7.0 PATCH 24/42] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit 1f22364bb5a756dfcbd15c2ae2bac18bbcef6190
0a122b
Author: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
Date:   Sat Aug 3 22:54:52 2013 -0400
0a122b
0a122b
    rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
0a122b
0a122b
    RDMA_WRID_CONTROL should be used. And remove related work around.
0a122b
0a122b
    Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
0a122b
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Message-id: 1375584894-9917-6-git-send-email-mrhines@linux.vnet.ibm.com
0a122b
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
---
0a122b
 migration-rdma.c |   12 ++++++------
0a122b
 1 files changed, 6 insertions(+), 6 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 migration-rdma.c | 12 ++++++------
0a122b
 1 file changed, 6 insertions(+), 6 deletions(-)
0a122b
0a122b
diff --git a/migration-rdma.c b/migration-rdma.c
0a122b
index 7266803..ea16f0e 100644
0a122b
--- a/migration-rdma.c
0a122b
+++ b/migration-rdma.c
0a122b
@@ -322,7 +322,7 @@ typedef struct RDMAContext {
0a122b
     char *host;
0a122b
     int port;
0a122b
 
0a122b
-    RDMAWorkRequestData wr_data[RDMA_WRID_MAX + 1];
0a122b
+    RDMAWorkRequestData wr_data[RDMA_WRID_MAX];
0a122b
 
0a122b
     /*
0a122b
      * This is used by *_exchange_send() to figure out whether or not
0a122b
@@ -1399,7 +1399,7 @@ static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
0a122b
                                        RDMAControlHeader *head)
0a122b
 {
0a122b
     int ret = 0;
0a122b
-    RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_MAX];
0a122b
+    RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_CONTROL];
0a122b
     struct ibv_send_wr *bad_wr;
0a122b
     struct ibv_sge sge = {
0a122b
                            .addr = (uint64_t)(wr->control),
0a122b
@@ -2054,7 +2054,7 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
0a122b
     g_free(rdma->block);
0a122b
     rdma->block = NULL;
0a122b
 
0a122b
-    for (idx = 0; idx <= RDMA_WRID_MAX; idx++) {
0a122b
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
0a122b
         if (rdma->wr_data[idx].control_mr) {
0a122b
             rdma->total_registrations--;
0a122b
             ibv_dereg_mr(rdma->wr_data[idx].control_mr);
0a122b
@@ -2136,7 +2136,7 @@ static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all)
0a122b
         goto err_rdma_source_init;
0a122b
     }
0a122b
 
0a122b
-    for (idx = 0; idx <= RDMA_WRID_MAX; idx++) {
0a122b
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
0a122b
         ret = qemu_rdma_reg_control(rdma, idx);
0a122b
         if (ret) {
0a122b
             ERROR(temp, "rdma migration: error registering %d control!",
0a122b
@@ -2248,7 +2248,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
     struct addrinfo *res;
0a122b
     char port_str[16];
0a122b
 
0a122b
-    for (idx = 0; idx <= RDMA_WRID_MAX; idx++) {
0a122b
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
0a122b
         rdma->wr_data[idx].control_len = 0;
0a122b
         rdma->wr_data[idx].control_curr = NULL;
0a122b
     }
0a122b
@@ -2705,7 +2705,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
0a122b
         goto err_rdma_dest_wait;
0a122b
     }
0a122b
 
0a122b
-    for (idx = 0; idx <= RDMA_WRID_MAX; idx++) {
0a122b
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
0a122b
         ret = qemu_rdma_reg_control(rdma, idx);
0a122b
         if (ret) {
0a122b
             fprintf(stderr, "rdma: error registering %d control!\n", idx);
0a122b
-- 
0a122b
1.7.11.7
0a122b