Commit f150e273 authored by Sebastian Sanchez's avatar Sebastian Sanchez Committed by Jason Gunthorpe

IB/hfi1: Compute BTH only for RDMA_WRITE_LAST/SEND_LAST packet

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: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarSebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 9636258f
...@@ -2035,7 +2035,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) ...@@ -2035,7 +2035,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
struct rvt_qp *qp = packet->qp; struct rvt_qp *qp = packet->qp;
struct hfi1_ibport *ibp = rcd_to_iport(rcd); struct hfi1_ibport *ibp = rcd_to_iport(rcd);
struct ib_other_headers *ohdr = packet->ohdr; struct ib_other_headers *ohdr = packet->ohdr;
u32 bth0 = be32_to_cpu(ohdr->bth[0]);
u32 opcode = packet->opcode; u32 opcode = packet->opcode;
u32 hdrsize = packet->hlen; u32 hdrsize = packet->hlen;
u32 psn = ib_bth_get_psn(packet->ohdr); u32 psn = ib_bth_get_psn(packet->ohdr);
...@@ -2233,7 +2232,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) ...@@ -2233,7 +2232,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)
wc.port_num = 0; wc.port_num = 0;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(bth0 & IB_BTH_SOLICITED) != 0); ib_bth_is_solicited(ohdr));
break; break;
case OP(RDMA_WRITE_ONLY): case OP(RDMA_WRITE_ONLY):
......
...@@ -478,8 +478,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -478,8 +478,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
wc.port_num = 0; wc.port_num = 0;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(ohdr->bth[0] & ib_bth_is_solicited(ohdr));
cpu_to_be32(IB_BTH_SOLICITED)) != 0);
break; break;
case OP(RDMA_WRITE_FIRST): case OP(RDMA_WRITE_FIRST):
......
...@@ -1045,8 +1045,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -1045,8 +1045,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
wc.port_num = qp->port_num; wc.port_num = qp->port_num;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(ohdr->bth[0] & ib_bth_is_solicited(ohdr));
cpu_to_be32(IB_BTH_SOLICITED)) != 0);
return; return;
drop: drop:
......
...@@ -1916,8 +1916,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr, ...@@ -1916,8 +1916,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct ib_header *hdr,
wc.port_num = 0; wc.port_num = 0;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(ohdr->bth[0] & ib_bth_is_solicited(ohdr));
cpu_to_be32(IB_BTH_SOLICITED)) != 0);
break; break;
case OP(RDMA_WRITE_FIRST): case OP(RDMA_WRITE_FIRST):
......
...@@ -403,8 +403,7 @@ void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr, ...@@ -403,8 +403,7 @@ void qib_uc_rcv(struct qib_ibport *ibp, struct ib_header *hdr,
wc.port_num = 0; wc.port_num = 0;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(ohdr->bth[0] & ib_bth_is_solicited(ohdr));
cpu_to_be32(IB_BTH_SOLICITED)) != 0);
break; break;
case OP(RDMA_WRITE_FIRST): case OP(RDMA_WRITE_FIRST):
......
...@@ -581,8 +581,7 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, ...@@ -581,8 +581,7 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr,
wc.port_num = qp->port_num; wc.port_num = qp->port_num;
/* Signal completion event if the solicited bit is set. */ /* Signal completion event if the solicited bit is set. */
rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc, rvt_cq_enter(ibcq_to_rvtcq(qp->ibqp.recv_cq), &wc,
(ohdr->bth[0] & ib_bth_is_solicited(ohdr));
cpu_to_be32(IB_BTH_SOLICITED)) != 0);
return; return;
drop: drop:
......
...@@ -331,4 +331,8 @@ static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr) ...@@ -331,4 +331,8 @@ static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr)
IB_BTH_TVER_MASK); 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 */ #endif /* IB_HDRS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment