net: usb: raw-ip: support more rmnet interfaces
[linux-2.6.git] / drivers / net / dl2k.c
index 2a8b6a7..ed73e4a 100644 (file)
@@ -221,13 +221,13 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
        ring_space = pci_alloc_consistent (pdev, TX_TOTAL_SIZE, &ring_dma);
        if (!ring_space)
                goto err_out_iounmap;
-       np->tx_ring = (struct netdev_desc *) ring_space;
+       np->tx_ring = ring_space;
        np->tx_ring_dma = ring_dma;
 
        ring_space = pci_alloc_consistent (pdev, RX_TOTAL_SIZE, &ring_dma);
        if (!ring_space)
                goto err_out_unmap_tx;
-       np->rx_ring = (struct netdev_desc *) ring_space;
+       np->rx_ring = ring_space;
        np->rx_ring_dma = ring_dma;
 
        /* Parse eeprom data */
@@ -346,7 +346,7 @@ parse_eeprom (struct net_device *dev)
        if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) {  /* D-Link Only */
                /* Check CRC */
                crc = ~ether_crc_le (256 - 4, sromdata);
-               if (psrom->crc != crc) {
+               if (psrom->crc != cpu_to_le32(crc)) {
                        printk (KERN_ERR "%s: EEPROM data CRC error.\n",
                                        dev->name);
                        return -1;
@@ -465,7 +465,7 @@ rio_open (struct net_device *dev)
        init_timer (&np->timer);
        np->timer.expires = jiffies + 1*HZ;
        np->timer.data = (unsigned long) dev;
-       np->timer.function = &rio_timer;
+       np->timer.function = rio_timer;
        add_timer (&np->timer);
 
        /* Start Tx/Rx */
@@ -596,8 +596,6 @@ alloc_list (struct net_device *dev)
        /* Set RFDListPtr */
        writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
        writel (0, dev->base_addr + RFDListPtr1);
-
-       return;
 }
 
 static netdev_tx_t
@@ -1128,21 +1126,18 @@ set_multicast (struct net_device *dev)
                /* Receive all frames promiscuously. */
                rx_mode = ReceiveAllFrames;
        } else if ((dev->flags & IFF_ALLMULTI) ||
-                       (dev->mc_count > multicast_filter_limit)) {
+                       (netdev_mc_count(dev) > multicast_filter_limit)) {
                /* Receive broadcast and multicast frames */
                rx_mode = ReceiveBroadcast | ReceiveMulticast | ReceiveUnicast;
-       } else if (dev->mc_count > 0) {
-               int i;
-               struct dev_mc_list *mclist;
+       } else if (!netdev_mc_empty(dev)) {
+               struct netdev_hw_addr *ha;
                /* Receive broadcast frames and multicast frames filtering
                   by Hashtable */
                rx_mode =
                    ReceiveBroadcast | ReceiveMulticastHash | ReceiveUnicast;
-               for (i=0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-                               i++, mclist=mclist->next)
-               {
+               netdev_for_each_mc_addr(ha, dev) {
                        int bit, index = 0;
-                       int crc = ether_crc_le (ETH_ALEN, mclist->dmi_addr);
+                       int crc = ether_crc_le(ETH_ALEN, ha->addr);
                        /* The inverted high significant 6 bits of CRC are
                           used as an index to hashtable */
                        for (bit = 0; bit < 6; bit++)
@@ -1194,10 +1189,10 @@ static int rio_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                cmd->transceiver = XCVR_INTERNAL;
        }
        if ( np->link_status ) {
-               cmd->speed = np->speed;
+               ethtool_cmd_speed_set(cmd, np->speed);
                cmd->duplex = np->full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
        } else {
-               cmd->speed = -1;
+               ethtool_cmd_speed_set(cmd, -1);
                cmd->duplex = -1;
        }
        if ( np->an_enable)
@@ -1224,31 +1219,20 @@ static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        } else {
                np->an_enable = 0;
                if (np->speed == 1000) {
-                       cmd->speed = SPEED_100;
+                       ethtool_cmd_speed_set(cmd, SPEED_100);
                        cmd->duplex = DUPLEX_FULL;
                        printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
                }
-               switch(cmd->speed + cmd->duplex) {
-
-               case SPEED_10 + DUPLEX_HALF:
-                       np->speed = 10;
-                       np->full_duplex = 0;
-                       break;
-
-               case SPEED_10 + DUPLEX_FULL:
+               switch (ethtool_cmd_speed(cmd)) {
+               case SPEED_10:
                        np->speed = 10;
-                       np->full_duplex = 1;
+                       np->full_duplex = (cmd->duplex == DUPLEX_FULL);
                        break;
-               case SPEED_100 + DUPLEX_HALF:
+               case SPEED_100:
                        np->speed = 100;
-                       np->full_duplex = 0;
+                       np->full_duplex = (cmd->duplex == DUPLEX_FULL);
                        break;
-               case SPEED_100 + DUPLEX_FULL:
-                       np->speed = 100;
-                       np->full_duplex = 1;
-                       break;
-               case SPEED_1000 + DUPLEX_HALF:/* not supported */
-               case SPEED_1000 + DUPLEX_FULL:/* not supported */
+               case SPEED_1000: /* not supported */
                default:
                        return -EINVAL;
                }
@@ -1758,8 +1742,6 @@ rio_close (struct net_device *dev)
 
        /* Free all the skbuffs in the queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
-               np->rx_ring[i].status = 0;
-               np->rx_ring[i].fraginfo = 0;
                skb = np->rx_skbuff[i];
                if (skb) {
                        pci_unmap_single(np->pdev,
@@ -1768,6 +1750,8 @@ rio_close (struct net_device *dev)
                        dev_kfree_skb (skb);
                        np->rx_skbuff[i] = NULL;
                }
+               np->rx_ring[i].status = 0;
+               np->rx_ring[i].fraginfo = 0;
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                skb = np->tx_skbuff[i];