Commit 9a78f14f authored by Stephen Hemminger's avatar Stephen Hemminger

[PATCH] sk98: /proc interface related changes

The /proc intereface can be cleaned up a lot:
+ Pass the device to through the proc data/seq_private hook.
+ No longer needs to have a list of network devices
+ use seq_printf directly rather than indirection into a buffer
+ failure to create proc directory or interface should not
  be fatal.
+ if PROC_FS not configured, let the stubs cause the necessary
  code elimination rather than using #ifdef
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 39ca4394
...@@ -266,7 +266,6 @@ struct s_TxD { ...@@ -266,7 +266,6 @@ struct s_TxD {
typedef struct s_DevNet DEV_NET; typedef struct s_DevNet DEV_NET;
struct s_DevNet { struct s_DevNet {
struct proc_dir_entry *proc;
int PortNr; int PortNr;
int NetNr; int NetNr;
int Mtu; int Mtu;
...@@ -395,7 +394,7 @@ struct s_AC { ...@@ -395,7 +394,7 @@ struct s_AC {
SK_U32 PciDevId; /* pci device id */ SK_U32 PciDevId; /* pci device id */
struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */ struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
char Name[30]; /* driver name */ char Name[30]; /* driver name */
struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */
int RxBufSize; /* length of receive buffers */ int RxBufSize; /* length of receive buffers */
struct net_device_stats stats; /* linux 'netstat -i' statistics */ struct net_device_stats stats; /* linux 'netstat -i' statistics */
int Index; /* internal board index number */ int Index; /* internal board index number */
......
...@@ -233,12 +233,27 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); ...@@ -233,12 +233,27 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
* Extern Function Prototypes * Extern Function Prototypes
* *
******************************************************************************/ ******************************************************************************/
static const char SKRootName[] = "sk98lin";
#ifdef CONFIG_PROC_FS
static const char SK_Root_Dir_entry[] = "sk98lin";
static struct proc_dir_entry *pSkRootDir; static struct proc_dir_entry *pSkRootDir;
extern struct file_operations sk_proc_fops; extern struct file_operations sk_proc_fops;
#endif
static inline void SkGeProcCreate(struct net_device *dev)
{
struct proc_dir_entry *pe;
if (pSkRootDir &&
(pe = create_proc_entry(dev->name, S_IRUGO, pSkRootDir))) {
pe->proc_fops = &sk_proc_fops;
pe->data = dev;
pe->owner = THIS_MODULE;
}
}
static inline void SkGeProcRemove(struct net_device *dev)
{
if (pSkRootDir)
remove_proc_entry(dev->name, pSkRootDir);
}
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
extern void SkDimDisplayModerationSettings(SK_AC *pAC); extern void SkDimDisplayModerationSettings(SK_AC *pAC);
...@@ -252,7 +267,6 @@ static void DumpLong(char*, int); ...@@ -252,7 +267,6 @@ static void DumpLong(char*, int);
#endif #endif
/* global variables *********************************************************/ /* global variables *********************************************************/
struct SK_NET_DEVICE *SkGeRootDev = NULL;
static SK_BOOL DoPrintInterfaceChange = SK_TRUE; static SK_BOOL DoPrintInterfaceChange = SK_TRUE;
/* local variables **********************************************************/ /* local variables **********************************************************/
...@@ -601,12 +615,6 @@ SK_BOOL DualNet; ...@@ -601,12 +615,6 @@ SK_BOOL DualNet;
return(-EAGAIN); return(-EAGAIN);
} }
/*
* Register the device here
*/
pAC->Next = SkGeRootDev;
SkGeRootDev = dev;
return (0); return (0);
} /* SkGeBoardInit */ } /* SkGeBoardInit */
...@@ -4876,9 +4884,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, ...@@ -4876,9 +4884,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
SK_AC *pAC; SK_AC *pAC;
DEV_NET *pNet = NULL; DEV_NET *pNet = NULL;
struct net_device *dev = NULL; struct net_device *dev = NULL;
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *pProcFile;
#endif
static int boards_found = 0; static int boards_found = 0;
int error = -ENODEV; int error = -ENODEV;
...@@ -4974,14 +4979,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, ...@@ -4974,14 +4979,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6); memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6);
#ifdef CONFIG_PROC_FS SkGeProcCreate(dev);
pProcFile = create_proc_entry(dev->name, S_IRUGO, pSkRootDir);
if (pProcFile) {
pProcFile->proc_fops = &sk_proc_fops;
pProcFile->data = dev;
pProcFile->owner = THIS_MODULE;
}
#endif
pNet->PortNr = 0; pNet->PortNr = 0;
pNet->NetNr = 0; pNet->NetNr = 0;
...@@ -5028,16 +5026,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, ...@@ -5028,16 +5026,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
free_netdev(dev); free_netdev(dev);
pAC->dev[1] = pAC->dev[0]; pAC->dev[1] = pAC->dev[0];
} else { } else {
#ifdef CONFIG_PROC_FS SkGeProcCreate(dev);
pProcFile = create_proc_entry(dev->name, S_IRUGO,
pSkRootDir);
if (pProcFile) {
pProcFile->proc_fops = &sk_proc_fops;
pProcFile->data = dev;
pProcFile->owner = THIS_MODULE;
}
#endif
memcpy(&dev->dev_addr, memcpy(&dev->dev_addr,
&pAC->Addr.Net[1].CurrentMacAddress, 6); &pAC->Addr.Net[1].CurrentMacAddress, 6);
...@@ -5075,17 +5064,12 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) ...@@ -5075,17 +5064,12 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
DEV_NET *pNet = (DEV_NET *) dev->priv; DEV_NET *pNet = (DEV_NET *) dev->priv;
SK_AC *pAC = pNet->pAC; SK_AC *pAC = pNet->pAC;
int have_second_mac = 0; struct net_device *otherdev = pAC->dev[1];
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2)
have_second_mac = 1;
remove_proc_entry(dev->name, pSkRootDir); SkGeProcRemove(dev);
unregister_netdev(dev); unregister_netdev(dev);
if (have_second_mac) { if (otherdev != dev)
remove_proc_entry(pAC->dev[1]->name, pSkRootDir); SkGeProcRemove(otherdev);
unregister_netdev(pAC->dev[1]);
}
SkGeYellowLED(pAC, pAC->IoBase, 0); SkGeYellowLED(pAC, pAC->IoBase, 0);
...@@ -5118,8 +5102,8 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) ...@@ -5118,8 +5102,8 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
FreeResources(dev); FreeResources(dev);
free_netdev(dev); free_netdev(dev);
if (have_second_mac) if (otherdev != dev)
free_netdev(pAC->dev[1]); free_netdev(otherdev);
kfree(pAC); kfree(pAC);
} }
...@@ -5152,34 +5136,21 @@ static int __init skge_init(void) ...@@ -5152,34 +5136,21 @@ static int __init skge_init(void)
{ {
int error; int error;
#ifdef CONFIG_PROC_FS pSkRootDir = proc_mkdir(SKRootName, proc_net);
memcpy(&SK_Root_Dir_entry, BOOT_STRING, sizeof(SK_Root_Dir_entry) - 1); if (pSkRootDir)
pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net);
if (!pSkRootDir) {
printk(KERN_WARNING "Unable to create /proc/net/%s",
SK_Root_Dir_entry);
return -ENOMEM;
}
pSkRootDir->owner = THIS_MODULE; pSkRootDir->owner = THIS_MODULE;
#endif
error = pci_module_init(&skge_driver);
if (error) {
#ifdef CONFIG_PROC_FS
remove_proc_entry(pSkRootDir->name, proc_net);
#endif
}
error = pci_register_driver(&skge_driver);
if (error)
proc_net_remove(SKRootName);
return error; return error;
} }
static void __exit skge_exit(void) static void __exit skge_exit(void)
{ {
pci_unregister_driver(&skge_driver); pci_unregister_driver(&skge_driver);
#ifdef CONFIG_PROC_FS proc_net_remove(SKRootName);
remove_proc_entry(pSkRootDir->name, proc_net);
#endif
} }
module_init(skge_init); module_init(skge_init);
......
...@@ -31,13 +31,9 @@ ...@@ -31,13 +31,9 @@
#include "h/skdrv2nd.h" #include "h/skdrv2nd.h"
#include "h/skversion.h" #include "h/skversion.h"
extern struct SK_NET_DEVICE *SkGeRootDev;
static int sk_proc_print(void *writePtr, char *format, ...);
static void sk_gen_browse(void *buffer);
int len;
static int sk_seq_show(struct seq_file *seq, void *v); static int sk_seq_show(struct seq_file *seq, void *v);
static int sk_proc_open(struct inode *inode, struct file *file); static int sk_proc_open(struct inode *inode, struct file *file);
struct file_operations sk_proc_fops = { struct file_operations sk_proc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = sk_proc_open, .open = sk_proc_open,
...@@ -45,46 +41,33 @@ struct file_operations sk_proc_fops = { ...@@ -45,46 +41,33 @@ struct file_operations sk_proc_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release, .release = single_release,
}; };
struct net_device *currDev = NULL;
/***************************************************************************** /*****************************************************************************
* *
* sk_gen_browse -generic print "summaries" entry * sk_seq_show - show proc information of a particular adapter
* *
* Description: * Description:
* This function fills the proc entry with statistic data about * This function fills the proc entry with statistic data about
* the ethernet device. * the ethernet device. It invokes the generic sk_gen_browse() to
* print out all items one per one.
* *
* Returns: - * Returns: 0
* *
*/ */
static void sk_gen_browse(void *buffer) static int sk_seq_show(struct seq_file *seq, void *v)
{ {
struct SK_NET_DEVICE *SkgeProcDev = SkGeRootDev; struct net_device *dev = seq->private;
struct SK_NET_DEVICE *next; DEV_NET *pNet = netdev_priv(dev);
SK_PNMI_STRUCT_DATA *pPnmiStruct; SK_AC *pAC = pNet->pAC;
SK_PNMI_STAT *pPnmiStat; SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
unsigned long Flags; unsigned long Flags;
unsigned int Size; unsigned int Size;
DEV_NET *pNet;
SK_AC *pAC;
char sens_msg[50]; char sens_msg[50];
int MaxSecurityCount = 0;
int t; int t;
int i; int i;
while (SkgeProcDev) {
MaxSecurityCount++;
if (MaxSecurityCount > 100) {
printk("Max limit for sk_proc_read security counter!\n");
return;
}
pNet = (DEV_NET*) SkgeProcDev->priv;
pAC = pNet->pAC;
next = pAC->Next;
pPnmiStruct = &pAC->PnmiStruct;
/* NetIndex in GetStruct is now required, zero is only dummy */ /* NetIndex in GetStruct is now required, zero is only dummy */
for (t=pAC->GIni.GIMacsFound; t > 0; t--) { for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1) if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
t--; t--;
...@@ -106,38 +89,30 @@ static void sk_gen_browse(void *buffer) ...@@ -106,38 +89,30 @@ static void sk_gen_browse(void *buffer)
#endif #endif
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
if (strcmp(pAC->dev[t-1]->name, currDev->name) == 0) { if (pAC->dev[t-1] == dev) {
pPnmiStat = &pPnmiStruct->Stat[0]; SK_PNMI_STAT *pPnmiStat = &pPnmiStruct->Stat[0];
len = sk_proc_print(buffer,
"\nDetailed statistic for device %s\n", seq_printf(seq, "\nDetailed statistic for device %s\n",
pAC->dev[t-1]->name); pAC->dev[t-1]->name);
len += sk_proc_print(buffer, seq_printf(seq, "=======================================\n");
"=======================================\n");
/* Board statistics */ /* Board statistics */
len += sk_proc_print(buffer, seq_printf(seq, "\nBoard statistics\n\n");
"\nBoard statistics\n\n"); seq_printf(seq, "Active Port %c\n",
len += sk_proc_print(buffer,
"Active Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber); Net[t-1].PrefPort]->PortNumber);
len += sk_proc_print(buffer, seq_printf(seq, "Preferred Port %c\n",
"Preferred Port %c\n",
'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
Net[t-1].PrefPort]->PortNumber); Net[t-1].PrefPort]->PortNumber);
len += sk_proc_print(buffer, seq_printf(seq, "Bus speed (MHz) %d\n",
"Bus speed (MHz) %d\n",
pPnmiStruct->BusSpeed); pPnmiStruct->BusSpeed);
len += sk_proc_print(buffer, seq_printf(seq, "Bus width (Bit) %d\n",
"Bus width (Bit) %d\n",
pPnmiStruct->BusWidth); pPnmiStruct->BusWidth);
len += sk_proc_print(buffer, seq_printf(seq, "Driver version %s\n",
"Driver version %s\n",
VER_STRING); VER_STRING);
len += sk_proc_print(buffer, seq_printf(seq, "Hardware revision v%d.%d\n",
"Hardware revision v%d.%d\n",
(pAC->GIni.GIPciHwRev >> 4) & 0x0F, (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
pAC->GIni.GIPciHwRev & 0x0F); pAC->GIni.GIPciHwRev & 0x0F);
...@@ -148,16 +123,14 @@ static void sk_gen_browse(void *buffer) ...@@ -148,16 +123,14 @@ static void sk_gen_browse(void *buffer)
case 1: case 1:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (C)"); strcat(sens_msg, " (C)");
len += sk_proc_print(buffer, seq_printf(seq, "%-25s %d.%02d\n",
"%-25s %d.%02d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue / 10, pAC->I2c.SenTable[i].SenValue / 10,
pAC->I2c.SenTable[i].SenValue % 10); pAC->I2c.SenTable[i].SenValue % 10);
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (F)"); strcat(sens_msg, " (F)");
len += sk_proc_print(buffer, seq_printf(seq, "%-25s %d.%02d\n",
"%-25s %d.%02d\n",
sens_msg, sens_msg,
((((pAC->I2c.SenTable[i].SenValue) ((((pAC->I2c.SenTable[i].SenValue)
*10)*9)/5 + 3200)/100, *10)*9)/5 + 3200)/100,
...@@ -167,8 +140,7 @@ static void sk_gen_browse(void *buffer) ...@@ -167,8 +140,7 @@ static void sk_gen_browse(void *buffer)
case 2: case 2:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (V)"); strcat(sens_msg, " (V)");
len += sk_proc_print(buffer, seq_printf(seq, "%-25s %d.%03d\n",
"%-25s %d.%03d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue / 1000, pAC->I2c.SenTable[i].SenValue / 1000,
pAC->I2c.SenTable[i].SenValue % 1000); pAC->I2c.SenTable[i].SenValue % 1000);
...@@ -176,8 +148,7 @@ static void sk_gen_browse(void *buffer) ...@@ -176,8 +148,7 @@ static void sk_gen_browse(void *buffer)
case 3: case 3:
strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
strcat(sens_msg, " (rpm)"); strcat(sens_msg, " (rpm)");
len += sk_proc_print(buffer, seq_printf(seq, "%-25s %d\n",
"%-25s %d\n",
sens_msg, sens_msg,
pAC->I2c.SenTable[i].SenValue); pAC->I2c.SenTable[i].SenValue);
break; break;
...@@ -187,14 +158,11 @@ static void sk_gen_browse(void *buffer) ...@@ -187,14 +158,11 @@ static void sk_gen_browse(void *buffer)
} }
/*Receive statistics */ /*Receive statistics */
len += sk_proc_print(buffer, seq_printf(seq, "\nReceive statistics\n\n");
"\nReceive statistics\n\n");
len += sk_proc_print(buffer, seq_printf(seq, "Received bytes %Lu\n",
"Received bytes %Lu\n",
(unsigned long long) pPnmiStat->StatRxOctetsOkCts); (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
len += sk_proc_print(buffer, seq_printf(seq, "Received packets %Lu\n",
"Received packets %Lu\n",
(unsigned long long) pPnmiStat->StatRxOkCts); (unsigned long long) pPnmiStat->StatRxOkCts);
#if 0 #if 0
if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
...@@ -204,155 +172,74 @@ static void sk_gen_browse(void *buffer) ...@@ -204,155 +172,74 @@ static void sk_gen_browse(void *buffer)
pPnmiStat->StatRxShortsCts = 0; pPnmiStat->StatRxShortsCts = 0;
} }
#endif #endif
if (pNet->Mtu > 1500) if (dev->mtu > 1500)
pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
pPnmiStat->StatRxTooLongCts; pPnmiStat->StatRxTooLongCts;
len += sk_proc_print(buffer, seq_printf(seq, "Receive errors %Lu\n",
"Receive errors %Lu\n",
(unsigned long long) pPnmiStruct->InErrorsCts); (unsigned long long) pPnmiStruct->InErrorsCts);
len += sk_proc_print(buffer, seq_printf(seq, "Receive dropped %Lu\n",
"Receive dropped %Lu\n",
(unsigned long long) pPnmiStruct->RxNoBufCts); (unsigned long long) pPnmiStruct->RxNoBufCts);
len += sk_proc_print(buffer, seq_printf(seq, "Received multicast %Lu\n",
"Received multicast %Lu\n",
(unsigned long long) pPnmiStat->StatRxMulticastOkCts); (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
len += sk_proc_print(buffer, seq_printf(seq, "Receive error types\n");
"Receive error types\n"); seq_printf(seq, " length %Lu\n",
len += sk_proc_print(buffer,
" length %Lu\n",
(unsigned long long) pPnmiStat->StatRxRuntCts); (unsigned long long) pPnmiStat->StatRxRuntCts);
len += sk_proc_print(buffer, seq_printf(seq, " buffer overflow %Lu\n",
" buffer overflow %Lu\n",
(unsigned long long) pPnmiStat->StatRxFifoOverflowCts); (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
len += sk_proc_print(buffer, seq_printf(seq, " bad crc %Lu\n",
" bad crc %Lu\n",
(unsigned long long) pPnmiStat->StatRxFcsCts); (unsigned long long) pPnmiStat->StatRxFcsCts);
len += sk_proc_print(buffer, seq_printf(seq, " framing %Lu\n",
" framing %Lu\n",
(unsigned long long) pPnmiStat->StatRxFramingCts); (unsigned long long) pPnmiStat->StatRxFramingCts);
len += sk_proc_print(buffer, seq_printf(seq, " missed frames %Lu\n",
" missed frames %Lu\n",
(unsigned long long) pPnmiStat->StatRxMissedCts); (unsigned long long) pPnmiStat->StatRxMissedCts);
if (pNet->Mtu > 1500) if (dev->mtu > 1500)
pPnmiStat->StatRxTooLongCts = 0; pPnmiStat->StatRxTooLongCts = 0;
len += sk_proc_print(buffer, seq_printf(seq, " too long %Lu\n",
" too long %Lu\n",
(unsigned long long) pPnmiStat->StatRxTooLongCts); (unsigned long long) pPnmiStat->StatRxTooLongCts);
len += sk_proc_print(buffer, seq_printf(seq, " carrier extension %Lu\n",
" carrier extension %Lu\n",
(unsigned long long) pPnmiStat->StatRxCextCts); (unsigned long long) pPnmiStat->StatRxCextCts);
len += sk_proc_print(buffer, seq_printf(seq, " too short %Lu\n",
" too short %Lu\n",
(unsigned long long) pPnmiStat->StatRxShortsCts); (unsigned long long) pPnmiStat->StatRxShortsCts);
len += sk_proc_print(buffer, seq_printf(seq, " symbol %Lu\n",
" symbol %Lu\n",
(unsigned long long) pPnmiStat->StatRxSymbolCts); (unsigned long long) pPnmiStat->StatRxSymbolCts);
len += sk_proc_print(buffer, seq_printf(seq, " LLC MAC size %Lu\n",
" LLC MAC size %Lu\n",
(unsigned long long) pPnmiStat->StatRxIRLengthCts); (unsigned long long) pPnmiStat->StatRxIRLengthCts);
len += sk_proc_print(buffer, seq_printf(seq, " carrier event %Lu\n",
" carrier event %Lu\n",
(unsigned long long) pPnmiStat->StatRxCarrierCts); (unsigned long long) pPnmiStat->StatRxCarrierCts);
len += sk_proc_print(buffer, seq_printf(seq, " jabber %Lu\n",
" jabber %Lu\n",
(unsigned long long) pPnmiStat->StatRxJabberCts); (unsigned long long) pPnmiStat->StatRxJabberCts);
/*Transmit statistics */ /*Transmit statistics */
len += sk_proc_print(buffer, seq_printf(seq, "\nTransmit statistics\n\n");
"\nTransmit statistics\n\n");
len += sk_proc_print(buffer, seq_printf(seq, "Transmited bytes %Lu\n",
"Transmited bytes %Lu\n",
(unsigned long long) pPnmiStat->StatTxOctetsOkCts); (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
len += sk_proc_print(buffer, seq_printf(seq, "Transmited packets %Lu\n",
"Transmited packets %Lu\n",
(unsigned long long) pPnmiStat->StatTxOkCts); (unsigned long long) pPnmiStat->StatTxOkCts);
len += sk_proc_print(buffer, seq_printf(seq, "Transmit errors %Lu\n",
"Transmit errors %Lu\n",
(unsigned long long) pPnmiStat->StatTxSingleCollisionCts); (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
len += sk_proc_print(buffer, seq_printf(seq, "Transmit dropped %Lu\n",
"Transmit dropped %Lu\n",
(unsigned long long) pPnmiStruct->TxNoBufCts); (unsigned long long) pPnmiStruct->TxNoBufCts);
len += sk_proc_print(buffer, seq_printf(seq, "Transmit collisions %Lu\n",
"Transmit collisions %Lu\n",
(unsigned long long) pPnmiStat->StatTxSingleCollisionCts); (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
len += sk_proc_print(buffer, seq_printf(seq, "Transmit error types\n");
"Transmit error types\n"); seq_printf(seq, " excessive collision %ld\n",
len += sk_proc_print(buffer,
" excessive collision %ld\n",
pAC->stats.tx_aborted_errors); pAC->stats.tx_aborted_errors);
len += sk_proc_print(buffer, seq_printf(seq, " carrier %Lu\n",
" carrier %Lu\n",
(unsigned long long) pPnmiStat->StatTxCarrierCts); (unsigned long long) pPnmiStat->StatTxCarrierCts);
len += sk_proc_print(buffer, seq_printf(seq, " fifo underrun %Lu\n",
" fifo underrun %Lu\n",
(unsigned long long) pPnmiStat->StatTxFifoUnderrunCts); (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
len += sk_proc_print(buffer, seq_printf(seq, " heartbeat %Lu\n",
" heartbeat %Lu\n",
(unsigned long long) pPnmiStat->StatTxCarrierCts); (unsigned long long) pPnmiStat->StatTxCarrierCts);
len += sk_proc_print(buffer, seq_printf(seq, " window %ld\n",
" window %ld\n",
pAC->stats.tx_window_errors); pAC->stats.tx_window_errors);
} /* if (strcmp(pACname, currDeviceName) == 0) */
} }
SkgeProcDev = next;
} }
}
/*****************************************************************************
*
* sk_proc_print -generic line print
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device.
*
* Returns: number of bytes written
*
*/
static int sk_proc_print(void *writePtr, char *format, ...)
{
#define MAX_LEN_SINGLE_LINE 256
char str[MAX_LEN_SINGLE_LINE];
va_list a_start;
int lenght = 0;
struct seq_file *seq = (struct seq_file *) writePtr;
SK_MEMSET(str, 0, MAX_LEN_SINGLE_LINE);
va_start(a_start, format);
vsprintf(str, format, a_start);
va_end(a_start);
lenght = strlen(str);
seq_printf(seq, str);
return lenght;
}
/*****************************************************************************
*
* sk_seq_show - show proc information of a particular adapter
*
* Description:
* This function fills the proc entry with statistic data about
* the ethernet device. It invokes the generic sk_gen_browse() to
* print out all items one per one.
*
* Returns: number of bytes written
*
*/
static int sk_seq_show(struct seq_file *seq, void *v)
{
void *castedBuffer = (void *) seq;
currDev = seq->private;
sk_gen_browse(castedBuffer);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment