diff options
author | Or Gerlitz <ogerlitz@mellanox.com> | 2011-07-05 11:46:29 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-07-19 00:04:35 -0400 |
commit | 6aea213a62122701891fe55cc3405d31b927cfde (patch) | |
tree | 3406b02988e4bda771d9d2639fc78be892f2ebbb /drivers/infiniband | |
parent | f2a3f6a32cf64db1495b5ced8625b9a80bde44e5 (diff) |
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>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_mad.c | 198 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_mad.c | 78 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_mad.h | 143 |
3 files changed, 75 insertions, 344 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) | 793 | static 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 | |||
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) | ||
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 | ||
960 | static int recv_pma_get_portsamplescontrol(struct ib_perf *pmp, | 828 | static 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 | ||
1009 | static int recv_pma_set_portsamplescontrol(struct ib_perf *pmp, | 877 | static 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 | ||
1096 | static int recv_pma_get_portsamplesresult(struct ib_perf *pmp, | 964 | static 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 | ||
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 | 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 | ||
1148 | static int recv_pma_get_portcounters(struct ib_perf *pmp, | 1016 | static 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 | ||
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 | 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 | ||
1284 | static int recv_pma_set_portcounters(struct ib_perf *pmp, | 1152 | static 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 | ||
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 | 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 | ||
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c index 8fd3df5bf04d..3b3745f261f0 100644 --- a/drivers/infiniband/hw/qib/qib_mad.c +++ b/drivers/infiniband/hw/qib/qib_mad.c | |||
@@ -1125,22 +1125,22 @@ static int subn_trap_repress(struct ib_smp *smp, struct ib_device *ibdev, | |||
1125 | return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED; | 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 | struct ib_device *ibdev) | 1129 | struct ib_device *ibdev) |
1130 | { | 1130 | { |
1131 | struct ib_pma_classportinfo *p = | 1131 | struct ib_class_port_info *p = |
1132 | (struct ib_pma_classportinfo *)pmp->data; | 1132 | (struct ib_class_port_info *)pmp->data; |
1133 | struct qib_devdata *dd = dd_from_ibdev(ibdev); | 1133 | struct qib_devdata *dd = dd_from_ibdev(ibdev); |
1134 | 1134 | ||
1135 | memset(pmp->data, 0, sizeof(pmp->data)); | 1135 | memset(pmp->data, 0, sizeof(pmp->data)); |
1136 | 1136 | ||
1137 | if (pmp->attr_mod != 0) | 1137 | if (pmp->mad_hdr.attr_mod != 0) |
1138 | pmp->status |= IB_SMP_INVALID_FIELD; | 1138 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1139 | 1139 | ||
1140 | /* Note that AllPortSelect is not valid */ | 1140 | /* Note that AllPortSelect is not valid */ |
1141 | p->base_version = 1; | 1141 | p->base_version = 1; |
1142 | p->class_version = 1; | 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 | * Set the most significant bit of CM2 to indicate support for | 1145 | * Set the most significant bit of CM2 to indicate support for |
1146 | * congestion statistics | 1146 | * congestion statistics |
@@ -1154,7 +1154,7 @@ static int pma_get_classportinfo(struct ib_perf *pmp, | |||
1154 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1158 | struct ib_device *ibdev, u8 port) |
1159 | { | 1159 | { |
1160 | struct ib_pma_portsamplescontrol *p = | 1160 | struct ib_pma_portsamplescontrol *p = |
@@ -1169,8 +1169,8 @@ static int pma_get_portsamplescontrol(struct ib_perf *pmp, | |||
1169 | memset(pmp->data, 0, sizeof(pmp->data)); | 1169 | memset(pmp->data, 0, sizeof(pmp->data)); |
1170 | 1170 | ||
1171 | p->port_select = port_select; | 1171 | p->port_select = port_select; |
1172 | if (pmp->attr_mod != 0 || port_select != port) { | 1172 | if (pmp->mad_hdr.attr_mod != 0 || port_select != port) { |
1173 | pmp->status |= IB_SMP_INVALID_FIELD; | 1173 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1174 | goto bail; | 1174 | goto bail; |
1175 | } | 1175 | } |
1176 | spin_lock_irqsave(&ibp->lock, flags); | 1176 | spin_lock_irqsave(&ibp->lock, flags); |
@@ -1192,7 +1192,7 @@ bail: | |||
1192 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1196 | struct ib_device *ibdev, u8 port) |
1197 | { | 1197 | { |
1198 | struct ib_pma_portsamplescontrol *p = | 1198 | struct ib_pma_portsamplescontrol *p = |
@@ -1205,8 +1205,8 @@ static int pma_set_portsamplescontrol(struct ib_perf *pmp, | |||
1205 | u8 status, xmit_flags; | 1205 | u8 status, xmit_flags; |
1206 | int ret; | 1206 | int ret; |
1207 | 1207 | ||
1208 | if (pmp->attr_mod != 0 || p->port_select != port) { | 1208 | if (pmp->mad_hdr.attr_mod != 0 || p->port_select != port) { |
1209 | pmp->status |= IB_SMP_INVALID_FIELD; | 1209 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1210 | ret = reply((struct ib_smp *) pmp); | 1210 | ret = reply((struct ib_smp *) pmp); |
1211 | goto bail; | 1211 | goto bail; |
1212 | } | 1212 | } |
@@ -1321,7 +1321,7 @@ static u64 get_cache_hw_sample_counters(struct qib_pportdata *ppd, | |||
1321 | return ret; | 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 | struct ib_device *ibdev, u8 port) | 1325 | struct ib_device *ibdev, u8 port) |
1326 | { | 1326 | { |
1327 | struct ib_pma_portsamplesresult *p = | 1327 | struct ib_pma_portsamplesresult *p = |
@@ -1360,7 +1360,7 @@ static int pma_get_portsamplesresult(struct ib_perf *pmp, | |||
1360 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1364 | struct ib_device *ibdev, u8 port) |
1365 | { | 1365 | { |
1366 | struct ib_pma_portsamplesresult_ext *p = | 1366 | struct ib_pma_portsamplesresult_ext *p = |
@@ -1402,7 +1402,7 @@ static int pma_get_portsamplesresult_ext(struct ib_perf *pmp, | |||
1402 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1406 | struct ib_device *ibdev, u8 port) |
1407 | { | 1407 | { |
1408 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) | 1408 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
@@ -1436,8 +1436,8 @@ static int pma_get_portcounters(struct ib_perf *pmp, | |||
1436 | memset(pmp->data, 0, sizeof(pmp->data)); | 1436 | memset(pmp->data, 0, sizeof(pmp->data)); |
1437 | 1437 | ||
1438 | p->port_select = port_select; | 1438 | p->port_select = port_select; |
1439 | if (pmp->attr_mod != 0 || port_select != port) | 1439 | if (pmp->mad_hdr.attr_mod != 0 || port_select != port) |
1440 | pmp->status |= IB_SMP_INVALID_FIELD; | 1440 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1441 | 1441 | ||
1442 | if (cntrs.symbol_error_counter > 0xFFFFUL) | 1442 | if (cntrs.symbol_error_counter > 0xFFFFUL) |
1443 | p->symbol_error_counter = cpu_to_be16(0xFFFF); | 1443 | p->symbol_error_counter = cpu_to_be16(0xFFFF); |
@@ -1472,7 +1472,7 @@ static int pma_get_portcounters(struct ib_perf *pmp, | |||
1472 | cntrs.local_link_integrity_errors = 0xFUL; | 1472 | cntrs.local_link_integrity_errors = 0xFUL; |
1473 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) | 1473 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) |
1474 | cntrs.excessive_buffer_overrun_errors = 0xFUL; | 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 | cntrs.excessive_buffer_overrun_errors; | 1476 | cntrs.excessive_buffer_overrun_errors; |
1477 | if (cntrs.vl15_dropped > 0xFFFFUL) | 1477 | if (cntrs.vl15_dropped > 0xFFFFUL) |
1478 | p->vl15_dropped = cpu_to_be16(0xFFFF); | 1478 | p->vl15_dropped = cpu_to_be16(0xFFFF); |
@@ -1500,7 +1500,7 @@ static int pma_get_portcounters(struct ib_perf *pmp, | |||
1500 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1504 | struct ib_device *ibdev, u8 port) |
1505 | { | 1505 | { |
1506 | /* Congestion PMA packets start at offset 24 not 64 */ | 1506 | /* Congestion PMA packets start at offset 24 not 64 */ |
@@ -1510,7 +1510,7 @@ static int pma_get_portcounters_cong(struct ib_perf *pmp, | |||
1510 | struct qib_ibport *ibp = to_iport(ibdev, port); | 1510 | struct qib_ibport *ibp = to_iport(ibdev, port); |
1511 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); | 1511 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); |
1512 | struct qib_devdata *dd = dd_from_ppd(ppd); | 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 | u64 xmit_wait_counter; | 1514 | u64 xmit_wait_counter; |
1515 | unsigned long flags; | 1515 | unsigned long flags; |
1516 | 1516 | ||
@@ -1519,9 +1519,9 @@ static int pma_get_portcounters_cong(struct ib_perf *pmp, | |||
1519 | * SET method ends up calling this anyway. | 1519 | * SET method ends up calling this anyway. |
1520 | */ | 1520 | */ |
1521 | if (!dd->psxmitwait_supported) | 1521 | if (!dd->psxmitwait_supported) |
1522 | pmp->status |= IB_SMP_UNSUP_METH_ATTR; | 1522 | pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; |
1523 | if (port_select != port) | 1523 | if (port_select != port) |
1524 | pmp->status |= IB_SMP_INVALID_FIELD; | 1524 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1525 | 1525 | ||
1526 | qib_get_counters(ppd, &cntrs); | 1526 | qib_get_counters(ppd, &cntrs); |
1527 | spin_lock_irqsave(&ppd->ibport_data.lock, flags); | 1527 | spin_lock_irqsave(&ppd->ibport_data.lock, flags); |
@@ -1603,7 +1603,7 @@ static int pma_get_portcounters_cong(struct ib_perf *pmp, | |||
1603 | cntrs.local_link_integrity_errors = 0xFUL; | 1603 | cntrs.local_link_integrity_errors = 0xFUL; |
1604 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) | 1604 | if (cntrs.excessive_buffer_overrun_errors > 0xFUL) |
1605 | cntrs.excessive_buffer_overrun_errors = 0xFUL; | 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 | cntrs.excessive_buffer_overrun_errors; | 1607 | cntrs.excessive_buffer_overrun_errors; |
1608 | if (cntrs.vl15_dropped > 0xFFFFUL) | 1608 | if (cntrs.vl15_dropped > 0xFFFFUL) |
1609 | p->vl15_dropped = cpu_to_be16(0xFFFF); | 1609 | p->vl15_dropped = cpu_to_be16(0xFFFF); |
@@ -1613,7 +1613,7 @@ static int pma_get_portcounters_cong(struct ib_perf *pmp, | |||
1613 | return reply((struct ib_smp *)pmp); | 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 | struct ib_device *ibdev, u8 port) | 1617 | struct ib_device *ibdev, u8 port) |
1618 | { | 1618 | { |
1619 | struct ib_pma_portcounters_ext *p = | 1619 | struct ib_pma_portcounters_ext *p = |
@@ -1626,8 +1626,8 @@ static int pma_get_portcounters_ext(struct ib_perf *pmp, | |||
1626 | memset(pmp->data, 0, sizeof(pmp->data)); | 1626 | memset(pmp->data, 0, sizeof(pmp->data)); |
1627 | 1627 | ||
1628 | p->port_select = port_select; | 1628 | p->port_select = port_select; |
1629 | if (pmp->attr_mod != 0 || port_select != port) { | 1629 | if (pmp->mad_hdr.attr_mod != 0 || port_select != port) { |
1630 | pmp->status |= IB_SMP_INVALID_FIELD; | 1630 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
1631 | goto bail; | 1631 | goto bail; |
1632 | } | 1632 | } |
1633 | 1633 | ||
@@ -1652,7 +1652,7 @@ bail: | |||
1652 | return reply((struct ib_smp *) pmp); | 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 | struct ib_device *ibdev, u8 port) | 1656 | struct ib_device *ibdev, u8 port) |
1657 | { | 1657 | { |
1658 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) | 1658 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
@@ -1715,14 +1715,14 @@ static int pma_set_portcounters(struct ib_perf *pmp, | |||
1715 | return pma_get_portcounters(pmp, ibdev, port); | 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 | struct ib_device *ibdev, u8 port) | 1719 | struct ib_device *ibdev, u8 port) |
1720 | { | 1720 | { |
1721 | struct qib_ibport *ibp = to_iport(ibdev, port); | 1721 | struct qib_ibport *ibp = to_iport(ibdev, port); |
1722 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); | 1722 | struct qib_pportdata *ppd = ppd_from_ibp(ibp); |
1723 | struct qib_devdata *dd = dd_from_ppd(ppd); | 1723 | struct qib_devdata *dd = dd_from_ppd(ppd); |
1724 | struct qib_verbs_counters cntrs; | 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 | int ret = 0; | 1726 | int ret = 0; |
1727 | unsigned long flags; | 1727 | unsigned long flags; |
1728 | 1728 | ||
@@ -1766,7 +1766,7 @@ static int pma_set_portcounters_cong(struct ib_perf *pmp, | |||
1766 | return ret; | 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 | struct ib_device *ibdev, u8 port) | 1770 | struct ib_device *ibdev, u8 port) |
1771 | { | 1771 | { |
1772 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) | 1772 | struct ib_pma_portcounters *p = (struct ib_pma_portcounters *) |
@@ -1959,19 +1959,19 @@ static int process_perf(struct ib_device *ibdev, u8 port, | |||
1959 | struct ib_mad *in_mad, | 1959 | struct ib_mad *in_mad, |
1960 | struct ib_mad *out_mad) | 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 | int ret; | 1963 | int ret; |
1964 | 1964 | ||
1965 | *out_mad = *in_mad; | 1965 | *out_mad = *in_mad; |
1966 | if (pmp->class_version != 1) { | 1966 | if (pmp->mad_hdr.class_version != 1) { |
1967 | pmp->status |= IB_SMP_UNSUP_VERSION; | 1967 | pmp->mad_hdr.status |= IB_SMP_UNSUP_VERSION; |
1968 | ret = reply((struct ib_smp *) pmp); | 1968 | ret = reply((struct ib_smp *) pmp); |
1969 | goto bail; | 1969 | goto bail; |
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | switch (pmp->method) { | 1972 | switch (pmp->mad_hdr.method) { |
1973 | case IB_MGMT_METHOD_GET: | 1973 | case IB_MGMT_METHOD_GET: |
1974 | switch (pmp->attr_id) { | 1974 | switch (pmp->mad_hdr.attr_id) { |
1975 | case IB_PMA_CLASS_PORT_INFO: | 1975 | case IB_PMA_CLASS_PORT_INFO: |
1976 | ret = pma_get_classportinfo(pmp, ibdev); | 1976 | ret = pma_get_classportinfo(pmp, ibdev); |
1977 | goto bail; | 1977 | goto bail; |
@@ -1994,13 +1994,13 @@ static int process_perf(struct ib_device *ibdev, u8 port, | |||
1994 | ret = pma_get_portcounters_cong(pmp, ibdev, port); | 1994 | ret = pma_get_portcounters_cong(pmp, ibdev, port); |
1995 | goto bail; | 1995 | goto bail; |
1996 | default: | 1996 | default: |
1997 | pmp->status |= IB_SMP_UNSUP_METH_ATTR; | 1997 | pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; |
1998 | ret = reply((struct ib_smp *) pmp); | 1998 | ret = reply((struct ib_smp *) pmp); |
1999 | goto bail; | 1999 | goto bail; |
2000 | } | 2000 | } |
2001 | 2001 | ||
2002 | case IB_MGMT_METHOD_SET: | 2002 | case IB_MGMT_METHOD_SET: |
2003 | switch (pmp->attr_id) { | 2003 | switch (pmp->mad_hdr.attr_id) { |
2004 | case IB_PMA_PORT_SAMPLES_CONTROL: | 2004 | case IB_PMA_PORT_SAMPLES_CONTROL: |
2005 | ret = pma_set_portsamplescontrol(pmp, ibdev, port); | 2005 | ret = pma_set_portsamplescontrol(pmp, ibdev, port); |
2006 | goto bail; | 2006 | goto bail; |
@@ -2014,7 +2014,7 @@ static int process_perf(struct ib_device *ibdev, u8 port, | |||
2014 | ret = pma_set_portcounters_cong(pmp, ibdev, port); | 2014 | ret = pma_set_portcounters_cong(pmp, ibdev, port); |
2015 | goto bail; | 2015 | goto bail; |
2016 | default: | 2016 | default: |
2017 | pmp->status |= IB_SMP_UNSUP_METH_ATTR; | 2017 | pmp->mad_hdr.status |= IB_SMP_UNSUP_METH_ATTR; |
2018 | ret = reply((struct ib_smp *) pmp); | 2018 | ret = reply((struct ib_smp *) pmp); |
2019 | goto bail; | 2019 | goto bail; |
2020 | } | 2020 | } |
@@ -2030,7 +2030,7 @@ static int process_perf(struct ib_device *ibdev, u8 port, | |||
2030 | goto bail; | 2030 | goto bail; |
2031 | 2031 | ||
2032 | default: | 2032 | default: |
2033 | pmp->status |= IB_SMP_UNSUP_METHOD; | 2033 | pmp->mad_hdr.status |= IB_SMP_UNSUP_METHOD; |
2034 | ret = reply((struct ib_smp *) pmp); | 2034 | ret = reply((struct ib_smp *) pmp); |
2035 | } | 2035 | } |
2036 | 2036 | ||
diff --git a/drivers/infiniband/hw/qib/qib_mad.h b/drivers/infiniband/hw/qib/qib_mad.h index 7840ab593bcf..ecc416cdbaaa 100644 --- a/drivers/infiniband/hw/qib/qib_mad.h +++ b/drivers/infiniband/hw/qib/qib_mad.h | |||
@@ -32,6 +32,8 @@ | |||
32 | * SOFTWARE. | 32 | * SOFTWARE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <rdma/ib_pma.h> | ||
36 | |||
35 | #define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004) | 37 | #define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004) |
36 | #define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008) | 38 | #define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008) |
37 | #define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C) | 39 | #define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C) |
@@ -180,109 +182,8 @@ struct ib_vl_weight_elem { | |||
180 | #define IB_VLARB_HIGHPRI_0_31 3 | 182 | #define IB_VLARB_HIGHPRI_0_31 3 |
181 | #define IB_VLARB_HIGHPRI_32_63 4 | 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 | #define IB_PMA_PORT_COUNTERS_CONG cpu_to_be16(0xFF00) | 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 | struct ib_pma_portcounters_cong { | 187 | struct ib_pma_portcounters_cong { |
287 | u8 reserved; | 188 | u8 reserved; |
288 | u8 reserved1; | 189 | u8 reserved1; |
@@ -297,7 +198,7 @@ struct ib_pma_portcounters_cong { | |||
297 | u8 port_xmit_constraint_errors; | 198 | u8 port_xmit_constraint_errors; |
298 | u8 port_rcv_constraint_errors; | 199 | u8 port_rcv_constraint_errors; |
299 | u8 reserved2; | 200 | u8 reserved2; |
300 | u8 lli_ebor_errors; /* 4, 4, bits */ | 201 | u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ |
301 | __be16 reserved3; | 202 | __be16 reserved3; |
302 | __be16 vl15_dropped; | 203 | __be16 vl15_dropped; |
303 | __be64 port_xmit_data; | 204 | __be64 port_xmit_data; |
@@ -316,49 +217,11 @@ struct ib_pma_portcounters_cong { | |||
316 | /* number of 4nsec cycles equaling 2secs */ | 217 | /* number of 4nsec cycles equaling 2secs */ |
317 | #define QIB_CONG_TIMER_PSINTERVAL 0x1DCD64EC | 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 | #define IB_PMA_SEL_CONG_ALL 0x01 | 220 | #define IB_PMA_SEL_CONG_ALL 0x01 |
334 | #define IB_PMA_SEL_CONG_PORT_DATA 0x02 | 221 | #define IB_PMA_SEL_CONG_PORT_DATA 0x02 |
335 | #define IB_PMA_SEL_CONG_XMIT 0x04 | 222 | #define IB_PMA_SEL_CONG_XMIT 0x04 |
336 | #define IB_PMA_SEL_CONG_ROUTING 0x08 | 223 | #define IB_PMA_SEL_CONG_ROUTING 0x08 |
337 | 224 | ||
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 | |||
362 | /* | 225 | /* |
363 | * The PortSamplesControl.CounterMasks field is an array of 3 bit fields | 226 | * The PortSamplesControl.CounterMasks field is an array of 3 bit fields |
364 | * which specify the N'th counter's capabilities. See ch. 16.1.3.2. | 227 | * which specify the N'th counter's capabilities. See ch. 16.1.3.2. |