Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp838033ybi; Fri, 12 Jul 2019 05:29:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwut1U/zqUQc3Lgl3dI67LlqMuB5A3S14bUzM+jaDmIUNAVlssQhzyXwQtQMAseOWc6CFmR X-Received: by 2002:a17:902:aa5:: with SMTP id 34mr11610126plp.166.1562934575622; Fri, 12 Jul 2019 05:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934575; cv=none; d=google.com; s=arc-20160816; b=CZcjw+gqKhyANElauNe8XiQt8ta/jd1NH82rK1Ab1YB+SGsdmL+3SLbvbX612mDQMk eWGw9EefV1bnBoy4l7hk+28XMiGwlliJov6zIRsDgWyymuPTaHM77CasVHp1GtbAMcJL tx5odf46NHJHijrUjaWwPJ8RRxWeIHU/NuKHMJQH1wVpQ0bXtxQp6ZNP7opsSWX3H++6 WLjOzizZgGoFtm6qsGEPJIlEYlMbalImQetDv21I7DvYtBHcSQv6XZv9gKetfMIDgxDf 0IBPeYJ9N+SRS+6h1skuPoFswaB3vfb45QrauLH0klW0EKs1HRdJEIHl8Nr2YNBWCC4Z 6Uxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=atpnXkPUpUYfg3E3nws/aEOUPI28q6mSOhTnkW6bgN4=; b=TRDUEk5oJkUwWjiWs3Dboaa8+D1QwckAsYBJD7duXv9e7nHybjmi4jH+QuDPab+/sJ CJ0exFWtlKkCozVNtYZEFEE+5N6g01+A2dmmyNkv7y0dO5R33Zag9c8+52MdzbZVqR5Y EVDHR7SBj52gtZWKxz4G/hpLG0ZXw4jt1+M5jIGvMvIwRiJa6pga8r+mHA/pYKC0Ip76 zvhwa2J1KvZUEmTkWybzfRMVERb5HwTtWDXUNKwH2QcXqUE6uv/hHBle+Y0UbTXUg4yQ TJh+mnP+Z4kx4wki+Y2rb9fgttwwoZv+uDG5oYSYuQM6zGMTxxqOnRFpXH0HNjt66IDl P6NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QIjq6SBD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l64si8052630pjb.93.2019.07.12.05.29.20; Fri, 12 Jul 2019 05:29:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QIjq6SBD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728794AbfGLM2S (ORCPT + 99 others); Fri, 12 Jul 2019 08:28:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:41944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727530AbfGLM2R (ORCPT ); Fri, 12 Jul 2019 08:28:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DD0D208E4; Fri, 12 Jul 2019 12:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934496; bh=tmEmSKGMfhw83BlgPKUkMGYugBLo6ioLpkf1J4gqIBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QIjq6SBDW0+w8/1ljBFTbmtoHH7sd1RypUpUR4NTJELBQLyBLtsVKOnzlh7/dkKwQ 5gGfaFD1THVw2ntxTimtpiBlNDPqbwxdTT47BWHJFB1BMyGnjcAA8mDrDtuLL/Ptav kuj9Z7oIH/11KMNbwyvdA7chLJzzxFdHCYuLKCBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Sasha Levin Subject: [PATCH 5.1 072/138] IB/hfi1: Create inline to get extended headers Date: Fri, 12 Jul 2019 14:18:56 +0200 Message-Id: <20190712121631.442816850@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 9755f72496664eec70bc804104118b5797b6bf63 ] This paves the way for another patch that reacts to a flush sdma completion for RC. Fixes: 81cd3891f021 ("IB/hfi1: Add support for 16B Management Packets") Reviewed-by: Dennis Dalessandro Signed-off-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hfi1/hfi.h | 31 +++++++++++++++++++++++++++++++ drivers/infiniband/hw/hfi1/rc.c | 21 +-------------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index 048b5d73ba39..d85b16a3aaaf 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -539,6 +539,37 @@ static inline void hfi1_16B_set_qpn(struct opa_16b_mgmt *mgmt, mgmt->src_qpn = cpu_to_be32(src_qp & OPA_16B_MGMT_QPN_MASK); } +/** + * hfi1_get_rc_ohdr - get extended header + * @opah - the opaheader + */ +static inline struct ib_other_headers * +hfi1_get_rc_ohdr(struct hfi1_opa_header *opah) +{ + struct ib_other_headers *ohdr; + struct ib_header *hdr = NULL; + struct hfi1_16b_header *hdr_16b = NULL; + + /* Find out where the BTH is */ + if (opah->hdr_type == HFI1_PKT_TYPE_9B) { + hdr = &opah->ibh; + if (ib_get_lnh(hdr) == HFI1_LRH_BTH) + ohdr = &hdr->u.oth; + else + ohdr = &hdr->u.l.oth; + } else { + u8 l4; + + hdr_16b = &opah->opah; + l4 = hfi1_16B_get_l4(hdr_16b); + if (l4 == OPA_16B_L4_IB_LOCAL) + ohdr = &hdr_16b->u.oth; + else + ohdr = &hdr_16b->u.l.oth; + } + return ohdr; +} + struct rvt_sge_state; /* diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c index 5991211d72bd..82f101878e33 100644 --- a/drivers/infiniband/hw/hfi1/rc.c +++ b/drivers/infiniband/hw/hfi1/rc.c @@ -1711,8 +1711,6 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah) struct ib_other_headers *ohdr; struct hfi1_qp_priv *priv = qp->priv; struct rvt_swqe *wqe; - struct ib_header *hdr = NULL; - struct hfi1_16b_header *hdr_16b = NULL; u32 opcode, head, tail; u32 psn; struct tid_rdma_request *req; @@ -1721,24 +1719,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah) if (!(ib_rvt_state_ops[qp->state] & RVT_SEND_OR_FLUSH_OR_RECV_OK)) return; - /* Find out where the BTH is */ - if (priv->hdr_type == HFI1_PKT_TYPE_9B) { - hdr = &opah->ibh; - if (ib_get_lnh(hdr) == HFI1_LRH_BTH) - ohdr = &hdr->u.oth; - else - ohdr = &hdr->u.l.oth; - } else { - u8 l4; - - hdr_16b = &opah->opah; - l4 = hfi1_16B_get_l4(hdr_16b); - if (l4 == OPA_16B_L4_IB_LOCAL) - ohdr = &hdr_16b->u.oth; - else - ohdr = &hdr_16b->u.l.oth; - } - + ohdr = hfi1_get_rc_ohdr(opah); opcode = ib_bth_get_opcode(ohdr); if ((opcode >= OP(RDMA_READ_RESPONSE_FIRST) && opcode <= OP(ATOMIC_ACKNOWLEDGE)) || -- 2.20.1