]> git.dujemihanovic.xyz Git - linux.git/commitdiff
IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet
authorSebastian Sanchez <sebastian.sanchez@intel.com>
Thu, 1 Feb 2018 18:46:15 +0000 (10:46 -0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 1 Feb 2018 22:43:28 +0000 (15:43 -0700)
In hfi1_rc_rcv(), BTH is computed for all packets received.
However, it's only used for packets received with opcodes
RDMA_WRITE_LAST and SEND_LAST, and it is a costly operation.

Compute BTH only in the RDMA_WRITE_LAST/SEND_LAST code path
and let the compiler handle endianness conversion for bitwise
operations.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/hfi1/rc.c
drivers/infiniband/hw/hfi1/uc.c
drivers/infiniband/hw/hfi1/ud.c
drivers/infiniband/hw/qib/qib_rc.c
drivers/infiniband/hw/qib/qib_uc.c
drivers/infiniband/hw/qib/qib_ud.c
include/rdma/ib_hdrs.h

index 524c12f04bd982193f7bb113424dd26876e39b3d..70aa82b305d80fb23f15b902413a5ba407f59c18 100644 (file)
@@ -2035,7 +2035,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
        struct rvt_qp *qp = packet->qp;
        struct hfi1_ibport *ibp = rcd_to_iport(rcd);
        struct ib_other_headers *ohdr = packet->ohdr;
-       u32 bth0 = be32_to_cpu(ohdr->bth[0]);
        u32 opcode = packet->opcode;
        u32 hdrsize = packet->hlen;
        u32 psn = ib_bth_get_psn(packet->ohdr);
@@ -2233,7 +2232,7 @@ send_last:
                wc.port_num = 0;
                /* Signal completion event if the solicited bit is set. */
                rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                            (bth0 & IB_BTH_SOLICITED) != 0);
+                            ib_bth_is_solicited(ohdr));
                break;
 
        case OP(RDMA_WRITE_ONLY):
index fef69d98386c4c7ad1e77f7b3ff42253cf09b2c5..8030c38a27f2fdcc7bcdade513c78be583ca514d 100644 (file)
@@ -478,8 +478,7 @@ last_imm:
                wc.port_num = 0;
                /* Signal completion event if the solicited bit is set. */
                rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                            (ohdr->bth[0] &
-                             cpu_to_be32(IB_BTH_SOLICITED)) != 0);
+                            ib_bth_is_solicited(ohdr));
                break;
 
        case OP(RDMA_WRITE_FIRST):
index 6b5cd3a86be431232e7e6e5a0f5714c087d98702..cff2fd8907f5133a2dd2961e5813ee3b9ca4e384 100644 (file)
@@ -1045,8 +1045,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
        wc.port_num = qp->port_num;
        /* Signal completion event if the solicited bit is set. */
        rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                    (ohdr->bth[0] &
-                     cpu_to_be32(IB_BTH_SOLICITED)) != 0);
+                    ib_bth_is_solicited(ohdr));
        return;
 
 drop:
index e4a9ba1dd9ba58530c37cb08ab29548c771a51d6..61d3bc6771f0d214ff436656909db36bfc4fb8e6 100644 (file)
@@ -1916,8 +1916,7 @@ send_last:
                wc.port_num = 0;
                /* Signal completion event if the solicited bit is set. */
                rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                            (ohdr->bth[0] &
-                             cpu_to_be32(IB_BTH_SOLICITED)) != 0);
+                            ib_bth_is_solicited(ohdr));
                break;
 
        case OP(RDMA_WRITE_FIRST):
index bddcc37ace4420937c5fde681edf29169a3e36c3..d311db6487cfe43b6eaaf6e23266828a1625cb65 100644 (file)
@@ -403,8 +403,7 @@ last_imm:
                wc.port_num = 0;
                /* Signal completion event if the solicited bit is set. */
                rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                            (ohdr->bth[0] &
-                               cpu_to_be32(IB_BTH_SOLICITED)) != 0);
+                            ib_bth_is_solicited(ohdr));
                break;
 
        case OP(RDMA_WRITE_FIRST):
index 15962ed193cea0515bcda715ed536f3983d66ed8..59a4f0333803b1a6ece85ca7d0a44b345e8c485f 100644 (file)
@@ -581,8 +581,7 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr,
        wc.port_num = qp->port_num;
        /* Signal completion event if the solicited bit is set. */
        rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
-                    (ohdr->bth[0] &
-                       cpu_to_be32(IB_BTH_SOLICITED)) != 0);
+                    ib_bth_is_solicited(ohdr));
        return;
 
 drop:
index c124d515f7d545951dfc105d95ba1794a987e2bf..6b1e8039971d89144ba6c3b14d51f93e6e176eea 100644 (file)
@@ -331,4 +331,8 @@ static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr)
                    IB_BTH_TVER_MASK);
 }
 
+static inline bool ib_bth_is_solicited(struct ib_other_headers *ohdr)
+{
+       return ohdr->bth[0] & cpu_to_be32(IB_BTH_SOLICITED);
+}
 #endif                          /* IB_HDRS_H */