diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2014-07-08 05:45:10 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-08-05 10:47:33 -0400 |
commit | e316453301f02bfcaabcb86e628f3dbef2e96c7e (patch) | |
tree | 4ddd58df2ed33ae4550020888c053731b8534a78 /drivers/infiniband | |
parent | 64aa90f26c06e1cb2aacfb98a7d0eccfbd6c1a91 (diff) |
IB/ipath: Add P_Key change event support
Deliver P_Key_CHANGE event through the relevant IB device when
the local pkey table changes.
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_mad.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index 43f2d0424d4f..e890e5ba0e01 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c | |||
@@ -726,7 +726,7 @@ bail: | |||
726 | * @dd: the infinipath device | 726 | * @dd: the infinipath device |
727 | * @pkeys: the PKEY table | 727 | * @pkeys: the PKEY table |
728 | */ | 728 | */ |
729 | static int set_pkeys(struct ipath_devdata *dd, u16 *pkeys) | 729 | static int set_pkeys(struct ipath_devdata *dd, u16 *pkeys, u8 port) |
730 | { | 730 | { |
731 | struct ipath_portdata *pd; | 731 | struct ipath_portdata *pd; |
732 | int i; | 732 | int i; |
@@ -759,6 +759,7 @@ static int set_pkeys(struct ipath_devdata *dd, u16 *pkeys) | |||
759 | } | 759 | } |
760 | if (changed) { | 760 | if (changed) { |
761 | u64 pkey; | 761 | u64 pkey; |
762 | struct ib_event event; | ||
762 | 763 | ||
763 | pkey = (u64) dd->ipath_pkeys[0] | | 764 | pkey = (u64) dd->ipath_pkeys[0] | |
764 | ((u64) dd->ipath_pkeys[1] << 16) | | 765 | ((u64) dd->ipath_pkeys[1] << 16) | |
@@ -768,12 +769,17 @@ static int set_pkeys(struct ipath_devdata *dd, u16 *pkeys) | |||
768 | (unsigned long long) pkey); | 769 | (unsigned long long) pkey); |
769 | ipath_write_kreg(dd, dd->ipath_kregs->kr_partitionkey, | 770 | ipath_write_kreg(dd, dd->ipath_kregs->kr_partitionkey, |
770 | pkey); | 771 | pkey); |
772 | |||
773 | event.event = IB_EVENT_PKEY_CHANGE; | ||
774 | event.device = &dd->verbs_dev->ibdev; | ||
775 | event.element.port_num = port; | ||
776 | ib_dispatch_event(&event); | ||
771 | } | 777 | } |
772 | return 0; | 778 | return 0; |
773 | } | 779 | } |
774 | 780 | ||
775 | static int recv_subn_set_pkeytable(struct ib_smp *smp, | 781 | static int recv_subn_set_pkeytable(struct ib_smp *smp, |
776 | struct ib_device *ibdev) | 782 | struct ib_device *ibdev, u8 port) |
777 | { | 783 | { |
778 | u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); | 784 | u32 startpx = 32 * (be32_to_cpu(smp->attr_mod) & 0xffff); |
779 | __be16 *p = (__be16 *) smp->data; | 785 | __be16 *p = (__be16 *) smp->data; |
@@ -784,7 +790,7 @@ static int recv_subn_set_pkeytable(struct ib_smp *smp, | |||
784 | for (i = 0; i < n; i++) | 790 | for (i = 0; i < n; i++) |
785 | q[i] = be16_to_cpu(p[i]); | 791 | q[i] = be16_to_cpu(p[i]); |
786 | 792 | ||
787 | if (startpx != 0 || set_pkeys(dev->dd, q) != 0) | 793 | if (startpx != 0 || set_pkeys(dev->dd, q, port) != 0) |
788 | smp->status |= IB_SMP_INVALID_FIELD; | 794 | smp->status |= IB_SMP_INVALID_FIELD; |
789 | 795 | ||
790 | return recv_subn_get_pkeytable(smp, ibdev); | 796 | return recv_subn_get_pkeytable(smp, ibdev); |
@@ -1342,7 +1348,7 @@ static int process_subn(struct ib_device *ibdev, int mad_flags, | |||
1342 | ret = recv_subn_set_portinfo(smp, ibdev, port_num); | 1348 | ret = recv_subn_set_portinfo(smp, ibdev, port_num); |
1343 | goto bail; | 1349 | goto bail; |
1344 | case IB_SMP_ATTR_PKEY_TABLE: | 1350 | case IB_SMP_ATTR_PKEY_TABLE: |
1345 | ret = recv_subn_set_pkeytable(smp, ibdev); | 1351 | ret = recv_subn_set_pkeytable(smp, ibdev, port_num); |
1346 | goto bail; | 1352 | goto bail; |
1347 | case IB_SMP_ATTR_SM_INFO: | 1353 | case IB_SMP_ATTR_SM_INFO: |
1348 | if (dev->port_cap_flags & IB_PORT_SM_DISABLED) { | 1354 | if (dev->port_cap_flags & IB_PORT_SM_DISABLED) { |