From c8ebd3a37f0e7a2aae337279d58a50c1a1fcd053 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Fri, 11 Nov 2005 20:44:21 +0100 Subject: [PATCH] drivers/net/sk98lin/skge.c: make SkPciWriteCfgDWord() a static inline No external user and that small - such a function should be static inline and not a global function. Signed-off-by: Adrian Bunk Signed-off-by: John W. Linville --- drivers/net/sk98lin/h/skvpd.h | 8 -------- drivers/net/sk98lin/skge.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 30 deletions(-) (limited to 'drivers/net/sk98lin') diff --git a/drivers/net/sk98lin/h/skvpd.h b/drivers/net/sk98lin/h/skvpd.h index bdc1a5eaaae..daa9a8d154f 100644 --- a/drivers/net/sk98lin/h/skvpd.h +++ b/drivers/net/sk98lin/h/skvpd.h @@ -130,14 +130,12 @@ typedef struct s_vpd_key { #ifndef VPD_DO_IO #define VPD_OUT8(pAC,IoC,Addr,Val) (void)SkPciWriteCfgByte(pAC,Addr,Val) #define VPD_OUT16(pAC,IoC,Addr,Val) (void)SkPciWriteCfgWord(pAC,Addr,Val) -#define VPD_OUT32(pAC,IoC,Addr,Val) (void)SkPciWriteCfgDWord(pAC,Addr,Val) #define VPD_IN8(pAC,IoC,Addr,pVal) (void)SkPciReadCfgByte(pAC,Addr,pVal) #define VPD_IN16(pAC,IoC,Addr,pVal) (void)SkPciReadCfgWord(pAC,Addr,pVal) #define VPD_IN32(pAC,IoC,Addr,pVal) (void)SkPciReadCfgDWord(pAC,Addr,pVal) #else /* VPD_DO_IO */ #define VPD_OUT8(pAC,IoC,Addr,Val) SK_OUT8(IoC,PCI_C(Addr),Val) #define VPD_OUT16(pAC,IoC,Addr,Val) SK_OUT16(IoC,PCI_C(Addr),Val) -#define VPD_OUT32(pAC,IoC,Addr,Val) SK_OUT32(IoC,PCI_C(Addr),Val) #define VPD_IN8(pAC,IoC,Addr,pVal) SK_IN8(IoC,PCI_C(Addr),pVal) #define VPD_IN16(pAC,IoC,Addr,pVal) SK_IN16(IoC,PCI_C(Addr),pVal) #define VPD_IN32(pAC,IoC,Addr,pVal) SK_IN32(IoC,PCI_C(Addr),pVal) @@ -155,12 +153,6 @@ typedef struct s_vpd_key { else \ SK_OUT16(pAC,PCI_C(Addr),Val); \ } -#define VPD_OUT32(pAC,Ioc,Addr,Val) { \ - if ((pAC)->DgT.DgUseCfgCycle) \ - SkPciWriteCfgDWord(pAC,Addr,Val); \ - else \ - SK_OUT32(pAC,PCI_C(Addr),Val); \ - } #define VPD_IN8(pAC,Ioc,Addr,pVal) { \ if ((pAC)->DgT.DgUseCfgCycle) \ SkPciReadCfgByte(pAC,Addr,pVal); \ diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index b18c92cb629..08906ef3ff7 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -277,6 +277,27 @@ extern struct ethtool_ops SkGeEthtoolOps; static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}}; static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; +/***************************************************************************** + * + * SkPciWriteCfgDWord - write a 32 bit value to pci config space + * + * Description: + * This routine writes a 32 bit value to the pci configuration + * space. + * + * Returns: + * 0 - indicate everything worked ok. + * != 0 - error indication + */ +static inline int SkPciWriteCfgDWord( +SK_AC *pAC, /* Adapter Control structure pointer */ +int PciAddr, /* PCI register address */ +SK_U32 Val) /* pointer to store the read value */ +{ + pci_write_config_dword(pAC->PciDev, PciAddr, Val); + return(0); +} /* SkPciWriteCfgDWord */ + /***************************************************************************** * * SkGeInitPCI - Init the PCI resources @@ -4083,28 +4104,6 @@ SK_U8 *pVal) /* pointer to store the read value */ } /* SkPciReadCfgByte */ -/***************************************************************************** - * - * SkPciWriteCfgDWord - write a 32 bit value to pci config space - * - * Description: - * This routine writes a 32 bit value to the pci configuration - * space. - * - * Returns: - * 0 - indicate everything worked ok. - * != 0 - error indication - */ -int SkPciWriteCfgDWord( -SK_AC *pAC, /* Adapter Control structure pointer */ -int PciAddr, /* PCI register address */ -SK_U32 Val) /* pointer to store the read value */ -{ - pci_write_config_dword(pAC->PciDev, PciAddr, Val); - return(0); -} /* SkPciWriteCfgDWord */ - - /***************************************************************************** * * SkPciWriteCfgWord - write a 16 bit value to pci config space -- cgit v1.2.3 From 9a648f3c535cb6b24a5f0538d032aea9a33ec515 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Sun, 13 Nov 2005 00:33:32 -0500 Subject: [PATCH] skge: fix warning from inlining SkPciWriteCfgDWord() Making SkPciWriteCfgDWord a static inline produces a warning due to a forward declaration in skdrv2nd.h. This patch removes that declaration. Signed-off-by: John W. Linville --- drivers/net/sk98lin/h/skdrv2nd.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/net/sk98lin') diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h index 542cec57f86..c0bfce5a465 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*); extern int SkPciReadCfgDWord(SK_AC*, int, SK_U32*); extern int SkPciReadCfgWord(SK_AC*, int, SK_U16*); extern int SkPciReadCfgByte(SK_AC*, int, SK_U8*); -extern int SkPciWriteCfgDWord(SK_AC*, int, SK_U32); extern int SkPciWriteCfgWord(SK_AC*, int, SK_U16); extern int SkPciWriteCfgByte(SK_AC*, int, SK_U8); extern int SkDrvEvent(SK_AC*, SK_IOC IoC, SK_U32, SK_EVPARA); -- cgit v1.2.3 From 09f5a214389fe467c2ff15aa2b85349bbde15bce Mon Sep 17 00:00:00 2001 From: "shemminger@osdl.org" Date: Wed, 23 Nov 2005 22:00:52 -0800 Subject: [PATCH] sk98lin: allow ethtool checksum on/off per port Allow control of checksumming parameters via ethtool. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/sk98lin/h/skdrv2nd.h | 1 + drivers/net/sk98lin/skethtool.c | 48 +++++++++++++++++++++++++++++ drivers/net/sk98lin/skge.c | 66 ++++++++++++++++++---------------------- 3 files changed, 79 insertions(+), 36 deletions(-) (limited to 'drivers/net/sk98lin') diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h index 9bdfde80c30..0ebafc88570 100644 --- a/drivers/net/sk98lin/h/skdrv2nd.h +++ b/drivers/net/sk98lin/h/skdrv2nd.h @@ -297,6 +297,7 @@ struct s_RxPort { RXD *pRxdRingTail; /* Tail of Rx rings */ RXD *pRxdRingPrev; /* descriptor given to BMU previously */ int RxdRingFree; /* # of free entrys */ + int RxCsum; /* use receive checksum hardware */ spinlock_t RxDesRingLock; /* serialize descriptor accesses */ int RxFillLimit; /* limit for buffers in ring */ SK_IOC HwAddr; /* bmu registers address */ diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c index b71769ae460..4265ed91a9c 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 return ret ? -EIO : 0; } +/* Only Yukon supports checksum offload. */ +static int setScatterGather(struct net_device *dev, u32 data) +{ + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + + if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) + return -EOPNOTSUPP; + return ethtool_op_set_sg(dev, data); +} + +static int setTxCsum(struct net_device *dev, u32 data) +{ + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + + if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) + return -EOPNOTSUPP; + + return ethtool_op_set_tx_csum(dev, data); +} + +static u32 getRxCsum(struct net_device *dev) +{ + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + + return pAC->RxPort[pNet->PortNr].RxCsum; +} + +static int setRxCsum(struct net_device *dev, u32 data) +{ + DEV_NET *pNet = netdev_priv(dev); + SK_AC *pAC = pNet->pAC; + + if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) + return -EOPNOTSUPP; + + pAC->RxPort[pNet->PortNr].RxCsum = data != 0; + return 0; +} + struct ethtool_ops SkGeEthtoolOps = { .get_settings = getSettings, .set_settings = setSettings, @@ -551,4 +593,10 @@ struct ethtool_ops SkGeEthtoolOps = { .set_pauseparam = setPauseParams, .get_link = ethtool_op_get_link, .get_perm_addr = ethtool_op_get_perm_addr, + .get_sg = ethtool_op_get_sg, + .set_sg = setScatterGather, + .get_tx_csum = ethtool_op_get_tx_csum, + .set_tx_csum = setTxCsum, + .get_rx_csum = getRxCsum, + .set_rx_csum = setRxCsum, }; diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 107c5d97546..02143fa3ee5 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -2189,13 +2189,10 @@ rx_start: skb_put(pMsg, FrameLength); } /* frame > SK_COPY_TRESHOLD */ -#ifdef USE_SK_RX_CHECKSUM - pMsg->csum = pRxd->TcpSums; - pMsg->ip_summed = CHECKSUM_HW; -#else - pMsg->ip_summed = CHECKSUM_NONE; -#endif - + if (pRxPort->RxCsum) { + pMsg->csum = pRxd->TcpSums; + pMsg->ip_summed = CHECKSUM_HW; + } SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); ForRlmt = SK_RLMT_RX_PROTOCOL; @@ -4149,6 +4146,7 @@ SK_BOOL DualNet; Flags); break; case SK_DRV_NET_UP: /* SK_U32 PortIdx */ + { struct net_device *dev = pAC->dev[Param.Para32[0]]; /* action list 5 */ FromPort = Param.Para32[0]; SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, @@ -4232,22 +4230,12 @@ SK_BOOL DualNet; printk(" irq moderation: disabled\n"); -#ifdef SK_ZEROCOPY - if (pAC->ChipsetType) -#ifdef USE_SK_TX_CHECKSUM - printk(" scatter-gather: enabled\n"); -#else - printk(" tx-checksum: disabled\n"); -#endif - else - printk(" scatter-gather: disabled\n"); -#else - printk(" scatter-gather: disabled\n"); -#endif - -#ifndef USE_SK_RX_CHECKSUM - printk(" rx-checksum: disabled\n"); -#endif + printk(" scatter-gather: %s\n", + (dev->features & NETIF_F_SG) ? "enabled" : "disabled"); + printk(" tx-checksum: %s\n", + (dev->features & NETIF_F_IP_CSUM) ? "enabled" : "disabled"); + printk(" rx-checksum: %s\n", + pAC->RxPort[Param.Para32[0]].RxCsum ? "enabled" : "disabled"); } else { DoPrintInterfaceChange = SK_TRUE; @@ -4262,9 +4250,9 @@ SK_BOOL DualNet; } /* Inform the world that link protocol is up. */ - netif_carrier_on(pAC->dev[Param.Para32[0]]); - + netif_carrier_on(dev); break; + } case SK_DRV_NET_DOWN: /* SK_U32 Reason */ /* action list 7 */ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, @@ -4871,15 +4859,18 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, SET_NETDEV_DEV(dev, &pdev->dev); SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); -#ifdef SK_ZEROCOPY -#ifdef USE_SK_TX_CHECKSUM + /* Use only if yukon hardware */ if (pAC->ChipsetType) { - /* Use only if yukon hardware */ - /* SK and ZEROCOPY - fly baby... */ - dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; - } +#ifdef USE_SK_TX_CHECKSUM + dev->features |= NETIF_F_IP_CSUM; #endif +#ifdef SK_ZEROCOPY + dev->features |= NETIF_F_SG; +#endif +#ifdef USE_SK_RX_CHECKSUM + pAC->RxPort[0].RxCsum = 1; #endif + } pAC->Index = boards_found++; @@ -4944,14 +4935,17 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, SET_NETDEV_DEV(dev, &pdev->dev); SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); -#ifdef SK_ZEROCOPY -#ifdef USE_SK_TX_CHECKSUM if (pAC->ChipsetType) { - /* SG and ZEROCOPY - fly baby... */ - dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; - } +#ifdef USE_SK_TX_CHECKSUM + dev->features |= NETIF_F_IP_CSUM; #endif +#ifdef SK_ZEROCOPY + dev->features |= NETIF_F_SG; +#endif +#ifdef USE_SK_RX_CHECKSUM + pAC->RxPort[1].RxCsum = 1; #endif + } if (register_netdev(dev)) { printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); -- cgit v1.2.3 From 8f7a17d12a8cfd0ab4a50dded8390f6c44f1f205 Mon Sep 17 00:00:00 2001 From: "shemminger@osdl.org" Date: Wed, 23 Nov 2005 22:00:53 -0800 Subject: [PATCH] sk98lin: remove redundant fields in device info Shrink size of per device data by removing redundant fields or things that are only used at boot up. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/sk98lin/h/skdrv2nd.h | 7 +--- drivers/net/sk98lin/skge.c | 71 +++++++++++++++++++--------------------- 2 files changed, 34 insertions(+), 44 deletions(-) (limited to 'drivers/net/sk98lin') diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h index 0ebafc88570..778d9e618eb 100644 --- a/drivers/net/sk98lin/h/skdrv2nd.h +++ b/drivers/net/sk98lin/h/skdrv2nd.h @@ -267,8 +267,6 @@ typedef struct s_DevNet DEV_NET; struct s_DevNet { int PortNr; int NetNr; - int Mtu; - int Up; SK_AC *pAC; }; @@ -390,12 +388,10 @@ struct s_AC { SK_IOC IoBase; /* register set of adapter */ int BoardLevel; /* level of active hw init (0-2) */ - char DeviceStr[80]; /* adapter string from vpd */ + SK_U32 AllocFlag; /* flag allocation of resources */ struct pci_dev *PciDev; /* for access to pci config space */ - SK_U32 PciDevId; /* pci device id */ struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */ - char Name[30]; /* driver name */ int RxBufSize; /* length of receive buffers */ struct net_device_stats stats; /* linux 'netstat -i' statistics */ @@ -430,7 +426,6 @@ struct s_AC { DIM_INFO DynIrqModInfo; /* all data related to DIM */ /* Only for tests */ - int PortUp; int PortDown; int ChipsetType; /* Chipset family type * 0 == Genesis family support diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 02143fa3ee5..8338d497250 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -206,7 +206,6 @@ static void SkGeSetRxMode(struct SK_NET_DEVICE *dev); static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); static void GetConfiguration(SK_AC*); -static void ProductStr(SK_AC*); static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); static void FillRxRing(SK_AC*, RX_PORT*); @@ -321,7 +320,7 @@ int SkGeInitPCI(SK_AC *pAC) dev->mem_start = pci_resource_start (pdev, 0); pci_set_master(pdev); - if (pci_request_regions(pdev, pAC->Name) != 0) { + if (pci_request_regions(pdev, "sk98lin") != 0) { retval = 2; goto out_disable; } @@ -599,10 +598,10 @@ SK_BOOL DualNet; spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); if (pAC->GIni.GIMacsFound == 2) { - Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); + Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); } else if (pAC->GIni.GIMacsFound == 1) { Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, - pAC->Name, dev); + "sk98lin", dev); } else { printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", pAC->GIni.GIMacsFound); @@ -1286,7 +1285,6 @@ struct SK_NET_DEVICE *dev) spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); pAC->MaxPorts++; - pNet->Up = 1; SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, @@ -1416,7 +1414,6 @@ struct SK_NET_DEVICE *dev) sizeof(SK_PNMI_STRUCT_DATA)); pAC->MaxPorts--; - pNet->Up = 0; return (0); } /* SkGeClose */ @@ -2568,7 +2565,7 @@ unsigned long Flags; static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) { DEV_NET *pNet; -DEV_NET *pOtherNet; +struct net_device *pOtherDev; SK_AC *pAC; unsigned long Flags; int i; @@ -2598,11 +2595,11 @@ SK_EVPARA EvPara; } #endif - pNet->Mtu = NewMtu; - pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]); - if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { - return(0); - } + pOtherDev = pAC->dev[1 - pNet->NetNr]; + + if ( netif_running(pOtherDev) && (pOtherDev->mtu > 1500) + && (NewMtu <= 1500)) + return 0; pAC->RxBufSize = NewMtu + 32; dev->mtu = NewMtu; @@ -2764,7 +2761,8 @@ SK_EVPARA EvPara; EvPara.Para32[1] = -1; SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); - if (pOtherNet->Up) { + if (netif_running(pOtherDev)) { + DEV_NET *pOtherNet = netdev_priv(pOtherDev); EvPara.Para32[0] = pOtherNet->PortNr; SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); } @@ -2838,7 +2836,7 @@ unsigned long Flags; /* for spin lock */ pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; - if (pNet->Mtu <= 1500) { + if (dev->mtu <= 1500) { pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; } else { pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - @@ -3789,25 +3787,21 @@ int Capabilities[3][3] = * * Returns: N/A */ -static void ProductStr( -SK_AC *pAC /* pointer to adapter context */ +static inline int ProductStr( + SK_AC *pAC, /* pointer to adapter context */ + char *DeviceStr, /* result string */ + int StrLen /* length of the string */ ) { -int StrLen = 80; /* length of the string, defined in SK_AC */ char Keyword[] = VPD_NAME; /* vpd productname identifier */ int ReturnCode; /* return code from vpd_read */ unsigned long Flags; spin_lock_irqsave(&pAC->SlowPathLock, Flags); - ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr, - &StrLen); + ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, DeviceStr, &StrLen); spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - if (ReturnCode != 0) { - /* there was an error reading the vpd data */ - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR, - ("Error reading VPD data: %d\n", ReturnCode)); - pAC->DeviceStr[0] = '\0'; - } + + return ReturnCode; } /* ProductStr */ /***************************************************************************** @@ -4466,7 +4460,7 @@ SK_AC *pAc) /* pointer to adapter context */ pAC->DiagModeActive = DIAG_ACTIVE; if (pAC->BoardLevel > SK_INIT_DATA) { - if (pNet->Up) { + if (netif_running(pAC->dev[0])) { pAC->WasIfUp[0] = SK_TRUE; pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ DoPrintInterfaceChange = SK_FALSE; @@ -4476,7 +4470,7 @@ SK_AC *pAc) /* pointer to adapter context */ } if (pNet != netdev_priv(pAC->dev[1])) { pNet = netdev_priv(pAC->dev[1]); - if (pNet->Up) { + if (netif_running(pAC->dev[1])) { pAC->WasIfUp[1] = SK_TRUE; pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ DoPrintInterfaceChange = SK_FALSE; @@ -4802,6 +4796,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, struct net_device *dev = NULL; static int boards_found = 0; int error = -ENODEV; + char DeviceStr[80]; if (pci_enable_device(pdev)) goto out; @@ -4829,14 +4824,11 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, memset(pNet->pAC, 0, sizeof(SK_AC)); pAC = pNet->pAC; pAC->PciDev = pdev; - pAC->PciDevId = pdev->device; + pAC->dev[0] = dev; pAC->dev[1] = dev; - sprintf(pAC->Name, "SysKonnect SK-98xx"); pAC->CheckQueue = SK_FALSE; - pNet->Mtu = 1500; - pNet->Up = 0; dev->irq = pdev->irq; error = SkGeInitPCI(pAC); if (error) { @@ -4877,6 +4869,12 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, if (SkGeBoardInit(dev, pAC)) goto out_free_netdev; + /* Read Adapter name from VPD */ + if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) { + printk(KERN_ERR "sk98lin: Could not read VPD data.\n"); + goto out_free_resources; + } + /* Register net device */ if (register_netdev(dev)) { printk(KERN_ERR "sk98lin: Could not register device.\n"); @@ -4884,8 +4882,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, } /* Print adapter specific string from vpd */ - ProductStr(pAC); - printk("%s: %s\n", dev->name, pAC->DeviceStr); + printk("%s: %s\n", dev->name, DeviceStr); /* Print configuration settings */ printk(" PrefPort:%c RlmtMode:%s\n", @@ -4921,8 +4918,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, pNet->PortNr = 1; pNet->NetNr = 1; pNet->pAC = pAC; - pNet->Mtu = 1500; - pNet->Up = 0; dev->open = &SkGeOpen; dev->stop = &SkGeClose; @@ -4957,7 +4952,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, &pAC->Addr.Net[1].CurrentMacAddress, 6); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); - printk("%s: %s\n", dev->name, pAC->DeviceStr); + printk("%s: %s\n", dev->name, DeviceStr); printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); } } @@ -5081,9 +5076,9 @@ static int skge_resume(struct pci_dev *pdev) pci_enable_device(pdev); pci_set_master(pdev); if (pAC->GIni.GIMacsFound == 2) - ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); + ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); else - ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); + ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev); if (ret) { printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); pAC->AllocFlag &= ~SK_ALLOC_IRQ; -- cgit v1.2.3 From 35b8fcab1b293cadd54cdf9e9636cc576d2cad88 Mon Sep 17 00:00:00 2001 From: "shemminger@osdl.org" Date: Wed, 23 Nov 2005 22:00:54 -0800 Subject: [PATCH] sk98lin: remove /proc interface Remove device specific proc interface. It doesn't handle renames correctly; it ain't worth fixing. Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/sk98lin/Makefile | 3 +- drivers/net/sk98lin/skge.c | 42 +------ drivers/net/sk98lin/skproc.c | 265 ------------------------------------------- 3 files changed, 2 insertions(+), 308 deletions(-) delete mode 100644 drivers/net/sk98lin/skproc.c (limited to 'drivers/net/sk98lin') diff --git a/drivers/net/sk98lin/Makefile b/drivers/net/sk98lin/Makefile index 7653d6e33aa..afd900d5d73 100644 --- a/drivers/net/sk98lin/Makefile +++ b/drivers/net/sk98lin/Makefile @@ -26,8 +26,7 @@ sk98lin-objs := \ skrlmt.o \ sktimer.o \ skvpd.o \ - skxmac2.o \ - skproc.o + skxmac2.o # DBGDEF = \ # -DDEBUG diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 8338d497250..e3bdb583600 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -110,7 +110,6 @@ #include #include #include -#include #include #include @@ -234,28 +233,6 @@ static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); * Extern Function Prototypes * ******************************************************************************/ -static const char SKRootName[] = "net/sk98lin"; -static struct proc_dir_entry *pSkRootDir; -extern struct file_operations sk_proc_fops; - -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 SkDimDisplayModerationSettings(SK_AC *pAC); extern void SkDimStartModerationTimer(SK_AC *pAC); @@ -4898,8 +4875,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); - SkGeProcCreate(dev); - pNet->PortNr = 0; pNet->NetNr = 0; @@ -4947,7 +4922,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, free_netdev(dev); pAC->dev[1] = pAC->dev[0]; } else { - SkGeProcCreate(dev); memcpy(&dev->dev_addr, &pAC->Addr.Net[1].CurrentMacAddress, 6); memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); @@ -4988,10 +4962,7 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) SK_AC *pAC = pNet->pAC; struct net_device *otherdev = pAC->dev[1]; - SkGeProcRemove(dev); unregister_netdev(dev); - if (otherdev != dev) - SkGeProcRemove(otherdev); SkGeYellowLED(pAC, pAC->IoBase, 0); @@ -5136,23 +5107,12 @@ static struct pci_driver skge_driver = { static int __init skge_init(void) { - int error; - - pSkRootDir = proc_mkdir(SKRootName, NULL); - if (pSkRootDir) - pSkRootDir->owner = THIS_MODULE; - - error = pci_register_driver(&skge_driver); - if (error) - remove_proc_entry(SKRootName, NULL); - return error; + return pci_module_init(&skge_driver); } static void __exit skge_exit(void) { pci_unregister_driver(&skge_driver); - remove_proc_entry(SKRootName, NULL); - } module_init(skge_init); diff --git a/drivers/net/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c deleted file mode 100644 index 5cece25c034..00000000000 --- a/drivers/net/sk98lin/skproc.c +++ /dev/null @@ -1,265 +0,0 @@ -/****************************************************************************** - * - * Name: skproc.c - * Project: GEnesis, PCI Gigabit Ethernet Adapter - * Version: $Revision: 1.11 $ - * Date: $Date: 2003/12/11 16:03:57 $ - * Purpose: Funktions to display statictic data - * - ******************************************************************************/ - -/****************************************************************************** - * - * (C)Copyright 1998-2002 SysKonnect GmbH. - * (C)Copyright 2002-2003 Marvell. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Created 22-Nov-2000 - * Author: Mirko Lindner (mlindner@syskonnect.de) - * - * The information in this file is provided "AS IS" without warranty. - * - ******************************************************************************/ -#include -#include - -#include "h/skdrv1st.h" -#include "h/skdrv2nd.h" -#include "h/skversion.h" - -static int sk_seq_show(struct seq_file *seq, void *v); -static int sk_proc_open(struct inode *inode, struct file *file); - -struct file_operations sk_proc_fops = { - .owner = THIS_MODULE, - .open = sk_proc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - - -/***************************************************************************** - * - * 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: 0 - * - */ -static int sk_seq_show(struct seq_file *seq, void *v) -{ - struct net_device *dev = seq->private; - DEV_NET *pNet = netdev_priv(dev); - SK_AC *pAC = pNet->pAC; - SK_PNMI_STRUCT_DATA *pPnmiStruct = &pAC->PnmiStruct; - unsigned long Flags; - unsigned int Size; - char sens_msg[50]; - int t; - int i; - - /* NetIndex in GetStruct is now required, zero is only dummy */ - for (t=pAC->GIni.GIMacsFound; t > 0; t--) { - if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 1) - t--; - - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - Size = SK_PNMI_STRUCT_SIZE; -#ifdef SK_DIAG_SUPPORT - if (pAC->BoardLevel == SK_INIT_DATA) { - SK_MEMCPY(&(pAC->PnmiStruct), &(pAC->PnmiBackup), sizeof(SK_PNMI_STRUCT_DATA)); - if (pAC->DiagModeActive == DIAG_NOTACTIVE) { - pAC->Pnmi.DiagAttached = SK_DIAG_IDLE; - } - } else { - SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, t-1); - } -#else - SkPnmiGetStruct(pAC, pAC->IoBase, - pPnmiStruct, &Size, t-1); -#endif - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - - if (pAC->dev[t-1] == dev) { - SK_PNMI_STAT *pPnmiStat = &pPnmiStruct->Stat[0]; - - seq_printf(seq, "\nDetailed statistic for device %s\n", - pAC->dev[t-1]->name); - seq_printf(seq, "=======================================\n"); - - /* Board statistics */ - seq_printf(seq, "\nBoard statistics\n\n"); - seq_printf(seq, "Active Port %c\n", - 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. - Net[t-1].PrefPort]->PortNumber); - seq_printf(seq, "Preferred Port %c\n", - 'A' + pAC->Rlmt.Net[t-1].Port[pAC->Rlmt. - Net[t-1].PrefPort]->PortNumber); - - seq_printf(seq, "Bus speed (MHz) %d\n", - pPnmiStruct->BusSpeed); - - seq_printf(seq, "Bus width (Bit) %d\n", - pPnmiStruct->BusWidth); - seq_printf(seq, "Driver version %s\n", - VER_STRING); - seq_printf(seq, "Hardware revision v%d.%d\n", - (pAC->GIni.GIPciHwRev >> 4) & 0x0F, - pAC->GIni.GIPciHwRev & 0x0F); - - /* Print sensor informations */ - for (i=0; i < pAC->I2c.MaxSens; i ++) { - /* Check type */ - switch (pAC->I2c.SenTable[i].SenType) { - case 1: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (C)"); - seq_printf(seq, "%-25s %d.%02d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue / 10, - pAC->I2c.SenTable[i].SenValue % 10); - - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (F)"); - seq_printf(seq, "%-25s %d.%02d\n", - sens_msg, - ((((pAC->I2c.SenTable[i].SenValue) - *10)*9)/5 + 3200)/100, - ((((pAC->I2c.SenTable[i].SenValue) - *10)*9)/5 + 3200) % 10); - break; - case 2: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (V)"); - seq_printf(seq, "%-25s %d.%03d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue / 1000, - pAC->I2c.SenTable[i].SenValue % 1000); - break; - case 3: - strcpy(sens_msg, pAC->I2c.SenTable[i].SenDesc); - strcat(sens_msg, " (rpm)"); - seq_printf(seq, "%-25s %d\n", - sens_msg, - pAC->I2c.SenTable[i].SenValue); - break; - default: - break; - } - } - - /*Receive statistics */ - seq_printf(seq, "\nReceive statistics\n\n"); - - seq_printf(seq, "Received bytes %Lu\n", - (unsigned long long) pPnmiStat->StatRxOctetsOkCts); - seq_printf(seq, "Received packets %Lu\n", - (unsigned long long) pPnmiStat->StatRxOkCts); -#if 0 - if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && - pAC->HWRevision < 12) { - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxShortsCts; - pPnmiStat->StatRxShortsCts = 0; - } -#endif - if (dev->mtu > 1500) - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxTooLongCts; - - seq_printf(seq, "Receive errors %Lu\n", - (unsigned long long) pPnmiStruct->InErrorsCts); - seq_printf(seq, "Receive dropped %Lu\n", - (unsigned long long) pPnmiStruct->RxNoBufCts); - seq_printf(seq, "Received multicast %Lu\n", - (unsigned long long) pPnmiStat->StatRxMulticastOkCts); - seq_printf(seq, "Receive error types\n"); - seq_printf(seq, " length %Lu\n", - (unsigned long long) pPnmiStat->StatRxRuntCts); - seq_printf(seq, " buffer overflow %Lu\n", - (unsigned long long) pPnmiStat->StatRxFifoOverflowCts); - seq_printf(seq, " bad crc %Lu\n", - (unsigned long long) pPnmiStat->StatRxFcsCts); - seq_printf(seq, " framing %Lu\n", - (unsigned long long) pPnmiStat->StatRxFramingCts); - seq_printf(seq, " missed frames %Lu\n", - (unsigned long long) pPnmiStat->StatRxMissedCts); - - if (dev->mtu > 1500) - pPnmiStat->StatRxTooLongCts = 0; - - seq_printf(seq, " too long %Lu\n", - (unsigned long long) pPnmiStat->StatRxTooLongCts); - seq_printf(seq, " carrier extension %Lu\n", - (unsigned long long) pPnmiStat->StatRxCextCts); - seq_printf(seq, " too short %Lu\n", - (unsigned long long) pPnmiStat->StatRxShortsCts); - seq_printf(seq, " symbol %Lu\n", - (unsigned long long) pPnmiStat->StatRxSymbolCts); - seq_printf(seq, " LLC MAC size %Lu\n", - (unsigned long long) pPnmiStat->StatRxIRLengthCts); - seq_printf(seq, " carrier event %Lu\n", - (unsigned long long) pPnmiStat->StatRxCarrierCts); - seq_printf(seq, " jabber %Lu\n", - (unsigned long long) pPnmiStat->StatRxJabberCts); - - - /*Transmit statistics */ - seq_printf(seq, "\nTransmit statistics\n\n"); - - seq_printf(seq, "Transmited bytes %Lu\n", - (unsigned long long) pPnmiStat->StatTxOctetsOkCts); - seq_printf(seq, "Transmited packets %Lu\n", - (unsigned long long) pPnmiStat->StatTxOkCts); - seq_printf(seq, "Transmit errors %Lu\n", - (unsigned long long) pPnmiStat->StatTxSingleCollisionCts); - seq_printf(seq, "Transmit dropped %Lu\n", - (unsigned long long) pPnmiStruct->TxNoBufCts); - seq_printf(seq, "Transmit collisions %Lu\n", - (unsigned long long) pPnmiStat->StatTxSingleCollisionCts); - seq_printf(seq, "Transmit error types\n"); - seq_printf(seq, " excessive collision %ld\n", - pAC->stats.tx_aborted_errors); - seq_printf(seq, " carrier %Lu\n", - (unsigned long long) pPnmiStat->StatTxCarrierCts); - seq_printf(seq, " fifo underrun %Lu\n", - (unsigned long long) pPnmiStat->StatTxFifoUnderrunCts); - seq_printf(seq, " heartbeat %Lu\n", - (unsigned long long) pPnmiStat->StatTxCarrierCts); - seq_printf(seq, " window %ld\n", - pAC->stats.tx_window_errors); - - } - } - return 0; -} - -/***************************************************************************** - * - * sk_proc_open - register the show function when proc is open'ed - * - * Description: - * This function is called whenever a sk98lin proc file is queried. - * - * Returns: the return value of single_open() - * - */ -static int sk_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, sk_seq_show, PDE(inode)->data); -} - -/******************************************************************************* - * - * End of file - * - ******************************************************************************/ -- cgit v1.2.3