qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: mrhines@linux.vnet.ibm.com
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
Subject: [Qemu-devel] [PATCH v3 For-1.6 5/7] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX
Date: Sat,  3 Aug 2013 22:54:52 -0400	[thread overview]
Message-ID: <1375584894-9917-6-git-send-email-mrhines@linux.vnet.ibm.com> (raw)
In-Reply-To: <1375584894-9917-1-git-send-email-mrhines@linux.vnet.ibm.com>

From: Isaku Yamahata <yamahata@private.email.ne.jp>

RDMA_WRID_CONTROL should be used. And remove related work around.

Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Isaku Yamahata <yamahata@private.email.ne.jp>
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
---
 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

  parent reply	other threads:[~2013-08-04  2:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-04  2:54 [Qemu-devel] [PATCH v3 For-1.6 0/7] rdma: bugfixes, cleanups, IPv6 support mrhines
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 1/7] rdma: bugfix: make IPv6 support work mrhines
2013-08-07  8:39   ` Orit Wasserman
2013-08-07 14:53     ` Michael R. Hines
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 2/7] rdma: forgot to turn off the debugging flag mrhines
2013-08-07  8:39   ` Orit Wasserman
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 3/7] rdma: correct newlines in error statements mrhines
2013-08-07  8:45   ` Orit Wasserman
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 4/7] rdma: don't use negative index to array mrhines
2013-08-04  2:54 ` mrhines [this message]
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 6/7] rdma: use RDMA_WRID_READY mrhines
2013-08-04  2:54 ` [Qemu-devel] [PATCH v3 For-1.6 7/7] rdma: memory leak RDMAContext::host mrhines
2013-08-14 16:27 ` [Qemu-devel] [PATCH v3 For-1.6 0/7] rdma: bugfixes, cleanups, IPv6 support Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375584894-9917-6-git-send-email-mrhines@linux.vnet.ibm.com \
    --to=mrhines@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=mrhines@us.ibm.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=yamahata@private.email.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).