Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / drivers / net / e100.c
index 4d0e0ae..3dbaec6 100644 (file)
 
 #define DRV_NAME               "e100"
 #define DRV_EXT                        "-NAPI"
-#define DRV_VERSION            "3.5.17-k2"DRV_EXT
+#define DRV_VERSION            "3.5.23-k4"DRV_EXT
 #define DRV_DESCRIPTION                "Intel(R) PRO/100 Network Driver"
 #define DRV_COPYRIGHT          "Copyright(c) 1999-2006 Intel Corporation"
 #define PFX                    DRV_NAME ": "
@@ -174,10 +174,13 @@ MODULE_VERSION(DRV_VERSION);
 
 static int debug = 3;
 static int eeprom_bad_csum_allow = 0;
+static int use_io = 0;
 module_param(debug, int, 0);
 module_param(eeprom_bad_csum_allow, int, 0);
+module_param(use_io, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
 MODULE_PARM_DESC(eeprom_bad_csum_allow, "Allow bad eeprom checksums");
+MODULE_PARM_DESC(use_io, "Force use of i/o access mode");
 #define DPRINTK(nlevel, klevel, fmt, args...) \
        (void)((NETIF_MSG_##nlevel & nic->msg_enable) && \
        printk(KERN_##klevel PFX "%s: %s: " fmt, nic->netdev->name, \
@@ -536,6 +539,7 @@ struct nic {
        struct csr __iomem *csr;
        enum scb_cmd_lo cuc_cmd;
        unsigned int cbs_avail;
+       struct napi_struct napi;
        struct cb *cbs;
        struct cb *cb_to_use;
        struct cb *cb_to_send;
@@ -554,7 +558,6 @@ struct nic {
        enum mac mac;
        enum phy phy;
        struct params params;
-       struct net_device_stats net_stats;
        struct timer_list watchdog;
        struct timer_list blink_timer;
        struct mii_if_info mii;
@@ -580,7 +583,6 @@ struct nic {
        u32 rx_tco_frames;
        u32 rx_over_length_errors;
 
-       u8 rev_id;
        u16 leds;
        u16 eeprom_wc;
        u16 eeprom[256];
@@ -591,7 +593,7 @@ static inline void e100_write_flush(struct nic *nic)
 {
        /* Flush previous PCI writes through intermediate bridges
         * by doing a benign read */
-       (void)readb(&nic->csr->scb.status);
+       (void)ioread8(&nic->csr->scb.status);
 }
 
 static void e100_enable_irq(struct nic *nic)
@@ -599,7 +601,7 @@ static void e100_enable_irq(struct nic *nic)
        unsigned long flags;
 
        spin_lock_irqsave(&nic->cmd_lock, flags);
-       writeb(irq_mask_none, &nic->csr->scb.cmd_hi);
+       iowrite8(irq_mask_none, &nic->csr->scb.cmd_hi);
        e100_write_flush(nic);
        spin_unlock_irqrestore(&nic->cmd_lock, flags);
 }
@@ -609,7 +611,7 @@ static void e100_disable_irq(struct nic *nic)
        unsigned long flags;
 
        spin_lock_irqsave(&nic->cmd_lock, flags);
-       writeb(irq_mask_all, &nic->csr->scb.cmd_hi);
+       iowrite8(irq_mask_all, &nic->csr->scb.cmd_hi);
        e100_write_flush(nic);
        spin_unlock_irqrestore(&nic->cmd_lock, flags);
 }
@@ -618,11 +620,11 @@ static void e100_hw_reset(struct nic *nic)
 {
        /* Put CU and RU into idle with a selective reset to get
         * device off of PCI bus */
-       writel(selective_reset, &nic->csr->port);
+       iowrite32(selective_reset, &nic->csr->port);
        e100_write_flush(nic); udelay(20);
 
        /* Now fully reset device */
-       writel(software_reset, &nic->csr->port);
+       iowrite32(software_reset, &nic->csr->port);
        e100_write_flush(nic); udelay(20);
 
        /* Mask off our interrupt line - it's unmasked after reset */
@@ -639,7 +641,7 @@ static int e100_self_test(struct nic *nic)
        nic->mem->selftest.signature = 0;
        nic->mem->selftest.result = 0xFFFFFFFF;
 
-       writel(selftest | dma_addr, &nic->csr->port);
+       iowrite32(selftest | dma_addr, &nic->csr->port);
        e100_write_flush(nic);
        /* Wait 10 msec for self-test to complete */
        msleep(10);
@@ -677,23 +679,23 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, u16 data)
        for(j = 0; j < 3; j++) {
 
                /* Chip select */
-               writeb(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
+               iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
                e100_write_flush(nic); udelay(4);
 
                for(i = 31; i >= 0; i--) {
                        ctrl = (cmd_addr_data[j] & (1 << i)) ?
                                eecs | eedi : eecs;
-                       writeb(ctrl, &nic->csr->eeprom_ctrl_lo);
+                       iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
                        e100_write_flush(nic); udelay(4);
 
-                       writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
+                       iowrite8(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
                        e100_write_flush(nic); udelay(4);
                }
                /* Wait 10 msec for cmd to complete */
                msleep(10);
 
                /* Chip deselect */
-               writeb(0, &nic->csr->eeprom_ctrl_lo);
+               iowrite8(0, &nic->csr->eeprom_ctrl_lo);
                e100_write_flush(nic); udelay(4);
        }
 };
@@ -709,21 +711,21 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
        cmd_addr_data = ((op_read << *addr_len) | addr) << 16;
 
        /* Chip select */
-       writeb(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
+       iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
        e100_write_flush(nic); udelay(4);
 
        /* Bit-bang to read word from eeprom */
        for(i = 31; i >= 0; i--) {
                ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs;
-               writeb(ctrl, &nic->csr->eeprom_ctrl_lo);
+               iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
                e100_write_flush(nic); udelay(4);
 
-               writeb(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
+               iowrite8(ctrl | eesk, &nic->csr->eeprom_ctrl_lo);
                e100_write_flush(nic); udelay(4);
 
                /* Eeprom drives a dummy zero to EEDO after receiving
                 * complete address.  Use this to adjust addr_len. */
-               ctrl = readb(&nic->csr->eeprom_ctrl_lo);
+               ctrl = ioread8(&nic->csr->eeprom_ctrl_lo);
                if(!(ctrl & eedo) && i > 16) {
                        *addr_len -= (i - 16);
                        i = 17;
@@ -733,7 +735,7 @@ static u16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
        }
 
        /* Chip deselect */
-       writeb(0, &nic->csr->eeprom_ctrl_lo);
+       iowrite8(0, &nic->csr->eeprom_ctrl_lo);
        e100_write_flush(nic); udelay(4);
 
        return le16_to_cpu(data);
@@ -804,7 +806,7 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
 
        /* Previous command is accepted when SCB clears */
        for(i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) {
-               if(likely(!readb(&nic->csr->scb.cmd_lo)))
+               if(likely(!ioread8(&nic->csr->scb.cmd_lo)))
                        break;
                cpu_relax();
                if(unlikely(i > E100_WAIT_SCB_FAST))
@@ -816,8 +818,8 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
        }
 
        if(unlikely(cmd != cuc_resume))
-               writel(dma_addr, &nic->csr->scb.gen_ptr);
-       writeb(cmd, &nic->csr->scb.cmd_lo);
+               iowrite32(dma_addr, &nic->csr->scb.gen_ptr);
+       iowrite8(cmd, &nic->csr->scb.cmd_lo);
 
 err_unlock:
        spin_unlock_irqrestore(&nic->cmd_lock, flags);
@@ -895,7 +897,7 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
         */
        spin_lock_irqsave(&nic->mdio_lock, flags);
        for (i = 100; i; --i) {
-               if (readl(&nic->csr->mdi_ctrl) & mdi_ready)
+               if (ioread32(&nic->csr->mdi_ctrl) & mdi_ready)
                        break;
                udelay(20);
        }
@@ -905,11 +907,11 @@ static u16 mdio_ctrl(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
                spin_unlock_irqrestore(&nic->mdio_lock, flags);
                return 0;               /* No way to indicate timeout error */
        }
-       writel((reg << 16) | (addr << 21) | dir | data, &nic->csr->mdi_ctrl);
+       iowrite32((reg << 16) | (addr << 21) | dir | data, &nic->csr->mdi_ctrl);
 
        for (i = 0; i < 100; i++) {
                udelay(20);
-               if ((data_out = readl(&nic->csr->mdi_ctrl)) & mdi_ready)
+               if ((data_out = ioread32(&nic->csr->mdi_ctrl)) & mdi_ready)
                        break;
        }
        spin_unlock_irqrestore(&nic->mdio_lock, flags);
@@ -934,9 +936,8 @@ static void e100_get_defaults(struct nic *nic)
        struct param_range rfds = { .min = 16, .max = 256, .count = 256 };
        struct param_range cbs  = { .min = 64, .max = 256, .count = 128 };
 
-       pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id);
        /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */
-       nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->rev_id;
+       nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision;
        if(nic->mac == mac_unknown)
                nic->mac = mac_82557_D100_A;
 
@@ -1021,10 +1022,16 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
                config->mwi_enable = 0x1;       /* 1=enable, 0=disable */
                config->standard_tcb = 0x0;     /* 1=standard, 0=extended */
                config->rx_long_ok = 0x1;       /* 1=VLANs ok, 0=standard */
-               if(nic->mac >= mac_82559_D101M)
+               if (nic->mac >= mac_82559_D101M) {
                        config->tno_intr = 0x1;         /* TCO stats enable */
-               else
+                       /* Enable TCO in extended config */
+                       if (nic->mac >= mac_82551_10) {
+                               config->byte_count = 0x20; /* extended bytes */
+                               config->rx_d102_mode = 0x1; /* GMRC for TCO */
+                       }
+               } else {
                        config->standard_stat_counter = 0x0;
+               }
        }
 
        DPRINTK(HW, DEBUG, "[00-07]=%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
@@ -1270,7 +1277,7 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb
        if (nic->flags & ich)
                goto noloaducode;
 
-       /* Search for ucode match against h/w rev_id */
+       /* Search for ucode match against h/w revision */
        for (opts = ucode_opts; opts->mac; opts++) {
                int i;
                u32 *ucode = opts->ucode;
@@ -1317,8 +1324,8 @@ static inline int e100_exec_cb_wait(struct nic *nic, struct sk_buff *skb,
                if (!--counter) break;
        }
 
-       /* ack any interupts, something could have been set */
-       writeb(~0, &nic->csr->scb.stat_ack);
+       /* ack any interrupts, something could have been set */
+       iowrite8(~0, &nic->csr->scb.stat_ack);
 
        /* if the command failed, or is not OK, notify and return */
        if (!counter || !(cb->status & cpu_to_le16(cb_ok))) {
@@ -1475,7 +1482,8 @@ static void e100_set_multicast_list(struct net_device *netdev)
 
 static void e100_update_stats(struct nic *nic)
 {
-       struct net_device_stats *ns = &nic->net_stats;
+       struct net_device *dev = nic->netdev;
+       struct net_device_stats *ns = &dev->stats;
        struct stats *s = &nic->mem->stats;
        u32 *complete = (nic->mac < mac_82558_D101_A4) ? &s->fc_xmt_pause :
                (nic->mac < mac_82559_D101M) ? (u32 *)&s->xmt_tco_frames :
@@ -1580,7 +1588,7 @@ static void e100_watchdog(unsigned long data)
         * accidentally, due to hardware that shares a register between the
         * interrupt mask bit and the SW Interrupt generation bit */
        spin_lock_irq(&nic->cmd_lock);
-       writeb(readb(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
+       iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
        e100_write_flush(nic);
        spin_unlock_irq(&nic->cmd_lock);
 
@@ -1597,7 +1605,8 @@ static void e100_watchdog(unsigned long data)
        else
                nic->flags &= ~ich_10h_workaround;
 
-       mod_timer(&nic->watchdog, jiffies + E100_WATCHDOG_PERIOD);
+       mod_timer(&nic->watchdog,
+                 round_jiffies(jiffies + E100_WATCHDOG_PERIOD));
 }
 
 static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
@@ -1652,6 +1661,7 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 
 static int e100_tx_clean(struct nic *nic)
 {
+       struct net_device *dev = nic->netdev;
        struct cb *cb;
        int tx_cleaned = 0;
 
@@ -1666,8 +1676,8 @@ static int e100_tx_clean(struct nic *nic)
                        cb->status);
 
                if(likely(cb->skb != NULL)) {
-                       nic->net_stats.tx_packets++;
-                       nic->net_stats.tx_bytes += cb->skb->len;
+                       dev->stats.tx_packets++;
+                       dev->stats.tx_bytes += cb->skb->len;
 
                        pci_unmap_single(nic->pdev,
                                le32_to_cpu(cb->u.tcb.tbd.buf_addr),
@@ -1798,6 +1808,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 static int e100_rx_indicate(struct nic *nic, struct rx *rx,
        unsigned int *work_done, unsigned int work_to_do)
 {
+       struct net_device *dev = nic->netdev;
        struct sk_buff *skb = rx->skb;
        struct rfd *rfd = (struct rfd *)skb->data;
        u16 rfd_status, actual_size;
@@ -1842,8 +1853,8 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
                nic->rx_over_length_errors++;
                dev_kfree_skb_any(skb);
        } else {
-               nic->net_stats.rx_packets++;
-               nic->net_stats.rx_bytes += actual_size;
+               dev->stats.rx_packets++;
+               dev->stats.rx_bytes += actual_size;
                nic->netdev->last_rx = jiffies;
                netif_receive_skb(skb);
                if(work_done)
@@ -1952,7 +1963,7 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
 {
        struct net_device *netdev = dev_id;
        struct nic *nic = netdev_priv(netdev);
-       u8 stat_ack = readb(&nic->csr->scb.stat_ack);
+       u8 stat_ack = ioread8(&nic->csr->scb.stat_ack);
 
        DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack);
 
@@ -1961,41 +1972,37 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
                return IRQ_NONE;
 
        /* Ack interrupt(s) */
-       writeb(stat_ack, &nic->csr->scb.stat_ack);
+       iowrite8(stat_ack, &nic->csr->scb.stat_ack);
 
        /* We hit Receive No Resource (RNR); restart RU after cleaning */
        if(stat_ack & stat_ack_rnr)
                nic->ru_running = RU_SUSPENDED;
 
-       if(likely(netif_rx_schedule_prep(netdev))) {
+       if(likely(netif_rx_schedule_prep(netdev, &nic->napi))) {
                e100_disable_irq(nic);
-               __netif_rx_schedule(netdev);
+               __netif_rx_schedule(netdev, &nic->napi);
        }
 
        return IRQ_HANDLED;
 }
 
-static int e100_poll(struct net_device *netdev, int *budget)
+static int e100_poll(struct napi_struct *napi, int budget)
 {
-       struct nic *nic = netdev_priv(netdev);
-       unsigned int work_to_do = min(netdev->quota, *budget);
+       struct nic *nic = container_of(napi, struct nic, napi);
+       struct net_device *netdev = nic->netdev;
        unsigned int work_done = 0;
        int tx_cleaned;
 
-       e100_rx_clean(nic, &work_done, work_to_do);
+       e100_rx_clean(nic, &work_done, budget);
        tx_cleaned = e100_tx_clean(nic);
 
        /* If no Rx and Tx cleanup work was done, exit polling mode. */
        if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) {
-               netif_rx_complete(netdev);
+               netif_rx_complete(netdev, napi);
                e100_enable_irq(nic);
-               return 0;
        }
 
-       *budget -= work_done;
-       netdev->quota -= work_done;
-
-       return 1;
+       return work_done;
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -2010,12 +2017,6 @@ static void e100_netpoll(struct net_device *netdev)
 }
 #endif
 
-static struct net_device_stats *e100_get_stats(struct net_device *netdev)
-{
-       struct nic *nic = netdev_priv(netdev);
-       return &nic->net_stats;
-}
-
 static int e100_set_mac_address(struct net_device *netdev, void *p)
 {
        struct nic *nic = netdev_priv(netdev);
@@ -2064,7 +2065,7 @@ static int e100_up(struct nic *nic)
                nic->netdev->name, nic->netdev)))
                goto err_no_irq;
        netif_wake_queue(nic->netdev);
-       netif_poll_enable(nic->netdev);
+       napi_enable(&nic->napi);
        /* enable ints _after_ enabling poll, preventing a race between
         * disable ints+schedule */
        e100_enable_irq(nic);
@@ -2082,7 +2083,7 @@ err_rx_clean_list:
 static void e100_down(struct nic *nic)
 {
        /* wait here for poll to complete */
-       netif_poll_disable(nic->netdev);
+       napi_disable(&nic->napi);
        netif_stop_queue(nic->netdev);
        e100_hw_reset(nic);
        free_irq(nic->pdev->irq, nic->netdev);
@@ -2107,7 +2108,7 @@ static void e100_tx_timeout_task(struct work_struct *work)
        struct net_device *netdev = nic->netdev;
 
        DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n",
-               readb(&nic->csr->scb.status));
+               ioread8(&nic->csr->scb.status));
        e100_down(netdev_priv(netdev));
        e100_up(netdev_priv(netdev));
 }
@@ -2229,10 +2230,10 @@ static void e100_get_regs(struct net_device *netdev,
        u32 *buff = p;
        int i;
 
-       regs->version = (1 << 24) | nic->rev_id;
-       buff[0] = readb(&nic->csr->scb.cmd_hi) << 24 |
-               readb(&nic->csr->scb.cmd_lo) << 16 |
-               readw(&nic->csr->scb.status);
+       regs->version = (1 << 24) | nic->pdev->revision;
+       buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 |
+               ioread8(&nic->csr->scb.cmd_lo) << 16 |
+               ioread16(&nic->csr->scb.status);
        for(i = E100_PHY_REGS; i >= 0; i--)
                buff[1 + E100_PHY_REGS - i] =
                        mdio_read(netdev, nic->mii.phy_id, i);
@@ -2373,11 +2374,6 @@ static const char e100_gstrings_test[][ETH_GSTRING_LEN] = {
 };
 #define E100_TEST_LEN  sizeof(e100_gstrings_test) / ETH_GSTRING_LEN
 
-static int e100_diag_test_count(struct net_device *netdev)
-{
-       return E100_TEST_LEN;
-}
-
 static void e100_diag_test(struct net_device *netdev,
        struct ethtool_test *test, u64 *data)
 {
@@ -2440,9 +2436,16 @@ static const char e100_gstrings_stats[][ETH_GSTRING_LEN] = {
 #define E100_NET_STATS_LEN     21
 #define E100_STATS_LEN sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN
 
-static int e100_get_stats_count(struct net_device *netdev)
+static int e100_get_sset_count(struct net_device *netdev, int sset)
 {
-       return E100_STATS_LEN;
+       switch (sset) {
+       case ETH_SS_TEST:
+               return E100_TEST_LEN;
+       case ETH_SS_STATS:
+               return E100_STATS_LEN;
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 static void e100_get_ethtool_stats(struct net_device *netdev,
@@ -2452,7 +2455,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
        int i;
 
        for(i = 0; i < E100_NET_STATS_LEN; i++)
-               data[i] = ((unsigned long *)&nic->net_stats)[i];
+               data[i] = ((unsigned long *)&netdev->stats)[i];
 
        data[i++] = nic->tx_deferred;
        data[i++] = nic->tx_single_collisions;
@@ -2493,13 +2496,11 @@ static const struct ethtool_ops e100_ethtool_ops = {
        .set_eeprom             = e100_set_eeprom,
        .get_ringparam          = e100_get_ringparam,
        .set_ringparam          = e100_set_ringparam,
-       .self_test_count        = e100_diag_test_count,
        .self_test              = e100_diag_test,
        .get_strings            = e100_get_strings,
        .phys_id                = e100_phys_id,
-       .get_stats_count        = e100_get_stats_count,
        .get_ethtool_stats      = e100_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
+       .get_sset_count         = e100_get_sset_count,
 };
 
 static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
@@ -2548,6 +2549,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
        struct net_device *netdev;
        struct nic *nic;
        int err;
+       DECLARE_MAC_BUF(mac);
 
        if(!(netdev = alloc_etherdev(sizeof(struct nic)))) {
                if(((1 << debug) - 1) & NETIF_MSG_PROBE)
@@ -2558,7 +2560,6 @@ static int __devinit e100_probe(struct pci_dev *pdev,
        netdev->open = e100_open;
        netdev->stop = e100_close;
        netdev->hard_start_xmit = e100_xmit_frame;
-       netdev->get_stats = e100_get_stats;
        netdev->set_multicast_list = e100_set_multicast_list;
        netdev->set_mac_address = e100_set_mac_address;
        netdev->change_mtu = e100_change_mtu;
@@ -2566,14 +2567,13 @@ static int __devinit e100_probe(struct pci_dev *pdev,
        SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops);
        netdev->tx_timeout = e100_tx_timeout;
        netdev->watchdog_timeo = E100_WATCHDOG_PERIOD;
-       netdev->poll = e100_poll;
-       netdev->weight = E100_NAPI_WEIGHT;
 #ifdef CONFIG_NET_POLL_CONTROLLER
        netdev->poll_controller = e100_netpoll;
 #endif
        strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
 
        nic = netdev_priv(netdev);
+       netif_napi_add(netdev, &nic->napi, e100_poll, E100_NAPI_WEIGHT);
        nic->netdev = netdev;
        nic->pdev = pdev;
        nic->msg_enable = (1 << debug) - 1;
@@ -2601,10 +2601,12 @@ static int __devinit e100_probe(struct pci_dev *pdev,
                goto err_out_free_res;
        }
 
-       SET_MODULE_OWNER(netdev);
        SET_NETDEV_DEV(netdev, &pdev->dev);
 
-       nic->csr = ioremap(pci_resource_start(pdev, 0), sizeof(struct csr));
+       if (use_io)
+               DPRINTK(PROBE, INFO, "using i/o access mode\n");
+
+       nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr));
        if(!nic->csr) {
                DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n");
                err = -ENOMEM;
@@ -2651,11 +2653,16 @@ static int __devinit e100_probe(struct pci_dev *pdev,
 
        memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
        memcpy(netdev->perm_addr, nic->eeprom, ETH_ALEN);
-       if(!is_valid_ether_addr(netdev->perm_addr)) {
-               DPRINTK(PROBE, ERR, "Invalid MAC address from "
-                       "EEPROM, aborting.\n");
-               err = -EAGAIN;
-               goto err_out_free;
+       if (!is_valid_ether_addr(netdev->perm_addr)) {
+               if (!eeprom_bad_csum_allow) {
+                       DPRINTK(PROBE, ERR, "Invalid MAC address from "
+                               "EEPROM, aborting.\n");
+                       err = -EAGAIN;
+                       goto err_out_free;
+               } else {
+                       DPRINTK(PROBE, ERR, "Invalid MAC address from EEPROM, "
+                               "you MUST configure one.\n");
+               }
        }
 
        /* Wol magic packet can be enabled from eeprom */
@@ -2674,18 +2681,16 @@ static int __devinit e100_probe(struct pci_dev *pdev,
                goto err_out_free;
        }
 
-       DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, "
-               "MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n",
-               (unsigned long long)pci_resource_start(pdev, 0), pdev->irq,
-               netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2],
-               netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5]);
+       DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %s\n",
+               (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
+               pdev->irq, print_mac(mac, netdev->dev_addr));
 
        return 0;
 
 err_out_free:
        e100_free(nic);
 err_out_iounmap:
-       iounmap(nic->csr);
+       pci_iounmap(pdev, nic->csr);
 err_out_free_res:
        pci_release_regions(pdev);
 err_out_disable_pdev:
@@ -2719,7 +2724,7 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
        struct nic *nic = netdev_priv(netdev);
 
        if (netif_running(netdev))
-               netif_poll_disable(nic->netdev);
+               napi_disable(&nic->napi);
        del_timer_sync(&nic->watchdog);
        netif_carrier_off(nic->netdev);
        netif_device_detach(netdev);
@@ -2765,7 +2770,7 @@ static void e100_shutdown(struct pci_dev *pdev)
        struct nic *nic = netdev_priv(netdev);
 
        if (netif_running(netdev))
-               netif_poll_disable(nic->netdev);
+               napi_disable(&nic->napi);
        del_timer_sync(&nic->watchdog);
        netif_carrier_off(nic->netdev);
 
@@ -2790,12 +2795,13 @@ static void e100_shutdown(struct pci_dev *pdev)
 static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
+       struct nic *nic = netdev_priv(netdev);
 
        /* Similar to calling e100_down(), but avoids adpater I/O. */
        netdev->stop(netdev);
 
        /* Detach; put netif into state similar to hotplug unplug. */
-       netif_poll_enable(netdev);
+       napi_enable(&nic->napi);
        netif_device_detach(netdev);
        pci_disable_device(pdev);