Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dafbab3 authored by Don Hiatt's avatar Don Hiatt Committed by Doug Ledford
Browse files

IB/hfi1: Add functions to parse BTH/IB headers



Improve code readablity by adding inline functions
to read specific BTH/IB fields without knowledge of
byte offsets.

Reviewed-by: default avatarBrian Welty <brian.welty@intel.com>
Reviewed-by: default avatarDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDon Hiatt <don.hiatt@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent aa560df3
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
			goto drop;
		}
		/* Get the destination QP number. */
		qp_num = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK;
		qp_num = ib_bth_get_qpn(ohdr);
		if (lid < be16_to_cpu(IB_MULTICAST_LID_BASE)) {
			struct rvt_qp *qp;
			unsigned long flags;
@@ -438,7 +438,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
	case IB_QPT_GSI:
	case IB_QPT_UD:
		rlid = ib_get_slid(hdr);
		rqpn = be32_to_cpu(ohdr->u.ud.deth[1]) & RVT_QPN_MASK;
		rqpn = ib_get_sqpn(ohdr);
		svc_type = IB_CC_SVCTYPE_UD;
		is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
			(dlid != be16_to_cpu(IB_LID_PERMISSIVE));
@@ -461,7 +461,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,

	bth1 = be32_to_cpu(ohdr->bth[1]);
	if (do_cnp && (bth1 & IB_FECN_SMASK)) {
		u16 pkey = (u16)be32_to_cpu(ohdr->bth[0]);
		u16 pkey = ib_bth_get_pkey(ohdr);

		return_cnp(ibp, qp, rqpn, pkey, dlid, rlid, sc, grh);
	}
+4 −4
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
		ohdr->u.aeth = rvt_compute_aeth(qp);
	sc5 = ibp->sl_to_sc[rdma_ah_get_sl(&qp->remote_ah_attr)];
	/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */
	pbc_flags |= ((!!(sc5 & 0x10)) << PBC_DC_INFO_SHIFT);
	pbc_flags |= (ib_is_sc5(sc5) << PBC_DC_INFO_SHIFT);
	lrh0 |= (sc5 & 0xf) << 12 | (rdma_ah_get_sl(&qp->remote_ah_attr)
				     & 0xf) << 4;
	hdr.lrh[0] = cpu_to_be16(lrh0);
@@ -1009,7 +1009,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)
		return;
	}

	psn = be32_to_cpu(ohdr->bth[2]);
	psn = ib_bth_get_psn(ohdr);
	reset_sending_psn(qp, psn);

	/*
@@ -1943,7 +1943,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)

	is_fecn = process_ecn(qp, packet, false);

	psn = be32_to_cpu(ohdr->bth[2]);
	psn = ib_bth_get_psn(ohdr);
	opcode = ib_bth_get_opcode(ohdr);

	/*
@@ -2388,7 +2388,7 @@ void hfi1_rc_hdrerr(
	if (hfi1_ruc_check_hdr(ibp, hdr, has_grh, qp, bth0))
		return;

	psn = be32_to_cpu(ohdr->bth[2]);
	psn = ib_bth_get_psn(ohdr);
	opcode = ib_bth_get_opcode(ohdr);

	/* Only deal with RDMA Writes for now */
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)

	process_ecn(qp, packet, true);

	psn = be32_to_cpu(ohdr->bth[2]);
	psn = ib_bth_get_psn(ohdr);
	opcode = ib_bth_get_opcode(ohdr);

	/* Compare the PSN verses the expected PSN. */
+3 −3
Original line number Diff line number Diff line
@@ -549,7 +549,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
	hdr.lrh[3] = cpu_to_be16(slid);

	plen = 2 /* PBC */ + hwords;
	pbc_flags |= (!!(sc5 & 0x10)) << PBC_DC_INFO_SHIFT;
	pbc_flags |= (ib_is_sc5(sc5) << PBC_DC_INFO_SHIFT);
	vl = sc_to_vlt(ppd->dd, sc5);
	pbc = create_pbc(ppd, pbc_flags, qp->srate_mbps, vl, plen);
	if (ctxt) {
@@ -689,8 +689,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
	u16 slid;
	u8 extra_bytes;

	qkey = be32_to_cpu(ohdr->u.ud.deth[0]);
	src_qp = be32_to_cpu(ohdr->u.ud.deth[1]) & RVT_QPN_MASK;
	qkey = ib_get_qkey(ohdr);
	src_qp = ib_get_sqpn(ohdr);
	dlid = ib_get_dlid(hdr);
	bth1 = be32_to_cpu(ohdr->bth[1]);
	slid = ib_get_slid(hdr);
+3 −3
Original line number Diff line number Diff line
@@ -595,7 +595,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)
	inc_opstats(tlen, &rcd->opstats->stats[opcode]);

	/* Get the destination QP number. */
	qp_num = be32_to_cpu(packet->ohdr->bth[1]) & RVT_QPN_MASK;
	qp_num = ib_bth_get_qpn(packet->ohdr);
	lid = ib_get_dlid(hdr);
	if (unlikely((lid >= be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
		     (lid != be16_to_cpu(IB_LID_PERMISSIVE)))) {
@@ -863,7 +863,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,

			/* No vl15 here */
			/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */
			pbc |= (!!(sc5 & 0x10)) << PBC_DC_INFO_SHIFT;
			pbc |= (ib_is_sc5(sc5) << PBC_DC_INFO_SHIFT);

			if (unlikely(hfi1_dbg_fault_opcode(qp, opcode, false)))
				pbc = hfi1_fault_tx(qp, opcode, pbc);
@@ -999,7 +999,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
		u8 opcode = get_opcode(&tx->phdr.hdr);

		/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */
		pbc |= (!!(sc5 & 0x10)) << PBC_DC_INFO_SHIFT;
		pbc |= (ib_is_sc5(sc5) << PBC_DC_INFO_SHIFT);
		if (unlikely(hfi1_dbg_fault_opcode(qp, opcode, false)))
			pbc = hfi1_fault_tx(qp, opcode, pbc);
		pbc = create_pbc(ppd, pbc, qp->srate_mbps, vl, plen);
Loading