netdev
[Top] [All Lists]

initial acenic ZC cleanup

To: netdev@xxxxxxxxxxx
Subject: initial acenic ZC cleanup
From: Jes Sorensen <jes@xxxxxxxxxxxxx>
Date: Thu, 8 Mar 2001 16:47:28 -0500
Cc: davem@xxxxxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
Hi

Here is an initial cleanup of the AceNIC ZC patch. This is far from
where I want the code to go, but this is at least a starting point. It
also includes a couple of changes that were lost since the ZC patch
branced off from the official driver and removes the clearing of
statistics on open().

Dave, please apply.

Jes

--- bork/drivers/net/acenic.c   Thu Mar  8 15:17:43 2001
+++ linux-2.4.2-zc-010228/drivers/net/acenic.c  Thu Mar  8 16:40:39 2001
@@ -2,7 +2,7 @@
  * acenic.c: Linux driver for the Alteon AceNIC Gigabit Ethernet card
  *           and other Tigon based cards.
  *
- * Copyright 1998-2000 by Jes Sorensen, <jes@xxxxxxxxxxxxx>.
+ * Copyright 1998-2001 by Jes Sorensen, <jes@xxxxxxxxxxxxx>.
  *
  * Thanks to Alteon and 3Com for providing hardware and documentation
  * enabling me to write this driver.
@@ -208,10 +208,20 @@
 #if (LINUX_VERSION_CODE < 0x02032b)
 /*
  * SoftNet
+ *
+ * For pre-softnet kernels we need to tell the upper layer not to
+ * re-enter start_xmit() while we are in there. However softnet
+ * guarantees not to enter while we are in there so there is no need
+ * to do the netif_stop_queue() dance unless the transmit queue really
+ * gets stuck. This should also improve performance according to tests
+ * done by Aman Singla.
  */
-#define dev_kfree_skb_irq(a)   dev_kfree_skb(a)
-#define netif_wake_queue(dev)  do { clear_bit(0, &dev->tbusy); 
mark_bh(NET_BH); } while (0)
-#define netif_stop_queue(dev)  set_bit(0, &dev->tbusy)
+#define dev_kfree_skb_irq(a)                   dev_kfree_skb(a)
+#define netif_wake_queue(dev)                  clear_bit(0, &dev->tbusy)
+#define netif_stop_queue(dev)                  set_bit(0, &dev->tbusy)
+#define late_stop_netif_stop_queue(dev)                {do{} while(0);}
+#define early_stop_netif_stop_queue(dev)       test_and_set_bit(0,&dev->tbusy)
+#define early_stop_netif_wake_queue(dev)       netif_wake_queue(dev)
 
 static inline void netif_start_queue(struct net_device *dev)
 {
@@ -220,9 +230,10 @@
        dev->start = 1;
 }
 
-#define netif_queue_stopped(dev)       dev->tbusy
-#define netif_running(dev)             dev->start
-#define ace_if_down(dev)               {do{dev->start = 0;}while (0);}
+#define ace_mark_net_bh()                      mark_bh(NET_BH)
+#define netif_queue_stopped(dev)               dev->tbusy
+#define netif_running(dev)                     dev->start
+#define ace_if_down(dev)                       {do{dev->start = 0;} while(0);}
 
 #define tasklet_struct                         tq_struct
 static inline void tasklet_schedule(struct tasklet_struct *tasklet)
@@ -242,7 +253,11 @@
 }
 #define tasklet_kill(tasklet)                  {do{} while(0);}
 #else
-#define ace_if_down(dev)       {do{} while(0);}
+#define late_stop_netif_stop_queue(dev)                netif_stop_queue(dev)
+#define early_stop_netif_stop_queue(dev)       0
+#define early_stop_netif_wake_queue(dev)       {do{} while(0);}
+#define ace_mark_net_bh()                      {do{} while(0);}
+#define ace_if_down(dev)                       {do{} while(0);}
 #endif
 
 #if (LINUX_VERSION_CODE >= 0x02031b)
@@ -459,14 +474,15 @@
 #define DEF_RX_MAX_DESC                25
 #define DEF_TX_RATIO           21 /* 24 */
 
-#define DEF_JUMBO_TX_COAL      DEF_TX_COAL     /* was 20 */
-#define DEF_JUMBO_TX_MAX_DESC  DEF_TX_MAX_DESC
-#define DEF_JUMBO_RX_COAL      DEF_RX_COAL     /* was 30 */
+#define DEF_JUMBO_TX_COAL      20
+#define DEF_JUMBO_TX_MAX_DESC  60
+#define DEF_JUMBO_RX_COAL      30
 #define DEF_JUMBO_RX_MAX_DESC  6
 #define DEF_JUMBO_TX_RATIO     21
 
 #if tigon2FwReleaseLocal < 20001118
-/* Standard firmware and early modifications duplicate
+/*
+ * Standard firmware and early modifications duplicate
  * IRQ load without this flag (coal timer is never reset).
  * Note that with this flag tx_coal should be less than
  * time to xmit full tx ring.
@@ -474,12 +490,16 @@
  */
 #define TX_COAL_INTS_ONLY      1       /* worth it */
 #else
-/* With modified firmware, this is not necessary, but still useful. */
+/*
+ * With modified firmware, this is not necessary, but still useful.
+ */
 #define TX_COAL_INTS_ONLY      1
 #endif
+
 #define DEF_TRACE              0
 #define DEF_STAT               (2 * TICKS_PER_SEC)
 
+
 static int link[ACE_MAX_MOD_PARMS];
 static int trace[ACE_MAX_MOD_PARMS];
 static int tx_coal_tick[ACE_MAX_MOD_PARMS];
@@ -490,7 +510,7 @@
 static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
 
 static char version[] __initdata = 
-  "acenic.c: v0.50 02/02/2001  Jes Sorensen, linux-acenic@xxxxxxxxxx\n"
+  "acenic.c: v0.80 03/08/2001  Jes Sorensen, linux-acenic@xxxxxxxxxx\n"
   "                            http://home.cern.ch/~jes/gige/acenic.html\n";;
 
 static struct net_device *root_dev;
@@ -932,14 +952,12 @@
        if (ap->evt_ring == NULL)
                goto fail;
 
-#if USE_HOST_TX_RING
        size = (sizeof(struct tx_desc) * TX_RING_ENTRIES);
 
        ap->tx_ring = pci_alloc_consistent(ap->pdev, size, &ap->tx_ring_dma);
 
        if (ap->tx_ring == NULL)
                goto fail;
-#endif
 
        ap->evt_prd = pci_alloc_consistent(ap->pdev, sizeof(u32),
                                           &ap->evt_prd_dma);
@@ -1250,7 +1268,7 @@
 #endif
        writel(tmp, &regs->PciState);
 
-#if 1
+#if 0
        /*
         * I have received reports from people having problems when this
         * bit is enabled.
@@ -1409,34 +1427,29 @@
        *(ap->rx_ret_prd) = 0;
 
        writel(TX_RING_BASE, &regs->WinBase);
-#if USE_HOST_TX_RING
        memset(ap->tx_ring, 0, TX_RING_ENTRIES * sizeof(struct tx_desc));
 
        set_aceaddr(&info->tx_ctrl.rngptr, ap->tx_ring_dma);
 
        info->tx_ctrl.max_len = TX_RING_ENTRIES;
-       info->tx_ctrl.flags = 
RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|RCB_FLG_TX_HOST_RING;
-#else
-       ap->tx_ring = (struct tx_desc *)regs->Window;
-       for (i = 0; i < (TX_RING_ENTRIES * sizeof(struct tx_desc) / 4); i++) {
-               writel(0, (unsigned long)ap->tx_ring + i * 4);
-       }
-
-       set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE);
-       info->tx_ctrl.max_len = TX_RING_ENTRIES;
-       info->tx_ctrl.flags = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR;
-#endif
+       tmp = RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|RCB_FLG_TX_HOST_RING;
 #if TX_COAL_INTS_ONLY
-       info->tx_ctrl.flags |= RCB_FLG_COAL_INT_ONLY;
+       tmp |= RCB_FLG_COAL_INT_ONLY;
 #endif
+       info->tx_ctrl.flags = tmp;
 
        set_aceaddr(&info->tx_csm_ptr, ap->tx_csm_dma);
 
        /*
         * Potential item for tuning parameter
         */
+#if 0 /* NO */
        writel(DMA_THRESH_16W, &regs->DmaReadCfg);
        writel(DMA_THRESH_16W, &regs->DmaWriteCfg);
+#else
+       writel(DMA_THRESH_8W, &regs->DmaReadCfg);
+       writel(DMA_THRESH_8W, &regs->DmaWriteCfg);
+#endif
 
        writel(0, &regs->MaskInt);
        writel(1, &regs->IfIdx);
@@ -1525,10 +1538,8 @@
        if (ap->version >= 2)
                writel(tmp, &regs->TuneFastLink);
 
-#ifndef CONFIG_ACENIC_OMIT_TIGON_I
        if (ACE_IS_TIGON_I(ap))
                writel(tigonFwStartAddr, &regs->Pc);
-#endif
        if (ap->version == 2)
                writel(tigon2FwStartAddr, &regs->Pc);
 
@@ -1548,6 +1559,11 @@
        writel(0, &regs->RxRetCsm);
 
        /*
+        * Zero the stats before starting the interface
+        */
+       memset(&ap->stats, 0, sizeof(ap->stats));
+
+       /*
         * Start the NIC CPU
         */
        writel(readl(&regs->CpuCtrl) & ~(CPU_HALT|CPU_TRACE), &regs->CpuCtrl);
@@ -1648,8 +1664,10 @@
        }
 }
 
-static void ace_watchdog(struct net_device *dev)
+
+static void ace_watchdog(struct net_device *data)
 {
+       struct net_device *dev = data;
        struct ace_private *ap = dev->priv;
        struct ace_regs *regs = ap->regs;
 
@@ -1910,8 +1928,8 @@
        return;
  error_out:
        if (net_ratelimit())
-       printk(KERN_INFO "Out of memory when allocating "
-              "jumbo receive buffers\n");
+               printk(KERN_INFO "Out of memory when allocating "
+                      "jumbo receive buffers\n");
        goto out;
 }
 
@@ -1944,11 +1962,12 @@
                        case E_C_LINK_UP:
                        {
                                u32 state = readl(&ap->regs->GigLnkState);
-                               printk(KERN_WARNING "%s: Optical link UP (FD%c; 
FC: TX%c, RX%c)\n",
+                               printk(KERN_WARNING "%s: Optical link UP "
+                                      "(%s Duplex, Flow Control: %s%s)\n",
                                       dev->name,
-                                      state&LNK_FULL_DUPLEX ? '+' : '-',
-                                      state&LNK_TX_FLOW_CTL_Y ? '+' : '-',
-                                      state&LNK_RX_FLOW_CTL_Y ? '+' : '-');
+                                      state & LNK_FULL_DUPLEX ? "Full":"Half",
+                                      state & LNK_TX_FLOW_CTL_Y ? "TX " : "",
+                                      state & LNK_RX_FLOW_CTL_Y ? "RX" : "");
                                break;
                        }
                        case E_C_LINK_DOWN:
@@ -2099,7 +2118,8 @@
                skb->dev = dev;
                skb->protocol = eth_type_trans(skb, dev);
 
-               /* So, instead of forcing poor tigon mips cpu to calculate
+               /*
+                * Instead of forcing the poor tigon mips cpu to calculate
                 * pseudo hdr checksum, we do this ourselves.
                 */
                if (bd_flags & BD_FLG_TCP_UDP_SUM) {
@@ -2208,6 +2228,7 @@
         */
 }
 
+
 static void ace_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
 {
        struct ace_private *ap;
@@ -2228,7 +2249,8 @@
        if (!(readl(&regs->HostCtrl) & IN_INT))
                return;
 
-       /* ACK intr now. Otherwise we will lose updates to rx_ret_prd,
+       /*
+        * ACK intr now. Otherwise we will lose updates to rx_ret_prd,
         * which happened _after_ rxretprd = *ap->rx_ret_prd; but before
         * writel(0, &regs->Mb0Lo).
         *
@@ -2254,15 +2276,14 @@
        idx = ap->tx_ret_csm;
 
        if (txcsm != idx) {
-#if MAX_SKB_FRAGS
-               /* If each skb takes only one descriptor this check degenerates
+               /*
+                * If each skb takes only one descriptor this check degenerates
                 * to identity, because new space has just been opened.
                 * But if skbs are fragmented we must check that this index
                 * update releases enough of space, otherwise we just
                 * wait for device to make more work.
                 */
                if (!tx_ring_full(txcsm, ap->tx_prd))
-#endif
                        ace_tx_int(dev, txcsm, idx);
        }
 
@@ -2333,6 +2354,7 @@
        }
 }
 
+
 static int ace_open(struct net_device *dev)
 {
        struct ace_private *ap;
@@ -2349,11 +2371,6 @@
 
        writel(dev->mtu + ETH_HLEN + 4, &regs->IfMtu);
 
-       /*
-        * Zero the stats when restarting the interface...
-        */
-       memset(&ap->stats, 0, sizeof(ap->stats));
-
        cmd.evt = C_CLEAR_STATS;
        cmd.code = 0;
        cmd.idx = 0;
@@ -2390,6 +2407,9 @@
 
        ACE_MOD_INC_USE_COUNT;
 
+       /*
+        * Setup the bottom half rx ring refill handler
+        */
        tasklet_init(&ap->ace_tasklet, ace_tasklet, (unsigned long)dev);
        return 0;
 }
@@ -2405,7 +2425,8 @@
 
        ace_if_down(dev);
 
-       /* Without (or before) releasing irq and stopping hardware, this
+       /*
+        * Without (or before) releasing irq and stopping hardware, this
         * is an absolute non-sense, by the way. It will be reset instantly
         * by the first irq.
         */
@@ -2449,13 +2470,7 @@
                mapping = info->mapping;
 
                if (mapping) {
-#if USE_HOST_TX_RING
                        memset(ap->tx_ring+i, 0, sizeof(struct tx_desc));
-#else
-                       writel(0, &ap->tx_ring[i].addr.addrhi);
-                       writel(0, &ap->tx_ring[i].addr.addrlo);
-                       writel(0, &ap->tx_ring[i].flagsize);
-#endif
                        pci_unmap_single(ap->pdev, mapping, info->maplen,
                                         PCI_DMA_TODEVICE);
                        info->mapping = 0;
@@ -2480,7 +2495,9 @@
        return 0;
 }
 
-/* Following below should be (in more clean form!) in arch/ARCH/kernel/pci_*.
+
+/*
+ * Following below should be (in more clean form!) in arch/ARCH/kernel/pci_*.
  * For now, let it stay here.
  */
 #if defined(CONFIG_HIGHMEM) && MAX_SKB_FRAGS
@@ -2489,43 +2506,39 @@
 #endif
 
 #if defined(CONFIG_X86)
-#define BITS_PER_DMAADDR 64
 #define DMAADDR_OFFSET 0
 typedef unsigned long long dmaaddr_high_t;
 #elif defined(CONFIG_PPC)
-#define BITS_PER_DMAADDR BITS_PER_LONG
 #define DMAADDR_OFFSET PCI_DRAM_OFFSET
 typedef unsigned long dmaaddr_high_t;
 #endif
 
+
 static inline dmaaddr_high_t
 pci_map_single_high(struct pci_dev *hwdev, struct page *page,
                    int offset, size_t size, int dir)
 {
        dmaaddr_high_t phys;
 
-       phys = (page-mem_map) *
-               (dmaaddr_high_t) PAGE_SIZE +
-                       offset;
+       phys = (page-mem_map) * (dmaaddr_high_t) PAGE_SIZE + offset;
 
-       return phys+DMAADDR_OFFSET;
+       return (phys + DMAADDR_OFFSET);
 }
 
 #else
 
 typedef unsigned long dmaaddr_high_t;
 
-#define BITS_PER_DMAADDR BITS_PER_LONG
-
 static inline dmaaddr_high_t
 pci_map_single_high(struct pci_dev *hwdev, struct page *page,
                    int offset, size_t size, int dir)
 {
-       return pci_map_single(hwdev, page_address(page)+offset, size, dir);
+       return pci_map_single(hwdev, page_address(page) + offset, size, dir);
 }
 
 #endif
 
+
 static inline dmaaddr_high_t
 ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb,
               struct sk_buff *tail, u32 idx)
@@ -2544,6 +2557,7 @@
        return addr;
 }
 
+
 static inline void
 ace_load_tx_bd(struct tx_desc *desc, dmaaddr_high_t addr, u32 flagsize)
 {
@@ -2551,22 +2565,14 @@
        flagsize &= ~BD_FLG_COAL_NOW;
 #endif
 
-#if !USE_HOST_TX_RING
-       /* Do not reload addrhi, when it is zero. */
-#if (BITS_PER_DMAADDR == 64)
-       writel(addr >> 32, &desc->addr.addrhi);
-#endif
-       writel(addr & 0xffffffff, &desc->addr.addrlo);
-       writel(flagsize, &desc->flagsize);
-#else
-#if (BITS_PER_DMAADDR == 64)
-       desc->addr.addrhi = addr>>32;
+#ifdef ACE_64BIT_PTR
+       desc->addr.addrhi = addr >> 32;
 #endif
        desc->addr.addrlo = addr;
        desc->flagsize = flagsize;
-#endif
 }
 
+
 static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct ace_private *ap = dev->priv;
@@ -2574,13 +2580,11 @@
        struct tx_desc *desc;
        u32 idx, flagsize;
 
-#if (LINUX_VERSION_CODE < 0x02032b)
        /*
         * This only happens with pre-softnet, ie. 2.2.x kernels.
         */
-       if (netif_queue_stopped(dev))
+       if (early_stop_netif_stop_queue(dev))
                return 1;
-#endif
 
 
 restart:
@@ -2631,7 +2635,10 @@
                        info = ap->skb->tx_skbuff + idx;
                        desc = ap->tx_ring + idx;
 
-                       phys = pci_map_single_high(ap->pdev, frag->page, 
frag->page_offset, frag->size, PCI_DMA_TODEVICE);
+                       phys = pci_map_single_high(ap->pdev, frag->page,
+                                                  frag->page_offset,
+                                                  frag->size,
+                                                  PCI_DMA_TODEVICE);
 
                        flagsize = (frag->size << 16);
                        if (skb->ip_summed == CHECKSUM_HW)
@@ -2664,7 +2671,7 @@
        ap->tx_prd = idx;
        ace_set_txprd(regs, ap, idx);
 
-       if (flagsize&BD_FLG_COAL_NOW) {
+       if (flagsize & BD_FLG_COAL_NOW) {
                netif_stop_queue(dev);
 
                /*
@@ -2681,8 +2688,9 @@
        return 0;
 
 overflow:
-       /* This race condition is unavoidable with lock-free drivers.
-        * We wake up queue _before_ tx_prd is advanced, so that we can
+       /*
+        * This race condition is unavoidable with lock-free drivers.
+        * We wake up the queue _before_ tx_prd is advanced, so that we can
         * enter hard_start_xmit too early, while tx ring still looks closed.
         * This happens ~1-4 times per 100000 packets, so that we can allow
         * to loop syncing to other CPU. Probably, we need an additional
@@ -2700,6 +2708,7 @@
        goto restart;
 }
 
+
 static int ace_change_mtu(struct net_device *dev, int new_mtu)
 {
        struct ace_private *ap = dev->priv;
@@ -2745,53 +2754,7 @@
 #ifdef SIOCETHTOOL
        struct ethtool_cmd ecmd;
        u32 link, speed;
-#endif
 
-       if (cmd == (SIOCDEVPRIVATE+0x01)) {
-               int p[5];
-               p[0] = readl(&regs->TuneTxCoalTicks);
-               p[1] = readl(&regs->TuneMaxTxDesc);
-               p[2] = readl(&regs->TuneRxCoalTicks);
-               p[3] = readl(&regs->TuneMaxRxDesc);
-               p[4] = readl(&regs->TxBufRat);
-
-               if (copy_to_user(ifr->ifr_data, &p, sizeof(p)))
-                       return -EFAULT;
-               return 0;
-       } else if (cmd == (SIOCDEVPRIVATE+0x02)) {
-               int p[5];
-               if (copy_from_user(&p, ifr->ifr_data, sizeof(p)))
-                       return -EFAULT;
-               writel(p[0], &regs->TuneTxCoalTicks);
-               writel(p[1], &regs->TuneMaxTxDesc);
-               writel(p[2], &regs->TuneRxCoalTicks);
-               writel(p[3], &regs->TuneMaxRxDesc);
-               /* This register not used after tigon is booted.
-                * We still allow to modify it, because it gives free
-                * variable, which could be used by modified firmware
-                * for another purposes.
-                */
-               writel(p[4], &regs->TxBufRat);
-               return 0;
-       } else if (cmd == (SIOCDEVPRIVATE+0x03)) {
-               if (copy_to_user(ifr->ifr_data, &ap->info->s, 
sizeof(ap->info->s)))
-                       return -EFAULT;
-               return 0;
-       } else if (cmd == (SIOCDEVPRIVATE+0x0e)) {
-               printk(KERN_NOTICE "%s: dumping debug info\n", dev->name);
-               printk(KERN_NOTICE "%s: tbusy %d, tx_csm %i tx_ret_csm %i, "
-                      "tx_prd %i\n", dev->name, netif_queue_stopped(dev),
-                      *ap->tx_csm, ap->tx_ret_csm, ap->tx_prd);
-               printk(KERN_NOTICE "%s: cur_rx %i, std_refill %li, "
-                      "mini_rx %i, mini_refill %li\n", dev->name,
-                      atomic_read(&ap->cur_rx_bufs), ap->std_refill_busy,
-                      atomic_read(&ap->cur_mini_bufs), ap->mini_refill_busy);
-               printk(KERN_NOTICE "%s: CpuCtrl %08x\n",
-                      dev->name, readl(&regs->CpuCtrl));
-               return 0;
-       }
-
-#ifdef SIOCETHTOOL
        if (cmd != SIOCETHTOOL)
                return -EOPNOTSUPP;
        if (copy_from_user(&ecmd, ifr->ifr_data, sizeof(ecmd)))
@@ -2928,7 +2891,8 @@
 
        regs = ((struct ace_private *)dev->priv)->regs;
        writel(da[0] << 8 | da[1], &regs->MacAddrHi);
-       writel((da[2] << 24) | (da[3] << 16) | (da[4] << 8) | da[5] , 
&regs->MacAddrLo);
+       writel((da[2] << 24) | (da[3] << 16) | (da[4] << 8) | da[5],
+              &regs->MacAddrLo);
 
        cmd.evt = C_SET_MAC_ADDR;
        cmd.code = 0;
@@ -3003,11 +2967,12 @@
        ap->stats.multicast = readl(&mac_stats->kept_mc);
        ap->stats.collisions = readl(&mac_stats->coll);
 
-       return(&ap->stats);
+       return &ap->stats;
 }
 
 
-static void __init ace_copy(struct ace_regs *regs, void *src, u32 dest, int 
size)
+static void __init ace_copy(struct ace_regs *regs, void *src,
+                           u32 dest, int size)
 {
        unsigned long tdest;
        u32 *wsrc;
@@ -3092,14 +3057,12 @@
         */
        ace_clear(regs, 0x2000, 0x80000-0x2000);
        if (ACE_IS_TIGON_I(ap)) {
-#ifndef CONFIG_ACENIC_OMIT_TIGON_I
                ace_copy(regs, tigonFwText, tigonFwTextAddr, tigonFwTextLen);
                ace_copy(regs, tigonFwData, tigonFwDataAddr, tigonFwDataLen);
                ace_copy(regs, tigonFwRodata, tigonFwRodataAddr,
                         tigonFwRodataLen);
                ace_clear(regs, tigonFwBssAddr, tigonFwBssLen);
                ace_clear(regs, tigonFwSbssAddr, tigonFwSbssLen);
-#endif
        }else if (ap->version == 2) {
                ace_clear(regs, tigon2FwBssAddr, tigon2FwBssLen);
                ace_clear(regs, tigon2FwSbssAddr, tigon2FwSbssLen);
--- bork/drivers/net/acenic.h   Thu Mar  8 15:17:43 2001
+++ linux-2.4.2-zc-010228/drivers/net/acenic.h  Thu Mar  8 16:31:24 2001
@@ -1,14 +1,9 @@
 #ifndef _ACENIC_H_
 #define _ACENIC_H_
 
-/* Use TX ring based in host memory. This avoids PIO stalling
- * cpu, but results in more bus traffic per packet and increase
- * of latency by up to 1 usec (sigh, alteon firmware is slooow).
- * With normal traffic the profit overweights.
- */
-#define USE_HOST_TX_RING 1
 
-/* Generate TX index update each time, when TX ring is closed.
+/*
+ * Generate TX index update each time, when TX ring is closed.
  * Normally, this is not useful, because results in more dma (and irqs
  * without TX_COAL_INTS_ONLY).
  */
@@ -18,6 +13,7 @@
 #define MAX_SKB_FRAGS 0
 #endif
 
+
 /*
  * Addressing:
  *
@@ -442,6 +438,10 @@
 /*
  * TX ring
  */
+#define TX_RING_ENTRIES        256     
+#define TX_RING_SIZE   (TX_RING_ENTRIES * sizeof(struct tx_desc))
+#define TX_RING_BASE   0x3800
+
 struct tx_desc{
         aceaddr        addr;
        u32     flagsize; 
@@ -465,14 +465,6 @@
        u32     vlanres;
 };
 
-/*
- * TX ring size can be 128, 256 or 512.
- * (any other value will result in a crash.)
- */
-#define TX_RING_ENTRIES        128
-#define TX_RING_SIZE   (TX_RING_ENTRIES * sizeof(struct tx_desc))
-#define TX_RING_END 0x4000
-#define TX_RING_BASE (TX_RING_END - sizeof(struct tx_desc)*TX_RING_ENTRIES)
 
 #define RX_STD_RING_ENTRIES    512
 #define RX_STD_RING_SIZE       (RX_STD_RING_ENTRIES * sizeof(struct rx_desc))
@@ -679,9 +671,7 @@
 
        volatile u32            *evt_prd, *rx_ret_prd, *tx_csm;
 
-#ifdef USE_HOST_TX_RING
        dma_addr_t              tx_ring_dma;    /* 32/64 bit */
-#endif
        dma_addr_t              rx_ring_base_dma;
        dma_addr_t              evt_ring_dma;
        dma_addr_t              evt_prd_dma, rx_ret_prd_dma, tx_csm_dma;
@@ -702,16 +692,21 @@
        struct net_device_stats stats;
 };
 
+
 #define TX_RESERVED    MAX_SKB_FRAGS
 
 static inline int tx_space (u32 csm, u32 prd)
 {
-       return (csm - prd - 1) & (TX_RING_ENTRIES-1);
+       return (csm - prd - 1) & (TX_RING_ENTRIES - 1);
 }
 
-#define tx_free(ap) tx_space((ap)->tx_ret_csm, (ap)->tx_prd)
+#define tx_free(ap)            tx_space((ap)->tx_ret_csm, (ap)->tx_prd)
 
-#define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED)
+#if MAX_SKB_FRAGS
+#define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED)
+#else
+#define tx_ring_full           0
+#endif
 
 
 static inline void set_aceaddr(aceaddr *aa, dma_addr_t addr)
@@ -778,9 +773,6 @@
 static void ace_dump_trace(struct ace_private *ap);
 static void ace_set_multicast_list(struct net_device *dev);
 static int ace_change_mtu(struct net_device *dev, int new_mtu);
-#ifdef SKB_RECYCLE
-extern int ace_recycle(struct sk_buff *skb);
-#endif
 static int ace_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 static int ace_set_mac_addr(struct net_device *dev, void *p);
 static void ace_set_rxtx_parms(struct net_device *dev, int jumbo);
--- bork/drivers/net/acenic_firmware.h  Thu Mar  8 15:51:25 2001
+++ linux-2.4.2-zc-010228/drivers/net/acenic_firmware.h Thu Mar  8 16:34:19 2001
@@ -17,10 +17,11 @@
 #define tigonFwSbssLen 0x38
 #define tigonFwBssAddr 0x00015dd0
 #define tigonFwBssLen 0x2080
-u32 tigonFwText[];
-u32 tigonFwData[];
-u32 tigonFwRodata[];
 #ifndef CONFIG_ACENIC_OMIT_TIGON_I
+#define tigonFwText 0
+#define tigonFwData 0
+#define tigonFwRodata 0
+#else
 /* Generated by genfw.c */
 u32 tigonFwText[(MAX_TEXT_LEN/4) + 1] __initdata = {
 0x10000003, 

<Prev in Thread] Current Thread [Next in Thread>