i2c: Document the message size limit
[safe/jmp/linux-2.6] / drivers / net / lib82596.c
index 7415f51..b117f7f 100644 (file)
@@ -47,7 +47,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
@@ -470,11 +470,11 @@ static inline int init_rx_bufs(struct net_device *dev)
 
        for (i = 0, rbd = dma->rbds; i < rx_ring_size; i++, rbd++) {
                dma_addr_t dma_addr;
-               struct sk_buff *skb = netdev_alloc_skb(dev, PKT_BUF_SZ + 4);
+               struct sk_buff *skb;
 
+               skb = netdev_alloc_skb_ip_align(dev, PKT_BUF_SZ);
                if (skb == NULL)
                        return -1;
-               skb_reserve(skb, 2);
                dma_addr = dma_map_single(dev->dev.parent, skb->data,
                                          PKT_BUF_SZ, DMA_FROM_DEVICE);
                rbd->v_next = rbd+1;
@@ -588,7 +588,7 @@ static int init_i596_mem(struct net_device *dev)
                             "%s: i82596 initialization successful\n",
                             dev->name));
 
-       if (request_irq(dev->irq, &i596_interrupt, 0, "i82596", dev)) {
+       if (request_irq(dev->irq, i596_interrupt, 0, "i82596", dev)) {
                printk(KERN_ERR "%s: IRQ %d not free\n", dev->name, dev->irq);
                goto failed;
        }
@@ -697,12 +697,12 @@ static inline int i596_rx(struct net_device *dev)
                                                 (dma_addr_t)SWAP32(rbd->b_data),
                                                 PKT_BUF_SZ, DMA_FROM_DEVICE);
                                /* Get fresh skbuff to replace filled one. */
-                               newskb = netdev_alloc_skb(dev, PKT_BUF_SZ + 4);
+                               newskb = netdev_alloc_skb_ip_align(dev,
+                                                                  PKT_BUF_SZ);
                                if (newskb == NULL) {
                                        skb = NULL;     /* drop pkt */
                                        goto memory_squeeze;
                                }
-                               skb_reserve(newskb, 2);
 
                                /* Pass up the skb already on the Rx ring. */
                                skb_put(skb, pkt_len);
@@ -716,7 +716,7 @@ static inline int i596_rx(struct net_device *dev)
                                rbd->b_data = SWAP32(dma_addr);
                                DMA_WBACK_INV(dev, rbd, sizeof(struct i596_rbd));
                        } else
-                               skb = netdev_alloc_skb(dev, pkt_len + 2);
+                               skb = netdev_alloc_skb_ip_align(dev, pkt_len);
 memory_squeeze:
                        if (skb == NULL) {
                                /* XXX tulip.c can defer packets here!! */
@@ -730,7 +730,6 @@ memory_squeeze:
                                        dma_sync_single_for_cpu(dev->dev.parent,
                                                                (dma_addr_t)SWAP32(rbd->b_data),
                                                                PKT_BUF_SZ, DMA_FROM_DEVICE);
-                                       skb_reserve(skb, 2);
                                        memcpy(skb_put(skb, pkt_len), rbd->v_data, pkt_len);
                                        dma_sync_single_for_device(dev->dev.parent,
                                                                   (dma_addr_t)SWAP32(rbd->b_data),
@@ -983,7 +982,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        if (length < ETH_ZLEN) {
                if (skb_padto(skb, ETH_ZLEN))
-                       return 0;
+                       return NETDEV_TX_OK;
                length = ETH_ZLEN;
        }
 
@@ -1028,7 +1027,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        netif_start_queue(dev);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static void print_eth(unsigned char *add, char *str)
@@ -1036,6 +1035,19 @@ static void print_eth(unsigned char *add, char *str)
        printk(KERN_DEBUG "i596 0x%p, %pM --> %pM %02X%02X, %s\n",
               add, add + 6, add, add[12], add[13], str);
 }
+static const struct net_device_ops i596_netdev_ops = {
+       .ndo_open               = i596_open,
+       .ndo_stop               = i596_close,
+       .ndo_start_xmit         = i596_start_xmit,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_tx_timeout         = i596_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = i596_poll_controller,
+#endif
+};
 
 static int __devinit i82596_probe(struct net_device *dev)
 {
@@ -1062,16 +1074,8 @@ static int __devinit i82596_probe(struct net_device *dev)
                return -ENOMEM;
        }
 
-       /* The 82596-specific entries in the device structure. */
-       dev->open = i596_open;
-       dev->stop = i596_close;
-       dev->hard_start_xmit = i596_start_xmit;
-       dev->set_multicast_list = set_multicast_list;
-       dev->tx_timeout = i596_tx_timeout;
+       dev->netdev_ops = &i596_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = i596_poll_controller;
-#endif
 
        memset(dma, 0, sizeof(struct i596_dma));
        lp->dma = dma;