Re: D-LINK DFE-530-TX [patch]

2000-12-14 Thread Urban Widmark

On Wed, 13 Dec 2000, Alan Cox wrote:

> > > > Becker's site http://www.scyld.com/network.
> > > 2.4.x-test has some fixes for via-rhine which don't appear to have made
> > > it into the Becker driver yet...
> > 
> > Is either of these likely to make it into the stock 2.2 via-rhine?
> 
> If someone ports them over for an earlyish 2.2.19pre

Your wish ...

Below a patch that updates the 2.2 via-rhine driver from Becker's 1.08b,
except for the pci probing that is unchanged, compatibility macros and
dead code that are not needed in 2.2 removed (removing ifdef CARDBUS is
from 1.08b) and "clear_tally_counters" from 2.4.

It would be nice if people using 2.2 and one of these cards could test
this too.

Patch includes:
+ new VT6102 pci id & supporting non-aligned data buffers for that chip
+ completely untested (by me, that is) big<->little endian stuff
+ free allocated memory on driver unload
+ no more writel to 0x7c.
+ 2 16bit values accessed as one 32bit (why? not sure, pci optimization?)
+ change transmit ring size
and some other more or less minor changes/cleanups.

This is mostly a copy operation. If you'd rather get a smaller
change for just supporting the VT6102 that is easy to do.

However, this is very similar to the 2.4 driver (locking is a major diff)
so I hope it is ok. Also, if I don't include most of the 1.08b driver I'm
not sure what version name to give it ... :)

/Urban


diff -ur -X exclude linux-2.2.18-orig/drivers/net/via-rhine.c 
linux/drivers/net/via-rhine.c
--- linux-2.2.18-orig/drivers/net/via-rhine.c   Wed Dec 13 21:27:37 2000
+++ linux/drivers/net/via-rhine.c   Fri Dec 15 00:03:59 2000
@@ -1,35 +1,44 @@
 /* via-rhine.c: A Linux Ethernet device driver for VIA Rhine family chips. */
 /*
-   Written 1998-1999 by Donald Becker.
+   Written 1998-2000 by Donald Becker.
 
-   This software may be used and distributed according to the terms
-   of the GNU Public License (GPL), incorporated herein by reference.
-   Drivers derived from this code also fall under the GPL and must retain
-   this authorship and copyright notice.
+   This software may be used and distributed according to the terms of
+   the GNU General Public License (GPL), incorporated herein by reference.
+   Drivers based on or derived from this code fall under the GPL and must
+   retain the authorship, copyright and license notice.  This file is not
+   a complete program and may only be used when the entire operating
+   system is licensed under the GPL.
 
This driver is designed for the VIA VT86c100A Rhine-II PCI Fast Ethernet
controller.  It also works with the older 3043 Rhine-I chip.
 
-   The author may be reached as [EMAIL PROTECTED], or
-   Donald Becker
-   312 Severn Ave. #W302
+   The author may be reached as [EMAIL PROTECTED], or C/O
+   Scyld Computing Corporation
+   410 Severn Ave., Suite 210
Annapolis MD 21403
 
Support and updates available at
-   http://cesdis.gsfc.nasa.gov/linux/drivers/via-rhine.html
+   http://www.scyld.com/network/via-rhine.html
+
+
+   Linux kernel version history:
+
+   LK1.0.0:
+   - Urban Widmark: merges from Beckers 1.08b version and 2.4.0 (VT6102)
 */
 
-static const char *versionA =
-"via-rhine.c:v1.01 2/27/99  Written by Donald Becker\n";
-static const char *versionB =
-"  http://cesdis.gsfc.nasa.gov/linux/drivers/via-rhine.html\n";
+/* These identify the driver base version and may not be removed. */
+static const char version1[] =
+"via-rhine.c:v1.08b-LK1.0.0 12/14/2000  Written by Donald Becker\n";
+static const char version2[] =
+"  http://www.scyld.com/network/via-rhine.html\n";
 
-/* A few user-configurable values.   These may be modified when a driver
-   module is loaded.*/
+/* The user-configurable values.
+   These may be modified when a driver module is loaded.*/
 
 static int debug = 1;  /* 1 normal messages, 0 quiet .. 7 verbose. */
 static int max_interrupt_work = 20;
-static int min_pci_latency = 64;
+static int min_pci_latency = 32;
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to > 1518 effectively disables this feature. */
@@ -55,7 +64,8 @@
Making the Tx ring too large decreases the effectiveness of channel
bonding and packet priority.
There are no ill effects from too-large receive rings. */
-#define TX_RING_SIZE   8
+#define TX_RING_SIZE   16
+#define TX_QUEUE_LEN   10  /* Limit ring entries actually used.  */
 #define RX_RING_SIZE   16
 
 /* Operational parameters that usually are not changed. */
@@ -64,9 +74,15 @@
 
 #define PKT_BUF_SZ 1536/* Size of each temporary Rx 
buffer.*/
 
+
+#if !defined(__OPTIMIZE__)
+#warning  You must compile this file with the correct options!
+#warning  See the last lines of the source file.
+#error  You must compile this driver with "-O".
+#endif
+
 #include 
 #include 
-#include 
 #include 
 

Re: D-LINK DFE-530-TX [patch]

2000-12-14 Thread Urban Widmark

On Wed, 13 Dec 2000, Alan Cox wrote:

Becker's site http://www.scyld.com/network.
   2.4.x-test has some fixes for via-rhine which don't appear to have made
   it into the Becker driver yet...
  
  Is either of these likely to make it into the stock 2.2 via-rhine?
 
 If someone ports them over for an earlyish 2.2.19pre

Your wish ...

Below a patch that updates the 2.2 via-rhine driver from Becker's 1.08b,
except for the pci probing that is unchanged, compatibility macros and
dead code that are not needed in 2.2 removed (removing ifdef CARDBUS is
from 1.08b) and "clear_tally_counters" from 2.4.

It would be nice if people using 2.2 and one of these cards could test
this too.

Patch includes:
+ new VT6102 pci id  supporting non-aligned data buffers for that chip
+ completely untested (by me, that is) big-little endian stuff
+ free allocated memory on driver unload
+ no more writel to 0x7c.
+ 2 16bit values accessed as one 32bit (why? not sure, pci optimization?)
+ change transmit ring size
and some other more or less minor changes/cleanups.

This is mostly a copypaste operation. If you'd rather get a smaller
change for just supporting the VT6102 that is easy to do.

However, this is very similar to the 2.4 driver (locking is a major diff)
so I hope it is ok. Also, if I don't include most of the 1.08b driver I'm
not sure what version name to give it ... :)

/Urban


diff -ur -X exclude linux-2.2.18-orig/drivers/net/via-rhine.c 
linux/drivers/net/via-rhine.c
--- linux-2.2.18-orig/drivers/net/via-rhine.c   Wed Dec 13 21:27:37 2000
+++ linux/drivers/net/via-rhine.c   Fri Dec 15 00:03:59 2000
@@ -1,35 +1,44 @@
 /* via-rhine.c: A Linux Ethernet device driver for VIA Rhine family chips. */
 /*
-   Written 1998-1999 by Donald Becker.
+   Written 1998-2000 by Donald Becker.
 
-   This software may be used and distributed according to the terms
-   of the GNU Public License (GPL), incorporated herein by reference.
-   Drivers derived from this code also fall under the GPL and must retain
-   this authorship and copyright notice.
+   This software may be used and distributed according to the terms of
+   the GNU General Public License (GPL), incorporated herein by reference.
+   Drivers based on or derived from this code fall under the GPL and must
+   retain the authorship, copyright and license notice.  This file is not
+   a complete program and may only be used when the entire operating
+   system is licensed under the GPL.
 
This driver is designed for the VIA VT86c100A Rhine-II PCI Fast Ethernet
controller.  It also works with the older 3043 Rhine-I chip.
 
-   The author may be reached as [EMAIL PROTECTED], or
-   Donald Becker
-   312 Severn Ave. #W302
+   The author may be reached as [EMAIL PROTECTED], or C/O
+   Scyld Computing Corporation
+   410 Severn Ave., Suite 210
Annapolis MD 21403
 
Support and updates available at
-   http://cesdis.gsfc.nasa.gov/linux/drivers/via-rhine.html
+   http://www.scyld.com/network/via-rhine.html
+
+
+   Linux kernel version history:
+
+   LK1.0.0:
+   - Urban Widmark: merges from Beckers 1.08b version and 2.4.0 (VT6102)
 */
 
-static const char *versionA =
-"via-rhine.c:v1.01 2/27/99  Written by Donald Becker\n";
-static const char *versionB =
-"  http://cesdis.gsfc.nasa.gov/linux/drivers/via-rhine.html\n";
+/* These identify the driver base version and may not be removed. */
+static const char version1[] =
+"via-rhine.c:v1.08b-LK1.0.0 12/14/2000  Written by Donald Becker\n";
+static const char version2[] =
+"  http://www.scyld.com/network/via-rhine.html\n";
 
-/* A few user-configurable values.   These may be modified when a driver
-   module is loaded.*/
+/* The user-configurable values.
+   These may be modified when a driver module is loaded.*/
 
 static int debug = 1;  /* 1 normal messages, 0 quiet .. 7 verbose. */
 static int max_interrupt_work = 20;
-static int min_pci_latency = 64;
+static int min_pci_latency = 32;
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
Setting to  1518 effectively disables this feature. */
@@ -55,7 +64,8 @@
Making the Tx ring too large decreases the effectiveness of channel
bonding and packet priority.
There are no ill effects from too-large receive rings. */
-#define TX_RING_SIZE   8
+#define TX_RING_SIZE   16
+#define TX_QUEUE_LEN   10  /* Limit ring entries actually used.  */
 #define RX_RING_SIZE   16
 
 /* Operational parameters that usually are not changed. */
@@ -64,9 +74,15 @@
 
 #define PKT_BUF_SZ 1536/* Size of each temporary Rx 
buffer.*/
 
+
+#if !defined(__OPTIMIZE__)
+#warning  You must compile this file with the correct options!
+#warning  See the last lines of the source file.
+#error  You must compile this driver with "-O".
+#endif
+
 #include linux/module.h
 #include linux/kernel.h
-#include