]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/sk98lin/skge.c
[PATCH] s/;;/;/g
[linux-2.6-omap-h63xx.git] / drivers / net / sk98lin / skge.c
index ae734393475876a6c0bd9ce521fb714967c15f21..38a26df4095f33976dc05bca3b405fe3cf9c64dc 100644 (file)
 
 #include       "h/skversion.h"
 
+#include       <linux/in.h>
 #include       <linux/module.h>
 #include       <linux/moduleparam.h>
 #include       <linux/init.h>
-#include       <linux/proc_fs.h>
 #include       <linux/dma-mapping.h>
 #include       <linux/ip.h>
 
@@ -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*);
@@ -235,28 +234,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);
@@ -277,6 +254,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
@@ -284,26 +282,22 @@ static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480};
  * Description:
  *     This function initialize the PCI resources and IO
  *
- * Returns: N/A
- *     
+ * Returns:
+ *     0 - indicate everything worked ok.
+ *     != 0 - error indication
  */
-int SkGeInitPCI(SK_AC *pAC)
+static __devinit int SkGeInitPCI(SK_AC *pAC)
 {
        struct SK_NET_DEVICE *dev = pAC->dev[0];
        struct pci_dev *pdev = pAC->PciDev;
        int retval;
 
-       if (pci_enable_device(pdev) != 0) {
-               return 1;
-       }
-
        dev->mem_start = pci_resource_start (pdev, 0);
        pci_set_master(pdev);
 
-       if (pci_request_regions(pdev, pAC->Name) != 0) {
-               retval = 2;
-               goto out_disable;
-       }
+       retval = pci_request_regions(pdev, "sk98lin");
+       if (retval)
+               goto out;
 
 #ifdef SK_BIG_ENDIAN
        /*
@@ -322,9 +316,8 @@ int SkGeInitPCI(SK_AC *pAC)
         * Remap the regs into kernel space.
         */
        pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000);
-
-       if (!pAC->IoBase){
-               retval = 3;
+       if (!pAC->IoBase) {
+               retval = -EIO;
                goto out_release;
        }
 
@@ -332,8 +325,7 @@ int SkGeInitPCI(SK_AC *pAC)
 
  out_release:
        pci_release_regions(pdev);
- out_disable:
-       pci_disable_device(pdev);
+ out:
        return retval;
 }
 
@@ -494,7 +486,7 @@ module_param_array(AutoSizing, charp, NULL, 0);
  *     0, if everything is ok
  *     !=0, on error
  */
-static int __init SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC)
+static int __devinit SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC)
 {
 short  i;
 unsigned long Flags;
@@ -531,7 +523,7 @@ SK_BOOL     DualNet;
        if (SkGeInit(pAC, pAC->IoBase, SK_INIT_DATA) != 0) {
                printk("HWInit (0) failed.\n");
                spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-               return(-EAGAIN);
+               return -EIO;
        }
        SkI2cInit(  pAC, pAC->IoBase, SK_INIT_DATA);
        SkEventInit(pAC, pAC->IoBase, SK_INIT_DATA);
@@ -553,7 +545,7 @@ SK_BOOL     DualNet;
        if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) {
                printk("sk98lin: HWInit (1) failed.\n");
                spin_unlock_irqrestore(&pAC->SlowPathLock, Flags);
-               return(-EAGAIN);
+               return -EIO;
        }
        SkI2cInit(  pAC, pAC->IoBase, SK_INIT_IO);
        SkEventInit(pAC, pAC->IoBase, SK_INIT_IO);
@@ -578,27 +570,27 @@ 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);
-               return -EAGAIN;
+               return -EIO;
        }
 
        if (Ret) {
                printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n",
                       dev->irq);
-               return -EAGAIN;
+               return Ret;
        }
        pAC->AllocFlag |= SK_ALLOC_IRQ;
 
        /* Alloc memory for this board (Mem for RxD/TxD) : */
        if(!BoardAllocMem(pAC)) {
                printk("No memory for descriptor rings.\n");
-                       return(-EAGAIN);
+               return -ENOMEM;
        }
 
        BoardInitMem(pAC);
@@ -614,7 +606,7 @@ SK_BOOL     DualNet;
                DualNet)) {
                BoardFreeMem(pAC);
                printk("sk98lin: SkGeInitAssignRamToQueues failed.\n");
-               return(-EAGAIN);
+               return -EIO;
        }
 
        return (0);
@@ -635,8 +627,7 @@ SK_BOOL     DualNet;
  *     SK_TRUE, if all memory could be allocated
  *     SK_FALSE, if not
  */
-static SK_BOOL BoardAllocMem(
-SK_AC  *pAC)
+static __devinit SK_BOOL BoardAllocMem(SK_AC   *pAC)
 {
 caddr_t                pDescrMem;      /* pointer to descriptor memory area */
 size_t         AllocLength;    /* length of complete descriptor area */
@@ -729,8 +720,7 @@ size_t              AllocLength;    /* length of complete descriptor area */
  *
  * Returns:    N/A
  */
-static void BoardInitMem(
-SK_AC  *pAC)   /* pointer to adapter context */
+static __devinit void BoardInitMem(SK_AC *pAC)
 {
 int    i;              /* loop counter */
 int    RxDescrSize;    /* the size of a rx descriptor rounded up to alignment*/
@@ -1265,7 +1255,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,
@@ -1395,7 +1384,6 @@ struct SK_NET_DEVICE      *dev)
                        sizeof(SK_PNMI_STRUCT_DATA));
 
        pAC->MaxPorts--;
-       pNet->Up = 0;
 
        return (0);
 } /* SkGeClose */
@@ -1739,7 +1727,7 @@ struct sk_buff    *pMessage)      /* pointer to send-message              */
                pTxd->VDataHigh = (SK_U32) (PhysAddr >> 32);
                pTxd->pMBuf     = pMessage;
                
-               pTxd->TBControl = Control | BMU_OWN | sk_frag->size;;
+               pTxd->TBControl = Control | BMU_OWN | sk_frag->size;
 
                /* 
                ** Do we have the last fragment? 
@@ -2175,7 +2163,6 @@ rx_start:
                pMsg->ip_summed = CHECKSUM_NONE;
 #endif
 
-
                SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V"));
                ForRlmt = SK_RLMT_RX_PROTOCOL;
 #if 0
@@ -2550,7 +2537,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;
@@ -2580,11 +2567,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;
@@ -2746,7 +2733,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);
                }
@@ -2820,7 +2808,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 -
@@ -2863,7 +2851,7 @@ unsigned long     Flags;                  /* for spin lock */
  * Description:
  *     This function is called if an ioctl is issued on the device.
  *     There are three subfunction for reading, writing and test-writing
- *     the private MIB data structure (usefull for SysKonnect-internal tools).
+ *     the private MIB data structure (useful for SysKonnect-internal tools).
  *
  * Returns:
  *     0, if everything is ok
@@ -3771,25 +3759,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 */
 
 /*****************************************************************************
@@ -3990,28 +3974,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
@@ -4150,6 +4112,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,
@@ -4233,22 +4196,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;
@@ -4263,9 +4216,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,
@@ -4479,7 +4432,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;
@@ -4489,7 +4442,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;
@@ -4815,42 +4768,56 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
        struct net_device       *dev = NULL;
        static int boards_found = 0;
        int error = -ENODEV;
+       int using_dac = 0;
+       char DeviceStr[80];
 
        if (pci_enable_device(pdev))
                goto out;
  
        /* Configure DMA attributes. */
-       if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
-           pci_set_dma_mask(pdev, DMA_32BIT_MASK))
-               goto out_disable_device;
-
+       if (sizeof(dma_addr_t) > sizeof(u32) &&
+           !(error = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
+               using_dac = 1;
+               error = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
+               if (error < 0) {
+                       printk(KERN_ERR "sk98lin %s unable to obtain 64 bit DMA "
+                              "for consistent allocations\n", pci_name(pdev));
+                       goto out_disable_device;
+               }
+       } else {
+               error = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+               if (error) {
+                       printk(KERN_ERR "sk98lin %s no usable DMA configuration\n",
+                              pci_name(pdev));
+                       goto out_disable_device;
+               }
+       }
 
-       if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) {
-               printk(KERN_ERR "Unable to allocate etherdev "
+       error = -ENOMEM;
+       dev = alloc_etherdev(sizeof(DEV_NET));
+       if (!dev) {
+               printk(KERN_ERR "sk98lin: unable to allocate etherdev "
                       "structure!\n");
                goto out_disable_device;
        }
 
        pNet = netdev_priv(dev);
-       pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL);
+       pNet->pAC = kzalloc(sizeof(SK_AC), GFP_KERNEL);
        if (!pNet->pAC) {
-               printk(KERN_ERR "Unable to allocate adapter "
+               printk(KERN_ERR "sk98lin: unable to allocate adapter "
                       "structure!\n");
                goto out_free_netdev;
        }
 
-       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) {
                printk(KERN_ERR "sk98lin: PCI setup failed: %i\n", error);
@@ -4872,30 +4839,44 @@ 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
+       }
+
+       if (using_dac)
+               dev->features |= NETIF_F_HIGHDMA;
 
        pAC->Index = boards_found++;
 
-       if (SkGeBoardInit(dev, pAC))
+       error = SkGeBoardInit(dev, pAC);
+       if (error)
                goto out_free_netdev;
 
+       /* Read Adapter name from VPD */
+       if (ProductStr(pAC, DeviceStr, sizeof(DeviceStr)) != 0) {
+               error = -EIO;
+               printk(KERN_ERR "sk98lin: Could not read VPD data.\n");
+               goto out_free_resources;
+       }
+
        /* Register net device */
-       if (register_netdev(dev)) {
+       error = register_netdev(dev);
+       if (error) {
                printk(KERN_ERR "sk98lin: Could not register device.\n");
                goto out_free_resources;
        }
 
        /* 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",
@@ -4911,28 +4892,26 @@ 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;
 
        boards_found++;
 
+       pci_set_drvdata(pdev, dev);
+
        /* More then one port found */
        if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) {
-               if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) {
-                       printk(KERN_ERR "Unable to allocate etherdev "
+               dev = alloc_etherdev(sizeof(DEV_NET));
+               if (!dev) {
+                       printk(KERN_ERR "sk98lin: unable to allocate etherdev "
                                "structure!\n");
-                       goto out;
+                       goto single_port;
                }
 
-               pAC->dev[1]   = dev;
                pNet          = netdev_priv(dev);
                pNet->PortNr  = 1;
                pNet->NetNr   = 1;
                pNet->pAC     = pAC;
-               pNet->Mtu     = 1500;
-               pNet->Up      = 0;
 
                dev->open               = &SkGeOpen;
                dev->stop               = &SkGeClose;
@@ -4945,30 +4924,40 @@ 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 (using_dac)
+                       dev->features |= NETIF_F_HIGHDMA;
 
-               if (register_netdev(dev)) {
-                       printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n");
+               error = register_netdev(dev);
+               if (error) {
+                       printk(KERN_ERR "sk98lin: Could not register device"
+                              " for second port. (%d)\n", error);
                        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);
-       
-                       printk("%s: %s\n", dev->name, pAC->DeviceStr);
-                       printk("      PrefPort:B  RlmtMode:Dual Check Link State\n");
+                       goto single_port;
                }
+
+               pAC->dev[1]   = dev;
+               memcpy(&dev->dev_addr,
+                      &pAC->Addr.Net[1].CurrentMacAddress, 6);
+               memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+
+               printk("%s: %s\n", dev->name, DeviceStr);
+               printk("      PrefPort:B  RlmtMode:Dual Check Link State\n");
        }
 
+single_port:
+
        /* Save the hardware revision */
        pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) +
                (pAC->GIni.GIPciHwRev & 0x0F);
@@ -4980,7 +4969,6 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
        memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA));
        memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA));
 
-       pci_set_drvdata(pdev, dev);
        return 0;
 
  out_free_resources:
@@ -5000,10 +4988,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);
 
@@ -5088,9 +5073,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;
@@ -5148,23 +5133,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);