aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c198
1 files changed, 33 insertions, 165 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index ceb98ee78666..43f2d0424d4f 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <rdma/ib_smi.h> 34#include <rdma/ib_smi.h>
35#include <rdma/ib_pma.h>
35 36
36#include "ipath_kernel.h" 37#include "ipath_kernel.h"
37#include "ipath_verbs.h" 38#include "ipath_verbs.h"
@@ -789,151 +790,18 @@ static int recv_subn_set_pkeytable(struct ib_smp *smp,
789 return recv_subn_get_pkeytable(smp, ibdev); 790 return recv_subn_get_pkeytable(smp, ibdev);
790} 791}
791 792
792#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) 793static int recv_pma_get_classportinfo(struct ib_pma_mad *pmp)
793#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
794#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
795#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
796#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
797#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
798
799struct ib_perf {
800 u8 base_version;
801 u8 mgmt_class;
802 u8 class_version;
803 u8 method;
804 __be16 status;
805 __be16 unused;
806 __be64 tid;
807 __be16 attr_id;
808 __be16 resv;
809 __be32 attr_mod;
810 u8 reserved[40];
811 u8 data[192];
812} __attribute__ ((packed));
813
814struct ib_pma_classportinfo {
815 u8 base_version;
816 u8 class_version;
817 __be16 cap_mask;
818 u8 reserved[3];
819 u8 resp_time_value; /* only lower 5 bits */
820 union ib_gid redirect_gid;
821 __be32 redirect_tc_sl_fl; /* 8, 4, 20 bits respectively */
822 __be16 redirect_lid;
823 __be16 redirect_pkey;
824 __be32 redirect_qp; /* only lower 24 bits */
825 __be32 redirect_qkey;
826 union ib_gid trap_gid;
827 __be32 trap_tc_sl_fl; /* 8, 4, 20 bits respectively */
828 __be16 trap_lid;
829 __be16 trap_pkey;
830 __be32 trap_hl_qp; /* 8, 24 bits respectively */
831 __be32 trap_qkey;
832} __attribute__ ((packed));
833
834struct ib_pma_portsamplescontrol {
835 u8 opcode;
836 u8 port_select;
837 u8 tick;
838 u8 counter_width; /* only lower 3 bits */
839 __be32 counter_mask0_9; /* 2, 10 * 3, bits */
840 __be16 counter_mask10_14; /* 1, 5 * 3, bits */
841 u8 sample_mechanisms;
842 u8 sample_status; /* only lower 2 bits */
843 __be64 option_mask;
844 __be64 vendor_mask;
845 __be32 sample_start;
846 __be32 sample_interval;
847 __be16 tag;
848 __be16 counter_select[15];
849} __attribute__ ((packed));
850
851struct ib_pma_portsamplesresult {
852 __be16 tag;
853 __be16 sample_status; /* only lower 2 bits */
854 __be32 counter[15];
855} __attribute__ ((packed));
856
857struct ib_pma_portsamplesresult_ext {
858 __be16 tag;
859 __be16 sample_status; /* only lower 2 bits */
860 __be32 extended_width; /* only upper 2 bits */
861 __be64 counter[15];
862} __attribute__ ((packed));
863
864struct ib_pma_portcounters {
865 u8 reserved;
866 u8 port_select;
867 __be16 counter_select;
868 __be16 symbol_error_counter;
869 u8 link_error_recovery_counter;
870 u8 link_downed_counter;
871 __be16 port_rcv_errors;
872 __be16 port_rcv_remphys_errors;
873 __be16 port_rcv_switch_relay_errors;
874 __be16 port_xmit_discards;
875 u8 port_xmit_constraint_errors;
876 u8 port_rcv_constraint_errors;
877 u8 reserved1;
878 u8 lli_ebor_errors; /* 4, 4, bits */
879 __be16 reserved2;
880 __be16 vl15_dropped;
881 __be32 port_xmit_data;
882 __be32 port_rcv_data;
883 __be32 port_xmit_packets;
884 __be32 port_rcv_packets;
885} __attribute__ ((packed));
886
887#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
888#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
889#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
890#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
891#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
892#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
893#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
894#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
895#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
896#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
897#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
898#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
899#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
900
901struct ib_pma_portcounters_ext {
902 u8 reserved;
903 u8 port_select;
904 __be16 counter_select;
905 __be32 reserved1;
906 __be64 port_xmit_data;
907 __be64 port_rcv_data;
908 __be64 port_xmit_packets;
909 __be64 port_rcv_packets;
910 __be64 port_unicast_xmit_packets;
911 __be64 port_unicast_rcv_packets;
912 __be64 port_multicast_xmit_packets;
913 __be64 port_multicast_rcv_packets;
914} __attribute__ ((packed));
915
916#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
917#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
918#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
919#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
920#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
921#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
922#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
923#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
924
925static int recv_pma_get_classportinfo(struct ib_perf *pmp)
926{ 794{
927 struct ib_pma_classportinfo *p = 795 struct ib_class_port_info *p =
928 (struct ib_pma_classportinfo *)pmp->data; 796 (struct ib_class_port_info *)pmp->data;
929 797
930 memset(pmp->data, 0, sizeof(pmp->data)); 798 memset(pmp->data, 0, sizeof(pmp->data));
931 799
932 if (pmp->attr_mod != 0) 800 if (pmp->mad_hdr.attr_mod != 0)
933 pmp->status |= IB_SMP_INVALID_FIELD; 801 pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
934 802
935 /* Indicate AllPortSelect is valid (only one port anyway) */ 803 /* Indicate AllPortSelect is valid (only one port anyway) */
936 p->cap_mask = cpu_to_be16(1 << 8); 804 p->capability_mask = cpu_to_be16(1 << 8);
937 p->base_version = 1; 805 p->base_version = 1;
938 p->class_version = 1; 806 p->class_version = 1;
939 /* 807 /*
@@ -957,7 +825,7 @@ static int recv_pma_get_classportinfo(struct ib_perf *pmp)
957 COUNTER_MASK(1, 3) | \ 825 COUNTER_MASK(1, 3) | \
958 COUNTER_MASK(1, 4)) 826 COUNTER_MASK(1, 4))
959 827
960static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp, 828static int recv_pma_get_portsamplescontrol(struct ib_pma_mad *pmp,
961 struct ib_device *ibdev, u8 port) 829 struct ib_device *ibdev, u8 port)
962{ 830{
963 struct ib_pma_portsamplescontrol *p = 831 struct ib_pma_portsamplescontrol *p =
@@ -970,9 +838,9 @@ static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp,
970 memset(pmp->data, 0, sizeof(pmp->data)); 838 memset(pmp->data, 0, sizeof(pmp->data));
971 839
972 p->port_select = port_select; 840 p->port_select = port_select;
973 if (pmp->attr_mod != 0 || 841 if (pmp->mad_hdr.attr_mod != 0 ||
974 (port_select != port && port_select != 0xFF)) 842 (port_select != port && port_select != 0xFF))
975 pmp->status |= IB_SMP_INVALID_FIELD; 843 pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
976 /* 844 /*
977 * Ticks are 10x the link transfer period which for 2.5Gbs is 4 845 * Ticks are 10x the link transfer period which for 2.5Gbs is 4
978 * nsec. 0 == 4 nsec., 1 == 8 nsec., ..., 255 == 1020 nsec. Sample 846 * nsec. 0 == 4 nsec., 1 == 8 nsec., ..., 255 == 1020 nsec. Sample
@@ -1006,7 +874,7 @@ static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp,
1006 return reply((struct ib_smp *) pmp); 874 return reply((struct ib_smp *) pmp);
1007} 875}
1008 876
1009static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp, 877static int recv_pma_set_portsamplescontrol(struct ib_pma_mad *pmp,
1010 struct ib_device *ibdev, u8 port) 878 struct ib_device *ibdev, u8 port)
1011{ 879{
1012 struct ib_pma_portsamplescontrol *p = 880 struct ib_pma_portsamplescontrol *p =
@@ -1017,9 +885,9 @@ static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp,
1017 u8 status; 885 u8 status;
1018 int ret; 886 int ret;
1019 887
1020 if (pmp->attr_mod != 0 || 888 if (pmp->mad_hdr.attr_mod != 0 ||
1021 (p->port_select != port && p->port_select != 0xFF)) { 889 (p->port_select != port && p->port_select != 0xFF)) {
1022 pmp->status |= IB_SMP_INVALID_FIELD; 890 pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
1023 ret = reply((struct ib_smp *) pmp); 891 ret = reply((struct ib_smp *) pmp);
1024 goto bail; 892 goto bail;
1025 } 893 }
@@ -1093,7 +961,7 @@ static u64 get_counter(struct ipath_ibdev *dev,
1093 return ret; 961 return ret;
1094} 962}
1095 963
1096static int recv_pma_get_portsamplesresult(struct ib_perf *pmp, 964static int recv_pma_get_portsamplesresult(struct ib_pma_mad *pmp,
1097 struct ib_device *ibdev) 965 struct ib_device *ibdev)
1098{ 966{
1099 struct ib_pma_portsamplesresult *p = 967 struct ib_pma_portsamplesresult *p =
@@ -1118,7 +986,7 @@ static int recv_pma_get_portsamplesresult(struct ib_perf *pmp,
1118 return reply((struct ib_smp *) pmp); 986 return reply((struct ib_smp *) pmp);
1119} 987}
1120 988
1121static int recv_pma_get_portsamplesresult_ext(struct ib_perf *pmp, 989static int recv_pma_get_portsamplesresult_ext(struct ib_pma_mad *pmp,
1122 struct ib_device *ibdev) 990 struct ib_device *ibdev)
1123{ 991{
1124 struct ib_pma_portsamplesresult_ext *p = 992 struct ib_pma_portsamplesresult_ext *p =
@@ -1145,7 +1013,7 @@ static int recv_pma_get_portsamplesresult_ext(struct ib_perf *pmp,
1145 return reply((struct ib_smp *) pmp); 1013 return reply((struct ib_smp *) pmp);
1146} 1014}
1147 1015
1148static int recv_pma_get_portcounters(struct ib_perf *pmp, 1016static int recv_pma_get_portcounters(struct ib_pma_mad *pmp,
1149 struct ib_device *ibdev, u8 port) 1017 struct ib_device *ibdev, u8 port)
1150{ 1018{
1151 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) 1019 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
@@ -1179,9 +1047,9 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
1179 memset(pmp->data, 0, sizeof(pmp->data)); 1047 memset(pmp->data, 0, sizeof(pmp->data));
1180 1048
1181 p->port_select = port_select; 1049 p->port_select = port_select;
1182 if (pmp->attr_mod != 0 || 1050 if (pmp->mad_hdr.attr_mod != 0 ||
1183 (port_select != port && port_select != 0xFF)) 1051 (port_select != port && port_select != 0xFF))
1184 pmp->status |= IB_SMP_INVALID_FIELD; 1052 pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
1185 1053
1186 if (cntrs.symbol_error_counter > 0xFFFFUL) 1054 if (cntrs.symbol_error_counter > 0xFFFFUL)
1187 p->symbol_error_counter = cpu_to_be16(0xFFFF); 1055 p->symbol_error_counter = cpu_to_be16(0xFFFF);
@@ -1216,7 +1084,7 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
1216 cntrs.local_link_integrity_errors = 0xFUL; 1084 cntrs.local_link_integrity_errors = 0xFUL;
1217 if (cntrs.excessive_buffer_overrun_errors > 0xFUL) 1085 if (cntrs.excessive_buffer_overrun_errors > 0xFUL)
1218 cntrs.excessive_buffer_overrun_errors = 0xFUL; 1086 cntrs.excessive_buffer_overrun_errors = 0xFUL;
1219 p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) | 1087 p->link_overrun_errors = (cntrs.local_link_integrity_errors << 4) |
1220 cntrs.excessive_buffer_overrun_errors; 1088 cntrs.excessive_buffer_overrun_errors;
1221 if (cntrs.vl15_dropped > 0xFFFFUL) 1089 if (cntrs.vl15_dropped > 0xFFFFUL)
1222 p->vl15_dropped = cpu_to_be16(0xFFFF); 1090 p->vl15_dropped = cpu_to_be16(0xFFFF);
@@ -1244,7 +1112,7 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
1244 return reply((struct ib_smp *) pmp); 1112 return reply((struct ib_smp *) pmp);
1245} 1113}
1246 1114
1247static int recv_pma_get_portcounters_ext(struct ib_perf *pmp, 1115static int recv_pma_get_portcounters_ext(struct ib_pma_mad *pmp,
1248 struct ib_device *ibdev, u8 port) 1116 struct ib_device *ibdev, u8 port)
1249{ 1117{
1250 struct ib_pma_portcounters_ext *p = 1118 struct ib_pma_portcounters_ext *p =
@@ -1265,9 +1133,9 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
1265 memset(pmp->data, 0, sizeof(pmp->data)); 1133 memset(pmp->data, 0, sizeof(pmp->data));
1266 1134
1267 p->port_select = port_select; 1135 p->port_select = port_select;
1268 if (pmp->attr_mod != 0 || 1136 if (pmp->mad_hdr.attr_mod != 0 ||
1269 (port_select != port && port_select != 0xFF)) 1137 (port_select != port && port_select != 0xFF))
1270 pmp->status |= IB_SMP_INVALID_FIELD; 1138 pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD;
1271 1139
1272 p->port_xmit_data = cpu_to_be64(swords); 1140 p->port_xmit_data = cpu_to_be64(swords);
1273 p->port_rcv_data = cpu_to_be64(rwords); 1141 p->port_rcv_data = cpu_to_be64(rwords);
@@ -1281,7 +1149,7 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp,
1281 return reply((struct ib_smp *) pmp); 1149 return reply((struct ib_smp *) pmp);
1282} 1150}
1283 1151
1284static int recv_pma_set_portcounters(struct ib_perf *pmp, 1152static int recv_pma_set_portcounters(struct ib_pma_mad *pmp,
1285 struct ib_device *ibdev, u8 port) 1153 struct ib_device *ibdev, u8 port)
1286{ 1154{
1287 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) 1155 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
@@ -1344,7 +1212,7 @@ static int recv_pma_set_portcounters(struct ib_perf *pmp,
1344 return recv_pma_get_portcounters(pmp, ibdev, port); 1212 return recv_pma_get_portcounters(pmp, ibdev, port);
1345} 1213}
1346 1214
1347static int recv_pma_set_portcounters_ext(struct ib_perf *pmp, 1215static int recv_pma_set_portcounters_ext(struct ib_pma_mad *pmp,
1348 struct ib_device *ibdev, u8 port) 1216 struct ib_device *ibdev, u8 port)
1349{ 1217{
1350 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) 1218 struct ib_pma_portcounters *p = (struct ib_pma_portcounters *)
@@ -1518,19 +1386,19 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
1518 struct ib_mad *in_mad, 1386 struct ib_mad *in_mad,
1519 struct ib_mad *out_mad) 1387 struct ib_mad *out_mad)
1520{ 1388{
1521 struct ib_perf *pmp = (struct ib_perf *)out_mad; 1389 struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad;
1522 int ret; 1390 int ret;
1523 1391
1524 *out_mad = *in_mad; 1392 *out_mad = *in_mad;
1525 if (pmp->class_version != 1) { 1393 if (pmp->mad_hdr.class_version != 1) {
1526 pmp->status |= IB_SMP_UNSUP_VERSION; 1394 pmp->mad_hdr.status |= IB_SMP_UNSUP_VERSION;
1527 ret = reply((struct ib_smp *) pmp); 1395 ret = reply((struct ib_smp *) pmp);
1528 goto bail; 1396 goto bail;
1529 } 1397 }
1530 1398
1531 switch (pmp->method) { 1399 switch (pmp->mad_hdr.method) {
1532 case IB_MGMT_METHOD_GET: 1400 case IB_MGMT_METHOD_GET:
1533 switch (pmp->attr_id) { 1401 switch (pmp->mad_hdr.attr_id) {
1534 case IB_PMA_CLASS_PORT_INFO: 1402 case IB_PMA_CLASS_PORT_INFO:
1535 ret = recv_pma_get_classportinfo(pmp); 1403 ret = recv_pma_get_classportinfo(pmp);
1536 goto bail; 1404 goto bail;
@@ -1554,13 +1422,13 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
1554 port_num); 1422 port_num);
1555 goto bail; 1423 goto bail;
1556 default: 1424 default:
1557 pmp->status |= IB_SMP_UNSUP_METH_ATTR; 1425 pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR;
1558 ret = reply((struct ib_smp *) pmp); 1426 ret = reply((struct ib_smp *) pmp);
1559 goto bail; 1427 goto bail;
1560 } 1428 }
1561 1429
1562 case IB_MGMT_METHOD_SET: 1430 case IB_MGMT_METHOD_SET:
1563 switch (pmp->attr_id) { 1431 switch (pmp->mad_hdr.attr_id) {
1564 case IB_PMA_PORT_SAMPLES_CONTROL: 1432 case IB_PMA_PORT_SAMPLES_CONTROL:
1565 ret = recv_pma_set_portsamplescontrol(pmp, ibdev, 1433 ret = recv_pma_set_portsamplescontrol(pmp, ibdev,
1566 port_num); 1434 port_num);
@@ -1574,7 +1442,7 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
1574 port_num); 1442 port_num);
1575 goto bail; 1443 goto bail;
1576 default: 1444 default:
1577 pmp->status |= IB_SMP_UNSUP_METH_ATTR; 1445 pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR;
1578 ret = reply((struct ib_smp *) pmp); 1446 ret = reply((struct ib_smp *) pmp);
1579 goto bail; 1447 goto bail;
1580 } 1448 }
@@ -1588,7 +1456,7 @@ static int process_perf(struct ib_device *ibdev, u8 port_num,
1588 ret = IB_MAD_RESULT_SUCCESS; 1456 ret = IB_MAD_RESULT_SUCCESS;
1589 goto bail; 1457 goto bail;
1590 default: 1458 default:
1591 pmp->status |= IB_SMP_UNSUP_METHOD; 1459 pmp->mad_hdr.status |= IB_SMP_UNSUP_METHOD;
1592 ret = reply((struct ib_smp *) pmp); 1460 ret = reply((struct ib_smp *) pmp);
1593 } 1461 }
1594 1462