net: spread __net_init, __net_exit
[safe/jmp/linux-2.6] / drivers / net / mv643xx_eth.c
index 1361ddc..af67af5 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/types.h>
 #include <linux/inet_lro.h>
 #include <asm/system.h>
+#include <linux/list.h>
 
 static char mv643xx_eth_driver_name[] = "mv643xx_eth";
 static char mv643xx_eth_driver_version[] = "1.4";
@@ -655,6 +656,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
                struct sk_buff *skb;
                int rx;
                struct rx_desc *rx_desc;
+               int size;
 
                skb = __skb_dequeue(&mp->rx_recycle);
                if (skb == NULL)
@@ -677,10 +679,11 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
 
                rx_desc = rxq->rx_desc_area + rx;
 
+               size = skb->end - skb->data;
                rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent,
-                                                 skb->data, mp->skb_size,
+                                                 skb->data, size,
                                                  DMA_FROM_DEVICE);
-               rx_desc->buf_size = mp->skb_size;
+               rx_desc->buf_size = size;
                rxq->rx_skb[rx] = skb;
                wmb();
                rx_desc->cmd_sts = BUFFER_OWNED_BY_DMA | RX_ENABLE_INTERRUPT;
@@ -848,7 +851,7 @@ no_csum:
        return 0;
 }
 
-static int mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t mv643xx_eth_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct mv643xx_eth_private *mp = netdev_priv(dev);
        int queue;
@@ -1065,40 +1068,6 @@ static void txq_set_fixed_prio_mode(struct tx_queue *txq)
        }
 }
 
-static void txq_set_wrr(struct tx_queue *txq, int weight)
-{
-       struct mv643xx_eth_private *mp = txq_to_mp(txq);
-       int off;
-       u32 val;
-
-       /*
-        * Turn off fixed priority mode.
-        */
-       off = 0;
-       switch (mp->shared->tx_bw_control) {
-       case TX_BW_CONTROL_OLD_LAYOUT:
-               off = TXQ_FIX_PRIO_CONF;
-               break;
-       case TX_BW_CONTROL_NEW_LAYOUT:
-               off = TXQ_FIX_PRIO_CONF_MOVED;
-               break;
-       }
-
-       if (off) {
-               val = rdlp(mp, off);
-               val &= ~(1 << txq->index);
-               wrlp(mp, off, val);
-
-               /*
-                * Configure WRR weight for this queue.
-                */
-
-               val = rdlp(mp, off);
-               val = (val & ~0xff) | (weight & 0xff);
-               wrlp(mp, TXQ_BW_WRR_CONF(txq->index), val);
-       }
-}
-
 
 /* mii management interface *************************************************/
 static irqreturn_t mv643xx_eth_err_irq(int irq, void *dev_id)
@@ -1721,20 +1690,20 @@ static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *addr)
 
 static u32 uc_addr_filter_mask(struct net_device *dev)
 {
-       struct dev_addr_list *uc_ptr;
+       struct netdev_hw_addr *ha;
        u32 nibbles;
 
        if (dev->flags & IFF_PROMISC)
                return 0;
 
        nibbles = 1 << (dev->dev_addr[5] & 0x0f);
-       for (uc_ptr = dev->uc_list; uc_ptr != NULL; uc_ptr = uc_ptr->next) {
-               if (memcmp(dev->dev_addr, uc_ptr->da_addr, 5))
+       list_for_each_entry(ha, &dev->uc.list, list) {
+               if (memcmp(dev->dev_addr, ha->addr, 5))
                        return 0;
-               if ((dev->dev_addr[5] ^ uc_ptr->da_addr[5]) & 0xf0)
+               if ((dev->dev_addr[5] ^ ha->addr[5]) & 0xf0)
                        return 0;
 
-               nibbles |= 1 << (uc_ptr->da_addr[5] & 0x0f);
+               nibbles |= 1 << (ha->addr[5] & 0x0f);
        }
 
        return nibbles;
@@ -1749,12 +1718,12 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
 
        uc_addr_set(mp, dev->dev_addr);
 
-       port_config = rdlp(mp, PORT_CONFIG);
+       port_config = rdlp(mp, PORT_CONFIG) & ~UNICAST_PROMISCUOUS_MODE;
+
        nibbles = uc_addr_filter_mask(dev);
        if (!nibbles) {
                port_config |= UNICAST_PROMISCUOUS_MODE;
-               wrlp(mp, PORT_CONFIG, port_config);
-               return;
+               nibbles = 0xffff;
        }
 
        for (i = 0; i < 16; i += 4) {
@@ -1775,7 +1744,6 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
                wrl(mp, off, v);
        }
 
-       port_config &= ~UNICAST_PROMISCUOUS_MODE;
        wrlp(mp, PORT_CONFIG, port_config);
 }
 
@@ -1861,6 +1829,9 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
 {
        struct sockaddr *sa = addr;
 
+       if (!is_valid_ether_addr(sa->sa_data))
+               return -EINVAL;
+
        memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
 
        netif_addr_lock_bh(dev);