aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/qib/qib_mad.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index 9292c76380fd..ed611e8df64f 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -396,6 +396,7 @@ static int get_linkdowndefaultstate(struct qib_pportdata *ppd)
396 396
397static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags) 397static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags)
398{ 398{
399 int valid_mkey = 0;
399 int ret = 0; 400 int ret = 0;
400 401
401 /* Is the mkey in the process of expiring? */ 402 /* Is the mkey in the process of expiring? */
@@ -406,23 +407,36 @@ static int check_mkey(struct qib_ibport *ibp, struct ib_smp *smp, int mad_flags)
406 ibp->mkeyprot = 0; 407 ibp->mkeyprot = 0;
407 } 408 }
408 409
409 /* M_Key checking depends on Portinfo:M_Key_protect_bits */ 410 if ((mad_flags & IB_MAD_IGNORE_MKEY) || ibp->mkey == 0 ||
410 if ((mad_flags & IB_MAD_IGNORE_MKEY) == 0 && ibp->mkey != 0 && 411 ibp->mkey == smp->mkey)
411 ibp->mkey != smp->mkey && 412 valid_mkey = 1;
412 (smp->method == IB_MGMT_METHOD_SET || 413
413 smp->method == IB_MGMT_METHOD_TRAP_REPRESS || 414 /* Unset lease timeout on any valid Get/Set/TrapRepress */
414 (smp->method == IB_MGMT_METHOD_GET && ibp->mkeyprot >= 2))) { 415 if (valid_mkey && ibp->mkey_lease_timeout &&
415 if (ibp->mkey_violations != 0xFFFF) 416 (smp->method == IB_MGMT_METHOD_GET ||
416 ++ibp->mkey_violations; 417 smp->method == IB_MGMT_METHOD_SET ||
417 if (!ibp->mkey_lease_timeout && ibp->mkey_lease_period) 418 smp->method == IB_MGMT_METHOD_TRAP_REPRESS))
418 ibp->mkey_lease_timeout = jiffies +
419 ibp->mkey_lease_period * HZ;
420 /* Generate a trap notice. */
421 qib_bad_mkey(ibp, smp);
422 ret = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
423 } else if (ibp->mkey_lease_timeout)
424 ibp->mkey_lease_timeout = 0; 419 ibp->mkey_lease_timeout = 0;
425 420
421 if (!valid_mkey) {
422 switch (smp->method) {
423 case IB_MGMT_METHOD_GET:
424 /* Bad mkey not a violation below level 2 */
425 if (ibp->mkeyprot < 2)
426 break;
427 case IB_MGMT_METHOD_SET:
428 case IB_MGMT_METHOD_TRAP_REPRESS:
429 if (ibp->mkey_violations != 0xFFFF)
430 ++ibp->mkey_violations;
431 if (!ibp->mkey_lease_timeout && ibp->mkey_lease_period)
432 ibp->mkey_lease_timeout = jiffies +
433 ibp->mkey_lease_period * HZ;
434 /* Generate a trap notice. */
435 qib_bad_mkey(ibp, smp);
436 ret = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED;
437 }
438 }
439
426 return ret; 440 return ret;
427} 441}
428 442