64 bit kernel
[linux-2.6.git] / drivers / net / 8390.c
index e3053a8..f870274 100644 (file)
@@ -43,6 +43,7 @@
   Paul Gortmaker       : Separate out Tx timeout code from Tx path.
   Paul Gortmaker       : Remove old unused single Tx buffer code.
   Hayato Fujiwara      : Add m32r support.
+  Paul Gortmaker       : use skb_padto() instead of stack scratch area
 
   Sources:
   The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
@@ -224,9 +225,9 @@ void ei_tx_timeout(struct net_device *dev)
        unsigned long icucr;
 
        local_irq_save(flags);
-       icucr = inl(ICUCR1);
+       icucr = inl(M32R_ICU_CR1_PORTL);
        icucr |= M32R_ICUCR_ISMOD11;
-       outl(icucr, ICUCR1);
+       outl(icucr, M32R_ICU_CR1_PORTL);
        local_irq_restore(flags);
 #endif
        ei_local->stat.tx_errors++;
@@ -272,11 +273,15 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
        struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
-       int length, send_length, output_page;
+       int send_length = skb->len, output_page;
        unsigned long flags;
-       char scratch[ETH_ZLEN];
 
-       length = skb->len;
+       if (skb->len < ETH_ZLEN) {
+               skb = skb_padto(skb, ETH_ZLEN);
+               if (skb == NULL)
+                       return 0;
+               send_length = ETH_ZLEN;
+       }
 
        /* Mask interrupts from the ethercard. 
           SMP: We have to grab the lock here otherwise the IRQ handler
@@ -298,8 +303,6 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
        
        ei_local->irqlock = 1;
 
-       send_length = ETH_ZLEN < length ? length : ETH_ZLEN;
-    
        /*
         * We have two Tx slots available for use. Find the first free
         * slot, and then perform some sanity checks. With two Tx bufs,
@@ -344,13 +347,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
         * trigger the send later, upon receiving a Tx done interrupt.
         */
         
-       if (length == send_length)
-               ei_block_output(dev, length, skb->data, output_page);
-       else {
-               memset(scratch, 0, ETH_ZLEN);
-               memcpy(scratch, skb->data, skb->len);
-               ei_block_output(dev, ETH_ZLEN, scratch, output_page);
-       }
+       ei_block_output(dev, send_length, skb->data, output_page);
                
        if (! ei_local->txing) 
        {
@@ -1002,6 +999,7 @@ static void ethdev_setup(struct net_device *dev)
 
 /**
  * alloc_ei_netdev - alloc_etherdev counterpart for 8390
+ * @size: extra bytes to allocate
  *
  * Allocate 8390-specific net_device.
  */
@@ -1096,7 +1094,7 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
    
        outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD);
     
-       if (inb_p(e8390_base) & E8390_TRANS) 
+       if (inb_p(e8390_base + E8390_CMD) & E8390_TRANS) 
        {
                printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n",
                        dev->name);
@@ -1114,7 +1112,6 @@ EXPORT_SYMBOL(ei_interrupt);
 #ifdef CONFIG_NET_POLL_CONTROLLER
 EXPORT_SYMBOL(ei_poll);
 #endif
-EXPORT_SYMBOL(ei_tx_timeout);
 EXPORT_SYMBOL(NS8390_init);
 EXPORT_SYMBOL(__alloc_ei_netdev);