From patchwork Fri Jul 1 06:10:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhijian X-Patchwork-Id: 12902740 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 18F4FC433EF for ; Fri, 1 Jul 2022 06:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233761AbiGAGKc (ORCPT ); Fri, 1 Jul 2022 02:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232866AbiGAGKb (ORCPT ); Fri, 1 Jul 2022 02:10:31 -0400 Received: from esa10.fujitsucc.c3s2.iphmx.com (esa10.fujitsucc.c3s2.iphmx.com [68.232.159.247]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B7B720195 for ; Thu, 30 Jun 2022 23:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj1; t=1656655829; x=1688191829; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xb8bcB3dacwTDC1wfXR/L8AIWhBWMTpzHSfnleSvvJw=; b=yiobyBrVHA9eYzTbV2e/ZEl/m6j5+fjqwm22ImxvSqlCddDKIx1AnMxA 9cu8N6p1kWD4Smx1uCpI8j6l92LWu7xXLRqbY+z0sPjlffn9/HxlW3axM DtheXhxj4tyFz2N2HsfDj8Rsy8y5itTlzhq6ZtZtyToRRajQYZCgigdxa UPGqNaqLrx0BaSP1ckqPQaNjD6+lEWrYkIK0B+xDkPM8XTAbUXRsxJKA2 xWep58DGgSW5Xr07wKqx8HwPMWe9HsfBvt4INTxKyQTrIyhTQA+AwCNEL Vf78NDBWinZuwRdRkAxrIkhQSSEJNd7vuHJP+Wsf58j1V8U11cAscsqib g==; X-IronPort-AV: E=McAfee;i="6400,9594,10394"; a="59519669" X-IronPort-AV: E=Sophos;i="5.92,236,1650898800"; d="scan'208";a="59519669" Received: from mail-tycjpn01lp2177.outbound.protection.outlook.com (HELO JPN01-TYC-obe.outbound.protection.outlook.com) ([104.47.23.177]) by ob1.fujitsucc.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 15:10:27 +0900 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jXhz2RlHnR9s5fdGi66i7DY3ffdVs9vvOHBmDsufjWCztF1Hu27jYv+bvCFiZ9zS9FqrPTL9k0rJReqm7AA5PZeeDIrE8eGuT0Ps9HiTBDESwGeVjabDejvetDKIA1lbthfvAhRi18rZuk/tg2c7u3anb3WqnkU3qWXHlXcWx3woJOtNWn/4HQ4tsHKrGssdHhCG6Wvq1jiq1hYV82hQQ+yOh2nYC/YVk6unlWWljGUvkIAzKVR+Lfpip4Xh6eH/UqRCljP+HnBXdodcOJawoVzZg4TQLdsoLQ5ICg/ahWf/5Toy1qTle5qa+lNTDYjUGA2P+5qlXpKt8TM4D35/nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xb8bcB3dacwTDC1wfXR/L8AIWhBWMTpzHSfnleSvvJw=; b=U1lKBnvaWJ8BDxGZSaj5X85CXn7uWB5ct3tILWehl9G+CMQqsvLU73c9qH/2ab05cD3C0tiLCtntiQexqTj5Oc6qIjx41OQ/Wbjjl7o+p4avQ8K6L/3CCwoRt5ZjviHMjlEFnWThgg/U+d4irLxZpPLCSdcVfcvL0N8dMPwqqfIPAof2SlekNaKSAKoQQOUam71433UAEj+rdFZPz38b4qDtLEvWNtyP0sI6p5+vteClXE4l2q6CX9XnxZ70gVJbiPdMDMniK9HdWczKUnrSgMWDxg4D4Tn3Kb6KMNUbIUah2BWryhz+qEp5YxPZNweQtgYoIKNd1O7pfBXewhdR1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fujitsu.com; dmarc=pass action=none header.from=fujitsu.com; dkim=pass header.d=fujitsu.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.onmicrosoft.com; s=selector2-fujitsu-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xb8bcB3dacwTDC1wfXR/L8AIWhBWMTpzHSfnleSvvJw=; b=SnCmwU8SDGkTNzS2lQ28F3oMMTovbzu2Dk2FrbnyCwo60Ycul9/TX3h/HyWhEFesf8tlgyFQy3OZPoAOcq/e/dAuRtWGOSkDtdOKqXGlBdvfbKDS+oQCjCq6GnQiYyUW7a0vZVdpN/easoKHlaa2WEI6w98WI3sI8OzA4caSzq8= Received: from TYCPR01MB9305.jpnprd01.prod.outlook.com (2603:1096:400:196::10) by OS3PR01MB6626.jpnprd01.prod.outlook.com (2603:1096:604:10c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Fri, 1 Jul 2022 06:10:21 +0000 Received: from TYCPR01MB9305.jpnprd01.prod.outlook.com ([fe80::8d7a:baa8:3b18:cd93]) by TYCPR01MB9305.jpnprd01.prod.outlook.com ([fe80::8d7a:baa8:3b18:cd93%6]) with mapi id 15.20.5395.015; Fri, 1 Jul 2022 06:10:21 +0000 From: "lizhijian@fujitsu.com" To: Yanjun Zhu , Jason Gunthorpe , Haakon Bugge , "linux-rdma@vger.kernel.org" , Bob Pearson CC: "lizhijian@fujitsu.com" Subject: [PATCH v4 2/3] RDMA/rxe: Generate error completion for error requester QP state Thread-Topic: [PATCH v4 2/3] RDMA/rxe: Generate error completion for error requester QP state Thread-Index: AQHYjRE+iGnVIQD7sEOrlc16O1v8ew== Date: Fri, 1 Jul 2022 06:10:21 +0000 Message-ID: <20220701061731.1582399-3-lizhijian@fujitsu.com> References: <20220701061731.1582399-1-lizhijian@fujitsu.com> In-Reply-To: <20220701061731.1582399-1-lizhijian@fujitsu.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.31.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=fujitsu.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3906e467-f71c-42b6-45b8-08da5b286164 x-ms-traffictypediagnostic: OS3PR01MB6626:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fNxATdEPkOKgpztkf0EcBkBmM/pr9Rd2G/htupaRuZzahyX9LJ5h/xGmM5MF250If/yNcbegq5Zo/kLeWKc/lhhZRdDceaJ5jb3CYOf56A3PdbYK7Bf39y3LRxfxJNpHaRXQXqDOSdvtmq3CW4U7GCv9T93PTvrLnX5kKQkjVUye9s4GilBYsK+bhW2cpmnw/fB1IRSVelhzNbZO3nkXj4oloQiYpWrra9rEmSj36+lCd3+OSm7cmrsaA/eHTBDVOrgAXE9pEZkQhLQXlMaTZZVXVLm/6hdfWWirctBUHKykyAhxrXpDP/mp45GQPSjq3Ej8noZ5T4rfxDi4DPjnuygTd+o4wvhXbOn930lB1jiPPG9hU27NB/SzxADjiuZ2nL7kID9zwIvt3Crrke7MAqNhvQIVGJioQOAoiW/gN8qPzO+WzMiUaPCipXLArkb8exrK5VnhTPhygE9VjjQNGt+dh+/Az7fVyLZLIop8Lm5HdTBimon9iMhzxoqWqh/aPRQPKGy4WoY64VWKxadumroEMJ+KlbLTwbRRtSDr38rzGWjLTTWHpRwvdYq1BiSKRHIU1Kuzo+YKGH/UhpHifjrUK3fdfcv152tI1cxPJWdXw+bRWCGldmO06EYPdZChQgKPdTCdrcbRO37NK4U2WOUMbx/P9uA9pf9u0gnoAjGDgZ1X7U1B5sJlpPnm/XyOSMYV+fpZtzldjdgwRdgEgN9BFGupDT3SFRyE9S3GRnqLuFZoWgtxYJPgsI05eQyl3PNUzQ4fe2kLpblIQqGfgZ+yZ6zl1F4/Cwb4lW9VhTRten7Krj7ptk8oB6uK7oB1 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB9305.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(366004)(396003)(376002)(136003)(39860400002)(5660300002)(36756003)(4326008)(64756008)(110136005)(8676002)(122000001)(8936002)(2906002)(38070700005)(66446008)(91956017)(186003)(41300700001)(83380400001)(85182001)(66476007)(316002)(76116006)(66946007)(6486002)(71200400001)(66556008)(82960400001)(38100700002)(478600001)(107886003)(86362001)(1076003)(6512007)(26005)(2616005)(6506007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?eucgb2312_cn?b?WGJnVmVpNHhQT3JCTWc2Ly9t?= =?eucgb2312_cn?b?ZlFwZmVoZm9Hd0dwK05vNHR5YTcreXl1cGZSZTRyNFlCd0dLN1NENUVhaTZiVzZV?= =?eucgb2312_cn?b?eG9CQjZZRmJlQjZYUDZhV3N2a3dSL3dObWpVQi9sNXFOMDRMcHhWeGo3Ylcvd2Rv?= =?eucgb2312_cn?b?dlpCT2t4ZFExL0UxUjRReU00dk16U2FFM015YzNSTWJFRDF2czBGbnNnQjhRdnFi?= =?eucgb2312_cn?b?MER4QzJ5KzRsU2ZzM2h5T2pVNkNRT1RSNVk3OEJZaVQ0Rm9Yb0tqU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C9HT1NV?= =?eucgb2312_cn?b?N0hGNFJNL1FsZ3hIMFdPSGt2clVkRHV4Y3lGa21GY1NWOVlIS3FqTWRRMU4yOW91?= =?eucgb2312_cn?b?NGtBMWxtcHpUWm9tcXNpaHFhWndoeFgveGNwQ1B4ZGszdFRmdm1TRHpZQnZUQnJr?= =?eucgb2312_cn?b?eDExaDVBYUt3NUJFdWFNOEFUMlphY2FXYUNSV3JsMFNmaFp1V2h3OUdyRklCMXI1?= =?eucgb2312_cn?b?emk1KzNGd3dqc0Q1NU1ISDRmL3c9PQ==?= MIME-Version: 1.0 X-OriginatorOrg: fujitsu.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB9305.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3906e467-f71c-42b6-45b8-08da5b286164 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2022 06:10:21.6658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a19f121d-81e1-4858-a9d8-736e267fd4c7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 7tq/8+MGoaRY/u7uG+rT4dACntnxoc+vwOs6aO2owpnQ7M6jFSdUxf9Tu3D2iVRpieAAUhawwd5L+lGVPtj0sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB6626 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 --- 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 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 4ffc4ebd6e28..7fdc8e6bf738 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -610,9 +610,22 @@ 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 so that user space + * is able to poll this completion. + */ + 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);