Proposed patch to tulip.c v0.91g

William J. Earl wje@fir.engr.sgi.com
Thu Jul 22 17:38:49 1999


     I have been using a Netgear FA310TX card for a while now, and I
have noticed quite a few incoming packet drops, when running in
10BaseT half-duplex mode, attached to an unswitched hub.  The problem
was particularly bad for ARP replies.  The FA310TX uses the Lite-On
PNIC controller.  I have applied a workaround for the PNIC receiver
bug which causes this problem to tulip.c, based on the workaround
developed by Bill Paul for the BSD if_pn.c driver.  The workaround
appears to solve the problem for me.

      In creating the workaround, I introduced symbolic names for many
of the status and control bits used by the hardware, as decoding the
hex values when reading the code was tedious.  More could be done in this
regard, particular in the area of the CSR6 register.  I noticed what
appears to be an error in the CSR6 setup; it looks like two of the constants
have an extra 0 digit appended, which would lead to some of the setup being
incorrect for two of the cases where there is no media description table.
The extra 0 digits are dropped in this patch.

      The problem, as described by Bill Paul, is that the PNIC
sometimes prefixes a packet with some amount of garbage.  This
generally causes two or more buffers to be filled.  The length for the
packet in the final buffer is correct, but the packet does not start
at the beginning of the final buffer, and may be partly in the
previous buffer.  The workaround is to fill all buffers with 0 before
making them available to the hardware, scan backward for a non-zero
CRC byte from the end of the last buffer (when multiple buffers are
used for a packet) to find the end of the packet, compute the
beginning of the packet from the length, move the packet so it is
aligned with the beginning of the last buffer, set the last buffer to
be a "whole packet", and discard the other buffers.  Note that the
workaround is only enabled for PNIC revisions 168*, 169, and 169B, not
for any other interfaces.

     If you have been experiencing problems with a PNIC-based card,
would you please try this patch and let me know if it works for you as
well, or if it is causes any problems.  Also, if anyone would be willing
to try this on a non-PNIC card, I would like to know if it causes any
regressions on other cards.

----------------------------------------------------------------------
diff -ub drivers/net/tulip.c-v0.91g drivers/net/tulip.c
--- drivers/net/tulip.c-v0.91g	Tue Jul 20 17:35:26 1999
+++ drivers/net/tulip.c	Thu Jul 22 13:40:46 1999
@@ -131,6 +131,8 @@
 #include <asm/io.h>
 #include <asm/unaligned.h>
 
+#define PNIC_RX_WAR 1
+
 /* Kernel compatibility defines, some common to David Hind's PCMCIA package.
    This is only in the support-all-kernels source code. */
 
@@ -362,6 +364,9 @@
 	HAS_PWRDWN=0x10, MC_HASH_ONLY=0x20, /* Hash-only multicast filter. */
 	HAS_PNICNWAY=0x80, HAS_NWAY143=0x40,	/* Uses internal NWay xcvr. */
 	HAS_8023X=0x100,
+#ifdef PNIC_RX_WAR
+    HAS_PNIC_RX_WAR=0x200
+#endif /* PNIC_RX_WAR */
 };
 static struct tulip_chip_table {
 	char *chip_name;
@@ -378,7 +383,12 @@
 	HAS_MII | HAS_MEDIA_TABLE | ALWAYS_CHECK_MII | HAS_PWRDWN | HAS_NWAY143,
 	t21142_timer },
   { "Lite-On 82c168 PNIC", 256, 0x0001ebef,
-	HAS_MII | HAS_PNICNWAY, pnic_timer },
+    (HAS_MII | HAS_PNICNWAY 
+#ifdef PNIC_RX_WAR
+     | HAS_PNIC_RX_WAR
+#endif /* PNIC_RX_WAR */
+     ),
+    pnic_timer },
   { "Macronix 98713 PMAC", 128, 0x0001ebef,
 	HAS_MII | HAS_MEDIA_TABLE | CSR12_IN_SROM, mxic_timer },
   { "Macronix 98715 PMAC", 256, 0x0001ebef,
@@ -452,19 +462,92 @@
 	u32 buffer1, buffer2;				/* We use only buffer 1.  */
 };
 
-enum desc_status_bits {
-	DescOwned=0x80000000, RxDescFatalErr=0x8000, RxWholePkt=0x0300,
+enum rx_status_bits {
+    RxStatusOverflow =  0x00000001,
+    RxStatusCRCError =  0x00000002,
+    RxStatusDribble =   0x00000004,
+    RxStatusWatchdog =  0x00000010,
+    RxStatusFrameType = 0x00000020, /* 1 -> Ethernet, 0 -> 802.3 */
+    RxStatusCollision = 0x00000040,
+    RxStatusGiant =     0x00000080,
+    RxStatusLastBuf =   0x00000100,
+    RxStatusFirstBuf =  0x00000200,
+    RxStatusMulticast = 0x00000400,
+    RxStatusRunt =      0x00000800,
+    RxStatusType =      0x00003000,
+    RxStatusFatalError = 0x00008000, 
+    RxStatusLength =    0x7fff0000,
+    RxStatusOwned =     0x80000000, 
+};
+
+#define RxStatusLengthShift 16
+
+#define RxStatusBytes(x)    (((x) & RxStatusLength) >> RxStatusLengthShift)
+
+#define RxStatusWholePkt (RxStatusFirstBuf | \
+                          RxStatusLastBuf)
+
+#define RxStatus        (RxStatusWholePkt | \
+                         RxStatusOwned)
+
+
+
+
+enum rx_control_bits {
+    RxControlBufferLength1 =        0x00000FFF,
+    RxControlBufferLength2 =        0x00FFF000,
+    RxControlRlink =                0x01000000,
+    RxControlRlast =                0x02000000,
 };
 
+#define RxControlBufferLength1Shift 0
+#define RxControlBufferLength2Shift 12
+
 /* Ring-wrap flag in length field, use for last ring entry.
-	0x01000000 means chain on buffer2 address,
-	0x02000000 means use the ring start address in CSR2/3.
+    RxControlRlink/TxControlTlink means chain on buffer2 address,
+    RxControlRlast/TxControlTlast means use the ring start address in CSR2/3.
    Note: Some work-alike chips do not function correctly in chained mode.
    The ASIX chip works only in chained mode.
    Thus we indicates ring mode, but always write the 'next' field for
    chained mode as well.
 */
-#define DESC_RING_WRAP 0x02000000
+
+enum tx_status_bits {
+    TxStatusDefer =             0x00000001,
+    TxStatusUnderrun =          0x00000002,
+    TxStatusLinkFailed =        0x00000003,
+    TxStatusCollisionCount =    0x00000078,
+    TxStatusSQE =               0x00000080,
+    TxStatusExcessCollisions =  0x00000100,
+    TxStatusLateCollision =     0x00000200,
+    TxStatusNoCarrier =         0x00000400,
+    TxStatusCarrierLost =       0x00000800,
+    TxStatusJabberTimeout =     0x00004000,
+    TxStatusFatalError =        0x00008000,
+    TxStatusOwned =             0x80000000,
+};
+
+#define TxStatusCollisionCountShift 3
+
+enum tx_control_bits {  
+    TxControlBufferLength1 =    0x000007FF,
+    TxControlBufferLength2 =    0x003FF800,
+    TxControlFiltType0 =        0x00400000,
+    TxControlPad =              0x00800000,
+    TxControlTlink =            0x01000000,
+    TxControlTlast =            0x02000000,
+    TxControlNoCRC =            0x04000000,
+    TxControlSetup =            0x08000000,
+    TxControlFiltType1 =        0x10000000,
+    TxControlFirstBuf =         0x20000000,
+    TxControlLastBuf =          0x40000000,
+    TxControlFint =             0x80000000,
+};
+
+#define TxControlBufferLength1Shift 0
+#define TxControlBufferLength2Shift 11
+
+#define SETUP_FRAME_SIZE 192
 
 #define EEPROM_SIZE 128 	/* 2 << EEPROM_ADDRLEN */
 
@@ -489,6 +572,12 @@
 	unsigned char *info;
 };
 
+#ifdef PNIC_RX_WAR
+#define PNIC_REVISION_168   0x10
+#define PNIC_REVISION_169   0x20
+#define PNIC_REVISION_169B  0x21
+#endif /* PNIC_RX_WAR */
+
 struct tulip_private {
 	char devname[8];			/* Used only for kernel debugging. */
 	const char *product_name;
@@ -530,6 +619,10 @@
 	int cur_index;						/* Current media index. */
 	int saved_if_port;
 	unsigned char pci_bus, pci_devfn;
+#ifdef PNIC_RX_WAR
+    int pnic_rx_war_base_entry;
+    int pnic_rx_war_pad;
+#endif /* PNIC_RX_WAR */
 	int pad0, pad1;						/* Used for 8-byte alignment */
 };
 
@@ -803,6 +896,13 @@
 	tp->chip_id = chip_idx;
 	tp->revision = chip_rev;
 	tp->flags = tulip_tbl[chip_idx].flags;
+#ifdef PNIC_RX_WAR
+    if (! (chip_rev == PNIC_REVISION_169B ||
+           chip_rev == PNIC_REVISION_169 ||
+           (chip_rev & 0xF0) == (PNIC_REVISION_168 & 0xF0)))
+        tp->flags &= ~HAS_PNIC_RX_WAR;
+    tp->pnic_rx_war_base_entry = -1;
+#endif /* PNIC_RX_WAR */
 	tp->csr0 = csr0;
 
 	/* BugFixes: The 21143-TD hangs with PCI Write-and-Invalidate cycles.
@@ -1457,9 +1557,9 @@
 		*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
 		*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
 		/* Put the setup frame on the Tx list. */
-		tp->tx_ring[0].length = 0x08000000 | 192;
+        tp->tx_ring[0].length = (TxControlSetup | SETUP_FRAME_SIZE);
 		tp->tx_ring[0].buffer1 = virt_to_bus(tp->setup_frame);
-		tp->tx_ring[0].status = DescOwned;
+        tp->tx_ring[0].status = TxStatusOwned;
 
 		tp->cur_tx++;
 	}
@@ -1785,9 +1885,9 @@
 		if (media_cap[dev->if_port] & MediaIsMII) {
 			new_csr6 = 0x020E0000;
 		} else if (media_cap[dev->if_port] & MediaIsFx) {
-			new_csr6 = 0x028600000;
+            new_csr6 = 0x02860000;
 		} else
-			new_csr6 = 0x038600000;
+            new_csr6 = 0x03860000;
 		if (tulip_debug > 1)
 			printk(KERN_DEBUG "%s: No media description table, assuming "
 				   "%s transceiver, CSR12 %2.2x.\n",
@@ -2492,7 +2592,7 @@
 		tp->rx_skbuff[i] = NULL;
 	}
 	/* Mark the last entry as wrapping the ring. */
-	tp->rx_ring[i-1].length = PKT_BUF_SZ | DESC_RING_WRAP;
+    tp->rx_ring[i-1].length = PKT_BUF_SZ | RxControlRlast;
 	tp->rx_ring[i-1].buffer2 = virt_to_bus(&tp->rx_ring[0]);
 
 
@@ -2501,11 +2601,15 @@
 		   dev_alloc_skb() provides 16 byte alignment.  But do *not*
 		   use skb_reserve() to align the IP header! */
 		struct sk_buff *skb = dev_alloc_skb(PKT_BUF_SZ);
+#ifdef PNIC_RX_WAR
+        if (tp->flags & HAS_PNIC_RX_WAR)
+            memset(skb->tail,0,PKT_BUF_SZ);
+#endif /* PNIC_RX_WAR */        
 		tp->rx_skbuff[i] = skb;
 		if (skb == NULL)
 			break;
 		skb->dev = dev;			/* Mark as being used by this device. */
-		tp->rx_ring[i].status = DescOwned;	/* Owned by Tulip chip */
+        tp->rx_ring[i].status = RxStatusOwned;  /* Owned by Tulip chip */
 		tp->rx_ring[i].buffer1 = virt_to_bus(skb->tail);
 	}
 	tp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
@@ -2546,20 +2650,27 @@
 	tp->tx_ring[entry].buffer1 = virt_to_bus(skb->data);
 
 	if (tp->cur_tx - tp->dirty_tx < TX_RING_SIZE/2) {/* Typical path */
-		flag = 0x60000000; /* No interrupt */
+        flag = (TxControlFirstBuf | TxControlLastBuf); /* No interrupt */
 	} else if (tp->cur_tx - tp->dirty_tx == TX_RING_SIZE/2) {
-		flag = 0xe0000000; /* Tx-done intr. */
+        flag = (TxControlFint |
+                TxControlFirstBuf | 
+                TxControlLastBuf); /* Tx-done intr. */
 	} else if (tp->cur_tx - tp->dirty_tx < TX_RING_SIZE - 2) {
-		flag = 0x60000000; /* No Tx-done intr. */
+        flag = (TxControlFirstBuf | TxControlLastBuf); /* No interrupt */
 	} else {		/* Leave room for set_rx_mode() to fill entries. */
 		tp->tx_full = 1;
-		flag = 0xe0000000; /* Tx-done intr. */
+        flag = (TxControlFint |
+                TxControlFirstBuf | 
+                TxControlLastBuf); /* Tx-done intr. */
 	}
 	if (entry == TX_RING_SIZE-1)
-		flag |= 0xe0000000 | DESC_RING_WRAP;
+        flag |= (TxControlFint |
+                 TxControlFirstBuf | 
+                 TxControlLastBuf |
+                 TxControlTlast);
 
 	tp->tx_ring[entry].length = skb->len | flag;
-	tp->tx_ring[entry].status = DescOwned;	/* Pass ownership to the chip. */
+    tp->tx_ring[entry].status = TxStatusOwned;  /* Pass ownership to the chip. */
 	tp->cur_tx++;
 	if ( ! tp->tx_full)
 		clear_bit(0, (void*)&dev->tbusy);
@@ -2619,13 +2730,13 @@
 				int entry = dirty_tx % TX_RING_SIZE;
 				int status = tp->tx_ring[entry].status;
 
-				if (status < 0)
+                if (status & TxStatusOwned)
 					break;			/* It still hasn't been Txed */
 				/* Check for Rx filter setup frames. */
 				if (tp->tx_skbuff[entry] == NULL)
 				  continue;
 
-				if (status & 0x8000) {
+                if (status & TxStatusFatalError) {
 					/* There was an major error, log it. */
 #ifndef final_version
 					if (tulip_debug > 1)
@@ -2633,23 +2744,35 @@
 							   dev->name, status);
 #endif
 					tp->stats.tx_errors++;
-					if (status & 0x4104) tp->stats.tx_aborted_errors++;
-					if (status & 0x0C00) tp->stats.tx_carrier_errors++;
-					if (status & 0x0200) tp->stats.tx_window_errors++;
-					if (status & 0x0002) tp->stats.tx_fifo_errors++;
-					if ((status & 0x0080) && tp->full_duplex == 0)
+                    if (status & (TxStatusJabberTimeout |
+                                  TxStatusExcessCollisions | 
+                                  0x4))
+                        tp->stats.tx_aborted_errors++;
+                    if (status & (TxStatusNoCarrier |
+                                  TxStatusCarrierLost)) 
+                        tp->stats.tx_carrier_errors++;
+                    if (status & TxStatusLateCollision)
+                        tp->stats.tx_window_errors++;
+                    if (status & TxStatusUnderrun)
+                        tp->stats.tx_fifo_errors++;
+                    if ((status & TxStatusSQE) &&
+                        tp->full_duplex == 0)
 						tp->stats.tx_heartbeat_errors++;
 #ifdef ETHER_STATS
-					if (status & 0x0100) tp->stats.collisions16++;
+                    if (status & TxStatusExcessCollisions)
+                        tp->stats.collisions16++;
 #endif
 				} else {
 #ifdef ETHER_STATS
-					if (status & 0x0001) tp->stats.tx_deferred++;
+                    if (status & TxStatusDefer) 
+                        tp->stats.tx_deferred++;
 #endif
 #if LINUX_VERSION_CODE > 0x20127
-					tp->stats.tx_bytes += tp->tx_ring[entry].length & 0x7ff;
+                    tp->stats.tx_bytes += (tp->tx_ring[entry].length & 
+                                           TxControlBufferLength1);
 #endif
-					tp->stats.collisions += (status >> 3) & 15;
+                    tp->stats.collisions += ((status & TxStatusCollisionCount) >> 
+                                             TxStatusCollisionCountShift);
 					tp->stats.tx_packets++;
 				}
 
@@ -2749,53 +2872,133 @@
 	int entry = tp->cur_rx % RX_RING_SIZE;
 	int rx_work_limit = tp->dirty_rx + RX_RING_SIZE - tp->cur_rx;
 	int work_done = 0;
+    int pkt_len;
+    struct sk_buff *skb;
 
 	if (tulip_debug > 4)
 		printk(KERN_DEBUG " In tulip_rx(), entry %d %8.8x.\n", entry,
 			   tp->rx_ring[entry].status);
 	/* If we own the next entry, it's a new packet. Send it up. */
-	while (tp->rx_ring[entry].status >= 0) {
+    while (! (tp->rx_ring[entry].status & RxStatusOwned)) {
 		s32 status = tp->rx_ring[entry].status;
 
 		if (tulip_debug > 5)
 			printk(KERN_DEBUG " In tulip_rx(), entry %d %8.8x.\n", entry,
 				   tp->rx_ring[entry].status);
+
 		if (--rx_work_limit < 0)
 			break;
-		if ((status & 0x38008300) != 0x0300) {
-			if ((status & 0x38000300) != 0x0300) {
-				/* Ingore earlier buffers. */
-				if ((status & 0xffff) != 0x7fff) {
+
+#ifdef PNIC_RX_WAR
+        if (tp->flags & HAS_PNIC_RX_WAR) {
+            if (! (status & RxStatusFatalError) &&
+                (status & RxStatusWholePkt) != RxStatusWholePkt) {
+                /*
+                 * PNIC bug:  PNIC prefixed packet with trash, so we 
+                 * have to delete the trash and extract the actual packet,
+                 * to avoid dropping packets.
+                 */
+                if (! (status & RxStatusLastBuf)) {
+                    if (status & RxStatusFirstBuf)
+                        tp->pnic_rx_war_base_entry = entry;
+                    entry = (++tp->cur_rx) % RX_RING_SIZE;
+                    continue;
+                }
+
+                if (tp->pnic_rx_war_base_entry != -1) {
+                    unsigned char *cp;
+                    int prev_entry;
+                    int copy_len;
+                    unsigned char *ep;
+
+                    /*
+                     * Search backward through buffer for CRC bytes 
+                     */
+                    pkt_len = RxStatusBytes(status);
+                    skb = tp->rx_skbuff[entry];
+
+                    for (cp = skb->tail + PKT_BUF_SZ;
+                         cp > skb->tail && cp[-1] == 0;
+                         cp--);
+                    if (cp <= skb->tail) {
+                    skip_bad_buffer:
+                        tp->rx_ring[entry].status = (RxStatusFatalError |
+                                                     RxStatusOverflow |
+                                                     RxStatusWholePkt);
+                    } else {
+                        if ((cp - skb->tail) < pkt_len) {
+                            /* some data in previous buffer */
+                            prev_entry = (entry + RX_RING_SIZE - 1) % RX_RING_SIZE;
+                            if (tp->rx_skbuff[prev_entry] == NULL)
+                                goto skip_bad_buffer;
+
+                            /* move latter part of data up in buffer */
+                            copy_len = (pkt_len - (cp - skb->tail));
+                            for (ep = cp + copy_len;
+                                 cp > skb->tail;
+                                 )
+                                *(--ep) = *(--cp);
+
+                            /* copy remainder of packet from previous buffer */
+                            memcpy(skb->tail,
+                                   (tp->rx_skbuff[prev_entry]->tail + 
+                                    PKT_BUF_SZ - copy_len),
+                                   copy_len);
+                        } else {
+                            /* copy data down to base of buffer */
+                            memcpy(skb->tail,cp - pkt_len,pkt_len);
+                        }
+                        tp->rx_ring[entry].status |= RxStatusWholePkt;
+                    }
+                    tp->pnic_rx_war_base_entry = -1;
+                }
+                status = tp->rx_ring[entry].status;
+            } else
+                tp->pnic_rx_war_base_entry = -1;
+        }
+#endif /* PNIC_RX_WAR */
+
+        /* Omit the four octet CRC from the length. */
+        pkt_len = RxStatusBytes(status) - 4;
+
+        if ((status & (RxStatusFatalError |
+                       RxStatusWholePkt)) != RxStatusWholePkt) {
+            if ((status & RxStatusWholePkt) !=
+                RxStatusWholePkt) {
+                /* Ignore earlier buffers. */
+                if (status & RxStatusLastBuf) {
 					if (tulip_debug > 1)
 						printk(KERN_WARNING "%s: Oversized Ethernet frame "
 							   "spanned multiple buffers, status %8.8x!\n",
 							   dev->name, status);
 					tp->stats.rx_length_errors++;
 				}
-			} else if (status & RxDescFatalErr) {
+            } else if (status & RxStatusFatalError) {
 				/* There was a fatal error. */
 				if (tulip_debug > 2)
 					printk(KERN_DEBUG "%s: Receive error, Rx status %8.8x.\n",
 						   dev->name, status);
 				tp->stats.rx_errors++; /* end of a packet.*/
-				if (status & 0x0890) tp->stats.rx_length_errors++;
-				if (status & 0x0004) tp->stats.rx_frame_errors++;
-				if (status & 0x0002) tp->stats.rx_crc_errors++;
-				if (status & 0x0001) tp->stats.rx_fifo_errors++;
+                if (status & (RxStatusRunt |
+                              RxStatusGiant | 
+                              RxStatusWatchdog))
+                    tp->stats.rx_length_errors++;
+                if (status & RxStatusDribble)
+                    tp->stats.rx_frame_errors++;
+                if (status & RxStatusCRCError)
+                    tp->stats.rx_crc_errors++;
+                if (status & RxStatusOverflow)
+                    tp->stats.rx_fifo_errors++;
 			}
-		} else {
-			/* Omit the four octet CRC from the length. */
-			short pkt_len = ((status >> 16) & 0x7ff) - 4;
-			struct sk_buff *skb;
 
 #ifndef final_version
-			if (pkt_len > 1518) {
+        } else if (pkt_len > 1518) {
 				printk(KERN_WARNING "%s: Bogus packet size of %d (%#x).\n",
 					   dev->name, pkt_len, pkt_len);
-				pkt_len = 1518;
 				tp->stats.rx_length_errors++;
-			}
 #endif
+
+        } else {
 			/* Check if the packet is long enough to accept without copying
 			   to a minimally-sized skbuff. */
 			if (pkt_len < rx_copybreak
@@ -2841,11 +3044,15 @@
 			skb = tp->rx_skbuff[entry] = dev_alloc_skb(PKT_BUF_SZ);
 			if (skb == NULL)
 				break;
+#ifdef PNIC_RX_WAR
+            if (tp->flags & HAS_PNIC_RX_WAR)
+                memset(skb->tail,0,PKT_BUF_SZ);
+#endif /* PNIC_RX_WAR */        
 			skb->dev = dev;			/* Mark as being used by this device. */
 			tp->rx_ring[entry].buffer1 = virt_to_bus(skb->tail);
 			work_done++;
 		}
-		tp->rx_ring[entry].status = DescOwned;
+        tp->rx_ring[entry].status = RxStatusOwned;
 	}
 
 	return work_done;
@@ -3075,14 +3282,16 @@
 	} else {
 		u16 *eaddrs, *setup_frm = tp->setup_frame;
 		struct dev_mc_list *mclist;
-		u32 tx_flags = 0x08000000 | 192;
+        u32 tx_flags = (TxControlSetup | SETUP_FRAME_SIZE);
 		int i;
 
 		/* Note that only the low-address shortword of setup_frame is valid!
 		   The values are doubled for big-endian architectures. */
 		if (dev->mc_count > 14) { /* Must use a multicast hash table. */
 			u16 hash_table[32];
-			tx_flags = 0x08400000 | 192;		/* Use hash filter. */
+            tx_flags = (TxControlSetup |
+                        TxControlFiltType0 |
+                        SETUP_FRAME_SIZE);       /* Use hash filter. */
 			memset(hash_table, 0, sizeof(hash_table));
 			set_bit(255, hash_table); 			/* Broadcast entry */
 			/* This should work on big-endian machines as well. */
@@ -3126,19 +3335,19 @@
 				/* Avoid a chip errata by prefixing a dummy entry. */
 				tp->tx_skbuff[entry] = 0;
 				tp->tx_ring[entry].length =
-					(entry == TX_RING_SIZE-1) ? DESC_RING_WRAP : 0;
+                    (entry == TX_RING_SIZE-1) ? TxControlTlast : 0;
 				tp->tx_ring[entry].buffer1 = 0;
-				tp->tx_ring[entry].status = DescOwned;
+                tp->tx_ring[entry].status = TxStatusOwned;
 				entry = tp->cur_tx++ % TX_RING_SIZE;
 			}
 
 			tp->tx_skbuff[entry] = 0;
 			/* Put the setup frame on the Tx list. */
 			if (entry == TX_RING_SIZE-1)
-				tx_flags |= DESC_RING_WRAP;		/* Wrap ring. */
+                tx_flags |= TxControlTlast;     /* Wrap ring. */
 			tp->tx_ring[entry].length = tx_flags;
 			tp->tx_ring[entry].buffer1 = virt_to_bus(tp->setup_frame);
-			tp->tx_ring[entry].status = DescOwned;
+            tp->tx_ring[entry].status = TxStatusOwned;
 			if (tp->cur_tx - tp->dirty_tx >= TX_RING_SIZE - 2) {
 				set_bit(0, (void*)&dev->tbusy);
 				tp->tx_full = 1;
@@ -3285,5 +3494,6 @@
  *  c-indent-level: 4
  *  c-basic-offset: 4
  *  tab-width: 4
+ *  indent-tabs-mode: nil
  * End:
  */