]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/skge.c
myri10ge: update firmware headers
[mirror_ubuntu-artful-kernel.git] / drivers / net / skge.c
index 21afe108d3cb3908efd888650104a09a0b3b4d46..2aae9fe38c5a9c250ae79f648ef081645cddf9e4 100644 (file)
@@ -135,10 +135,13 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 /* Wake on Lan only supported on Yukon chips with rev 1 or above */
 static u32 wol_supported(const struct skge_hw *hw)
 {
-       if (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev != 0)
-               return WAKE_MAGIC | WAKE_PHY;
-       else
+       if (hw->chip_id == CHIP_ID_GENESIS)
+               return 0;
+
+       if (hw->chip_id == CHIP_ID_YUKON && hw->chip_rev == 0)
                return 0;
+
+       return WAKE_MAGIC | WAKE_PHY;
 }
 
 static u32 pci_wake_enabled(struct pci_dev *dev)
@@ -407,9 +410,14 @@ static const struct skge_stat {
        { "rx_fcs_error",       XM_RXF_FCS_ERR, GM_RXF_FCS_ERR },
 };
 
-static int skge_get_stats_count(struct net_device *dev)
+static int skge_get_sset_count(struct net_device *dev, int sset)
 {
-       return ARRAY_SIZE(skge_stats);
+       switch (sset) {
+       case ETH_SS_STATS:
+               return ARRAY_SIZE(skge_stats);
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 static void skge_get_ethtool_stats(struct net_device *dev,
@@ -808,17 +816,14 @@ static const struct ethtool_ops skge_ethtool_ops = {
        .set_pauseparam = skge_set_pauseparam,
        .get_coalesce   = skge_get_coalesce,
        .set_coalesce   = skge_set_coalesce,
-       .get_sg         = ethtool_op_get_sg,
        .set_sg         = skge_set_sg,
-       .get_tx_csum    = ethtool_op_get_tx_csum,
        .set_tx_csum    = skge_set_tx_csum,
        .get_rx_csum    = skge_get_rx_csum,
        .set_rx_csum    = skge_set_rx_csum,
        .get_strings    = skge_get_strings,
        .phys_id        = skge_phys_id,
-       .get_stats_count = skge_get_stats_count,
+       .get_sset_count = skge_get_sset_count,
        .get_ethtool_stats = skge_get_ethtool_stats,
-       .get_perm_addr  = ethtool_op_get_perm_addr,
 };
 
 /*
@@ -2526,7 +2531,7 @@ static int skge_up(struct net_device *dev)
        skge_write32(hw, B0_IMSK, hw->intr_mask);
        spin_unlock_irq(&hw->hw_lock);
 
-       netif_poll_enable(dev);
+       napi_enable(&skge->napi);
        return 0;
 
  free_rx_ring:
@@ -2556,7 +2561,7 @@ static int skge_down(struct net_device *dev)
        if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
                del_timer_sync(&skge->link_timer);
 
-       netif_poll_disable(dev);
+       napi_disable(&skge->napi);
        netif_carrier_off(dev);
 
        spin_lock_irq(&hw->hw_lock);
@@ -3042,14 +3047,13 @@ static void skge_tx_done(struct net_device *dev)
        }
 }
 
-static int skge_poll(struct net_device *dev, int *budget)
+static int skge_poll(struct napi_struct *napi, int to_do)
 {
-       struct skge_port *skge = netdev_priv(dev);
+       struct skge_port *skge = container_of(napi, struct skge_port, napi);
+       struct net_device *dev = skge->netdev;
        struct skge_hw *hw = skge->hw;
        struct skge_ring *ring = &skge->rx_ring;
        struct skge_element *e;
-       unsigned long flags;
-       int to_do = min(dev->quota, *budget);
        int work_done = 0;
 
        skge_tx_done(dev);
@@ -3080,20 +3084,16 @@ static int skge_poll(struct net_device *dev, int *budget)
        wmb();
        skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);
 
-       *budget -= work_done;
-       dev->quota -= work_done;
-
-       if (work_done >=  to_do)
-               return 1; /* not done */
-
-       spin_lock_irqsave(&hw->hw_lock, flags);
-       __netif_rx_complete(dev);
-       hw->intr_mask |= napimask[skge->port];
-       skge_write32(hw, B0_IMSK, hw->intr_mask);
-       skge_read32(hw, B0_IMSK);
-       spin_unlock_irqrestore(&hw->hw_lock, flags);
+       if (work_done < to_do) {
+               spin_lock_irq(&hw->hw_lock);
+               __netif_rx_complete(dev, napi);
+               hw->intr_mask |= napimask[skge->port];
+               skge_write32(hw, B0_IMSK, hw->intr_mask);
+               skge_read32(hw, B0_IMSK);
+               spin_unlock_irq(&hw->hw_lock);
+       }
 
-       return 0;
+       return work_done;
 }
 
 /* Parity errors seem to happen when Genesis is connected to a switch
@@ -3250,8 +3250,9 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
        }
 
        if (status & (IS_XA1_F|IS_R1_F)) {
+               struct skge_port *skge = netdev_priv(hw->dev[0]);
                hw->intr_mask &= ~(IS_XA1_F|IS_R1_F);
-               netif_rx_schedule(hw->dev[0]);
+               netif_rx_schedule(hw->dev[0], &skge->napi);
        }
 
        if (status & IS_PA_TO_TX1)
@@ -3269,13 +3270,14 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
                skge_mac_intr(hw, 0);
 
        if (hw->dev[1]) {
+               struct skge_port *skge = netdev_priv(hw->dev[1]);
+
                if (status & (IS_XA2_F|IS_R2_F)) {
                        hw->intr_mask &= ~(IS_XA2_F|IS_R2_F);
-                       netif_rx_schedule(hw->dev[1]);
+                       netif_rx_schedule(hw->dev[1], &skge->napi);
                }
 
                if (status & IS_PA_TO_RX2) {
-                       struct skge_port *skge = netdev_priv(hw->dev[1]);
                        ++skge->net_stats.rx_over_errors;
                        skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2);
                }
@@ -3550,7 +3552,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
                return NULL;
        }
 
-       SET_MODULE_OWNER(dev);
        SET_NETDEV_DEV(dev, &hw->pdev->dev);
        dev->open = skge_up;
        dev->stop = skge_down;
@@ -3567,8 +3568,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
        SET_ETHTOOL_OPS(dev, &skge_ethtool_ops);
        dev->tx_timeout = skge_tx_timeout;
        dev->watchdog_timeo = TX_WATCHDOG;
-       dev->poll = skge_poll;
-       dev->weight = NAPI_WEIGHT;
 #ifdef CONFIG_NET_POLL_CONTROLLER
        dev->poll_controller = skge_netpoll;
 #endif
@@ -3578,6 +3577,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
                dev->features |= NETIF_F_HIGHDMA;
 
        skge = netdev_priv(dev);
+       netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT);
        skge->netdev = dev;
        skge->hw = hw;
        skge->msg_enable = netif_msg_init(debug, default_msg);
@@ -3591,7 +3591,9 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
        skge->duplex = -1;
        skge->speed = -1;
        skge->advertising = skge_supported_modes(hw);
-       skge->wol = pci_wake_enabled(hw->pdev) ? wol_supported(hw) : 0;
+
+       if (pci_wake_enabled(hw->pdev))
+               skge->wol = wol_supported(hw) & WAKE_MAGIC;
 
        hw->dev[port] = dev;
 
@@ -3619,12 +3621,11 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
 static void __devinit skge_show_addr(struct net_device *dev)
 {
        const struct skge_port *skge = netdev_priv(dev);
+       DECLARE_MAC_BUF(mac);
 
        if (netif_msg_probe(skge))
-               printk(KERN_INFO PFX "%s: addr %02x:%02x:%02x:%02x:%02x:%02x\n",
-                      dev->name,
-                      dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
-                      dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
+               printk(KERN_INFO PFX "%s: addr %s\n",
+                      dev->name, print_mac(mac, dev->dev_addr));
 }
 
 static int __devinit skge_probe(struct pci_dev *pdev,
@@ -3797,6 +3798,9 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
        struct skge_hw *hw  = pci_get_drvdata(pdev);
        int i, err, wol = 0;
 
+       if (!hw)
+               return 0;
+
        err = pci_save_state(pdev);
        if (err)
                return err;
@@ -3825,6 +3829,9 @@ static int skge_resume(struct pci_dev *pdev)
        struct skge_hw *hw  = pci_get_drvdata(pdev);
        int i, err;
 
+       if (!hw)
+               return 0;
+
        err = pci_set_power_state(pdev, PCI_D0);
        if (err)
                goto out;
@@ -3863,6 +3870,9 @@ static void skge_shutdown(struct pci_dev *pdev)
        struct skge_hw *hw  = pci_get_drvdata(pdev);
        int i, wol = 0;
 
+       if (!hw)
+               return;
+
        for (i = 0; i < hw->ports; i++) {
                struct net_device *dev = hw->dev[i];
                struct skge_port *skge = netdev_priv(dev);