]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/infiniband/hw/hfi1/rc.c
IB/hfi1: Use bool in process_ecn
[karo-tx-linux.git] / drivers / infiniband / hw / hfi1 / rc.c
index 7382be11afcad663424a19e32608c1c1b39c79f7..9b3333fd9dc0bf31271d9c8f7e834114fb87451a 100644 (file)
@@ -773,7 +773,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp,
        hdr.lrh[3] = cpu_to_be16(ppd->lid | qp->remote_ah_attr.src_path_bits);
        ohdr->bth[0] = cpu_to_be32(bth0);
        ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
-       ohdr->bth[1] |= cpu_to_be32((!!is_fecn) << HFI1_BECN_SHIFT);
+       ohdr->bth[1] |= cpu_to_be32((!!is_fecn) << IB_BECN_SHIFT);
        ohdr->bth[2] = cpu_to_be32(mask_psn(qp->r_ack_psn));
 
        /* Don't try to send ACKs if the link isn't ACTIVE */
@@ -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);
@@ -1028,13 +1028,17 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)
                    cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0)
                        break;
                s_last = qp->s_last;
+               trace_hfi1_qp_send_completion(qp, wqe, s_last);
                if (++s_last >= qp->s_size)
                        s_last = 0;
                qp->s_last = s_last;
                /* see post_send() */
                barrier();
                rvt_put_swqe(wqe);
-               rvt_qp_swqe_complete(qp, wqe, IB_WC_SUCCESS);
+               rvt_qp_swqe_complete(qp,
+                                    wqe,
+                                    ib_hfi1_wc_opcode[wqe->wr.opcode],
+                                    IB_WC_SUCCESS);
        }
        /*
         * If we were waiting for sends to complete before re-sending,
@@ -1076,12 +1080,16 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp *qp,
 
                rvt_put_swqe(wqe);
                s_last = qp->s_last;
+               trace_hfi1_qp_send_completion(qp, wqe, s_last);
                if (++s_last >= qp->s_size)
                        s_last = 0;
                qp->s_last = s_last;
                /* see post_send() */
                barrier();
-               rvt_qp_swqe_complete(qp, wqe, IB_WC_SUCCESS);
+               rvt_qp_swqe_complete(qp,
+                                    wqe,
+                                    ib_hfi1_wc_opcode[wqe->wr.opcode],
+                                    IB_WC_SUCCESS);
        } else {
                struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
 
@@ -1516,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).
@@ -1540,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).
@@ -1922,7 +1930,8 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
        int diff;
        struct ib_reth *reth;
        unsigned long flags;
-       int ret, is_fecn = 0;
+       int ret;
+       bool is_fecn = false;
        bool copy_last = false;
        u32 rkey;
 
@@ -1934,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]);
-       opcode = (bth0 >> 24) & 0xff;
+       opcode = ib_bth_get_opcode(ohdr);
 
        /*
         * Process responses (ACKs) before anything else.  Note that the
@@ -2065,7 +2074,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)))
@@ -2378,7 +2387,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) {