Update of /cvsroot/linux-vax/kernel-2.4/drivers/net
In directory usw-pr-cvs1:/tmp/cvs-serv25913
Modified Files:
vaxsgec.c vaxsgec.h
Log Message:
The Tx and Rx ring sizes need to be an exponent of 2 since we use bitwise-AND
to implement modular arithmetic on them.
Also fixed Tx and Rx comments in the header file were backwards.
Both based on Christoph's patch.
Index: vaxsgec.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- vaxsgec.c 23 May 2002 20:34:15 -0000 1.5
+++ vaxsgec.c 26 May 2002 02:02:20 -0000 1.6
@@ -36,7 +36,7 @@
#include "vaxsgec.h"
#define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
- lp->tx_old+TX_RING_MOD_MASK-lp->tx_new:\
+ lp->tx_old+TX_RING_MASK-lp->tx_new:\
lp->tx_old - lp->tx_new-1)
@@ -224,7 +224,7 @@
lp->stats.rx_dropped++;
//rd->mblength = 0;
rd->framelen = SG_FR_OWN;
- lp->rx_new =(lp->rx_new+1) & RX_RING_MOD_MASK;
+ lp->rx_new =(lp->rx_new+1) & RX_RING_MASK;
return 0;
/* } */
lp->stats.rx_bytes += len;
@@ -243,7 +243,7 @@
// rd->mblength=0;
rd->framelen = len;
rd->framelen &= SG_FR_OWN;
- lp->rx_new = (lp->rx_new + 1) & RX_RING_MOD_MASK;
+ lp->rx_new = (lp->rx_new + 1) & RX_RING_MASK;
}
return 0;
}
@@ -316,7 +316,7 @@
*/
lp->stats.tx_packets++;
}
- j = (j + 1) & TX_RING_MOD_MASK;
+ j = (j + 1) & TX_RING_MASK;
}
lp->tx_old = j;
out:
@@ -370,11 +370,11 @@
/* we should load the rest of the frame with multicast addresses */
#if 0
- entry = lp->tx_new & TX_RING_MOD_MASK;
+ entry = lp->tx_new & TX_RING_MASK;
ib->tx_ring[entry].flags1 = len;
cp_to_buf((char *) lp->sgec_mem->tx_buf[entry], skb->data, skblen);
ib->tx_ring[entry].flags1 = SG_TDR_OWN | SG_TD1_POK; /* (LE_T1_POK | LE_T1_OWN);*/
- lp->tx_new = (lp->tx_new + 1) & TX_RING_MOD_MASK;
+ lp->tx_new = (lp->tx_new + 1) & TX_RING_MASK;
if (TX_BUFFS_AVAIL <= 0)
netif_stop_queue(dev);
kick_sgec(regs); /* we don't need to TXPD if it's already going, right? */
@@ -518,7 +518,7 @@
lp->stats.tx_bytes += len;
- entry = lp->tx_new & TX_RING_MOD_MASK;
+ entry = lp->tx_new & TX_RING_MASK;
lp->tx_ring[entry].flags1 = len;
cp_to_buf((char *) lp->card_mem->tx_buf[entry], skb->data, skblen);
@@ -531,7 +531,7 @@
*/
/* Now, give the packet to the card */
lp->tx_ring[entry].flags1 = SG_TDR_OWN | SG_TD1_POK; /* (LE_T1_POK | LE_T1_OWN);*/
- lp->tx_new = (lp->tx_new + 1) & TX_RING_MOD_MASK;
+ lp->tx_new = (lp->tx_new + 1) & TX_RING_MASK;
if (TX_BUFFS_AVAIL <= 0)
netif_stop_queue(dev);
Index: vaxsgec.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vaxsgec.h 23 May 2002 16:11:02 -0000 1.1
+++ vaxsgec.h 26 May 2002 02:02:20 -0000 1.2
@@ -106,7 +106,7 @@
/* NICSR15: monitor command */
-/* transmit descriptor flags */
+/* Receive descriptor bits */
#define SG_FR_OWN 0x8000 /* We own the descriptor */
#define SG_R0_ERR 0x8000 /* an error occurred */
#define SG_R0_LEN 0x4000 /* length error */
@@ -129,7 +129,7 @@
#define SG_R1_VAD 0x40 /* virtual address */
#define SG_R1_VPA 0x20 /* virtual/physical PTE address */
-/* Receive descriptor bits */
+/* Transmit descriptor bits */
#define SG_TDR_OWN 0x8000 /* SGEC owns this descriptor */
#define SG_TD0_ES 0x8000 /* an error has occurred */
#define SG_TD0_TO 0x4000 /* transmit watchdog timeout */
@@ -189,15 +189,11 @@
#define SG_CSR14 56
#define SG_CSR15 60
-/* must be an even number of receive/transmit descriptors */
-#define RXDESCS 30 /* no of receive descriptors */
-#define TXDESCS 60 /* no of transmit descriptors */
-
-#define TX_RING_SIZE 60
-#define TX_RING_MOD_MASK 59
-
-#define RX_RING_SIZE 30
-#define RX_RING_MOD_MASK 29
+/* Tx and Rx ring size must be an exponent of 2 */
+#define TX_RING_SIZE 64
+#define TX_RING_MASK (TX_RING_SIZE - 1)
+#define RX_RING_SIZE 32
+#define RX_RING_MASK (TX_RING_SIZE - 1)
#define PKT_BUF_SZ 1536
#define RX_BUFF_SIZE PKT_BUF_SZ
|