From patchwork Mon Oct 12 13:18:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832627 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D3F9109B for ; Mon, 12 Oct 2020 13:18:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F60420878 for ; Mon, 12 Oct 2020 13:18:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="VSWgMdZj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388126AbgJLNSU (ORCPT ); Mon, 12 Oct 2020 09:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387743AbgJLNSU (ORCPT ); Mon, 12 Oct 2020 09:18:20 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D10C0613D0 for ; Mon, 12 Oct 2020 06:18:18 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id dt13so23121859ejb.12 for ; Mon, 12 Oct 2020 06:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qz5o+0xhtEcQDYPVbsuO2F8boamxheOIyacunDrflCY=; b=VSWgMdZjfXySCSe1XC4Efo6Q8ZR1p9u8B9JAPuJOJTv6GFCLzyhleqq+37YR5kspaT aHQI0CO+WUZvzpqp/INB5G68UiVLuvomTnEu3AEZfcmL7THXkjc2hwobPSZPmiSEyFz1 jOdcWCEXw7tlLVB5lkq/6FyjVfswLShR5kIk5cUaKjXwEGax+ob3qqw8DyXQzZB+6OD5 w1IQiUXI9OnvXft5Dp/zN5Xy3U6h7AJabYkGpjR5ktoKsRE/9IBaqi7/Y08koYENyuwT 6KPBGH45eSNCtjBQCEi7NfKyFEMORJ6/MvP6oVA9Fxvj5YixKmntvYlwJgelZbnJsUtM amdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qz5o+0xhtEcQDYPVbsuO2F8boamxheOIyacunDrflCY=; b=Z4q6GbNkStBv9uBulVqWqFkFmdM+Vknsz9K6xRfh7rh65GxdoBZ3Njibq3QlO0ZUt2 TgmkmP/DatE+enY8T73VDhdrUy2zcGynxskE/gOXqbjjZVAEgmLrVCdoI+df4M7kuvJV W/LQV0oZXerBYXAXWGWFA024JrXkUitC4cwKhlvOp7ZzVAo0nAOTMecO9TqmQlPLsQcd zg4fstukRKmFk2uu54THWquO6meU58bG/+PKwi+auWXxMwSfmlz+vFQFBWjdNjLA+srV MtOGUCUzJExBTh/Svv9+mBQcxa/WDNdu6V4uYvCl3DMM4cdeko1Dwf8mit0kx+rEIPcG gKmw== X-Gm-Message-State: AOAM532KjT5UAa7dzMySb0F9tEQA6H0pjuMLfbl+/FDOpxwzo66wjxI5 Z29a1qXlv0Smxj/F6PJeq3K0VE+oGlBOlw== X-Google-Smtp-Source: ABdhPJzZhoC6CMV6Te0mbthcBqFzlqZcdLQxMDeIBvsL50zhSznglnw3BVMtI+s9PdsxR1GrK80zdA== X-Received: by 2002:a17:906:bfe2:: with SMTP id vr2mr26066682ejb.248.1602508696669; Mon, 12 Oct 2020 06:18:16 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:16 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com Subject: [PATCH for-next 01/13] RDMA/rtrs-clt: remove destroy_con_cq_qo in case route resolving failed Date: Mon, 12 Oct 2020 15:18:02 +0200 Message-Id: <20201012131814.121096-2-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Danil Kipnis We call destroy_con_cq_qp(con) in rtrs_rdma_addr_resolved() in case route couldn't be resolved and then again in create_cm() because nothing happens. Don't call destroy_con_cq_qp from rtrs_rdma_addr_resolved, create_cm() does the clean up already. Signed-off-by: Danil Kipnis Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 776e89231c52..9980bb4a6f78 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1640,10 +1640,8 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con) return err; } err = rdma_resolve_route(con->c.cm_id, RTRS_CONNECT_TIMEOUT_MS); - if (err) { + if (err) rtrs_err(s, "Resolving route failed, err: %d\n", err); - destroy_con_cq_qp(con); - } return err; } From patchwork Mon Oct 12 13:18:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832629 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5BC11592 for ; Mon, 12 Oct 2020 13:18:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6AD020838 for ; Mon, 12 Oct 2020 13:18:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="gYJZWf+Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387743AbgJLNSV (ORCPT ); Mon, 12 Oct 2020 09:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388135AbgJLNSU (ORCPT ); Mon, 12 Oct 2020 09:18:20 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93DD0C0613D1 for ; Mon, 12 Oct 2020 06:18:19 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id e22so23151393ejr.4 for ; Mon, 12 Oct 2020 06:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N/Dc0j/lR+ShoZDY6ICFHErbzY6Y5dDxRujilMQ1QA0=; b=gYJZWf+Q5spXrfGtlPFs7Tg0SzygPVnf6C5ZYl8ScmiIAGbqaGu1r12eNDIuawd99A c1KqKHJ6sftS5w2c2MWOjUSLml9ZMzHi9qsZXSt1GUkgPdExGDh0eIATZmmQijYQ45uV F52TGsX7d1z1oM31HGL8+tmtUECRSoOp1rJ4YstIRVYs3locbnZWX7eqgCITfT6/wZK3 5SuR/QOPYMg2thTs/Z0I4S1PNl8xjnkqGtt3AQC4AE9blEjTGHJCpVXdl+XZx0vBoDoc nTk5e9R4nPyQlUmFRAUajMxX8QN1g4nmE67lkU7nyGXgPxJXUvkKN/brTTFftmq3u0Wr IvyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N/Dc0j/lR+ShoZDY6ICFHErbzY6Y5dDxRujilMQ1QA0=; b=BnIBfvKK3O7FRwVvubBuIEKMjsze2SxDGqROUz4kQsPxO0I5AfuZKLYih0evN/N0Qc ys3meX0h/a+60H+zLg60VZiE1lx/UlR1Xi7rHOD1AwLkM6JfhRwLJeksq68jChjrWOut bZh36KHuPeuSN69WAcePma/hPcKYw/hFA6JECp0SkrtxZnqeBwhiyZp9ihIryPbM2mOE gk3h/7g1H3Nbg22RPsrT1YRZzohPcyqxSAJ4YBUSUxvoQLtfl/NfNNVkCQ6dBapmvd4v WePM+0anuotuMRu5Jryl/gmFkG9Y0Gi73othWQ3iY2NqX/Dh26Z++rBui9ZWuRlTLelK SCNA== X-Gm-Message-State: AOAM533KPiYCXGU6dMfVEIPCteQpQXvhoK3c0vlo5UFcKynvgw31e0MM UDB1HzD6krw3PVkTcvXom9CVJiXfCzZYZw== X-Google-Smtp-Source: ABdhPJyRedixULSJrm/+tLrM6LuLem8pI9PyUyH3sWmZOKIgJC6jfUM6cfqhFQd1juZqWOrBlL/Sxg== X-Received: by 2002:a17:906:8610:: with SMTP id o16mr27927018ejx.209.1602508698129; Mon, 12 Oct 2020 06:18:18 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:17 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 02/13] RDMA/rtrs-clt: remove outdated comment in create_con_cq_qp Date: Mon, 12 Oct 2020 15:18:03 +0200 Message-Id: <20201012131814.121096-3-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org As run destroy_con_cq_qp many times doesn't work, remove the comments. Suggested-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 9980bb4a6f78..fb840b152b37 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1520,15 +1520,6 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) int err, cq_vector; struct rtrs_msg_rkey_rsp *rsp; - /* - * This function can fail, but still destroy_con_cq_qp() should - * be called, this is because create_con_cq_qp() is called on cm - * event path, thus caller/waiter never knows: have we failed before - * create_con_cq_qp() or after. To solve this dilemma without - * creating any additional flags just allow destroy_con_cq_qp() be - * called many times. - */ - if (con->c.cid == 0) { /* * One completion for each receive and two for each send From patchwork Mon Oct 12 13:18:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56C071592 for ; Mon, 12 Oct 2020 13:18:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A0DB20838 for ; Mon, 12 Oct 2020 13:18:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="YCou1t+b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388135AbgJLNSW (ORCPT ); Mon, 12 Oct 2020 09:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSW (ORCPT ); Mon, 12 Oct 2020 09:18:22 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D962C0613D0 for ; Mon, 12 Oct 2020 06:18:20 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id lw21so23121562ejb.6 for ; Mon, 12 Oct 2020 06:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zbcIR1//2G15w7P9phTD1z0NMWxAtwrzBqycVb8EBrU=; b=YCou1t+bwu02dPB0ZWRLVrq6EmdwYpQt2OOGJh4WfFQ2ha/IsCo5VVnpycCRD0vDE7 5U4BxaFCfD5FC8VBNheJoKejZ0ongFjBQalgx4UPSm1VZlomc2519d9w/ZxQPbkyajWp SexAce5yPyro1h8nYReuRhPm2Rczm1kPs2UcTqZC6jdvu7yl9Xz5Tp+0CBTjEUFLOpb1 RT08+dwub1TyrQkgTsoUHVgL7UGBRHaGXjaaXzs6HCc2cwNuNm9fgL+zq4i8BgbI8oZ1 sWJ2KjkNFDDtJq8vRa0Tg1sWkFqMx3gnpBKX812Op2ZFOfGfV3DbBHHFLkz0WZbncpck rP1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zbcIR1//2G15w7P9phTD1z0NMWxAtwrzBqycVb8EBrU=; b=mI+Fww3NU5qa8Xod4CPS/RfMkBTAGwtujq3T/0diN3eAc0l0WgdzNbw+gyN9ON9SbC JwAP3AOWx22wJd4Jt3V3DNGspyd+j7tE6Ieui0Ms/njUIVAYPjJYPv8rsbwziuDEGeno DgbNVFO06kBtYDDp6S+HW2ch++2g5PSm9F0quP0Mwfq/5CrUPlHNLB1J6m2PkPf3Fcm1 H5mkj8+DYl1zguqySo+nR/1fUSQjY7cFd7IBwkhW+iK1bxHFl7PS8ffyRUQ2q+mmr8HZ enFW2E4CzGnqvqKaHEV5A0jv7hFPsiBvy/6QAy476pslqpF8UrmjIVV54cf5DH8XQe0z vTZw== X-Gm-Message-State: AOAM533pnE2zOCJucgD1/SUOz8HzML9ql65hfGkRkWJIJb/zHnGeacas Zi0jE79YpYeN/X7ygmtfb1Uqa9Ey5JqCdA== X-Google-Smtp-Source: ABdhPJy+ODlUNussBRbG75XJmDDxKQ28YiyGXlyS8dp6+xWmte648afwnJNqNkmcnAVcW91sWeJFRA== X-Received: by 2002:a17:906:4b57:: with SMTP id j23mr7817641ejv.338.1602508699001; Mon, 12 Oct 2020 06:18:19 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:18 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com Subject: [PATCH for-next 03/13] RDMA/rtrs-clt: avoid run destroy_con_cq_qp/create_con_cq_qp in parallel Date: Mon, 12 Oct 2020 15:18:04 +0200 Message-Id: <20201012131814.121096-4-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org For redmine #54314, too kworker. addr_resolver kworker reconnect kworker rtrs_clt_rdma_cm_handler rtrs_rdma_addr_resolved create_con_cq_qp: s.dev_ref++ "s.dev_ref is 1" wait in create_cm fails with TIMEOUT destroy_con_cq_qp: --s.dev_ref "s.dev_ref is 0" destroy_con_cq_qp: sess->s.dev = NULL rtrs_cq_qp_create -> create_qp(con, sess->dev->ib_pd...) sess->dev is NULL, panic. To fix the problem using mutex to serialize create_con_cq_qp and destroy_con_cq_qp. redmine: https://redmine.pb.local/issues/54314 Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 15 +++++++++++++-- drivers/infiniband/ulp/rtrs/rtrs-clt.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index fb840b152b37..4677e8ed29ae 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1499,6 +1499,7 @@ static int create_con(struct rtrs_clt_sess *sess, unsigned int cid) con->c.cid = cid; con->c.sess = &sess->s; atomic_set(&con->io_cnt, 0); + mutex_init(&con->con_mutex); sess->s.con[cid] = &con->c; @@ -1510,6 +1511,7 @@ static void destroy_con(struct rtrs_clt_con *con) struct rtrs_clt_sess *sess = to_clt_sess(con->c.sess); sess->s.con[con->c.cid] = NULL; + mutex_destroy(&con->con_mutex); kfree(con); } @@ -1520,6 +1522,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) int err, cq_vector; struct rtrs_msg_rkey_rsp *rsp; + lockdep_assert_held(&con->con_mutex); if (con->c.cid == 0) { /* * One completion for each receive and two for each send @@ -1593,7 +1596,7 @@ static void destroy_con_cq_qp(struct rtrs_clt_con *con) * Be careful here: destroy_con_cq_qp() can be called even * create_con_cq_qp() failed, see comments there. */ - + lockdep_assert_held(&con->con_mutex); rtrs_cq_qp_destroy(&con->c); if (con->rsp_ius) { rtrs_iu_free(con->rsp_ius, DMA_FROM_DEVICE, @@ -1625,7 +1628,9 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con) struct rtrs_sess *s = con->c.sess; int err; + mutex_lock(&con->con_mutex); err = create_con_cq_qp(con); + mutex_unlock(&con->con_mutex); if (err) { rtrs_err(s, "create_con_cq_qp(), err: %d\n", err); return err; @@ -1938,8 +1943,9 @@ static int create_cm(struct rtrs_clt_con *con) errr: stop_cm(con); - /* Is safe to call destroy if cq_qp is not inited */ + mutex_lock(&con->con_mutex); destroy_con_cq_qp(con); + mutex_unlock(&con->con_mutex); destroy_cm: destroy_cm(con); @@ -2046,7 +2052,9 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_sess *sess) if (!sess->s.con[cid]) break; con = to_clt_con(sess->s.con[cid]); + mutex_lock(&con->con_mutex); destroy_con_cq_qp(con); + mutex_unlock(&con->con_mutex); destroy_cm(con); destroy_con(con); } @@ -2213,7 +2221,10 @@ static int init_conns(struct rtrs_clt_sess *sess) struct rtrs_clt_con *con = to_clt_con(sess->s.con[cid]); stop_cm(con); + + mutex_lock(&con->con_mutex); destroy_con_cq_qp(con); + mutex_unlock(&con->con_mutex); destroy_cm(con); destroy_con(con); } diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.h b/drivers/infiniband/ulp/rtrs/rtrs-clt.h index 167acd3c90fc..b8dbd701b3cb 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.h @@ -72,6 +72,7 @@ struct rtrs_clt_con { struct rtrs_iu *rsp_ius; u32 queue_size; unsigned int cpu; + struct mutex con_mutex; atomic_t io_cnt; int cm_err; }; From patchwork Mon Oct 12 13:18:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832631 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 321DE697 for ; Mon, 12 Oct 2020 13:18:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA22320838 for ; Mon, 12 Oct 2020 13:18:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="YwOqiZBh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388141AbgJLNSW (ORCPT ); Mon, 12 Oct 2020 09:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388135AbgJLNSW (ORCPT ); Mon, 12 Oct 2020 09:18:22 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA57C0613D1 for ; Mon, 12 Oct 2020 06:18:21 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id cq12so16902844edb.2 for ; Mon, 12 Oct 2020 06:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UiUFAeadu17toubshf2hcLBFxF9ODfT8eqY9HxjBaiM=; b=YwOqiZBhqUro+C6EDsek32boxSo4oCYTYwg4mPTABJT/z8lFSYaWjaff4CsszFaDHr BO+VxbPoEQhDmxP1MEZ0AQ5zGFoOaLWvoXcraxPfUq2FSnx1T5D2XQq8/g7qZet5iEsm HQGhwUrMXgROPw47pMrjKJbu6H/dzGbQ5vPEAwbWXJHaFEafru0k5g63NAROOYtZs6MI b5/2F9Pa3fevy9+xcLu/JIwpRt7dEE+037nbIJFgPCKq1HqUagQpvdAP/V1Hvxv2mNKF gs9gRwajCF5rmA5jJlBwuU4cHTDQBp6hWy7DEdzVtekANGNcHAL9n+h6yICfWpjL/KkN mS7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UiUFAeadu17toubshf2hcLBFxF9ODfT8eqY9HxjBaiM=; b=uG552BQxsLShotdgTgBleEbe6ei1Zp5dFjCkXTIuUEbjZnLc2rWavAVvVpvG2xS/Zt EHDAddtbfi0N9CXj0YN/NyIxDFcoKeMf/kuz7AFHBn/n4nJNwUXHt+IpFQZhBKivCEn5 9t+etigXGXMhtx829qhpRHhiAIk3O1x9Z+zyWj9kDLj3Dzx8xrM0r3Whnaj3S4CKkPHM xgikke1E0GteW7xVjQLROt8eXl9OgHmM/XivLsjrlFfcyqQQjOoKYKGPT+8bofP6lTD3 cp/Jr3vwBL9SqZD6dMjlH9FGieF8Ygq2vjVd64rWhZ2zVyvfl8EDw/p4WLsz/PlDucgY UI4Q== X-Gm-Message-State: AOAM533QS4tx5DO59KVlW/QhVYvJiiU48Lf1OyDGnYJIwuDDyfkqcQkV NNBFB8b9cssTIVmryQehoM6OJB4F9SGSHw== X-Google-Smtp-Source: ABdhPJyhSfebnC3atsXGQcWyEn/FSGmwnmM6XlTz6ck1De8YauvojSP/jUp0fMaxY2ryynYjurlfYg== X-Received: by 2002:a50:d654:: with SMTP id c20mr2911731edj.54.1602508700030; Mon, 12 Oct 2020 06:18:20 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:19 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 04/13] RDMA/rtrs-clt: remove unnecessary dev_ref of rtrs_sess Date: Mon, 12 Oct 2020 15:18:05 +0200 Message-Id: <20201012131814.121096-5-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim dev_ref of rtrs_sess is used for counting connections sharing the rtrs_ib_dev object. But rtrs_ib_dev has its own reference counter. We can use rtrs_ib_dev_get/put. Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 35 +++++++++++--------------- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 1 - 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 4677e8ed29ae..b1c0c1400c8a 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1523,6 +1523,19 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) struct rtrs_msg_rkey_rsp *rsp; lockdep_assert_held(&con->con_mutex); + /* + * The whole session uses device from user connection. + * Be careful not to close user connection before ib dev + * is gracefully put. + */ + sess->s.dev = rtrs_ib_dev_find_or_add(con->c.cm_id->device, + &dev_pd); + if (!sess->s.dev) { + rtrs_wrn(sess->clt, + "rtrs_ib_dev_find_get_or_add(): no memory\n"); + return -ENOMEM; + } + if (con->c.cid == 0) { /* * One completion for each receive and two for each send @@ -1531,23 +1544,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) * in case qp gets into error state */ wr_queue_size = SERVICE_CON_QUEUE_DEPTH * 3 + 2; - /* We must be the first here */ - if (WARN_ON(sess->s.dev)) - return -EINVAL; - /* - * The whole session uses device from user connection. - * Be careful not to close user connection before ib dev - * is gracefully put. - */ - sess->s.dev = rtrs_ib_dev_find_or_add(con->c.cm_id->device, - &dev_pd); - if (!sess->s.dev) { - rtrs_wrn(sess->clt, - "rtrs_ib_dev_find_get_or_add(): no memory\n"); - return -ENOMEM; - } - sess->s.dev_ref = 1; query_fast_reg_mode(sess); } else { /* @@ -1560,8 +1557,6 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) if (WARN_ON(!sess->queue_depth)) return -EINVAL; - /* Shared between connections */ - sess->s.dev_ref++; wr_queue_size = min_t(int, sess->s.dev->ib_dev->attrs.max_qp_wr, /* QD * (REQ + RSP + FR REGS or INVS) + drain */ @@ -1604,10 +1599,8 @@ static void destroy_con_cq_qp(struct rtrs_clt_con *con) con->rsp_ius = NULL; con->queue_size = 0; } - if (sess->s.dev_ref && !--sess->s.dev_ref) { - rtrs_ib_dev_put(sess->s.dev); + if (rtrs_ib_dev_put(sess->s.dev)) sess->s.dev = NULL; - } } static void stop_cm(struct rtrs_clt_con *con) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h index 0a93c87ef92b..287ff78921c7 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -103,7 +103,6 @@ struct rtrs_sess { unsigned int con_num; unsigned int recon_cnt; struct rtrs_ib_dev *dev; - int dev_ref; struct ib_cqe *hb_cqe; void (*hb_err_handler)(struct rtrs_con *con); struct workqueue_struct *hb_wq; From patchwork Mon Oct 12 13:18:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832635 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 728B8109B for ; Mon, 12 Oct 2020 13:18:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 569892076E for ; Mon, 12 Oct 2020 13:18:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="ExPxvdfx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388233AbgJLNSX (ORCPT ); Mon, 12 Oct 2020 09:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSX (ORCPT ); Mon, 12 Oct 2020 09:18:23 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8C0C0613D1 for ; Mon, 12 Oct 2020 06:18:22 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id e22so23151597ejr.4 for ; Mon, 12 Oct 2020 06:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I4+0xyavodLU51SOqdhqvo2jHIogAkTTKnDKf7hTwIE=; b=ExPxvdfxCZtAzG9GxKs0X79WfLwNxJ78VtYZkrSgiwyYF8+lj+dIav/NFP6FQySmwq +JheOK8uWOUccnm3R1dr3/Ds+oFYSSfBOfPbKqhLII2kaoOOu8IXycciWehHUq1cwmwY cUcUgDMDnz0zP/DFrVREp1ZxjAZJgqok58Z1xnfApsCIuQl1FHAY6dIfybJwpkws+YSM T38CPq1v7Emw/D/YA0gqHUlMb6QyIsXOpxYViUrAxsVgZQuhDbN7NqYNOocrInckUcHb m5d+kUDvI/RCkM33mm47hCnn+l17aI8zREgWgM4SM1MtreBNjTNAbQ4iVTABz8JpuI1g nKsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I4+0xyavodLU51SOqdhqvo2jHIogAkTTKnDKf7hTwIE=; b=bQPsaUfi4GcUJuxCxxaDDKa9KhqMxurgqY8ClBKnd3lhkBCJG6J4jWd3LkjVeTPQQQ fJ7fo88wlPpnYUUw0CCgQ0hnd5Qv+i22gYAm4YLVdvDELPcXbOeGCbHKS3ELXSrDIet1 PV1L7qpSOOGvVNIswnfokJjLdm+o2/WfSjWGX0KY6vENuZVH3AGMstsHkRFN9je+sHX6 Yig+Bi2/VE7ItVGHRQ0UZI6i2PtL7S2MaVIfDJk0+dMie3KDgjXjmNzwiHRfW5en/8g/ c67g9ILiNUMeqqlZyhhlebLD02TPbNyoCRn8jICtcYH8y31hXHsl9JH4cv4zoHPoALCr GNPA== X-Gm-Message-State: AOAM531BQN7vsQpGyYIFZL7FbIs9c/9CBxrly2Nn+yptO7WQttogMB3K FPSESGXu0BpzF0eWjF6tTBuGiqXNgG3Gtg== X-Google-Smtp-Source: ABdhPJzAw3qBfq93L/xUSI4zgwo3ALpCzAo6aaGCCCkauikmYYAaA/omAvWwfOvuVO3qXhETxvIkeg== X-Received: by 2002:a17:906:f151:: with SMTP id gw17mr9394318ejb.119.1602508700952; Mon, 12 Oct 2020 06:18:20 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:20 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 05/13] RDMA/rtrs: removed unused filed list of rtrs_iu Date: Mon, 12 Oct 2020 15:18:06 +0200 Message-Id: <20201012131814.121096-6-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim list filed is not used anywhere Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h index 287ff78921c7..7821ac4e827b 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -114,7 +114,6 @@ struct rtrs_sess { /* rtrs information unit */ struct rtrs_iu { - struct list_head list; struct ib_cqe cqe; dma_addr_t dma_addr; void *buf; From patchwork Mon Oct 12 13:18:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1654697 for ; Mon, 12 Oct 2020 13:18:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCD7E2076E for ; Mon, 12 Oct 2020 13:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="LY3WD/2x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388681AbgJLNSZ (ORCPT ); Mon, 12 Oct 2020 09:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSY (ORCPT ); Mon, 12 Oct 2020 09:18:24 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7887FC0613D0 for ; Mon, 12 Oct 2020 06:18:23 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id e22so23151689ejr.4 for ; Mon, 12 Oct 2020 06:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7scqcEtmQZ8SzGjSa1/wFmxibIMwLYiYBJN18Xc/RhA=; b=LY3WD/2xEw6Uj4Kec7epkqlsoxmo6u7tCEA0GvobneGOs0gRIM+STos3JDQSLbQD2R FAfduqB780TqR9edDHk4XvslFKG4M4UfH58kNwuERQhZHOk3n+TqUfHml9xdXRAmEHQI P/QnG9pzdL3eUQVuHLwHfo34+1PslsgAOvxvth6lkXk+QwgXaZt7GuY6nOlvuSlgB/H7 RPH19dK694AlZ0rro4OxJJGk3dCAPfRW22e8Ie5tk73kIaWhblRTVVhrOHSqTP8EcFks KA8BOAL0GySq/NY85IP2MHfXwSHnsYUm0HdOVMJEYSHimL1P2e2UcCy+0C1VQZL/cIKR A/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7scqcEtmQZ8SzGjSa1/wFmxibIMwLYiYBJN18Xc/RhA=; b=IlyqhUwFWOMwTt5YuVRThe9ncfhqD4PdUl8Ei89y6xwYQua4uoYpnpeWdf12H9Keqn eOyAw/2PpEYpDlMLfDnXIZQP8N8pYQyRqgHIeROpjc1o/3MqnEDJlvb8DVV5bvX5CPcj g3qYuwE9ib709rnGh5ZupZBH6j4/r2206INdziY5dPp4SWGxAgO/PwSsG8kaTnBnbVsQ PDfksr/TLkhR6aRyonF1FWknFTDTfQ2DMbST28hXpUhlBMi/CbG4z4u4aaZSpbGe5jyY TT8yf8XaAKr6auF5ykf8/XRtlscf5J2IT4iyAMyFkx7gAnisGTozBOw9n3rJzkuMaS1+ /bqA== X-Gm-Message-State: AOAM533Ze/wJ9wHIWxepPRrudYay9YQiiQPKm7R1dLVDf1KRtEWAsprW tKEmF2zfpFIvK0o7QoRJ9oUV89l8gr/uSg== X-Google-Smtp-Source: ABdhPJzAs1j3TB4Oe54jeLaxZcux0VjzdgDUH+ConNqYYluKVON4XWiplxf47p8S1ELMRN4Ylo37Qw== X-Received: by 2002:a17:907:1042:: with SMTP id oy2mr27048687ejb.64.1602508701915; Mon, 12 Oct 2020 06:18:21 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:21 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 06/13] RDMA/rtrs: remove unnecessary argument dir of rtrs_iu_free Date: Mon, 12 Oct 2020 15:18:07 +0200 Message-Id: <20201012131814.121096-7-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim The direction of DMA operation is already in the rtrs_iu Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 14 ++++++-------- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 3 +-- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 14 ++++++-------- drivers/infiniband/ulp/rtrs/rtrs.c | 9 ++++----- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index b1c0c1400c8a..6507cfb960d4 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1236,8 +1236,7 @@ static void free_sess_reqs(struct rtrs_clt_sess *sess) if (req->mr) ib_dereg_mr(req->mr); kfree(req->sge); - rtrs_iu_free(req->iu, DMA_TO_DEVICE, - sess->s.dev->ib_dev, 1); + rtrs_iu_free(req->iu, sess->s.dev->ib_dev, 1); } kfree(sess->reqs); sess->reqs = NULL; @@ -1594,8 +1593,7 @@ static void destroy_con_cq_qp(struct rtrs_clt_con *con) lockdep_assert_held(&con->con_mutex); rtrs_cq_qp_destroy(&con->c); if (con->rsp_ius) { - rtrs_iu_free(con->rsp_ius, DMA_FROM_DEVICE, - sess->s.dev->ib_dev, con->queue_size); + rtrs_iu_free(con->rsp_ius, sess->s.dev->ib_dev, con->queue_size); con->rsp_ius = NULL; con->queue_size = 0; } @@ -2238,7 +2236,7 @@ static void rtrs_clt_info_req_done(struct ib_cq *cq, struct ib_wc *wc) struct rtrs_iu *iu; iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe); - rtrs_iu_free(iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); if (unlikely(wc->status != IB_WC_SUCCESS)) { rtrs_err(sess->clt, "Sess info request send failed: %s\n", @@ -2367,7 +2365,7 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) out: rtrs_clt_update_wc_stats(con); - rtrs_iu_free(iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); rtrs_clt_change_state(sess, state); } @@ -2429,9 +2427,9 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess *sess) out: if (tx_iu) - rtrs_iu_free(tx_iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); if (rx_iu) - rtrs_iu_free(rx_iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); if (unlikely(err)) /* If we've never taken async path because of malloc problems */ rtrs_clt_change_state(sess, RTRS_CLT_CONNECTING_ERR); diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ulp/rtrs/rtrs-pri.h index 7821ac4e827b..f49b04c69d59 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -286,8 +286,7 @@ struct rtrs_msg_rdma_hdr { struct rtrs_iu *rtrs_iu_alloc(u32 queue_size, size_t size, gfp_t t, struct ib_device *dev, enum dma_data_direction, void (*done)(struct ib_cq *cq, struct ib_wc *wc)); -void rtrs_iu_free(struct rtrs_iu *iu, enum dma_data_direction dir, - struct ib_device *dev, u32 queue_size); +void rtrs_iu_free(struct rtrs_iu *iu, struct ib_device *dev, u32 queue_size); int rtrs_iu_post_recv(struct rtrs_con *con, struct rtrs_iu *iu); int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size, struct ib_send_wr *head); diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index 28f6414dfa3d..d85a55851446 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -575,8 +575,7 @@ static void unmap_cont_bufs(struct rtrs_srv_sess *sess) struct rtrs_srv_mr *srv_mr; srv_mr = &sess->mrs[i]; - rtrs_iu_free(srv_mr->iu, DMA_TO_DEVICE, - sess->s.dev->ib_dev, 1); + rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); ib_dereg_mr(srv_mr->mr); ib_dma_unmap_sg(sess->s.dev->ib_dev, srv_mr->sgt.sgl, srv_mr->sgt.nents, DMA_BIDIRECTIONAL); @@ -680,8 +679,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) sgt = &srv_mr->sgt; mr = srv_mr->mr; free_iu: - rtrs_iu_free(srv_mr->iu, DMA_TO_DEVICE, - sess->s.dev->ib_dev, 1); + rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); dereg_mr: ib_dereg_mr(mr); unmap_sg: @@ -733,7 +731,7 @@ static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) struct rtrs_iu *iu; iu = container_of(wc->wr_cqe, struct rtrs_iu, cqe); - rtrs_iu_free(iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); if (unlikely(wc->status != IB_WC_SUCCESS)) { rtrs_err(s, "Sess info response send failed: %s\n", @@ -859,7 +857,7 @@ static int process_info_req(struct rtrs_srv_con *con, if (unlikely(err)) { rtrs_err(s, "rtrs_iu_post_send(), err: %d\n", err); iu_free: - rtrs_iu_free(tx_iu, DMA_TO_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); } rwr_free: kfree(rwr); @@ -904,7 +902,7 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc) goto close; out: - rtrs_iu_free(iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); return; close: close_sess(sess); @@ -927,7 +925,7 @@ static int post_recv_info_req(struct rtrs_srv_con *con) err = rtrs_iu_post_recv(&con->c, rx_iu); if (unlikely(err)) { rtrs_err(s, "rtrs_iu_post_recv(), err: %d\n", err); - rtrs_iu_free(rx_iu, DMA_FROM_DEVICE, sess->s.dev->ib_dev, 1); + rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); return err; } diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c index ff1093d6e4bc..48f648f573b6 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -31,6 +31,7 @@ struct rtrs_iu *rtrs_iu_alloc(u32 queue_size, size_t size, gfp_t gfp_mask, return NULL; for (i = 0; i < queue_size; i++) { iu = &ius[i]; + iu->direction = dir; iu->buf = kzalloc(size, gfp_mask); if (!iu->buf) goto err; @@ -41,17 +42,15 @@ struct rtrs_iu *rtrs_iu_alloc(u32 queue_size, size_t size, gfp_t gfp_mask, iu->cqe.done = done; iu->size = size; - iu->direction = dir; } return ius; err: - rtrs_iu_free(ius, dir, dma_dev, i); + rtrs_iu_free(ius, dma_dev, i); return NULL; } EXPORT_SYMBOL_GPL(rtrs_iu_alloc); -void rtrs_iu_free(struct rtrs_iu *ius, enum dma_data_direction dir, - struct ib_device *ibdev, u32 queue_size) +void rtrs_iu_free(struct rtrs_iu *ius, struct ib_device *ibdev, u32 queue_size) { struct rtrs_iu *iu; int i; @@ -61,7 +60,7 @@ void rtrs_iu_free(struct rtrs_iu *ius, enum dma_data_direction dir, for (i = 0; i < queue_size; i++) { iu = &ius[i]; - ib_dma_unmap_single(ibdev, iu->dma_addr, iu->size, dir); + ib_dma_unmap_single(ibdev, iu->dma_addr, iu->size, iu->direction); kfree(iu->buf); } kfree(ius); From patchwork Mon Oct 12 13:18:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 726371592 for ; Mon, 12 Oct 2020 13:18:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51AF62078E for ; Mon, 12 Oct 2020 13:18:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="U/Ck/9i1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388682AbgJLNSZ (ORCPT ); Mon, 12 Oct 2020 09:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSZ (ORCPT ); Mon, 12 Oct 2020 09:18:25 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F62C0613D1 for ; Mon, 12 Oct 2020 06:18:24 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id e22so23151795ejr.4 for ; Mon, 12 Oct 2020 06:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uuFRrj9WYf9gUlAzDmpD9QovElzcMlssDMZFI4gvMaA=; b=U/Ck/9i13M3J6L4QxLLz6w1krWrlhzVCwZXo+83bODtx+hxVZickf+OIy2Bqt5/CIl wxphWWkBbCzRfim1vanTB9Tj0LaCgzN1lQfGRma/6qS8+53RVJ7bKHLFWxrLo6i7aqo3 FjslvmrFSf0PpBuAOdLg4eGroYmSy9uYs7Ca5vXIsYRXaT1LNclU5OGfACkVUd9VL2Sj aAhzxpuABkPQMidjtadFZRva94ma9mFEQwSYPEgKuQJX0R6kMCjOv4B132NOCNH7mosy K1+PS33RJUmv2XOvzgHzhhfWlGT5rL4cRnjMv7CQA+LIkuibi8YKpC9CmKTYg05wpzaQ gYiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uuFRrj9WYf9gUlAzDmpD9QovElzcMlssDMZFI4gvMaA=; b=b4SaEYUlhn81qxR6XH/YMYqNWAOQuQVHOChQwupJqpNkWTcd4t6y+rUv365U1nYnKl NLryOTnYCkLoqhZaJeLUGd9Z9m0Wpl1r+hrIoeDFuG1x/l8VUYwQmx2IcP0r2/y8Dmqq e/CUnwJ4rwVZAT/UTk4bV2svQU1zse0vt6h3CGbbS9ba7fU14ZZ+56FufSI3/czdNuYS Rs2XFZ0btVqW6QW9KpHFaFhQlEQ2vtUnA+5Vt2kQ41+rHdBYUmjAT9252MYWPGdu8gob lHTitdmVammAAYlj3w89X8/dwAXAOBKGLe9CcqMtRWlVD5gz2tmZsjMqg9PxXR1NSdcT pj1Q== X-Gm-Message-State: AOAM5320frw4xJPkp9bZ1WFjdt9RipFqaxHsAUBnTvwgUy7XG5h7C+b/ PR6iansudXnsOT7YjHj4uTke9Pjr7DQJAg== X-Google-Smtp-Source: ABdhPJxo5OapPCoNy6OYw7pmOlFN/ipxepxtBgxfpRpOtXAQWj36Ik7QhTzKbWJQwvzJ0/O8GN1z9g== X-Received: by 2002:a17:906:2b85:: with SMTP id m5mr29353894ejg.143.1602508703114; Mon, 12 Oct 2020 06:18:23 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:22 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 07/13] RDMA/rtrs-clt: remove duplicated switch-case handling for CM error events Date: Mon, 12 Oct 2020 15:18:08 +0200 Message-Id: <20201012131814.121096-8-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim The events returning the same error value are put together. Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 6507cfb960d4..7764a01185ef 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1836,20 +1836,22 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id, case RDMA_CM_EVENT_REJECTED: cm_err = rtrs_rdma_conn_rejected(con, ev); break; + case RDMA_CM_EVENT_DISCONNECTED: + /* No message for disconnecting */ + cm_err = -ECONNRESET; + break; case RDMA_CM_EVENT_CONNECT_ERROR: case RDMA_CM_EVENT_UNREACHABLE: + case RDMA_CM_EVENT_ADDR_CHANGE: + case RDMA_CM_EVENT_TIMEWAIT_EXIT: rtrs_wrn(s, "CM error event %d\n", ev->event); cm_err = -ECONNRESET; break; case RDMA_CM_EVENT_ADDR_ERROR: case RDMA_CM_EVENT_ROUTE_ERROR: + rtrs_wrn(s, "CM error event %d\n", ev->event); cm_err = -EHOSTUNREACH; break; - case RDMA_CM_EVENT_DISCONNECTED: - case RDMA_CM_EVENT_ADDR_CHANGE: - case RDMA_CM_EVENT_TIMEWAIT_EXIT: - cm_err = -ECONNRESET; - break; case RDMA_CM_EVENT_DEVICE_REMOVAL: /* * Device removal is a special case. Queue close and return 0. From patchwork Mon Oct 12 13:18:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 670DA697 for ; Mon, 12 Oct 2020 13:18:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49FFA2076E for ; Mon, 12 Oct 2020 13:18:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="H9tpShSi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388735AbgJLNS0 (ORCPT ); Mon, 12 Oct 2020 09:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNS0 (ORCPT ); Mon, 12 Oct 2020 09:18:26 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960F7C0613D0 for ; Mon, 12 Oct 2020 06:18:25 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id dg9so14526948edb.12 for ; Mon, 12 Oct 2020 06:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XJuZm6SZ/GzRajeoHT+29aR1kivIdc2pYCwz56Ka+Gs=; b=H9tpShSiTMslHkA43d6lInBCkD0gTCR1wjfWmmKGsdWFvCcASFulUhfgZ1id+e4m76 WJauMQMmwkB7RDWp5bK2qu9DHPmGbY7muiIeIDevfKlY1snBqf+IocyrbR28KV1kFnvl qC5wNiMmROetWJ2NZB6CLusqoJhyNEY40I4fE9lZOfdbhcxxFE4d1h6hjwRDG3UtXOF3 q7JyaCNbmcK/Stv33W8Y3IkReHwunOUCuEuAolikHAk/w0vB9H0gDJg2k2ADFz6kSrpt c7Q4Lu1dETpE4wWHLy5hqBdo+tzV1p+XOYcjee4/dwf0mMALmSpeEqatuNXySf3jzbQf 2wAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XJuZm6SZ/GzRajeoHT+29aR1kivIdc2pYCwz56Ka+Gs=; b=aHNJ7SwLU9YFA3VOz5cTTtzkd/xWbZB2tRueiO6oI8X2P/u8G5rNKB2JnNLLMSrfWc efTwHjQlkpE3TjRLigNwHXyXFxxy2tVdXhsuOCUjydkIXXoFjkJpAf0+DDIiWt/5SuJ2 /H98rgxuSXsanNaX35cxm9w9qN2kEyMpp55wrldi0JQcJtdo5WoA0P8XBkGgKxo9zbJB MnyT038JlV8Jmh/kqikro4+FP173BzO48COhSz/z5AcpgDX4H38qcWgA2//sPebZDVw3 vFKeYWj3LDPi5hNh6CPLGoW+VN/0ZKS4WcExpurnmnzSf4ifIxcvc1XlXz7LU46ufw+p 2P2Q== X-Gm-Message-State: AOAM530HW/qIYuSCN6Ojd4BRiMoNsL1Fz3WMOdYGrqw2AkUY7zbRuPZF XAWa0XPP9kBzS3dseOOAom3VwlCrjQvg8A== X-Google-Smtp-Source: ABdhPJwrEtdnkD+Ch5MI2MJRkLh9L5B2DI4aVOuZksKubawt70k+DqtvBErm58zh+VJWhkKM/tRVBA== X-Received: by 2002:a05:6402:1615:: with SMTP id f21mr14571922edv.257.1602508704095; Mon, 12 Oct 2020 06:18:24 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:23 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 08/13] RDMA/ibtrs-clt: missing error from rtrs_rdma_conn_established Date: Mon, 12 Oct 2020 15:18:09 +0200 Message-Id: <20201012131814.121096-9-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim When rtrs_rdma_conn_established returns error (non-zero value), the error value is stored in con->cm_err and it cannot trigger rtrs_rdma_error_recovery. Finally the error of rtrs_rdma_con_established will be forgot. Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 7764a01185ef..f63f239bbf55 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -1822,8 +1822,8 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id *cm_id, cm_err = rtrs_rdma_route_resolved(con); break; case RDMA_CM_EVENT_ESTABLISHED: - con->cm_err = rtrs_rdma_conn_established(con, ev); - if (likely(!con->cm_err)) { + cm_err = rtrs_rdma_conn_established(con, ev); + if (likely(!cm_err)) { /* * Report success and wake up. Here we abuse state_wq, * i.e. wake up without state change, but we set cm_err. From patchwork Mon Oct 12 13:18:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39D03697 for ; Mon, 12 Oct 2020 13:18:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A94B2076E for ; Mon, 12 Oct 2020 13:18:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="ihQM3NAj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388838AbgJLNS1 (ORCPT ); Mon, 12 Oct 2020 09:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNS1 (ORCPT ); Mon, 12 Oct 2020 09:18:27 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4ACC0613D0 for ; Mon, 12 Oct 2020 06:18:26 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id 33so16828929edq.13 for ; Mon, 12 Oct 2020 06:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2TUjEk2WzlxSK5DdNDdO9Tl/sONKN92hcjKxyFdyhpM=; b=ihQM3NAjTaciSAJuiBXnuZyqJMy2QO2Xl3WR3tVitBFgN52TqjtQ+3gfW8OiZ1qK2l boLCUjktEvPZmyndW3naW9r1b5Ovn45z7k/1LfrXUrldHc0B2O+7x2j76dbLxLEITHTv XqBE0w43BaSo313Za4U0JPzNePgw8w0vkDEpWl3N8O9IStHtQ6eKHuQ60TpcxL9xJUXU qlV+yE/gj3/QxaUxGaHpJtMY6aX2Zqn/4uZRlrjoTI2lRqIgPSB87bxnpf4YhGKgIpWL Jb6J7zqAyouCfTVnVrDmtM0pm1IAVd4ASIb6oGKhghkI9YLfY0f1GMPJiyUwDwudnnt7 zZmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2TUjEk2WzlxSK5DdNDdO9Tl/sONKN92hcjKxyFdyhpM=; b=gSF5swkVhm4/kKxYxYLG5MfwLe8byBVNOyHhbQYOn9ObFc/lffKYNCli0OMM7vQ5wP o+Fbc+c1ZkAPulC0E8toJmUpKqwfx4xv5kmry1Canl2ijUQCv1yZxSv/soepr1WZcORN CdzvZH43+x670I7nf2h1P74iJ2l5C5mmZjKHFgKw3YH1iWR9tWY2c2Catgc1ujDSftYW CmKMlETpZGjyjh+VkKk4rGqlNrD+wZ/bXAVxyNe6arDZEvRc3rI18hFVxSLxJAe6xDVj u/fXmcELKCTn9EHSPK4A/bhbBLgG15NINozMFcHk9bwIe/UK7xlJOgjp3vI6knsJhfv+ uGTg== X-Gm-Message-State: AOAM5329L94ILqJ7goMr+l7WQkPhF6Mj9x/D9VesAKQbJPh/K7oyTkTY QVn8CY0a6uEluRIpB9QWuGJ+vNlWZ9rKRQ== X-Google-Smtp-Source: ABdhPJy4O+UVsqYzVBii0M/PL7Ge8y9dfjFONWbcaPxp1imGVyCjyM/HV4/XbGQPVPVcEqYlGY1Wtg== X-Received: by 2002:a50:aa84:: with SMTP id q4mr3067609edc.331.1602508705059; Mon, 12 Oct 2020 06:18:25 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:24 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Gioh Kim Subject: [PATCH for-next 09/13] RDMA/rtrs-clt: remove duplicated code Date: Mon, 12 Oct 2020 15:18:10 +0200 Message-Id: <20201012131814.121096-10-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Gioh Kim process_info_rsp checks that sg_cnt is zero twice. Signed-off-by: Gioh Kim Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index f63f239bbf55..102df6898339 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2257,8 +2257,12 @@ static int process_info_rsp(struct rtrs_clt_sess *sess, int i, sgi; sg_cnt = le16_to_cpu(msg->sg_cnt); - if (unlikely(!sg_cnt)) + if (unlikely(!sg_cnt || (sess->queue_depth % sg_cnt))) { + rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n", + sg_cnt); return -EINVAL; + } + /* * Check if IB immediate data size is enough to hold the mem_id and * the offset inside the memory chunk. @@ -2271,11 +2275,6 @@ static int process_info_rsp(struct rtrs_clt_sess *sess, MAX_IMM_PAYL_BITS, sg_cnt, sess->chunk_size); return -EINVAL; } - if (unlikely(!sg_cnt || (sess->queue_depth % sg_cnt))) { - rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n", - sg_cnt); - return -EINVAL; - } total_len = 0; for (sgi = 0, i = 0; sgi < sg_cnt && i < sess->queue_depth; sgi++) { const struct rtrs_sg_desc *desc = &msg->desc[sgi]; From patchwork Mon Oct 12 13:18:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5802109B for ; Mon, 12 Oct 2020 13:18:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C713220838 for ; Mon, 12 Oct 2020 13:18:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="bYAmr8pU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388839AbgJLNS2 (ORCPT ); Mon, 12 Oct 2020 09:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNS2 (ORCPT ); Mon, 12 Oct 2020 09:18:28 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB89C0613D0 for ; Mon, 12 Oct 2020 06:18:27 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id i5so16889518edr.5 for ; Mon, 12 Oct 2020 06:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AKb1ORSrYwaqhwcZIKU1056JH5MXQiyVvSQIqGZ4l/A=; b=bYAmr8pUCCzdX18JYZLIKNDXoJxyUaUmJXzgYU3Axtrawn2lB9YGBijRGMJalg5l8z B45inLSKKExuFfKgvy7HoFHZRsuDZ/sG60WVlocIhQKzIEtWZMr2D7i1KLRLUpcy9pAi 901N27f9N/+CxzKhMUyWESviq98UN71Hxtby4wv2F/kGL74RXJJOJVixE9qTPIdi2LYE cH0Qvh7RVQDlq/DJYzAcX+ff3l0VB6QgAXKBcuqH7fZT22WyIZ2EbMDh5iFOCnZ5ECLg 6zkeRIYpaH9fZ6gvT6zYRqUzOp/YkWAPXJIO8hB3gF3nh1oP9VzoH+uq7DUAMYb0gJcR xPPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AKb1ORSrYwaqhwcZIKU1056JH5MXQiyVvSQIqGZ4l/A=; b=kcc/TaWWRUOfjRGeIL/6ZpAoZW66iFe8WYy+nrrTF/M0iZAypUDt5lPPWJ6OYSX/gQ +J4I8E2AWvVJeethRIMBPZ3YMlfYYRfm8a2SN2u37h6UQ5w3qpmlT8T6fhMEsrK+M+Ka QpWMm3nYRjLSvopUarJQg4QQ8SOPx1WHdL217dFPeUqYB7/NUtEYmdL2nDXjlY5kSwpa chH2o2BTGeDkscKAsguIm84XCIQoV/KCDMUjm6UkQbwlhF3OuZ2n05pBm4lr9PrKBeIJ LzRa3UOB8UYmEflIZgPMEIV43f+5QdSpexsrjPUWCyk3xJPcSogQjg0IfzJpbetfq2/R 3bLA== X-Gm-Message-State: AOAM533Mjp8dE5xdl14b4KRrZLbkTE3cTzYoysOlG6Df1xFx1NhEpk+x Xk8g9AnPe8FNRvumZOV22k0OCIiK3XK7Zg== X-Google-Smtp-Source: ABdhPJwuzqS7MP8TrVN64z/o1g73UFJebwSj64EKrdiEYW6xru2CrDP8mEVFhSRm+dpr1LqfsjcoZw== X-Received: by 2002:aa7:d782:: with SMTP id s2mr14032265edq.111.1602508705952; Mon, 12 Oct 2020 06:18:25 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:25 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Guoqing Jiang Subject: [PATCH for-next 10/13] RDMA/rtrs-srv: fix typo Date: Mon, 12 Oct 2020 15:18:11 +0200 Message-Id: <20201012131814.121096-11-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Guoqing Jiang It should mean region here. Signed-off-by: Guoqing Jiang Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-srv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.h b/drivers/infiniband/ulp/rtrs/rtrs-srv.h index dc95b0932f0d..6fb39e46e248 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.h @@ -62,7 +62,7 @@ struct rtrs_srv_op { /* * server side memory region context, when always_invalidate=Y, we need - * queue_depth of memory regrion to invalidate each memory region. + * queue_depth of memory region to invalidate each memory region. */ struct rtrs_srv_mr { struct ib_mr *mr; From patchwork Mon Oct 12 13:18:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832647 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D540C109B for ; Mon, 12 Oct 2020 13:18:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA3DC2078E for ; Mon, 12 Oct 2020 13:18:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="UokvXF1d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388840AbgJLNS3 (ORCPT ); Mon, 12 Oct 2020 09:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNS3 (ORCPT ); Mon, 12 Oct 2020 09:18:29 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86524C0613D0 for ; Mon, 12 Oct 2020 06:18:28 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id p13so16890321edi.7 for ; Mon, 12 Oct 2020 06:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JkxeU+sSRTy9pyx5IFVwQZlr/UNRjLgsU4lVsY6uQx4=; b=UokvXF1dIXiFPWMDCE7GHfODGm7GFyra8PAYICWPP/S2u/z28WB5sIVGtFwswG7QkC X3SR/fzLxRqjGwBMBpFTk2WoHjGK43tb9LQmd0MQAB62FJOdctCDHSCwv9reQ3DblTgX 3l2hyTzw5D8yOZQih8qBBADHDNgCLKWcGZLngwbMkvpH30BSAV/nFbq6wTY8Ss7/WJXh nRWVolUaHkWJ66/TZvv9D65YkbxMTgkvVhn/h7RfhcXc+//dbADgvXc1cEsG4vPOQON3 PXNMDAi0IdDJoBwBskuS96PJgNd1um9CHUayZeSBxoGGn0vaSGXCVRAXIPXybmK4xI/W 7i8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JkxeU+sSRTy9pyx5IFVwQZlr/UNRjLgsU4lVsY6uQx4=; b=HbfhN/uhk9WPSmdF3ampOd95Nsgph0ChIVK2FRQDWK32c+SHXtpJHqglFXY5OE/c7d +IkO6+5NofAx3xYuPcQO0I/5h6En65rcI6CrJSmqlEuTyaCfwg6zTKnELJ7f+ouT0wR6 utBabRHbG7LFowLruyxGwDGdmrPbVj22oauhOQqKrdtDn465dEuk+uzN3cC6hMbHrjO7 nc25fdLQTo0uupT0jVJB4xURvsNSXTIDA4lsrqnKTWBEXVWPqmCM6HODW1gO36d+cY4Z xxnmEH2kPxyXDO8eYpfoBqq+q5d/50dh139xVPQDLe1IbcVxJeJEAMZaF7JlaViLHe8H nhrw== X-Gm-Message-State: AOAM532gJWaL2ZXYtlNeS4Qr8ds6hv6+D6cF43O2ykeg9PTRu7rAwhko O1eiCRdq5UgAmmLjkAr7XJKIIsTk60w46A== X-Google-Smtp-Source: ABdhPJzgSnd42kvzWT9dtDLadRhhHIszQaiimeoSRSmXFsOhaqoNLVhNAyGXk6zmcvjdzKxRY4vCnQ== X-Received: by 2002:aa7:d4d8:: with SMTP id t24mr14597171edr.247.1602508706986; Mon, 12 Oct 2020 06:18:26 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:26 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Guoqing Jiang Subject: [PATCH for-next 11/13] RDMA/rtrs-srv: kill rtrs_srv_change_state_get_old Date: Mon, 12 Oct 2020 15:18:12 +0200 Message-Id: <20201012131814.121096-12-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Guoqing Jiang This function isn't needed since no caller checks the old_state of sess. Signed-off-by: Guoqing Jiang Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c index d85a55851446..52e02123697c 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -111,28 +111,18 @@ static bool __rtrs_srv_change_state(struct rtrs_srv_sess *sess, return changed; } -static bool rtrs_srv_change_state_get_old(struct rtrs_srv_sess *sess, - enum rtrs_srv_state new_state, - enum rtrs_srv_state *old_state) +static bool rtrs_srv_change_state(struct rtrs_srv_sess *sess, + enum rtrs_srv_state new_state) { bool changed; spin_lock_irq(&sess->state_lock); - *old_state = sess->state; changed = __rtrs_srv_change_state(sess, new_state); spin_unlock_irq(&sess->state_lock); return changed; } -static bool rtrs_srv_change_state(struct rtrs_srv_sess *sess, - enum rtrs_srv_state new_state) -{ - enum rtrs_srv_state old_state; - - return rtrs_srv_change_state_get_old(sess, new_state, &old_state); -} - static void free_id(struct rtrs_srv_op *id) { if (!id) @@ -469,10 +459,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *id, void close_sess(struct rtrs_srv_sess *sess) { - enum rtrs_srv_state old_state; - - if (rtrs_srv_change_state_get_old(sess, RTRS_SRV_CLOSING, - &old_state)) + if (rtrs_srv_change_state(sess, RTRS_SRV_CLOSING)) queue_work(rtrs_wq, &sess->close_work); WARN_ON(sess->state != RTRS_SRV_CLOSING); } From patchwork Mon Oct 12 13:18:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01E2A697 for ; Mon, 12 Oct 2020 13:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAD522076E for ; Mon, 12 Oct 2020 13:18:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="IjP2zpHQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388841AbgJLNSa (ORCPT ); Mon, 12 Oct 2020 09:18:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSa (ORCPT ); Mon, 12 Oct 2020 09:18:30 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72F64C0613D0 for ; Mon, 12 Oct 2020 06:18:29 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id g4so16922798edk.0 for ; Mon, 12 Oct 2020 06:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N98xLNwIrHPVMGn4TFLYhEJS7NXRDPuaQTkSD4Kdyco=; b=IjP2zpHQWmvdGFbagsbBGR15q910enEHydFvMuGrm5M6BOVTkgcpDvliviHQxe6HTP LbpCc+lYjJJiMyiobS3N55fz/4O8RpVaJ9drgN50Wa8aHqhF+5+CefTC41cELecvnQag uNz6vtLGFGbI2gvL+rUm4w/yAoVPqMMORBVvE8LSEfsV+9FQwjI1Cp7uCswvB7Brmwb1 b1RE8zmUbjyQqbPcH9N+UmXsJCTjt22iNxSPPfVUk0iTH6N6RWwXJ7ZQmSD0NcnrXygc eiLZAnkGWQfScoBejeUjQGDHs1h1BJl/Mn+0G60x9lPanMg04Rl7TxPjGSuwB8v7I7rS JX7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N98xLNwIrHPVMGn4TFLYhEJS7NXRDPuaQTkSD4Kdyco=; b=E/WMByrGA+FobO3ZdRXC5ZRCN/nHdOk3I0forYaxXLVlNDXwodqZjw99K29ILaLOgE 7ZTto4wzBK+X8KKWS8Zk/GxWoTJB+xAnYQTAVrZCZ+AvWoLio/091g4KJvW1isSnrNbG 5m8PLAKX1ypZ/gGw2rr3fecIaXFPkUmCcDqsoUDQXrHzMylWMTtTENqN2dElFbc3v69P m+gIf6Q6d7fgpsTFHP7quoO7Z+b2Ocm5f01e0o8/0PyZzV1dkJUU8B9LDZMvUSBUcQNn hE47o2E2ZiptRaFZXG11142vPnP3InfbwnbeBpXMRh57+96CIUCjaAJsA2wEY8rOj+3n q40A== X-Gm-Message-State: AOAM533OA7cP5S7WyDR4+vdgH6fBgJOmjJfXwIBMKu+iCniTBKVjkAaU nDWpci+SCXZ81dEdTpXJ0nEhJJUiOMd3Xg== X-Google-Smtp-Source: ABdhPJwAutl8VLiciwpVFHGTmuP6FTWxQ16FRgROlaW0Iq7msdF3T/Ao/HaEa8+95FbV0qTFlyn/6w== X-Received: by 2002:aa7:d143:: with SMTP id r3mr12518069edo.103.1602508707931; Mon, 12 Oct 2020 06:18:27 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:27 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Guoqing Jiang Subject: [PATCH for-next 12/13] RDMA/rtrs: introduce rtrs_post_send Date: Mon, 12 Oct 2020 15:18:13 +0200 Message-Id: <20201012131814.121096-13-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Guoqing Jiang Since the three functions share the similar logic, let's introduce one common function for it. Signed-off-by: Guoqing Jiang Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs.c | 52 +++++++++++------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c index 48f648f573b6..2e3a849e0a77 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -104,6 +104,22 @@ int rtrs_post_recv_empty(struct rtrs_con *con, struct ib_cqe *cqe) } EXPORT_SYMBOL_GPL(rtrs_post_recv_empty); +static int rtrs_post_send(struct ib_qp *qp, struct ib_send_wr *head, + struct ib_send_wr *wr) +{ + if (head) { + struct ib_send_wr *tail = head; + + while (tail->next) + tail = tail->next; + tail->next = wr; + } else { + head = wr; + } + + return ib_post_send(qp, head, NULL); +} + int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size, struct ib_send_wr *head) { @@ -126,17 +142,7 @@ int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t size, .send_flags = IB_SEND_SIGNALED, }; - if (head) { - struct ib_send_wr *tail = head; - - while (tail->next) - tail = tail->next; - tail->next = ≀ - } else { - head = ≀ - } - - return ib_post_send(con->qp, head, NULL); + return rtrs_post_send(con->qp, head, &wr); } EXPORT_SYMBOL_GPL(rtrs_iu_post_send); @@ -168,17 +174,7 @@ int rtrs_iu_post_rdma_write_imm(struct rtrs_con *con, struct rtrs_iu *iu, if (WARN_ON(sge[i].length == 0)) return -EINVAL; - if (head) { - struct ib_send_wr *tail = head; - - while (tail->next) - tail = tail->next; - tail->next = &wr.wr; - } else { - head = &wr.wr; - } - - return ib_post_send(con->qp, head, NULL); + return rtrs_post_send(con->qp, head, &wr.wr); } EXPORT_SYMBOL_GPL(rtrs_iu_post_rdma_write_imm); @@ -195,17 +191,7 @@ int rtrs_post_rdma_write_imm_empty(struct rtrs_con *con, struct ib_cqe *cqe, .ex.imm_data = cpu_to_be32(imm_data), }; - if (head) { - struct ib_send_wr *tail = head; - - while (tail->next) - tail = tail->next; - tail->next = ≀ - } else { - head = ≀ - } - - return ib_post_send(con->qp, head, NULL); + return rtrs_post_send(con->qp, head, &wr); } EXPORT_SYMBOL_GPL(rtrs_post_rdma_write_imm_empty); From patchwork Mon Oct 12 13:18:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 11832651 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29816109B for ; Mon, 12 Oct 2020 13:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CECD20714 for ; Mon, 12 Oct 2020 13:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cloud.ionos.com header.i=@cloud.ionos.com header.b="WHzBvOUc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388261AbgJLNSc (ORCPT ); Mon, 12 Oct 2020 09:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388160AbgJLNSc (ORCPT ); Mon, 12 Oct 2020 09:18:32 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A0FC0613D0 for ; Mon, 12 Oct 2020 06:18:30 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id i5so16889692edr.5 for ; Mon, 12 Oct 2020 06:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B1WTni9FMmqOxX6J8clKnzfWIzfNoMGtmaM+3RUD3qw=; b=WHzBvOUc9Jmvz9h3tqAlNKGcRqGSLaSUDgkk0xi04BLmFPpKwbKqT8TdjBx7ofanYE zhvIvzSAoiEa9fwXhFr3jeSrawKt5IV38+bYRWhjMvsRbYB3hMZK9TEC0QYf15o1TJOM le5Zz1ivCWo68FJNAjESfSARCxqr149capqbwLep0njSzIBnKTo6TuJTLRR0V42zknix zG77EYuN6sqhVfmRYbxFoofAYSuAASxNGhXQ/T67u0EXZ5Ex5GIlIoQk54k4DuQhgHGH /uBOrlKVqzmbbCN38GeRsmKUMPFJByiFyQ5MS2GST/dsfF8ON9jEp3hKIdNgbJ9oI5o7 vtcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B1WTni9FMmqOxX6J8clKnzfWIzfNoMGtmaM+3RUD3qw=; b=nVq9tphWHDjjw1ohT+lC0BBt0aZIWBB1LVzBheltgitAmMJb5frAsnjn6H2BumugBF H1ZaHplfJPgrj9jrGnsRZOAXnRv760uLd/2ei+F3hBTVw73Lv+U3m4uPTCZTDzLeZFVx TJDDf6/p2KrRjsFHYEV81wIqqTXjaL8yrVLxVGNys7h97MXL+2r3EdWc2+HpF0sT/wxq k3cGj28eFdB+og3CXG+Sl5VtW3IAsoUVTaRb8xNFui+t6yaEgTvSiB16lmazRhrndF4P vsbHv+DkPA0vLOMAswl3Oj1ib/bNzoH9UeO808h/1vKgVgqu0AdpMMO4NrXf0P9Izknk jdpQ== X-Gm-Message-State: AOAM532IyiQ4Ydv4tN6vudBh9leejF7B3PrFoyJO6dpENq2UeMa99Qyq 5sKi8QT8NcpybKIUtco0x7QHPy7NyuTQzg== X-Google-Smtp-Source: ABdhPJy0EB8wEWyxUjxbwzf8ZsupJ259c0rPZ6/SqRnrTIka5ogo+v5zkvGmXu/Z1btz88gQt8bMIQ== X-Received: by 2002:aa7:c98f:: with SMTP id c15mr14350861edt.200.1602508708867; Mon, 12 Oct 2020 06:18:28 -0700 (PDT) Received: from jwang-Latitude-5491.fkb.profitbricks.net ([2001:16b8:4915:9700:86d:33e0:2141:a74a]) by smtp.gmail.com with ESMTPSA id o12sm10828252ejb.36.2020.10.12.06.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 06:18:28 -0700 (PDT) From: Jack Wang To: linux-rdma@vger.kernel.org Cc: bvanassche@acm.org, leon@kernel.org, dledford@redhat.com, jgg@ziepe.ca, danil.kipnis@cloud.ionos.com, jinpu.wang@cloud.ionos.com, Guoqing Jiang Subject: [PATCH for-next 13/13] RDMA/rtrs-clt: remove 'addr' from rtrs_clt_add_path_to_arr Date: Mon, 12 Oct 2020 15:18:14 +0200 Message-Id: <20201012131814.121096-14-jinpu.wang@cloud.ionos.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> References: <20201012131814.121096-1-jinpu.wang@cloud.ionos.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Guoqing Jiang Remove the argument since it is not used in the function. Signed-off-by: Guoqing Jiang Signed-off-by: Jack Wang --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c index 102df6898339..a9f1dc3295c4 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2154,8 +2154,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_sess *sess) mutex_unlock(&clt->paths_mutex); } -static void rtrs_clt_add_path_to_arr(struct rtrs_clt_sess *sess, - struct rtrs_addr *addr) +static void rtrs_clt_add_path_to_arr(struct rtrs_clt_sess *sess) { struct rtrs_clt *clt = sess->clt; @@ -2930,7 +2929,7 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, * IO will never grab it. Also it is very important to add * path before init, since init fires LINK_CONNECTED event. */ - rtrs_clt_add_path_to_arr(sess, addr); + rtrs_clt_add_path_to_arr(sess); err = init_sess(sess); if (err)