mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bryan O'Sullivan" <bos@pathscale.com>
To: rdreier@cisco.com
Cc: openib-general@openib.org, linux-kernel@vger.kernel.org
Subject: [PATCH 36 of 53] ipath - count local link integrity errors
Date: Fri, 12 May 2006 16:43:21 -0700	[thread overview]
Message-ID: <ec1934faf5d11e165c9c.1147477401@eng-12.pathscale.com> (raw)
In-Reply-To: <patchbomb.1147477365@eng-12.pathscale.com>

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>

diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_driver.c
--- a/drivers/infiniband/hw/ipath/ipath_driver.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c	Fri May 12 15:55:28 2006 -0700
@@ -446,6 +446,8 @@ static int __devinit ipath_init_one(stru
 	 * by ipath_setup_htconfig.
 	 */
 	dd->ipath_flags = 0;
+	dd->ipath_lli_counter = 0;
+	dd->ipath_lli_errors = 0;
 
 	if (dd->ipath_f_bus(dd, pdev))
 		ipath_dev_err(dd, "Failed to setup config space; "
@@ -927,6 +929,18 @@ void ipath_kreceive(struct ipath_devdata
 				   "tlen=%x opcode=%x egridx=%x: %s\n",
 				   eflags, l, etype, tlen, bthbytes[0],
 				   ips_get_index((__le32 *) rc), emsg);
+			/* Count local link integrity errors. */
+			if (eflags & (INFINIPATH_RHF_H_ICRCERR |
+				      INFINIPATH_RHF_H_VCRCERR)) {
+				u8 n = (dd->ipath_ibcctrl >>
+					INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT) &
+					INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK;
+
+				if (++dd->ipath_lli_counter > n) {
+					dd->ipath_lli_counter = 0;
+					dd->ipath_lli_errors++;
+				}
+			}
 		} else if (etype == RCVHQ_RCV_TYPE_NON_KD) {
 				int ret = __ipath_verbs_rcv(dd, rc + 1,
 							    ebuf, tlen);
@@ -934,6 +948,8 @@ void ipath_kreceive(struct ipath_devdata
 					ipath_cdbg(VERBOSE,
 						   "received IB packet, "
 						   "not SMA (QP=%x)\n", qp);
+				if (dd->ipath_lli_counter)
+					dd->ipath_lli_counter--;
 		} else if (etype == RCVHQ_RCV_TYPE_EAGER) {
 			if (qp == IPATH_KD_QP &&
 			    bthbytes[0] == ipath_layer_rcv_opcode &&
@@ -1864,19 +1880,19 @@ static void __exit infinipath_cleanup(vo
 			} else
 				ipath_dbg("irq is 0, not doing free_irq "
 					  "for unit %u\n", dd->ipath_unit);
+
+			/*
+			 * we check for NULL here, because it's outside
+			 * the kregbase check, and we need to call it
+			 * after the free_irq.  Thus it's possible that
+			 * the function pointers were never initialized.
+			 */
+			if (dd->ipath_f_cleanup)
+				/* clean up chip-specific stuff */
+				dd->ipath_f_cleanup(dd);
+
 			dd->pcidev = NULL;
 		}
-
-		/*
-		 * we check for NULL here, because it's outside the kregbase
-		 * check, and we need to call it after the free_irq.  Thus
-		 * it's possible that the function pointers were never
-		 * initialized.
-		 */
-		if (dd->ipath_f_cleanup)
-			/* clean up chip-specific stuff */
-			dd->ipath_f_cleanup(dd);
-
 		spin_lock_irqsave(&ipath_devs_lock, flags);
 	}
 
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_intr.c
--- a/drivers/infiniband/hw/ipath/ipath_intr.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c	Fri May 12 15:55:28 2006 -0700
@@ -261,6 +261,7 @@ static void handle_e_ibstatuschanged(str
 				     | IPATH_LINKACTIVE |
 				     IPATH_LINKARMED);
 		*dd->ipath_statusp &= ~IPATH_STATUS_IB_READY;
+		dd->ipath_lli_counter = 0;
 		if (!noprint) {
 			if (((dd->ipath_lastibcstat >>
 			      INFINIPATH_IBCS_LINKSTATE_SHIFT) &
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_kernel.h
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h	Fri May 12 15:55:28 2006 -0700
@@ -509,6 +509,11 @@ struct ipath_devdata {
 	u8 ipath_pci_cacheline;
 	/* LID mask control */
 	u8 ipath_lmc;
+
+	/* local link integrity counter */
+	u32 ipath_lli_counter;
+	/* local link integrity errors */
+	u32 ipath_lli_errors;
 };
 
 
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_layer.c
--- a/drivers/infiniband/hw/ipath/ipath_layer.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c	Fri May 12 15:55:28 2006 -0700
@@ -1013,6 +1013,11 @@ int ipath_layer_get_counters(struct ipat
 		ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt);
 	cntrs->link_error_recovery_counter =
 		ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt);
+	/*
+	 * The link downed counter counts when the other side downs the
+	 * connection.  We add in the number of times we downed the link
+	 * due to local link integrity errors to compensate.
+	 */
 	cntrs->link_downed_counter =
 		ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt);
 	cntrs->port_rcv_errors =
@@ -1037,6 +1042,8 @@ int ipath_layer_get_counters(struct ipat
 		ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt);
 	cntrs->port_rcv_packets =
 		ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt);
+	cntrs->local_link_integrity_errors = dd->ipath_lli_errors;
+	cntrs->excessive_buffer_overrun_errors = 0; /* XXX */
 
 	ret = 0;
 
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_layer.h
--- a/drivers/infiniband/hw/ipath/ipath_layer.h	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_layer.h	Fri May 12 15:55:28 2006 -0700
@@ -54,6 +54,8 @@ struct ipath_layer_counters {
 	u64 port_rcv_data;
 	u64 port_xmit_packets;
 	u64 port_rcv_packets;
+	u32 local_link_integrity_errors;
+	u32 excessive_buffer_overrun_errors;
 };
 
 /*
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_mad.c
--- a/drivers/infiniband/hw/ipath/ipath_mad.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c	Fri May 12 15:55:28 2006 -0700
@@ -646,6 +646,8 @@ struct ib_pma_portcounters {
 #define IB_PMA_SEL_PORT_RCV_ERRORS		__constant_htons(0x0008)
 #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS	__constant_htons(0x0010)
 #define IB_PMA_SEL_PORT_XMIT_DISCARDS		__constant_htons(0x0040)
+#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS	__constant_htons(0x0200)
+#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS	__constant_htons(0x0400)
 #define IB_PMA_SEL_PORT_VL15_DROPPED		__constant_htons(0x0800)
 #define IB_PMA_SEL_PORT_XMIT_DATA		__constant_htons(0x1000)
 #define IB_PMA_SEL_PORT_RCV_DATA		__constant_htons(0x2000)
@@ -893,6 +895,10 @@ static int recv_pma_get_portcounters(str
 	cntrs.port_rcv_data -= dev->n_port_rcv_data;
 	cntrs.port_xmit_packets -= dev->n_port_xmit_packets;
 	cntrs.port_rcv_packets -= dev->n_port_rcv_packets;
+	cntrs.local_link_integrity_errors -=
+		dev->z_local_link_integrity_errors;
+	cntrs.excessive_buffer_overrun_errors -=
+		dev->z_excessive_buffer_overrun_errors;
 
 	memset(pmp->data, 0, sizeof(pmp->data));
 
@@ -930,6 +936,12 @@ static int recv_pma_get_portcounters(str
 	else
 		p->port_xmit_discards =
 			cpu_to_be16((u16)cntrs.port_xmit_discards);
+	if (cntrs.local_link_integrity_errors > 0xFUL)
+		cntrs.local_link_integrity_errors = 0xFUL;
+	if (cntrs.excessive_buffer_overrun_errors > 0xFUL)
+		cntrs.excessive_buffer_overrun_errors = 0xFUL;
+	p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) |
+		cntrs.excessive_buffer_overrun_errors;
 	if (dev->n_vl15_dropped > 0xFFFFUL)
 		p->vl15_dropped = __constant_cpu_to_be16(0xFFFF);
 	else
@@ -1028,6 +1040,14 @@ static int recv_pma_set_portcounters(str
 	if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS)
 		dev->n_port_xmit_discards = cntrs.port_xmit_discards;
 
+	if (p->counter_select & IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS)
+		dev->z_local_link_integrity_errors =
+			cntrs.local_link_integrity_errors;
+
+	if (p->counter_select & IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS)
+		dev->z_excessive_buffer_overrun_errors =
+			cntrs.excessive_buffer_overrun_errors;
+
 	if (p->counter_select & IB_PMA_SEL_PORT_VL15_DROPPED)
 		dev->n_vl15_dropped = 0;
 
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_verbs.c
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c	Fri May 12 15:55:28 2006 -0700
@@ -1046,6 +1046,10 @@ static void *ipath_register_ib_device(in
 	idev->n_port_rcv_data = cntrs.port_rcv_data;
 	idev->n_port_xmit_packets = cntrs.port_xmit_packets;
 	idev->n_port_rcv_packets = cntrs.port_rcv_packets;
+	idev->z_local_link_integrity_errors =
+		cntrs.local_link_integrity_errors;
+	idev->z_excessive_buffer_overrun_errors =
+		cntrs.excessive_buffer_overrun_errors;
 
 	/*
 	 * The system image GUID is supposed to be the same for all
diff -r e29625bd9050 -r ec1934faf5d1 drivers/infiniband/hw/ipath/ipath_verbs.h
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:28 2006 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h	Fri May 12 15:55:28 2006 -0700
@@ -459,6 +459,8 @@ struct ipath_ibdev {
 	u64 n_port_xmit_packets;	/* starting count for PMA */
 	u64 n_port_rcv_packets;	/* starting count for PMA */
 	u32 n_pkey_violations;	/* starting count for PMA */
+	u32 z_local_link_integrity_errors;	/* starting count for PMA */
+	u32 z_excessive_buffer_overrun_errors;	/* starting count for PMA */
 	u32 n_rc_resends;
 	u32 n_rc_acks;
 	u32 n_rc_qacks;

  parent reply	other threads:[~2006-05-12 23:46 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12 23:42 [PATCH 0 of 53] ipath driver updates for 2.6.17-rc4 Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 1 of 53] ipath - fix spinlock recursion bug Bryan O'Sullivan
2006-05-13  1:01   ` Joshua Hudson
2006-05-12 23:42 ` [PATCH 2 of 53] ipath - purge sps_lid and sps_mlid arrays, and /sys entries Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 3 of 53] ipath - report max MR and QP sizes based on table sizes Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 4 of 53] ipath - cap number of PDs that can be allocated Bryan O'Sullivan
2006-05-15 15:45   ` Roland Dreier
2006-05-15 21:06     ` Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 5 of 53] ipath - forbid creation of AHs with illegal ports Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 6 of 53] ipath - forbid creation of AH with DLID of 0 Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 7 of 53] ipath - cap maximum number of AHs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 8 of 53] ipath - cap number of CQEs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 9 of 53] ipath - cap number of CQs Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 10 of 53] ipath - require capabilities when creating a QP Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 11 of 53] ipath - don't modify QP if changes fail Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 12 of 53] ipath - reduce overhead of receive interrupts Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 13 of 53] ipath - limit number of SGEs and WRs per QP Bryan O'Sullivan
2006-05-12 23:42 ` [PATCH 14 of 53] ipath - forbid empty MRs Bryan O'Sullivan
2006-05-15 15:46   ` Roland Dreier
2006-05-15 21:17     ` Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 15 of 53] ipath - make some maximum values more sane Bryan O'Sullivan
2006-05-15 15:48   ` Roland Dreier
2006-05-16 22:44   ` [openib-general] " Arlin Davis
2006-05-12 23:43 ` [PATCH 16 of 53] ipath - fix reporting of driver version to userspace Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 17 of 53] ipath - fail properly if GID missing Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 18 of 53] ipath - make max mcast sizes configurable Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 19 of 53] ipath - replace uses of LIST_POISON Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 20 of 53] ipath - more sharing between RC and UC code Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 21 of 53] ipath - use phys_to_virt instead of bus_to_virt Bryan O'Sullivan
2006-05-15 15:50   ` Roland Dreier
2006-05-15 21:21     ` Bryan O'Sullivan
2006-05-15 21:28       ` Roland Dreier
2006-05-15 23:13         ` [openib-general] " Grant Grundler
2006-05-15 23:16           ` Roland Dreier
2006-05-15 23:30             ` Grant Grundler
2006-05-15 23:34               ` Roland Dreier
2006-05-16 20:05       ` Christoph Hellwig
2006-05-12 23:43 ` [PATCH 22 of 53] ipath - fix "many lost ticks" warning Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 23 of 53] ipath - [TRIVIAL] typo fixes Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 24 of 53] ipath - count dropped VL15 packets Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 25 of 53] ipath - remove some duplicated lines of code Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 26 of 53] ipath - treat PE800 rev1 and rev2 as similar Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 27 of 53] ipath - fix accounting of data packets with bad VLs Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 28 of 53] ipath - forbid setting of invalid MLID Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 29 of 53] ipath - remove redundant register read Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 30 of 53] ipath - count VL15 packet drops due to bad VL or lack of buffers Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 31 of 53] ipath - forbid sending of bad packet sizes Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 32 of 53] ipath - fix NULL dereference during cleanup Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 33 of 53] ipath - clean up some comments Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 34 of 53] ipath - fix occasional hangs in SDP Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 35 of 53] ipath - some interrelated stability and cleanliness fixes Bryan O'Sullivan
2006-05-15 15:53   ` Roland Dreier
2006-05-12 23:43 ` Bryan O'Sullivan [this message]
2006-05-12 23:43 ` [PATCH 37 of 53] ipath - name zero counter offsets consistently Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 38 of 53] ipath - SRQ compliance checks Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 39 of 53] ipath - count PE800 receive interrupts on user ports Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 40 of 53] ipath - remember to drop spinlock Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 41 of 53] ipath - disable interrupts while holding spinlock in RWQE get Bryan O'Sullivan
2006-05-15 15:55   ` Roland Dreier
2006-05-12 23:43 ` [PATCH 42 of 53] ipath - increment pointer properly when doing a diag read Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 43 of 53] ipath - fix memory leak when creating a QP fails Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 44 of 53] ipath - allow diags on any unit Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 45 of 53] ipath - fix memory leak when create of QP fails Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 46 of 53] ipath - enable GPIO interrupt on HT-460 Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 47 of 53] ipath - fix problem with lost interrupts on HT-400 Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 48 of 53] ipath - QP should ignore receive queue size if SRQ specified Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 49 of 53] ipath - NULL-terminate pci_device_id table Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 50 of 53] ipath - reduce maximum table sizes Bryan O'Sullivan
2006-05-15 16:00   ` Roland Dreier
2006-05-12 23:43 ` [PATCH 51 of 53] ipath - fix reporting of vendor ID and a few other trivial bits Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 52 of 53] ipath - register as IB device owner Bryan O'Sullivan
2006-05-12 23:43 ` [PATCH 53 of 53] ipath - add memory barrier when waiting for writes Bryan O'Sullivan
2006-05-15 15:57   ` Roland Dreier
2006-05-15 21:10     ` Bryan O'Sullivan
2006-05-15 23:01       ` ralphc
2006-05-15 23:08         ` Roland Dreier
2006-05-15 23:25           ` ralphc
2006-05-15 23:28             ` [openib-general] " Roland Dreier
2006-05-15 23:38               ` ralphc
2006-05-15 23:47                 ` Roland Dreier
2006-05-15 15:02 ` [openib-general] [PATCH 0 of 53] ipath driver updates for 2.6.17-rc4 Roger Heflin
2006-05-15 15:44 ` Roland Dreier
2006-05-15 16:00   ` [openib-general] " Roger Heflin
2006-05-15 16:04     ` Roland Dreier
2006-05-15 20:11       ` Roger Heflin
2006-05-15 21:09         ` Bryan O'Sullivan
2006-05-15 21:07   ` Bryan O'Sullivan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec1934faf5d11e165c9c.1147477401@eng-12.pathscale.com \
    --to=bos@pathscale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openib-general@openib.org \
    --cc=rdreier@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome