diff options
author | Mike Marciniszyn <mike.marciniszyn@qlogic.com> | 2011-09-23 13:17:00 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-10-21 09:38:57 -0700 |
commit | 9fd5473deb421eb7e5575a5f9d7e43ca67c04fe9 (patch) | |
tree | cf4314fee9e1e4f501ac1114ed200c004ebadf91 /drivers/infiniband/hw/qib/qib_ruc.c | |
parent | d0f2faf72d51dacf5c5e8dec7dca22d0395896e2 (diff) | |
download | talos-op-linux-9fd5473deb421eb7e5575a5f9d7e43ca67c04fe9.tar.gz talos-op-linux-9fd5473deb421eb7e5575a5f9d7e43ca67c04fe9.zip |
IB/qib: Remove s_lock around header validation
Review of qib_ruc_check_hdr() shows that the s_lock is not required in
the normal case. The r_lock is held in all cases, and protects the qp
fields that are read.
The s_lock will be needed to around the call to qib_migrate_qp() to
insure that the send engine sees a consistent set of fields.
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_ruc.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_ruc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/qib/qib_ruc.c b/drivers/infiniband/hw/qib/qib_ruc.c index eb78d9367f06..b4b37e47321a 100644 --- a/drivers/infiniband/hw/qib/qib_ruc.c +++ b/drivers/infiniband/hw/qib/qib_ruc.c @@ -260,12 +260,15 @@ static int gid_ok(union ib_gid *gid, __be64 gid_prefix, __be64 id) /* * - * This should be called with the QP s_lock held. + * This should be called with the QP r_lock held. + * + * The s_lock will be acquired around the qib_migrate_qp() call. */ int qib_ruc_check_hdr(struct qib_ibport *ibp, struct qib_ib_header *hdr, int has_grh, struct qib_qp *qp, u32 bth0) { __be64 guid; + unsigned long flags; if (qp->s_mig_state == IB_MIG_ARMED && (bth0 & IB_BTH_MIG_REQ)) { if (!has_grh) { @@ -295,7 +298,9 @@ int qib_ruc_check_hdr(struct qib_ibport *ibp, struct qib_ib_header *hdr, if (be16_to_cpu(hdr->lrh[3]) != qp->alt_ah_attr.dlid || ppd_from_ibp(ibp)->port != qp->alt_ah_attr.port_num) goto err; + spin_lock_irqsave(&qp->s_lock, flags); qib_migrate_qp(qp); + spin_unlock_irqrestore(&qp->s_lock, flags); } else { if (!has_grh) { if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) |