[PATCH 11 of 33] IB/ipath - Change packet problems vs chip errors handling and reporting

2007-03-15 Thread Bryan O'Sullivan
# HG changeset patch
# User Bryan O'Sullivan <[EMAIL PROTECTED]>
# Date 1173994464 25200
# Node ID c793dc8a526564b73018924a707bcb21052f8f36
# Parent  4050989280f08d81d06642e3d6cf5c3ea4397107
IB/ipath - Change packet problems vs chip errors handling and reporting

Some types of packet errors are moderately common with longer IB
cables and large clusters, and are not reported with prints by
other IB HCA drivers.  This suppresses those messages unless the
new __IPATH_ERRPKTDBG bit is set in ipath_debug.  Reporting
of temporarily disabled frequent error interrupts was also made
clearer

We also distinguish between chip errors, and bad packets sent or
received in the wording of the messages.

Signed-off-by: Dave Olson <[EMAIL PROTECTED]>
Signed-off-by: Bryan O'Sullivan <[EMAIL PROTECTED]>

diff -r 4050989280f0 -r c793dc8a5265 drivers/infiniband/hw/ipath/ipath_debug.h
--- a/drivers/infiniband/hw/ipath/ipath_debug.h Thu Mar 15 14:34:24 2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_debug.h Thu Mar 15 14:34:24 2007 -0700
@@ -57,6 +57,7 @@
 #define __IPATH_PROCDBG 0x100
 /* print mmap/nopage stuff, not using VDBG any more */
 #define __IPATH_MMDBG   0x200
+#define __IPATH_ERRPKTDBG   0x400
 #define __IPATH_USER_SEND   0x1000 /* use user mode send */
 #define __IPATH_KERNEL_SEND 0x2000 /* use kernel mode send */
 #define __IPATH_EPKTDBG 0x4000 /* print ethernet packet data */
diff -r 4050989280f0 -r c793dc8a5265 drivers/infiniband/hw/ipath/ipath_driver.c
--- a/drivers/infiniband/hw/ipath/ipath_driver.cThu Mar 15 14:34:24 
2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_driver.cThu Mar 15 14:34:24 
2007 -0700
@@ -754,9 +754,42 @@ static int ipath_wait_linkstate(struct i
return (dd->ipath_flags & state) ? 0 : -ETIMEDOUT;
 }
 
-void ipath_decode_err(char *buf, size_t blen, ipath_err_t err)
-{
+/*
+ * Decode the error status into strings, deciding whether to always
+ * print * it or not depending on "normal packet errors" vs everything
+ * else.   Return 1 if "real" errors, otherwise 0 if only packet
+ * errors, so caller can decide what to print with the string.
+ */
+int ipath_decode_err(char *buf, size_t blen, ipath_err_t err)
+{
+   int iserr = 1;
*buf = '\0';
+   if (err & INFINIPATH_E_PKTERRS) {
+   if (!(err & ~INFINIPATH_E_PKTERRS))
+   iserr = 0; // if only packet errors.
+   if (ipath_debug & __IPATH_ERRPKTDBG) {
+   if (err & INFINIPATH_E_REBP)
+   strlcat(buf, "EBP ", blen);
+   if (err & INFINIPATH_E_RVCRC)
+   strlcat(buf, "VCRC ", blen);
+   if (err & INFINIPATH_E_RICRC) {
+   strlcat(buf, "CRC ", blen);
+   // clear for check below, so only once
+   err &= INFINIPATH_E_RICRC; 
+   }
+   if (err & INFINIPATH_E_RSHORTPKTLEN)
+   strlcat(buf, "rshortpktlen ", blen);
+   if (err & INFINIPATH_E_SDROPPEDDATAPKT)
+   strlcat(buf, "sdroppeddatapkt ", blen);
+   if (err & INFINIPATH_E_SPKTLEN)
+   strlcat(buf, "spktlen ", blen);
+   }
+   if ((err & INFINIPATH_E_RICRC) &&
+   !(err&(INFINIPATH_E_RVCRC|INFINIPATH_E_REBP)))
+   strlcat(buf, "CRC ", blen);
+   if (!iserr)
+   goto done;
+   }
if (err & INFINIPATH_E_RHDRLEN)
strlcat(buf, "rhdrlen ", blen);
if (err & INFINIPATH_E_RBADTID)
@@ -767,12 +800,12 @@ void ipath_decode_err(char *buf, size_t 
strlcat(buf, "rhdr ", blen);
if (err & INFINIPATH_E_RLONGPKTLEN)
strlcat(buf, "rlongpktlen ", blen);
-   if (err & INFINIPATH_E_RSHORTPKTLEN)
-   strlcat(buf, "rshortpktlen ", blen);
if (err & INFINIPATH_E_RMAXPKTLEN)
strlcat(buf, "rmaxpktlen ", blen);
if (err & INFINIPATH_E_RMINPKTLEN)
strlcat(buf, "rminpktlen ", blen);
+   if (err & INFINIPATH_E_SMINPKTLEN)
+   strlcat(buf, "sminpktlen ", blen);
if (err & INFINIPATH_E_RFORMATERR)
strlcat(buf, "rformaterr ", blen);
if (err & INFINIPATH_E_RUNSUPVL)
@@ -781,32 +814,20 @@ void ipath_decode_err(char *buf, size_t 
strlcat(buf, "runexpchar ", blen);
if (err & INFINIPATH_E_RIBFLOW)
strlcat(buf, "ribflow ", blen);
-   if (err & INFINIPATH_E_REBP)
-   strlcat(buf, "EBP ", blen);
if (err & INFINIPATH_E_SUNDERRUN)
strlcat(buf, "sunderrun ", blen);
if (err & INFINIPATH_E_SPIOARMLAUNCH)
strlcat(buf, "spioarmlaunch ", blen);
if (err & INFINIPATH_E_SUNEXPERRPKTNUM)

[PATCH 11 of 33] IB/ipath - Change packet problems vs chip errors handling and reporting

2007-03-15 Thread Bryan O'Sullivan
# HG changeset patch
# User Bryan O'Sullivan [EMAIL PROTECTED]
# Date 1173994464 25200
# Node ID c793dc8a526564b73018924a707bcb21052f8f36
# Parent  4050989280f08d81d06642e3d6cf5c3ea4397107
IB/ipath - Change packet problems vs chip errors handling and reporting

Some types of packet errors are moderately common with longer IB
cables and large clusters, and are not reported with prints by
other IB HCA drivers.  This suppresses those messages unless the
new __IPATH_ERRPKTDBG bit is set in ipath_debug.  Reporting
of temporarily disabled frequent error interrupts was also made
clearer

We also distinguish between chip errors, and bad packets sent or
received in the wording of the messages.

Signed-off-by: Dave Olson [EMAIL PROTECTED]
Signed-off-by: Bryan O'Sullivan [EMAIL PROTECTED]

diff -r 4050989280f0 -r c793dc8a5265 drivers/infiniband/hw/ipath/ipath_debug.h
--- a/drivers/infiniband/hw/ipath/ipath_debug.h Thu Mar 15 14:34:24 2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_debug.h Thu Mar 15 14:34:24 2007 -0700
@@ -57,6 +57,7 @@
 #define __IPATH_PROCDBG 0x100
 /* print mmap/nopage stuff, not using VDBG any more */
 #define __IPATH_MMDBG   0x200
+#define __IPATH_ERRPKTDBG   0x400
 #define __IPATH_USER_SEND   0x1000 /* use user mode send */
 #define __IPATH_KERNEL_SEND 0x2000 /* use kernel mode send */
 #define __IPATH_EPKTDBG 0x4000 /* print ethernet packet data */
diff -r 4050989280f0 -r c793dc8a5265 drivers/infiniband/hw/ipath/ipath_driver.c
--- a/drivers/infiniband/hw/ipath/ipath_driver.cThu Mar 15 14:34:24 
2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_driver.cThu Mar 15 14:34:24 
2007 -0700
@@ -754,9 +754,42 @@ static int ipath_wait_linkstate(struct i
return (dd-ipath_flags  state) ? 0 : -ETIMEDOUT;
 }
 
-void ipath_decode_err(char *buf, size_t blen, ipath_err_t err)
-{
+/*
+ * Decode the error status into strings, deciding whether to always
+ * print * it or not depending on normal packet errors vs everything
+ * else.   Return 1 if real errors, otherwise 0 if only packet
+ * errors, so caller can decide what to print with the string.
+ */
+int ipath_decode_err(char *buf, size_t blen, ipath_err_t err)
+{
+   int iserr = 1;
*buf = '\0';
+   if (err  INFINIPATH_E_PKTERRS) {
+   if (!(err  ~INFINIPATH_E_PKTERRS))
+   iserr = 0; // if only packet errors.
+   if (ipath_debug  __IPATH_ERRPKTDBG) {
+   if (err  INFINIPATH_E_REBP)
+   strlcat(buf, EBP , blen);
+   if (err  INFINIPATH_E_RVCRC)
+   strlcat(buf, VCRC , blen);
+   if (err  INFINIPATH_E_RICRC) {
+   strlcat(buf, CRC , blen);
+   // clear for check below, so only once
+   err = INFINIPATH_E_RICRC; 
+   }
+   if (err  INFINIPATH_E_RSHORTPKTLEN)
+   strlcat(buf, rshortpktlen , blen);
+   if (err  INFINIPATH_E_SDROPPEDDATAPKT)
+   strlcat(buf, sdroppeddatapkt , blen);
+   if (err  INFINIPATH_E_SPKTLEN)
+   strlcat(buf, spktlen , blen);
+   }
+   if ((err  INFINIPATH_E_RICRC) 
+   !(err(INFINIPATH_E_RVCRC|INFINIPATH_E_REBP)))
+   strlcat(buf, CRC , blen);
+   if (!iserr)
+   goto done;
+   }
if (err  INFINIPATH_E_RHDRLEN)
strlcat(buf, rhdrlen , blen);
if (err  INFINIPATH_E_RBADTID)
@@ -767,12 +800,12 @@ void ipath_decode_err(char *buf, size_t 
strlcat(buf, rhdr , blen);
if (err  INFINIPATH_E_RLONGPKTLEN)
strlcat(buf, rlongpktlen , blen);
-   if (err  INFINIPATH_E_RSHORTPKTLEN)
-   strlcat(buf, rshortpktlen , blen);
if (err  INFINIPATH_E_RMAXPKTLEN)
strlcat(buf, rmaxpktlen , blen);
if (err  INFINIPATH_E_RMINPKTLEN)
strlcat(buf, rminpktlen , blen);
+   if (err  INFINIPATH_E_SMINPKTLEN)
+   strlcat(buf, sminpktlen , blen);
if (err  INFINIPATH_E_RFORMATERR)
strlcat(buf, rformaterr , blen);
if (err  INFINIPATH_E_RUNSUPVL)
@@ -781,32 +814,20 @@ void ipath_decode_err(char *buf, size_t 
strlcat(buf, runexpchar , blen);
if (err  INFINIPATH_E_RIBFLOW)
strlcat(buf, ribflow , blen);
-   if (err  INFINIPATH_E_REBP)
-   strlcat(buf, EBP , blen);
if (err  INFINIPATH_E_SUNDERRUN)
strlcat(buf, sunderrun , blen);
if (err  INFINIPATH_E_SPIOARMLAUNCH)
strlcat(buf, spioarmlaunch , blen);
if (err  INFINIPATH_E_SUNEXPERRPKTNUM)
strlcat(buf, sunexperrpktnum , blen);
-   if (err