IB/qib: Fix M_Key field in SubnGet and SubnGetResp MADs
authorMitko Haralanov <mitko@qlogic.com>
Fri, 4 Mar 2011 18:53:17 +0000 (18:53 +0000)
committerRoland Dreier <roland@purestorage.com>
Mon, 14 Mar 2011 19:11:51 +0000 (12:11 -0700)
Set the M_Key field in SubnGet and SugnGetResp MADs based on correctly
interpreting the protection level specified in the M_KeyProtBits field.

Signed-off-by: Mitko Haralanov <mitko@qlogic.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_mad.c

index 4b9e11cc561b8d16359bcbd3a5212fa8afabb940..8fd3df5bf04d48b8444a13bd4efab1c241181104 100644 (file)
@@ -464,8 +464,9 @@ static int subn_get_portinfo(struct ib_smp *smp, struct ib_device *ibdev,
        memset(smp->data, 0, sizeof(smp->data));
 
        /* Only return the mkey if the protection field allows it. */
-       if (smp->method == IB_MGMT_METHOD_SET || ibp->mkey == smp->mkey ||
-           ibp->mkeyprot == 0)
+       if (!(smp->method == IB_MGMT_METHOD_GET &&
+             ibp->mkey != smp->mkey &&
+             ibp->mkeyprot == 1))
                pip->mkey = ibp->mkey;
        pip->gid_prefix = ibp->gid_prefix;
        lid = ppd->lid;