aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_layer.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.c62
1 files changed, 41 insertions, 21 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c
index 9ec4ac77b87f..b28c6f81c731 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.c
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c
@@ -1,4 +1,5 @@
1/* 1/*
2 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
2 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. 3 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
3 * 4 *
4 * This software is available to you under a choice of one of two 5 * This software is available to you under a choice of one of two
@@ -40,8 +41,8 @@
40#include <asm/byteorder.h> 41#include <asm/byteorder.h>
41 42
42#include "ipath_kernel.h" 43#include "ipath_kernel.h"
43#include "ips_common.h"
44#include "ipath_layer.h" 44#include "ipath_layer.h"
45#include "ipath_common.h"
45 46
46/* Acquire before ipath_devs_lock. */ 47/* Acquire before ipath_devs_lock. */
47static DEFINE_MUTEX(ipath_layer_mutex); 48static DEFINE_MUTEX(ipath_layer_mutex);
@@ -299,9 +300,8 @@ bail:
299 300
300EXPORT_SYMBOL_GPL(ipath_layer_set_mtu); 301EXPORT_SYMBOL_GPL(ipath_layer_set_mtu);
301 302
302int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc) 303int ipath_set_lid(struct ipath_devdata *dd, u32 arg, u8 lmc)
303{ 304{
304 ipath_stats.sps_lid[dd->ipath_unit] = arg;
305 dd->ipath_lid = arg; 305 dd->ipath_lid = arg;
306 dd->ipath_lmc = lmc; 306 dd->ipath_lmc = lmc;
307 307
@@ -315,7 +315,7 @@ int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc)
315 return 0; 315 return 0;
316} 316}
317 317
318EXPORT_SYMBOL_GPL(ipath_set_sps_lid); 318EXPORT_SYMBOL_GPL(ipath_set_lid);
319 319
320int ipath_layer_set_guid(struct ipath_devdata *dd, __be64 guid) 320int ipath_layer_set_guid(struct ipath_devdata *dd, __be64 guid)
321{ 321{
@@ -340,18 +340,26 @@ u32 ipath_layer_get_nguid(struct ipath_devdata *dd)
340 340
341EXPORT_SYMBOL_GPL(ipath_layer_get_nguid); 341EXPORT_SYMBOL_GPL(ipath_layer_get_nguid);
342 342
343int ipath_layer_query_device(struct ipath_devdata *dd, u32 * vendor, 343u32 ipath_layer_get_majrev(struct ipath_devdata *dd)
344 u32 * boardrev, u32 * majrev, u32 * minrev)
345{ 344{
346 *vendor = dd->ipath_vendorid; 345 return dd->ipath_majrev;
347 *boardrev = dd->ipath_boardrev; 346}
348 *majrev = dd->ipath_majrev;
349 *minrev = dd->ipath_minrev;
350 347
351 return 0; 348EXPORT_SYMBOL_GPL(ipath_layer_get_majrev);
349
350u32 ipath_layer_get_minrev(struct ipath_devdata *dd)
351{
352 return dd->ipath_minrev;
353}
354
355EXPORT_SYMBOL_GPL(ipath_layer_get_minrev);
356
357u32 ipath_layer_get_pcirev(struct ipath_devdata *dd)
358{
359 return dd->ipath_pcirev;
352} 360}
353 361
354EXPORT_SYMBOL_GPL(ipath_layer_query_device); 362EXPORT_SYMBOL_GPL(ipath_layer_get_pcirev);
355 363
356u32 ipath_layer_get_flags(struct ipath_devdata *dd) 364u32 ipath_layer_get_flags(struct ipath_devdata *dd)
357{ 365{
@@ -374,6 +382,13 @@ u16 ipath_layer_get_deviceid(struct ipath_devdata *dd)
374 382
375EXPORT_SYMBOL_GPL(ipath_layer_get_deviceid); 383EXPORT_SYMBOL_GPL(ipath_layer_get_deviceid);
376 384
385u32 ipath_layer_get_vendorid(struct ipath_devdata *dd)
386{
387 return dd->ipath_vendorid;
388}
389
390EXPORT_SYMBOL_GPL(ipath_layer_get_vendorid);
391
377u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd) 392u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd)
378{ 393{
379 return dd->ipath_lastibcstat; 394 return dd->ipath_lastibcstat;
@@ -403,7 +418,7 @@ void ipath_layer_add(struct ipath_devdata *dd)
403 mutex_unlock(&ipath_layer_mutex); 418 mutex_unlock(&ipath_layer_mutex);
404} 419}
405 420
406void ipath_layer_del(struct ipath_devdata *dd) 421void ipath_layer_remove(struct ipath_devdata *dd)
407{ 422{
408 mutex_lock(&ipath_layer_mutex); 423 mutex_lock(&ipath_layer_mutex);
409 424
@@ -607,7 +622,7 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax)
607 goto bail; 622 goto bail;
608 } 623 }
609 624
610 ret = ipath_setrcvhdrsize(dd, NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE); 625 ret = ipath_setrcvhdrsize(dd, IPATH_HEADER_QUEUE_WORDS);
611 626
612 if (ret < 0) 627 if (ret < 0)
613 goto bail; 628 goto bail;
@@ -616,9 +631,9 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax)
616 631
617 if (*dd->ipath_statusp & IPATH_STATUS_IB_READY) 632 if (*dd->ipath_statusp & IPATH_STATUS_IB_READY)
618 intval |= IPATH_LAYER_INT_IF_UP; 633 intval |= IPATH_LAYER_INT_IF_UP;
619 if (ipath_stats.sps_lid[dd->ipath_unit]) 634 if (dd->ipath_lid)
620 intval |= IPATH_LAYER_INT_LID; 635 intval |= IPATH_LAYER_INT_LID;
621 if (ipath_stats.sps_mlid[dd->ipath_unit]) 636 if (dd->ipath_mlid)
622 intval |= IPATH_LAYER_INT_BCAST; 637 intval |= IPATH_LAYER_INT_BCAST;
623 /* 638 /*
624 * do this on open, in case low level is already up and 639 * do this on open, in case low level is already up and
@@ -884,7 +899,7 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss,
884/** 899/**
885 * ipath_verbs_send - send a packet from the verbs layer 900 * ipath_verbs_send - send a packet from the verbs layer
886 * @dd: the infinipath device 901 * @dd: the infinipath device
887 * @hdrwords: the number of works in the header 902 * @hdrwords: the number of words in the header
888 * @hdr: the packet header 903 * @hdr: the packet header
889 * @len: the length of the packet in bytes 904 * @len: the length of the packet in bytes
890 * @ss: the SGE to send 905 * @ss: the SGE to send
@@ -1016,19 +1031,22 @@ int ipath_layer_get_counters(struct ipath_devdata *dd,
1016 ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt); 1031 ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt);
1017 cntrs->link_error_recovery_counter = 1032 cntrs->link_error_recovery_counter =
1018 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt); 1033 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt);
1034 /*
1035 * The link downed counter counts when the other side downs the
1036 * connection. We add in the number of times we downed the link
1037 * due to local link integrity errors to compensate.
1038 */
1019 cntrs->link_downed_counter = 1039 cntrs->link_downed_counter =
1020 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt); 1040 ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt);
1021 cntrs->port_rcv_errors = 1041 cntrs->port_rcv_errors =
1022 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rxdroppktcnt) + 1042 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rxdroppktcnt) +
1023 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvovflcnt) + 1043 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvovflcnt) +
1024 ipath_snap_cntr(dd, dd->ipath_cregs->cr_portovflcnt) + 1044 ipath_snap_cntr(dd, dd->ipath_cregs->cr_portovflcnt) +
1025 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errrcvflowctrlcnt) +
1026 ipath_snap_cntr(dd, dd->ipath_cregs->cr_err_rlencnt) + 1045 ipath_snap_cntr(dd, dd->ipath_cregs->cr_err_rlencnt) +
1027 ipath_snap_cntr(dd, dd->ipath_cregs->cr_invalidrlencnt) + 1046 ipath_snap_cntr(dd, dd->ipath_cregs->cr_invalidrlencnt) +
1028 ipath_snap_cntr(dd, dd->ipath_cregs->cr_erricrccnt) + 1047 ipath_snap_cntr(dd, dd->ipath_cregs->cr_erricrccnt) +
1029 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errvcrccnt) + 1048 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errvcrccnt) +
1030 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlpcrccnt) + 1049 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlpcrccnt) +
1031 ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlinkcnt) +
1032 ipath_snap_cntr(dd, dd->ipath_cregs->cr_badformatcnt); 1050 ipath_snap_cntr(dd, dd->ipath_cregs->cr_badformatcnt);
1033 cntrs->port_rcv_remphys_errors = 1051 cntrs->port_rcv_remphys_errors =
1034 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvebpcnt); 1052 ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvebpcnt);
@@ -1042,6 +1060,8 @@ int ipath_layer_get_counters(struct ipath_devdata *dd,
1042 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt); 1060 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt);
1043 cntrs->port_rcv_packets = 1061 cntrs->port_rcv_packets =
1044 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt); 1062 ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt);
1063 cntrs->local_link_integrity_errors = dd->ipath_lli_errors;
1064 cntrs->excessive_buffer_overrun_errors = 0; /* XXX */
1045 1065
1046 ret = 0; 1066 ret = 0;
1047 1067
@@ -1086,10 +1106,10 @@ int ipath_layer_send_hdr(struct ipath_devdata *dd, struct ether_header *hdr)
1086 } 1106 }
1087 1107
1088 vlsllnh = *((__be16 *) hdr); 1108 vlsllnh = *((__be16 *) hdr);
1089 if (vlsllnh != htons(IPS_LRH_BTH)) { 1109 if (vlsllnh != htons(IPATH_LRH_BTH)) {
1090 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); " 1110 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); "
1091 "not sending\n", be16_to_cpu(vlsllnh), 1111 "not sending\n", be16_to_cpu(vlsllnh),
1092 IPS_LRH_BTH); 1112 IPATH_LRH_BTH);
1093 ret = -EINVAL; 1113 ret = -EINVAL;
1094 } 1114 }
1095 if (ret) 1115 if (ret)