aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/sk98lin/h/skdrv2nd.h7
-rw-r--r--drivers/net/sk98lin/skge.c71
2 files changed, 34 insertions, 44 deletions
diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h
index 0ebafc885705..778d9e618ebd 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;
267struct s_DevNet { 267struct s_DevNet {
268 int PortNr; 268 int PortNr;
269 int NetNr; 269 int NetNr;
270 int Mtu;
271 int Up;
272 SK_AC *pAC; 270 SK_AC *pAC;
273}; 271};
274 272
@@ -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/skge.c b/drivers/net/sk98lin/skge.c
index 02143fa3ee5b..8338d4972500 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);
206static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); 206static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev);
207static 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);
208static void GetConfiguration(SK_AC*); 208static void GetConfiguration(SK_AC*);
209static void ProductStr(SK_AC*);
210static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); 209static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*);
211static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); 210static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*);
212static void FillRxRing(SK_AC*, RX_PORT*); 211static void FillRxRing(SK_AC*, RX_PORT*);
@@ -321,7 +320,7 @@ int SkGeInitPCI(SK_AC *pAC)
321 dev->mem_start = pci_resource_start (pdev, 0); 320 dev->mem_start = pci_resource_start (pdev, 0);
322 pci_set_master(pdev); 321 pci_set_master(pdev);
323 322
324 if (pci_request_regions(pdev, pAC->Name) != 0) { 323 if (pci_request_regions(pdev, "sk98lin") != 0) {
325 retval = 2; 324 retval = 2;
326 goto out_disable; 325 goto out_disable;
327 } 326 }
@@ -599,10 +598,10 @@ SK_BOOL DualNet;
599 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 598 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
600 599
601 if (pAC->GIni.GIMacsFound == 2) { 600 if (pAC->GIni.GIMacsFound == 2) {
602 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 601 Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
603 } else if (pAC->GIni.GIMacsFound == 1) { 602 } else if (pAC->GIni.GIMacsFound == 1) {
604 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, 603 Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ,
605 pAC->Name, dev); 604 "sk98lin", dev);
606 } else { 605 } else {
607 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", 606 printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n",
608 pAC->GIni.GIMacsFound); 607 pAC->GIni.GIMacsFound);
@@ -1286,7 +1285,6 @@ struct SK_NET_DEVICE *dev)
1286 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 1285 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
1287 1286
1288 pAC->MaxPorts++; 1287 pAC->MaxPorts++;
1289 pNet->Up = 1;
1290 1288
1291 1289
1292 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, 1290 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY,
@@ -1416,7 +1414,6 @@ struct SK_NET_DEVICE *dev)
1416 sizeof(SK_PNMI_STRUCT_DATA)); 1414 sizeof(SK_PNMI_STRUCT_DATA));
1417 1415
1418 pAC->MaxPorts--; 1416 pAC->MaxPorts--;
1419 pNet->Up = 0;
1420 1417
1421 return (0); 1418 return (0);
1422} /* SkGeClose */ 1419} /* SkGeClose */
@@ -2568,7 +2565,7 @@ unsigned long Flags;
2568static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) 2565static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu)
2569{ 2566{
2570DEV_NET *pNet; 2567DEV_NET *pNet;
2571DEV_NET *pOtherNet; 2568struct net_device *pOtherDev;
2572SK_AC *pAC; 2569SK_AC *pAC;
2573unsigned long Flags; 2570unsigned long Flags;
2574int i; 2571int i;
@@ -2598,11 +2595,11 @@ SK_EVPARA EvPara;
2598 } 2595 }
2599#endif 2596#endif
2600 2597
2601 pNet->Mtu = NewMtu; 2598 pOtherDev = pAC->dev[1 - pNet->NetNr];
2602 pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]); 2599
2603 if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { 2600 if ( netif_running(pOtherDev) && (pOtherDev->mtu > 1500)
2604 return(0); 2601 && (NewMtu <= 1500))
2605 } 2602 return 0;
2606 2603
2607 pAC->RxBufSize = NewMtu + 32; 2604 pAC->RxBufSize = NewMtu + 32;
2608 dev->mtu = NewMtu; 2605 dev->mtu = NewMtu;
@@ -2764,7 +2761,8 @@ SK_EVPARA EvPara;
2764 EvPara.Para32[1] = -1; 2761 EvPara.Para32[1] = -1;
2765 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2762 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2766 2763
2767 if (pOtherNet->Up) { 2764 if (netif_running(pOtherDev)) {
2765 DEV_NET *pOtherNet = netdev_priv(pOtherDev);
2768 EvPara.Para32[0] = pOtherNet->PortNr; 2766 EvPara.Para32[0] = pOtherNet->PortNr;
2769 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); 2767 SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara);
2770 } 2768 }
@@ -2838,7 +2836,7 @@ unsigned long Flags; /* for spin lock */
2838 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; 2836 pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts;
2839 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; 2837 pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts;
2840 2838
2841 if (pNet->Mtu <= 1500) { 2839 if (dev->mtu <= 1500) {
2842 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; 2840 pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF;
2843 } else { 2841 } else {
2844 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - 2842 pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts -
@@ -3789,25 +3787,21 @@ int Capabilities[3][3] =
3789 * 3787 *
3790 * Returns: N/A 3788 * Returns: N/A
3791 */ 3789 */
3792static void ProductStr( 3790static inline int ProductStr(
3793SK_AC *pAC /* pointer to adapter context */ 3791 SK_AC *pAC, /* pointer to adapter context */
3792 char *DeviceStr, /* result string */
3793 int StrLen /* length of the string */
3794) 3794)
3795{ 3795{
3796int StrLen = 80; /* length of the string, defined in SK_AC */
3797char Keyword[] = VPD_NAME; /* vpd productname identifier */ 3796char Keyword[] = VPD_NAME; /* vpd productname identifier */
3798int ReturnCode; /* return code from vpd_read */ 3797int ReturnCode; /* return code from vpd_read */
3799unsigned long Flags; 3798unsigned long Flags;
3800 3799
3801 spin_lock_irqsave(&pAC->SlowPathLock, Flags); 3800 spin_lock_irqsave(&pAC->SlowPathLock, Flags);
3802 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, pAC->DeviceStr, 3801 ReturnCode = VpdRead(pAC, pAC->IoBase, Keyword, DeviceStr, &StrLen);
3803 &StrLen);
3804 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); 3802 spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
3805 if (ReturnCode != 0) { 3803
3806 /* there was an error reading the vpd data */ 3804 return ReturnCode;
3807 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ERROR,
3808 ("Error reading VPD data: %d\n", ReturnCode));
3809 pAC->DeviceStr[0] = '\0';
3810 }
3811} /* ProductStr */ 3805} /* ProductStr */
3812 3806
3813/***************************************************************************** 3807/*****************************************************************************
@@ -4466,7 +4460,7 @@ SK_AC *pAc) /* pointer to adapter context */
4466 4460
4467 pAC->DiagModeActive = DIAG_ACTIVE; 4461 pAC->DiagModeActive = DIAG_ACTIVE;
4468 if (pAC->BoardLevel > SK_INIT_DATA) { 4462 if (pAC->BoardLevel > SK_INIT_DATA) {
4469 if (pNet->Up) { 4463 if (netif_running(pAC->dev[0])) {
4470 pAC->WasIfUp[0] = SK_TRUE; 4464 pAC->WasIfUp[0] = SK_TRUE;
4471 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4465 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4472 DoPrintInterfaceChange = SK_FALSE; 4466 DoPrintInterfaceChange = SK_FALSE;
@@ -4476,7 +4470,7 @@ SK_AC *pAc) /* pointer to adapter context */
4476 } 4470 }
4477 if (pNet != netdev_priv(pAC->dev[1])) { 4471 if (pNet != netdev_priv(pAC->dev[1])) {
4478 pNet = netdev_priv(pAC->dev[1]); 4472 pNet = netdev_priv(pAC->dev[1]);
4479 if (pNet->Up) { 4473 if (netif_running(pAC->dev[1])) {
4480 pAC->WasIfUp[1] = SK_TRUE; 4474 pAC->WasIfUp[1] = SK_TRUE;
4481 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ 4475 pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */
4482 DoPrintInterfaceChange = SK_FALSE; 4476 DoPrintInterfaceChange = SK_FALSE;
@@ -4802,6 +4796,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4802 struct net_device *dev = NULL; 4796 struct net_device *dev = NULL;
4803 static int boards_found = 0; 4797 static int boards_found = 0;
4804 int error = -ENODEV; 4798 int error = -ENODEV;
4799 char DeviceStr[80];
4805 4800
4806 if (pci_enable_device(pdev)) 4801 if (pci_enable_device(pdev))
4807 goto out; 4802 goto out;
@@ -4829,14 +4824,11 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4829 memset(pNet->pAC, 0, sizeof(SK_AC)); 4824 memset(pNet->pAC, 0, sizeof(SK_AC));
4830 pAC = pNet->pAC; 4825 pAC = pNet->pAC;
4831 pAC->PciDev = pdev; 4826 pAC->PciDev = pdev;
4832 pAC->PciDevId = pdev->device; 4827
4833 pAC->dev[0] = dev; 4828 pAC->dev[0] = dev;
4834 pAC->dev[1] = dev; 4829 pAC->dev[1] = dev;
4835 sprintf(pAC->Name, "SysKonnect SK-98xx");
4836 pAC->CheckQueue = SK_FALSE; 4830 pAC->CheckQueue = SK_FALSE;
4837 4831
4838 pNet->Mtu = 1500;
4839 pNet->Up = 0;
4840 dev->irq = pdev->irq; 4832 dev->irq = pdev->irq;
4841 error = SkGeInitPCI(pAC); 4833 error = SkGeInitPCI(pAC);
4842 if (error) { 4834 if (error) {
@@ -4877,6 +4869,12 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4877 if (SkGeBoardInit(dev, pAC)) 4869 if (SkGeBoardInit(dev, pAC))
4878 goto out_free_netdev; 4870 goto out_free_netdev;
4879 4871
4872 /* Read Adapter name from VPD */
4873 if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) {
4874 printk(KERN_ERR "sk98lin: Could not read VPD data.\n");
4875 goto out_free_resources;
4876 }
4877
4880 /* Register net device */ 4878 /* Register net device */
4881 if (register_netdev(dev)) { 4879 if (register_netdev(dev)) {
4882 printk(KERN_ERR "sk98lin: Could not register device.\n"); 4880 printk(KERN_ERR "sk98lin: Could not register device.\n");
@@ -4884,8 +4882,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4884 } 4882 }
4885 4883
4886 /* Print adapter specific string from vpd */ 4884 /* Print adapter specific string from vpd */
4887 ProductStr(pAC); 4885 printk("%s: %s\n", dev->name, DeviceStr);
4888 printk("%s: %s\n", dev->name, pAC->DeviceStr);
4889 4886
4890 /* Print configuration settings */ 4887 /* Print configuration settings */
4891 printk(" PrefPort:%c RlmtMode:%s\n", 4888 printk(" PrefPort:%c RlmtMode:%s\n",
@@ -4921,8 +4918,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4921 pNet->PortNr = 1; 4918 pNet->PortNr = 1;
4922 pNet->NetNr = 1; 4919 pNet->NetNr = 1;
4923 pNet->pAC = pAC; 4920 pNet->pAC = pAC;
4924 pNet->Mtu = 1500;
4925 pNet->Up = 0;
4926 4921
4927 dev->open = &SkGeOpen; 4922 dev->open = &SkGeOpen;
4928 dev->stop = &SkGeClose; 4923 dev->stop = &SkGeClose;
@@ -4957,7 +4952,7 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4957 &pAC->Addr.Net[1].CurrentMacAddress, 6); 4952 &pAC->Addr.Net[1].CurrentMacAddress, 6);
4958 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 4953 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
4959 4954
4960 printk("%s: %s\n", dev->name, pAC->DeviceStr); 4955 printk("%s: %s\n", dev->name, DeviceStr);
4961 printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); 4956 printk(" PrefPort:B RlmtMode:Dual Check Link State\n");
4962 } 4957 }
4963 } 4958 }
@@ -5081,9 +5076,9 @@ static int skge_resume(struct pci_dev *pdev)
5081 pci_enable_device(pdev); 5076 pci_enable_device(pdev);
5082 pci_set_master(pdev); 5077 pci_set_master(pdev);
5083 if (pAC->GIni.GIMacsFound == 2) 5078 if (pAC->GIni.GIMacsFound == 2)
5084 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); 5079 ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev);
5085 else 5080 else
5086 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); 5081 ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev);
5087 if (ret) { 5082 if (ret) {
5088 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); 5083 printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
5089 pAC->AllocFlag &= ~SK_ALLOC_IRQ; 5084 pAC->AllocFlag &= ~SK_ALLOC_IRQ;