patch-2.4.21 linux-2.4.21/drivers/net/sk98lin/skproc.c
Next file: linux-2.4.21/drivers/net/sk98lin/skqueue.c
Previous file: linux-2.4.21/drivers/net/sk98lin/sklm80.c
Back to the patch index
Back to the overall index
- Lines: 416
- Date:
2003-06-13 07:51:35.000000000 -0700
- Orig file:
linux-2.4.20/drivers/net/sk98lin/skproc.c
- Orig date:
2001-09-10 09:04:53.000000000 -0700
diff -urN linux-2.4.20/drivers/net/sk98lin/skproc.c linux-2.4.21/drivers/net/sk98lin/skproc.c
@@ -2,15 +2,15 @@
*
* Name: skproc.c
* Project: GEnesis, PCI Gigabit Ethernet Adapter
- * Version: $Revision: 1.2.2.2 $
- * Date: $Date: 2001/03/15 12:50:13 $
+ * Version: $Revision: 1.3 $
+ * Date: $Date: 2002/10/02 12:59:51 $
* Purpose: Funktions to display statictic data
*
******************************************************************************/
/******************************************************************************
*
- * (C)Copyright 1998-2001 SysKonnect GmbH.
+ * (C)Copyright 1998-2002 SysKonnect GmbH.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,6 +28,31 @@
* History:
*
* $Log: skproc.c,v $
+ * Revision 1.3 2002/10/02 12:59:51 mlindner
+ * Add: Support for Yukon
+ * Add: Speed check and setup
+ * Add: Merge source for kernel 2.2.x and 2.4.x
+ * Add: Read sensor names directly from VPD
+ * Fix: Volt values
+ *
+ * Revision 1.2.2.7 2002/01/14 12:45:15 mlindner
+ * Fix: Editorial changes
+ *
+ * Revision 1.2.2.6 2001/12/06 15:26:07 mlindner
+ * Fix: Return value of proc_read
+ *
+ * Revision 1.2.2.5 2001/12/06 09:57:39 mlindner
+ * New ProcFs entries
+ *
+ * Revision 1.2.2.4 2001/09/05 12:16:02 mlindner
+ * Add: New ProcFs entries
+ * Fix: Counter Errors (Jumbo == to long errors)
+ * Fix: Kernel error compilation
+ * Fix: too short counters
+ *
+ * Revision 1.2.2.3 2001/06/25 07:26:26 mlindner
+ * Add: More error messages
+ *
* Revision 1.2.2.2 2001/03/15 12:50:13 mlindner
* fix: ProcFS owner protection
*
@@ -46,36 +71,24 @@
#include "h/skdrv1st.h"
#include "h/skdrv2nd.h"
-#define ZEROPAD 1 /* pad with zero */
-#define SIGN 2 /* unsigned/signed long */
-#define PLUS 4 /* show plus */
-#define SPACE 8 /* space if plus */
-#define LEFT 16 /* left justified */
-//#define SPECIAL 32 /* 0x */
-#define LARGE 64
-
-extern void proc_fill_inode(struct inode *inode, int fill);
-extern char * SkNumber(char * str, long long num, int base, int size,
- int precision ,int type);
-int proc_read(char *buffer,
- char **buffer_location,
- off_t offset,
- int buffer_length,
- int *eof,
- void *data);
-
-static const char SK_Root_Dir_entry[] = "sk98lin";
-extern struct net_device *sk98lin_root_dev;
-
-
-struct proc_dir_entry pSkRootDir = {
- 0,
- sizeof(SK_Root_Dir_entry)-1,
- (const char*)SK_Root_Dir_entry,
- S_IFDIR | S_IRUGO,
- 2, 0, 0, 0, NULL,
- NULL
-};
+#define ZEROPAD 1 /* pad with zero */
+#define SIGN 2 /* unsigned/signed long */
+#define PLUS 4 /* show plus */
+#define SPACE 8 /* space if plus */
+#define LEFT 16 /* left justified */
+#define SPECIALX 32 /* 0x */
+#define LARGE 64
+
+extern SK_AC *pACList;
+extern struct net_device *SkGeRootDev;
+
+extern char * SkNumber(
+ char * str,
+ long long num,
+ int base,
+ int size,
+ int precision,
+ int type);
/*****************************************************************************
@@ -100,13 +113,14 @@
int len = 0;
int t;
int i;
- DEV_NET *pNet;
- SK_AC *pAC;
- char test_buf[100];
+ DEV_NET *pNet;
+ SK_AC *pAC;
+ char test_buf[100];
+ char sens_msg[50];
unsigned long Flags;
unsigned int Size;
- struct net_device *next;
- struct net_device *SkgeProcDev = sk98lin_root_dev;
+ struct SK_NET_DEVICE *next;
+ struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev;
SK_PNMI_STRUCT_DATA *pPnmiStruct;
SK_PNMI_STAT *pPnmiStat;
@@ -122,7 +136,7 @@
for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
t--;
-
+
spin_lock_irqsave(&pAC->SlowPathLock, Flags);
Size = SK_PNMI_STRUCT_SIZE;
SkPnmiGetStruct(pAC, pAC->IoBase,
@@ -135,151 +149,214 @@
"\nDetailed statistic for device %s\n",
pAC->dev[t-1]->name);
len += sprintf(buffer + len,
- "==================================\n");
+ "=======================================\n");
/* Board statistics */
len += sprintf(buffer + len,
"\nBoard statistics\n\n");
len += sprintf(buffer + len,
- "Active Port %c\n",
+ "Active Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
len += sprintf(buffer + len,
- "Preferred Port %c\n",
+ "Preferred Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber);
len += sprintf(buffer + len,
- "Bus speed (Mhz) %d\n",
+ "Bus speed (MHz) %d\n",
pPnmiStruct->BusSpeed);
len += sprintf(buffer + len,
- "Bus width (Bit) %d\n",
+ "Bus width (Bit) %d\n",
pPnmiStruct->BusWidth);
-
- for (i=0; i < SK_MAX_SENSORS; i ++) {
- if (strcmp(pAC->I2c.SenTable[i].SenDesc,
- "Temperature") == 0 ) {
+ len += sprintf(buffer + len,
+ "Hardware revision v%d.%d\n",
+ (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
+ pAC->GIni.GIPciHwRev & 0x0F);
+
+ /* Print sensor informations */
+ for (i=0; i < pAC->I2c.MaxSens; i ++) {
+ /* Check type */
+ switch (pAC->I2c.SenTable[i].SenType) {
+ case 1:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (C)");
len += sprintf(buffer + len,
- "Temperature (C) %d.%d\n",
+ "%-25s %d.%02d\n",
+ sens_msg,
pAC->I2c.SenTable[i].SenValue / 10,
pAC->I2c.SenTable[i].SenValue % 10);
+
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (F)");
len += sprintf(buffer + len,
- "Temperature (F) %d.%d\n",
+ "%-25s %d.%02d\n",
+ sens_msg,
((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200)/100,
((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200) % 10);
- } else if (strcmp(pAC->I2c.SenTable[i].SenDesc,
- "Speed Fan") == 0 ) {
- len += sprintf(buffer + len,
- "Speed Fan %d\n",
- pAC->I2c.SenTable[i].SenValue);
- } else {
+ break;
+ case 2:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (V)");
len += sprintf(buffer + len,
- "%-20s %d.%d\n",
- pAC->I2c.SenTable[i].SenDesc,
+ "%-25s %d.%03d\n",
+ sens_msg,
pAC->I2c.SenTable[i].SenValue / 1000,
pAC->I2c.SenTable[i].SenValue % 1000);
+ break;
+ case 3:
+ strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
+ strcat(sens_msg, " (rpm)");
+ len += sprintf(buffer + len,
+ "%-25s %d\n",
+ sens_msg,
+ pAC->I2c.SenTable[i].SenValue);
+ break;
+ default:
+ break;
}
}
/*Receive statistics */
-
len += sprintf(buffer + len,
"\nReceive statistics\n\n");
len += sprintf(buffer + len,
- "Received bytes %s\n",
+ "Received bytes %s\n",
SkNumber(test_buf, pPnmiStat->StatRxOctetsOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Received packets %s\n",
+ "Received packets %s\n",
SkNumber(test_buf, pPnmiStat->StatRxOkCts,
10,0,-1,0));
+#if 0
+ if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
+ pAC->HWRevision < 12) {
+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
+ pPnmiStat->StatRxShortsCts;
+ pPnmiStat->StatRxShortsCts = 0;
+ }
+#endif
+ if (pNet->Mtu > 1500)
+ pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
+ pPnmiStat->StatRxTooLongCts;
+
len += sprintf(buffer + len,
- "Received errors %s\n",
- SkNumber(test_buf, pPnmiStat->StatRxFcsCts,
+ "Receive errors %s\n",
+ SkNumber(test_buf, pPnmiStruct->InErrorsCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Received dropped %s\n",
+ "Receive drops %s\n",
SkNumber(test_buf, pPnmiStruct->RxNoBufCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Received multicast %s\n",
+ "Received multicast %s\n",
SkNumber(test_buf, pPnmiStat->StatRxMulticastOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Received errors types\n");
+ "Receive error types\n");
len += sprintf(buffer + len,
- " length errors %s\n",
+ " length %s\n",
SkNumber(test_buf, pPnmiStat->StatRxRuntCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " over errors %s\n",
+ " buffer overflow %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFifoOverflowCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " crc errors %s\n",
+ " bad crc %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFcsCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " frame errors %s\n",
+ " framing %s\n",
SkNumber(test_buf, pPnmiStat->StatRxFramingCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " fifo errors %s\n",
- SkNumber(test_buf, pPnmiStat->StatRxFifoOverflowCts,
- 10, 0, -1, 0));
- len += sprintf(buffer + len,
- " missed errors %s\n",
+ " missed frames %s\n",
SkNumber(test_buf, pPnmiStat->StatRxMissedCts,
10, 0, -1, 0));
-
+
+ if (pNet->Mtu > 1500)
+ pPnmiStat->StatRxTooLongCts = 0;
+
+ len += sprintf(buffer + len,
+ " too long %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxTooLongCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " carrier extension %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxCextCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " too short %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxShortsCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " symbol %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxSymbolCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " LLC MAC size %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxIRLengthCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " carrier event %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxCarrierCts,
+ 10, 0, -1, 0));
+ len += sprintf(buffer + len,
+ " jabber %s\n",
+ SkNumber(test_buf, pPnmiStat->StatRxJabberCts,
+ 10, 0, -1, 0));
+
+
/*Transmit statistics */
len += sprintf(buffer + len,
"\nTransmit statistics\n\n");
len += sprintf(buffer + len,
- "Transmit bytes %s\n",
+ "Transmited bytes %s\n",
SkNumber(test_buf, pPnmiStat->StatTxOctetsOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Transmit packets %s\n",
+ "Transmited packets %s\n",
SkNumber(test_buf, pPnmiStat->StatTxOkCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Transmit errors %s\n",
+ "Transmit errors %s\n",
SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Transmit dropped %s\n",
+ "Transmit dropped %s\n",
SkNumber(test_buf, pPnmiStruct->TxNoBufCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Transmit collisions %s\n",
+ "Transmit collisions %s\n",
SkNumber(test_buf, pPnmiStat->StatTxSingleCollisionCts,
10,0,-1,0));
len += sprintf(buffer + len,
- "Transmited errors types\n");
+ "Transmit errors types\n");
len += sprintf(buffer + len,
- " aborted errors %ld\n",
+ " excessive collision %ld\n",
pAC->stats.tx_aborted_errors);
len += sprintf(buffer + len,
- " carrier errors %s\n",
+ " carrier %s\n",
SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " fifo errors %s\n",
+ " fifo underrun %s\n",
SkNumber(test_buf, pPnmiStat->StatTxFifoUnderrunCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " heartbeat errors %s\n",
+ " heartbeat %s\n",
SkNumber(test_buf, pPnmiStat->StatTxCarrierCts,
10, 0, -1, 0));
len += sprintf(buffer + len,
- " window errors %ld\n",
+ " window %ld\n",
pAC->stats.tx_window_errors);
+
}
}
SkgeProcDev = next;
@@ -388,7 +465,7 @@
size--;
}
}
- if (type & SPECIAL) {
+ if (type & SPECIALX) {
if (base == 16)
size -= 2;
else if (base == 8)
@@ -408,7 +485,7 @@
*str++ = ' ';
if (sign)
*str++ = sign;
- if (type & SPECIAL) {
+ if (type & SPECIALX) {
if (base==8)
*str++ = '0';
else if (base==16) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)