aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael J. Ruhl <michael.j.ruhl@intel.com>2017-05-04 08:15:03 -0400
committerDoug Ledford <dledford@redhat.com>2017-05-04 19:31:46 -0400
commit637a9a7febf8b48d2ac1916f34d639aa81998a8a (patch)
treeb026c81565c19b9543f3103bb061fe989d919ec7
parent5fbded483c699823a7cca001a5c27ddc4d73370f (diff)
IB/hfi1: Correctly clear the pkey
In the close path the context is removed from the device array, and then the clear pkey function is called. The pkey function trys to get the context from the device array, but because it was removed the clearing does not occur. Rework pkey clear function to work as expected. Update the function variable to reflect the correct size and name of the hw_context. Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/hfi1/chip.c34
-rw-r--r--drivers/infiniband/hw/hfi1/chip.h2
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c2
-rw-r--r--drivers/infiniband/hw/hfi1/vnic_main.c2
4 files changed, 17 insertions, 23 deletions
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 5aa95dac7c4f..9f72d55feb85 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -14528,30 +14528,24 @@ done:
14528 return ret; 14528 return ret;
14529} 14529}
14530 14530
14531int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt) 14531int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt)
14532{ 14532{
14533 struct hfi1_ctxtdata *rcd; 14533 u8 hw_ctxt;
14534 unsigned sctxt;
14535 int ret = 0;
14536 u64 reg; 14534 u64 reg;
14537 14535
14538 if (ctxt < dd->num_rcv_contexts) { 14536 if (!ctxt || !ctxt->sc)
14539 rcd = dd->rcd[ctxt]; 14537 return -EINVAL;
14540 } else { 14538
14541 ret = -EINVAL; 14539 if (ctxt->ctxt >= dd->num_rcv_contexts)
14542 goto done; 14540 return -EINVAL;
14543 } 14541
14544 if (!rcd || !rcd->sc) { 14542 hw_ctxt = ctxt->sc->hw_context;
14545 ret = -EINVAL; 14543 reg = read_kctxt_csr(dd, hw_ctxt, SEND_CTXT_CHECK_ENABLE);
14546 goto done;
14547 }
14548 sctxt = rcd->sc->hw_context;
14549 reg = read_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE);
14550 reg &= ~SEND_CTXT_CHECK_ENABLE_CHECK_PARTITION_KEY_SMASK; 14544 reg &= ~SEND_CTXT_CHECK_ENABLE_CHECK_PARTITION_KEY_SMASK;
14551 write_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_ENABLE, reg); 14545 write_kctxt_csr(dd, hw_ctxt, SEND_CTXT_CHECK_ENABLE, reg);
14552 write_kctxt_csr(dd, sctxt, SEND_CTXT_CHECK_PARTITION_KEY, 0); 14546 write_kctxt_csr(dd, hw_ctxt, SEND_CTXT_CHECK_PARTITION_KEY, 0);
14553done: 14547
14554 return ret; 14548 return 0;
14555} 14549}
14556 14550
14557/* 14551/*
diff --git a/drivers/infiniband/hw/hfi1/chip.h b/drivers/infiniband/hw/hfi1/chip.h
index 4c3c88d7ec65..760aa2e17402 100644
--- a/drivers/infiniband/hw/hfi1/chip.h
+++ b/drivers/infiniband/hw/hfi1/chip.h
@@ -1362,7 +1362,7 @@ int hfi1_set_ib_cfg(struct hfi1_pportdata *ppd, int which, u32 val);
1362int hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt, u16 jkey); 1362int hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt, u16 jkey);
1363int hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt); 1363int hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt);
1364int hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt, u16 pkey); 1364int hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt, u16 pkey);
1365int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt); 1365int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt);
1366void hfi1_read_link_quality(struct hfi1_devdata *dd, u8 *link_quality); 1366void hfi1_read_link_quality(struct hfi1_devdata *dd, u8 *link_quality);
1367void hfi1_init_vnic_rsm(struct hfi1_devdata *dd); 1367void hfi1_init_vnic_rsm(struct hfi1_devdata *dd);
1368void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd); 1368void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd);
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 9574fc4722ff..5a624401b817 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -810,7 +810,7 @@ static int hfi1_file_close(struct inode *inode, struct file *fp)
810 dd->rcd[uctxt->ctxt] = NULL; 810 dd->rcd[uctxt->ctxt] = NULL;
811 811
812 hfi1_user_exp_rcv_grp_free(uctxt); 812 hfi1_user_exp_rcv_grp_free(uctxt);
813 hfi1_clear_ctxt_pkey(dd, uctxt->ctxt); 813 hfi1_clear_ctxt_pkey(dd, uctxt);
814 814
815 uctxt->rcvwait_to = 0; 815 uctxt->rcvwait_to = 0;
816 uctxt->piowait_to = 0; 816 uctxt->piowait_to = 0;
diff --git a/drivers/infiniband/hw/hfi1/vnic_main.c b/drivers/infiniband/hw/hfi1/vnic_main.c
index 392f4d57f3e3..b1572c795c35 100644
--- a/drivers/infiniband/hw/hfi1/vnic_main.c
+++ b/drivers/infiniband/hw/hfi1/vnic_main.c
@@ -209,7 +209,7 @@ static void deallocate_vnic_ctxt(struct hfi1_devdata *dd,
209 uctxt->event_flags = 0; 209 uctxt->event_flags = 0;
210 210
211 hfi1_clear_tids(uctxt); 211 hfi1_clear_tids(uctxt);
212 hfi1_clear_ctxt_pkey(dd, uctxt->ctxt); 212 hfi1_clear_ctxt_pkey(dd, uctxt);
213 213
214 hfi1_stats.sps_ctxts--; 214 hfi1_stats.sps_ctxts--;
215 hfi1_free_ctxtdata(dd, uctxt); 215 hfi1_free_ctxtdata(dd, uctxt);