IB/qib: Decode path MTU optimization

Store both the encoded and decoded MTU in the QP structure as a minor
optimization for UC/RC receive routines.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
Mike Marciniszyn 2011-09-23 13:16:34 -04:00 committed by Roland Dreier
parent 2fc109c890
commit cc6ea1385b
4 changed files with 9 additions and 6 deletions

View File

@ -765,8 +765,10 @@ int qib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
} }
} }
if (attr_mask & IB_QP_PATH_MTU) if (attr_mask & IB_QP_PATH_MTU) {
qp->path_mtu = pmtu; qp->path_mtu = pmtu;
qp->pmtu = ib_mtu_enum_to_int(pmtu);
}
if (attr_mask & IB_QP_RETRY_CNT) { if (attr_mask & IB_QP_RETRY_CNT) {
qp->s_retry_cnt = attr->retry_cnt; qp->s_retry_cnt = attr->retry_cnt;

View File

@ -239,7 +239,7 @@ int qib_make_rc_req(struct qib_qp *qp)
u32 len; u32 len;
u32 bth0; u32 bth0;
u32 bth2; u32 bth2;
u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); u32 pmtu = qp->pmtu;
char newreq; char newreq;
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
@ -1732,7 +1732,7 @@ static int qib_rc_rcv_error(struct qib_other_headers *ohdr,
* same request. * same request.
*/ */
offset = ((psn - e->psn) & QIB_PSN_MASK) * offset = ((psn - e->psn) & QIB_PSN_MASK) *
ib_mtu_enum_to_int(qp->path_mtu); qp->pmtu;
len = be32_to_cpu(reth->length); len = be32_to_cpu(reth->length);
if (unlikely(offset + len != e->rdma_sge.sge_length)) if (unlikely(offset + len != e->rdma_sge.sge_length))
goto unlock_done; goto unlock_done;
@ -1876,7 +1876,7 @@ void qib_rc_rcv(struct qib_ctxtdata *rcd, struct qib_ib_header *hdr,
u32 psn; u32 psn;
u32 pad; u32 pad;
struct ib_wc wc; struct ib_wc wc;
u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); u32 pmtu = qp->pmtu;
int diff; int diff;
struct ib_reth *reth; struct ib_reth *reth;
unsigned long flags; unsigned long flags;

View File

@ -51,7 +51,7 @@ int qib_make_uc_req(struct qib_qp *qp)
u32 hwords; u32 hwords;
u32 bth0; u32 bth0;
u32 len; u32 len;
u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); u32 pmtu = qp->pmtu;
int ret = 0; int ret = 0;
spin_lock_irqsave(&qp->s_lock, flags); spin_lock_irqsave(&qp->s_lock, flags);
@ -249,7 +249,7 @@ void qib_uc_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
u32 psn; u32 psn;
u32 pad; u32 pad;
struct ib_wc wc; struct ib_wc wc;
u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); u32 pmtu = qp->pmtu;
struct ib_reth *reth; struct ib_reth *reth;
int ret; int ret;

View File

@ -485,6 +485,7 @@ struct qib_qp {
u8 alt_timeout; /* Alternate path timeout for this QP */ u8 alt_timeout; /* Alternate path timeout for this QP */
u8 port_num; u8 port_num;
enum ib_mtu path_mtu; enum ib_mtu path_mtu;
u32 pmtu; /* decoded from path_mtu */
u32 remote_qpn; u32 remote_qpn;
u32 qkey; /* QKEY for this QP (for UD or RD) */ u32 qkey; /* QKEY for this QP (for UD or RD) */
u32 s_size; /* send work queue size */ u32 s_size; /* send work queue size */