From patchwork Wed Jul 20 08:56:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 12923690 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BE85C43334 for ; Wed, 20 Jul 2022 08:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229561AbiGTI4o (ORCPT ); Wed, 20 Jul 2022 04:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiGTI4m (ORCPT ); Wed, 20 Jul 2022 04:56:42 -0400 Received: from mail1.bemta37.messagelabs.com (mail1.bemta37.messagelabs.com [85.158.142.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A69367CB3 for ; Wed, 20 Jul 2022 01:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1658307399; i=@fujitsu.com; bh=zB2ocOaaMAzpH4otIshXdWK3XaHkkri7AmHyrGMo6Fs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TJBJLIKqKqniwgdO1pb2oEaT3klpIMeqUWpF/mmY1S0h9q2D4CePDEO8gO7PrsVay YsnA3FoCN/zUcor2JHo1gWuihNf7JXWeg9wZBVepdIdHxYZ6X8dIQt8yFUbDHPhe26 p0k8P2ms+PuEevhrvwpZTE1rfA0IHJBLH6FOpyhOeFojj7D1W8I/Db8JhLe5n9LtEL lXedUzlF3sPuw+0Wbk3IbeXpcEug6YSAgmiMTKkK7QJQoAEi338GmE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SFofp7tsWkPBPmjrus6X5yb3Cza 851dw8TVz1dupY1UbVT2ju3z211PV+1t4DOb8dhs383SDNsN6fz6y052B8sLhCyQalkpeMD+Y ekR7m8aH3WLL/Af/MBgzhYQkfnOJku8T4mlOCPRUIu5qDgRAGbkOP2jAwAA X-Env-Sender: lizhijian@fujitsu.com X-Msg-Ref: server-9.tower-732.messagelabs.com!1658307398!318012!1 X-Originating-IP: [62.60.8.179] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.87.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8051 invoked from network); 20 Jul 2022 08:56:39 -0000 Received: from unknown (HELO n03ukasimr04.n03.fujitsu.local) (62.60.8.179) by server-9.tower-732.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jul 2022 08:56:39 -0000 Received: from n03ukasimr04.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr04.n03.fujitsu.local (Postfix) with ESMTP id 6FD95150; Wed, 20 Jul 2022 09:56:38 +0100 (BST) Received: from R01UKEXCASM126.r01.fujitsu.local (R01UKEXCASM126 [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr04.n03.fujitsu.local (Postfix) with ESMTPS id 61C8C7B; Wed, 20 Jul 2022 09:56:38 +0100 (BST) Received: from centos-smtp.localdomain (10.167.226.45) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 20 Jul 2022 09:56:34 +0100 From: Li Zhijian To: Yanjun Zhu , Jason Gunthorpe , "Haakon Bugge" , , Bob Pearson , Leon Romanovsky CC: Cheng Xu , Li Zhijian Subject: [PATCH RESEND for-next v6 2/4] RDMA/rxe: Generate error completion for error requester QP state Date: Wed, 20 Jul 2022 04:56:06 -0400 Message-ID: <1658307368-1851-3-git-send-email-lizhijian@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1658307368-1851-1-git-send-email-lizhijian@fujitsu.com> References: <1658307368-1851-1-git-send-email-lizhijian@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.45] X-ClientProxiedBy: G08CNEXCHPEKD08.g08.fujitsu.local (10.167.33.83) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org As per IBTA specification, all subsequent WQEs while QP is in error state should be completed with a flush error. Here we check QP_STATE_ERROR after req_next_wqe() so that rxe_completer() has chance to be called where it will set CQ state to FLUSH ERROR and the completion can associate with its WQE. Signed-off-by: Li Zhijian --- V5: parentheses issue # Cheng Xu V4: check QP ERROR before QP RESET # Bob V3: unlikely() optimization # Cheng Xu update commit log # Haakon Bugge --- drivers/infiniband/sw/rxe/rxe_req.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index c187deeb6e6b..cbb2ce2d7b50 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -611,9 +611,20 @@ int rxe_requester(void *arg) return -EAGAIN; next_wqe: - if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) + if (unlikely(!qp->valid)) goto exit; + if (unlikely(qp->req.state == QP_STATE_ERROR)) { + wqe = req_next_wqe(qp); + if (wqe) + /* + * Generate an error completion for error qp state + */ + goto err; + else + goto exit; + } + if (unlikely(qp->req.state == QP_STATE_RESET)) { qp->req.wqe_index = queue_get_consumer(q, QUEUE_TYPE_FROM_CLIENT);