net: wireless: bcmdhd: Fix filtering setting in case of P2P
[linux-2.6.git] / drivers / net / acenic.c
index 4ae750e..31798f5 100644 (file)
 #include <linux/highmem.h>
 #include <linux/sockios.h>
 #include <linux/firmware.h>
-
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#include <linux/slab.h>
+#include <linux/prefetch.h>
 #include <linux/if_vlan.h>
-#endif
 
 #ifdef SIOCETHTOOL
 #include <linux/ethtool.h>
@@ -169,15 +168,6 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
 #define BOARD_IDX_STATIC       0
 #define BOARD_IDX_OVERFLOW     -1
 
-#if (defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)) && \
-       defined(NETIF_F_HW_VLAN_RX)
-#define ACENIC_DO_VLAN         1
-#define ACE_RCB_VLAN_FLAG      RCB_FLG_VLAN_ASSIST
-#else
-#define ACENIC_DO_VLAN         0
-#define ACE_RCB_VLAN_FLAG      0
-#endif
-
 #include "acenic.h"
 
 /*
@@ -463,9 +453,6 @@ static const struct net_device_ops ace_netdev_ops = {
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_set_mac_address    = ace_set_mac_addr,
        .ndo_change_mtu         = ace_change_mtu,
-#if ACENIC_DO_VLAN
-       .ndo_vlan_rx_register   = ace_vlan_rx_register,
-#endif
 };
 
 static int __devinit acenic_probe_one(struct pci_dev *pdev,
@@ -489,9 +476,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,
        ap->name = pci_name(pdev);
 
        dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
-#if ACENIC_DO_VLAN
        dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-#endif
 
        dev->watchdog_timeo = 5*HZ;
 
@@ -660,7 +645,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                        dma_addr_t mapping;
 
                        ringp = &ap->skb->rx_std_skbuff[i];
-                       mapping = pci_unmap_addr(ringp, mapping);
+                       mapping = dma_unmap_addr(ringp, mapping);
                        pci_unmap_page(ap->pdev, mapping,
                                       ACE_STD_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
@@ -680,7 +665,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                                dma_addr_t mapping;
 
                                ringp = &ap->skb->rx_mini_skbuff[i];
-                               mapping = pci_unmap_addr(ringp,mapping);
+                               mapping = dma_unmap_addr(ringp,mapping);
                                pci_unmap_page(ap->pdev, mapping,
                                               ACE_MINI_BUFSIZE,
                                               PCI_DMA_FROMDEVICE);
@@ -699,7 +684,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                        dma_addr_t mapping;
 
                        ringp = &ap->skb->rx_jumbo_skbuff[i];
-                       mapping = pci_unmap_addr(ringp, mapping);
+                       mapping = dma_unmap_addr(ringp, mapping);
                        pci_unmap_page(ap->pdev, mapping,
                                       ACE_JUMBO_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
@@ -1246,7 +1231,7 @@ static int __devinit ace_init(struct net_device *dev)
        set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma);
        info->rx_std_ctrl.max_len = ACE_STD_BUFSIZE;
        info->rx_std_ctrl.flags =
-         RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
+         RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST;
 
        memset(ap->rx_std_ring, 0,
               RX_STD_RING_ENTRIES * sizeof(struct rx_desc));
@@ -1262,7 +1247,7 @@ static int __devinit ace_init(struct net_device *dev)
                     (sizeof(struct rx_desc) * RX_STD_RING_ENTRIES)));
        info->rx_jumbo_ctrl.max_len = 0;
        info->rx_jumbo_ctrl.flags =
-         RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
+         RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST;
 
        memset(ap->rx_jumbo_ring, 0,
               RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc));
@@ -1284,7 +1269,7 @@ static int __devinit ace_init(struct net_device *dev)
                               RX_JUMBO_RING_ENTRIES))));
                info->rx_mini_ctrl.max_len = ACE_MINI_SIZE;
                info->rx_mini_ctrl.flags =
-                 RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG;
+                 RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|RCB_FLG_VLAN_ASSIST;
 
                for (i = 0; i < RX_MINI_RING_ENTRIES; i++)
                        ap->rx_mini_ring[i].flags =
@@ -1330,7 +1315,7 @@ static int __devinit ace_init(struct net_device *dev)
        }
 
        info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap);
-       tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
+       tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST;
 
        /*
         * The Tigon I does not like having the TX ring in host memory ;-(
@@ -1517,13 +1502,13 @@ static int __devinit ace_init(struct net_device *dev)
         * firmware to wipe the ring without re-initializing it.
         */
        if (!test_and_set_bit(0, &ap->std_refill_busy))
-               ace_load_std_rx_ring(ap, RX_RING_SIZE);
+               ace_load_std_rx_ring(dev, RX_RING_SIZE);
        else
                printk(KERN_ERR "%s: Someone is busy refilling the RX ring\n",
                       ap->name);
        if (ap->version >= 2) {
                if (!test_and_set_bit(0, &ap->mini_refill_busy))
-                       ace_load_mini_rx_ring(ap, RX_MINI_SIZE);
+                       ace_load_mini_rx_ring(dev, RX_MINI_SIZE);
                else
                        printk(KERN_ERR "%s: Someone is busy refilling "
                               "the RX mini ring\n", ap->name);
@@ -1583,7 +1568,7 @@ static void ace_watchdog(struct net_device *data)
        /*
         * We haven't received a stats update event for more than 2.5
         * seconds and there is data in the transmit queue, thus we
-        * asume the card is stuck.
+        * assume the card is stuck.
         */
        if (*ap->tx_csm != ap->tx_ret_csm) {
                printk(KERN_WARNING "%s: Transmitter is stuck, %08x\n",
@@ -1599,9 +1584,10 @@ static void ace_watchdog(struct net_device *data)
 }
 
 
-static void ace_tasklet(unsigned long dev)
+static void ace_tasklet(unsigned long arg)
 {
-       struct ace_private *ap = netdev_priv((struct net_device *)dev);
+       struct net_device *dev = (struct net_device *) arg;
+       struct ace_private *ap = netdev_priv(dev);
        int cur_size;
 
        cur_size = atomic_read(&ap->cur_rx_bufs);
@@ -1610,7 +1596,7 @@ static void ace_tasklet(unsigned long dev)
 #ifdef DEBUG
                printk("refilling buffers (current %i)\n", cur_size);
 #endif
-               ace_load_std_rx_ring(ap, RX_RING_SIZE - cur_size);
+               ace_load_std_rx_ring(dev, RX_RING_SIZE - cur_size);
        }
 
        if (ap->version >= 2) {
@@ -1621,7 +1607,7 @@ static void ace_tasklet(unsigned long dev)
                        printk("refilling mini buffers (current %i)\n",
                               cur_size);
 #endif
-                       ace_load_mini_rx_ring(ap, RX_MINI_SIZE - cur_size);
+                       ace_load_mini_rx_ring(dev, RX_MINI_SIZE - cur_size);
                }
        }
 
@@ -1631,7 +1617,7 @@ static void ace_tasklet(unsigned long dev)
 #ifdef DEBUG
                printk("refilling jumbo buffers (current %i)\n", cur_size);
 #endif
-               ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE - cur_size);
+               ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE - cur_size);
        }
        ap->tasklet_pending = 0;
 }
@@ -1657,8 +1643,9 @@ static void ace_dump_trace(struct ace_private *ap)
  * done only before the device is enabled, thus no interrupts are
  * generated and by the interrupt handler/tasklet handler.
  */
-static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
+static void ace_load_std_rx_ring(struct net_device *dev, int nr_bufs)
 {
+       struct ace_private *ap = netdev_priv(dev);
        struct ace_regs __iomem *regs = ap->regs;
        short i, idx;
 
@@ -1672,17 +1659,16 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_STD_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
+               skb = netdev_alloc_skb_ip_align(dev, ACE_STD_BUFSIZE);
                if (!skb)
                        break;
 
-               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
                                       ACE_STD_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_std_skbuff[idx].skb = skb;
-               pci_unmap_addr_set(&ap->skb->rx_std_skbuff[idx],
+               dma_unmap_addr_set(&ap->skb->rx_std_skbuff[idx],
                                   mapping, mapping);
 
                rd = &ap->rx_std_ring[idx];
@@ -1720,8 +1706,9 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
 }
 
 
-static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
+static void ace_load_mini_rx_ring(struct net_device *dev, int nr_bufs)
 {
+       struct ace_private *ap = netdev_priv(dev);
        struct ace_regs __iomem *regs = ap->regs;
        short i, idx;
 
@@ -1733,17 +1720,16 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_MINI_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
+               skb = netdev_alloc_skb_ip_align(dev, ACE_MINI_BUFSIZE);
                if (!skb)
                        break;
 
-               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
                                       ACE_MINI_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_mini_skbuff[idx].skb = skb;
-               pci_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
+               dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
                                   mapping, mapping);
 
                rd = &ap->rx_mini_ring[idx];
@@ -1777,8 +1763,9 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
  * Load the jumbo rx ring, this may happen at any time if the MTU
  * is changed to a value > 1500.
  */
-static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
+static void ace_load_jumbo_rx_ring(struct net_device *dev, int nr_bufs)
 {
+       struct ace_private *ap = netdev_priv(dev);
        struct ace_regs __iomem *regs = ap->regs;
        short i, idx;
 
@@ -1789,17 +1776,16 @@ static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_JUMBO_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
+               skb = netdev_alloc_skb_ip_align(dev, ACE_JUMBO_BUFSIZE);
                if (!skb)
                        break;
 
-               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
                                       ACE_JUMBO_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_jumbo_skbuff[idx].skb = skb;
-               pci_unmap_addr_set(&ap->skb->rx_jumbo_skbuff[idx],
+               dma_unmap_addr_set(&ap->skb->rx_jumbo_skbuff[idx],
                                   mapping, mapping);
 
                rd = &ap->rx_jumbo_ring[idx];
@@ -2012,7 +1998,7 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
                skb = rip->skb;
                rip->skb = NULL;
                pci_unmap_page(ap->pdev,
-                              pci_unmap_addr(rip, mapping),
+                              dma_unmap_addr(rip, mapping),
                               mapsize,
                               PCI_DMA_FROMDEVICE);
                skb_put(skb, retdesc->size);
@@ -2032,16 +2018,13 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
                        skb->csum = htons(csum);
                        skb->ip_summed = CHECKSUM_COMPLETE;
                } else {
-                       skb->ip_summed = CHECKSUM_NONE;
+                       skb_checksum_none_assert(skb);
                }
 
                /* send it up */
-#if ACENIC_DO_VLAN
-               if (ap->vlgrp && (bd_flags & BD_FLG_VLAN_TAG)) {
-                       vlan_hwaccel_rx(skb, ap->vlgrp, retdesc->vlan);
-               } else
-#endif
-                       netif_rx(skb);
+               if ((bd_flags & BD_FLG_VLAN_TAG))
+                       __vlan_hwaccel_put_tag(skb, retdesc->vlan);
+               netif_rx(skb);
 
                dev->stats.rx_packets++;
                dev->stats.rx_bytes += retdesc->size;
@@ -2077,18 +2060,16 @@ static inline void ace_tx_int(struct net_device *dev,
 
        do {
                struct sk_buff *skb;
-               dma_addr_t mapping;
                struct tx_ring_info *info;
 
                info = ap->skb->tx_skbuff + idx;
                skb = info->skb;
-               mapping = pci_unmap_addr(info, mapping);
 
-               if (mapping) {
-                       pci_unmap_page(ap->pdev, mapping,
-                                      pci_unmap_len(info, maplen),
+               if (dma_unmap_len(info, maplen)) {
+                       pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping),
+                                      dma_unmap_len(info, maplen),
                                       PCI_DMA_TODEVICE);
-                       pci_unmap_addr_set(info, mapping, 0);
+                       dma_unmap_len_set(info, maplen, 0);
                }
 
                if (skb) {
@@ -2216,7 +2197,7 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
 #ifdef DEBUG
                                printk("low on std buffers %i\n", cur_size);
 #endif
-                               ace_load_std_rx_ring(ap,
+                               ace_load_std_rx_ring(dev,
                                                     RX_RING_SIZE - cur_size);
                        } else
                                run_tasklet = 1;
@@ -2232,7 +2213,8 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
                                        printk("low on mini buffers %i\n",
                                               cur_size);
 #endif
-                                       ace_load_mini_rx_ring(ap, RX_MINI_SIZE - cur_size);
+                                       ace_load_mini_rx_ring(dev,
+                                                             RX_MINI_SIZE - cur_size);
                                } else
                                        run_tasklet = 1;
                        }
@@ -2248,7 +2230,8 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
                                        printk("low on jumbo buffers %i\n",
                                               cur_size);
 #endif
-                                       ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE - cur_size);
+                                       ace_load_jumbo_rx_ring(dev,
+                                                              RX_JUMBO_SIZE - cur_size);
                                } else
                                        run_tasklet = 1;
                        }
@@ -2262,24 +2245,6 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-
-#if ACENIC_DO_VLAN
-static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
-{
-       struct ace_private *ap = netdev_priv(dev);
-       unsigned long flags;
-
-       local_irq_save(flags);
-       ace_mask_irq(dev);
-
-       ap->vlgrp = grp;
-
-       ace_unmask_irq(dev);
-       local_irq_restore(flags);
-}
-#endif /* ACENIC_DO_VLAN */
-
-
 static int ace_open(struct net_device *dev)
 {
        struct ace_private *ap = netdev_priv(dev);
@@ -2305,7 +2270,7 @@ static int ace_open(struct net_device *dev)
 
        if (ap->jumbo &&
            !test_and_set_bit(0, &ap->jumbo_refill_busy))
-               ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE);
+               ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE);
 
        if (dev->flags & IFF_PROMISC) {
                cmd.evt = C_SET_PROMISC_MODE;
@@ -2376,14 +2341,12 @@ static int ace_close(struct net_device *dev)
 
        for (i = 0; i < ACE_TX_RING_ENTRIES(ap); i++) {
                struct sk_buff *skb;
-               dma_addr_t mapping;
                struct tx_ring_info *info;
 
                info = ap->skb->tx_skbuff + i;
                skb = info->skb;
-               mapping = pci_unmap_addr(info, mapping);
 
-               if (mapping) {
+               if (dma_unmap_len(info, maplen)) {
                        if (ACE_IS_TIGON_I(ap)) {
                                /* NB: TIGON_1 is special, tx_ring is in io space */
                                struct tx_desc __iomem *tx;
@@ -2394,10 +2357,10 @@ static int ace_close(struct net_device *dev)
                        } else
                                memset(ap->tx_ring + i, 0,
                                       sizeof(struct tx_desc));
-                       pci_unmap_page(ap->pdev, mapping,
-                                      pci_unmap_len(info, maplen),
+                       pci_unmap_page(ap->pdev, dma_unmap_addr(info, mapping),
+                                      dma_unmap_len(info, maplen),
                                       PCI_DMA_TODEVICE);
-                       pci_unmap_addr_set(info, mapping, 0);
+                       dma_unmap_len_set(info, maplen, 0);
                }
                if (skb) {
                        dev_kfree_skb(skb);
@@ -2432,8 +2395,8 @@ ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb,
 
        info = ap->skb->tx_skbuff + idx;
        info->skb = tail;
-       pci_unmap_addr_set(info, mapping, mapping);
-       pci_unmap_len_set(info, maplen, skb->len);
+       dma_unmap_addr_set(info, mapping, mapping);
+       dma_unmap_len_set(info, maplen, skb->len);
        return mapping;
 }
 
@@ -2451,16 +2414,12 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr,
                writel(addr >> 32, &io->addr.addrhi);
                writel(addr & 0xffffffff, &io->addr.addrlo);
                writel(flagsize, &io->flagsize);
-#if ACENIC_DO_VLAN
                writel(vlan_tag, &io->vlanres);
-#endif
        } else {
                desc->addr.addrhi = addr >> 32;
                desc->addr.addrlo = addr;
                desc->flagsize = flagsize;
-#if ACENIC_DO_VLAN
                desc->vlanres = vlan_tag;
-#endif
        }
 }
 
@@ -2488,12 +2447,10 @@ restart:
                flagsize = (skb->len << 16) | (BD_FLG_END);
                if (skb->ip_summed == CHECKSUM_PARTIAL)
                        flagsize |= BD_FLG_TCP_UDP_SUM;
-#if ACENIC_DO_VLAN
                if (vlan_tx_tag_present(skb)) {
                        flagsize |= BD_FLG_VLAN_TAG;
                        vlan_tag = vlan_tx_tag_get(skb);
                }
-#endif
                desc = ap->tx_ring + idx;
                idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap);
 
@@ -2511,12 +2468,10 @@ restart:
                flagsize = (skb_headlen(skb) << 16);
                if (skb->ip_summed == CHECKSUM_PARTIAL)
                        flagsize |= BD_FLG_TCP_UDP_SUM;
-#if ACENIC_DO_VLAN
                if (vlan_tx_tag_present(skb)) {
                        flagsize |= BD_FLG_VLAN_TAG;
                        vlan_tag = vlan_tx_tag_get(skb);
                }
-#endif
 
                ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag);
 
@@ -2552,8 +2507,8 @@ restart:
                        } else {
                                info->skb = NULL;
                        }
-                       pci_unmap_addr_set(info, mapping, mapping);
-                       pci_unmap_len_set(info, maplen, frag->size);
+                       dma_unmap_addr_set(info, mapping, mapping);
+                       dma_unmap_len_set(info, maplen, frag->size);
                        ace_load_tx_bd(ap, desc, mapping, flagsize, vlan_tag);
                }
        }
@@ -2567,7 +2522,7 @@ restart:
 
                /*
                 * A TX-descriptor producer (an IRQ) might have gotten
-                * inbetween, making the ring free again. Since xmit is
+                * between, making the ring free again. Since xmit is
                 * serialized, this is the only situation we have to
                 * re-test.
                 */
@@ -2623,7 +2578,7 @@ static int ace_change_mtu(struct net_device *dev, int new_mtu)
                               "support\n", dev->name);
                        ap->jumbo = 1;
                        if (!test_and_set_bit(0, &ap->jumbo_refill_busy))
-                               ace_load_jumbo_rx_ring(ap, RX_JUMBO_SIZE);
+                               ace_load_jumbo_rx_ring(dev, RX_JUMBO_SIZE);
                        ace_set_rxtx_parms(dev, 1);
                }
        } else {
@@ -2661,15 +2616,15 @@ static int ace_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 
        link = readl(&regs->GigLnkState);
        if (link & LNK_1000MB)
-               ecmd->speed = SPEED_1000;
+               ethtool_cmd_speed_set(ecmd, SPEED_1000);
        else {
                link = readl(&regs->FastLnkState);
                if (link & LNK_100MB)
-                       ecmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(ecmd, SPEED_100);
                else if (link & LNK_10MB)
-                       ecmd->speed = SPEED_10;
+                       ethtool_cmd_speed_set(ecmd, SPEED_10);
                else
-                       ecmd->speed = 0;
+                       ethtool_cmd_speed_set(ecmd, 0);
        }
        if (link & LNK_FULL_DUPLEX)
                ecmd->duplex = DUPLEX_FULL;
@@ -2721,9 +2676,9 @@ static int ace_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                link |= LNK_TX_FLOW_CTL_Y;
        if (ecmd->autoneg == AUTONEG_ENABLE)
                link |= LNK_NEGOTIATE;
-       if (ecmd->speed != speed) {
+       if (ethtool_cmd_speed(ecmd) != speed) {
                link &= ~(LNK_1000MB | LNK_100MB | LNK_10MB);
-               switch (speed) {
+               switch (ethtool_cmd_speed(ecmd)) {
                case SPEED_1000:
                        link |= LNK_1000MB;
                        break;
@@ -2922,8 +2877,6 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz
                dest += tsize;
                size -= tsize;
        }
-
-       return;
 }