]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/ns83820.c
netxen: hold tx lock while sending firmware commands
[linux-2.6-omap-h63xx.git] / drivers / net / ns83820.c
index b42c05f84be15d78d59600362f7e8f8f5e0837d0..e80294d8cc19e48fc5c230d2d78b50159235110f 100644 (file)
@@ -585,16 +585,13 @@ static inline int rx_refill(struct net_device *ndev, gfp_t gfp)
        for (i=0; i<NR_RX_DESC; i++) {
                struct sk_buff *skb;
                long res;
+
                /* extra 16 bytes for alignment */
-               skb = __dev_alloc_skb(REAL_RX_BUF_SIZE+16, gfp);
+               skb = __netdev_alloc_skb(ndev, REAL_RX_BUF_SIZE+16, gfp);
                if (unlikely(!skb))
                        break;
 
-               res = (long)skb->data & 0xf;
-               res = 0x10 - res;
-               res &= 0xf;
-               skb_reserve(skb, res);
-
+               skb_reserve(skb, skb->data - PTR_ALIGN(skb->data, 16));
                if (gfp != GFP_ATOMIC)
                        spin_lock_irqsave(&dev->rx_info.lock, flags);
                res = ns83820_add_rx_skb(dev, skb);
@@ -1951,14 +1948,29 @@ static void ns83820_probe_phy(struct net_device *ndev)
 }
 #endif
 
-static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_device_id *id)
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = ns83820_open,
+       .ndo_stop               = ns83820_stop,
+       .ndo_start_xmit         = ns83820_hard_start_xmit,
+       .ndo_get_stats          = ns83820_get_stats,
+       .ndo_change_mtu         = ns83820_change_mtu,
+       .ndo_set_multicast_list = ns83820_set_multicast,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_tx_timeout         = ns83820_tx_timeout,
+#ifdef NS83820_VLAN_ACCEL_SUPPORT
+       .ndo_vlan_rx_register   = ns83820_vlan_rx_register,
+#endif
+};
+
+static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
+                                     const struct pci_device_id *id)
 {
        struct net_device *ndev;
        struct ns83820 *dev;
        long addr;
        int err;
        int using_dac = 0;
-       DECLARE_MAC_BUF(mac);
 
        /* See if we can set the dma mask early on; failure is fatal. */
        if (sizeof(dma_addr_t) == 8 &&
@@ -2044,14 +2056,8 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
                ndev->name, le32_to_cpu(readl(dev->base + 0x22c)),
                pci_dev->subsystem_vendor, pci_dev->subsystem_device);
 
-       ndev->open = ns83820_open;
-       ndev->stop = ns83820_stop;
-       ndev->hard_start_xmit = ns83820_hard_start_xmit;
-       ndev->get_stats = ns83820_get_stats;
-       ndev->change_mtu = ns83820_change_mtu;
-       ndev->set_multicast_list = ns83820_set_multicast;
+       ndev->netdev_ops = &netdev_ops;
        SET_ETHTOOL_OPS(ndev, &ops);
-       ndev->tx_timeout = ns83820_tx_timeout;
        ndev->watchdog_timeo = 5 * HZ;
        pci_set_drvdata(pci_dev, ndev);
 
@@ -2214,7 +2220,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
 #ifdef NS83820_VLAN_ACCEL_SUPPORT
        /* We also support hardware vlan acceleration */
        ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-       ndev->vlan_rx_register = ns83820_vlan_rx_register;
 #endif
 
        if (using_dac) {
@@ -2223,12 +2228,11 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
                ndev->features |= NETIF_F_HIGHDMA;
        }
 
-       printk(KERN_INFO "%s: ns83820 v" VERSION ": DP83820 v%u.%u: %s io=0x%08lx irq=%d f=%s\n",
+       printk(KERN_INFO "%s: ns83820 v" VERSION ": DP83820 v%u.%u: %pM io=0x%08lx irq=%d f=%s\n",
                ndev->name,
                (unsigned)readl(dev->base + SRR) >> 8,
                (unsigned)readl(dev->base + SRR) & 0xff,
-               print_mac(mac, ndev->dev_addr),
-               addr, pci_dev->irq,
+               ndev->dev_addr, addr, pci_dev->irq,
                (ndev->features & NETIF_F_HIGHDMA) ? "h,sg" : "sg"
                );