Commit 6aea213a62122701891fe55cc3405d31b927cfde
Committed by
Roland Dreier
1 parent
f2a3f6a32c
Exists in
master
and in
6 other branches
IB/pma: Add include file for IBA performance counters definitions
Move the various definitions and mad structures needed for software implementation of IBA PM agent from the ipath and qib drivers into a single include file, which in turn could be used by more consumers. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.co.il> Signed-off-by: Roland Dreier <roland@purestorage.com>
Showing 4 changed files with 231 additions and 344 deletions Side-by-side Diff
drivers/infiniband/hw/ipath/ipath_mad.c
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | */ |
33 | 33 | |
34 | 34 | #include <rdma/ib_smi.h> |
35 | +#include <rdma/ib_pma.h> | |
35 | 36 | |
36 | 37 | #include "ipath_kernel.h" |
37 | 38 | #include "ipath_verbs.h" |
38 | 39 | |
39 | 40 | |
40 | 41 | |
... | ... | @@ -789,151 +790,18 @@ |
789 | 790 | return recv_subn_get_pkeytable(smp, ibdev); |
790 | 791 | } |
791 | 792 | |
792 | -#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) | |
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 | - | |
799 | -struct 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 | - | |
814 | -struct 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 | - | |
834 | -struct 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 | - | |
851 | -struct ib_pma_portsamplesresult { | |
852 | - __be16 tag; | |
853 | - __be16 sample_status; /* only lower 2 bits */ | |
854 | - __be32 counter[15]; | |
855 | -} __attribute__ ((packed)); | |
856 | - | |
857 | -struct 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 | - | |
864 | -struct 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 | - | |
901 | -struct 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 | - | |
925 | -static int recv_pma_get_classportinfo(struct ib_perf *pmp) | |
793 | +static int recv_pma_get_classportinfo(struct ib_pma_mad *pmp) | |
926 | 794 | { |
927 | - struct ib_pma_classportinfo *p = | |
928 | - (struct ib_pma_classportinfo *)pmp->data; | |
795 | + struct ib_class_port_info *p = | |
796 | + (struct ib_class_port_info *)pmp->data; | |
929 | 797 | |
930 | 798 | memset(pmp->data, 0, sizeof(pmp->data)); |
931 | 799 | |
932 | - if (pmp->attr_mod != 0) | |
933 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
800 | + if (pmp->mad_hdr.attr_mod != 0) | |
801 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
934 | 802 | |
935 | 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 | 805 | p->base_version = 1; |
938 | 806 | p->class_version = 1; |
939 | 807 | /* |
... | ... | @@ -957,7 +825,7 @@ |
957 | 825 | COUNTER_MASK(1, 3) | \ |
958 | 826 | COUNTER_MASK(1, 4)) |
959 | 827 | |
960 | -static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp, | |
828 | +static int recv_pma_get_portsamplescontrol(struct ib_pma_mad *pmp, | |
961 | 829 | struct ib_device *ibdev, u8 port) |
962 | 830 | { |
963 | 831 | struct ib_pma_portsamplescontrol *p = |
964 | 832 | |
... | ... | @@ -970,9 +838,9 @@ |
970 | 838 | memset(pmp->data, 0, sizeof(pmp->data)); |
971 | 839 | |
972 | 840 | p->port_select = port_select; |
973 | - if (pmp->attr_mod != 0 || | |
841 | + if (pmp->mad_hdr.attr_mod != 0 || | |
974 | 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 | 845 | * Ticks are 10x the link transfer period which for 2.5Gbs is 4 |
978 | 846 | * nsec. 0 == 4 nsec., 1 == 8 nsec., ..., 255 == 1020 nsec. Sample |
... | ... | @@ -1006,7 +874,7 @@ |
1006 | 874 | return reply((struct ib_smp *) pmp); |
1007 | 875 | } |
1008 | 876 | |
1009 | -static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp, | |
877 | +static int recv_pma_set_portsamplescontrol(struct ib_pma_mad *pmp, | |
1010 | 878 | struct ib_device *ibdev, u8 port) |
1011 | 879 | { |
1012 | 880 | struct ib_pma_portsamplescontrol *p = |
1013 | 881 | |
... | ... | @@ -1017,9 +885,9 @@ |
1017 | 885 | u8 status; |
1018 | 886 | int ret; |
1019 | 887 | |
1020 | - if (pmp->attr_mod != 0 || | |
888 | + if (pmp->mad_hdr.attr_mod != 0 || | |
1021 | 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 | 891 | ret = reply((struct ib_smp *) pmp); |
1024 | 892 | goto bail; |
1025 | 893 | } |
... | ... | @@ -1093,7 +961,7 @@ |
1093 | 961 | return ret; |
1094 | 962 | } |
1095 | 963 | |
1096 | -static int recv_pma_get_portsamplesresult(struct ib_perf *pmp, | |
964 | +static int recv_pma_get_portsamplesresult(struct ib_pma_mad *pmp, | |
1097 | 965 | struct ib_device *ibdev) |
1098 | 966 | { |
1099 | 967 | struct ib_pma_portsamplesresult *p = |
... | ... | @@ -1118,7 +986,7 @@ |
1118 | 986 | return reply((struct ib_smp *) pmp); |
1119 | 987 | } |
1120 | 988 | |
1121 | -static int recv_pma_get_portsamplesresult_ext(struct ib_perf *pmp, | |
989 | +static int recv_pma_get_portsamplesresult_ext(struct ib_pma_mad *pmp, | |
1122 | 990 | struct ib_device *ibdev) |
1123 | 991 | { |
1124 | 992 | struct ib_pma_portsamplesresult_ext *p = |
... | ... | @@ -1145,7 +1013,7 @@ |
1145 | 1013 | return reply((struct ib_smp *) pmp); |
1146 | 1014 | } |
1147 | 1015 | |
1148 | -static int recv_pma_get_portcounters(struct ib_perf *pmp, | |
1016 | +static int recv_pma_get_portcounters(struct ib_pma_mad *pmp, | |
1149 | 1017 | struct ib_device *ibdev, u8 port) |
1150 | 1018 | { |
1151 | 1019 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
1152 | 1020 | |
... | ... | @@ -1179,9 +1047,9 @@ |
1179 | 1047 | memset(pmp->data, 0, sizeof(pmp->data)); |
1180 | 1048 | |
1181 | 1049 | p->port_select = port_select; |
1182 | - if (pmp->attr_mod != 0 || | |
1050 | + if (pmp->mad_hdr.attr_mod != 0 || | |
1183 | 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 | 1054 | if (cntrs.symbol_error_counter > 0xFFFFUL) |
1187 | 1055 | p->symbol_error_counter = cpu_to_be16(0xFFFF); |
... | ... | @@ -1216,7 +1084,7 @@ |
1216 | 1084 | cntrs.local_link_integrity_errors = 0xFUL; |
1217 | 1085 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) |
1218 | 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 | 1088 | cntrs.excessive_buffer_overrun_errors; |
1221 | 1089 | if (cntrs.vl15_dropped > 0xFFFFUL) |
1222 | 1090 | p->vl15_dropped = cpu_to_be16(0xFFFF); |
... | ... | @@ -1244,7 +1112,7 @@ |
1244 | 1112 | return reply((struct ib_smp *) pmp); |
1245 | 1113 | } |
1246 | 1114 | |
1247 | -static int recv_pma_get_portcounters_ext(struct ib_perf *pmp, | |
1115 | +static int recv_pma_get_portcounters_ext(struct ib_pma_mad *pmp, | |
1248 | 1116 | struct ib_device *ibdev, u8 port) |
1249 | 1117 | { |
1250 | 1118 | struct ib_pma_portcounters_ext *p = |
1251 | 1119 | |
... | ... | @@ -1265,9 +1133,9 @@ |
1265 | 1133 | memset(pmp->data, 0, sizeof(pmp->data)); |
1266 | 1134 | |
1267 | 1135 | p->port_select = port_select; |
1268 | - if (pmp->attr_mod != 0 || | |
1136 | + if (pmp->mad_hdr.attr_mod != 0 || | |
1269 | 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 | 1140 | p->port_xmit_data = cpu_to_be64(swords); |
1273 | 1141 | p->port_rcv_data = cpu_to_be64(rwords); |
... | ... | @@ -1281,7 +1149,7 @@ |
1281 | 1149 | return reply((struct ib_smp *) pmp); |
1282 | 1150 | } |
1283 | 1151 | |
1284 | -static int recv_pma_set_portcounters(struct ib_perf *pmp, | |
1152 | +static int recv_pma_set_portcounters(struct ib_pma_mad *pmp, | |
1285 | 1153 | struct ib_device *ibdev, u8 port) |
1286 | 1154 | { |
1287 | 1155 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
... | ... | @@ -1344,7 +1212,7 @@ |
1344 | 1212 | return recv_pma_get_portcounters(pmp, ibdev, port); |
1345 | 1213 | } |
1346 | 1214 | |
1347 | -static int recv_pma_set_portcounters_ext(struct ib_perf *pmp, | |
1215 | +static int recv_pma_set_portcounters_ext(struct ib_pma_mad *pmp, | |
1348 | 1216 | struct ib_device *ibdev, u8 port) |
1349 | 1217 | { |
1350 | 1218 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
1351 | 1219 | |
1352 | 1220 | |
1353 | 1221 | |
... | ... | @@ -1518,19 +1386,19 @@ |
1518 | 1386 | struct ib_mad *in_mad, |
1519 | 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 | 1390 | int ret; |
1523 | 1391 | |
1524 | 1392 | *out_mad = *in_mad; |
1525 | - if (pmp->class_version != 1) { | |
1526 | - pmp->status |= IB_SMP_UNSUP_VERSION; | |
1393 | + if (pmp->mad_hdr.class_version != 1) { | |
1394 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_VERSION; | |
1527 | 1395 | ret = reply((struct ib_smp *) pmp); |
1528 | 1396 | goto bail; |
1529 | 1397 | } |
1530 | 1398 | |
1531 | - switch (pmp->method) { | |
1399 | + switch (pmp->mad_hdr.method) { | |
1532 | 1400 | case IB_MGMT_METHOD_GET: |
1533 | - switch (pmp->attr_id) { | |
1401 | + switch (pmp->mad_hdr.attr_id) { | |
1534 | 1402 | case IB_PMA_CLASS_PORT_INFO: |
1535 | 1403 | ret = recv_pma_get_classportinfo(pmp); |
1536 | 1404 | goto bail; |
1537 | 1405 | |
... | ... | @@ -1554,13 +1422,13 @@ |
1554 | 1422 | port_num); |
1555 | 1423 | goto bail; |
1556 | 1424 | default: |
1557 | - pmp->status |= IB_SMP_UNSUP_METH_ATTR; | |
1425 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; | |
1558 | 1426 | ret = reply((struct ib_smp *) pmp); |
1559 | 1427 | goto bail; |
1560 | 1428 | } |
1561 | 1429 | |
1562 | 1430 | case IB_MGMT_METHOD_SET: |
1563 | - switch (pmp->attr_id) { | |
1431 | + switch (pmp->mad_hdr.attr_id) { | |
1564 | 1432 | case IB_PMA_PORT_SAMPLES_CONTROL: |
1565 | 1433 | ret = recv_pma_set_portsamplescontrol(pmp, ibdev, |
1566 | 1434 | port_num); |
... | ... | @@ -1574,7 +1442,7 @@ |
1574 | 1442 | port_num); |
1575 | 1443 | goto bail; |
1576 | 1444 | default: |
1577 | - pmp->status |= IB_SMP_UNSUP_METH_ATTR; | |
1445 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; | |
1578 | 1446 | ret = reply((struct ib_smp *) pmp); |
1579 | 1447 | goto bail; |
1580 | 1448 | } |
... | ... | @@ -1588,7 +1456,7 @@ |
1588 | 1456 | ret = IB_MAD_RESULT_SUCCESS; |
1589 | 1457 | goto bail; |
1590 | 1458 | default: |
1591 | - pmp->status |= IB_SMP_UNSUP_METHOD; | |
1459 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METHOD; | |
1592 | 1460 | ret = reply((struct ib_smp *) pmp); |
1593 | 1461 | } |
1594 | 1462 |
drivers/infiniband/hw/qib/qib_mad.c
... | ... | @@ -1125,22 +1125,22 @@ |
1125 | 1125 | return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; |
1126 | 1126 | } |
1127 | 1127 | |
1128 | -static int pma_get_classportinfo(struct ib_perf *pmp, | |
1128 | +static int pma_get_classportinfo(struct ib_pma_mad *pmp, | |
1129 | 1129 | struct ib_device *ibdev) |
1130 | 1130 | { |
1131 | - struct ib_pma_classportinfo *p = | |
1132 | - (struct ib_pma_classportinfo *)pmp->data; | |
1131 | + struct ib_class_port_info *p = | |
1132 | + (struct ib_class_port_info *)pmp->data; | |
1133 | 1133 | struct qib_devdata *dd = dd_from_ibdev(ibdev); |
1134 | 1134 | |
1135 | 1135 | memset(pmp->data, 0, sizeof(pmp->data)); |
1136 | 1136 | |
1137 | - if (pmp->attr_mod != 0) | |
1138 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1137 | + if (pmp->mad_hdr.attr_mod != 0) | |
1138 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1139 | 1139 | |
1140 | 1140 | /* Note that AllPortSelect is not valid */ |
1141 | 1141 | p->base_version = 1; |
1142 | 1142 | p->class_version = 1; |
1143 | - p->cap_mask = IB_PMA_CLASS_CAP_EXT_WIDTH; | |
1143 | + p->capability_mask = IB_PMA_CLASS_CAP_EXT_WIDTH; | |
1144 | 1144 | /* |
1145 | 1145 | * Set the most significant bit of CM2 to indicate support for |
1146 | 1146 | * congestion statistics |
... | ... | @@ -1154,7 +1154,7 @@ |
1154 | 1154 | return reply((struct ib_smp *) pmp); |
1155 | 1155 | } |
1156 | 1156 | |
1157 | -static int pma_get_portsamplescontrol(struct ib_perf *pmp, | |
1157 | +static int pma_get_portsamplescontrol(struct ib_pma_mad *pmp, | |
1158 | 1158 | struct ib_device *ibdev, u8 port) |
1159 | 1159 | { |
1160 | 1160 | struct ib_pma_portsamplescontrol *p = |
... | ... | @@ -1169,8 +1169,8 @@ |
1169 | 1169 | memset(pmp->data, 0, sizeof(pmp->data)); |
1170 | 1170 | |
1171 | 1171 | p->port_select = port_select; |
1172 | - if (pmp->attr_mod != 0 || port_select != port) { | |
1173 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1172 | + if (pmp->mad_hdr.attr_mod != 0 || port_select != port) { | |
1173 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1174 | 1174 | goto bail; |
1175 | 1175 | } |
1176 | 1176 | spin_lock_irqsave(&ibp->lock, flags); |
... | ... | @@ -1192,7 +1192,7 @@ |
1192 | 1192 | return reply((struct ib_smp *) pmp); |
1193 | 1193 | } |
1194 | 1194 | |
1195 | -static int pma_set_portsamplescontrol(struct ib_perf *pmp, | |
1195 | +static int pma_set_portsamplescontrol(struct ib_pma_mad *pmp, | |
1196 | 1196 | struct ib_device *ibdev, u8 port) |
1197 | 1197 | { |
1198 | 1198 | struct ib_pma_portsamplescontrol *p = |
... | ... | @@ -1205,8 +1205,8 @@ |
1205 | 1205 | u8 status, xmit_flags; |
1206 | 1206 | int ret; |
1207 | 1207 | |
1208 | - if (pmp->attr_mod != 0 || p->port_select != port) { | |
1209 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1208 | + if (pmp->mad_hdr.attr_mod != 0 || p->port_select != port) { | |
1209 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1210 | 1210 | ret = reply((struct ib_smp *) pmp); |
1211 | 1211 | goto bail; |
1212 | 1212 | } |
... | ... | @@ -1321,7 +1321,7 @@ |
1321 | 1321 | return ret; |
1322 | 1322 | } |
1323 | 1323 | |
1324 | -static int pma_get_portsamplesresult(struct ib_perf *pmp, | |
1324 | +static int pma_get_portsamplesresult(struct ib_pma_mad *pmp, | |
1325 | 1325 | struct ib_device *ibdev, u8 port) |
1326 | 1326 | { |
1327 | 1327 | struct ib_pma_portsamplesresult *p = |
... | ... | @@ -1360,7 +1360,7 @@ |
1360 | 1360 | return reply((struct ib_smp *) pmp); |
1361 | 1361 | } |
1362 | 1362 | |
1363 | -static int pma_get_portsamplesresult_ext(struct ib_perf *pmp, | |
1363 | +static int pma_get_portsamplesresult_ext(struct ib_pma_mad *pmp, | |
1364 | 1364 | struct ib_device *ibdev, u8 port) |
1365 | 1365 | { |
1366 | 1366 | struct ib_pma_portsamplesresult_ext *p = |
... | ... | @@ -1402,7 +1402,7 @@ |
1402 | 1402 | return reply((struct ib_smp *) pmp); |
1403 | 1403 | } |
1404 | 1404 | |
1405 | -static int pma_get_portcounters(struct ib_perf *pmp, | |
1405 | +static int pma_get_portcounters(struct ib_pma_mad *pmp, | |
1406 | 1406 | struct ib_device *ibdev, u8 port) |
1407 | 1407 | { |
1408 | 1408 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
... | ... | @@ -1436,8 +1436,8 @@ |
1436 | 1436 | memset(pmp->data, 0, sizeof(pmp->data)); |
1437 | 1437 | |
1438 | 1438 | p->port_select = port_select; |
1439 | - if (pmp->attr_mod != 0 || port_select != port) | |
1440 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1439 | + if (pmp->mad_hdr.attr_mod != 0 || port_select != port) | |
1440 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1441 | 1441 | |
1442 | 1442 | if (cntrs.symbol_error_counter > 0xFFFFUL) |
1443 | 1443 | p->symbol_error_counter = cpu_to_be16(0xFFFF); |
... | ... | @@ -1472,7 +1472,7 @@ |
1472 | 1472 | cntrs.local_link_integrity_errors = 0xFUL; |
1473 | 1473 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) |
1474 | 1474 | cntrs.excessive_buffer_overrun_errors = 0xFUL; |
1475 | - p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) | | |
1475 | + p->link_overrun_errors = (cntrs.local_link_integrity_errors << 4) | | |
1476 | 1476 | cntrs.excessive_buffer_overrun_errors; |
1477 | 1477 | if (cntrs.vl15_dropped > 0xFFFFUL) |
1478 | 1478 | p->vl15_dropped = cpu_to_be16(0xFFFF); |
... | ... | @@ -1500,7 +1500,7 @@ |
1500 | 1500 | return reply((struct ib_smp *) pmp); |
1501 | 1501 | } |
1502 | 1502 | |
1503 | -static int pma_get_portcounters_cong(struct ib_perf *pmp, | |
1503 | +static int pma_get_portcounters_cong(struct ib_pma_mad *pmp, | |
1504 | 1504 | struct ib_device *ibdev, u8 port) |
1505 | 1505 | { |
1506 | 1506 | /* Congestion PMA packets start at offset 24 not 64 */ |
... | ... | @@ -1510,7 +1510,7 @@ |
1510 | 1510 | struct qib_ibport *ibp = to_iport(ibdev, port); |
1511 | 1511 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); |
1512 | 1512 | struct qib_devdata *dd = dd_from_ppd(ppd); |
1513 | - u32 port_select = be32_to_cpu(pmp->attr_mod) & 0xFF; | |
1513 | + u32 port_select = be32_to_cpu(pmp->mad_hdr.attr_mod) & 0xFF; | |
1514 | 1514 | u64 xmit_wait_counter; |
1515 | 1515 | unsigned long flags; |
1516 | 1516 | |
1517 | 1517 | |
... | ... | @@ -1519,9 +1519,9 @@ |
1519 | 1519 | * SET method ends up calling this anyway. |
1520 | 1520 | */ |
1521 | 1521 | if (!dd->psxmitwait_supported) |
1522 | - pmp->status |= IB_SMP_UNSUP_METH_ATTR; | |
1522 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; | |
1523 | 1523 | if (port_select != port) |
1524 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1524 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1525 | 1525 | |
1526 | 1526 | qib_get_counters(ppd, &cntrs); |
1527 | 1527 | spin_lock_irqsave(&ppd->ibport_data.lock, flags); |
... | ... | @@ -1603,7 +1603,7 @@ |
1603 | 1603 | cntrs.local_link_integrity_errors = 0xFUL; |
1604 | 1604 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) |
1605 | 1605 | cntrs.excessive_buffer_overrun_errors = 0xFUL; |
1606 | - p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) | | |
1606 | + p->link_overrun_errors = (cntrs.local_link_integrity_errors << 4) | | |
1607 | 1607 | cntrs.excessive_buffer_overrun_errors; |
1608 | 1608 | if (cntrs.vl15_dropped > 0xFFFFUL) |
1609 | 1609 | p->vl15_dropped = cpu_to_be16(0xFFFF); |
... | ... | @@ -1613,7 +1613,7 @@ |
1613 | 1613 | return reply((struct ib_smp *)pmp); |
1614 | 1614 | } |
1615 | 1615 | |
1616 | -static int pma_get_portcounters_ext(struct ib_perf *pmp, | |
1616 | +static int pma_get_portcounters_ext(struct ib_pma_mad *pmp, | |
1617 | 1617 | struct ib_device *ibdev, u8 port) |
1618 | 1618 | { |
1619 | 1619 | struct ib_pma_portcounters_ext *p = |
... | ... | @@ -1626,8 +1626,8 @@ |
1626 | 1626 | memset(pmp->data, 0, sizeof(pmp->data)); |
1627 | 1627 | |
1628 | 1628 | p->port_select = port_select; |
1629 | - if (pmp->attr_mod != 0 || port_select != port) { | |
1630 | - pmp->status |= IB_SMP_INVALID_FIELD; | |
1629 | + if (pmp->mad_hdr.attr_mod != 0 || port_select != port) { | |
1630 | + pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | |
1631 | 1631 | goto bail; |
1632 | 1632 | } |
1633 | 1633 | |
... | ... | @@ -1652,7 +1652,7 @@ |
1652 | 1652 | return reply((struct ib_smp *) pmp); |
1653 | 1653 | } |
1654 | 1654 | |
1655 | -static int pma_set_portcounters(struct ib_perf *pmp, | |
1655 | +static int pma_set_portcounters(struct ib_pma_mad *pmp, | |
1656 | 1656 | struct ib_device *ibdev, u8 port) |
1657 | 1657 | { |
1658 | 1658 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
1659 | 1659 | |
... | ... | @@ -1715,14 +1715,14 @@ |
1715 | 1715 | return pma_get_portcounters(pmp, ibdev, port); |
1716 | 1716 | } |
1717 | 1717 | |
1718 | -static int pma_set_portcounters_cong(struct ib_perf *pmp, | |
1718 | +static int pma_set_portcounters_cong(struct ib_pma_mad *pmp, | |
1719 | 1719 | struct ib_device *ibdev, u8 port) |
1720 | 1720 | { |
1721 | 1721 | struct qib_ibport *ibp = to_iport(ibdev, port); |
1722 | 1722 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); |
1723 | 1723 | struct qib_devdata *dd = dd_from_ppd(ppd); |
1724 | 1724 | struct qib_verbs_counters cntrs; |
1725 | - u32 counter_select = (be32_to_cpu(pmp->attr_mod) >> 24) & 0xFF; | |
1725 | + u32 counter_select = (be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24) & 0xFF; | |
1726 | 1726 | int ret = 0; |
1727 | 1727 | unsigned long flags; |
1728 | 1728 | |
... | ... | @@ -1766,7 +1766,7 @@ |
1766 | 1766 | return ret; |
1767 | 1767 | } |
1768 | 1768 | |
1769 | -static int pma_set_portcounters_ext(struct ib_perf *pmp, | |
1769 | +static int pma_set_portcounters_ext(struct ib_pma_mad *pmp, | |
1770 | 1770 | struct ib_device *ibdev, u8 port) |
1771 | 1771 | { |
1772 | 1772 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
1773 | 1773 | |
1774 | 1774 | |
1775 | 1775 | |
... | ... | @@ -1959,19 +1959,19 @@ |
1959 | 1959 | struct ib_mad *in_mad, |
1960 | 1960 | struct ib_mad *out_mad) |
1961 | 1961 | { |
1962 | - struct ib_perf *pmp = (struct ib_perf *)out_mad; | |
1962 | + struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad; | |
1963 | 1963 | int ret; |
1964 | 1964 | |
1965 | 1965 | *out_mad = *in_mad; |
1966 | - if (pmp->class_version != 1) { | |
1967 | - pmp->status |= IB_SMP_UNSUP_VERSION; | |
1966 | + if (pmp->mad_hdr.class_version != 1) { | |
1967 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_VERSION; | |
1968 | 1968 | ret = reply((struct ib_smp *) pmp); |
1969 | 1969 | goto bail; |
1970 | 1970 | } |
1971 | 1971 | |
1972 | - switch (pmp->method) { | |
1972 | + switch (pmp->mad_hdr.method) { | |
1973 | 1973 | case IB_MGMT_METHOD_GET: |
1974 | - switch (pmp->attr_id) { | |
1974 | + switch (pmp->mad_hdr.attr_id) { | |
1975 | 1975 | case IB_PMA_CLASS_PORT_INFO: |
1976 | 1976 | ret = pma_get_classportinfo(pmp, ibdev); |
1977 | 1977 | goto bail; |
1978 | 1978 | |
... | ... | @@ -1994,13 +1994,13 @@ |
1994 | 1994 | ret = pma_get_portcounters_cong(pmp, ibdev, port); |
1995 | 1995 | goto bail; |
1996 | 1996 | default: |
1997 | - pmp->status |= IB_SMP_UNSUP_METH_ATTR; | |
1997 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; | |
1998 | 1998 | ret = reply((struct ib_smp *) pmp); |
1999 | 1999 | goto bail; |
2000 | 2000 | } |
2001 | 2001 | |
2002 | 2002 | case IB_MGMT_METHOD_SET: |
2003 | - switch (pmp->attr_id) { | |
2003 | + switch (pmp->mad_hdr.attr_id) { | |
2004 | 2004 | case IB_PMA_PORT_SAMPLES_CONTROL: |
2005 | 2005 | ret = pma_set_portsamplescontrol(pmp, ibdev, port); |
2006 | 2006 | goto bail; |
... | ... | @@ -2014,7 +2014,7 @@ |
2014 | 2014 | ret = pma_set_portcounters_cong(pmp, ibdev, port); |
2015 | 2015 | goto bail; |
2016 | 2016 | default: |
2017 | - pmp->status |= IB_SMP_UNSUP_METH_ATTR; | |
2017 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; | |
2018 | 2018 | ret = reply((struct ib_smp *) pmp); |
2019 | 2019 | goto bail; |
2020 | 2020 | } |
... | ... | @@ -2030,7 +2030,7 @@ |
2030 | 2030 | goto bail; |
2031 | 2031 | |
2032 | 2032 | default: |
2033 | - pmp->status |= IB_SMP_UNSUP_METHOD; | |
2033 | + pmp->mad_hdr.status |= IB_SMP_UNSUP_METHOD; | |
2034 | 2034 | ret = reply((struct ib_smp *) pmp); |
2035 | 2035 | } |
2036 | 2036 |
drivers/infiniband/hw/qib/qib_mad.h
... | ... | @@ -32,6 +32,8 @@ |
32 | 32 | * SOFTWARE. |
33 | 33 | */ |
34 | 34 | |
35 | +#include <rdma/ib_pma.h> | |
36 | + | |
35 | 37 | #define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004) |
36 | 38 | #define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008) |
37 | 39 | #define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C) |
38 | 40 | |
... | ... | @@ -180,109 +182,8 @@ |
180 | 182 | #define IB_VLARB_HIGHPRI_0_31 3 |
181 | 183 | #define IB_VLARB_HIGHPRI_32_63 4 |
182 | 184 | |
183 | -/* | |
184 | - * PMA class portinfo capability mask bits | |
185 | - */ | |
186 | -#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8) | |
187 | -#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9) | |
188 | -#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12) | |
189 | - | |
190 | -#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) | |
191 | -#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010) | |
192 | -#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011) | |
193 | -#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012) | |
194 | -#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D) | |
195 | -#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E) | |
196 | 185 | #define IB_PMA_PORT_COUNTERS_CONG cpu_to_be16(0xFF00) |
197 | 186 | |
198 | -struct ib_perf { | |
199 | - u8 base_version; | |
200 | - u8 mgmt_class; | |
201 | - u8 class_version; | |
202 | - u8 method; | |
203 | - __be16 status; | |
204 | - __be16 unused; | |
205 | - __be64 tid; | |
206 | - __be16 attr_id; | |
207 | - __be16 resv; | |
208 | - __be32 attr_mod; | |
209 | - u8 reserved[40]; | |
210 | - u8 data[192]; | |
211 | -} __attribute__ ((packed)); | |
212 | - | |
213 | -struct ib_pma_classportinfo { | |
214 | - u8 base_version; | |
215 | - u8 class_version; | |
216 | - __be16 cap_mask; | |
217 | - u8 reserved[3]; | |
218 | - u8 resp_time_value; /* only lower 5 bits */ | |
219 | - union ib_gid redirect_gid; | |
220 | - __be32 redirect_tc_sl_fl; /* 8, 4, 20 bits respectively */ | |
221 | - __be16 redirect_lid; | |
222 | - __be16 redirect_pkey; | |
223 | - __be32 redirect_qp; /* only lower 24 bits */ | |
224 | - __be32 redirect_qkey; | |
225 | - union ib_gid trap_gid; | |
226 | - __be32 trap_tc_sl_fl; /* 8, 4, 20 bits respectively */ | |
227 | - __be16 trap_lid; | |
228 | - __be16 trap_pkey; | |
229 | - __be32 trap_hl_qp; /* 8, 24 bits respectively */ | |
230 | - __be32 trap_qkey; | |
231 | -} __attribute__ ((packed)); | |
232 | - | |
233 | -struct ib_pma_portsamplescontrol { | |
234 | - u8 opcode; | |
235 | - u8 port_select; | |
236 | - u8 tick; | |
237 | - u8 counter_width; /* only lower 3 bits */ | |
238 | - __be32 counter_mask0_9; /* 2, 10 * 3, bits */ | |
239 | - __be16 counter_mask10_14; /* 1, 5 * 3, bits */ | |
240 | - u8 sample_mechanisms; | |
241 | - u8 sample_status; /* only lower 2 bits */ | |
242 | - __be64 option_mask; | |
243 | - __be64 vendor_mask; | |
244 | - __be32 sample_start; | |
245 | - __be32 sample_interval; | |
246 | - __be16 tag; | |
247 | - __be16 counter_select[15]; | |
248 | -} __attribute__ ((packed)); | |
249 | - | |
250 | -struct ib_pma_portsamplesresult { | |
251 | - __be16 tag; | |
252 | - __be16 sample_status; /* only lower 2 bits */ | |
253 | - __be32 counter[15]; | |
254 | -} __attribute__ ((packed)); | |
255 | - | |
256 | -struct ib_pma_portsamplesresult_ext { | |
257 | - __be16 tag; | |
258 | - __be16 sample_status; /* only lower 2 bits */ | |
259 | - __be32 extended_width; /* only upper 2 bits */ | |
260 | - __be64 counter[15]; | |
261 | -} __attribute__ ((packed)); | |
262 | - | |
263 | -struct ib_pma_portcounters { | |
264 | - u8 reserved; | |
265 | - u8 port_select; | |
266 | - __be16 counter_select; | |
267 | - __be16 symbol_error_counter; | |
268 | - u8 link_error_recovery_counter; | |
269 | - u8 link_downed_counter; | |
270 | - __be16 port_rcv_errors; | |
271 | - __be16 port_rcv_remphys_errors; | |
272 | - __be16 port_rcv_switch_relay_errors; | |
273 | - __be16 port_xmit_discards; | |
274 | - u8 port_xmit_constraint_errors; | |
275 | - u8 port_rcv_constraint_errors; | |
276 | - u8 reserved1; | |
277 | - u8 lli_ebor_errors; /* 4, 4, bits */ | |
278 | - __be16 reserved2; | |
279 | - __be16 vl15_dropped; | |
280 | - __be32 port_xmit_data; | |
281 | - __be32 port_rcv_data; | |
282 | - __be32 port_xmit_packets; | |
283 | - __be32 port_rcv_packets; | |
284 | -} __attribute__ ((packed)); | |
285 | - | |
286 | 187 | struct ib_pma_portcounters_cong { |
287 | 188 | u8 reserved; |
288 | 189 | u8 reserved1; |
... | ... | @@ -297,7 +198,7 @@ |
297 | 198 | u8 port_xmit_constraint_errors; |
298 | 199 | u8 port_rcv_constraint_errors; |
299 | 200 | u8 reserved2; |
300 | - u8 lli_ebor_errors; /* 4, 4, bits */ | |
201 | + u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ | |
301 | 202 | __be16 reserved3; |
302 | 203 | __be16 vl15_dropped; |
303 | 204 | __be64 port_xmit_data; |
304 | 205 | |
... | ... | @@ -316,48 +217,10 @@ |
316 | 217 | /* number of 4nsec cycles equaling 2secs */ |
317 | 218 | #define QIB_CONG_TIMER_PSINTERVAL 0x1DCD64EC |
318 | 219 | |
319 | -#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001) | |
320 | -#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002) | |
321 | -#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004) | |
322 | -#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008) | |
323 | -#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010) | |
324 | -#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040) | |
325 | -#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200) | |
326 | -#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400) | |
327 | -#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800) | |
328 | -#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000) | |
329 | -#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000) | |
330 | -#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000) | |
331 | -#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000) | |
332 | - | |
333 | 220 | #define IB_PMA_SEL_CONG_ALL 0x01 |
334 | 221 | #define IB_PMA_SEL_CONG_PORT_DATA 0x02 |
335 | 222 | #define IB_PMA_SEL_CONG_XMIT 0x04 |
336 | 223 | #define IB_PMA_SEL_CONG_ROUTING 0x08 |
337 | - | |
338 | -struct ib_pma_portcounters_ext { | |
339 | - u8 reserved; | |
340 | - u8 port_select; | |
341 | - __be16 counter_select; | |
342 | - __be32 reserved1; | |
343 | - __be64 port_xmit_data; | |
344 | - __be64 port_rcv_data; | |
345 | - __be64 port_xmit_packets; | |
346 | - __be64 port_rcv_packets; | |
347 | - __be64 port_unicast_xmit_packets; | |
348 | - __be64 port_unicast_rcv_packets; | |
349 | - __be64 port_multicast_xmit_packets; | |
350 | - __be64 port_multicast_rcv_packets; | |
351 | -} __attribute__ ((packed)); | |
352 | - | |
353 | -#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001) | |
354 | -#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002) | |
355 | -#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004) | |
356 | -#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008) | |
357 | -#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010) | |
358 | -#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020) | |
359 | -#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040) | |
360 | -#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080) | |
361 | 224 | |
362 | 225 | /* |
363 | 226 | * The PortSamplesControl.CounterMasks field is an array of 3 bit fields |
include/rdma/ib_pma.h
1 | +/* | |
2 | + * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. | |
3 | + * All rights reserved. | |
4 | + * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. | |
5 | + * | |
6 | + * This software is available to you under a choice of one of two | |
7 | + * licenses. You may choose to be licensed under the terms of the GNU | |
8 | + * General Public License (GPL) Version 2, available from the file | |
9 | + * COPYING in the main directory of this source tree, or the | |
10 | + * OpenIB.org BSD license below: | |
11 | + * | |
12 | + * Redistribution and use in source and binary forms, with or | |
13 | + * without modification, are permitted provided that the following | |
14 | + * conditions are met: | |
15 | + * | |
16 | + * - Redistributions of source code must retain the above | |
17 | + * copyright notice, this list of conditions and the following | |
18 | + * disclaimer. | |
19 | + * | |
20 | + * - Redistributions in binary form must reproduce the above | |
21 | + * copyright notice, this list of conditions and the following | |
22 | + * disclaimer in the documentation and/or other materials | |
23 | + * provided with the distribution. | |
24 | + * | |
25 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
26 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
27 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
28 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
29 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
30 | + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
31 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
32 | + * SOFTWARE. | |
33 | + */ | |
34 | + | |
35 | +#if !defined(IB_PMA_H) | |
36 | +#define IB_PMA_H | |
37 | + | |
38 | +#include <rdma/ib_mad.h> | |
39 | + | |
40 | +/* | |
41 | + * PMA class portinfo capability mask bits | |
42 | + */ | |
43 | +#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8) | |
44 | +#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9) | |
45 | +#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12) | |
46 | + | |
47 | +#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) | |
48 | +#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010) | |
49 | +#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011) | |
50 | +#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012) | |
51 | +#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D) | |
52 | +#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E) | |
53 | + | |
54 | +struct ib_pma_mad { | |
55 | + struct ib_mad_hdr mad_hdr; | |
56 | + u8 reserved[40]; | |
57 | + u8 data[192]; | |
58 | +} __packed; | |
59 | + | |
60 | +struct ib_pma_portsamplescontrol { | |
61 | + u8 opcode; | |
62 | + u8 port_select; | |
63 | + u8 tick; | |
64 | + u8 counter_width; /* resv: 7:3, counter width: 2:0 */ | |
65 | + __be32 counter_mask0_9; /* 2, 10 3-bit fields */ | |
66 | + __be16 counter_mask10_14; /* 1, 5 3-bit fields */ | |
67 | + u8 sample_mechanisms; | |
68 | + u8 sample_status; /* only lower 2 bits */ | |
69 | + __be64 option_mask; | |
70 | + __be64 vendor_mask; | |
71 | + __be32 sample_start; | |
72 | + __be32 sample_interval; | |
73 | + __be16 tag; | |
74 | + __be16 counter_select[15]; | |
75 | + __be32 reserved1; | |
76 | + __be64 samples_only_option_mask; | |
77 | + __be32 reserved2[28]; | |
78 | +}; | |
79 | + | |
80 | +struct ib_pma_portsamplesresult { | |
81 | + __be16 tag; | |
82 | + __be16 sample_status; /* only lower 2 bits */ | |
83 | + __be32 counter[15]; | |
84 | +}; | |
85 | + | |
86 | +struct ib_pma_portsamplesresult_ext { | |
87 | + __be16 tag; | |
88 | + __be16 sample_status; /* only lower 2 bits */ | |
89 | + __be32 extended_width; /* only upper 2 bits */ | |
90 | + __be64 counter[15]; | |
91 | +}; | |
92 | + | |
93 | +struct ib_pma_portcounters { | |
94 | + u8 reserved; | |
95 | + u8 port_select; | |
96 | + __be16 counter_select; | |
97 | + __be16 symbol_error_counter; | |
98 | + u8 link_error_recovery_counter; | |
99 | + u8 link_downed_counter; | |
100 | + __be16 port_rcv_errors; | |
101 | + __be16 port_rcv_remphys_errors; | |
102 | + __be16 port_rcv_switch_relay_errors; | |
103 | + __be16 port_xmit_discards; | |
104 | + u8 port_xmit_constraint_errors; | |
105 | + u8 port_rcv_constraint_errors; | |
106 | + u8 reserved1; | |
107 | + u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ | |
108 | + __be16 reserved2; | |
109 | + __be16 vl15_dropped; | |
110 | + __be32 port_xmit_data; | |
111 | + __be32 port_rcv_data; | |
112 | + __be32 port_xmit_packets; | |
113 | + __be32 port_rcv_packets; | |
114 | + __be32 port_xmit_wait; | |
115 | +} __packed; | |
116 | + | |
117 | + | |
118 | +#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001) | |
119 | +#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002) | |
120 | +#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004) | |
121 | +#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008) | |
122 | +#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010) | |
123 | +#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040) | |
124 | +#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200) | |
125 | +#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400) | |
126 | +#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800) | |
127 | +#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000) | |
128 | +#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000) | |
129 | +#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000) | |
130 | +#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000) | |
131 | + | |
132 | +struct ib_pma_portcounters_ext { | |
133 | + u8 reserved; | |
134 | + u8 port_select; | |
135 | + __be16 counter_select; | |
136 | + __be32 reserved1; | |
137 | + __be64 port_xmit_data; | |
138 | + __be64 port_rcv_data; | |
139 | + __be64 port_xmit_packets; | |
140 | + __be64 port_rcv_packets; | |
141 | + __be64 port_unicast_xmit_packets; | |
142 | + __be64 port_unicast_rcv_packets; | |
143 | + __be64 port_multicast_xmit_packets; | |
144 | + __be64 port_multicast_rcv_packets; | |
145 | +} __packed; | |
146 | + | |
147 | +#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001) | |
148 | +#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002) | |
149 | +#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004) | |
150 | +#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008) | |
151 | +#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010) | |
152 | +#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020) | |
153 | +#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040) | |
154 | +#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080) | |
155 | + | |
156 | +#endif /* IB_PMA_H */ |