Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3083971rwb; Mon, 15 Aug 2022 17:44:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RJKhCAuhncf6FaFo0yozDl/3XvEUAdUdk38TWlixenbXBh+cKu6oVKbeXgus27xeAuc3w X-Received: by 2002:a05:6402:51ce:b0:43e:74bc:dce with SMTP id r14-20020a05640251ce00b0043e74bc0dcemr17016295edd.225.1660610652743; Mon, 15 Aug 2022 17:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610652; cv=none; d=google.com; s=arc-20160816; b=YJEPpBWM3aLRxENN/6DtaOHWf29OWqrZrBWTqTcUrYy+V1PuGpveKKKfFF+wwVCGe5 2SUe5A75K+48NmMNNkiQXUKHqmkraEkd9gPz6/cgZxOY6AsKxyVeGnRVNQqpPoPEzxp7 IHsrKVXHdA1ekLh1ctle50y7DEcJD7YK84tuGZQOVfyfAGY83fy9AkwRd8aWFBYEObjF UnGIrcWb2RlBqx6U5Xbrxp4ty22rMk9Mbk2jAcZhlisPvjn6WTM5amHS+86MC+XE00uM S1YjegzMdicMKZsmwBfqMY7kUCDRRrlOYycK5YWPPcuvd4uH/6VJk9WauPh/X4g0Xwfy 11bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cFKPQHiM/HF73uug/jyRQgOv0zDCEpGIYrQQzKKYVdw=; b=PKJ4v3JvYuVx+Cu7YDcE2ZJFAlSmpuAR8UfGW+zV1tvUJq9NXWcIUn3A/c2Taoyz2d aMtRyRvETl5aspcQCoDEzfNSWeG+Tpr4sQIxmZrrTATHcZcpSl6Aae/l5VjB8qG7J4ZK vD4EJVBwow7T+u5W3GCLVUl73rPlgqrCWh8tMoUf0hOcMNulxqiw9DecLRVARCJNklZ2 lwf26+r8UraC1CwBlDRRJEexeF4DAhOh69HsH8+pCTcDpRvYnwDUCnrrTdmRvzj3wR4B dYdL0L/Qzzg6h72Y6eCGZtAZ6WHiLa4+ej5xHu3kjvCxkzkZ02+LOcy9TNhJ7NVym7bg ufBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IY36Nvoy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn14-20020a17090794ce00b00730a0ca675asi7379339ejc.380.2022.08.15.17.43.47; Mon, 15 Aug 2022 17:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IY36Nvoy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351011AbiHPAUX (ORCPT + 99 others); Mon, 15 Aug 2022 20:20:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357445AbiHPANg (ORCPT ); Mon, 15 Aug 2022 20:13:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF4515D888; Mon, 15 Aug 2022 13:30:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2194B61057; Mon, 15 Aug 2022 20:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 289F8C433D6; Mon, 15 Aug 2022 20:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595406; bh=FsTM63fKqrQhD58pgBUPeFDJ8S+3PWu0hrxKXaYf4pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IY36NvoyrjGi8I3f6MXgxflsgU48QpmsYKpl4gBL6eK6lh5py23MqYLpBPnSQKqox EuYRQHFEPbJB1BupevJ27loCGVsdAvBhhGLoHY0iJD3vl+xWI32/c7BrWmWX7ziPqy QAa228nrH+07nu2WVtd2r1C+PjBJAhABzdxMLen8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.19 0753/1157] RDMA/rxe: Add a responder state for atomic reply Date: Mon, 15 Aug 2022 20:01:49 +0200 Message-Id: <20220815180509.629844107@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Pearson [ Upstream commit 0ed5493e430a1d887eb62b45c75dd5d6bb2dcf48 ] Add a responder state for atomic reply similar to read reply and rename process_atomic() rxe_atomic_reply(). In preparation for merging the normal and retry atomic responder flows. Link: https://lore.kernel.org/r/20220606143836.3323-3-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index f4f6ee5d81fe..e38bf958ab48 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -21,6 +21,7 @@ enum resp_states { RESPST_CHK_RKEY, RESPST_EXECUTE, RESPST_READ_REPLY, + RESPST_ATOMIC_REPLY, RESPST_COMPLETE, RESPST_ACKNOWLEDGE, RESPST_CLEANUP, @@ -55,6 +56,7 @@ static char *resp_state_name[] = { [RESPST_CHK_RKEY] = "CHK_RKEY", [RESPST_EXECUTE] = "EXECUTE", [RESPST_READ_REPLY] = "READ_REPLY", + [RESPST_ATOMIC_REPLY] = "ATOMIC_REPLY", [RESPST_COMPLETE] = "COMPLETE", [RESPST_ACKNOWLEDGE] = "ACKNOWLEDGE", [RESPST_CLEANUP] = "CLEANUP", @@ -552,8 +554,8 @@ static enum resp_states write_data_in(struct rxe_qp *qp, /* Guarantee atomicity of atomic operations at the machine level. */ static DEFINE_SPINLOCK(atomic_ops_lock); -static enum resp_states process_atomic(struct rxe_qp *qp, - struct rxe_pkt_info *pkt) +static enum resp_states rxe_atomic_reply(struct rxe_qp *qp, + struct rxe_pkt_info *pkt) { u64 *vaddr; enum resp_states ret; @@ -585,7 +587,16 @@ static enum resp_states process_atomic(struct rxe_qp *qp, spin_unlock_bh(&atomic_ops_lock); - ret = RESPST_NONE; + qp->resp.msn++; + + /* next expected psn, read handles this separately */ + qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK; + qp->resp.ack_psn = qp->resp.psn; + + qp->resp.opcode = pkt->opcode; + qp->resp.status = IB_WC_SUCCESS; + + ret = RESPST_ACKNOWLEDGE; out: return ret; } @@ -858,9 +869,7 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) qp->resp.msn++; return RESPST_READ_REPLY; } else if (pkt->mask & RXE_ATOMIC_MASK) { - err = process_atomic(qp, pkt); - if (err) - return err; + return RESPST_ATOMIC_REPLY; } else { /* Unreachable */ WARN_ON_ONCE(1); @@ -1316,6 +1325,9 @@ int rxe_responder(void *arg) case RESPST_READ_REPLY: state = read_reply(qp, pkt); break; + case RESPST_ATOMIC_REPLY: + state = rxe_atomic_reply(qp, pkt); + break; case RESPST_ACKNOWLEDGE: state = acknowledge(qp, pkt); break; -- 2.35.1