diff options
Diffstat (limited to 'drivers/net/sk98lin/skge.c')
-rw-r--r-- | drivers/net/sk98lin/skge.c | 212 |
1 files changed, 81 insertions, 131 deletions
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); | |||
207 | static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); | 206 | static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); |
208 | static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); | 207 | static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); |
209 | static void GetConfiguration(SK_AC*); | 208 | static void GetConfiguration(SK_AC*); |
210 | static void ProductStr(SK_AC*); | ||
211 | static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); | 209 | static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); |
212 | static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); | 210 | static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); |
213 | static void FillRxRing(SK_AC*, RX_PORT*); | 211 | static 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 | ******************************************************************************/ |
239 | static const char SKRootName[] = "net/sk98lin"; | ||
240 | static struct proc_dir_entry *pSkRootDir; | ||
241 | extern struct file_operations sk_proc_fops; | ||
242 | |||
243 | static 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 | |||
255 | static inline void SkGeProcRemove(struct net_device *dev) | ||
256 | { | ||
257 | if (pSkRootDir) | ||
258 | remove_proc_entry(dev->name, pSkRootDir); | ||
259 | } | ||
260 | |||
261 | extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); | 237 | extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); |
262 | extern void SkDimDisplayModerationSettings(SK_AC *pAC); | 238 | extern void SkDimDisplayModerationSettings(SK_AC *pAC); |
263 | extern void SkDimStartModerationTimer(SK_AC *pAC); | 239 | extern 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 | */ | ||
269 | static inline int SkPciWriteCfgDWord( | ||
270 | SK_AC *pAC, /* Adapter Control structure pointer */ | ||
271 | int PciAddr, /* PCI register address */ | ||
272 | SK_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; | |||
2551 | static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) | 2545 | static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) |
2552 | { | 2546 | { |
2553 | DEV_NET *pNet; | 2547 | DEV_NET *pNet; |
2554 | DEV_NET *pOtherNet; | 2548 | struct net_device *pOtherDev; |
2555 | SK_AC *pAC; | 2549 | SK_AC *pAC; |
2556 | unsigned long Flags; | 2550 | unsigned long Flags; |
2557 | int i; | 2551 | int 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 | */ |
3775 | static void ProductStr( | 3770 | static inline int ProductStr( |
3776 | SK_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 | { |
3779 | int StrLen = 80; /* length of the string, defined in SK_AC */ | ||
3780 | char Keyword[] = VPD_NAME; /* vpd productname identifier */ | 3776 | char Keyword[] = VPD_NAME; /* vpd productname identifier */ |
3781 | int ReturnCode; /* return code from vpd_read */ | 3777 | int ReturnCode; /* return code from vpd_read */ |
3782 | unsigned long Flags; | 3778 | unsigned 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 | */ | ||
4006 | int SkPciWriteCfgDWord( | ||
4007 | SK_AC *pAC, /* Adapter Control structure pointer */ | ||
4008 | int PciAddr, /* PCI register address */ | ||
4009 | SK_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 | ||
5150 | static int __init skge_init(void) | 5111 | static 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 | ||
5164 | static void __exit skge_exit(void) | 5116 | static 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 | ||
5171 | module_init(skge_init); | 5121 | module_init(skge_init); |