From patchwork Thu Aug 20 22:46:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Pearson X-Patchwork-Id: 11727157 X-Patchwork-Delegate: jgg@ziepe.ca 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 60CB6618 for ; Thu, 20 Aug 2020 22:47:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48CED207DF for ; Thu, 20 Aug 2020 22:47:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WEqaBFy/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728538AbgHTWru (ORCPT ); Thu, 20 Aug 2020 18:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728592AbgHTWrb (ORCPT ); Thu, 20 Aug 2020 18:47:31 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFDF0C061349 for ; Thu, 20 Aug 2020 15:47:28 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id a24so3329430oia.6 for ; Thu, 20 Aug 2020 15:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nfAXiZdnC3W8AdXkWucywAkf4pXx1+CfaumTiObKXH8=; b=WEqaBFy/pfgjQWAP1jtSkmt4OZwKzACQ+yKTujZz85Gzik2Z8x07HEez5txFZQYAwf UorqfgYGdkS45NortHkh2EzLbdq04L/UXuylKLIbIBrZRfksyjBo/XTemc6E1t6nqFT4 AeelBCuxPaS06h71uDdo/B7w++5GxCuTAz8ZH8s+esdRnOHBz7TELV7ZrMt/YeBBRC8P fG4ayW96BrEWC8ubz0neq+RgKO6T9k5EPnzxK5zAr77JKon1IKmDRSkAxulIej8XldaW T68kCxtabimDLYc2+4I9wTbIXwDNPyt6oVElg1FhMgPhcHMuH0IfkYk6W9Z9NpQnVcAp itRQ== 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=nfAXiZdnC3W8AdXkWucywAkf4pXx1+CfaumTiObKXH8=; b=VweUl2uInCI+2w63/i1YSHq4FMxQwaZPpQbm3GhjeCZbKlqvO8U8WelrOmhEcu2q7Z 2XtLBaax9IzgMMvB4faqcBDqhrN+jGpuN0jKM1ANPkpwIWhQVpM9NkoN2Eu7MYUjy/HT kNzQOjjA3YQydlUWlqA/sAFleSDJgRNNEaghC7VGbqtg4PWmZGtCsum9Kx/mJAjxc5sy lilVqIsezd8O3FJFMg1WrUB7hTyA6GjRNgClx3ekJxEJYCQfpVITpjJ82nKdy3g5UjdO 3RBKK7RPom0+Fi62o5jwyt/0DDcaO+v998DEzysyGdY0s0sANTU/aTRg0Pa4U9jN6t40 k5GQ== X-Gm-Message-State: AOAM531MBKKkZp+REuhOJKFaWM4LNGuzaOZcSBldi8Vld65KcXCmwqG7 R2P701KizaFl0okQt+BfBQ/RYBF1a24mwg== X-Google-Smtp-Source: ABdhPJzqp1JY7yHSv4lLlRa9uYglKra7g0PTYjJUQKl3r3fL1qXmiZN14C+6YzqMgU1CduotB5gABQ== X-Received: by 2002:aca:4c0f:: with SMTP id z15mr9805oia.131.1597963647625; Thu, 20 Aug 2020 15:47:27 -0700 (PDT) Received: from localhost ([2605:6000:8b03:f000:e2a0:5228:a0c3:36eb]) by smtp.gmail.com with ESMTPSA id 3sm679303oix.24.2020.08.20.15.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 15:47:27 -0700 (PDT) From: Bob Pearson X-Google-Original-From: Bob Pearson To: linux-rdma@vger.kernel.org, zyjzyj2000@gmail.com Cc: Bob Pearson Subject: [PATCH v3 17/17] rdma_rxe: minor cleanups Date: Thu, 20 Aug 2020 17:46:38 -0500 Message-Id: <20200820224638.3212-18-rpearson@hpe.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200820224638.3212-1-rpearson@hpe.com> References: <20200820224638.3212-1-rpearson@hpe.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Added vendor_part_id Fixed bug in rxe_resp.c at RKEY_VIOLATION: failed to ack bad rkeys Fixed failure to init mr in rxe_resp.c at check_rkey Fixed failure to allow invalidation of invalid MWs Signed-off-by: Bob Pearson --- drivers/infiniband/sw/rxe/rxe.c | 1 + drivers/infiniband/sw/rxe/rxe_mw.c | 20 ++++++++++++-------- drivers/infiniband/sw/rxe/rxe_param.h | 1 + drivers/infiniband/sw/rxe/rxe_resp.c | 9 ++++++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c index 10f441ac7203..11b043edd647 100644 --- a/drivers/infiniband/sw/rxe/rxe.c +++ b/drivers/infiniband/sw/rxe/rxe.c @@ -43,6 +43,7 @@ static void rxe_init_device_param(struct rxe_dev *rxe) rxe->max_inline_data = RXE_MAX_INLINE_DATA; rxe->attr.vendor_id = RXE_VENDOR_ID; + rxe->attr.vendor_part_id = RXE_VENDOR_PART_ID; rxe->attr.max_mr_size = RXE_MAX_MR_SIZE; rxe->attr.page_size_cap = RXE_PAGE_SIZE_CAP; rxe->attr.max_qp = RXE_MAX_QP; diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c index 4178cf501a2b..a443deae35a3 100644 --- a/drivers/infiniband/sw/rxe/rxe_mw.c +++ b/drivers/infiniband/sw/rxe/rxe_mw.c @@ -28,7 +28,6 @@ static void rxe_set_mw_rkey(struct rxe_mw *mw) pr_err_once("unable to get random rkey for mw\n"); } -/* this temporary code to test ibv_alloc_mw, ibv_dealloc_mw */ struct ib_mw *rxe_alloc_mw(struct ib_pd *ibpd, enum ib_mw_type type, struct ib_udata *udata) { @@ -326,9 +325,12 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe) static int check_invalidate_mw(struct rxe_qp *qp, struct rxe_mw *mw) { - if (unlikely(mw->state != RXE_MEM_STATE_VALID)) { - pr_err_once("attempt to invalidate a MW that is not valid\n"); - return -EINVAL; + /* run_test requires invalidate to work when !valid so don't check */ + if (0) { + if (unlikely(mw->state != RXE_MEM_STATE_VALID)) { + pr_err_once("attempt to invalidate a MW that is not valid\n"); + return -EINVAL; + } } /* o10-37.2.26 */ @@ -344,9 +346,11 @@ static void do_invalidate_mw(struct rxe_mw *mw) { mw->qp = NULL; - rxe_drop_ref(mw->mr); - atomic_dec(&mw->mr->num_mw); - mw->mr = NULL; + if (mw->mr) { + rxe_drop_ref(mw->mr); + atomic_dec(&mw->mr->num_mw); + mw->mr = NULL; + } mw->access = 0; mw->addr = 0; @@ -378,7 +382,7 @@ int rxe_mw_check_access(struct rxe_qp *qp, struct rxe_mw *mw, struct rxe_pd *pd = to_rpd(mw->ibmw.pd); if (unlikely(mw->state != RXE_MEM_STATE_VALID)) { - pr_err_once("attempt to access a MW that is not in the valid state\n"); + pr_err_once("attempt to access a MW that is not valid\n"); return -EINVAL; } diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h index e1d485bdd6af..beaa3f844819 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -107,6 +107,7 @@ enum rxe_device_param { /* IBTA v1.4 A3.3.1 VENDOR INFORMATION section */ RXE_VENDOR_ID = 0XFFFFFF, + RXE_VENDOR_PART_ID = 1, }; /* default/initial rxe port parameters */ diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index d6e957a34910..bf7ef56aaf1c 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -392,8 +392,8 @@ static enum resp_states check_length(struct rxe_qp *qp, static enum resp_states check_rkey(struct rxe_qp *qp, struct rxe_pkt_info *pkt) { - struct rxe_mr *mr; - struct rxe_mw *mw; + struct rxe_mr *mr = NULL; + struct rxe_mw *mw = NULL; struct rxe_dev *rxe = to_rdev(qp->ibqp.device); u64 va; u32 rkey; @@ -1368,7 +1368,10 @@ int rxe_responder(void *arg) /* Class C */ do_class_ac_error(qp, AETH_NAK_REM_ACC_ERR, IB_WC_REM_ACCESS_ERR); - state = RESPST_COMPLETE; + if (qp->resp.wqe) + state = RESPST_COMPLETE; + else + state = RESPST_ACKNOWLEDGE; } else { qp->resp.drop_msg = 1; if (qp->srq) {