All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jack Wang <jinpu.wang@ionos.com>
To: quintela@redhat.com, dgilbert@redhat.com
Cc: qemu-devel@nongnu.org, pankaj.gupta@ionos.com
Subject: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination
Date: Tue,  1 Feb 2022 16:11:36 +0100	[thread overview]
Message-ID: <20220201151136.52157-2-jinpu.wang@ionos.com> (raw)
In-Reply-To: <20220201151136.52157-1-jinpu.wang@ionos.com>

This allow address could be reused to avoid rdma_bind_addr error
out.

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/migration/rdma.c b/migration/rdma.c
index 2e223170d06d..b498ef013c77 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2705,6 +2705,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
     char ip[40] = "unknown";
     struct rdma_addrinfo *res, *e;
     char port_str[16];
+    int reuse = 1;
 
     for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
         rdma->wr_data[idx].control_len = 0;
@@ -2740,6 +2741,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         goto err_dest_init_bind_addr;
     }
 
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+			  &reuse, sizeof reuse);
+    if (ret) {
+        ERROR(errp, "Error: could not set REUSEADDR option");
+        goto err_dest_init_bind_addr;
+    }
     for (e = res; e != NULL; e = e->ai_next) {
         inet_ntop(e->ai_family,
             &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof ip);
-- 
2.25.1



  reply	other threads:[~2022-02-01 21:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 15:11 [PATCH 1/2] migration/rdma: Increase the backlog from 5 to 128 Jack Wang
2022-02-01 15:11 ` Jack Wang [this message]
2022-02-01 18:39   ` [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination Pankaj Gupta
2022-02-01 20:43     ` Jinpu Wang
2022-02-02  4:57       ` Pankaj Gupta
2022-02-02 10:15   ` Dr. David Alan Gilbert
2022-02-02 10:51     ` Jinpu Wang
2022-02-01 18:19 ` [PATCH 1/2] migration/rdma: Increase the backlog from 5 to 128 Pankaj Gupta
2022-02-01 20:32   ` Jinpu Wang
2022-02-02  6:27     ` Pankaj Gupta
2022-02-02  6:37       ` Pankaj Gupta
2022-02-02  9:20         ` Dr. David Alan Gilbert
2022-02-02  9:55           ` Jinpu Wang

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=20220201151136.52157-2-jinpu.wang@ionos.com \
    --to=jinpu.wang@ionos.com \
    --cc=dgilbert@redhat.com \
    --cc=pankaj.gupta@ionos.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.