aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sk98lin
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sk98lin')
-rw-r--r--drivers/net/sk98lin/Makefile3
-rw-r--r--drivers/net/sk98lin/h/skdrv2nd.h9
-rw-r--r--drivers/net/sk98lin/h/skvpd.h8
-rw-r--r--drivers/net/sk98lin/skethtool.c48
-rw-r--r--drivers/net/sk98lin/skge.c212
-rw-r--r--drivers/net/sk98lin/skproc.c265
6 files changed, 132 insertions, 413 deletions
diff --git a/drivers/net/sk98lin/Makefile b/drivers/net/sk98lin/Makefile
index 7653d6e33aa2..afd900d5d730 100644
--- a/drivers/net/sk98lin/Makefile
+++ b/drivers/net/sk98lin/Makefile
@@ -26,8 +26,7 @@ sk98lin-objs := \
26 skrlmt.o \ 26 skrlmt.o \
27 sktimer.o \ 27 sktimer.o \
28 skvpd.o \ 28 skvpd.o \
29 skxmac2.o \ 29 skxmac2.o
30 skproc.o
31 30
32# DBGDEF = \ 31# DBGDEF = \
33# -DDEBUG 32# -DDEBUG
diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h
index 2dc5728e3ef6..778d9e618ebd 100644
--- a/drivers/net/sk98lin/h/skdrv2nd.h
+++ b/drivers/net/sk98lin/h/skdrv2nd.h
@@ -60,7 +60,6 @@ extern SK_U64 SkOsGetTime(SK_AC*);
60extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*); 60extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*);
61extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*); 61extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*);
62extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*); 62extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*);
63extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32);
64extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16); 63extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16);
65extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8); 64extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8);
66extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA); 65extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA);
@@ -268,8 +267,6 @@ typedef struct s_DevNet DEV_NET;
268struct s_DevNet { 267struct s_DevNet {
269 int PortNr; 268 int PortNr;
270 int NetNr; 269 int NetNr;
271 int Mtu;
272 int Up;
273 SK_AC *pAC; 270 SK_AC *pAC;
274}; 271};
275 272
@@ -298,6 +295,7 @@ struct s_RxPort {
298 RXD *pRxdRingTail; /* Tail of Rx rings */ 295 RXD *pRxdRingTail; /* Tail of Rx rings */
299 RXD *pRxdRingPrev; /* descriptor given to BMU previously */ 296 RXD *pRxdRingPrev; /* descriptor given to BMU previously */
300 int RxdRingFree; /* # of free entrys */ 297 int RxdRingFree; /* # of free entrys */
298 int RxCsum; /* use receive checksum hardware */
301 spinlock_t RxDesRingLock; /* serialize descriptor accesses */ 299 spinlock_t RxDesRingLock; /* serialize descriptor accesses */
302 int RxFillLimit; /* limit for buffers in ring */ 300 int RxFillLimit; /* limit for buffers in ring */
303 SK_IOC HwAddr; /* bmu registers address */ 301 SK_IOC HwAddr; /* bmu registers address */
@@ -390,12 +388,10 @@ struct s_AC {
390 388
391 SK_IOC IoBase; /* register set of adapter */ 389 SK_IOC IoBase; /* register set of adapter */
392 int BoardLevel; /* level of active hw init (0-2) */ 390 int BoardLevel; /* level of active hw init (0-2) */
393 char DeviceStr[80]; /* adapter string from vpd */ 391
394 SK_U32 AllocFlag; /* flag allocation of resources */ 392 SK_U32 AllocFlag; /* flag allocation of resources */
395 struct pci_dev *PciDev; /* for access to pci config space */ 393 struct pci_dev *PciDev; /* for access to pci config space */
396 SK_U32 PciDevId; /* pci device id */
397 struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */ 394 struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */
398 char Name[30]; /* driver name */
399 395
400 int RxBufSize; /* length of receive buffers */ 396 int RxBufSize; /* length of receive buffers */
401 struct net_device_stats stats; /* linux 'netstat -i' statistics */ 397 struct net_device_stats stats; /* linux 'netstat -i' statistics */
@@ -430,7 +426,6 @@ struct s_AC {
430 DIM_INFO DynIrqModInfo; /* all data related to DIM */ 426 DIM_INFO DynIrqModInfo; /* all data related to DIM */
431 427
432 /* Only for tests */ 428 /* Only for tests */
433 int PortUp;
434 int PortDown; 429 int PortDown;
435 int ChipsetType; /* Chipset family type 430 int ChipsetType; /* Chipset family type
436 * 0 == Genesis family support 431 * 0 == Genesis family support
diff --git a/drivers/net/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h
index bdc1a5eaaae9..daa9a8d154fc 100644
--- a/drivers/net/sk98lin/h/skvpd.h
+++ b/drivers/net/sk98lin/h/skvpd.h
@@ -130,14 +130,12 @@ typedef struct s_vpd_key {
130#ifndef VPD_DO_IO 130#ifndef VPD_DO_IO
131#define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val) 131#define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val)
132#define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val) 132#define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val)
133#define VPD_OUT32(pAC,IoC,Addr,Val) (void)SkPciWriteCfgDWord(pAC,Addr,Val)
134#define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal) 133#define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal)
135#define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal) 134#define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal)
136#define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal) 135#define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal)
137#else /* VPD_DO_IO */ 136#else /* VPD_DO_IO */
138#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val) 137#define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val)
139#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val) 138#define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val)
140#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(Addr),Val)
141#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal) 139#define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal)
142#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal) 140#define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal)
143#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) 141#define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal)
@@ -155,12 +153,6 @@ typedef struct s_vpd_key {
155 else \ 153 else \
156 SK_OUT16(pAC,PCI_C(Addr),Val); \ 154 SK_OUT16(pAC,PCI_C(Addr),Val); \
157 } 155 }
158#define VPD_OUT32(pAC,Ioc,Addr,Val) { \
159 if ((pAC)->DgT.DgUseCfgCycle) \
160 SkPciWriteCfgDWord(pAC,Addr,Val); \
161 else \
162 SK_OUT32(pAC,PCI_C(Addr),Val); \
163 }
164#define VPD_IN8(pAC,Ioc,Addr,pVal) { \ 156#define VPD_IN8(pAC,Ioc,Addr,pVal) { \
165 if ((pAC)->DgT.DgUseCfgCycle) \ 157 if ((pAC)->DgT.DgUseCfgCycle) \
166 SkPciReadCfgByte(pAC,Addr,pVal); \ 158 SkPciReadCfgByte(pAC,Addr,pVal); \
diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c
index b71769ae4603..4265ed91a9c4 100644
--- a/drivers/net/sk98lin/skethtool.c
+++ b/drivers/net/sk98lin/skethtool.c
@@ -539,6 +539,48 @@ static int setPauseParams(struct net_device *dev , struct ethtool_pauseparam *ep
539 return ret ? -EIO : 0; 539 return ret ? -EIO : 0;
540} 540}
541 541
542/* Only Yukon supports checksum offload. */
543static int setScatterGather(struct net_device *dev, u32 data)
544{
545 DEV_NET *pNet = netdev_priv(dev);
546 SK_AC *pAC = pNet->pAC;
547
548 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
549 return -EOPNOTSUPP;
550 return ethtool_op_set_sg(dev, data);
551}
552
553static int setTxCsum(struct net_device *dev, u32 data)
554{
555 DEV_NET *pNet = netdev_priv(dev);
556 SK_AC *pAC = pNet->pAC;
557
558 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
559 return -EOPNOTSUPP;
560
561 return ethtool_op_set_tx_csum(dev, data);
562}
563
564static u32 getRxCsum(struct net_device *dev)
565{
566 DEV_NET *pNet = netdev_priv(dev);
567 SK_AC *pAC = pNet->pAC;
568
569 return pAC->RxPort[pNet->PortNr].RxCsum;
570}
571
572static int setRxCsum(struct net_device *dev, u32 data)
573{
574 DEV_NET *pNet = netdev_priv(dev);
575 SK_AC *pAC = pNet->pAC;
576
577 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
578 return -EOPNOTSUPP;
579
580 pAC->RxPort[pNet->PortNr].RxCsum = data != 0;
581 return 0;
582}
583
542struct ethtool_ops SkGeEthtoolOps = { 584struct ethtool_ops SkGeEthtoolOps = {
543 .get_settings = getSettings, 585 .get_settings = getSettings,
544 .set_settings = setSettings, 586 .set_settings = setSettings,
@@ -551,4 +593,10 @@ struct ethtool_ops SkGeEthtoolOps = {
551 .set_pauseparam = setPauseParams, 593 .set_pauseparam = setPauseParams,
552 .get_link = ethtool_op_get_link, 594 .get_link = ethtool_op_get_link,
553 .get_perm_addr = ethtool_op_get_perm_addr, 595 .get_perm_addr = ethtool_op_get_perm_addr,
596 .get_sg = ethtool_op_get_sg,
597 .set_sg = setScatterGather,
598 .get_tx_csum = ethtool_op_get_tx_csum,
599 .set_tx_csum = setTxCsum,
600 .get_rx_csum = getRxCsum,
601 .set_rx_csum = setRxCsum,
554}; 602};
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index ae7343934758..e5591d33dd28 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -110,7 +110,6 @@
110#include <linux/module.h> 110#include <linux/module.h>
111#include <linux/moduleparam.h> 111#include <linux/moduleparam.h>
112#include <linux/init.h> 112#include <linux/init.h>
113#include <linux/proc_fs.h>
114#include <linux/dma-mapping.h> 113#include <linux/dma-mapping.h>
115#include <linux/ip.h> 114#include <linux/ip.h>
116 115
@@ -206,7 +205,6 @@ static void SkGeSetRxMode(struct SK_NET_DEVICE *dev);
206static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); 205static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev);
207static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); 206static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd);
208static void GetConfiguration(SK_AC*); 207static void GetConfiguration(SK_AC*);
209static void ProductStr(SK_AC*);
210static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); 208static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*);
211static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); 209static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*);
212static void FillRxRing(SK_AC*, RX_PORT*); 210static void FillRxRing(SK_AC*, RX_PORT*);
@@ -235,28 +233,6 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
235 * Extern Function Prototypes 233 * Extern Function Prototypes
236 * 234 *
237 ******************************************************************************/ 235 ******************************************************************************/
238static const char SKRootName[] = "net/sk98lin";
239static struct proc_dir_entry *pSkRootDir;
240extern struct file_operations sk_proc_fops;
241
242static inline void SkGeProcCreate(struct net_device *dev)
243{
244 struct proc_dir_entry *pe;
245
246 if (pSkRootDir &&
247 (pe = create_proc_entry(dev->name, S_IRUGO, pSkRootDir))) {
248 pe->proc_fops = &sk_proc_fops;
249 pe->data = dev;
250 pe->owner = THIS_MODULE;
251 }
252}
253
254static inline void SkGeProcRemove(struct net_device *dev)
255{
256 if (pSkRootDir)
257 remove_proc_entry(dev->name, pSkRootDir);
258}
259
260extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); 236extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
261extern void SkDimDisplayModerationSettings(SK_AC *pAC); 237extern void SkDimDisplayModerationSettings(SK_AC *pAC);
262extern void SkDimStartModerationTimer(SK_AC *pAC); 238extern void SkDimStartModerationTimer(SK_AC *pAC);
@@ -279,6 +255,27 @@ static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
279 255
280/***************************************************************************** 256/*****************************************************************************
281 * 257 *
258 * SkPciWriteCfgDWord - write a 32 bit value to pci config space
259 *
260 * Description:
261 * This routine writes a 32 bit value to the pci configuration
262 * space.
263 *
264 * Returns:
265 * 0 - indicate everything worked ok.
266 * != 0 - error indication
267 */
268static inline int SkPciWriteCfgDWord(
269SK_AC *pAC, /* Adapter Control structure pointer */
270int PciAddr, /* PCI register address */
271SK_U32 Val) /* pointer to store the read value */
272{
273 pci_write_config_dword(pAC->PciDev, PciAddr, Val);
274 return(0);
275} /* SkPciWriteCfgDWord */
276
277/*****************************************************************************
278 *
282 * SkGeInitPCI - Init the PCI resources 279 * SkGeInitPCI - Init the PCI resources
283 * 280 *
284 * Description: 281 * Description:
@@ -300,7 +297,7 @@ int SkGeInitPCI(SK_AC *pAC)
300 dev->mem_start = pci_resource_start (pdev, 0); 297 dev->mem_start = pci_resource_start (pdev, 0);
301 pci_set_master(pdev); 298 pci_set_master(pdev);
302 299
303 if (pci_request_regions(pdev, pAC->Name) != 0) { 300 if (pci_request_regions(pdev, "sk98lin") != 0) {
304 retval = 2; 301 retval = 2;
305 goto out_disable; 302 goto out_disable;
306 } 303 }
@@ -578,10 +575,10 @@ SK_BOOL DualNet;
578 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 575 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
579 576
580 if (pAC->GIni.GIMacsFound == 2) { 577 if (pAC->GIni.GIMacsFound == 2) {
581 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 578 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
582 } else if (pAC->GIni.GIMacsFound == 1) { 579 } else if (pAC->GIni.GIMacsFound == 1) {
583 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, 580 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ,
584 pAC->Name, dev); 581 "sk98lin", dev);
585 } else { 582 } else {
586 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", 583 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
587 pAC->GIni.GIMacsFound); 584 pAC->GIni.GIMacsFound);
@@ -1265,7 +1262,6 @@ struct SK_NET_DEVICE *dev)
1265 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 1262 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
1266 1263
1267 pAC->MaxPorts++; 1264 pAC->MaxPorts++;
1268 pNet->Up = 1;
1269 1265
1270 1266
1271 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, 1267 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
@@ -1395,7 +1391,6 @@ struct SK_NET_DEVICE *dev)
1395 sizeof(SK_PNMI_STRUCT_DATA)); 1391 sizeof(SK_PNMI_STRUCT_DATA));
1396 1392
1397 pAC->MaxPorts--; 1393 pAC->MaxPorts--;
1398 pNet->Up = 0;
1399 1394
1400 return (0); 1395 return (0);
1401} /* SkGeClose */ 1396} /* SkGeClose */
@@ -2175,7 +2170,6 @@ rx_start:
2175 pMsg->ip_summed = CHECKSUM_NONE; 2170 pMsg->ip_summed = CHECKSUM_NONE;
2176#endif 2171#endif
2177 2172
2178
2179 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); 2173 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V"));
2180 ForRlmt = SK_RLMT_RX_PROTOCOL; 2174 ForRlmt = SK_RLMT_RX_PROTOCOL;
2181#if 0 2175#if 0
@@ -2550,7 +2544,7 @@ unsigned long Flags;
2550static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) 2544static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu)
2551{ 2545{
2552DEV_NET *pNet; 2546DEV_NET *pNet;
2553DEV_NET *pOtherNet; 2547struct net_device *pOtherDev;
2554SK_AC *pAC; 2548SK_AC *pAC;
2555unsigned long Flags; 2549unsigned long Flags;
2556int i; 2550int i;
@@ -2580,11 +2574,11 @@ SK_EVPARA EvPara;
2580 } 2574 }
2581#endif 2575#endif
2582 2576
2583 pNet->Mtu = NewMtu; 2577 pOtherDev = pAC->dev[1 - pNet->NetNr];
2584 pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]); 2578
2585 if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { 2579 if ( netif_running(pOtherDev) && (pOtherDev->mtu > 1500)
2586 return(0); 2580 && (NewMtu <= 1500))
2587 } 2581 return 0;
2588 2582
2589 pAC->RxBufSize = NewMtu + 32; 2583 pAC->RxBufSize = NewMtu + 32;
2590 dev->mtu = NewMtu; 2584 dev->mtu = NewMtu;
@@ -2746,7 +2740,8 @@ SK_EVPARA EvPara;
2746 EvPara.Para32[1] = -1; 2740 EvPara.Para32[1] = -1;
2747 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2741 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2748 2742
2749 if (pOtherNet->Up) { 2743 if (netif_running(pOtherDev)) {
2744 DEV_NET *pOtherNet = netdev_priv(pOtherDev);
2750 EvPara.Para32[0] = pOtherNet->PortNr; 2745 EvPara.Para32[0] = pOtherNet->PortNr;
2751 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2746 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2752 } 2747 }
@@ -2820,7 +2815,7 @@ unsigned long Flags; /* for spin lock */
2820 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; 2815 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts;
2821 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; 2816 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts;
2822 2817
2823 if (pNet->Mtu <= 1500) { 2818 if (dev->mtu <= 1500) {
2824 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; 2819 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF;
2825 } else { 2820 } else {
2826 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - 2821 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts -
@@ -3771,25 +3766,21 @@ int Capabilities[3][3] =
3771 * 3766 *
3772 * Returns: N/A 3767 * Returns: N/A
3773 */ 3768 */
3774static void ProductStr( 3769static inline int ProductStr(
3775SK_AC *pAC /* pointer to adapter context */ 3770 SK_AC *pAC, /* pointer to adapter context */
3771 char *DeviceStr, /* result string */
3772 int StrLen /* length of the string */
3776) 3773)
3777{ 3774{
3778int StrLen = 80; /* length of the string, defined in SK_AC */
3779char Keyword[] = VPD_NAME; /* vpd productname identifier */ 3775char Keyword[] = VPD_NAME; /* vpd productname identifier */
3780int ReturnCode; /* return code from vpd_read */ 3776int ReturnCode; /* return code from vpd_read */
3781unsigned long Flags; 3777unsigned long Flags;
3782 3778
3783 spin_lock_irqsave(&pAC->SlowPathLock, Flags); 3779 spin_lock_irqsave(&pAC->SlowPathLock, Flags);
3784 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr, 3780 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, DeviceStr, &StrLen);
3785 &StrLen);
3786 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 3781 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
3787 if (ReturnCode != 0) { 3782
3788 /* there was an error reading the vpd data */ 3783 return ReturnCode;
3789 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR,
3790 ("Error reading VPD data: %d\n", ReturnCode));
3791 pAC->DeviceStr[0] = '\0';
3792 }
3793} /* ProductStr */ 3784} /* ProductStr */
3794 3785
3795/***************************************************************************** 3786/*****************************************************************************
@@ -3992,28 +3983,6 @@ SK_U8 *pVal) /* pointer to store the read value */
3992 3983
3993/***************************************************************************** 3984/*****************************************************************************
3994 * 3985 *
3995 * SkPciWriteCfgDWord - write a 32 bit value to pci config space
3996 *
3997 * Description:
3998 * This routine writes a 32 bit value to the pci configuration
3999 * space.
4000 *
4001 * Returns:
4002 * 0 - indicate everything worked ok.
4003 * != 0 - error indication
4004 */
4005int SkPciWriteCfgDWord(
4006SK_AC *pAC, /* Adapter Control structure pointer */
4007int PciAddr, /* PCI register address */
4008SK_U32 Val) /* pointer to store the read value */
4009{
4010 pci_write_config_dword(pAC->PciDev, PciAddr, Val);
4011 return(0);
4012} /* SkPciWriteCfgDWord */
4013
4014
4015/*****************************************************************************
4016 *
4017 * SkPciWriteCfgWord - write a 16 bit value to pci config space 3986 * SkPciWriteCfgWord - write a 16 bit value to pci config space
4018 * 3987 *
4019 * Description: 3988 * Description:
@@ -4150,6 +4119,7 @@ SK_BOOL DualNet;
4150 Flags); 4119 Flags);
4151 break; 4120 break;
4152 case SK_DRV_NET_UP: /* SK_U32 PortIdx */ 4121 case SK_DRV_NET_UP: /* SK_U32 PortIdx */
4122 { struct net_device *dev = pAC->dev[Param.Para32[0]];
4153 /* action list 5 */ 4123 /* action list 5 */
4154 FromPort = Param.Para32[0]; 4124 FromPort = Param.Para32[0];
4155 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4125 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4233,22 +4203,12 @@ SK_BOOL DualNet;
4233 printk(" irq moderation: disabled\n"); 4203 printk(" irq moderation: disabled\n");
4234 4204
4235 4205
4236#ifdef SK_ZEROCOPY 4206 printk(" scatter-gather: %s\n",
4237 if (pAC->ChipsetType) 4207 (dev->features & NETIF_F_SG) ? "enabled" : "disabled");
4238#ifdef USE_SK_TX_CHECKSUM 4208 printk(" tx-checksum: %s\n",
4239 printk(" scatter-gather: enabled\n"); 4209 (dev->features & NETIF_F_IP_CSUM) ? "enabled" : "disabled");
4240#else 4210 printk(" rx-checksum: %s\n",
4241 printk(" tx-checksum: disabled\n"); 4211 pAC->RxPort[Param.Para32[0]].RxCsum ? "enabled" : "disabled");
4242#endif
4243 else
4244 printk(" scatter-gather: disabled\n");
4245#else
4246 printk(" scatter-gather: disabled\n");
4247#endif
4248
4249#ifndef USE_SK_RX_CHECKSUM
4250 printk(" rx-checksum: disabled\n");
4251#endif
4252 4212
4253 } else { 4213 } else {
4254 DoPrintInterfaceChange = SK_TRUE; 4214 DoPrintInterfaceChange = SK_TRUE;
@@ -4263,9 +4223,9 @@ SK_BOOL DualNet;
4263 } 4223 }
4264 4224
4265 /* Inform the world that link protocol is up. */ 4225 /* Inform the world that link protocol is up. */
4266 netif_carrier_on(pAC->dev[Param.Para32[0]]); 4226 netif_carrier_on(dev);
4267
4268 break; 4227 break;
4228 }
4269 case SK_DRV_NET_DOWN: /* SK_U32 Reason */ 4229 case SK_DRV_NET_DOWN: /* SK_U32 Reason */
4270 /* action list 7 */ 4230 /* action list 7 */
4271 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4231 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4479,7 +4439,7 @@ SK_AC *pAc) /* pointer to adapter context */
4479 4439
4480 pAC->DiagModeActive = DIAG_ACTIVE; 4440 pAC->DiagModeActive = DIAG_ACTIVE;
4481 if (pAC->BoardLevel > SK_INIT_DATA) { 4441 if (pAC->BoardLevel > SK_INIT_DATA) {
4482 if (pNet->Up) { 4442 if (netif_running(pAC->dev[0])) {
4483 pAC->WasIfUp[0] = SK_TRUE; 4443 pAC->WasIfUp[0] = SK_TRUE;
4484 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4444 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4485 DoPrintInterfaceChange = SK_FALSE; 4445 DoPrintInterfaceChange = SK_FALSE;
@@ -4489,7 +4449,7 @@ SK_AC *pAc) /* pointer to adapter context */
4489 } 4449 }
4490 if (pNet != netdev_priv(pAC->dev[1])) { 4450 if (pNet != netdev_priv(pAC->dev[1])) {
4491 pNet = netdev_priv(pAC->dev[1]); 4451 pNet = netdev_priv(pAC->dev[1]);
4492 if (pNet->Up) { 4452 if (netif_running(pAC->dev[1])) {
4493 pAC->WasIfUp[1] = SK_TRUE; 4453 pAC->WasIfUp[1] = SK_TRUE;
4494 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4454 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4495 DoPrintInterfaceChange = SK_FALSE; 4455 DoPrintInterfaceChange = SK_FALSE;
@@ -4815,6 +4775,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4815 struct net_device *dev = NULL; 4775 struct net_device *dev = NULL;
4816 static int boards_found = 0; 4776 static int boards_found = 0;
4817 int error = -ENODEV; 4777 int error = -ENODEV;
4778 char DeviceStr[80];
4818 4779
4819 if (pci_enable_device(pdev)) 4780 if (pci_enable_device(pdev))
4820 goto out; 4781 goto out;
@@ -4842,14 +4803,11 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4842 memset(pNet->pAC, 0, sizeof(SK_AC)); 4803 memset(pNet->pAC, 0, sizeof(SK_AC));
4843 pAC = pNet->pAC; 4804 pAC = pNet->pAC;
4844 pAC->PciDev = pdev; 4805 pAC->PciDev = pdev;
4845 pAC->PciDevId = pdev->device; 4806
4846 pAC->dev[0] = dev; 4807 pAC->dev[0] = dev;
4847 pAC->dev[1] = dev; 4808 pAC->dev[1] = dev;
4848 sprintf(pAC->Name, "SysKonnect SK-98xx");
4849 pAC->CheckQueue = SK_FALSE; 4809 pAC->CheckQueue = SK_FALSE;
4850 4810
4851 pNet->Mtu = 1500;
4852 pNet->Up = 0;
4853 dev->irq = pdev->irq; 4811 dev->irq = pdev->irq;
4854 error = SkGeInitPCI(pAC); 4812 error = SkGeInitPCI(pAC);
4855 if (error) { 4813 if (error) {
@@ -4872,21 +4830,30 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4872 SET_NETDEV_DEV(dev, &pdev->dev); 4830 SET_NETDEV_DEV(dev, &pdev->dev);
4873 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4831 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4874 4832
4875#ifdef SK_ZEROCOPY 4833 /* Use only if yukon hardware */
4876#ifdef USE_SK_TX_CHECKSUM
4877 if (pAC->ChipsetType) { 4834 if (pAC->ChipsetType) {
4878 /* Use only if yukon hardware */ 4835#ifdef USE_SK_TX_CHECKSUM
4879 /* SK and ZEROCOPY - fly baby... */ 4836 dev->features |= NETIF_F_IP_CSUM;
4880 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 4837#endif
4881 } 4838#ifdef SK_ZEROCOPY
4839 dev->features |= NETIF_F_SG;
4882#endif 4840#endif
4841#ifdef USE_SK_RX_CHECKSUM
4842 pAC->RxPort[0].RxCsum = 1;
4883#endif 4843#endif
4844 }
4884 4845
4885 pAC->Index = boards_found++; 4846 pAC->Index = boards_found++;
4886 4847
4887 if (SkGeBoardInit(dev, pAC)) 4848 if (SkGeBoardInit(dev, pAC))
4888 goto out_free_netdev; 4849 goto out_free_netdev;
4889 4850
4851 /* Read Adapter name from VPD */
4852 if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) {
4853 printk(KERN_ERR "sk98lin: Could not read VPD data.\n");
4854 goto out_free_resources;
4855 }
4856
4890 /* Register net device */ 4857 /* Register net device */
4891 if (register_netdev(dev)) { 4858 if (register_netdev(dev)) {
4892 printk(KERN_ERR "sk98lin: Could not register device.\n"); 4859 printk(KERN_ERR "sk98lin: Could not register device.\n");
@@ -4894,8 +4861,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4894 } 4861 }
4895 4862
4896 /* Print adapter specific string from vpd */ 4863 /* Print adapter specific string from vpd */
4897 ProductStr(pAC); 4864 printk("%s: %s\n", dev->name, DeviceStr);
4898 printk("%s: %s\n", dev->name, pAC->DeviceStr);
4899 4865
4900 /* Print configuration settings */ 4866 /* Print configuration settings */
4901 printk(" PrefPort:%c RlmtMode:%s\n", 4867 printk(" PrefPort:%c RlmtMode:%s\n",
@@ -4911,8 +4877,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4911 memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6); 4877 memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6);
4912 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 4878 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
4913 4879
4914 SkGeProcCreate(dev);
4915
4916 pNet->PortNr = 0; 4880 pNet->PortNr = 0;
4917 pNet->NetNr = 0; 4881 pNet->NetNr = 0;
4918 4882
@@ -4931,8 +4895,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4931 pNet->PortNr = 1; 4895 pNet->PortNr = 1;
4932 pNet->NetNr = 1; 4896 pNet->NetNr = 1;
4933 pNet->pAC = pAC; 4897 pNet->pAC = pAC;
4934 pNet->Mtu = 1500;
4935 pNet->Up = 0;
4936 4898
4937 dev->open = &SkGeOpen; 4899 dev->open = &SkGeOpen;
4938 dev->stop = &SkGeClose; 4900 dev->stop = &SkGeClose;
@@ -4945,26 +4907,28 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4945 SET_NETDEV_DEV(dev, &pdev->dev); 4907 SET_NETDEV_DEV(dev, &pdev->dev);
4946 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4908 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4947 4909
4948#ifdef SK_ZEROCOPY
4949#ifdef USE_SK_TX_CHECKSUM
4950 if (pAC->ChipsetType) { 4910 if (pAC->ChipsetType) {
4951 /* SG and ZEROCOPY - fly baby... */ 4911#ifdef USE_SK_TX_CHECKSUM
4952 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 4912 dev->features |= NETIF_F_IP_CSUM;
4953 } 4913#endif
4914#ifdef SK_ZEROCOPY
4915 dev->features |= NETIF_F_SG;
4954#endif 4916#endif
4917#ifdef USE_SK_RX_CHECKSUM
4918 pAC->RxPort[1].RxCsum = 1;
4955#endif 4919#endif
4920 }
4956 4921
4957 if (register_netdev(dev)) { 4922 if (register_netdev(dev)) {
4958 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); 4923 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n");
4959 free_netdev(dev); 4924 free_netdev(dev);
4960 pAC->dev[1] = pAC->dev[0]; 4925 pAC->dev[1] = pAC->dev[0];
4961 } else { 4926 } else {
4962 SkGeProcCreate(dev);
4963 memcpy(&dev->dev_addr, 4927 memcpy(&dev->dev_addr,
4964 &pAC->Addr.Net[1].CurrentMacAddress, 6); 4928 &pAC->Addr.Net[1].CurrentMacAddress, 6);
4965 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 4929 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
4966 4930
4967 printk("%s: %s\n", dev->name, pAC->DeviceStr); 4931 printk("%s: %s\n", dev->name, DeviceStr);
4968 printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); 4932 printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
4969 } 4933 }
4970 } 4934 }
@@ -5000,10 +4964,7 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
5000 SK_AC *pAC = pNet->pAC; 4964 SK_AC *pAC = pNet->pAC;
5001 struct net_device *otherdev = pAC->dev[1]; 4965 struct net_device *otherdev = pAC->dev[1];
5002 4966
5003 SkGeProcRemove(dev);
5004 unregister_netdev(dev); 4967 unregister_netdev(dev);
5005 if (otherdev != dev)
5006 SkGeProcRemove(otherdev);
5007 4968
5008 SkGeYellowLED(pAC, pAC->IoBase, 0); 4969 SkGeYellowLED(pAC, pAC->IoBase, 0);
5009 4970
@@ -5088,9 +5049,9 @@ static int skge_resume(struct pci_dev *pdev)
5088 pci_enable_device(pdev); 5049 pci_enable_device(pdev);
5089 pci_set_master(pdev); 5050 pci_set_master(pdev);
5090 if (pAC->GIni.GIMacsFound == 2) 5051 if (pAC->GIni.GIMacsFound == 2)
5091 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 5052 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
5092 else 5053 else
5093 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); 5054 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev);
5094 if (ret) { 5055 if (ret) {
5095 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); 5056 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5096 pAC->AllocFlag &= ~SK_ALLOC_IRQ; 5057 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
@@ -5148,23 +5109,12 @@ static struct pci_driver skge_driver = {
5148 5109
5149static int __init skge_init(void) 5110static int __init skge_init(void)
5150{ 5111{
5151 int error; 5112 return pci_module_init(&skge_driver);
5152
5153 pSkRootDir = proc_mkdir(SKRootName, NULL);
5154 if (pSkRootDir)
5155 pSkRootDir->owner = THIS_MODULE;
5156
5157 error = pci_register_driver(&skge_driver);
5158 if (error)
5159 remove_proc_entry(SKRootName, NULL);
5160 return error;
5161} 5113}
5162 5114
5163static void __exit skge_exit(void) 5115static void __exit skge_exit(void)
5164{ 5116{
5165 pci_unregister_driver(&skge_driver); 5117 pci_unregister_driver(&skge_driver);
5166 remove_proc_entry(SKRootName, NULL);
5167
5168} 5118}
5169 5119
5170module_init(skge_init); 5120module_init(skge_init);
diff --git a/drivers/net/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c
deleted file mode 100644
index 5cece25c034e..000000000000
--- a/drivers/net/sk98lin/skproc.c
+++ /dev/null
@@ -1,265 +0,0 @@
1/******************************************************************************
2 *
3 * Name: skproc.c
4 * Project: GEnesis, PCI Gigabit Ethernet Adapter
5 * Version: $Revision: 1.11 $
6 * Date: $Date: 2003/12/11 16:03:57 $
7 * Purpose: Funktions to display statictic data
8 *
9 ******************************************************************************/
10
11/******************************************************************************
12 *
13 * (C)Copyright 1998-2002 SysKonnect GmbH.
14 * (C)Copyright 2002-2003 Marvell.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * Created 22-Nov-2000
22 * Author: Mirko Lindner (mlindner@syskonnect.de)
23 *
24 * The information in this file is provided "AS IS" without warranty.
25 *
26 ******************************************************************************/
27#include <linux/proc_fs.h>
28#include <linux/seq_file.h>
29
30#include "h/skdrv1st.h"
31#include "h/skdrv2nd.h"
32#include "h/skversion.h"
33
34static int sk_seq_show(struct seq_file *seq, void *v);
35static int sk_proc_open(struct inode *inode, struct file *file);
36
37struct file_operations sk_proc_fops = {
38 .owner = THIS_MODULE,
39 .open = sk_proc_open,
40 .read = seq_read,
41 .llseek = seq_lseek,
42 .release = single_release,
43};
44
45
46/*****************************************************************************
47 *
48 * sk_seq_show - show proc information of a particular adapter
49 *
50 * Description:
51 * This function fills the proc entry with statistic data about
52 * the ethernet device. It invokes the generic sk_gen_browse() to
53 * print out all items one per one.
54 *
55 * Returns: 0
56 *
57 */
58static int sk_seq_show(struct seq_file *seq, void *v)
59{
60 struct net_device *dev = seq->private;
61 DEV_NET *pNet = netdev_priv(dev);
62 SK_AC *pAC = pNet->pAC;
63 SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct;
64 unsigned long Flags;
65 unsigned int Size;
66 char sens_msg[50];
67 int t;
68 int i;
69
70 /* NetIndex in GetStruct is now required, zero is only dummy */
71 for (t=pAC->GIni.GIMacsFound; t > 0; t--) {
72 if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1)
73 t--;
74
75 spin_lock_irqsave(&pAC->SlowPathLock, Flags);
76 Size = SK_PNMI_STRUCT_SIZE;
77#ifdef SK_DIAG_SUPPORT
78 if (pAC->BoardLevel == SK_INIT_DATA) {
79 SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA));
80 if (pAC->DiagModeActive == DIAG_NOTACTIVE) {
81 pAC->Pnmi.DiagAttached = SK_DIAG_IDLE;
82 }
83 } else {
84 SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1);
85 }
86#else
87 SkPnmiGetStruct(pAC, pAC->IoBase,
88 pPnmiStruct, &Size, t-1);
89#endif
90 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
91
92 if (pAC->dev[t-1] == dev) {
93 SK_PNMI_STAT *pPnmiStat = &pPnmiStruct->Stat[0];
94
95 seq_printf(seq, "\nDetailed statistic for device %s\n",
96 pAC->dev[t-1]->name);
97 seq_printf(seq, "=======================================\n");
98
99 /* Board statistics */
100 seq_printf(seq, "\nBoard statistics\n\n");
101 seq_printf(seq, "Active Port %c\n",
102 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
103 Net[t-1].PrefPort]->PortNumber);
104 seq_printf(seq, "Preferred Port %c\n",
105 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt.
106 Net[t-1].PrefPort]->PortNumber);
107
108 seq_printf(seq, "Bus speed (MHz) %d\n",
109 pPnmiStruct->BusSpeed);
110
111 seq_printf(seq, "Bus width (Bit) %d\n",
112 pPnmiStruct->BusWidth);
113 seq_printf(seq, "Driver version %s\n",
114 VER_STRING);
115 seq_printf(seq, "Hardware revision v%d.%d\n",
116 (pAC->GIni.GIPciHwRev >> 4) & 0x0F,
117 pAC->GIni.GIPciHwRev & 0x0F);
118
119 /* Print sensor informations */
120 for (i=0; i < pAC->I2c.MaxSens; i ++) {
121 /* Check type */
122 switch (pAC->I2c.SenTable[i].SenType) {
123 case 1:
124 strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
125 strcat(sens_msg, " (C)");
126 seq_printf(seq, "%-25s %d.%02d\n",
127 sens_msg,
128 pAC->I2c.SenTable[i].SenValue / 10,
129 pAC->I2c.SenTable[i].SenValue % 10);
130
131 strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
132 strcat(sens_msg, " (F)");
133 seq_printf(seq, "%-25s %d.%02d\n",
134 sens_msg,
135 ((((pAC->I2c.SenTable[i].SenValue)
136 *10)*9)/5 + 3200)/100,
137 ((((pAC->I2c.SenTable[i].SenValue)
138 *10)*9)/5 + 3200) % 10);
139 break;
140 case 2:
141 strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
142 strcat(sens_msg, " (V)");
143 seq_printf(seq, "%-25s %d.%03d\n",
144 sens_msg,
145 pAC->I2c.SenTable[i].SenValue / 1000,
146 pAC->I2c.SenTable[i].SenValue % 1000);
147 break;
148 case 3:
149 strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc);
150 strcat(sens_msg, " (rpm)");
151 seq_printf(seq, "%-25s %d\n",
152 sens_msg,
153 pAC->I2c.SenTable[i].SenValue);
154 break;
155 default:
156 break;
157 }
158 }
159
160 /*Receive statistics */
161 seq_printf(seq, "\nReceive statistics\n\n");
162
163 seq_printf(seq, "Received bytes %Lu\n",
164 (unsigned long long) pPnmiStat->StatRxOctetsOkCts);
165 seq_printf(seq, "Received packets %Lu\n",
166 (unsigned long long) pPnmiStat->StatRxOkCts);
167#if 0
168 if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC &&
169 pAC->HWRevision < 12) {
170 pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
171 pPnmiStat->StatRxShortsCts;
172 pPnmiStat->StatRxShortsCts = 0;
173 }
174#endif
175 if (dev->mtu > 1500)
176 pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts -
177 pPnmiStat->StatRxTooLongCts;
178
179 seq_printf(seq, "Receive errors %Lu\n",
180 (unsigned long long) pPnmiStruct->InErrorsCts);
181 seq_printf(seq, "Receive dropped %Lu\n",
182 (unsigned long long) pPnmiStruct->RxNoBufCts);
183 seq_printf(seq, "Received multicast %Lu\n",
184 (unsigned long long) pPnmiStat->StatRxMulticastOkCts);
185 seq_printf(seq, "Receive error types\n");
186 seq_printf(seq, " length %Lu\n",
187 (unsigned long long) pPnmiStat->StatRxRuntCts);
188 seq_printf(seq, " buffer overflow %Lu\n",
189 (unsigned long long) pPnmiStat->StatRxFifoOverflowCts);
190 seq_printf(seq, " bad crc %Lu\n",
191 (unsigned long long) pPnmiStat->StatRxFcsCts);
192 seq_printf(seq, " framing %Lu\n",
193 (unsigned long long) pPnmiStat->StatRxFramingCts);
194 seq_printf(seq, " missed frames %Lu\n",
195 (unsigned long long) pPnmiStat->StatRxMissedCts);
196
197 if (dev->mtu > 1500)
198 pPnmiStat->StatRxTooLongCts = 0;
199
200 seq_printf(seq, " too long %Lu\n",
201 (unsigned long long) pPnmiStat->StatRxTooLongCts);
202 seq_printf(seq, " carrier extension %Lu\n",
203 (unsigned long long) pPnmiStat->StatRxCextCts);
204 seq_printf(seq, " too short %Lu\n",
205 (unsigned long long) pPnmiStat->StatRxShortsCts);
206 seq_printf(seq, " symbol %Lu\n",
207 (unsigned long long) pPnmiStat->StatRxSymbolCts);
208 seq_printf(seq, " LLC MAC size %Lu\n",
209 (unsigned long long) pPnmiStat->StatRxIRLengthCts);
210 seq_printf(seq, " carrier event %Lu\n",
211 (unsigned long long) pPnmiStat->StatRxCarrierCts);
212 seq_printf(seq, " jabber %Lu\n",
213 (unsigned long long) pPnmiStat->StatRxJabberCts);
214
215
216 /*Transmit statistics */
217 seq_printf(seq, "\nTransmit statistics\n\n");
218
219 seq_printf(seq, "Transmited bytes %Lu\n",
220 (unsigned long long) pPnmiStat->StatTxOctetsOkCts);
221 seq_printf(seq, "Transmited packets %Lu\n",
222 (unsigned long long) pPnmiStat->StatTxOkCts);
223 seq_printf(seq, "Transmit errors %Lu\n",
224 (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
225 seq_printf(seq, "Transmit dropped %Lu\n",
226 (unsigned long long) pPnmiStruct->TxNoBufCts);
227 seq_printf(seq, "Transmit collisions %Lu\n",
228 (unsigned long long) pPnmiStat->StatTxSingleCollisionCts);
229 seq_printf(seq, "Transmit error types\n");
230 seq_printf(seq, " excessive collision %ld\n",
231 pAC->stats.tx_aborted_errors);
232 seq_printf(seq, " carrier %Lu\n",
233 (unsigned long long) pPnmiStat->StatTxCarrierCts);
234 seq_printf(seq, " fifo underrun %Lu\n",
235 (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts);
236 seq_printf(seq, " heartbeat %Lu\n",
237 (unsigned long long) pPnmiStat->StatTxCarrierCts);
238 seq_printf(seq, " window %ld\n",
239 pAC->stats.tx_window_errors);
240
241 }
242 }
243 return 0;
244}
245
246/*****************************************************************************
247 *
248 * sk_proc_open - register the show function when proc is open'ed
249 *
250 * Description:
251 * This function is called whenever a sk98lin proc file is queried.
252 *
253 * Returns: the return value of single_open()
254 *
255 */
256static int sk_proc_open(struct inode *inode, struct file *file)
257{
258 return single_open(file, sk_seq_show, PDE(inode)->data);
259}
260
261/*******************************************************************************
262 *
263 * End of file
264 *
265 ******************************************************************************/