From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Far-0002yw-TV for qemu-devel@nongnu.org; Fri, 02 Aug 2013 09:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5Faj-0001af-Kj for qemu-devel@nongnu.org; Fri, 02 Aug 2013 09:40:33 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:40089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Faj-0001aa-Cd for qemu-devel@nongnu.org; Fri, 02 Aug 2013 09:40:25 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Aug 2013 07:40:24 -0600 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 0AC84C90045 for ; Fri, 2 Aug 2013 09:40:19 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r72DeKeg120930 for ; Fri, 2 Aug 2013 09:40:20 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r72DeKPY027655 for ; Fri, 2 Aug 2013 09:40:20 -0400 Message-ID: <51FBB6C4.3070905@linux.vnet.ibm.com> Date: Fri, 02 Aug 2013 09:40:20 -0400 From: "Michael R. Hines" MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] rdma: qemu_rdma_post_send_control uses wrongly RDMA_WRID_MAX List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: owasserm@redhat.com, quintela@redhat.com, mrhines@us.ibm.com, qemu-devel@nongnu.org, pbonzini@redhat.com On 08/01/2013 11:56 PM, Isaku Yamahata wrote: > RDMA_WRID_CONTROL should be used. And remove related work around. > > Cc: Michael R. Hines > Signed-off-by: Isaku Yamahata > --- > 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); Good eyes ...... I totally missed that =) Reviewed-by: Michael R. Hines