IB/hfi1: Add functions to parse 9B headers
These inline functions improve code readability by enabling callers to read specific fields from the header without knowledge of byte offsets. Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Don Hiatt <don.hiatt@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
@@ -994,12 +994,12 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)
|
||||
return;
|
||||
|
||||
/* Find out where the BTH is */
|
||||
if ((be16_to_cpu(hdr->lrh[0]) & 3) == HFI1_LRH_BTH)
|
||||
if (ib_get_lnh(hdr) == HFI1_LRH_BTH)
|
||||
ohdr = &hdr->u.oth;
|
||||
else
|
||||
ohdr = &hdr->u.l.oth;
|
||||
|
||||
opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
|
||||
opcode = ib_bth_get_opcode(ohdr);
|
||||
if (opcode >= OP(RDMA_READ_RESPONSE_FIRST) &&
|
||||
opcode <= OP(ATOMIC_ACKNOWLEDGE)) {
|
||||
WARN_ON(!qp->s_rdma_ack_cnt);
|
||||
@@ -1524,7 +1524,7 @@ read_middle:
|
||||
if (!do_rc_ack(qp, aeth, psn, opcode, 0, rcd))
|
||||
goto ack_done;
|
||||
/* Get the number of bytes the message was padded by. */
|
||||
pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
|
||||
pad = ib_bth_get_pad(ohdr);
|
||||
/*
|
||||
* Check that the data size is >= 0 && <= pmtu.
|
||||
* Remember to account for ICRC (4).
|
||||
@@ -1548,7 +1548,7 @@ read_middle:
|
||||
if (unlikely(wqe->wr.opcode != IB_WR_RDMA_READ))
|
||||
goto ack_op_err;
|
||||
/* Get the number of bytes the message was padded by. */
|
||||
pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
|
||||
pad = ib_bth_get_pad(ohdr);
|
||||
/*
|
||||
* Check that the data size is >= 1 && <= pmtu.
|
||||
* Remember to account for ICRC (4).
|
||||
@@ -1942,7 +1942,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
|
||||
is_fecn = process_ecn(qp, packet, false);
|
||||
|
||||
psn = be32_to_cpu(ohdr->bth[2]);
|
||||
opcode = (bth0 >> 24) & 0xff;
|
||||
opcode = ib_bth_get_opcode(ohdr);
|
||||
|
||||
/*
|
||||
* Process responses (ACKs) before anything else. Note that the
|
||||
@@ -2073,7 +2073,7 @@ no_immediate_data:
|
||||
wc.ex.imm_data = 0;
|
||||
send_last:
|
||||
/* Get the number of bytes the message was padded by. */
|
||||
pad = (bth0 >> 20) & 3;
|
||||
pad = ib_bth_get_pad(ohdr);
|
||||
/* Check for invalid length. */
|
||||
/* LAST len should be >= 1 */
|
||||
if (unlikely(tlen < (hdrsize + pad + 4)))
|
||||
@@ -2386,7 +2386,7 @@ void hfi1_rc_hdrerr(
|
||||
return;
|
||||
|
||||
psn = be32_to_cpu(ohdr->bth[2]);
|
||||
opcode = (bth0 >> 24) & 0xff;
|
||||
opcode = ib_bth_get_opcode(ohdr);
|
||||
|
||||
/* Only deal with RDMA Writes for now */
|
||||
if (opcode < IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST) {
|
||||
|
Reference in New Issue
Block a user