aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@intel.com>2019-06-14 12:32:38 -0400
committerDoug Ledford <dledford@redhat.com>2019-06-17 21:15:40 -0400
commit9755f72496664eec70bc804104118b5797b6bf63 (patch)
treebaff4bacef69a8f11a25ccb77b9d09501a02b5d5
parent3230f4a8d44e4a0bb7afea814b280b5129521f52 (diff)
IB/hfi1: Create inline to get extended headers
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 <dennis.dalessandro@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/hfi1/hfi.h31
-rw-r--r--drivers/infiniband/hw/hfi1/rc.c21
2 files changed, 32 insertions, 20 deletions
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index b458c218842b..fa45350a9a1d 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,
539 mgmt->src_qpn = cpu_to_be32(src_qp & OPA_16B_MGMT_QPN_MASK); 539 mgmt->src_qpn = cpu_to_be32(src_qp & OPA_16B_MGMT_QPN_MASK);
540} 540}
541 541
542/**
543 * hfi1_get_rc_ohdr - get extended header
544 * @opah - the opaheader
545 */
546static inline struct ib_other_headers *
547hfi1_get_rc_ohdr(struct hfi1_opa_header *opah)
548{
549 struct ib_other_headers *ohdr;
550 struct ib_header *hdr = NULL;
551 struct hfi1_16b_header *hdr_16b = NULL;
552
553 /* Find out where the BTH is */
554 if (opah->hdr_type == HFI1_PKT_TYPE_9B) {
555 hdr = &opah->ibh;
556 if (ib_get_lnh(hdr) == HFI1_LRH_BTH)
557 ohdr = &hdr->u.oth;
558 else
559 ohdr = &hdr->u.l.oth;
560 } else {
561 u8 l4;
562
563 hdr_16b = &opah->opah;
564 l4 = hfi1_16B_get_l4(hdr_16b);
565 if (l4 == OPA_16B_L4_IB_LOCAL)
566 ohdr = &hdr_16b->u.oth;
567 else
568 ohdr = &hdr_16b->u.l.oth;
569 }
570 return ohdr;
571}
572
542struct rvt_sge_state; 573struct rvt_sge_state;
543 574
544/* 575/*
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index a922edcf23d6..707a4c52d20e 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -1709,8 +1709,6 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah)
1709 struct ib_other_headers *ohdr; 1709 struct ib_other_headers *ohdr;
1710 struct hfi1_qp_priv *priv = qp->priv; 1710 struct hfi1_qp_priv *priv = qp->priv;
1711 struct rvt_swqe *wqe; 1711 struct rvt_swqe *wqe;
1712 struct ib_header *hdr = NULL;
1713 struct hfi1_16b_header *hdr_16b = NULL;
1714 u32 opcode, head, tail; 1712 u32 opcode, head, tail;
1715 u32 psn; 1713 u32 psn;
1716 struct tid_rdma_request *req; 1714 struct tid_rdma_request *req;
@@ -1719,24 +1717,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_opa_header *opah)
1719 if (!(ib_rvt_state_ops[qp->state] & RVT_SEND_OR_FLUSH_OR_RECV_OK)) 1717 if (!(ib_rvt_state_ops[qp->state] & RVT_SEND_OR_FLUSH_OR_RECV_OK))
1720 return; 1718 return;
1721 1719
1722 /* Find out where the BTH is */ 1720 ohdr = hfi1_get_rc_ohdr(opah);
1723 if (priv->hdr_type == HFI1_PKT_TYPE_9B) {
1724 hdr = &opah->ibh;
1725 if (ib_get_lnh(hdr) == HFI1_LRH_BTH)
1726 ohdr = &hdr->u.oth;
1727 else
1728 ohdr = &hdr->u.l.oth;
1729 } else {
1730 u8 l4;
1731
1732 hdr_16b = &opah->opah;
1733 l4 = hfi1_16B_get_l4(hdr_16b);
1734 if (l4 == OPA_16B_L4_IB_LOCAL)
1735 ohdr = &hdr_16b->u.oth;
1736 else
1737 ohdr = &hdr_16b->u.l.oth;
1738 }
1739
1740 opcode = ib_bth_get_opcode(ohdr); 1721 opcode = ib_bth_get_opcode(ohdr);
1741 if ((opcode >= OP(RDMA_READ_RESPONSE_FIRST) && 1722 if ((opcode >= OP(RDMA_READ_RESPONSE_FIRST) &&
1742 opcode <= OP(ATOMIC_ACKNOWLEDGE)) || 1723 opcode <= OP(ATOMIC_ACKNOWLEDGE)) ||