aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_mad.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-07-01 07:36:09 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-01 12:56:01 -0400
commitfba75200ad92892bf32d8d6f1443c6f1e4f48676 (patch)
tree289d5db3b7fc9f9ce4c49f9f1299bbf3985b87d4 /drivers/infiniband/hw/ipath/ipath_mad.c
parent85322947d761d08bd84165500f35b93c702aaaf3 (diff)
[PATCH] IB/ipath: fixes to performance get counters for IB compliance
This patch fixes some problems uncovered during IB compliance testing to return the right values for error counters returned by the Performance Get Counters packet. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Cc: "Michael S. Tsirkin" <mst@mellanox.co.il> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_mad.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index 8f765341d03..95756924ecd 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -613,6 +613,9 @@ struct ib_pma_portcounters {
613#define IB_PMA_SEL_PORT_RCV_ERRORS __constant_htons(0x0008) 613#define IB_PMA_SEL_PORT_RCV_ERRORS __constant_htons(0x0008)
614#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS __constant_htons(0x0010) 614#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS __constant_htons(0x0010)
615#define IB_PMA_SEL_PORT_XMIT_DISCARDS __constant_htons(0x0040) 615#define IB_PMA_SEL_PORT_XMIT_DISCARDS __constant_htons(0x0040)
616#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS __constant_htons(0x0200)
617#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS __constant_htons(0x0400)
618#define IB_PMA_SEL_PORT_VL15_DROPPED __constant_htons(0x0800)
616#define IB_PMA_SEL_PORT_XMIT_DATA __constant_htons(0x1000) 619#define IB_PMA_SEL_PORT_XMIT_DATA __constant_htons(0x1000)
617#define IB_PMA_SEL_PORT_RCV_DATA __constant_htons(0x2000) 620#define IB_PMA_SEL_PORT_RCV_DATA __constant_htons(0x2000)
618#define IB_PMA_SEL_PORT_XMIT_PACKETS __constant_htons(0x4000) 621#define IB_PMA_SEL_PORT_XMIT_PACKETS __constant_htons(0x4000)
@@ -859,6 +862,10 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
859 cntrs.port_rcv_data -= dev->z_port_rcv_data; 862 cntrs.port_rcv_data -= dev->z_port_rcv_data;
860 cntrs.port_xmit_packets -= dev->z_port_xmit_packets; 863 cntrs.port_xmit_packets -= dev->z_port_xmit_packets;
861 cntrs.port_rcv_packets -= dev->z_port_rcv_packets; 864 cntrs.port_rcv_packets -= dev->z_port_rcv_packets;
865 cntrs.local_link_integrity_errors -=
866 dev->z_local_link_integrity_errors;
867 cntrs.excessive_buffer_overrun_errors -=
868 dev->z_excessive_buffer_overrun_errors;
862 869
863 memset(pmp->data, 0, sizeof(pmp->data)); 870 memset(pmp->data, 0, sizeof(pmp->data));
864 871
@@ -896,6 +903,16 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp,
896 else 903 else
897 p->port_xmit_discards = 904 p->port_xmit_discards =
898 cpu_to_be16((u16)cntrs.port_xmit_discards); 905 cpu_to_be16((u16)cntrs.port_xmit_discards);
906 if (cntrs.local_link_integrity_errors > 0xFUL)
907 cntrs.local_link_integrity_errors = 0xFUL;
908 if (cntrs.excessive_buffer_overrun_errors > 0xFUL)
909 cntrs.excessive_buffer_overrun_errors = 0xFUL;
910 p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) |
911 cntrs.excessive_buffer_overrun_errors;
912 if (dev->n_vl15_dropped > 0xFFFFUL)
913 p->vl15_dropped = __constant_cpu_to_be16(0xFFFF);
914 else
915 p->vl15_dropped = cpu_to_be16((u16)dev->n_vl15_dropped);
899 if (cntrs.port_xmit_data > 0xFFFFFFFFUL) 916 if (cntrs.port_xmit_data > 0xFFFFFFFFUL)
900 p->port_xmit_data = __constant_cpu_to_be32(0xFFFFFFFF); 917 p->port_xmit_data = __constant_cpu_to_be32(0xFFFFFFFF);
901 else 918 else
@@ -990,6 +1007,17 @@ static int recv_pma_set_portcounters(struct ib_perf *pmp,
990 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS) 1007 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS)
991 dev->z_port_xmit_discards = cntrs.port_xmit_discards; 1008 dev->z_port_xmit_discards = cntrs.port_xmit_discards;
992 1009
1010 if (p->counter_select & IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS)
1011 dev->z_local_link_integrity_errors =
1012 cntrs.local_link_integrity_errors;
1013
1014 if (p->counter_select & IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS)
1015 dev->z_excessive_buffer_overrun_errors =
1016 cntrs.excessive_buffer_overrun_errors;
1017
1018 if (p->counter_select & IB_PMA_SEL_PORT_VL15_DROPPED)
1019 dev->n_vl15_dropped = 0;
1020
993 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DATA) 1021 if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DATA)
994 dev->z_port_xmit_data = cntrs.port_xmit_data; 1022 dev->z_port_xmit_data = cntrs.port_xmit_data;
995 1023
@@ -1275,32 +1303,8 @@ int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1275 struct ib_wc *in_wc, struct ib_grh *in_grh, 1303 struct ib_wc *in_wc, struct ib_grh *in_grh,
1276 struct ib_mad *in_mad, struct ib_mad *out_mad) 1304 struct ib_mad *in_mad, struct ib_mad *out_mad)
1277{ 1305{
1278 struct ipath_ibdev *dev = to_idev(ibdev);
1279 int ret; 1306 int ret;
1280 1307
1281 /*
1282 * Snapshot current HW counters to "clear" them.
1283 * This should be done when the driver is loaded except that for
1284 * some reason we get a zillion errors when brining up the link.
1285 */
1286 if (dev->rcv_errors == 0) {
1287 struct ipath_layer_counters cntrs;
1288
1289 ipath_layer_get_counters(to_idev(ibdev)->dd, &cntrs);
1290 dev->rcv_errors++;
1291 dev->z_symbol_error_counter = cntrs.symbol_error_counter;
1292 dev->z_link_error_recovery_counter =
1293 cntrs.link_error_recovery_counter;
1294 dev->z_link_downed_counter = cntrs.link_downed_counter;
1295 dev->z_port_rcv_errors = cntrs.port_rcv_errors + 1;
1296 dev->z_port_rcv_remphys_errors =
1297 cntrs.port_rcv_remphys_errors;
1298 dev->z_port_xmit_discards = cntrs.port_xmit_discards;
1299 dev->z_port_xmit_data = cntrs.port_xmit_data;
1300 dev->z_port_rcv_data = cntrs.port_rcv_data;
1301 dev->z_port_xmit_packets = cntrs.port_xmit_packets;
1302 dev->z_port_rcv_packets = cntrs.port_rcv_packets;
1303 }
1304 switch (in_mad->mad_hdr.mgmt_class) { 1308 switch (in_mad->mad_hdr.mgmt_class) {
1305 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: 1309 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
1306 case IB_MGMT_CLASS_SUBN_LID_ROUTED: 1310 case IB_MGMT_CLASS_SUBN_LID_ROUTED: