aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sk98lin
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 19:31:56 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 19:31:56 -0500
commitd779188d2baf436e67fe8816fca2ef53d246900f (patch)
tree9bac75842a5611172860feec3c4019ff874a2b89 /drivers/net/sk98lin
parentf61ea1b0c825a20a1826bb43a226387091934586 (diff)
parentac67c6247361b3b8644b34e5301a46d5069c1373 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
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 e1a2d52cc1fe..9a76ac180b11 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -111,7 +111,6 @@
111#include <linux/module.h> 111#include <linux/module.h>
112#include <linux/moduleparam.h> 112#include <linux/moduleparam.h>
113#include <linux/init.h> 113#include <linux/init.h>
114#include <linux/proc_fs.h>
115#include <linux/dma-mapping.h> 114#include <linux/dma-mapping.h>
116#include <linux/ip.h> 115#include <linux/ip.h>
117 116
@@ -207,7 +206,6 @@ static void SkGeSetRxMode(struct SK_NET_DEVICE *dev);
207static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); 206static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev);
208static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); 207static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd);
209static void GetConfiguration(SK_AC*); 208static void GetConfiguration(SK_AC*);
210static void ProductStr(SK_AC*);
211static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); 209static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*);
212static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); 210static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*);
213static void FillRxRing(SK_AC*, RX_PORT*); 211static void FillRxRing(SK_AC*, RX_PORT*);
@@ -236,28 +234,6 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr);
236 * Extern Function Prototypes 234 * Extern Function Prototypes
237 * 235 *
238 ******************************************************************************/ 236 ******************************************************************************/
239static const char SKRootName[] = "net/sk98lin";
240static struct proc_dir_entry *pSkRootDir;
241extern struct file_operations sk_proc_fops;
242
243static inline void SkGeProcCreate(struct net_device *dev)
244{
245 struct proc_dir_entry *pe;
246
247 if (pSkRootDir &&
248 (pe = create_proc_entry(dev->name, S_IRUGO, pSkRootDir))) {
249 pe->proc_fops = &sk_proc_fops;
250 pe->data = dev;
251 pe->owner = THIS_MODULE;
252 }
253}
254
255static inline void SkGeProcRemove(struct net_device *dev)
256{
257 if (pSkRootDir)
258 remove_proc_entry(dev->name, pSkRootDir);
259}
260
261extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); 237extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
262extern void SkDimDisplayModerationSettings(SK_AC *pAC); 238extern void SkDimDisplayModerationSettings(SK_AC *pAC);
263extern void SkDimStartModerationTimer(SK_AC *pAC); 239extern void SkDimStartModerationTimer(SK_AC *pAC);
@@ -280,6 +256,27 @@ static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
280 256
281/***************************************************************************** 257/*****************************************************************************
282 * 258 *
259 * SkPciWriteCfgDWord - write a 32 bit value to pci config space
260 *
261 * Description:
262 * This routine writes a 32 bit value to the pci configuration
263 * space.
264 *
265 * Returns:
266 * 0 - indicate everything worked ok.
267 * != 0 - error indication
268 */
269static inline int SkPciWriteCfgDWord(
270SK_AC *pAC, /* Adapter Control structure pointer */
271int PciAddr, /* PCI register address */
272SK_U32 Val) /* pointer to store the read value */
273{
274 pci_write_config_dword(pAC->PciDev, PciAddr, Val);
275 return(0);
276} /* SkPciWriteCfgDWord */
277
278/*****************************************************************************
279 *
283 * SkGeInitPCI - Init the PCI resources 280 * SkGeInitPCI - Init the PCI resources
284 * 281 *
285 * Description: 282 * Description:
@@ -301,7 +298,7 @@ int SkGeInitPCI(SK_AC *pAC)
301 dev->mem_start = pci_resource_start (pdev, 0); 298 dev->mem_start = pci_resource_start (pdev, 0);
302 pci_set_master(pdev); 299 pci_set_master(pdev);
303 300
304 if (pci_request_regions(pdev, pAC->Name) != 0) { 301 if (pci_request_regions(pdev, "sk98lin") != 0) {
305 retval = 2; 302 retval = 2;
306 goto out_disable; 303 goto out_disable;
307 } 304 }
@@ -579,10 +576,10 @@ SK_BOOL DualNet;
579 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 576 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
580 577
581 if (pAC->GIni.GIMacsFound == 2) { 578 if (pAC->GIni.GIMacsFound == 2) {
582 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 579 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
583 } else if (pAC->GIni.GIMacsFound == 1) { 580 } else if (pAC->GIni.GIMacsFound == 1) {
584 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, 581 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ,
585 pAC->Name, dev); 582 "sk98lin", dev);
586 } else { 583 } else {
587 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", 584 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
588 pAC->GIni.GIMacsFound); 585 pAC->GIni.GIMacsFound);
@@ -1266,7 +1263,6 @@ struct SK_NET_DEVICE *dev)
1266 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 1263 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
1267 1264
1268 pAC->MaxPorts++; 1265 pAC->MaxPorts++;
1269 pNet->Up = 1;
1270 1266
1271 1267
1272 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, 1268 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
@@ -1396,7 +1392,6 @@ struct SK_NET_DEVICE *dev)
1396 sizeof(SK_PNMI_STRUCT_DATA)); 1392 sizeof(SK_PNMI_STRUCT_DATA));
1397 1393
1398 pAC->MaxPorts--; 1394 pAC->MaxPorts--;
1399 pNet->Up = 0;
1400 1395
1401 return (0); 1396 return (0);
1402} /* SkGeClose */ 1397} /* SkGeClose */
@@ -2176,7 +2171,6 @@ rx_start:
2176 pMsg->ip_summed = CHECKSUM_NONE; 2171 pMsg->ip_summed = CHECKSUM_NONE;
2177#endif 2172#endif
2178 2173
2179
2180 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); 2174 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V"));
2181 ForRlmt = SK_RLMT_RX_PROTOCOL; 2175 ForRlmt = SK_RLMT_RX_PROTOCOL;
2182#if 0 2176#if 0
@@ -2551,7 +2545,7 @@ unsigned long Flags;
2551static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) 2545static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu)
2552{ 2546{
2553DEV_NET *pNet; 2547DEV_NET *pNet;
2554DEV_NET *pOtherNet; 2548struct net_device *pOtherDev;
2555SK_AC *pAC; 2549SK_AC *pAC;
2556unsigned long Flags; 2550unsigned long Flags;
2557int i; 2551int i;
@@ -2581,11 +2575,11 @@ SK_EVPARA EvPara;
2581 } 2575 }
2582#endif 2576#endif
2583 2577
2584 pNet->Mtu = NewMtu; 2578 pOtherDev = pAC->dev[1 - pNet->NetNr];
2585 pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]); 2579
2586 if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { 2580 if ( netif_running(pOtherDev) && (pOtherDev->mtu > 1500)
2587 return(0); 2581 && (NewMtu <= 1500))
2588 } 2582 return 0;
2589 2583
2590 pAC->RxBufSize = NewMtu + 32; 2584 pAC->RxBufSize = NewMtu + 32;
2591 dev->mtu = NewMtu; 2585 dev->mtu = NewMtu;
@@ -2747,7 +2741,8 @@ SK_EVPARA EvPara;
2747 EvPara.Para32[1] = -1; 2741 EvPara.Para32[1] = -1;
2748 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2742 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2749 2743
2750 if (pOtherNet->Up) { 2744 if (netif_running(pOtherDev)) {
2745 DEV_NET *pOtherNet = netdev_priv(pOtherDev);
2751 EvPara.Para32[0] = pOtherNet->PortNr; 2746 EvPara.Para32[0] = pOtherNet->PortNr;
2752 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2747 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2753 } 2748 }
@@ -2821,7 +2816,7 @@ unsigned long Flags; /* for spin lock */
2821 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; 2816 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts;
2822 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; 2817 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts;
2823 2818
2824 if (pNet->Mtu <= 1500) { 2819 if (dev->mtu <= 1500) {
2825 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; 2820 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF;
2826 } else { 2821 } else {
2827 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - 2822 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts -
@@ -3772,25 +3767,21 @@ int Capabilities[3][3] =
3772 * 3767 *
3773 * Returns: N/A 3768 * Returns: N/A
3774 */ 3769 */
3775static void ProductStr( 3770static inline int ProductStr(
3776SK_AC *pAC /* pointer to adapter context */ 3771 SK_AC *pAC, /* pointer to adapter context */
3772 char *DeviceStr, /* result string */
3773 int StrLen /* length of the string */
3777) 3774)
3778{ 3775{
3779int StrLen = 80; /* length of the string, defined in SK_AC */
3780char Keyword[] = VPD_NAME; /* vpd productname identifier */ 3776char Keyword[] = VPD_NAME; /* vpd productname identifier */
3781int ReturnCode; /* return code from vpd_read */ 3777int ReturnCode; /* return code from vpd_read */
3782unsigned long Flags; 3778unsigned long Flags;
3783 3779
3784 spin_lock_irqsave(&pAC->SlowPathLock, Flags); 3780 spin_lock_irqsave(&pAC->SlowPathLock, Flags);
3785 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr, 3781 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, DeviceStr, &StrLen);
3786 &StrLen);
3787 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 3782 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
3788 if (ReturnCode != 0) { 3783
3789 /* there was an error reading the vpd data */ 3784 return ReturnCode;
3790 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR,
3791 ("Error reading VPD data: %d\n", ReturnCode));
3792 pAC->DeviceStr[0] = '\0';
3793 }
3794} /* ProductStr */ 3785} /* ProductStr */
3795 3786
3796/***************************************************************************** 3787/*****************************************************************************
@@ -3993,28 +3984,6 @@ SK_U8 *pVal) /* pointer to store the read value */
3993 3984
3994/***************************************************************************** 3985/*****************************************************************************
3995 * 3986 *
3996 * SkPciWriteCfgDWord - write a 32 bit value to pci config space
3997 *
3998 * Description:
3999 * This routine writes a 32 bit value to the pci configuration
4000 * space.
4001 *
4002 * Returns:
4003 * 0 - indicate everything worked ok.
4004 * != 0 - error indication
4005 */
4006int SkPciWriteCfgDWord(
4007SK_AC *pAC, /* Adapter Control structure pointer */
4008int PciAddr, /* PCI register address */
4009SK_U32 Val) /* pointer to store the read value */
4010{
4011 pci_write_config_dword(pAC->PciDev, PciAddr, Val);
4012 return(0);
4013} /* SkPciWriteCfgDWord */
4014
4015
4016/*****************************************************************************
4017 *
4018 * SkPciWriteCfgWord - write a 16 bit value to pci config space 3987 * SkPciWriteCfgWord - write a 16 bit value to pci config space
4019 * 3988 *
4020 * Description: 3989 * Description:
@@ -4151,6 +4120,7 @@ SK_BOOL DualNet;
4151 Flags); 4120 Flags);
4152 break; 4121 break;
4153 case SK_DRV_NET_UP: /* SK_U32 PortIdx */ 4122 case SK_DRV_NET_UP: /* SK_U32 PortIdx */
4123 { struct net_device *dev = pAC->dev[Param.Para32[0]];
4154 /* action list 5 */ 4124 /* action list 5 */
4155 FromPort = Param.Para32[0]; 4125 FromPort = Param.Para32[0];
4156 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4126 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4234,22 +4204,12 @@ SK_BOOL DualNet;
4234 printk(" irq moderation: disabled\n"); 4204 printk(" irq moderation: disabled\n");
4235 4205
4236 4206
4237#ifdef SK_ZEROCOPY 4207 printk(" scatter-gather: %s\n",
4238 if (pAC->ChipsetType) 4208 (dev->features & NETIF_F_SG) ? "enabled" : "disabled");
4239#ifdef USE_SK_TX_CHECKSUM 4209 printk(" tx-checksum: %s\n",
4240 printk(" scatter-gather: enabled\n"); 4210 (dev->features & NETIF_F_IP_CSUM) ? "enabled" : "disabled");
4241#else 4211 printk(" rx-checksum: %s\n",
4242 printk(" tx-checksum: disabled\n"); 4212 pAC->RxPort[Param.Para32[0]].RxCsum ? "enabled" : "disabled");
4243#endif
4244 else
4245 printk(" scatter-gather: disabled\n");
4246#else
4247 printk(" scatter-gather: disabled\n");
4248#endif
4249
4250#ifndef USE_SK_RX_CHECKSUM
4251 printk(" rx-checksum: disabled\n");
4252#endif
4253 4213
4254 } else { 4214 } else {
4255 DoPrintInterfaceChange = SK_TRUE; 4215 DoPrintInterfaceChange = SK_TRUE;
@@ -4264,9 +4224,9 @@ SK_BOOL DualNet;
4264 } 4224 }
4265 4225
4266 /* Inform the world that link protocol is up. */ 4226 /* Inform the world that link protocol is up. */
4267 netif_carrier_on(pAC->dev[Param.Para32[0]]); 4227 netif_carrier_on(dev);
4268
4269 break; 4228 break;
4229 }
4270 case SK_DRV_NET_DOWN: /* SK_U32 Reason */ 4230 case SK_DRV_NET_DOWN: /* SK_U32 Reason */
4271 /* action list 7 */ 4231 /* action list 7 */
4272 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4232 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4480,7 +4440,7 @@ SK_AC *pAc) /* pointer to adapter context */
4480 4440
4481 pAC->DiagModeActive = DIAG_ACTIVE; 4441 pAC->DiagModeActive = DIAG_ACTIVE;
4482 if (pAC->BoardLevel > SK_INIT_DATA) { 4442 if (pAC->BoardLevel > SK_INIT_DATA) {
4483 if (pNet->Up) { 4443 if (netif_running(pAC->dev[0])) {
4484 pAC->WasIfUp[0] = SK_TRUE; 4444 pAC->WasIfUp[0] = SK_TRUE;
4485 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4445 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4486 DoPrintInterfaceChange = SK_FALSE; 4446 DoPrintInterfaceChange = SK_FALSE;
@@ -4490,7 +4450,7 @@ SK_AC *pAc) /* pointer to adapter context */
4490 } 4450 }
4491 if (pNet != netdev_priv(pAC->dev[1])) { 4451 if (pNet != netdev_priv(pAC->dev[1])) {
4492 pNet = netdev_priv(pAC->dev[1]); 4452 pNet = netdev_priv(pAC->dev[1]);
4493 if (pNet->Up) { 4453 if (netif_running(pAC->dev[1])) {
4494 pAC->WasIfUp[1] = SK_TRUE; 4454 pAC->WasIfUp[1] = SK_TRUE;
4495 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4455 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4496 DoPrintInterfaceChange = SK_FALSE; 4456 DoPrintInterfaceChange = SK_FALSE;
@@ -4816,6 +4776,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4816 struct net_device *dev = NULL; 4776 struct net_device *dev = NULL;
4817 static int boards_found = 0; 4777 static int boards_found = 0;
4818 int error = -ENODEV; 4778 int error = -ENODEV;
4779 char DeviceStr[80];
4819 4780
4820 if (pci_enable_device(pdev)) 4781 if (pci_enable_device(pdev))
4821 goto out; 4782 goto out;
@@ -4843,14 +4804,11 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4843 memset(pNet->pAC, 0, sizeof(SK_AC)); 4804 memset(pNet->pAC, 0, sizeof(SK_AC));
4844 pAC = pNet->pAC; 4805 pAC = pNet->pAC;
4845 pAC->PciDev = pdev; 4806 pAC->PciDev = pdev;
4846 pAC->PciDevId = pdev->device; 4807
4847 pAC->dev[0] = dev; 4808 pAC->dev[0] = dev;
4848 pAC->dev[1] = dev; 4809 pAC->dev[1] = dev;
4849 sprintf(pAC->Name, "SysKonnect SK-98xx");
4850 pAC->CheckQueue = SK_FALSE; 4810 pAC->CheckQueue = SK_FALSE;
4851 4811
4852 pNet->Mtu = 1500;
4853 pNet->Up = 0;
4854 dev->irq = pdev->irq; 4812 dev->irq = pdev->irq;
4855 error = SkGeInitPCI(pAC); 4813 error = SkGeInitPCI(pAC);
4856 if (error) { 4814 if (error) {
@@ -4873,21 +4831,30 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4873 SET_NETDEV_DEV(dev, &pdev->dev); 4831 SET_NETDEV_DEV(dev, &pdev->dev);
4874 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4832 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4875 4833
4876#ifdef SK_ZEROCOPY 4834 /* Use only if yukon hardware */
4877#ifdef USE_SK_TX_CHECKSUM
4878 if (pAC->ChipsetType) { 4835 if (pAC->ChipsetType) {
4879 /* Use only if yukon hardware */ 4836#ifdef USE_SK_TX_CHECKSUM
4880 /* SK and ZEROCOPY - fly baby... */ 4837 dev->features |= NETIF_F_IP_CSUM;
4881 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 4838#endif
4882 } 4839#ifdef SK_ZEROCOPY
4840 dev->features |= NETIF_F_SG;
4883#endif 4841#endif
4842#ifdef USE_SK_RX_CHECKSUM
4843 pAC->RxPort[0].RxCsum = 1;
4884#endif 4844#endif
4845 }
4885 4846
4886 pAC->Index = boards_found++; 4847 pAC->Index = boards_found++;
4887 4848
4888 if (SkGeBoardInit(dev, pAC)) 4849 if (SkGeBoardInit(dev, pAC))
4889 goto out_free_netdev; 4850 goto out_free_netdev;
4890 4851
4852 /* Read Adapter name from VPD */
4853 if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) {
4854 printk(KERN_ERR "sk98lin: Could not read VPD data.\n");
4855 goto out_free_resources;
4856 }
4857
4891 /* Register net device */ 4858 /* Register net device */
4892 if (register_netdev(dev)) { 4859 if (register_netdev(dev)) {
4893 printk(KERN_ERR "sk98lin: Could not register device.\n"); 4860 printk(KERN_ERR "sk98lin: Could not register device.\n");
@@ -4895,8 +4862,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4895 } 4862 }
4896 4863
4897 /* Print adapter specific string from vpd */ 4864 /* Print adapter specific string from vpd */
4898 ProductStr(pAC); 4865 printk("%s: %s\n", dev->name, DeviceStr);
4899 printk("%s: %s\n", dev->name, pAC->DeviceStr);
4900 4866
4901 /* Print configuration settings */ 4867 /* Print configuration settings */
4902 printk(" PrefPort:%c RlmtMode:%s\n", 4868 printk(" PrefPort:%c RlmtMode:%s\n",
@@ -4912,8 +4878,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4912 memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6); 4878 memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6);
4913 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 4879 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
4914 4880
4915 SkGeProcCreate(dev);
4916
4917 pNet->PortNr = 0; 4881 pNet->PortNr = 0;
4918 pNet->NetNr = 0; 4882 pNet->NetNr = 0;
4919 4883
@@ -4932,8 +4896,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4932 pNet->PortNr = 1; 4896 pNet->PortNr = 1;
4933 pNet->NetNr = 1; 4897 pNet->NetNr = 1;
4934 pNet->pAC = pAC; 4898 pNet->pAC = pAC;
4935 pNet->Mtu = 1500;
4936 pNet->Up = 0;
4937 4899
4938 dev->open = &SkGeOpen; 4900 dev->open = &SkGeOpen;
4939 dev->stop = &SkGeClose; 4901 dev->stop = &SkGeClose;
@@ -4946,26 +4908,28 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4946 SET_NETDEV_DEV(dev, &pdev->dev); 4908 SET_NETDEV_DEV(dev, &pdev->dev);
4947 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4909 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4948 4910
4949#ifdef SK_ZEROCOPY
4950#ifdef USE_SK_TX_CHECKSUM
4951 if (pAC->ChipsetType) { 4911 if (pAC->ChipsetType) {
4952 /* SG and ZEROCOPY - fly baby... */ 4912#ifdef USE_SK_TX_CHECKSUM
4953 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 4913 dev->features |= NETIF_F_IP_CSUM;
4954 } 4914#endif
4915#ifdef SK_ZEROCOPY
4916 dev->features |= NETIF_F_SG;
4955#endif 4917#endif
4918#ifdef USE_SK_RX_CHECKSUM
4919 pAC->RxPort[1].RxCsum = 1;
4956#endif 4920#endif
4921 }
4957 4922
4958 if (register_netdev(dev)) { 4923 if (register_netdev(dev)) {
4959 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); 4924 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n");
4960 free_netdev(dev); 4925 free_netdev(dev);
4961 pAC->dev[1] = pAC->dev[0]; 4926 pAC->dev[1] = pAC->dev[0];
4962 } else { 4927 } else {
4963 SkGeProcCreate(dev);
4964 memcpy(&dev->dev_addr, 4928 memcpy(&dev->dev_addr,
4965 &pAC->Addr.Net[1].CurrentMacAddress, 6); 4929 &pAC->Addr.Net[1].CurrentMacAddress, 6);
4966 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 4930 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
4967 4931
4968 printk("%s: %s\n", dev->name, pAC->DeviceStr); 4932 printk("%s: %s\n", dev->name, DeviceStr);
4969 printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); 4933 printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
4970 } 4934 }
4971 } 4935 }
@@ -5001,10 +4965,7 @@ static void __devexit skge_remove_one(struct pci_dev *pdev)
5001 SK_AC *pAC = pNet->pAC; 4965 SK_AC *pAC = pNet->pAC;
5002 struct net_device *otherdev = pAC->dev[1]; 4966 struct net_device *otherdev = pAC->dev[1];
5003 4967
5004 SkGeProcRemove(dev);
5005 unregister_netdev(dev); 4968 unregister_netdev(dev);
5006 if (otherdev != dev)
5007 SkGeProcRemove(otherdev);
5008 4969
5009 SkGeYellowLED(pAC, pAC->IoBase, 0); 4970 SkGeYellowLED(pAC, pAC->IoBase, 0);
5010 4971
@@ -5089,9 +5050,9 @@ static int skge_resume(struct pci_dev *pdev)
5089 pci_enable_device(pdev); 5050 pci_enable_device(pdev);
5090 pci_set_master(pdev); 5051 pci_set_master(pdev);
5091 if (pAC->GIni.GIMacsFound == 2) 5052 if (pAC->GIni.GIMacsFound == 2)
5092 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 5053 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
5093 else 5054 else
5094 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); 5055 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev);
5095 if (ret) { 5056 if (ret) {
5096 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); 5057 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5097 pAC->AllocFlag &= ~SK_ALLOC_IRQ; 5058 pAC->AllocFlag &= ~SK_ALLOC_IRQ;
@@ -5149,23 +5110,12 @@ static struct pci_driver skge_driver = {
5149 5110
5150static int __init skge_init(void) 5111static int __init skge_init(void)
5151{ 5112{
5152 int error; 5113 return pci_module_init(&skge_driver);
5153
5154 pSkRootDir = proc_mkdir(SKRootName, NULL);
5155 if (pSkRootDir)
5156 pSkRootDir->owner = THIS_MODULE;
5157
5158 error = pci_register_driver(&skge_driver);
5159 if (error)
5160 remove_proc_entry(SKRootName, NULL);
5161 return error;
5162} 5114}
5163 5115
5164static void __exit skge_exit(void) 5116static void __exit skge_exit(void)
5165{ 5117{
5166 pci_unregister_driver(&skge_driver); 5118 pci_unregister_driver(&skge_driver);
5167 remove_proc_entry(SKRootName, NULL);
5168
5169} 5119}
5170 5120
5171module_init(skge_init); 5121module_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 ******************************************************************************/